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