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