dossiers: use the new comment field for addresses and contacts (fixes #4372).

This commit is contained in:
Mikaël Ates 2014-10-03 09:28:16 +02:00
parent c69fae347b
commit a869df8f3d
8 changed files with 24 additions and 17 deletions

View File

@ -173,13 +173,20 @@ class PaperIDForm(ModelForm):
model = PatientRecord
fields = ('paper_id', )
class AddrCommentForm(ModelForm):
class Meta:
model = PatientRecord
fields = ('addresses_contacts_comment', )
widgets = {
'addresses_contacts_comment': forms.Textarea(attrs={'cols': 50, 'rows': 2}),
}
class PolicyHolderForm(ModelForm):
class Meta:
model = PatientRecord
fields = ('policyholder', 'contact_comment')
widgets = {
fields = ('policyholder',)
widgets = {
'policyholder': forms.RadioSelect(),
'contact_comment': forms.Textarea(attrs={'cols': 50, 'rows': 2}),
}
class PatientContactForm(ModelForm):

View File

@ -24,15 +24,14 @@ errors:
</ul>
<h3>Adresse</h3>
<p><strong>Commentaire :</strong> <br />
{{ object.policyholder.contact_comment }}
</p>
{% if object.addresses_contacts_comment %}<p>Commentaire : <strong>{{ object.addresses_contacts_comment }}</strong></p>{% endif %}
<ul class="addresses">
{% for address in object.addresses.all %}
<li>
<span>{{ address.display_name }} {% if address.phone %}(Tél : {{ address.phone }}){% endif %}</span>
<pre>{{ address.comment }}</pre>
{% if address.comment %}<p><em>Commentaire : {{ address.comment }}</em></p>{% endif %}
<ul>
{% if address.recipient %}
<li><input type="radio" name="contact" id="contact_{{ address.id }}_{{ contact.id }}"

View File

@ -56,9 +56,7 @@
{% else %}
<label class="highlight">Aucun lieu de vie d'indiqué</label>
{% endif %}
{% if object.contact_comment %}
<p>{{ object.contact_comment }}</p>
{% endif %}
{% if object.addresses_contacts_comment %}<p>Commentaire : <strong>{{ object.addresses_contacts_comment }}</strong></p>{% endif %}
{% if object.addresses.all %}
<ul>
{% for address in object.addresses.all %}

View File

@ -20,7 +20,7 @@
{% else %}
<label class="highlight">Aucun lieu de vie n'est indiqué.</label>
{% endif %}
{% if object.contact_comment %}<p>{{ object.contact_comment|linebreaks }}</p>{% endif %}
{% if object.addresses_contacts_comment %}<p><strong>{{ object.addresses_contacts_comment }}</strong></p>{% endif %}
{% if object.addresses.all %}
<ul>
{% for address in object.addresses.all %}

View File

@ -5,7 +5,6 @@
{% load dossiers %}
{% block content %}
<div id="tabs-3">
<form method="post" action="tab3" id="policyholder-form" class="patientrecordform">{% csrf_token %}
<p>
{% if nb_place_of_lifes == 1 %}
<span>Un lieu de vie unique est indiqué</span>
@ -15,15 +14,19 @@
<span class="highlight">Aucun lieu de vie n'est indiqué.</span>
{% endif %}
</p>
<form method="post" action="tab3" class="autosubmit-form patientrecordform">{% csrf_token %}
<p>
<label>Commentaire <button class="save enable-on-change btn-maj"></button></label>
{{ forms.policyholder.contact_comment }}
{{ forms.comment.addresses_contacts_comment }}
</p>
</form>
<p>
<button type="button" id="new-address-btn" class="icon-home-space">Nouvelle adresse</button>
<button type="button" id="new-contact-btn" class="icon-user-space">Nouveau contact</button>
</p>
<form method="post" action="tab3" class="autosubmit-form patientrecordform">{% csrf_token %}
<div class="contact patient">
<h4 class="icon-user-space">Patient</h4>
<div class="right">Assuré

View File

@ -334,7 +334,8 @@ class PatientRecordAddrView(cbv.ServiceViewMixin, cbv.NotificationDisplayView, c
model = PatientRecord
forms_classes = {
'contact': forms.PatientContactForm,
'policyholder': forms.PolicyHolderForm
'policyholder': forms.PolicyHolderForm,
'comment' : forms.AddrCommentForm,
}
template_name = 'dossiers/patientrecord_tab3_adresses.html'
success_url = './view#tab=2'

View File

@ -99,7 +99,7 @@ div#tabs-4 div div.buttons {
width: 85%;
}
#id_policyholder-contact_comment {
#id_comment-addresses_contacts_comment {
margin: 0;
}

View File

@ -201,7 +201,7 @@ function load_tab3_addresses() {
});
}
$('.autosubmit').on('click', function() {
$('#policyholder-form').submit();
$('.autosubmit-form').submit();
});
$('#new-contact-btn').click(function() {
generic_ajaxform_dialog('contact/new', 'Ajouter un contact',
@ -475,4 +475,3 @@ function load_tab8_medical() {
});
})(window.jQuery)