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 %} | |
13 | <form action="" method="post"> | |
14 | ||
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 %} | |
28 | <h1>Autorisation d'embauche</h1> | |
29 | ||
30 | <p><strong>Poste</strong>: {{ poste }}</p> | |
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 }}" /> | |
41 | ||
42 | <script type="text/javascript"> | |
43 | function activateEmployeDropDown() { | |
44 | $('#id_employe').change(loadEmploye); | |
45 | } | |
46 | ||
47 | function loadEmploye() { | |
48 | var employeUrl = '{% url employe %}/' + $(this).val(); | |
49 | $('#form-employe').html('<tr><td>Chargement...</td></tr>') | |
50 | .load(employeUrl, activateEmployeDropDown); | |
51 | var dossierUrl = '{% url dossier %}/' + $('#poste').val() + | |
52 | '/' + $(this).val(); | |
53 | $('#form-dossier').html('<tr><td>Chargement...</td></tr>') | |
54 | .load(dossierUrl, activateDossierDropDowns); | |
55 | } | |
56 | ||
57 | activateEmployeDropDown(); | |
58 | </script> | |
59 | ||
60 | <h2>Dossier</h2> | |
61 | ||
62 | <table cellspacing="0" id="form-dossier"> | |
63 | {{ forms.dossier.as_table }} | |
64 | </table> | |
65 | ||
66 | <script type="text/javascript"> | |
67 | function activateDossierDropDowns() { | |
68 | $('#id_classement, #id_devise').change(loadSalaire); | |
69 | } | |
70 | ||
71 | function loadSalaire() { | |
72 | $.getJSON('{% url salaire %}/' + $('#implantation').val() + '/' + | |
73 | $('#id_devise').val() + '/' + $('#id_classement').val(), | |
74 | function(data) { | |
75 | console.log(data); | |
76 | $('#id_salaire').val(data.salaire_devise); | |
77 | }); | |
78 | } | |
79 | ||
80 | activateDossierDropDowns(); | |
81 | </script> | |
82 | <input type="submit" name="save" value="Sauvegarder" /> | |
83 | {% endif %} | |
84 | </form> | |
85 | {% endblock %} | |
86 |