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