Commit | Line | Data |
---|---|---|
5d680e84 | 1 | {% extends 'base.html' %} |
37bf2d05 | 2 | |
498881f4 | 3 | {% block title %}RH - DAE{% endblock %} |
4 | {% block titre %}Ressources humaines{% endblock %} | |
5efcd48e | 5 | {% block sous_titre %} |
6 | Demande d'autorisation d'embauche | |
7 | {% endblock %} | |
498881f4 | 8 | |
37bf2d05 | 9 | {% block extrahead %} |
703e5cfb NC |
10 | <script src="{{ MEDIA_URL }}js/jquery-1.5.1.min.js" |
11 | type="text/javascript"></script> | |
12 | <script src="{{ MEDIA_URL }}js/jquery-ui-1.8.11.custom.min.js" | |
13 | type="text/javascript"></script> | |
14 | <link href="{{ MEDIA_URL }}/css/redmond/jquery-ui-1.8.11.custom.css" | |
15 | rel="stylesheet" /> | |
ce110fb9 OL |
16 | |
17 | <style> | |
ce110fb9 OL |
18 | .row {padding: 10px 0px; clear: both; display:block;} |
19 | .row * {float: left; margin: 0px; padding: 0px; margin-right: 4px;} | |
20 | .row li {list-style-type: none;} | |
21 | .underline {text-decoration: underline;} | |
22 | .clear {display: block; clear: both;} | |
23 | .note {text-decoration: underline; font-style: italic; margin-left: 12px;} | |
24 | .info {font-size:13px; font-style: italic;} | |
25 | .noborder {border:none; margin:0; padding; 0} | |
26 | tr.noborder td {border:none; padding-left: 0;} | |
27 | </style> | |
37bf2d05 NC |
28 | {% endblock %} |
29 | ||
37bf2d05 | 30 | {% block main %} |
498881f4 | 31 | <h1>Demande d'autorisation de création de poste</h1> |
32 | ||
36341125 | 33 | <form action="" method="post" enctype="multipart/form-data"> |
5efcd48e | 34 | <fieldset> |
35 | <h2> | |
36 | {% if new %} | |
37 | Nouveau poste | |
38 | {% else %} | |
39 | Poste existant : {{ poste.nom }} ({{ poste.implantation.nom }}) | |
40 | {% endif %} | |
41 | </h2> | |
42 | <table> | |
43 | <tbody> | |
44 | <tr> | |
45 | <th>{{ form.poste.label_tag }} :<br />{{ form.poste.errors }}</th> | |
46 | <td>{{ form.poste }}</td> | |
47 | </tr> | |
48 | <tr> | |
49 | <th>{{ form.nom.label_tag }} :<br />{{ form.nom.errors }}</th> | |
50 | <td>{{ form.nom }}</td> | |
51 | </tr> | |
52 | <tr> | |
53 | <th>{{ form.type_poste.label_tag }} :<br />{{ form.type_poste.errors }}</th> | |
54 | <td>{{ form.type_poste }}</td> | |
55 | </tr> | |
56 | <tr> | |
57 | <th>{{ form.implantation.label_tag }} :<br />{{ form.implantation.errors }}</th> | |
58 | <td>{{ form.implantation }}</td> | |
59 | </tr> | |
60 | <tr> | |
61 | <th>{{ form.service.label_tag }} :<br />{{ form.service.errors }}</th> | |
62 | <td>{{ form.service }}</td> | |
63 | </tr> | |
64 | <tr> | |
65 | <th>{{ form.responsable.label_tag }} :<br />{{ form.responsable.errors }}</th> | |
66 | <td>{{ form.responsable }}</td> | |
67 | </tr> | |
68 | </tbody> | |
69 | </table> | |
70 | </fieldset> | |
d949462d | 71 | |
5efcd48e | 72 | <fieldset> |
73 | <h2>Recrutement</h2> | |
74 | <table> | |
75 | <tbody> | |
76 | <tr> | |
77 | <th>{{ form.statut_residence.label_tag }} :<br />{{ form.statut_residence.errors }}</th> | |
78 | <td> | |
79 | <span class="row"> | |
80 | {{ form.statut_residence }} | |
81 | {{ form.mise_a_disposition.label_tag }} | |
82 | {{ form.mise_a_disposition.errors }} | |
83 | {{ form.mise_a_disposition }} | |
84 | </span> | |
85 | </td> | |
86 | </tr> | |
87 | <tr> | |
88 | <th>{{ form.appel.label_tag }} :<br />{{ form.appel.errors }}</th> | |
89 | <td> | |
90 | <span class="row"> | |
91 | {{ form.appel }} | |
92 | </span> | |
93 | </td> | |
94 | </tr> | |
95 | </tbody> | |
96 | </table> | |
97 | </fieldset> | |
d949462d | 98 | |
5efcd48e | 99 | <fieldset> |
100 | <h2>Durée prévue du poste </h2> | |
9fb2ccd9 | 101 | <span class="info">Indépendamment du titulaire du poste</span> |
5efcd48e | 102 | <table> |
103 | <tbody> | |
104 | <tr> | |
105 | <th rowspan="2">Durée :</th> | |
106 | <td>du</td> | |
107 | <td> | |
108 | {{ form.date_debut }}<br /> | |
109 | <span class="info">({{form.date_debut.help_text }})</span><br /> | |
110 | {{ form.date_debut.errors }} | |
111 | </td> | |
112 | <td> au </td> | |
113 | <td> | |
114 | {{ form.date_fin }}<br /> | |
115 | <span class="info">({{form.date_fin.help_text }})</span><br /> | |
116 | {{ form.date_fin.errors }} | |
117 | </td> | |
118 | </tr> | |
119 | <tr> | |
120 | <td colspan="4" class="info">Pour une durée indéterminée, spécifier uniquement la date de début.</td> | |
ce110fb9 OL |
121 | </tr> |
122 | <tr> | |
5efcd48e | 123 | <th>{{ form.regime_travail.label_tag }} :<br />{{ form.regime_travail.errors }}</th> |
124 | <td colspan="4"> | |
125 | {{ form.regime_travail }} | |
126 | <span class="info">{{ form.regime_travail.help_text }}</span> | |
ce110fb9 | 127 | </td> |
0f23302a | 128 | </tr> |
5efcd48e | 129 | <tr> |
130 | <th> | |
131 | {{ form.regime_travail_nb_heure_semaine.label_tag }} :<br /> | |
132 | {{ form.regime_travail_nb_heure_semaine.errors }} | |
133 | </th> | |
134 | <td colspan="4">{{ form.regime_travail_nb_heure_semaine }}</td> | |
135 | </tr> | |
136 | </tbody> | |
0f23302a | 137 | </table> |
5efcd48e | 138 | </fieldset> |
0f23302a | 139 | |
5efcd48e | 140 | <fieldset> |
141 | <h2>Classement du poste</h2> | |
142 | <table> | |
143 | <tbody> | |
144 | <tr> | |
145 | <th></th> | |
146 | <th>Échelon AUF</th> | |
96d32304 | 147 | <th>Coefficient</th> |
5efcd48e | 148 | <th>Valeur du point</th> |
3d627bfd | 149 | <th>Devise</th> |
150 | <th colspan="2">Salaire de base</th> | |
151 | <th colspan="2">Indemnité, responsabilité (le cas échéant)</th> | |
152 | <th colspan="2">Autres</th> | |
153 | <th colspan="2">TOTAL</th> | |
8e30e17f | 154 | <th>Taux > €</th> |
3d627bfd | 155 | <th colspan="2">Conversion EUR</th> |
5efcd48e | 156 | </tr> |
157 | <tr> | |
158 | <th>Minimum</th> | |
17353922 OL |
159 | <td> |
160 | {{ form.classement_min }} | |
161 | {{ form.classement_min.errors }} | |
162 | </td> | |
163 | <td> | |
164 | {{ form.coefficient_min }} | |
165 | {{ form.coefficient_min.errors }} | |
166 | </td> | |
5efcd48e | 167 | <td> |
168 | {{ form.valeur_point_min }} | |
169 | {{ form.valeur_point_min.errors }} | |
170 | </td> | |
3d627bfd | 171 | <td> |
172 | {{ form.devise_min }} | |
173 | {{ form.devise_min.errors }} | |
174 | </td> | |
63437606 | 175 | <td> |
176 | {{ form.salaire_min }} | |
177 | {{ form.salaire_min.errors }} | |
178 | </td> | |
3d627bfd | 179 | <td><span class="devise_min_code">EUR</span></td> |
5efcd48e | 180 | <td>{{ form.indemn_min }}</td> |
3d627bfd | 181 | <td><span class="devise_min_code">EUR</span></td> |
5efcd48e | 182 | <td>{{ form.autre_min }}</td> |
3d627bfd | 183 | <td><span class="devise_min_code">EUR</span></td> |
8e30e17f | 184 | <td id="total_min" class="cell-nombre">0.00</td> |
3d627bfd | 185 | <td><span class="devise_min_code">EUR</span></td> |
8e30e17f | 186 | <td id="taux_min_euro_display">1</td> |
187 | <td id="total_min_euro" class="cell-nombre">0.00</td> | |
3d627bfd | 188 | <td>€</td> |
0f23302a | 189 | </tr> |
190 | <tr> | |
5efcd48e | 191 | <th>Maximun</th> |
17353922 OL |
192 | <td> |
193 | {{ form.classement_max }} | |
194 | {{ form.classement_max.errors }} | |
195 | </td> | |
196 | <td> | |
197 | {{ form.coefficient_max }} | |
198 | {{ form.coefficient_max.errors }} | |
199 | </td> | |
5efcd48e | 200 | <td> |
201 | {{ form.valeur_point_max }} | |
202 | {{ form.valeur_point_max.errors }} | |
ce110fb9 | 203 | </td> |
3d627bfd | 204 | <td> |
205 | {{ form.devise_max }} | |
206 | {{ form.devise_max.errors }} | |
207 | </td> | |
63437606 | 208 | <td> |
209 | {{ form.salaire_max }} | |
210 | {{ form.salaire_max.errors }} | |
211 | </td> | |
3d627bfd | 212 | <td><span class="devise_max_code">EUR</span></td> |
5efcd48e | 213 | <td>{{ form.indemn_max }}</td> |
3d627bfd | 214 | <td><span class="devise_max_code">EUR</span></td> |
5efcd48e | 215 | <td>{{ form.autre_max }}</td> |
3d627bfd | 216 | <td><span class="devise_max_code">EUR</span></td> |
8e30e17f | 217 | <td id="total_max" class="cell-nombre">0.00</td> |
3d627bfd | 218 | <td><span class="devise_max_code">EUR</span></td> |
8e30e17f | 219 | <td id="taux_max_euro_display">1</td> |
220 | <td id="total_max_euro" class="cell-nombre">0.00</td> | |
3d627bfd | 221 | <td>€</td> |
ce110fb9 | 222 | </tr> |
5efcd48e | 223 | </tbody> |
0f23302a | 224 | </table> |
ce110fb9 | 225 | |
0f23302a | 226 | <p class="info">N.B Conversion en EUROS au taux de change budgétaire</p> |
5efcd48e | 227 | </fieldset> |
228 | ||
63437606 | 229 | {% comment %}{% if new %}{% endcomment %} |
5efcd48e | 230 | <fieldset> |
231 | <h2>Éléments de comparaison</h2> | |
232 | <p class="info">Compléter uniquement lors de la création d'un poste</p> | |
233 | <table> | |
234 | <tbody> | |
235 | <tr> | |
a3508c67 | 236 | <th>Devise</th> |
237 | <td> | |
238 | {{ form.devise_comparaison }} | |
239 | {{ form.devise_comparaison.errors }} | |
240 | </td> | |
241 | </tr> | |
242 | </tbody> | |
243 | </table> | |
244 | <table> | |
245 | <tbody> | |
246 | <tr> | |
5efcd48e | 247 | <th></th> |
a3508c67 | 248 | <th colspan="2">Entreprise locale</th> |
249 | <th colspan="2">Université</th> | |
250 | <th colspan="2">Fonction publique</th> | |
251 | <th colspan="2">ONG</th> | |
252 | <th colspan="2">Autre</th> | |
5efcd48e | 253 | </tr> |
254 | <tr> | |
255 | <th>Minimum</th> | |
256 | <td>{{ form.comp_locale_min }}</td> | |
a3508c67 | 257 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 258 | <td>{{ form.comp_universite_min }}</td> |
a3508c67 | 259 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 260 | <td>{{ form.comp_fonctionpub_min }}</td> |
a3508c67 | 261 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 262 | <td>{{ form.comp_ong_min }}</td> |
a3508c67 | 263 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 264 | <td>{{ form.comp_autre_min }}</td> |
a3508c67 | 265 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 266 | </tr> |
267 | <tr> | |
268 | <th>Maximum</th> | |
269 | <td>{{ form.comp_locale_max }}</td> | |
a3508c67 | 270 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 271 | <td>{{ form.comp_universite_max }}</td> |
a3508c67 | 272 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 273 | <td>{{ form.comp_fonctionpub_max }}</td> |
a3508c67 | 274 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 275 | <td>{{ form.comp_ong_max }}</td> |
a3508c67 | 276 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 277 | <td>{{ form.comp_autre_max }}</td> |
a3508c67 | 278 | <td><span class="devise_comp_code">€</span></td> |
5efcd48e | 279 | </tr> |
280 | </tbody> | |
281 | </table> | |
5efcd48e | 282 | </fieldset> |
63437606 | 283 | {% comment %}{% endif %}{% endcomment %} |
ce110fb9 | 284 | |
36341125 OL |
285 | <fieldset> |
286 | <h2>Pièces jointes</h2> | |
287 | <p class="info">Compléter uniquement lors de la création d'un poste</p> | |
288 | <table> | |
b9d81e90 | 289 | {% for f in piecesForm.management_form %} |
290 | {{ f }} | |
291 | {% endfor %} | |
292 | <tr> | |
293 | <th></th> | |
294 | {% for field in piecesForm.forms.0 %} | |
295 | {% if not field.is_hidden %} | |
296 | <th>{{ field.label }}</th> | |
297 | {% endif %} | |
298 | {% endfor %} | |
299 | </tr> | |
300 | {% for f in piecesForm.forms %} | |
301 | <tr> | |
302 | <td> | |
303 | {% if f.initial.fichier %} | |
304 | <a href="{{ f.initial.fichier.url }}" target="_blank">Télécharger</a> | |
305 | {% endif %} | |
306 | </td> | |
307 | {% for field in f %} | |
308 | {% if not field.is_hidden %} | |
309 | <td>{{ field }}</td> | |
310 | {% else %} | |
311 | {{ field }} | |
312 | {% endif %} | |
313 | {% endfor %} | |
314 | </tr> | |
315 | {% endfor %} | |
36341125 OL |
316 | </table> |
317 | </fieldset> | |
3ed49093 | 318 | <input type="submit" name="save" value="Sauvegarder" /> |
5efcd48e | 319 | </form> |
3ed49093 | 320 | |
5efcd48e | 321 | <fieldset> |
322 | <h2>Financement</h2> | |
3ed49093 | 323 | |
5efcd48e | 324 | <table cellspacing="0" id="financing"> |
3ed49093 NC |
325 | <tr> |
326 | <th>Type</th> | |
327 | <th>Montant</th> | |
328 | <th>Devise</th> | |
329 | <th>Pourcentage</th> | |
330 | <th>Commentaire</th> | |
331 | <th></th> | |
332 | </tr> | |
333 | {% for fin in poste.financements.all %} | |
334 | <tr> | |
43d04712 | 335 | <td>{{ fin.get_type_display }}</td> |
3ed49093 | 336 | <td>{{ fin.montant }}</td> |
43d04712 | 337 | <td>€ |
338 | {% comment %} | |
339 | {{ fin.devise }} | |
340 | {% endcomment %} | |
341 | </td> | |
3ed49093 NC |
342 | <td>{{ fin.pourcentage }}</td> |
343 | <td>{{ fin.commentaire }}</td> | |
344 | <td><a href="{% url financement poste_key fin.id %}">Modifier</a></td> | |
345 | </tr> | |
346 | {% empty %} | |
347 | <tr> | |
348 | <td colspan="5"> | |
349 | {% if new %} | |
350 | Vous devez enregister ce nouveau poste avant de pouvoir spécifier | |
351 | la ou les sources de financement. | |
352 | {% else %} | |
353 | Aucun financement au registre | |
354 | {% endif %} | |
355 | </td> | |
356 | </tr> | |
357 | {% endfor %} | |
5efcd48e | 358 | </table> |
359 | {% if not new %} | |
703e5cfb | 360 | <a href="{% url financement poste_key %}" class="new"> |
3ed49093 NC |
361 | Ajouter une source de financement |
362 | </a> | |
5efcd48e | 363 | {% endif %} |
703e5cfb | 364 | |
5efcd48e | 365 | <div id="financing-form"></div> |
366 | </fieldset> | |
703e5cfb | 367 | |
b50b0cd3 | 368 | <script type="text/javascript"> |
369 | $('#id_poste').change(function() { | |
370 | window.location = '{% url poste %}/' + $(this).val(); | |
371 | }); | |
372 | $('#financing a, a.new').click(function() { | |
373 | $('#financing-form').load($(this).attr('href') + '?ajax=1') | |
374 | .dialog({ | |
375 | modal: true, | |
376 | height: 500, | |
377 | width: 550 | |
378 | }); | |
379 | return false; | |
380 | }); | |
3d627bfd | 381 | |
382 | /* CLASSEMENT MIN */ | |
85668061 | 383 | $(document).ready(function() { |
3d627bfd | 384 | valeur_min = '<input type="hidden" id="valeur_min" name="valeur_min" value="0" disabled="disabled">' |
a3508c67 | 385 | devise_min_code = '<input type="hidden" id="devise_min_code" name="devise_min_code" value="EUR" disabled="disabled">' |
8e30e17f | 386 | taux_min_euro = '<input type="hidden" id="taux_min_euro" name="taux_min_euro" value="1" disabled="disabled">' |
85668061 | 387 | $('#id_valeur_point_min').after(valeur_min) |
3d627bfd | 388 | $('#id_devise_min').after(devise_min_code) |
8e30e17f | 389 | $('#total_min_euro').after(taux_min_euro) |
63437606 | 390 | |
a3508c67 | 391 | /* valeur_point, devise et taux de l'implantation par défaut */ |
392 | /* | |
393 | implantation = $('id_implantation').val(); | |
394 | valeur_point_min = $('#id_valeur_point_min').val(); | |
395 | if (valeur_point_min == '' and implantation != '') | |
396 | */ | |
397 | /* simuler id_valeur_point_min change */ | |
398 | ||
399 | ||
63437606 | 400 | /* simuler id_devise_min change */ |
401 | devise_min = $('#id_devise_min').val(); | |
402 | url_devise_code = "{% url dae_devise_code %}"; | |
403 | $.post(url_devise_code, {'devise':devise_min}, function(data){ | |
404 | $('#devise_min_code').val(data["devise_code"]); | |
405 | $('#taux_min_euro').val(data["taux_euro"]); | |
406 | $('#taux_min_euro_display').empty(); | |
407 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
408 | $('.devise_min_code').trigger('update_devise_min_code'); | |
409 | $('#total_min_euro').trigger('update_total_min_euro'); | |
410 | }, 'json'); | |
411 | /* total */ | |
412 | $('#total_min').trigger('update_total_min'); | |
413 | /* total euro */ | |
414 | $('#total_min_euro').trigger('update_total_min_euro'); | |
85668061 | 415 | }); |
8e30e17f | 416 | /* bindings */ |
85668061 | 417 | $('#id_coefficient_min').bind('coeff_min_modified', function(){ |
418 | $('#id_salaire_min').trigger('update_salaire_min'); | |
419 | }); | |
3d627bfd | 420 | $('.devise_min_code').bind('update_devise_min_code', function(){ |
421 | devise_code = $('#devise_min_code').val(); | |
422 | $('.devise_min_code').empty(); | |
423 | $('.devise_min_code').text(devise_code); | |
424 | }); | |
85668061 | 425 | $('#id_salaire_min').bind('update_salaire_min', function(){ |
426 | valeur = $('#valeur_min').val(); | |
427 | coeff = $('#id_coefficient_min').val(); | |
428 | salaire = coeff * valeur; | |
429 | salaire = clean_float(salaire); | |
3d627bfd | 430 | $(this).val(salaire); |
85668061 | 431 | $('#total_min').trigger('update_total_min'); |
432 | }); | |
433 | $('#total_min').bind('update_total_min', function(){ | |
434 | total = 0; | |
435 | salaire = $('#id_salaire_min').val(); | |
436 | indemn = $('#id_indemn_min').val(); | |
437 | autre = $('#id_autre_min').val(); | |
438 | salaire = clean_float(salaire); | |
439 | indemn = clean_float(indemn); | |
440 | autre = clean_float(autre); | |
441 | total = salaire + indemn + autre; | |
3d627bfd | 442 | $(this).empty(); |
443 | $(this).text(total.toFixed(2)); | |
8e30e17f | 444 | $('#total_min_euro').trigger('update_total_min_euro'); |
445 | }); | |
446 | $('#total_min_euro').bind('update_total_min_euro', function(){ | |
447 | total = $('#total_min').text(); | |
448 | taux_euro = $('#taux_min_euro').val(); | |
449 | total = clean_float(total); | |
450 | taux_euro = clean_float(taux_euro); | |
451 | total_euro = total * taux_euro; | |
452 | $(this).empty(); | |
453 | $(this).text(total_euro.toFixed(2)); | |
85668061 | 454 | }); |
3d627bfd | 455 | /* change */ |
85668061 | 456 | $('#id_coefficient_min').change(function(){ |
3d627bfd | 457 | $(this).trigger('coeff_min_modified'); |
85668061 | 458 | }); |
b50b0cd3 | 459 | $('#id_classement_min').change(function() { |
b50b0cd3 | 460 | url = "{% url dae_coefficient %}"; |
8e30e17f | 461 | $.post(url, {'classement':$(this).val()}, function(data){ |
b50b0cd3 | 462 | $('#id_coefficient_min').val(data["coefficient"]); |
85668061 | 463 | $('#id_coefficient_min').trigger('coeff_min_modified'); |
b50b0cd3 | 464 | }, 'json'); |
465 | }); | |
85668061 | 466 | $('#id_valeur_point_min').change(function() { |
3d627bfd | 467 | url_valeur = "{% url dae_valeur %}"; |
468 | url_devise = "{% url dae_devise %}"; | |
1849a509 | 469 | min_now = $('#id_valeur_point_min').val(); |
470 | max_now = $('#id_valeur_point_max').val(); | |
a3508c67 | 471 | $.post(url_valeur, {'valeur_point':min_now}, function(data){ |
85668061 | 472 | $('#valeur_min').val(data["valeur"]); |
473 | $('#id_salaire_min').trigger('update_salaire_min'); | |
8e30e17f | 474 | $('#total_min_euro').trigger('update_total_min_euro'); |
a3508c67 | 475 | if (max_now == ''){ |
1849a509 | 476 | $('#id_valeur_point_max').val(min_now); |
477 | $('#valeur_max').val(data["valeur"]); | |
478 | $('#id_salaire_max').trigger('update_salaire_max'); | |
479 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 480 | } |
85668061 | 481 | }, 'json'); |
a3508c67 | 482 | $.post(url_devise, {'valeur_point':min_now}, function(data){ |
3d627bfd | 483 | $('#id_devise_min').val(data["devise"]); |
484 | $('#devise_min_code').val(data["devise_code"]); | |
8e30e17f | 485 | $('#taux_min_euro').val(data["taux_euro"]); |
486 | $('#taux_min_euro_display').empty(); | |
487 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
3d627bfd | 488 | $('.devise_min_code').trigger('update_devise_min_code'); |
8e30e17f | 489 | $('#total_min_euro').trigger('update_total_min_euro'); |
a3508c67 | 490 | if (max_now == ''){ |
1849a509 | 491 | $('#id_devise_max').val(data["devise"]); |
492 | $('#devise_max_code').val(data["devise_code"]); | |
493 | $('#taux_max_euro').val(data["taux_euro"]); | |
494 | $('#taux_max_euro_display').empty(); | |
495 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
496 | $('.devise_max_code').trigger('update_devise_max_code'); | |
497 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 498 | } |
3d627bfd | 499 | }, 'json'); |
500 | }); | |
501 | $('#id_devise_min').change(function(){ | |
63437606 | 502 | devise_min = $('#id_devise_min').val(); |
3d627bfd | 503 | url_devise_code = "{% url dae_devise_code %}"; |
63437606 | 504 | $.post(url_devise_code, {'devise':devise_min}, function(data){ |
3d627bfd | 505 | $('#devise_min_code').val(data["devise_code"]); |
8e30e17f | 506 | $('#taux_min_euro').val(data["taux_euro"]); |
507 | $('#taux_min_euro_display').empty(); | |
508 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
3d627bfd | 509 | $('.devise_min_code').trigger('update_devise_min_code'); |
8e30e17f | 510 | $('#total_min_euro').trigger('update_total_min_euro'); |
3d627bfd | 511 | }, 'json'); |
85668061 | 512 | }); |
513 | $('#id_salaire_min').change(function(){ | |
514 | $('#total_min').trigger('update_total_min'); | |
515 | }); | |
516 | $('#id_indemn_min').change(function(){ | |
517 | $('#total_min').trigger('update_total_min'); | |
518 | }); | |
519 | $('#id_autre_min').change(function(){ | |
520 | $('#total_min').trigger('update_total_min'); | |
521 | }); | |
522 | ||
3d627bfd | 523 | /* CLASSEMENT MAX */ |
681bf3d0 | 524 | $(document).ready(function() { |
525 | valeur_max = '<input type="hidden" id="valeur_max" name="valeur_max" value="0" disabled="disabled">' | |
a3508c67 | 526 | devise_max_code = '<input type="hidden" id="devise_max_code" name="devise_max_code" value="EUR" disabled="disabled">' |
681bf3d0 | 527 | taux_max_euro = '<input type="hidden" id="taux_max_euro" name="taux_max_euro" value="1" disabled="disabled">' |
528 | $('#id_valeur_point_max').after(valeur_max) | |
529 | $('#id_devise_max').after(devise_max_code) | |
530 | $('#total_max_euro').after(taux_max_euro) | |
63437606 | 531 | |
532 | /* simuler id_devise_max change */ | |
533 | devise_max = $('#id_devise_max').val(); | |
534 | url_devise_code = "{% url dae_devise_code %}"; | |
535 | $.post(url_devise_code, {'devise':devise_max}, function(data){ | |
536 | $('#devise_max_code').val(data["devise_code"]); | |
537 | $('#taux_max_euro').val(data["taux_euro"]); | |
538 | $('#taux_max_euro_display').empty(); | |
539 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
540 | $('.devise_max_code').trigger('update_devise_max_code'); | |
541 | $('#total_max_euro').trigger('update_total_max_euro'); | |
542 | }, 'json'); | |
543 | /* total */ | |
544 | $('#total_max').trigger('update_total_max'); | |
545 | /* total euro */ | |
546 | $('#total_max_euro').trigger('update_total_max_euro'); | |
681bf3d0 | 547 | }); |
548 | /* bindings */ | |
549 | $('#id_coefficient_max').bind('coeff_max_modified', function(){ | |
550 | $('#id_salaire_max').trigger('update_salaire_max'); | |
551 | }); | |
552 | $('.devise_max_code').bind('update_devise_max_code', function(){ | |
553 | devise_code = $('#devise_max_code').val(); | |
554 | $('.devise_max_code').empty(); | |
555 | $('.devise_max_code').text(devise_code); | |
556 | }); | |
557 | $('#id_salaire_max').bind('update_salaire_max', function(){ | |
558 | valeur = $('#valeur_max').val(); | |
559 | coeff = $('#id_coefficient_max').val(); | |
560 | salaire = coeff * valeur; | |
561 | salaire = clean_float(salaire); | |
562 | $(this).val(salaire); | |
563 | $('#total_max').trigger('update_total_max'); | |
564 | }); | |
565 | $('#total_max').bind('update_total_max', function(){ | |
566 | total = 0; | |
567 | salaire = $('#id_salaire_max').val(); | |
568 | indemn = $('#id_indemn_max').val(); | |
569 | autre = $('#id_autre_max').val(); | |
570 | salaire = clean_float(salaire); | |
571 | indemn = clean_float(indemn); | |
572 | autre = clean_float(autre); | |
573 | total = salaire + indemn + autre; | |
574 | $(this).empty(); | |
575 | $(this).text(total.toFixed(2)); | |
576 | $('#total_max_euro').trigger('update_total_max_euro'); | |
577 | }); | |
578 | $('#total_max_euro').bind('update_total_max_euro', function(){ | |
579 | total = $('#total_max').text(); | |
580 | taux_euro = $('#taux_max_euro').val(); | |
581 | total = clean_float(total); | |
582 | taux_euro = clean_float(taux_euro); | |
583 | total_euro = total * taux_euro; | |
584 | $(this).empty(); | |
585 | $(this).text(total_euro.toFixed(2)); | |
586 | }); | |
587 | /* change */ | |
588 | $('#id_coefficient_max').change(function(){ | |
589 | $(this).trigger('coeff_max_modified'); | |
590 | }); | |
b50b0cd3 | 591 | $('#id_classement_max').change(function() { |
b50b0cd3 | 592 | url = "{% url dae_coefficient %}"; |
3d627bfd | 593 | $.post(url, {'classement':$(this).val()}, function(data){ |
b50b0cd3 | 594 | $('#id_coefficient_max').val(data["coefficient"]); |
681bf3d0 | 595 | $('#id_coefficient_max').trigger('coeff_max_modified'); |
596 | }, 'json'); | |
597 | }); | |
598 | $('#id_valeur_point_max').change(function() { | |
599 | url_valeur = "{% url dae_valeur %}"; | |
600 | url_devise = "{% url dae_devise %}"; | |
1849a509 | 601 | min_now = $('#id_valeur_point_min').val(); |
602 | max_now = $('#id_valeur_point_max').val(); | |
a3508c67 | 603 | $.post(url_valeur, {'valeur_point':max_now}, function(data){ |
681bf3d0 | 604 | $('#valeur_max').val(data["valeur"]); |
605 | $('#id_salaire_max').trigger('update_salaire_max'); | |
606 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 607 | if (min_now == ''){ |
1849a509 | 608 | $('#id_valeur_point_min').val(max_now); |
609 | $('#valeur_min').val(data["valeur"]); | |
610 | $('#id_salaire_min').trigger('update_salaire_min'); | |
611 | $('#total_min_euro').trigger('update_total_min_euro'); | |
a3508c67 | 612 | } |
b50b0cd3 | 613 | }, 'json'); |
a3508c67 | 614 | $.post(url_devise, {'valeur_point':max_now}, function(data){ |
681bf3d0 | 615 | $('#id_devise_max').val(data["devise"]); |
616 | $('#devise_max_code').val(data["devise_code"]); | |
617 | $('#taux_max_euro').val(data["taux_euro"]); | |
618 | $('#taux_max_euro_display').empty(); | |
619 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
620 | $('.devise_max_code').trigger('update_devise_max_code'); | |
621 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 622 | if (min_now == ''){ |
1849a509 | 623 | $('#id_devise_min').val(data["devise"]); |
624 | $('#devise_min_code').val(data["devise_code"]); | |
625 | $('#taux_min_euro').val(data["taux_euro"]); | |
626 | $('#taux_min_euro_display').empty(); | |
627 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
628 | $('.devise_min_code').trigger('update_devise_min_code'); | |
629 | $('#total_min_euro').trigger('update_total_min_euro'); | |
a3508c67 | 630 | } |
681bf3d0 | 631 | }, 'json'); |
632 | }); | |
633 | $('#id_devise_max').change(function(){ | |
63437606 | 634 | devise_max = $('#id_devise_max').val(); |
681bf3d0 | 635 | url_devise_code = "{% url dae_devise_code %}"; |
63437606 | 636 | $.post(url_devise_code, {'devise':devise_max}, function(data){ |
681bf3d0 | 637 | $('#devise_max_code').val(data["devise_code"]); |
638 | $('#taux_max_euro').val(data["taux_euro"]); | |
639 | $('#taux_max_euro_display').empty(); | |
640 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
641 | $('.devise_max_code').trigger('update_devise_max_code'); | |
642 | $('#total_max_euro').trigger('update_total_max_euro'); | |
643 | }, 'json'); | |
644 | }); | |
645 | $('#id_salaire_max').change(function(){ | |
646 | $('#total_max').trigger('update_total_max'); | |
647 | }); | |
648 | $('#id_indemn_max').change(function(){ | |
649 | $('#total_max').trigger('update_total_max'); | |
650 | }); | |
651 | $('#id_autre_max').change(function(){ | |
652 | $('#total_max').trigger('update_total_max'); | |
b50b0cd3 | 653 | }); |
85668061 | 654 | |
a3508c67 | 655 | /* COMPARAISON */ |
656 | ||
657 | $(document).ready(function() { | |
658 | devise_comp_code = '<input type="hidden" id="devise_comp_code" name="devise_comp_code" value="EUR" disabled="disabled">' | |
659 | $('#id_devise_comparaison').after(devise_comp_code) | |
660 | ||
661 | /* simuler id_devise_comparaison change */ | |
662 | devise_comparaison = $('#id_devise_comparaison').val(); | |
663 | url_devise_code = "{% url dae_devise_code %}"; | |
664 | $.post(url_devise_code, {'devise':devise_comparaison}, function(data){ | |
665 | $('#devise_comp_code').val(data["devise_code"]); | |
666 | $('.devise_comp_code').trigger('update_devise_comp_code'); | |
667 | }, 'json'); | |
668 | }); | |
669 | $('.devise_comp_code').bind('update_devise_comp_code', function(){ | |
670 | devise_code = $('#devise_comp_code').val(); | |
671 | $('.devise_comp_code').empty(); | |
672 | $('.devise_comp_code').text(devise_code); | |
673 | }); | |
674 | $('#id_devise_comparaison').change(function(){ | |
675 | devise_comparaison = $('#id_devise_comparaison').val(); | |
676 | url_devise_code = "{% url dae_devise_code %}"; | |
677 | $.post(url_devise_code, {'devise':devise_comparaison}, function(data){ | |
678 | $('#devise_comp_code').val(data["devise_code"]); | |
679 | $('.devise_comp_code').trigger('update_devise_comp_code'); | |
680 | }, 'json'); | |
681 | }); | |
682 | ||
3d627bfd | 683 | /* helpers */ |
85668061 | 684 | function clean_float(value){ |
685 | if (value == undefined) | |
686 | output = 0; | |
687 | else | |
688 | output = parseFloat(value); | |
689 | output = Math.round(output*100)/100; | |
690 | return output; | |
691 | } | |
b50b0cd3 | 692 | |
693 | </script> | |
5d680e84 | 694 | {% endblock %} |