Project

General

Profile

« Previous | Next » 

Revision dfd4bd12

Added by Jérôme Schneider over 12 years ago

dossiers: improve urls and support delete contact or address

View differences:

calebasse/dossiers/templates/dossiers/patientaddress_confirm_delete.html
1
{% load widget_tweaks %}
2

  
3
{% if error_message %}
4
<p><strong>{{ error_message }}</strong></p>
5
{% endif %}
6
<form action="{{ request.get_full_path }}" method="post">{% csrf_token %}
7
  <p>Êtes-vous sûr de vouloir supprimer l'adresse : {{ object.display_name }} ?</p>
8
</form>
calebasse/dossiers/templates/dossiers/patientaddress_form.html
1

  
2
{% load widget_tweaks %}
3

  
4
<form action="{{ request.get_full_path }}" method="post">
5
  {% csrf_token %}
6
  <table>
7
    <tbody>
8
      <tr>
9
        <p>
10
        </p>
11
        <td>
12
          {{ form.number.label_tag }} :<br>
13
          {{ form.number }}
14
          {{ form.number.errors }}
15
        </td>
16
        <td>
17
          {{ form.street.label_tag }} :<br>
18
          {{ form.street }}
19
          {{ form.street.errors }}
20
        </td>
21
      </tr>
22
      <tr>
23
        <td></td>
24
        <td>
25
          {{ form.address_complement.label_tag }} :<br>
26
          {{ form.address_complement }}
27
          {{ form.address_complement.errors }}
28
        </td>
29
      </tr>
30
      <tr>
31
        <td>
32
          {{ form.zip_code.label_tag }} :<br>
33
          {{ form.zip_code }}
34
          {{ form.zip_code.errors }}
35
        </td>
36
        <td>
37
          {{ form.city.label_tag }} :<br>
38
          {{ form.city }}
39
          {{ form.city.errors }}
40
        </td>
41
      </tr>
42
      <tr>
43
        <td>
44
          {{ form.phone.label_tag }} :<br>
45
          {{ form.phone }}
46
          {{ form.phone.errors }}
47
        </td>
48
        <td>
49
          {{ form.fax.label_tag }} :<br>
50
          {{ form.fax }}
51
          {{ form.fax.errors }}
52
        </td>
53
      </tr>
54
    </tbody>
55
  </table>
56
  <br>
57
  <p>
58
  {{ form.place_of_life.label_tag }}
59
  {{ form.place_of_life }}
60
  {{ form.place_of_life.errors }}
61
  </p>
62
  <p>
63
  {{ form.comment.label_tag }} {{ form.comment }}
64
  {{ form.comment.errors }}
65
  </p>
66
</form>
calebasse/dossiers/templates/dossiers/patientaddress_new.html
1

  
2
{% load widget_tweaks %}
3

  
4
<form action="{{ request.get_full_path }}" method="post">
5
  {% csrf_token %}
6
  <table>
7
    <tbody>
8
      <tr>
9
        <p>
10
        </p>
11
        <td>
12
          {{ form.number.label_tag }} :<br>
13
          {{ form.number }}
14
          {{ form.number.errors }}
15
        </td>
16
        <td>
17
          {{ form.street.label_tag }} :<br>
18
          {{ form.street }}
19
          {{ form.street.errors }}
20
        </td>
21
      </tr>
22
      <tr>
23
        <td></td>
24
        <td>
25
          {{ form.address_complement.label_tag }} :<br>
26
          {{ form.address_complement }}
27
          {{ form.address_complement.errors }}
28
        </td>
29
      </tr>
30
      <tr>
31
        <td>
32
          {{ form.zip_code.label_tag }} :<br>
33
          {{ form.zip_code }}
34
          {{ form.zip_code.errors }}
35
        </td>
36
        <td>
37
          {{ form.city.label_tag }} :<br>
38
          {{ form.city }}
39
          {{ form.city.errors }}
40
        </td>
41
      </tr>
42
      <tr>
43
        <td>
44
          {{ form.phone.label_tag }} :<br>
45
          {{ form.phone }}
46
          {{ form.phone.errors }}
47
        </td>
48
        <td>
49
          {{ form.fax.label_tag }} :<br>
