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