Project

General

Profile

« Previous | Next » 

Revision 72f229a9

Added by Jérôme Schneider about 11 years ago

agenda: synchronize enventwithact description with act comment

Ref #4006

View differences:

calebasse/agenda/appointments.py
28 28
        self.workers = None
29 29
        self.workers_initial = None
30 30
        self.workers_codes = None
31
        self.act_id = None
31 32
        self.act_state = None
32 33
        self.act_absence = None
33 34
        self.weight = 0
......
73 74
        self.len_workers = event.participants.count()
74 75
        self.workers_absent = event.get_missing_participants()
75 76
        if event.event_type.id == 1:
77
            self.act_id = event.act.id
76 78
            self.convocation_sent = event.convocation_sent
77 79
            self.patient = event.patient
78 80
            self.patient_record_id = event.patient.id
79 81
            self.patient_record_paper_id = event.patient.paper_id
80 82
            self.act_type = event.act_type.name
83
            self.description = event.act.comment
81 84
            self.is_billed = event.act.is_billed
82 85
            state = event.get_state()
83 86
            state_name = state.state_name if state else 'NON_VALIDE'
calebasse/agenda/templates/agenda/ajax-worker-tab.html
126 126
       </div>
127 127
    {% endif %}
128 128
    {% if appointment.event_id %}
129
        <div class="tabs-worker-{{ worker_agenda.worker.id }} textedit">
129
    <div class="tabs-worker-{{ worker_agenda.worker.id }} textedit">
130 130
            <span></span>
131 131
            {% if service in appointment.services_names or not appointment.services_names %}
132 132
            <textarea>{{ appointment.description }}</textarea>
133
              <button disabled="disabled" data-event-id="{{ appointment.event_id }}" data-date="{{ date|date:"Y-m-d" }}">✔</button>
133
            <button disabled="disabled" data-event-id="{{ appointment.event_id }}" data-date="{{ date|date:"Y-m-d" }}" data-act-id="{{ appointment.act_id }}">✔</button>
134 134
            {% else %}
135 135
            <p>{{ appointment.description }}</p>
136 136
            {% endif %}
calebasse/static/js/calebasse.agenda.js
19 19
          var textarea = $(this).prev();
20 20
          var span = textarea.prev()
21 21
          var btn = $(this)
22
          var data = {description: textarea.val() };
23
          var data = JSON.stringify(data);
24
          $.ajax({
22
          if ($(this).data('act-id'))
23
          {
24
            var data = {comment: textarea.val() };
25
            var data = JSON.stringify(data);
26
            $.ajax({
27
              url: '/api/v1/act/' + $(this).data("act-id") + '/?format=json&date=' + $(this).data('date'),
28
              type: 'PATCH',
29
              contentType: 'application/json',
30
              data: data,
31
              success: function(data) {
32
                btn.attr('disabled', 'disabled');
33
                span.html('Commentaire modifié avec succès');
34
              }
35
            });
36
          }
37
          else
38
          {
39
            var data = {description: textarea.val() };
40
            var data = JSON.stringify(data);
41
            $.ajax({
25 42
              url: '/api/v1/event/' + $(this).data("event-id") + '/?format=json&date=' + $(this).data('date'),
26 43
              type: 'PATCH',
27 44
              contentType: 'application/json',
28 45
              data: data,
29 46
              success: function(data) {
30
                  btn.attr('disabled', 'disabled');
31
                  span.html('Commentaire modifié avec succès');
47
                btn.attr('disabled', 'disabled');
48
                span.html('Commentaire modifié avec succès');
32 49
              }
33
          });
50
            });
51
          }
34 52
      });
35 53
      /* TODO: put this in a generic function */
36 54
      $('.input_is_billable').click(function() {

Also available in: Unified diff