Project

General

Profile

Download (4.16 KB) Statistics
| Branch: | Tag: | Revision:

calebasse / calebasse / agenda / templates / agenda / act-validation.html @ 9d75fa2a

1
{% extends "agenda/base.html" %}
2
{% load url from future %}
3

    
4
{% block body-class %}{{ block.super }} no-left-column{% endblock %}
5

    
6
{% block appbar %}
7
<h2>Validation des actes - {{ date|date:"DATE_FORMAT" }}</h2>
8
    <a href="..">Retourner à l'agenda</a>
9
    {% if authorized_lock %}
10
        <form method="post">
11
          {% csrf_token %}
12
          <input type="hidden" name="unlock-all" value="1">
13
          <button id="unlock-all">Tout déverrouiller</button>
14
        </form>
15
        <button id="validate-all">Validation automatique</button>
16
    {% endif %}
17
{% endblock %}
18

    
19
{% block agenda-content %}
20
    {% if validation_msg %}
21
    <ul>
22
    {% for message in validation_msg %}
23
     <li>message</li>
24
    {% endfor %}
25
    </ul>
26
    {% endif %}
27

    
28

    
29
    {% if actes %}
30
    <div id="actes">
31
    {% for acte, last_status, last_status_name in actes %}
32
    <div class="frame acte" id="acte-frame-{{ acte.id }}">
33
      <h3>{{ acte.date }} - <strong>{{ acte.patient.last_name }} {{ acte.patient.first_name }}</strong>
34
          {% if acte.patient.paper_id %} ({{ acte.patient.paper_id }}){% endif %}
35
          {% if acte.doctors %}{% for doctor in acte.doctors.all %} - {{ doctor.last_name }} {{ doctor.first_name }}{% endfor %}{% endif %} -
36
          <strong>{{ acte.act_type }}</strong>
37
          {% if acte.description %} <img title="Un commentaire existe" src="{{ STATIC_URL }}images/emblem-documents.png">{% endif%}
38
      </h3>
39
      <div><span>{% if last_status %}<strong>{{ last_status_name }}</strong>, le {{ last_status.created }} par {{ last_status.author }}
40
           {% if last_status.auto %}(par validation automatique){% endif %}.
41
         {% else %}
42
           Non pointé.
43
         {% endif %}
44
         </span>
45
         {% if acte.validation_locked and authorized_lock %}
46
             <form method="post" class="inline-form">
47
               {% csrf_token %}
48
               <input type="hidden" value="{{acte.id}}" name="acte-id">
49
               <input type="hidden" name="unlock" value="1">
50
               <button>Déverrouiller</button>
51
             </form>
52
         {% else %}
53
           <form method="post" class="inline-form">
54
           {% csrf_token %}
55
           <input type="hidden" value="{{acte.id}}" name="acte-id">
56
           <select data-previous="{{ last_status.state_name }}" name="act_state">
57
             {% for state_name, display_state_name in validation_states.items %}
58
             <option value="{{ state_name }}" {% if state_name == last_status.state_name %}selected{% endif %}>{{ display_state_name }}</option>
59
             {% endfor %}
60
           </select>
61
           <button {% if last_status %}disabled{% endif %}>Modifier</button>
62
           </form>
63
           {% if authorized_lock and last_status %}
64
             <form method="post" class="inline-form">
65
               {% csrf_token %}
66
               <input type="hidden" value="{{acte.id}}" name="acte-id">
67
               <input type="hidden" name="lock" value="1">
68
               <button>Verrouiller</button>
69
             </form>
70
           {% endif %}
71
         {% endif %}
72
      </div>
73
    </div>
74
    {% endfor %}
75
    </div>
76
    {% else %}
77
    <p><strong>Il n'y a pas d'acte à valider le {{ date|date:"DATE_FORMAT" }}.</strong></p>
78
    {% endif %}
79
{% endblock %}
80

    
81
{% block dialogs %}
82
<div id="validate-all-dialog" title="Validation">
83
  <div id="validate-all-dialog-content">
84
  </div>
85
  <form action="{% url 'validation-all' service=service date=date %}" method="post">
86
    {% csrf_token %}
87
    <input type="hidden" name="validate-all" value="1">
88
  </form>
89
</div>
90
{% endblock %}
91

    
92

    
93
{% block page-end %}
94
<script>
95
  $('select[name^="act_state"]').on('change', function () {
96
    $(this).next('button').prop('disabled',
97
      ($(this).data('previous') == $(this).val()));
98
  })
99
  $('#validate-all-dialog').dialog({
100
    autoOpen: false,
101
    modal: true,
102
    buttons: {
103
      "Valider": function () { $('#validate-all-dialog form').submit(); },
104
      "Annuler": function () { $(this).dialog("close"); },
105
    },
106
  });
107
  $('#validate-all').click(function () {
108
    $('#validate-all-dialog-content').load('{% url 'validation-all' service=service date=date %}',
109
      function () {
110
        $('#validate-all-dialog').dialog('open');
111
      }
112
    );
113
  });
114
</script>
115
{% endblock %}
(1-1/9)