50
          {{ form.fax }}
51
          {{ form.fax.errors }}
52
        </td>
53
      </tr>
54
    </tbody>
55
  </table>
56
  <br>
57
  <p>
58
  {{ form.place_of_life.label_tag }}
59
  {{ form.place_of_life }}
60
  {{ form.place_of_life.errors }}
61
  </p>
62
  <p>
63
  {{ form.comment.label_tag }} {{ form.comment }}
64
  {{ form.comment.errors }}
65
  </p>
66
</form>
calebasse/dossiers/templates/dossiers/patientcontact_confirm_delete.html
1
{% load widget_tweaks %}
2

  
3
{% if error_message %}
4
<p><strong>{{ error_message }}</strong></p>
5
{% endif %}
6
<form action="{{ request.get_full_path }}" method="post">{% csrf_token %}
7
  <p>Êtes-vous sûr de vouloir supprimer l'adresse : {{ object.display_name }} ?</p>
8
</form>
calebasse/dossiers/templates/dossiers/patientcontact_form.html
1
{% load widget_tweaks %}
2

  
3
<form action="{{ request.get_full_path }}" enctype="multipart/form-data" method="post">
4
  {% csrf_token %}
5
  <table>
6
    <tbody>
7
      <tr>
8
        <p>
9
        </p>
10
        <td>
11
          {{ form.first_name.label_tag }} :<br>
12
          {{ form.first_name }}
13
          {{ form.first_name.errors }}
14
        </td>
15
        <td>
16
          {{ form.last_name.label_tag }} :<br>
17
          {{ form.last_name }}
18
          {{ form.last_name.errors }}
19
        </td>
20
        <td>
21
          {{ form.gender.label_tag }} :<br>
22
          {{ form.gender }}
23
          {{ form.gender.errors }}
24
        </td>
25
      </tr>
26
      <tr>
27
        <td>
28
          {{ form.mobile.label_tag }} :<br>
29
          {{ form.mobile }}
30
          {{ form.mobile.errors }}
31
        </td>
32
        <td>
33
          {{ form.email.label_tag }} :<br>
34
          {{ form.email }}
35
          {{ form.email.errors }}
36
        </td>
37
      </tr>
38
      <tr>
39
        <td>
40
          {{ form.birthdate.label_tag }} :<br>
41
          {{ form.birthdate }}
42
          {{ form.birthdate.errors }}
43
        </td>
44
        <td>
45
          {{ form.social_security_id.label_tag }} :<br>
46
          {{ form.social_security_id }}
47
          {{ form.social_security_id.errors }}
48
        </td>
49
        <td>
50
          {{ form.key.label_tag }} :<br>
51
          {{ form.key }}
52
          {{ form.key.errors }}
53
        </td>
54
      </tr>
55
      <tr>
56
        <td>
57
          {{ form.begin_rights.label_tag }} :<br>
58
          {{ form.begin_rights }}
59
          {{ form.begin_rights.errors }}
60
        </td>
61
        <td>
62
          {{ form.end_rights.label_tag }} :<br>
63
          {{ form.end_rights }}
64
          {{ form.end_rights.errors }}
65
        </td>
66
        <td>
67
          {{ form.twinning_rank.label_tag }} :<br>
68
          {{ form.twinning_rank }}
69
          {{ form.twinning_rank.errors }}
70
        </td>
71
      </tr>
72
      <tr>
73
        <td>
74
          {{ form.healt_fund.label_tag }} :<br>
75
          {{ form.healt_fund }}
76
          {{ form.healt_fund.errors }}
77
        </td>
78
        <td>
79
          {{ form.healt_center.label_tag }} :<br>
80
          {{ form.healt_center }}
81
          {{ form.healt_center.errors }}
82
        </td>
83
    </tbody>
84
  </table>
85
  <p>
86
  {{ form.addresses.label_tag }}
87
  {{ form.addresses }}
88
  {{ form.addresses.errors }}
89
  </p>
90
  <p>
91
  {{ form.contact_comment.label_tag }}
92
  {{ form.contact_comment }}
93
  {{ form.contact_comment.errors }}
94
  </p>
95
 </form>
