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> | |
d766bf2c | 288 | {% include "dae/pieces.html" %} |
36341125 | 289 | </fieldset> |
3ed49093 | 290 | <input type="submit" name="save" value="Sauvegarder" /> |
5efcd48e | 291 | </form> |
3ed49093 | 292 | |
5efcd48e | 293 | <fieldset> |
294 | <h2>Financement</h2> | |
3ed49093 | 295 | |
5efcd48e | 296 | <table cellspacing="0" id="financing"> |
3ed49093 NC |
297 | <tr> |
298 | <th>Type</th> | |
299 | <th>Montant</th> | |
300 | <th>Devise</th> | |
301 | <th>Pourcentage</th> | |
302 | <th>Commentaire</th> | |
303 | <th></th> | |
304 | </tr> | |
305 | {% for fin in poste.financements.all %} | |
306 | <tr> | |
43d04712 | 307 | <td>{{ fin.get_type_display }}</td> |
3ed49093 | 308 | <td>{{ fin.montant }}</td> |
43d04712 | 309 | <td>€ |
310 | {% comment %} | |
311 | {{ fin.devise }} | |
312 | {% endcomment %} | |
313 | </td> | |
3ed49093 NC |
314 | <td>{{ fin.pourcentage }}</td> |
315 | <td>{{ fin.commentaire }}</td> | |
316 | <td><a href="{% url financement poste_key fin.id %}">Modifier</a></td> | |
317 | </tr> | |
318 | {% empty %} | |
319 | <tr> | |
320 | <td colspan="5"> | |
321 | {% if new %} | |
322 | Vous devez enregister ce nouveau poste avant de pouvoir spécifier | |
323 | la ou les sources de financement. | |
324 | {% else %} | |
325 | Aucun financement au registre | |
326 | {% endif %} | |
327 | </td> | |
328 | </tr> | |
329 | {% endfor %} | |
5efcd48e | 330 | </table> |
331 | {% if not new %} | |
703e5cfb | 332 | <a href="{% url financement poste_key %}" class="new"> |
3ed49093 NC |
333 | Ajouter une source de financement |
334 | </a> | |
5efcd48e | 335 | {% endif %} |
703e5cfb | 336 | |
5efcd48e | 337 | <div id="financing-form"></div> |
338 | </fieldset> | |
703e5cfb | 339 | |
b50b0cd3 | 340 | <script type="text/javascript"> |
341 | $('#id_poste').change(function() { | |
342 | window.location = '{% url poste %}/' + $(this).val(); | |
343 | }); | |
344 | $('#financing a, a.new').click(function() { | |
345 | $('#financing-form').load($(this).attr('href') + '?ajax=1') | |
346 | .dialog({ | |
347 | modal: true, | |
348 | height: 500, | |
349 | width: 550 | |
350 | }); | |
351 | return false; | |
352 | }); | |
3d627bfd | 353 | |
354 | /* CLASSEMENT MIN */ | |
85668061 | 355 | $(document).ready(function() { |
3d627bfd | 356 | valeur_min = '<input type="hidden" id="valeur_min" name="valeur_min" value="0" disabled="disabled">' |
a3508c67 | 357 | devise_min_code = '<input type="hidden" id="devise_min_code" name="devise_min_code" value="EUR" disabled="disabled">' |
8e30e17f | 358 | taux_min_euro = '<input type="hidden" id="taux_min_euro" name="taux_min_euro" value="1" disabled="disabled">' |
85668061 | 359 | $('#id_valeur_point_min').after(valeur_min) |
3d627bfd | 360 | $('#id_devise_min').after(devise_min_code) |
8e30e17f | 361 | $('#total_min_euro').after(taux_min_euro) |
63437606 | 362 | |
a3508c67 | 363 | /* valeur_point, devise et taux de l'implantation par défaut */ |
364 | /* | |
365 | implantation = $('id_implantation').val(); | |
366 | valeur_point_min = $('#id_valeur_point_min').val(); | |
367 | if (valeur_point_min == '' and implantation != '') | |
368 | */ | |
369 | /* simuler id_valeur_point_min change */ | |
370 | ||
371 | ||
63437606 | 372 | /* simuler id_devise_min change */ |
373 | devise_min = $('#id_devise_min').val(); | |
374 | url_devise_code = "{% url dae_devise_code %}"; | |
375 | $.post(url_devise_code, {'devise':devise_min}, function(data){ | |
376 | $('#devise_min_code').val(data["devise_code"]); | |
377 | $('#taux_min_euro').val(data["taux_euro"]); | |
378 | $('#taux_min_euro_display').empty(); | |
379 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
380 | $('.devise_min_code').trigger('update_devise_min_code'); | |
381 | $('#total_min_euro').trigger('update_total_min_euro'); | |
382 | }, 'json'); | |
383 | /* total */ | |
384 | $('#total_min').trigger('update_total_min'); | |
385 | /* total euro */ | |
386 | $('#total_min_euro').trigger('update_total_min_euro'); | |
85668061 | 387 | }); |
8e30e17f | 388 | /* bindings */ |
85668061 | 389 | $('#id_coefficient_min').bind('coeff_min_modified', function(){ |
390 | $('#id_salaire_min').trigger('update_salaire_min'); | |
391 | }); | |
3d627bfd | 392 | $('.devise_min_code').bind('update_devise_min_code', function(){ |
393 | devise_code = $('#devise_min_code').val(); | |
394 | $('.devise_min_code').empty(); | |
395 | $('.devise_min_code').text(devise_code); | |
396 | }); | |
85668061 | 397 | $('#id_salaire_min').bind('update_salaire_min', function(){ |
398 | valeur = $('#valeur_min').val(); | |
399 | coeff = $('#id_coefficient_min').val(); | |
400 | salaire = coeff * valeur; | |
401 | salaire = clean_float(salaire); | |
3d627bfd | 402 | $(this).val(salaire); |
85668061 | 403 | $('#total_min').trigger('update_total_min'); |
404 | }); | |
405 | $('#total_min').bind('update_total_min', function(){ | |
406 | total = 0; | |
407 | salaire = $('#id_salaire_min').val(); | |
408 | indemn = $('#id_indemn_min').val(); | |
409 | autre = $('#id_autre_min').val(); | |
410 | salaire = clean_float(salaire); | |
411 | indemn = clean_float(indemn); | |
412 | autre = clean_float(autre); | |
413 | total = salaire + indemn + autre; | |
3d627bfd | 414 | $(this).empty(); |
415 | $(this).text(total.toFixed(2)); | |
8e30e17f | 416 | $('#total_min_euro').trigger('update_total_min_euro'); |
417 | }); | |
418 | $('#total_min_euro').bind('update_total_min_euro', function(){ | |
419 | total = $('#total_min').text(); | |
420 | taux_euro = $('#taux_min_euro').val(); | |
421 | total = clean_float(total); | |
422 | taux_euro = clean_float(taux_euro); | |
423 | total_euro = total * taux_euro; | |
424 | $(this).empty(); | |
425 | $(this).text(total_euro.toFixed(2)); | |
85668061 | 426 | }); |
3d627bfd | 427 | /* change */ |
85668061 | 428 | $('#id_coefficient_min').change(function(){ |
3d627bfd | 429 | $(this).trigger('coeff_min_modified'); |
85668061 | 430 | }); |
b50b0cd3 | 431 | $('#id_classement_min').change(function() { |
b50b0cd3 | 432 | url = "{% url dae_coefficient %}"; |
8e30e17f | 433 | $.post(url, {'classement':$(this).val()}, function(data){ |
b50b0cd3 | 434 | $('#id_coefficient_min').val(data["coefficient"]); |
85668061 | 435 | $('#id_coefficient_min').trigger('coeff_min_modified'); |
b50b0cd3 | 436 | }, 'json'); |
437 | }); | |
85668061 | 438 | $('#id_valeur_point_min').change(function() { |
3d627bfd | 439 | url_valeur = "{% url dae_valeur %}"; |
440 | url_devise = "{% url dae_devise %}"; | |
1849a509 | 441 | min_now = $('#id_valeur_point_min').val(); |
442 | max_now = $('#id_valeur_point_max').val(); | |
a3508c67 | 443 | $.post(url_valeur, {'valeur_point':min_now}, function(data){ |
85668061 | 444 | $('#valeur_min').val(data["valeur"]); |
445 | $('#id_salaire_min').trigger('update_salaire_min'); | |
8e30e17f | 446 | $('#total_min_euro').trigger('update_total_min_euro'); |
a3508c67 | 447 | if (max_now == ''){ |
1849a509 | 448 | $('#id_valeur_point_max').val(min_now); |
449 | $('#valeur_max').val(data["valeur"]); | |
450 | $('#id_salaire_max').trigger('update_salaire_max'); | |
451 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 452 | } |
85668061 | 453 | }, 'json'); |
a3508c67 | 454 | $.post(url_devise, {'valeur_point':min_now}, function(data){ |
3d627bfd | 455 | $('#id_devise_min').val(data["devise"]); |
456 | $('#devise_min_code').val(data["devise_code"]); | |
8e30e17f | 457 | $('#taux_min_euro').val(data["taux_euro"]); |
458 | $('#taux_min_euro_display').empty(); | |
459 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
3d627bfd | 460 | $('.devise_min_code').trigger('update_devise_min_code'); |
8e30e17f | 461 | $('#total_min_euro').trigger('update_total_min_euro'); |
a3508c67 | 462 | if (max_now == ''){ |
1849a509 | 463 | $('#id_devise_max').val(data["devise"]); |
464 | $('#devise_max_code').val(data["devise_code"]); | |
465 | $('#taux_max_euro').val(data["taux_euro"]); | |
466 | $('#taux_max_euro_display').empty(); | |
467 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
468 | $('.devise_max_code').trigger('update_devise_max_code'); | |
469 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 470 | } |
3d627bfd | 471 | }, 'json'); |
472 | }); | |
473 | $('#id_devise_min').change(function(){ | |
63437606 | 474 | devise_min = $('#id_devise_min').val(); |
3d627bfd | 475 | url_devise_code = "{% url dae_devise_code %}"; |
63437606 | 476 | $.post(url_devise_code, {'devise':devise_min}, function(data){ |
3d627bfd | 477 | $('#devise_min_code').val(data["devise_code"]); |
8e30e17f | 478 | $('#taux_min_euro').val(data["taux_euro"]); |
479 | $('#taux_min_euro_display').empty(); | |
480 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
3d627bfd | 481 | $('.devise_min_code').trigger('update_devise_min_code'); |
8e30e17f | 482 | $('#total_min_euro').trigger('update_total_min_euro'); |
3d627bfd | 483 | }, 'json'); |
85668061 | 484 | }); |
485 | $('#id_salaire_min').change(function(){ | |
486 | $('#total_min').trigger('update_total_min'); | |
487 | }); | |
488 | $('#id_indemn_min').change(function(){ | |
489 | $('#total_min').trigger('update_total_min'); | |
490 | }); | |
491 | $('#id_autre_min').change(function(){ | |
492 | $('#total_min').trigger('update_total_min'); | |
493 | }); | |
494 | ||
3d627bfd | 495 | /* CLASSEMENT MAX */ |
681bf3d0 | 496 | $(document).ready(function() { |
497 | valeur_max = '<input type="hidden" id="valeur_max" name="valeur_max" value="0" disabled="disabled">' | |
a3508c67 | 498 | devise_max_code = '<input type="hidden" id="devise_max_code" name="devise_max_code" value="EUR" disabled="disabled">' |
681bf3d0 | 499 | taux_max_euro = '<input type="hidden" id="taux_max_euro" name="taux_max_euro" value="1" disabled="disabled">' |
500 | $('#id_valeur_point_max').after(valeur_max) | |
501 | $('#id_devise_max').after(devise_max_code) | |
502 | $('#total_max_euro').after(taux_max_euro) | |
63437606 | 503 | |
504 | /* simuler id_devise_max change */ | |
505 | devise_max = $('#id_devise_max').val(); | |
506 | url_devise_code = "{% url dae_devise_code %}"; | |
507 | $.post(url_devise_code, {'devise':devise_max}, function(data){ | |
508 | $('#devise_max_code').val(data["devise_code"]); | |
509 | $('#taux_max_euro').val(data["taux_euro"]); | |
510 | $('#taux_max_euro_display').empty(); | |
511 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
512 | $('.devise_max_code').trigger('update_devise_max_code'); | |
513 | $('#total_max_euro').trigger('update_total_max_euro'); | |
514 | }, 'json'); | |
515 | /* total */ | |
516 | $('#total_max').trigger('update_total_max'); | |
517 | /* total euro */ | |
518 | $('#total_max_euro').trigger('update_total_max_euro'); | |
681bf3d0 | 519 | }); |
520 | /* bindings */ | |
521 | $('#id_coefficient_max').bind('coeff_max_modified', function(){ | |
522 | $('#id_salaire_max').trigger('update_salaire_max'); | |
523 | }); | |
524 | $('.devise_max_code').bind('update_devise_max_code', function(){ | |
525 | devise_code = $('#devise_max_code').val(); | |
526 | $('.devise_max_code').empty(); | |
527 | $('.devise_max_code').text(devise_code); | |
528 | }); | |
529 | $('#id_salaire_max').bind('update_salaire_max', function(){ | |
530 | valeur = $('#valeur_max').val(); | |
531 | coeff = $('#id_coefficient_max').val(); | |
532 | salaire = coeff * valeur; | |
533 | salaire = clean_float(salaire); | |
534 | $(this).val(salaire); | |
535 | $('#total_max').trigger('update_total_max'); | |
536 | }); | |
537 | $('#total_max').bind('update_total_max', function(){ | |
538 | total = 0; | |
539 | salaire = $('#id_salaire_max').val(); | |
540 | indemn = $('#id_indemn_max').val(); | |
541 | autre = $('#id_autre_max').val(); | |
542 | salaire = clean_float(salaire); | |
543 | indemn = clean_float(indemn); | |
544 | autre = clean_float(autre); | |
545 | total = salaire + indemn + autre; | |
546 | $(this).empty(); | |
547 | $(this).text(total.toFixed(2)); | |
548 | $('#total_max_euro').trigger('update_total_max_euro'); | |
549 | }); | |
550 | $('#total_max_euro').bind('update_total_max_euro', function(){ | |
551 | total = $('#total_max').text(); | |
552 | taux_euro = $('#taux_max_euro').val(); | |
553 | total = clean_float(total); | |
554 | taux_euro = clean_float(taux_euro); | |
555 | total_euro = total * taux_euro; | |
556 | $(this).empty(); | |
557 | $(this).text(total_euro.toFixed(2)); | |
558 | }); | |
559 | /* change */ | |
560 | $('#id_coefficient_max').change(function(){ | |
561 | $(this).trigger('coeff_max_modified'); | |
562 | }); | |
b50b0cd3 | 563 | $('#id_classement_max').change(function() { |
b50b0cd3 | 564 | url = "{% url dae_coefficient %}"; |
3d627bfd | 565 | $.post(url, {'classement':$(this).val()}, function(data){ |
b50b0cd3 | 566 | $('#id_coefficient_max').val(data["coefficient"]); |
681bf3d0 | 567 | $('#id_coefficient_max').trigger('coeff_max_modified'); |
568 | }, 'json'); | |
569 | }); | |
570 | $('#id_valeur_point_max').change(function() { | |
571 | url_valeur = "{% url dae_valeur %}"; | |
572 | url_devise = "{% url dae_devise %}"; | |
1849a509 | 573 | min_now = $('#id_valeur_point_min').val(); |
574 | max_now = $('#id_valeur_point_max').val(); | |
a3508c67 | 575 | $.post(url_valeur, {'valeur_point':max_now}, function(data){ |
681bf3d0 | 576 | $('#valeur_max').val(data["valeur"]); |
577 | $('#id_salaire_max').trigger('update_salaire_max'); | |
578 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 579 | if (min_now == ''){ |
1849a509 | 580 | $('#id_valeur_point_min').val(max_now); |
581 | $('#valeur_min').val(data["valeur"]); | |
582 | $('#id_salaire_min').trigger('update_salaire_min'); | |
583 | $('#total_min_euro').trigger('update_total_min_euro'); | |
a3508c67 | 584 | } |
b50b0cd3 | 585 | }, 'json'); |
a3508c67 | 586 | $.post(url_devise, {'valeur_point':max_now}, function(data){ |
681bf3d0 | 587 | $('#id_devise_max').val(data["devise"]); |
588 | $('#devise_max_code').val(data["devise_code"]); | |
589 | $('#taux_max_euro').val(data["taux_euro"]); | |
590 | $('#taux_max_euro_display').empty(); | |
591 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
592 | $('.devise_max_code').trigger('update_devise_max_code'); | |
593 | $('#total_max_euro').trigger('update_total_max_euro'); | |
a3508c67 | 594 | if (min_now == ''){ |
1849a509 | 595 | $('#id_devise_min').val(data["devise"]); |
596 | $('#devise_min_code').val(data["devise_code"]); | |
597 | $('#taux_min_euro').val(data["taux_euro"]); | |
598 | $('#taux_min_euro_display').empty(); | |
599 | $('#taux_min_euro_display').text(data["taux_euro"]); | |
600 | $('.devise_min_code').trigger('update_devise_min_code'); | |
601 | $('#total_min_euro').trigger('update_total_min_euro'); | |
a3508c67 | 602 | } |
681bf3d0 | 603 | }, 'json'); |
604 | }); | |
605 | $('#id_devise_max').change(function(){ | |
63437606 | 606 | devise_max = $('#id_devise_max').val(); |
681bf3d0 | 607 | url_devise_code = "{% url dae_devise_code %}"; |
63437606 | 608 | $.post(url_devise_code, {'devise':devise_max}, function(data){ |
681bf3d0 | 609 | $('#devise_max_code').val(data["devise_code"]); |
610 | $('#taux_max_euro').val(data["taux_euro"]); | |
611 | $('#taux_max_euro_display').empty(); | |
612 | $('#taux_max_euro_display').text(data["taux_euro"]); | |
613 | $('.devise_max_code').trigger('update_devise_max_code'); | |
614 | $('#total_max_euro').trigger('update_total_max_euro'); | |
615 | }, 'json'); | |
616 | }); | |
617 | $('#id_salaire_max').change(function(){ | |
618 | $('#total_max').trigger('update_total_max'); | |
619 | }); | |
620 | $('#id_indemn_max').change(function(){ | |
621 | $('#total_max').trigger('update_total_max'); | |
622 | }); | |
623 | $('#id_autre_max').change(function(){ | |
624 | $('#total_max').trigger('update_total_max'); | |
b50b0cd3 | 625 | }); |
85668061 | 626 | |
a3508c67 | 627 | /* COMPARAISON */ |
628 | ||
629 | $(document).ready(function() { | |
630 | devise_comp_code = '<input type="hidden" id="devise_comp_code" name="devise_comp_code" value="EUR" disabled="disabled">' | |
631 | $('#id_devise_comparaison').after(devise_comp_code) | |
632 | ||
633 | /* simuler id_devise_comparaison change */ | |
634 | devise_comparaison = $('#id_devise_comparaison').val(); | |
635 | url_devise_code = "{% url dae_devise_code %}"; | |
636 | $.post(url_devise_code, {'devise':devise_comparaison}, function(data){ | |
637 | $('#devise_comp_code').val(data["devise_code"]); | |
638 | $('.devise_comp_code').trigger('update_devise_comp_code'); | |
639 | }, 'json'); | |
640 | }); | |
641 | $('.devise_comp_code').bind('update_devise_comp_code', function(){ | |
642 | devise_code = $('#devise_comp_code').val(); | |
643 | $('.devise_comp_code').empty(); | |
644 | $('.devise_comp_code').text(devise_code); | |
645 | }); | |
646 | $('#id_devise_comparaison').change(function(){ | |
647 | devise_comparaison = $('#id_devise_comparaison').val(); | |
648 | url_devise_code = "{% url dae_devise_code %}"; | |
649 | $.post(url_devise_code, {'devise':devise_comparaison}, function(data){ | |
650 | $('#devise_comp_code').val(data["devise_code"]); | |
651 | $('.devise_comp_code').trigger('update_devise_comp_code'); | |
652 | }, 'json'); | |
653 | }); | |
654 | ||
3d627bfd | 655 | /* helpers */ |
85668061 | 656 | function clean_float(value){ |
657 | if (value == undefined) | |
658 | output = 0; | |
659 | else | |
660 | output = parseFloat(value); | |
661 | output = Math.round(output*100)/100; | |
662 | return output; | |
663 | } | |
b50b0cd3 | 664 | |
665 | </script> | |
5d680e84 | 666 | {% endblock %} |