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