calebasse/dossiers/templates/dossiers/patientcontact_new.html
1
{% load widget_tweaks %}
2

  
3
<form action="{{ request.get_full_path }}" enctype="multipart/form-data" method="post">
4
  {% csrf_token %}
5
  <table>
6
    <tbody>
7
      <tr>
8
        <p>
9
        </p>
10
        <td>
11
          {{ form.first_name.label_tag }} :<br>
12
          {{ form.first_name }}
13
          {{ form.first_name.errors }}
14
        </td>
15
        <td>
16
          {{ form.last_name.label_tag }} :<br>
17
          {{ form.last_name }}
18
          {{ form.last_name.errors }}
19
        </td>
20
        <td>
21
          {{ form.gender.label_tag }} :<br>
22
          {{ form.gender }}
23
          {{ form.gender.errors }}
24
        </td>
25
      </tr>
26
      <tr>
27
        <td>
28
          {{ form.mobile.label_tag }} :<br>
29
          {{ form.mobile }}
30
          {{ form.mobile.errors }}
31
        </td>
32
        <td>
33
          {{ form.email.label_tag }} :<br>
34
          {{ form.email }}
35
          {{ form.email.errors }}
36
        </td>
37
      </tr>
38
      <tr>
39
        <td>
40
          {{ form.birthdate.label_tag }} :<br>
41
          {{ form.birthdate }}
42
          {{ form.birthdate.errors }}
43
        </td>
44
        <td>
45
          {{ form.social_security_id.label_tag }} :<br>
46
          {{ form.social_security_id }}
47
          {{ form.social_security_id.errors }}
48
        </td>
49
        <td>
50
          {{ form.key.label_tag }} :<br>
51
          {{ form.key }}
52
          {{ form.key.errors }}
53
        </td>
54
      </tr>
55
      <tr>
56
        <td>
57
          {{ form.begin_rights.label_tag }} :<br>
58
          {{ form.begin_rights }}
59
          {{ form.begin_rights.errors }}
60
        </td>
61
        <td>
62
          {{ form.end_rights.label_tag }} :<br>
63
          {{ form.end_rights }}
64
          {{ form.end_rights.errors }}
65
        </td>
66
        <td>
67
          {{ form.twinning_rank.label_tag }} :<br>
68
          {{ form.twinning_rank }}
69
          {{ form.twinning_rank.errors }}
70
        </td>
71
      </tr>
72
      <tr>
73
        <td>
74
          {{ form.healt_fund.label_tag }} :<br>
75
          {{ form.healt_fund }}
76
          {{ form.healt_fund.errors }}
77
        </td>
78
        <td>
79
          {{ form.healt_center.label_tag }} :<br>
80
          {{ form.healt_center }}
81
          {{ form.healt_center.errors }}
82
        </td>
83
    </tbody>
84
  </table>
85
  <p>
86
  {{ form.addresses.label_tag }}
87
  {{ form.addresses }}
88
  {{ form.addresses.errors }}
89
  </p>
90
  <p>
91
  {{ form.contact_comment.label_tag }}
92
  {{ form.contact_comment }}
93
  {{ form.contact_comment.errors }}
94
  </p>
95
 </form>
calebasse/dossiers/templates/dossiers/patientrecord_update.html
12 12
{% block content %}
13 13
<div id="tabs">
14 14
  <ul>
15
    <li><a href="#tabs-1">Général</a></li>
16
    <li><a href="#tabs-2">Fiche administrative</a></li>
17
    <li><a href="#tabs-3">Adresses / contacts</a></li>
18
    {% if object.service.name == "CMPP" %}<li><a href="#tabs-4">Prise en charge</a></li>{% endif %}
19
    {% if object.service.name == "SESSAD TED" or object.service.name == "SESSAD DYS" %}<li><a href="#tabs-4">Notifications</a></li>{% endif %}
20
    <li><a href="#tabs-5">Actes passés</a>
21
    <li><a href="#tabs-6">Prochains rendez-vous</a>
22
    <li><a href="#tabs-7">Socialisation</a>
23
    <li><a href="#tabs-8">Données à caractère médical</a>
15
    <li><a data-id="0" class="atabs" href="#tabs-1">Général</a></li>
16
    <li><a data-id="1" class="atabs" href="#tabs-2">Fiche administrative</a></li>
