Revision 1a9b2fe9
Added by Jérôme Schneider over 13 years ago
| calebasse/dossiers/templates/dossiers/patientcontact_form.html | ||
|---|---|---|
|
{% load widget_tweaks %}
|
||
|
|
||
|
<form action="{{ request.get_full_path }}" method="post">
|
||
|
<form action="{{ request.get_full_path }}" enctype="multipart/form-data" method="post">
|
||
|
{% csrf_token %}
|
||
|
<table>
|
||
|
<tbody>
|
||
| calebasse/dossiers/templates/dossiers/patientrecord_update.html | ||
|---|---|---|
|
<div id="tabs-3"> <!-- Adresses / Contacts -->
|
||
|
<button id="new-address-btn">Nouvelle adresse</button>
|
||
|
<button id="new-contact-btn">Nouveau contact</button>
|
||
|
{% for address in object.addresses.all %}
|
||
|
<div class="frame">
|
||
|
<h3>{{ address.number }} {{ address.street }}</h3>
|
||
|
<div class="buttons"><button>➖</button> <button>✍</button></div>
|
||
|
<div class="right">
|
||
|
<input type="checkbox" checked>Lieu de vie</input>
|
||
|
{% for address in object.addresses.all %}
|
||
|
<div class="frame">
|
||
|
<h3>{{ address.number }} {{ address.street }}</h3>
|
||
|
<div class="buttons"><button>➖</button> <button>✍</button></div>
|
||
|
<div class="right">
|
||
|
<input type="checkbox" {% if address.place_of_life %}checked{% endif %}>Lieu de vie</input>
|
||
|
</div>
|
||
|
<p>{{ address.zip_code }} {{ address.city }}</p>
|
||
|
<p>{{ address.phone }}</p>
|
||
|
{% for contact in address.patientcontact_set.all %}
|
||
|
<div class="contact{% if contact.id == object.id %} patient{% endif %}">
|
||
|
<h4>{% if contact.gender == 1 %}M.{% else %}Mme{% endif %}
|
||
|
{{ contact.display_name }} {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
|
||
|
<div class="right">
|
||
|
<input type="radio" name="radio-assure" checked="checked">Assuré</input>
|
||
|
<button>➖</button> <button>✍</button>
|
||
|
</div>
|
||
|
<p>{{ contact.social_security_id }}</p>
|
||
|
<p>{{ contact.mobile }}</p>
|
||
|
</div>
|
||
|
{% endfor %}
|
||
|
</div>
|
||
|
<p>{{ address.zip_code }} {{ address.city }}</p>
|
||
|
<p>{{ address.phone }}</p>
|
||
|
{% for contact in address.patientcontact_set.all %}
|
||
|
<div class="contact{% if contact.id == object.id %} patient{% endif %}">
|
||
|
<h4>{% if contact.gender == 1 %}M.{% else %}Mme{% endif %}
|
||
|
{{ contact.display_name }} {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
|
||
|
<div class="right">
|
||
|
<input type="radio" name="radio-assure" checked="checked">Assuré</input>
|
||
|
<button>➖</button> <button>✍</button>
|
||
|
</div>
|
||
|
<p>{{ contact.social_security_id }}</p>
|
||
|
<p>{{ contact.mobile }}</p>
|
||
|
</div>
|
||
|
{% endfor %}
|
||
|
{% endfor %}
|
||
|
{% endfor %}
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div id="tabs-4"> <!-- Prise en charge -->
|
||
|
<div id="patient-diag" style="display: none;">
|
||
|
<div id="patient-diag">
|
||
|
<div class="frame">
|
||
|
<h3>En diagnostic depuis le 11 juin 2012</h3>
|
||
|
<ul>
|
||
| ... | ... | |
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div id="patient-traitement" style="display: none;">
|
||
|
<div id="patient-traitement">
|
||
|
<div class="frame">
|
||
|
<h3>En diagnostic depuis le 6 mars 2012</h3>
|
||
|
<ul>
|
||
| calebasse/dossiers/views.py | ||
|---|---|---|
|
from datetime import datetime
|
||
|
|
||
|
from django.views.generic.edit import DeleteView
|
||
|
from django.core.urlresolvers import reverse_lazy
|
||
|
from django.http import HttpResponseRedirect
|
||
|
from django.views.generic.edit import DeleteView, FormMixin
|
||
|
|
||
|
from calebasse import cbv
|
||
|
from calebasse.dossiers import forms
|
||
| ... | ... | |
|
|
||
|
new_patient_record = NewPatientRecordView.as_view()
|
||
|
|
||
|
class PatientContactView(cbv.FormView):
|
||
|
class NewPatientContactView(cbv.CreateView):
|
||
|
model = PatientContact
|
||
|
form_class = forms.PatientContactForm
|
||
|
template_name = 'dossiers/patientcontact_form.html'
|
||
|
success_url = '..'
|
||
|
success_url = './view#tab=2'
|
||
|
|
||
|
def get(self, request, *args, **kwargs):
|
||
|
if kwargs.has_key('patientrecord_id'):
|
||
|
request.session['patientrecord_id'] = kwargs['patientrecord_id']
|
||
|
return super(PatientContactView, self).get(request, *args, **kwargs)
|
||
|
return super(NewPatientContactView, self).get(request, *args, **kwargs)
|
||
|
|
||
|
new_patient_contact = PatientContactView.as_view()
|
||
|
new_patient_contact = NewPatientContactView.as_view()
|
||
|
|
||
|
class PatientAddressView(cbv.FormView):
|
||
|
class NewPatientAddressView(cbv.CreateView):
|
||
|
model = PatientAddress
|
||
|
form_class = forms.PatientAddressForm
|
||
|
template_name = 'dossiers/patientaddress_form.html'
|
||
|
success_url = '..'
|
||
|
success_url = './view#tab=2'
|
||
|
|
||
|
def get_success_url(self):
|
||
|
return self.success_url
|
||
|
|
||
|
def form_valid(self, form):
|
||
|
patientaddress = form.save()
|
||
|
patientrecord = PatientRecord.objects.get(id=self.kwargs['patientrecord_id'])
|
||
|
patientrecord.addresses.add(patientaddress)
|
||
|
return HttpResponseRedirect(self.get_success_url())
|
||
|
|
||
|
new_patient_address = PatientAddressView.as_view()
|
||
|
new_patient_address = NewPatientAddressView.as_view()
|
||
|
|
||
|
class StateFormView(cbv.FormView):
|
||
|
template_name = 'dossiers/state.html'
|
||
| calebasse/personnes/models.py | ||
|---|---|---|
|
display_name = models.CharField(max_length=256,
|
||
|
verbose_name=u'Nom complet', editable=False)
|
||
|
gender = models.IntegerField(verbose_name=u"Genre", choices=GENDERS,
|
||
|
max_length=1, default=0, blank=True)
|
||
|
max_length=1, blank=True, null=True)
|
||
|
|
||
|
def save(self, **kwargs):
|
||
|
self.display_name = self.first_name + ' ' + self.last_name
|
||
| calebasse/static/js/calebasse.dossiers.js | ||
|---|---|---|
|
var tabid = $.url($(location).attr('href')).fparam('tab');
|
||
|
if (tabid) {
|
||
|
$tabs.tabs('select', parseInt(tabid));
|
||
|
location.hash = '';
|
||
|
}
|
||
|
});
|
||
|
})(window.jQuery)
|
||
Also available in: Unified diff
dossiers: finish add contact and address forms