179 |
|
|
180 |
function changeDataSelect(tn, ds, joker){ |
function changeDataSelect(tn, ds, joker){ |
181 |
|
|
182 |
var idArrondissement = $("#"+ds+" option:selected").val(); |
var id = $("#"+ds+" option:selected").val(); |
183 |
link = "../app/listData.php?idx=" + idArrondissement + "&tn=" + tn + "&ds=" + ds; |
link = "../app/listData.php?idx=" + id + "&tn=" + tn + "&ds=" + ds; |
184 |
$.ajax({ |
$.ajax({ |
185 |
type: "GET", |
type: "GET", |
186 |
url: link, |
url: link, |
237 |
fenetreouverte = true; |
fenetreouverte = true; |
238 |
} |
} |
239 |
|
|
240 |
|
/* |
241 |
|
Ajoute le formulaire d'jout de référence cadastrale personnalisé |
242 |
|
* */ |
243 |
$(function() { |
$(function() { |
244 |
//hideFields(); |
|
245 |
|
|
246 |
|
|
247 |
|
url = document.location + "" ; |
248 |
|
if ( $('#date_demande').length > 0 |
249 |
|
&& !$('#dossier_autorisation_type_detaille').is(':disabled') |
250 |
|
&& url.indexOf("form.php?obj=demande&action=0") != -1 ){ |
251 |
|
|
252 |
|
$.ajax({ |
253 |
|
type: "GET", |
254 |
|
url: "sousform.php?obj=demandeur&action=0&tri=&objsf=demandeur&premiersf=0", |
255 |
|
cache: false, |
256 |
|
success: function(html){ |
257 |
|
|
258 |
|
$('.lots').append(createFieldset('test', 'test')); |
259 |
|
$('.test').html(html); |
260 |
|
$('.test').html($('.test .formEntete>#form-content').html()); |
261 |
|
$('.libelle-demande').parent().parent().remove(); |
262 |
|
|
263 |
|
setSelectCivilite(); |
264 |
|
}, |
265 |
|
async: false |
266 |
|
}); |
267 |
|
|
268 |
|
$('.lots').append(createFieldset('Pétitionnaire(s)', 'petitionnaire')); |
269 |
|
$('.petitionnaire').append( |
270 |
|
'<div class="field field-type-text morePetitionnaire" style="display: table-row;">' + |
271 |
|
'<div class="form-libelle">' + |
272 |
|
'<label class="libelle-more_petitionnaire" for="terrain_superficie"> + Ajouter un autre pétitionnaire </label>' + |
273 |
|
'</div>' + |
274 |
|
'<div class="form-content">' + |
275 |
|
'</div>' + |
276 |
|
'</div>'); |
277 |
|
|
278 |
|
$('.morePetitionnaire').click( function() { |
279 |
|
alert('test'); |
280 |
|
}); |
281 |
|
|
282 |
|
$('.lots').append(createFieldset('Délégataire', 'delegataire')); |
283 |
|
setDelegataire(); |
284 |
|
|
285 |
|
$(".datepicker").each( |
286 |
|
function(){ |
287 |
|
inputdate_bind_datepicker(); |
288 |
|
} |
289 |
|
); |
290 |
|
|
291 |
|
hideFields(); |
292 |
|
} |
293 |
|
|
294 |
|
if ( $('#date_demande').length > 0 |
295 |
|
&& !$('#dossier_autorisation_type_detaille').is(':disabled') |
296 |
|
&& url.indexOf("form.php?obj=demande&action=1") != -1 ){ |
297 |
|
|
298 |
|
addNewFieldReferencesCadastrales(); |
299 |
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
300 |
|
|
301 |
|
reference_cadastrale = $('#terrain_references_cadastrales').val(); |
302 |
|
/*Formatage de la reference cadastrale*/ |
303 |
|
if ( reference_cadastrale != '' ){ |
304 |
|
|
305 |
|
|
306 |
|
references_cadastrales = reference_cadastrale.split(';'); |
307 |
|
donnees = new Array(); |
308 |
|
|
309 |
|
i = 0 ; |
310 |
|
for ( l = 0 ; l < references_cadastrales.length - 1 ; l ++ ){ |
311 |
|
|
312 |
|
k = 0; |
313 |
|
donnees[i] = ''; |
314 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
315 |
|
if ( references_cadastrales[l].charAt(j) >= 0 && references_cadastrales[l].charAt(j) <= 9 ){ |
316 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
317 |
|
k++; |
318 |
|
} else { |
319 |
|
i++; |
320 |
|
break; |
321 |
|
} |
322 |
|
|
323 |
|
|
324 |
|
donnees[i] = ''; |
325 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
326 |
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
327 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
328 |
|
k++; |
329 |
|
} else { |
330 |
|
i++; |
331 |
|
break; |
332 |
|
} |
333 |
|
|
334 |
|
donnees[i] = ''; |
335 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
336 |
|
if ( references_cadastrales[l].charAt(j) >= 0 && references_cadastrales[l].charAt(j) <= 9 ){ |
337 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
338 |
|
k++; |
339 |
|
} else { |
340 |
|
break; |
341 |
|
} |
342 |
|
|
343 |
|
m = 0 ; |
344 |
|
if ( k < references_cadastrales[l].length ){ |
345 |
|
|
346 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
347 |
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
348 |
|
m++; |
349 |
|
donnees[++i] = references_cadastrales[l].charAt(j); |
350 |
|
donnees[++i] = ''; |
351 |
|
} |
352 |
|
else { |
353 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
354 |
|
} |
355 |
|
} |
356 |
|
|
357 |
|
donnees[++i] = ';'; |
358 |
|
i++; |
359 |
|
|
360 |
|
if ( l > 0 ) |
361 |
|
$('.reference_cadastrale_custom_fields').append( "<br/>" + fieldReferenceCadastraleBase()); |
362 |
|
actionFormReferenceCadastrale(); |
363 |
|
|
364 |
|
if ( m > 0 ){ |
365 |
|
|
366 |
|
for ( j = 0 ; j < m ; j++ ) |
367 |
|
$('#moreFieldReferenceCadastrale' + ( $('.moreFieldReferenceCadastrale').length - 1 ) ).before(newInputReferenceCadastrale()); |
368 |
|
} |
369 |
|
} |
370 |
|
|
371 |
|
actionLineFormReferenceCadastrale(); |
372 |
|
|
373 |
|
$('.reference_cadastrale_custom_field').each( |
374 |
|
function(index) { |
375 |
|
$(this).val(donnees[index]) |
376 |
|
} |
377 |
|
); |
378 |
|
} |
379 |
|
} |
380 |
}); |
}); |
381 |
|
|
382 |
|
/* |
383 |
|
Création du formulaire pour le délégataire |
384 |
|
* */ |
385 |
|
function setDelegataire(){ |
386 |
|
$('.delegataire').html($('.test').html()); |
387 |
|
|
388 |
|
$('.delegataire #type_demandeur').parent().parent().remove(); |
389 |
|
$('.delegataire #personne_morale_denomination').parent().parent().remove(); |
390 |
|
$('.delegataire #personne_morale_raison_sociale').parent().parent().remove(); |
391 |
|
$('.delegataire #personne_morale_siret').parent().parent().remove(); |
392 |
|
$('.delegataire #personne_morale_categorie_juridique').parent().parent().remove(); |
393 |
|
$('.delegataire #personne_morale_civilite').parent().parent().remove(); |
394 |
|
$('.delegataire #personne_morale_nom').parent().parent().remove(); |
395 |
|
$('.delegataire #personne_morale_prenom').parent().parent().remove(); |
396 |
|
$('.delegataire #frequent').parent().parent().remove(); |
397 |
|
|
398 |
|
$('.delegataire input').each( |
399 |
|
function(){ |
400 |
|
$(this).attr('id', 'delegataire_' + $(this).attr('id') ); |
401 |
|
$(this).attr('name', 'delegataire_' + $(this).attr('name') ); |
402 |
|
} |
403 |
|
); |
404 |
|
addDatePicker('delegataire_particulier_date_naissance'); |
405 |
|
$('.delegataire select').attr('id', 'delegataire_' + $('.delegataire select').attr('id')); |
406 |
|
$('.delegataire select').attr('name', 'delegataire_' + $('.delegataire select').attr('name')); |
407 |
|
} |
408 |
|
|
409 |
|
function addDatePicker(id){ |
410 |
|
|
411 |
|
$("#" + id ).datepicker({ |
412 |
|
dateFormat: dateFormat, |
413 |
|
changeMonth: true, |
414 |
|
changeYear: true, |
415 |
|
yearRange: minYear+':'+maxYear, |
416 |
|
showOn: 'button', |
417 |
|
buttonImage: '../img/calendar.png', |
418 |
|
buttonImageOnly: true, |
419 |
|
constrainInput: true |
420 |
|
}); |
421 |
|
} |
422 |
|
|
423 |
|
/* |
424 |
|
Création des select pour la civilité |
425 |
|
* */ |
426 |
|
function setSelectCivilite(){ |
427 |
|
|
428 |
|
$.ajax({ |
429 |
|
type: "GET", |
430 |
|
url: "../app/civilite.php", |
431 |
|
dataType: "json", |
432 |
|
cache: false, |
433 |
|
success: function(html){ |
434 |
|
if ( html != '' ){ |
435 |
|
|
436 |
|
$('#particulier_civilite').parent().html('<select id="particulier_civilite" class="champFormulaire" size="1" name="particulier_civilite">' + |
437 |
|
'<option value="" selected="selected">choisir particulier_civilite</option>'); |
438 |
|
$('#personne_morale_civilite').parent().html('<select id="personne_morale_civilite" class="champFormulaire" size="1" name="personne_morale_civilite">' + |
439 |
|
'<option value="" selected="selected">choisir personne_morale_civilite</option>'); |
440 |
|
|
441 |
|
civilite = html.split(';'); |
442 |
|
for ( i = 0 ; i < civilite.length - 1 ; i++ ){ |
443 |
|
|
444 |
|
$('#particulier_civilite').append('<option value="' + civilite[i] + '">' + civilite[i] + '</option>'); |
445 |
|
$('#personne_morale_civilite').append('<option value="' + civilite[i] + '">' + civilite[i] + '</option>'); |
446 |
|
} |
447 |
|
|
448 |
|
$('#particulier_civilite').append('</select>'); |
449 |
|
$('#personne_morale_civilite').append('</select>'); |
450 |
|
} |
451 |
|
}, |
452 |
|
async: false |
453 |
|
}); |
454 |
|
} |
455 |
|
|
456 |
|
/* |
457 |
|
Retourne le code HTML d'un fieldset |
458 |
|
* */ |
459 |
|
function createFieldset(name, className){ |
460 |
|
return '<fieldset class="cadre ui-corner-all ui-widget-content">' + |
461 |
|
'<legend class="ui-corner-all ui-widget-content ui-state-active">' + name + ' </legend>' + |
462 |
|
'<div class="fieldsetContent ' + className + '">' + |
463 |
|
'</div>' + |
464 |
|
'<div class="visualClear"></div>' + |
465 |
|
'</div>' + |
466 |
|
'</fieldset>'; |
467 |
|
} |
468 |
|
|
469 |
|
/* |
470 |
|
Test str est une lettre de l'alphabet |
471 |
|
* */ |
472 |
|
function isAlpha(str) { |
473 |
|
return /^[a-zA-Z\/]+$/.test(str); |
474 |
|
} |
475 |
|
|
476 |
|
/* |
477 |
|
Ajoute les ations spécifiques pour le formulaire personnalisé d'ajout de référence cadastrale |
478 |
|
* */ |
479 |
|
function actionFormReferenceCadastrale(){ |
480 |
|
$('form').submit( |
481 |
|
function(){ |
482 |
|
|
483 |
|
var reference_cadastrale = ''; |
484 |
|
|
485 |
|
$('.reference_cadastrale_custom_field').each( |
486 |
|
function(){ |
487 |
|
|
488 |
|
reference_cadastrale += $(this).val(); |
489 |
|
} |
490 |
|
); |
491 |
|
|
492 |
|
$('#terrain_references_cadastrales').val(reference_cadastrale); |
493 |
|
} |
494 |
|
); |
495 |
|
|
496 |
|
$('#moreFieldReferenceCadastrale' + ($('.moreFieldReferenceCadastrale').length - 1 )).on("click", function() { |
497 |
|
$(this).before(newInputReferenceCadastrale()); |
498 |
|
}); |
499 |
|
} |
500 |
|
|
501 |
|
/* |
502 |
|
Action pour l'ajout de nouvelle ligne |
503 |
|
* */ |
504 |
|
function actionLineFormReferenceCadastrale(){ |
505 |
|
$('#morelineReferenceCadastrale').click( |
506 |
|
function(){ |
507 |
|
|
508 |
|
$('.reference_cadastrale_custom_fields').append( "<br/>" + fieldReferenceCadastraleBase()); |
509 |
|
$('#moreFieldReferenceCadastrale'+ ($('.moreFieldReferenceCadastrale').length - 1 )).on("click", function() { |
510 |
|
$(this).before(newInputReferenceCadastrale()); |
511 |
|
}); |
512 |
|
} |
513 |
|
); |
514 |
|
} |
515 |
|
|
516 |
|
/* |
517 |
|
Met à jour le select demande_type dès qu'un dossier_autorisation_type_detaille est choisi |
518 |
|
* */ |
519 |
function changeDemandeType(){ |
function changeDemandeType(){ |
520 |
|
|
521 |
var idDossierAutorisationTypeDetaille = $("#dossier_autorisation_type_detaille option:selected").val(); |
var idDossierAutorisationTypeDetaille = $("#dossier_autorisation_type_detaille option:selected").val(); |
523 |
if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){ |
if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){ |
524 |
|
|
525 |
changeDataSelect('demande_type','dossier_autorisation_type_detaille'); |
changeDataSelect('demande_type','dossier_autorisation_type_detaille'); |
526 |
|
if ( $('#demande_type option').size() < 2 ) |
527 |
|
showFormsDemande(); |
528 |
|
|
529 |
$('#demande_type').parent().parent().show(); |
$('#demande_type').parent().parent().show(); |
530 |
|
|
531 |
|
addNewFieldReferencesCadastrales(); |
532 |
|
|
533 |
|
actionFormReferenceCadastrale(); |
534 |
|
actionLineFormReferenceCadastrale() |
535 |
} |
} |
536 |
else { |
else { |
537 |
hideFields(); |
hideFields(); |
538 |
} |
} |
539 |
} |
} |
540 |
|
|
541 |
|
/* |
542 |
|
Ajoute le code HTML des champs pour les références cadastrales |
543 |
|
* */ |
544 |
|
function addNewFieldReferencesCadastrales(){ |
545 |
|
$('.references_cadastrales_new_field').remove(); |
546 |
|
$('.moreFieldReferenceCadastrale').remove(); |
547 |
|
$('#morelineReferenceCadastrale').remove(); |
548 |
|
$('.localisation .fieldsetContent').prepend( |
549 |
|
'<div class="field field-type-text references_cadastrales_new_field" >'+ |
550 |
|
'<div class="form-libelle">' + |
551 |
|
'<label '+ |
552 |
|
'class="libelle-terrain_references_cadastrales" '+ |
553 |
|
'for="terrain_references_cadastrales">'+ |
554 |
|
' terrain_references_cadastrales '+ |
555 |
|
'</label>' + |
556 |
|
'</div>' + |
557 |
|
'<div class="form-content reference_cadastrale_custom_fields">' + |
558 |
|
fieldReferenceCadastraleBase() + |
559 |
|
'</div>' + |
560 |
|
'</div>' + |
561 |
|
'<div class="field field-type-text" id="morelineReferenceCadastrale">' + |
562 |
|
'<div class="form-libelle"></div>' + |
563 |
|
'<div class="form-content">' + |
564 |
|
' + ajouter d\'autres lignes' + |
565 |
|
'</div>' + |
566 |
|
'</div>' |
567 |
|
); |
568 |
|
} |
569 |
|
|
570 |
|
/* |
571 |
|
Séparateur caché ; |
572 |
|
* */ |
573 |
|
function hiddenSeparatorField(){ |
574 |
|
return '<input ' + |
575 |
|
'class="reference_cadastrale_custom_field " ' + |
576 |
|
'type="hidden" ' + |
577 |
|
'maxlength="2" ' + |
578 |
|
'size="2" ' + |
579 |
|
'value=";" />'; |
580 |
|
} |
581 |
|
|
582 |
|
/* |
583 |
|
Ajout d'une nouvelle ligne de champ |
584 |
|
* */ |
585 |
|
function fieldReferenceCadastraleBase(){ |
586 |
|
return '<input ' + |
587 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
588 |
|
'type="text" ' + |
589 |
|
'onchange="VerifNum(this)" ' + |
590 |
|
'maxlength="3" ' + |
591 |
|
'size="3" ' + |
592 |
|
'value="" />' + |
593 |
|
'<input ' + |
594 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
595 |
|
'type="text" ' + |
596 |
|
'maxlength="2" ' + |
597 |
|
'size="2" ' + |
598 |
|
'value="" />' + |
599 |
|
'<input ' + |
600 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
601 |
|
'type="text" ' + |
602 |
|
'onchange="VerifNum(this)" ' + |
603 |
|
'maxlength="4" ' + |
604 |
|
'size="4" ' + |
605 |
|
'value="" />' + |
606 |
|
'<span id="moreFieldReferenceCadastrale' + $('.moreFieldReferenceCadastrale').length + '" class="moreFieldReferenceCadastrale">' + |
607 |
|
hiddenSeparatorField() + |
608 |
|
' + ajouter d\'autres champs' + |
609 |
|
'</span>'; |
610 |
|
} |
611 |
|
|
612 |
|
/* |
613 |
|
Cache les champs inutules |
614 |
|
* */ |
615 |
function hideFields(){ |
function hideFields(){ |
616 |
$('.bloc').each( |
$('.bloc').each( |
617 |
function(){ |
function(){ |
625 |
$('#demande_type').parent().parent().hide(); |
$('#demande_type').parent().parent().hide(); |
626 |
} |
} |
627 |
|
|
628 |
|
/* |
629 |
|
Affiche les champs dont on a besoin |
630 |
|
* */ |
631 |
function showFormsDemande(){ |
function showFormsDemande(){ |
632 |
$('.bloc').each( |
$('.bloc').each( |
633 |
function(){ |
function(){ |
638 |
|
|
639 |
$('.field-type-text').show(); |
$('.field-type-text').show(); |
640 |
$('input[type=submit]').show(); |
$('input[type=submit]').show(); |
641 |
|
$('.terrain_references_cadastrales_custom').hide(); |
642 |
|
|
643 |
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
644 |
|
} |
645 |
|
|
646 |
|
/* |
647 |
|
Action au clique sur le bouton " + ajouter d'autres champs" |
648 |
|
* */ |
649 |
|
function newInputReferenceCadastrale(){ |
650 |
|
return '<input ' + |
651 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
652 |
|
'type="text" ' + |
653 |
|
'maxlength="1" ' + |
654 |
|
'size="1" ' + |
655 |
|
'value="" />' + |
656 |
|
'<input ' + |
657 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
658 |
|
'type="text" ' + |
659 |
|
'onchange="VerifNum(this)" ' + |
660 |
|
'maxlength="4" ' + |
661 |
|
'size="4" ' + |
662 |
|
'value="" />'; |
663 |
} |
} |
664 |
|
|
665 |
|
// Desactivation des fonctions widget du tableau de bord inutiles sur le nouveau |
666 |
|
// tableau de bord |
667 |
|
function widget_bind_move_actions() {} |
668 |
|
function widget_bind_add_action() {} |
669 |
|
function widget_bind_edit_actions(widget_selector) {} |
670 |
|
|