17
    <li><a data-id="2" class="atabs" href="#tabs-3">Adresses / contacts</a></li>
18
    {% if object.service.name == "CMPP" %}
19
    <li><a data-id="3"  class="atabs" href="#tabs-4">Prise en charge</a></li>
20
    {% endif %}
21
    {% if object.service.name == "SESSAD TED" or object.service.name == "SESSAD DYS" %}
22
    <li><a data-id="3" class="atabs" href="#tabs-4">Notifications</a></li>
23
    {% endif %}
24
    <li><a data-id="4" class="atabs" href="#tabs-5">Actes passés</a>
25
    <li><a data-id="5" class="atabs" href="#tabs-6">Prochains rendez-vous</a>
26
    <li><a data-id="6" class="atabs" href="#tabs-7">Socialisation</a>
27
    <li><a data-id="7" class="atabs" href="#tabs-8">Données à caractère médical</a>
24 28
  </ul>
25 29
  <div id="tabs-1"> <!-- Général -->
26 30
    <form method="post" id="general-form" class="patientrecordform">
......
251 255
        {% for address in object.addresses.all %}
252 256
        <div class="frame">
253 257
            <h3>{{ address.number }} {{ address.street }}</h3>
254
            <div class="buttons"><button>➖</button> <button>✍</button></div>
258
            <div class="buttons"><button data-id="{{ address.id }}" class="del-address">➖</button> <button>✍</button></div>
255 259
            <div class="right">
256 260
                <input type="checkbox" {% if address.place_of_life %}checked{% endif %}>Lieu de vie</input>
257 261
            </div>
......
259 263
            <p>{{ address.phone }}</p>
260 264
            {% for contact in address.patientcontact_set.all  %}
261 265
            <div class="contact{% if contact.id == object.id %} patient{% endif %}">
262
                <h4>{% if contact.gender == 1 %}M.{% else %}Mme{% endif %}
266
                <h4>{% if contact.gender == 1 %}M.{% elif contact.gender == 2 %}Mme{% endif %}
263 267
                    {{ contact.display_name }} {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
264 268
                <div class="right">
265 269
                    <input type="radio" name="radio-assure" checked="checked">Assuré</input>
266
                    <button>➖</button> <button>✍</button>
270
                    <button data-id="{{ contact.id }}" class="del-contact">➖</button> <button>✍</button>
267 271
                </div>
268 272
                <p>{{ contact.social_security_id }}</p>
269 273
                <p>{{ contact.mobile }}</p>
......
427 431
  </div>
428 432

  
429 433
  <div id="new-address-dlg" style="display: none;"></div>
434
  <div id="del-address-dlg" style="display: none;"></div>
430 435
  <div id="new-contact-dlg" style="display: none;"></div>
436
  <div id="del-contact-dlg" style="display: none;"></div>
431 437

  
432 438
  <div id="add-prise-en-charge-dlg" style="display: none;">
433 439
   <div>
calebasse/dossiers/urls.py
5 5
from models import PatientRecord
6 6
from views import (patientrecord_home, patient_record, state_form,
7 7
        new_patient_record, patientrecord_delete, new_patient_contact,
8
        new_patient_address)
8
        new_patient_address, delete_patient_contact, delete_patient_address)
9 9
from forms import EditPatientRecordForm
10 10

  
11 11
urlpatterns = patterns('',
......
13 13
        url(r'^new$', new_patient_record),
14 14
        url(r'^(?P<pk>\d+)/view$', patient_record),
15 15
        url(r'^(?P<pk>\d+)/delete$', patientrecord_delete),
16
        url(r'^(?P<patientrecord_id>\d+)/new-contact$', new_patient_contact),
17
        url(r'^(?P<patientrecord_id>\d+)/new-address$', new_patient_address),
18
        url(r'^(?P<pk>\d+)/update-state$', state_form),
16
        url(r'^(?P<patientrecord_id>\d+)/update-state$', state_form),
17
        url(r'^(?P<patientrecord_id>\d+)/address/new$', new_patient_address),
18
        url(r'^(?P<patientrecord_id>\d+)/address/(?P<pk>\d+)/del$', delete_patient_address),
19
        url(r'^(?P<patientrecord_id>\d+)/contact/new$', new_patient_contact),
20
        url(r'^(?P<patientrecord_id>\d+)/contact/(?P<pk>\d+)/del$', delete_patient_contact),
19 21
)
calebasse/dossiers/views.py
50 50
class NewPatientContactView(cbv.CreateView):
51 51
    model = PatientContact
