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