Commit | Line | Data |
---|---|---|
139686f2 NC |
1 | {% extends 'base.html' %} |
2 | ||
3 | {% block extrahead %} | |
4 | <script src="{{ MEDIA_URL }}js/jquery-1.5.1.min.js" | |
5 | type="text/javascript"></script> | |
6 | {% endblock %} | |
7 | ||
8 | {% block title %} | |
9 | Embauche | |
10 | {% endblock %} | |
11 | ||
12 | {% block main %} | |
0f23302a | 13 | <h1>Autorisation d'embauche</h1> |
139686f2 | 14 | <form action="" method="post"> |
139686f2 NC |
15 | {% if step == 'poste' %} |
16 | <h2>Poste visé</h2> | |
17 | ||
18 | <table cellspacing="0"> | |
19 | {{ form.as_table }} | |
20 | </table> | |
21 | ||
22 | <script type="text/javascript"> | |
23 | $('#id_poste').change(function() { | |
24 | window.location = '{% url embauche %}/' + $(this).val(); | |
25 | }); | |
26 | </script> | |
27 | {% else %} | |
139686f2 | 28 | |
0f23302a | 29 | <h2>Poste</h2> |
30 | <p>{{ poste }}</p> | |
139686f2 NC |
31 | |
32 | <h2>Employé</h2> | |
33 | ||
34 | <table cellspacing="0" id="form-employe"> | |
35 | {{ forms.employe.as_table }} | |
36 | </table> | |
37 | ||
38 | <input type="hidden" id="poste" name="poste" value="dae-{{ poste.id }}" /> | |
39 | <input type="hidden" id="implantation" name="implantation" | |
40 | value="{{ poste.implantation_id }}" /> | |
768d7e1b NC |
41 | <input type="hidden" id="dossier" name="dossier" |
42 | value="{{ dossier.id }}" /> | |
139686f2 NC |
43 | |
44 | <script type="text/javascript"> | |
45 | function activateEmployeDropDown() { | |
46 | $('#id_employe').change(loadEmploye); | |
47 | } | |
48 | ||
49 | function loadEmploye() { | |
50 | var employeUrl = '{% url employe %}/' + $(this).val(); | |
51 | $('#form-employe').html('<tr><td>Chargement...</td></tr>') | |
52 | .load(employeUrl, activateEmployeDropDown); | |
53 | var dossierUrl = '{% url dossier %}/' + $('#poste').val() + | |
54 | '/' + $(this).val(); | |
55 | $('#form-dossier').html('<tr><td>Chargement...</td></tr>') | |
56 | .load(dossierUrl, activateDossierDropDowns); | |
57 | } | |
58 | ||
59 | activateEmployeDropDown(); | |
60 | </script> | |
61 | ||
62 | <h2>Dossier</h2> | |
63 | ||
64 | <table cellspacing="0" id="form-dossier"> | |
65 | {{ forms.dossier.as_table }} | |
66 | </table> | |
67 | ||
68 | <script type="text/javascript"> | |
69 | function activateDossierDropDowns() { | |
70 | $('#id_classement, #id_devise').change(loadSalaire); | |
71 | } | |
72 | ||
73 | function loadSalaire() { | |
74 | $.getJSON('{% url salaire %}/' + $('#implantation').val() + '/' + | |
75 | $('#id_devise').val() + '/' + $('#id_classement').val(), | |
76 | function(data) { | |
77 | console.log(data); | |
78 | $('#id_salaire').val(data.salaire_devise); | |
79 | }); | |
80 | } | |
81 | ||
82 | activateDossierDropDowns(); | |
83 | </script> | |
84 | <input type="submit" name="save" value="Sauvegarder" /> | |
85 | {% endif %} | |
86 | </form> | |
87 | {% endblock %} | |
88 |