Project

General

Profile

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

calebasse / calebasse / agenda / templates / agenda / act-validation.html @ 36d6d03e

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

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

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

    
30

    
31
    {% if actes %}
32
    <div id="actes">
33
    {% for acte, last_status, last_status_name in actes %}
34
    <div class="frame acte" id="acte-frame-{{ acte.id }}">
35
      <h3>{{ acte.date }} - <strong>{{ acte.patient.last_name }} {{ acte.patient.first_name }}</strong>
36
          {% if acte.patient.paper_id %} ({{ acte.patient.paper_id }}){% endif %}
37
          {% if acte.doctors %}{% for doctor in acte.doctors.all %} - {{ doctor.last_name }} {{ doctor.first_name }}{% endfor %}{% endif %} -
38
          <strong>{{ acte.act_type }}</strong>
39
          {% if acte.description %} <img title="Un commentaire existe" src="{{ STATIC_URL }}images/emblem-documents.png">{% endif%}
40
      </h3>
41
      <div><span>{% if last_status %}<strong>{{ last_status_name }}</strong>, le {{ last_status.created }} par {{ last_status.author }}
42
           {% if last_status.auto %}(par validation automatique){% endif %}.
43
         {% else %}
44
           Non pointé.
45
         {% endif %}
46
         </span>
47
         {% if acte.validation_locked and authorized_lock %}
48
             <form method="post" class="inline-form">
49
               {% csrf_token %}
50
               <input type="hidden" value="{{acte.id}}" name="acte-id">
51
               <input type="hidden" name="unlock" value="1">
52
               <button>Déverrouiller</button>
53
             </form>
54
         {% else %}
55
           <form method="post" class="inline-form">
56
           {% csrf_token %}
57
           <input type="hidden" value="{{acte.id}}" name="acte-id">
58
           <select data-previous="{{ last_status.state_name }}" name="act_state">
59
             {% for state_name, display_state_name in validation_states.items %}
60
             <option value="{{ state_name }}" {% if state_name == last_status.state_name %}selected{% endif %}>{{ display_state_name }}</option>
61
             {% endfor %}
62
           </select>
63
           <button {% if last_status %}disabled{% endif %}>Modifier</button>
64
           </form>
65
           {% if authorized_lock and last_status %}
66
             <form method="post" class="inline-form">
67
               {% csrf_token %}
68
               <input type="hidden" value="{{acte.id}}" name="acte-id">
69
               <input type="hidden" name="lock" value="1">
70
               <button>Verrouiller</button>
71
             </form>
72
           {% endif %}
73
         {% endif %}
74
      </div>
75
    </div>
76
    {% endfor %}
77
    </div>
78
    {% else %}
79
    <p><strong>Il n'y a pas d'acte à valider le {{ date|date:"DATE_FORMAT" }}.</strong></p>
80
    {% endif %}
81
{% endblock %}
82
{% block page-end %}
83
<script>
84
  $('select[name^="act_state"]').on('change', function () {
85
    $(this).next('button').prop('disabled',
86
      ($(this).data('previous') == $(this).val()));
87
  })
88
  $('#validate-all-form').on('submit', function () {
89
    return window.confirm('Confirmez-vous la validation automatique des actes ?');
90
  });
91
</script>
92
{% endblock %}
(1-1/8)