aboutsummaryrefslogtreecommitdiffstats
path: root/client/templates/client/doc_create.html
blob: 9649a730ec55799cbef437153770de9751ebceb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
{% extends 'registration/base_client.html' %}

{% block title %}Crea iscrizione{% endblock %}

{% block breadcrumb %}
    <a href="#!" class="breadcrumb hide-on-med-and-down">Crea Iscrizione</a>
{% endblock %}

{% load app_filter %}

{% block content %}
<div class="row">
  <div class="col l8 offset-l2 s12">
    <div class="card-panel">
      <div class="row">
        <form id="form" action="{% url 'create' code=uc.id %}" method="post" class="col s12">
          {% csrf_token %}
          <input type="hidden" name="action" id="action">
          {% if not next %}
            <div class="row">
              <div class="col s12">
                {{uc.first_name}} {{uc.last_name}}
                <div style="font-size: 0.5em; line-height: normal;">{{uc.born_date}}</div>
              </div>
            </div>
            <div class="row">
              <div class="input-field col s12">
                <select name="doctype">
                  <option value="" disabled selected>Scegli</option>
                  {% for doctype in docs%}
                    <option value="{{doctype.id}}">{{doctype.name}}</option>
                  {% endfor %}
                </select>
                <label>Iscrizione</label>
              </div>
            </div>
            <a class="btn waves-effect waves-light {{color}}" onclick="window.history.back();" >
              <i class="material-icons left">navigate_before</i>Indietro
            </a>
            <a class="btn waves-effect waves-light {{color}}" onclick="send('details')" >Avanti
              <i class="material-icons right">navigate_next</i>
            </a>
          {% else %}
              <input type="hidden" name="doctype" value="{{doctype.id}}">
              <div class="row">
                <div class="input-field col s12">
                  <select>
                    <option disabled selected>{{doctype.name}}</option>
                  </select>
                  <label>Iscrizione</label>
                </div>
              </div>
            {% if no_free_places%}
              <div class="row">
                <div class="col s12">
                  <div class="card {{color}}">
                    <div class="card-content">
                      <p style="color:white"><b>
                        Siamo spiacenti abbiamo esaurito i posti disponibili per questa iscrizione.
                      </b></p>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col s12">
                  <br>
                  <a class="btn waves-effect waves-light {{color}}" onclick="window.history.back();" >
                    <i class="material-icons left">navigate_before</i>Indietro
                  </a>
                  <a class="btn waves-effect waves-light {{color}}" href="/" >Annulla
                    <i class="material-icons right">cancel</i>
                  </a>
                </div>
              </div>
            {% else %}
              {% if personal_data %}
                <div class="row">
                  <div class="col s12">
                    <div class="card {{color}}">
                      <div class="card-content">
                        <p style="color:white"><b>
                          Il documento conterr&agrave; le informazioni personali, prego verificare che siano corrette e aggiornate
                        </b></p>
                      </div>
                    </div>
                  </div>
                </div>
              {% endif %}
              {% if medical_data %}
                <div class="row">
                  <div class="col s12">
                    <div class="card {{color}}">
                      <div class="card-content">
                        <p style="color:white"><b>
                          Il documento conterr&agrave; le informazioni mediche, prego verificare che siano corrette e aggiornate
                        </b></p>
                      </div>
                    </div>
                  </div>
                </div>
              {% endif %}
              {% if custom_message %}
                <div class="row">
                  <div class="col s12">
                    <div class="card {{color}}">
                      <div class="card-content" style="color:white">
                        <p><b>
                          {{custom_message_text | linebreaksbr}}
                        </b></p>
                      </div>
                    </div>
                  </div>
                </div>
              {% endif %}
              {% if custom_data %}
                {% for key in keys %}
                  {% if key.key_extra|is_heading %}
                    <div class="row">
                      <div class="input-field col s12">
                        <h6>{{key.key_extra|parse_heading}}</h6>
                      </div>
                    </div>
                  {% elif key.key_extra|is_multiple_choice %}
                    <div class="row">
                      <div class="col s12">
                        {% with arr=key.key_extra|parse_multiple_choice %}
                          {{arr.0}}
                          {% for val in arr.1 %}
                            <p><label>
                              <input class="with-gap" name="{{key.id}}" value="{{val}}" type="radio"/>
                              <span>{{val}}</span>
                            </label></p>
                          {% endfor %}
                        {% endwith %}
                      </div>
                    </div>
                  {% elif key.key_extra|is_checkbox %}
                    checkbox
                  {% else %}
                    <div class="row">
                      <div class="input-field col s12">
                        <input value="" name="{{key.id}}" id="{{key.id}}" type="text">
                        <label for="{{key.id}}">{{key.key}}</label>
                      </div>
                    </div>
                  {% endif %}
                {% endfor %}
              {% endif %}
              <div class="row">
                <div class="col s12">
                  <div class="card red">
                    <div class="card-content">
                      <p style="color:white"><b>
                        Attenzione: il documento non sarĂ  valido fino a quando non viene approvato. Selezionare
                        il documento dalla pagina principale per approvarlo.
                      </b></p>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col s12">
                  <br>
                  <a class="btn waves-effect waves-light {{color}}" onclick="window.history.back();" >
                    <i class="material-icons left">navigate_before</i>Indietro
                  </a>
                  <a class="btn waves-effect waves-light {{color}}" onclick="send('save')" >Crea
                    <i class="material-icons right">create</i>
                  </a>
                </div>
              </div>
            {% endif %}
          {% endif %}
        </form>
      </div>
    </div>
  </div>
</div>
{% endblock %}

{% block script %}
$(document).ready(function(){
    $('select').formSelect();
    {% if error %}
      M.toast({html: '{{ error_text}}', classes: 'orange'})
    {% endif %}
});

function send(id) {
  var form = document.getElementById('form')
  var action = document.getElementById('action')
  action.setAttribute('value', id);
  form.submit()
}
{% endblock %}