Projet

Général

Profil

« Précédent | Suivant » 

Révision 8f67b4a1

Ajouté par Jérôme Schneider il y a environ 10 ans

dossiers: continue to split javascript to support new tabs

Refs #2357

Voir les différences:

calebasse/static/js/calebasse.dossiers.js
49 49
            });
50 50
}
51 51

  
52
function load_tab1_general(tab) {
52
function load_tab1_general() {
53 53
    $('#update-paper-id-btn').click(function() {
54 54
        generic_ajaxform_dialog('update/paper_id', 'Modifier le numéro du dossier papier',
55 55
            '#ajax-dlg', '500px', 'Modifier');
......
100 100
    });
101 101
}
102 102

  
103
function load_tab2_adm(tab) {
103
function load_tab2_adm() {
104 104
    init_magic_dialog();
105 105
    $('#prescription-transport-btn').click(function() {
106 106
        $('#ajax-dlg').load('prescription-transport',
......
129 129
    $('input#id_id-birthdate', this).datepicker({dateFormat: 'd/m/yy', showOn: 'button' });
130 130
}
131 131

  
132
function load_tab3_addresses(tab) {
132
function load_tab3_addresses() {
133
    function nir_check(that) {
134
      $(that).find('#social-security-id input').keyup(function() {
135
        if ($(this).val().length < 13) {
136
             $('p#nir-key span').removeAttr('id')
137
             $('p#nir-key span').text('-');
138
         } else {
139
             $('p#nir-key span').attr('id', 'highlight')
140
             var nir = $(this).val();
141
             var minus = 0;
142
             if (nir.charAt(6) == 'A'){
143
               nir = nir.replace('A', '0');
144
               minus = 1000000;
145
             }
146
             if (nir.charAt(6) == 'B'){
147
               nir = nir.replace('B', '0');
148
               minus = 2000000;
149
             }
150
             nir = parseInt(nir, 10);
151
             nir = nir - minus;
152
             var key = 97 - (nir % 97);
153
             if (isNaN(key)) {
154
                 $('p#nir-key span').text('NIR invalide');
155
             } else {
156
                 $('p#nir-key span').text(key);
157
             }
158
         }
159
      });
160
    }
133 161
    $('.policyholder-radio').click(function() {
134 162
        $("#policyholder-form").submit();
135 163
    });
......
159 187
    });
160 188

  
161 189

  
162
    function nir_check(that) {
163
      $(that).find('#social-security-id input').keyup(function() {
164
        if ($(this).val().length < 13) {
165
             $('p#nir-key span').removeAttr('id')
166
             $('p#nir-key span').text('-');
167
         } else {
168
             $('p#nir-key span').attr('id', 'highlight')
169
             var nir = $(this).val();
170
             var minus = 0;
171
             if (nir.charAt(6) == 'A'){
172
               nir = nir.replace('A', '0');
173
               minus = 1000000;
174
             }
175
             if (nir.charAt(6) == 'B'){
176
               nir = nir.replace('B', '0');
177
               minus = 2000000;
178
             }
179
             nir = parseInt(nir, 10);
180
             nir = nir - minus;
181
             var key = 97 - (nir % 97);
182
             if (isNaN(key)) {
183
                 $('p#nir-key span').text('NIR invalide');
184
             } else {
185
                 $('p#nir-key span').text(key);
186
             }
187
         }
188
      });
189
    }
190 190
      $('.place_of_life').click(function() {
191 191
          if ((this.checked) == true) {
192 192
              var value = "true";
......
221 221
    });
222 222
}
223 223

  
224
function load_tab4_notifs(tab) {
224
function load_tab4_notifs() {
225
    $('#new-hctrait-btn').click(function() {
226
        generic_ajaxform_dialog('healthcare_treatment/new', 'Ajouter une prise en charge de traitement',
227
            '#ajax-dlg', '600px', 'Ajouter', null, add_datepickers);
228
    });
229
    $('#new-hcdiag-btn').click(function() {
230
        generic_ajaxform_dialog('healthcare_diagnostic/new', 'Ajouter une prise en charge de diagnostic',
231
            '#ajax-dlg', '600px', 'Ajouter', null, add_datepickers);
232
    });
233
    $('#new-notification-btn').click(function() {
234
        generic_ajaxform_dialog('healthcare_notification/new', 'Ajouter une notification',
235
            '#ajax-dlg', '600px', 'Ajouter', null, add_datepickers);
236
    });
237
    $('.update-hctrait-btn').click(function() {
238
        generic_ajaxform_dialog('healthcare_treatment/' + $(this).data('id') + '/update', 'Modifier une prise en charge de traitement',
239
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
240
    });
241
    $('.update-hcdiag-btn').click(function() {
242
        generic_ajaxform_dialog('healthcare_diagnostic/' + $(this).data('id') + '/update', 'Modifier une prise en charge de diagnostic',
243
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
244
    });
245
    $('.update-notification-btn').click(function() {
246
        generic_ajaxform_dialog('healthcare_notification/' + $(this).data('id') + '/update', 'Modifier une notification',
247
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
248
    });
249
    $('.del-hctrait').click(function() {
250
        generic_ajaxform_dialog('healthcare_treatment/' + $(this).data('id') + '/del', 'Supprimer une prise en charge de traitement',
251
            '#ajax-dlg', '500px', 'Supprimer');
252
    });
253
    $('.del-hcdiag').click(function() {
254
        generic_ajaxform_dialog('healthcare_diagnostic/' + $(this).data('id') + '/del', 'Supprimer une prise en charge de diagnostic',
255
            '#ajax-dlg', '500px', 'Supprimer');
256
    });
257
    $('.del-notification').click(function() {
258
        generic_ajaxform_dialog('healthcare_notification/' + $(this).data('id') + '/del', 'Supprimer une notification',
259
            '#ajax-dlg', '500px', 'Supprimer');
260
    });
261

  
225 262
}
226
function load_tab5_last_acts(tab) {
263

  
264
function load_tab5_last_acts() {
227 265
}
228
function load_tab6_next_rdv(tab) {
266

  
267
function load_tab6_next_rdv() {
229 268
}
230
function load_tab7_socialisation(tab) {
269

  
270
function load_tab7_socialisation() {
271
    $('#new-socialisation-duration-btn').click(function() {
272
        generic_ajaxform_dialog('socialisation/new', 'Ajouter une période de socialisation',
273
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
274
    });
275
    $('.update-duration-btn').click(function() {
276
        generic_ajaxform_dialog('socialisation/' + $(this).data('id') + '/update', 'Modifier une période de socialisation',
277
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
278
    });
279
    $('.del-duration').click(function() {
280
        generic_ajaxform_dialog('socialisation/' + $(this).data('id') + '/del', 'Supprimer une période de socialisation',
281
            '#ajax-dlg', '500px', 'Supprimer');
282
    });
283
    $('#new-mdph-request-btn').click(function() {
284
        generic_ajaxform_dialog('mdph_request/new', 'Ajouter une demande MDPH',
285
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
286
    });
287
    $('.update-mdph-request-btn').click(function() {
288
        generic_ajaxform_dialog('mdph_request/' + $(this).data('id') + '/update', 'Modifier une demande MDPH',
289
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
290
    });
291
    $('.del-mdph-request').click(function() {
292
        generic_ajaxform_dialog('mdph_request/' + $(this).data('id') + '/del', 'Supprimer une demande MDPH',
293
            '#ajax-dlg', '500px', 'Supprimer');
294
    });
295
    $('#new-mdph-response-btn').click(function() {
296
        generic_ajaxform_dialog('mdph_response/new', 'Ajouter une réponse MDPH',
297
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
298
    });
299
    $('.update-mdph-response-btn').click(function() {
300
        generic_ajaxform_dialog('mdph_response/' + $(this).data('id') + '/update', 'Modifier une réponse MDPH',
301
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
302
    });
303
    $('.del-mdph-response').click(function() {
304
        generic_ajaxform_dialog('mdph_response/' + $(this).data('id') + '/del', 'Supprimer une réponse MDPH',
305
            '#ajax-dlg', '500px', 'Supprimer');
306
    });
231 307
}
232
function load_tab8_medical(tab) {
308
function load_tab8_medical() {
233 309
}
234 310

  
235 311

  
......
240 316
            var tabid = $(ui.tab).attr('id');
241 317
            console.log(tabid);
242 318
            if (tabid == "ui-id-1")
243
                load_tab1_general($(ui.tab));
319
                load_tab1_general();
244 320
            else if (tabid == "ui-id-2")
245
                load_tab2_adm($(ui.tab));
321
                load_tab2_adm();
246 322
            else if (tabid == "ui-id-3")
247
                load_tab3_addresses($(ui.tab));
248
            else if (tabid == "ui-id-4") {
249
            }
250
            else if (tabid == "ui-id-5") {
251
            }
252
            else if (tabid == "ui-id-6") {
253
            }
254
            else if (tabid == "ui-id-7") {
255
            }
256
            else if (tabid == "ui-id-8") {
257
            }
323
                load_tab3_addresses();
324
            else if (tabid == "ui-id-4")
325
                load_tab4_notifs();
326
            else if (tabid == "ui-id-7")
327
                load_tab7_socialisation();
328
            else if (tabid == "ui-id-8")
329
                load_tab8_medical();
258 330

  
259 331
        },
260 332
        });
......
312 384
    });
313 385

  
314 386

  
315
    $('#new-socialisation-duration-btn').click(function() {
316
        generic_ajaxform_dialog('socialisation/new', 'Ajouter une période de socialisation',
317
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
318
    });
319
    $('.update-duration-btn').click(function() {
320
        generic_ajaxform_dialog('socialisation/' + $(this).data('id') + '/update', 'Modifier une période de socialisation',
321
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
322
    });
323
    $('.del-duration').click(function() {
324
        generic_ajaxform_dialog('socialisation/' + $(this).data('id') + '/del', 'Supprimer une période de socialisation',
325
            '#ajax-dlg', '500px', 'Supprimer');
326
    });
327
    $('#new-mdph-request-btn').click(function() {
328
        generic_ajaxform_dialog('mdph_request/new', 'Ajouter une demande MDPH',
329
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
330
    });
331
    $('.update-mdph-request-btn').click(function() {
332
        generic_ajaxform_dialog('mdph_request/' + $(this).data('id') + '/update', 'Modifier une demande MDPH',
333
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
334
    });
335
    $('.del-mdph-request').click(function() {
336
        generic_ajaxform_dialog('mdph_request/' + $(this).data('id') + '/del', 'Supprimer une demande MDPH',
337
            '#ajax-dlg', '500px', 'Supprimer');
338
    });
339
    $('#new-mdph-response-btn').click(function() {
340
        generic_ajaxform_dialog('mdph_response/new', 'Ajouter une réponse MDPH',
341
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
342
    });
343
    $('.update-mdph-response-btn').click(function() {
344
        generic_ajaxform_dialog('mdph_response/' + $(this).data('id') + '/update', 'Modifier une réponse MDPH',
345
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
346
    });
347
    $('.del-mdph-response').click(function() {
348
        generic_ajaxform_dialog('mdph_response/' + $(this).data('id') + '/del', 'Supprimer une réponse MDPH',
349
            '#ajax-dlg', '500px', 'Supprimer');
350
    });
351
    $('#new-hctrait-btn').click(function() {
352
        generic_ajaxform_dialog('healthcare_treatment/new', 'Ajouter une prise en charge de traitement',
353
            '#ajax-dlg', '600px', 'Ajouter', null, add_datepickers);
354
    });
355
    $('#new-hcdiag-btn').click(function() {
356
        generic_ajaxform_dialog('healthcare_diagnostic/new', 'Ajouter une prise en charge de diagnostic',
357
            '#ajax-dlg', '600px', 'Ajouter', null, add_datepickers);
358
    });
359
    $('#new-notification-btn').click(function() {
360
        generic_ajaxform_dialog('healthcare_notification/new', 'Ajouter une notification',
361
            '#ajax-dlg', '600px', 'Ajouter', null, add_datepickers);
362
    });
363
    $('.update-hctrait-btn').click(function() {
364
        generic_ajaxform_dialog('healthcare_treatment/' + $(this).data('id') + '/update', 'Modifier une prise en charge de traitement',
365
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
366
    });
367
    $('.update-hcdiag-btn').click(function() {
368
        generic_ajaxform_dialog('healthcare_diagnostic/' + $(this).data('id') + '/update', 'Modifier une prise en charge de diagnostic',
369
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
370
    });
371
    $('.update-notification-btn').click(function() {
372
        generic_ajaxform_dialog('healthcare_notification/' + $(this).data('id') + '/update', 'Modifier une notification',
373
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
374
    });
375
    $('.del-hctrait').click(function() {
376
        generic_ajaxform_dialog('healthcare_treatment/' + $(this).data('id') + '/del', 'Supprimer une prise en charge de traitement',
377
            '#ajax-dlg', '500px', 'Supprimer');
378
    });
379
    $('.del-hcdiag').click(function() {
380
        generic_ajaxform_dialog('healthcare_diagnostic/' + $(this).data('id') + '/del', 'Supprimer une prise en charge de diagnostic',
381
            '#ajax-dlg', '500px', 'Supprimer');
382
    });
383
    $('.del-notification').click(function() {
384
        generic_ajaxform_dialog('healthcare_notification/' + $(this).data('id') + '/del', 'Supprimer une notification',
385
            '#ajax-dlg', '500px', 'Supprimer');
386
    });
387

  
388 387
    $('.update-patient-state-btn').click(function() {
389 388
        generic_ajaxform_dialog('state/' + $(this).data('id') + '/update', 'Modifier un état',
390 389
            '#ajax-dlg', '500px', 'Modifier', '#histo', add_datepickers);

Formats disponibles : Unified diff