AJAX dossier manquait le poste
[auf_rh_dae.git] / project / dae / templates / dae / embauche.html
CommitLineData
139686f2 1{% extends 'base.html' %}
0e0aeb7e 2{% load adminmedia %}
139686f2 3
e8e75458 4{% block title %}RH - DAE - Embauche{% endblock %}
5{% block titre %}Ressources humaines{% endblock %}
6{% block sous_titre %}Demande d'autorisation d'embauche{% endblock %}
7
139686f2
NC
8{% block extrahead %}
9 <script src="{{ MEDIA_URL }}js/jquery-1.5.1.min.js"
10 type="text/javascript"></script>
da3ca955 11
0e0aeb7e
OL
12 {% comment %} style pour le calendier {% endcomment %}
13 <script type="text/javascript">
14 window.__admin_media_prefix__ = "{% filter escapejs %}{% admin_media_prefix %}{% endfilter %}";
15 </script>
16 <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/calendrier.css" />
17 <script type="text/javascript" src="/admin/jsi18n/"></script>
18 <script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>
19 <script type="text/javascript" src="{% admin_media_prefix %}js/calendar.js"></script>
20 <script type="text/javascript" src="{% admin_media_prefix %}js/admin/DateTimeShortcuts.js"></script>
dfc31755
OL
21 <script src="{{ MEDIA_URL }}js/dae.js" type="text/javascript"></script>
22 <script src="{{ MEDIA_URL }}js/dae-embauche.js" type="text/javascript"></script>
0e0aeb7e 23
da3ca955 24 <style>
25 h2.section {
26 width:100%;
27 background-color: #D0E8F8;
28 text-align: center;
29 color: #5F5F5F;
30 margin: 50px 0px 26px 0px;
31 border-bottom: 3px solid #BBD8EC;
32 padding: 4px;
33 }
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;}
43 .gauche { float:left; }
44 .droite { float:right; text-align:right; }
45 .clear { clear:both; width:100%; }
46 </style>
139686f2 47{% endblock %}
139686f2
NC
48
49{% block main %}
da3ca955 50<h1>Demandes d'autorisation d'engagement de personnel</h1>
0db0aedd 51<form action="" method="post" enctype="multipart/form-data">
da3ca955 52{% if step == 'poste' %}
53 <h2 class="section">SECTION 1 - POSTE</h2>
54 <fieldset>
55 <h2>Poste visé</h2>
56
57 <table cellspacing="0">
139686f2 58 {{ form.as_table }}
da3ca955 59 </table>
60 </fieldset>
139686f2 61
da3ca955 62 <script type="text/javascript">
139686f2
NC
63 $('#id_poste').change(function() {
64 window.location = '{% url embauche %}/' + $(this).val();
65 });
da3ca955 66 </script>
67{% else %}
68 <h2 class="section">SECTION 1 - POSTE</h2>
69 <fieldset>
70 <h2>Poste : {{ poste.nom }} ({{ poste.implantation.nom }})</h2>
71
72 </fieldset>
73
74 <h2 class="section">SECTION 2 - PERSONNEL ENGAGÉ</h2>
75 <fieldset>
76 <div>
77 <div class="gauche"><h2>Personne</h2></div>
78 <div class="droite">
79 <table class="droite">
80 <tbody>
81 <tr>
82 <th>Mobilité interne</th>
83 <td colspan="3"><input id="mobilite_interne" type="checkbox" name="mobilite_interne" /></td>
84 </tr>
85 </tbody>
86 </table>
87 </div>
88 </div>
89 <div class="clear"></div>
90 <table id="form-employe">
91 <tbody>
92 <tr>
93 <th>
94 Employé :<br />
95 {{ forms.employe.employe.errors }}
96 </th>
97 <td colspan="5">{{ forms.employe.employe }}</td>
98 </tr>
99 <tr>
100 <th>
101 {{ forms.employe.nom.label_tag }} :<br />
102 {{ forms.employe.nom.errors }}
103 </th>
104 <td>{{ forms.employe.nom }}</td>
105 <th>
106 {{ forms.employe.prenom.label_tag }} :<br />
107 {{ forms.employe.prenom.errors }}
108 </th>
109 <td>{{ forms.employe.prenom }}</td>
110 <th>
111 {{ forms.employe.genre.label_tag }} :<br />
112 {{ forms.employe.genre.errors }}
113 </th>
114 <td>{{ forms.employe.genre }}</td>
115 </tr>
116 </tbody>
117 </table>
118
119 <input type="hidden" id="poste" name="poste"
120 value="dae-{{ poste.id }}" />
121 <input type="hidden" id="implantation" name="implantation"
122 value="{{ poste.implantation_id }}" />
123 <input type="hidden" id="dossier" name="dossier"
124 value="{{ dossier.id }}" />
125 </fieldset>
126
127 <script type="text/javascript">
0e0aeb7e
OL
128
129 /* Ajout des datespickers sur les inputs loadés via AJAX.
130 On s'assure qu'on est pas dans le cas initial où ils sont déjà ajoutés.
131 (La façon dont c'est fait requiert que les inputs soient uniquement dans la partie AJAX).*/
132 function datepicker() {
133 var date_pickers = $(".datetimeshortcuts");
134 if (date_pickers.length == 0)
135 DateTimeShortcuts.init();
136 }
137
139686f2
NC
138 function activateEmployeDropDown() {
139 $('#id_employe').change(loadEmploye);
140 }
141
142 function loadEmploye() {
143 var employeUrl = '{% url employe %}/' + $(this).val();
144 $('#form-employe').html('<tr><td>Chargement...</td></tr>')
da3ca955 145 .load(employeUrl, activateEmployeDropDown);
139686f2 146 var dossierUrl = '{% url dossier %}/' + $('#poste').val() +
da3ca955 147 '/' + $(this).val();
139686f2 148 $('#form-dossier').html('<tr><td>Chargement...</td></tr>')
0e0aeb7e
OL
149 .load(dossierUrl, function() {
150 datepicker();
151 activateDossierDropDowns();
152 });
139686f2 153 }
139686f2
NC
154 activateEmployeDropDown();
155 </script>
156
0801327c 157 {% with forms.dossier as form %}
da3ca955 158 {% include "dae/embauche-dossier.html" %}
0801327c 159 {% endwith %}
6b34f27e 160
dbb687ad
OL
161 <fieldset>
162 <h2>Pièces jointes</h2>
163 <p class="info">CV, lettre de motivation...</p>
164 {% include "dae/pieces.html" %}
165 </fieldset>
166
139686f2
NC
167 <script type="text/javascript">
168 function activateDossierDropDowns() {
169 $('#id_classement, #id_devise').change(loadSalaire);
170 }
171
172 function loadSalaire() {
173 $.getJSON('{% url salaire %}/' + $('#implantation').val() + '/' +
174 $('#id_devise').val() + '/' + $('#id_classement').val(),
175 function(data) {
139686f2
NC
176 $('#id_salaire').val(data.salaire_devise);
177 });
178 }
179
180 activateDossierDropDowns();
181 </script>
cb1d62b5 182
0801327c
NC
183 <h2 class="section">SECTION 3 - COÛT GLOBAL</h2>
184
cb1d62b5 185 <fieldset>
cb1d62b5
NC
186
187 {% if new %}
188 <p>
189 Vous devez enregister ce dossier avant de pouvoir détailler le
190 coût global.
191 </p>
192 {% else %}
193 <table cellspacing="0" id="global-cost">
194 {% include 'dae/embauche-remun.html' %}
195 </table>
196
197 <select id="type-remun" name="type-remun">
198 <option value="">(Ajouter une ligne)</option>
199 {% for tr in type_remun %}
200 <option value="{{ tr.id }}">{{ tr.nom }}</option>
201 {% endfor %}
202 </select>
203 {% endif %}
204
205 </fieldset>
206
8629520e
NC
207 <script type="text/javascript">
208 function round2(n) {
209 return Math.round(n * 100) / 100;
210 }
211
212 $('#global-cost input[id^="montant"]').live('keyup', function() {
213 var value = $(this).val(),
214 idParts = $(this).attr('id').split('-'),
215 name = idParts[0],
216 id = idParts[1];
217 if (name == 'montant') {
218 $('#montant_mois-' + id).val(round2(value / 12));
219 } else {
220 value = value * 12;
221 $('#montant-' + id).val(round2(value));
222 }
223 var taux = $('#taux_devise-' + id).val();
224 $('#montant_euro_mois-' + id).text(round2(value / taux / 12));
225 $('#montant_euro-' + id).text(round2(value / taux));
226 });
227 </script>
228
0801327c
NC
229 <h2 class="section">SECTION 4 - JUSTIFICATION DE LA DEMANDE (OBLIGATOIRE)</h2>
230
139686f2 231 <input type="submit" name="save" value="Sauvegarder" />
cb1d62b5
NC
232 </form>
233 <script type="text/javascript">
234 $('#type-remun').change(function() {
235 if ($(this).val() != '') {
236 $('#global-cost').html('<tr><td>Chargement...</td></tr>')
237 .load('{% url add_remun %}/' +
238 $('#dossier').val() + '/' +
239 $(this).val(), function() {
240 $('#type-remun').val('');
241 });
242 }
243 });
244 </script>
245 {% endif %}
139686f2
NC
246{% endblock %}
247