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