52 52
    form_class = forms.PatientContactForm
53
    template_name = 'dossiers/patientcontact_form.html'
54
    success_url = './view#tab=2'
53
    template_name = 'dossiers/patientcontact_new.html'
54
    success_url = '../view#tab=2'
55 55

  
56 56
    def get(self, request, *args, **kwargs):
57 57
        if kwargs.has_key('patientrecord_id'):
......
60 60

  
61 61
new_patient_contact = NewPatientContactView.as_view()
62 62

  
63
class DeletePatientContactView(cbv.DeleteView):
64
    model = PatientContact
65
    form_class = forms.PatientContactForm
66
    template_name = 'dossiers/patientcontact_confirm_delete.html'
67
    success_url = '../../view#tab=2'
68

  
69
delete_patient_contact = DeletePatientContactView.as_view()
70

  
63 71
class NewPatientAddressView(cbv.CreateView):
64 72
    model = PatientAddress
65 73
    form_class = forms.PatientAddressForm
66
    template_name = 'dossiers/patientaddress_form.html'
67
    success_url = './view#tab=2'
74
    template_name = 'dossiers/patientaddress_new.html'
75
    success_url = '../view#tab=2'
68 76

  
69 77
    def get_success_url(self):
70 78
        return self.success_url
......
77 85

  
78 86
new_patient_address = NewPatientAddressView.as_view()
79 87

  
88
class DeletePatientAddressView(cbv.DeleteView):
89
    model = PatientAddress
90
    form_class = forms.PatientAddressForm
91
    template_name = 'dossiers/patientaddress_confirm_delete.html'
92
    success_url = '../../view#tab=2'
93

  
94
delete_patient_address = DeletePatientAddressView.as_view()
95

  
80 96
class StateFormView(cbv.FormView):
81 97
    template_name = 'dossiers/state.html'
82 98
    form_class = forms.StateForm
83
    success_url = '..'
99
    success_url = './view#tab=0'
84 100

  
85 101
    def post(self, request, *args, **kwarg):
86 102
        self.user = request.user
calebasse/static/js/calebasse.dossiers.js
32 32
  $(function() {
33 33
    var $tabs = $('#tabs').tabs();
34 34

  
35
    $('.atabs').click(function() {
36
        location.hash = 'tab=' + $(this).data('id');
37
    });
38

  
35 39
    $('#btn_all_state').click(function() {
36 40
      $('.checkbox_state').attr('checked', true);
37 41
    });
......
94 98
    });
95 99

  
96 100
    $('#new-address-btn').click(function() {
97
        generic_ajaxform_dialog('new-address', 'Ajouter une adresse',
101
        generic_ajaxform_dialog('address/new', 'Ajouter une adresse',
98 102
            '#new-address-dlg', '600px', 'Ajouter');
99 103
    });
100 104

  
101 105
    $('#new-contact-btn').click(function() {
102
        generic_ajaxform_dialog('new-contact', 'Ajouter un contact',
106
        generic_ajaxform_dialog('contact/new', 'Ajouter un contact',
103 107
            '#new-contact-dlg', '750px', 'Ajouter');
104 108
    });
105 109

  
110
    $('.del-address').click(function() {
111
        generic_ajaxform_dialog('address/' + $(this).data('id') + '/del', 'Supprimer une addresse',
112
            '#del-address-dlg', '500px', 'Supprimer');
113
    });
114
    $('.del-contact').click(function() {
115
        generic_ajaxform_dialog('contact/' + $(this).data('id') + '/del', 'Supprimer un contact',
116
            '#del-contact-dlg', '500px', 'Supprimer');
117
    });
118

  
106 119
    $('#add-prise-en-charge-btn').click(function() {
107 120
      $('#add-prise-en-charge-dlg').dialog({title: 'Prise en charge',
108 121
        width: '300px',

Also available in: Unified diff