/[openfoncier]/trunk/app/js/script.js
ViewVC logotype

Contents of /trunk/app/js/script.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 694 - (show annotations)
Thu Nov 15 09:36:32 2012 UTC (12 years, 2 months ago) by vpihour
File MIME type: application/javascript
File size: 29918 byte(s)
Ajout des libelles aux civilités

1 // specific openfoncier ========================================================
2 // OnReady
3 $(function(){
4 // Document is ready
5 $('#avis_code_barre_form #consultation').focus();
6 });
7
8
9 function bible(){
10 if(fenetreouverte==true)
11 pfenetre.close();
12 var ev=document.f2.evenement.value;
13 var idx=document.f2.dossier.value;
14 pfenetre=window.open("../app/bible.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120");
15 fenetreouverte=true;
16 }
17
18 function bible2()
19 {
20 if(fenetreouverte==true)
21 pfenetre.close();
22 var ev=document.f2.evenement.value;
23 var idx=document.f2.dossier.value;
24 pfenetre=window.open("../app/bible2.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120");
25 fenetreouverte=true;
26 }
27
28 function bible_auto(){
29 if(fenetreouverte==true)
30 pfenetre.close();
31 var ev=document.f2.evenement.value;
32 var idx=document.f2.dossier.value;
33 pfenetre=window.open("../app/bible_auto.php?idx="+idx+"&ev="+ev,"evenement","width=600,height=300,top=120,left=120");
34 fenetreouverte=true;
35 }
36
37 function dossierads_d(debut)
38 {
39 //if(fenetreouverte==true)
40 window.location="../pdf/pdfetat.php?obj=dossier_ads_d&nature="
41 +document.f1.nature.value+"&idx=demo&datedebut="
42 +document.f1.datedebut.value+"&datefin="+document.f1.datefin.value;
43 }
44
45 function dossierdepot()
46 {
47 //if(fenetreouverte==true)
48 window.location="../pdf/pdfetat.php?obj=dossier_depot&nature="+
49 document.f1.nature.value+"&idx=demo&datedebut="+
50 document.f1.datedebut.value+"&datefin="+document.f1.datefin.value;
51 }
52
53 function dossierads()
54 {
55 //if(fenetreouverte==true)
56 window.location="../pdf/pdfetat.php?obj=dossier_ads&nature="+
57 document.f1.nature.value+"&idx=demo&datedebut="+
58 document.f1.datedebut.value+"&datefin="+document.f1.datefin.value;
59 }
60
61
62 function VerifNumdec(champ) {
63 champ.value = champ.value.replace(",", "."); // remplacement de la virgule
64 //if (champ.value.lastIndexOf(".") == -1){ // champ decimal
65 if (isNaN(champ.value)) {
66 alert(msg_alert_error_verifnum);
67 champ.value = "";
68 return;
69 }
70 //}
71
72 }
73 /* -- Debut -- */
74 function messageIt(objsf, link, empty) {
75 // recuperation du terme recherche
76 var recherche = document.getElementById("recherchedyn");
77 if (recherche != null) {
78 link += "&recherche="+recherche.value;
79 }else {
80 link += "&recherche=";
81 }
82 // execution de la requete en GET
83 $.ajax({
84 type: "GET",
85 url: link,
86 cache: false,
87 success: function(html){
88 (empty == true )?$("#sousform-"+objsf).empty():'';
89 $("#sousform-"+objsf).append(html);
90 om_initialize_content();
91 },
92 async: false
93 });
94 }
95
96 /* Plugin jQuery qui lance un espèce d'appel AJAX vers un script PHP de téléchargement de fichier*/
97 jQuery.download = function(url, data, method){
98 //url and data options required
99 if( url && data ){
100 //data can be string of parameters or array/object
101 data = typeof data == 'string' ? data : jQuery.param(data);
102 //split params into form inputs
103 var inputs = '';
104 jQuery.each(data.split('&'), function(){
105 var pair = this.split('=');
106 inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />';
107 });
108 //send request
109 jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>')
110 .prependTo('body').submit().remove();
111 };
112 };
113
114 /* -- FIN -- */
115 function popupIt(objsf, link) {
116 // Insertion du conteneur du dialog
117 var dialog = $('<div id=\"sousform-'+objsf+'\"></div>').insertAfter('.formControls');
118 $('<input type=\"text\" name=\"recherchedyn\" id=\"recherchedyn\" value=\"\" class=\"champFormulaire\" style=\"display:none\" />').insertAfter('#sousform-'+objsf);
119
120 // execution de la requete passee en parametre
121 // (idem ajaxIt + callback)
122 $.ajax({
123 type: "GET",
124 url: link,
125 cache: false,
126 success: function(html){
127 //Suppression d'un precedent dialog
128 dialog.empty();
129 //Ajout du contenu recupere
130 dialog.append(html);
131 //Initialisation du theme OM
132 om_initialize_content();
133 //Creation du dialog
134 $(dialog).dialog({
135 //OnClose suppression du contenu
136 close: function(ev, ui) {
137 // Si le formulaire est submit et valide
138 var valid=$('#sousform-'+objsf+' div.ui-state-valid');
139 if(valid.length > 0) {
140 document.location.href="../scr/tab.php?obj="+$.getQuery('obj')+"&premier="+$.getQuery('premier')
141 +"&advs_id="+$.getQuery('advs_id')+"&recherche="+$.getQuery('recherche')+"&tricol="+$.getQuery('tricol')
142 +"&selectioncol="+$.getQuery('selectioncol');
143 }
144 $(this).remove();
145 },
146 resizable: false,
147 modal: true,
148 width: 700,
149 height: 520,
150 });
151 },
152 async : false
153 });
154 //Modification des boutons retours du sous formulaire pour fermer le dialog
155 $('#sousform-'+objsf).on("mousedown",'a.retour',function() {
156 $('#sousform-'+objsf+' a.retour').attr('onclick','');
157 });
158 $('#sousform-'+objsf).on("click",'a.retour',function() {
159 $(dialog).dialog('close').remove();
160 });
161 return false;
162 }
163
164 // Parse URL Queries Method
165 (function($){
166 $.getQuery = function( query ) {
167 query = query.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
168 var expr = "[\\?&]"+query+"=([^&#]*)";
169 var regex = new RegExp( expr );
170 var results = regex.exec( window.location.href );
171 if( results !== null ) {
172 return results[1];
173 return decodeURIComponent(results[1].replace(/\+/g, " "));
174 } else {
175 return false;
176 }
177 };
178 })(jQuery);
179
180 function changeDataSelect(tn, ds, joker){
181
182 var id = $("#"+ds+" option:selected").val();
183 link = "../app/listData.php?idx=" + id + "&tn=" + tn + "&ds=" + ds;
184 $.ajax({
185 type: "GET",
186 url: link,
187 cache: false,
188 dataType: "json",
189 success: function(html){
190
191 $('#'+tn).empty();
192
193 if ( joker == true )
194 $('#'+tn).append(
195 '<option value="" selected="selected">*</option>'
196 );
197 else
198 $('#'+tn).append(
199 '<option value="" selected="selected">Choisir ' + tn + '</option>'
200 );
201
202 if ( html !== '' ){
203
204 html = html.split(';');
205 for ( i = 0 ; i < html.length - 1 ; i++ ){
206
207 html_temp = html[i].split('_');
208 $('#'+tn).append(
209 '<option value="'+html_temp[0]+'" >'+html_temp[1]+'</option>'
210 );
211 }
212 }
213 },
214 async: false
215 });
216 }
217 function vuploadMulti(champ) {
218 //
219 if (fenetreouverte == true) {
220 pfenetre.close();
221 }
222 //
223 pfenetre = window.open("../spg/upload.php?origine="+champ+"&form="+$('input[name='+champ+']').closest('form').attr('name'),"upload","width=400,height=300,top=120,left=120");
224 //pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120");
225 //
226 fenetreouverte = true;
227 }
228 function tmpUpload(champ) {
229 //
230 if (fenetreouverte == true) {
231 pfenetre.close();
232 }
233 //
234 pfenetre = window.open("../app/tmpUpload.php?origine="+champ+"&form="+$('input[name='+champ+']').closest('form').attr('name'),"upload","width=400,height=300,top=120,left=120");
235 //pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120");
236 //
237 fenetreouverte = true;
238 }
239
240 /*
241 Ajoute le formulaire d'jout de référence cadastrale personnalisé
242 * */
243 $(function() {
244
245 url = document.location + "" ;
246 if ( $('#date_demande').length > 0
247 && !$('#dossier_autorisation_type_detaille').is(':disabled')
248 && url.indexOf("form.php?obj=demande&action=0") != -1 ){
249
250 $.ajax({
251 type: "GET",
252 url: "sousform.php?obj=demandeur&action=0&tri=&objsf=demandeur&premiersf=0",
253 cache: false,
254 success: function(html){
255
256 $('.lots').append(createFieldset('test', 'test'));
257 $('#test').html(html);
258 $('#test').html($('#test .formEntete>#form-content').html());
259
260 obj = $('#type_demandeur').parent();
261 obj.empty();
262 obj.html(
263 '<select id="type_demandeur" class="champFormulaire selectTypeDemandeur" name="type_demandeur" size="1">' +
264 '<option selected="selected" value="particulier">particulier</option>' +
265 '<option value="personne_morale">personne morale</option>' +
266 '</select>'
267 );
268
269 setSelectCivilite();
270 },
271 async: false
272 });
273
274 $('.lots').append(createFieldset('P&eacute;titionnaire(s)', 'petitionnaire'));
275 $('#petitionnaire').after(
276 '<div class="field field-type-text morePetitionnaire" style="display: table-row;">' +
277 '<div class="form-libelle">' +
278 '<label class="libelle-more_petitionnaire" for="terrain_superficie"> + Ajouter un autre p&eacute;titionnaire </label>' +
279 '</div>' +
280 '<div class="form-content">' +
281 '</div>' +
282 '</div>');
283
284 $('.morePetitionnaire').click( function() {
285 $('#fieldsetpetitionnaire .morePetitionnaire').before(
286 '<div id="petitionnaire' + $('#fieldsetpetitionnaire .fieldsetContent').size() +'" class="fieldsetContent">'+
287 $('#fieldsetpetitionnaire #formsDemandeur').val() +
288 '</div>'
289 );
290
291 nb = $('#fieldsetpetitionnaire .fieldsetContent').size() - 1;
292
293 changeIdNameField('petitionnaire' + nb );
294
295 addDatePicker( 'petitionnaire' + nb + '_petitionnaire_particulier_date_naissance');
296
297 setTypeDemandeur('petitionnaire' + nb, 'petitionnaire' + nb , '_petitionnaire');
298 });
299
300 $('.lots').append(createFieldset('D&eacute;l&eacute;gataire', 'delegataire'));
301 setDelegataire();
302 setPetitionnaire();
303 setTypeDemandeur('petitionnaire', 'petitionnaire_type_demandeur', '');
304
305 hideFields();
306 }
307
308 if ( $('#date_demande').length > 0
309 && !$('#dossier_autorisation_type_detaille').is(':disabled')
310 && url.indexOf("form.php?obj=demande&action=1") != -1 ){
311
312 addNewFieldReferencesCadastrales();
313 $('#terrain_references_cadastrales').parent().parent().hide();
314
315 reference_cadastrale = $('#terrain_references_cadastrales').val();
316 /*Formatage de la reference cadastrale*/
317 if ( reference_cadastrale != '' ){
318
319 references_cadastrales = reference_cadastrale.split(';');
320 donnees = new Array();
321
322 i = 0 ;
323 for ( l = 0 ; l < references_cadastrales.length - 1 ; l ++ ){
324
325 k = 0;
326 donnees[i] = '';
327 for ( j = k ; j < references_cadastrales[l].length ; j++ )
328 if ( references_cadastrales[l].charAt(j) >= 0 && references_cadastrales[l].charAt(j) <= 9 ){
329 donnees[i] += references_cadastrales[l].charAt(j);
330 k++;
331 } else {
332 i++;
333 break;
334 }
335
336
337 donnees[i] = '';
338 for ( j = k ; j < references_cadastrales[l].length ; j++ )
339 if ( isAlpha(references_cadastrales[l].charAt(j)) ){
340 donnees[i] += references_cadastrales[l].charAt(j);
341 k++;
342 } else {
343 i++;
344 break;
345 }
346
347 donnees[i] = '';
348 for ( j = k ; j < references_cadastrales[l].length ; j++ )
349 if ( references_cadastrales[l].charAt(j) >= 0 && references_cadastrales[l].charAt(j) <= 9 ){
350 donnees[i] += references_cadastrales[l].charAt(j);
351 k++;
352 } else {
353 break;
354 }
355
356 m = 0 ;
357 if ( k < references_cadastrales[l].length ){
358
359 for ( j = k ; j < references_cadastrales[l].length ; j++ )
360 if ( isAlpha(references_cadastrales[l].charAt(j)) ){
361 m++;
362 donnees[++i] = references_cadastrales[l].charAt(j);
363 donnees[++i] = '';
364 }
365 else {
366 donnees[i] += references_cadastrales[l].charAt(j);
367 }
368 }
369
370 donnees[++i] = ';';
371 i++;
372
373 if ( l > 0 )
374 $('.reference_cadastrale_custom_fields').append( "<br/>" + fieldReferenceCadastraleBase());
375 actionFormReferenceCadastrale();
376
377 if ( m > 0 ){
378
379 for ( j = 0 ; j < m ; j++ )
380 $('#moreFieldReferenceCadastrale' + ( $('.moreFieldReferenceCadastrale').length - 1 ) ).before(newInputReferenceCadastrale());
381 }
382 }
383
384 actionLineFormReferenceCadastrale();
385
386 $('.reference_cadastrale_custom_field').each(
387 function(index) {
388 $(this).val(donnees[index])
389 }
390 );
391 }
392 }
393 });
394
395 /*
396 Création du formuliare pour le petitionnaire
397 * */
398 function setPetitionnaire(){
399 $('#petitionnaire').prepend("<br/>" + $('#test').html() + "<br/>");
400 $('#test').parent().remove();
401
402 changeIdNameField('petitionnaire');
403 }
404
405 /*
406 Action au changement du select du type de demandeur
407 * */
408 function setTypeDemandeur(id, selector, complement){
409 $('#'+selector).on('change',
410 function() {
411
412 if ( $(this).find('option:selected').first().text() == 'particulier' )
413 fieldTypeDemandeur('#' + id, complement, true);
414 else
415 fieldTypeDemandeur('#' + id, complement, false);
416 }
417 );
418 }
419
420 /*
421 Création du formulaire pour le délégataire
422 * */
423 function setDelegataire(){
424 $('#delegataire').html($('#test').html());
425
426 $('#delegataire #type_demandeur').parent().parent().remove();
427 $('#delegataire #personne_morale_denomination').parent().parent().remove();
428 $('#delegataire #personne_morale_raison_sociale').parent().parent().remove();
429 $('#delegataire #personne_morale_siret').parent().parent().remove();
430 $('#delegataire #personne_morale_categorie_juridique').parent().parent().remove();
431 $('#delegataire #personne_morale_civilite').parent().parent().remove();
432 $('#delegataire #personne_morale_nom').parent().parent().remove();
433 $('#delegataire #personne_morale_prenom').parent().parent().remove();
434 $('#delegataire #frequent').parent().parent().remove();
435
436 changeIdNameField('delegataire');
437 addDatePicker('delegataire_particulier_date_naissance');
438 }
439
440 /*
441 Change les id et name des champs
442 * */
443 function changeIdNameField(name){
444
445 $('#' + name + ' input').each(
446 function(){
447 $(this).attr('id', name + '_' + $(this).attr('id') );
448 $(this).attr('name', name + '_' + $(this).attr('name') );
449 }
450 );
451
452 $('#' + name + ' #type_demandeur').attr('id', name + '_' + $('#' + name + ' #type_demandeur').attr('id'));
453 $('#' + name + ' #type_demandeur').attr('name', name + '_' + $('#' + name + ' #type_demandeur').attr('name'));
454
455 $('#' + name + ' #particulier_civilite').attr('id', name + '_' + $('#' + name + ' #particulier_civilite').attr('id'));
456 $('#' + name + ' #particulier_civilite').attr('name', name + '_' + $('#' + name + ' #particulier_civilite').attr('name'));
457
458 $('#' + name + ' #personne_morale_civilite').attr('id', name + '_' + $('#' + name + ' #personne_morale_civilite').attr('id'));
459 $('#' + name + ' #personne_morale_civilite').attr('name', name + '_' + $('#' + name + ' #personne_morale_civilite').attr('name'));
460
461
462 }
463
464 function addDatePicker(id){
465
466 $("#" + id ).datepicker({
467 dateFormat: dateFormat,
468 changeMonth: true,
469 changeYear: true,
470 yearRange: minYear+':'+maxYear,
471 showOn: 'button',
472 buttonImage: '../img/calendar.png',
473 buttonImageOnly: true,
474 constrainInput: true
475 });
476 }
477
478 /*
479 Création des select pour la civilité
480 * */
481 function setSelectCivilite(){
482
483 $.ajax({
484 type: "GET",
485 url: "../app/civilite.php",
486 dataType: "json",
487 cache: false,
488 success: function(html){
489 if ( html != '' ){
490
491 $('#particulier_civilite').parent().html('<select id="particulier_civilite" class="champFormulaire" size="1" name="particulier_civilite">' +
492 '<option value="" selected="selected">choisir particulier_civilite</option>');
493 $('#personne_morale_civilite').parent().html('<select id="personne_morale_civilite" class="champFormulaire" size="1" name="personne_morale_civilite">' +
494 '<option value="" selected="selected">choisir personne_morale_civilite</option>');
495
496 civilites = html.split(';');
497 for ( i = 0 ; i < civilites.length - 1 ; i++ ){
498
499 civilite = civilites[i].split('_');
500 $('#particulier_civilite').append('<option value="' + civilite[0] + '">' + civilite[1] + '</option>');
501 $('#personne_morale_civilite').append('<option value="' + civilite[0] + '">' + civilite[1] + '</option>');
502 }
503
504 $('#particulier_civilite').append('</select>');
505 $('#personne_morale_civilite').append('</select>');
506 }
507 },
508 async: false
509 });
510 }
511
512 /*
513 Retourne le code HTML d'un fieldset
514 * */
515 function createFieldset(name, className){
516 return '<fieldset class="cadre ui-corner-all ui-widget-content" id="fieldset' + className + '">' +
517 '<legend class="ui-corner-all ui-widget-content ui-state-active">' + name + ' </legend>' +
518 '<input id="formsDemandeur" type="hidden" val=""/>'+
519 '<div class="fieldsetContent " id="' + className + '">' +
520 '</div>' +
521 '<div class="visualClear"></div>' +
522 '</div>' +
523 '</fieldset>';
524 }
525
526 /*
527 Test str est une lettre de l'alphabet
528 * */
529 function isAlpha(str) {
530 return /^[a-zA-Z\/]+$/.test(str);
531 }
532
533 /*
534 Ajoute les ations spécifiques pour le formulaire personnalisé d'ajout de référence cadastrale
535 * */
536 function actionFormReferenceCadastrale(){
537 $('form').submit(
538 function(){
539
540 var reference_cadastrale = '';
541 var reference_cadastrale_temp = '';
542
543 $('.reference_cadastrale_custom_field').each(
544 function(){
545
546 if ( $(this).val() == ';' ){
547
548 reference_cadastrale += reference_cadastrale_temp + ( ( reference_cadastrale_temp != '' && reference_cadastrale_temp.length > 0 ) ? ';' : '' );
549 reference_cadastrale_temp = '';
550 }
551 else
552 reference_cadastrale_temp += $(this).val();
553
554 }
555 );
556
557 $('#terrain_references_cadastrales').val(reference_cadastrale);
558 }
559 );
560
561 $('#moreFieldReferenceCadastrale' + ($('.moreFieldReferenceCadastrale').length - 1 )).on("click", function() {
562 $(this).before(newInputReferenceCadastrale());
563 });
564 }
565
566 /*
567 Action pour l'ajout de nouvelle ligne
568 * */
569 function actionLineFormReferenceCadastrale(){
570 $('#morelineReferenceCadastrale').click(
571 function(){
572
573 $('.reference_cadastrale_custom_fields').append( "<br/>" + fieldReferenceCadastraleBase());
574 $('#moreFieldReferenceCadastrale'+ ($('.moreFieldReferenceCadastrale').length - 1 )).on("click", function() {
575 $(this).before(newInputReferenceCadastrale());
576 });
577 }
578 );
579 }
580
581 /*
582 Met à jour le select demande_type dès qu'un dossier_autorisation_type_detaille est choisi
583 * */
584 function changeDemandeType(){
585
586 var idDossierAutorisationTypeDetaille = $("#dossier_autorisation_type_detaille option:selected").val();
587
588 if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){
589
590 changeDataSelect('demande_type','dossier_autorisation_type_detaille');
591 if ( $('#demande_type option').size() < 2 )
592 showFormsDemande();
593
594 $('#demande_type').parent().parent().show();
595
596 addNewFieldReferencesCadastrales();
597
598 actionFormReferenceCadastrale();
599 actionLineFormReferenceCadastrale()
600 }
601 else {
602 hideFields();
603 }
604 }
605
606 /*
607 Ajoute le code HTML des champs pour les références cadastrales
608 * */
609 function addNewFieldReferencesCadastrales(){
610 $('.references_cadastrales_new_field').remove();
611 $('.moreFieldReferenceCadastrale').remove();
612 $('#morelineReferenceCadastrale').remove();
613 $('.localisation .fieldsetContent').prepend(
614 '<div class="field field-type-text references_cadastrales_new_field" >'+
615 '<div class="form-libelle">' +
616 '<label '+
617 'class="libelle-terrain_references_cadastrales" '+
618 'for="terrain_references_cadastrales">'+
619 ' terrain_references_cadastrales '+
620 '</label>' +
621 '</div>' +
622 '<div class="form-content reference_cadastrale_custom_fields">' +
623 fieldReferenceCadastraleBase() +
624 '</div>' +
625 '</div>' +
626 '<div class="field field-type-text" id="morelineReferenceCadastrale">' +
627 '<div class="form-libelle"></div>' +
628 '<div class="form-content">' +
629 ' + ajouter d\'autres lignes' +
630 '</div>' +
631 '</div>'
632 );
633 $('#terrain_superficie').parent().parent().after('<div class="field field-type-text" >' +
634 '<div class="form-libelle"></div>' +
635 '<div class="form-content">' +
636 '<input id="cad-adr-them" class="ui-button ui-widget ui-state-default ui-corner-all" type="button" value="Cadastrale < = > Adresse"/>' +
637 '</div>' +
638 '</div>' );
639 }
640
641 /*
642 Séparateur caché ;
643 * */
644 function hiddenSeparatorField(){
645 return '<input ' +
646 'class="reference_cadastrale_custom_field " ' +
647 'type="hidden" ' +
648 'maxlength="2" ' +
649 'size="2" ' +
650 'value=";" />';
651 }
652
653 /*
654 Ajout d'une nouvelle ligne de champ
655 * */
656 function fieldReferenceCadastraleBase(){
657 return '<input ' +
658 'class="champFormulaire reference_cadastrale_custom_field" ' +
659 'type="text" ' +
660 'onchange="VerifNum(this)" ' +
661 'maxlength="3" ' +
662 'size="3" ' +
663 'value="" />' +
664 '<input ' +
665 'class="champFormulaire reference_cadastrale_custom_field" ' +
666 'type="text" ' +
667 'maxlength="2" ' +
668 'size="2" ' +
669 'value="" />' +
670 '<input ' +
671 'class="champFormulaire reference_cadastrale_custom_field" ' +
672 'type="text" ' +
673 'onchange="VerifNum(this)" ' +
674 'maxlength="4" ' +
675 'size="4" ' +
676 'value="" />' +
677 '<span id="moreFieldReferenceCadastrale' + $('.moreFieldReferenceCadastrale').length + '" class="moreFieldReferenceCadastrale">' +
678 hiddenSeparatorField() +
679 ' + ajouter d\'autres champs' +
680 '</span>';
681 }
682
683 /*
684 Cache les champs inutules
685 * */
686 function hideFields(){
687 $('.bloc').each(
688 function(){
689 if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') )
690 $(this).hide();
691 }
692 );
693
694 $('.field-type-text').hide();
695 $('input[type=submit]').hide();
696 $('#demande_type').parent().parent().hide();
697 }
698
699 /*
700 Affiche les champs dont on a besoin
701 * */
702 function showFormsDemande(){
703 $('.bloc').each(
704 function(){
705 if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') )
706 $(this).show();
707 }
708 );
709
710 $('.field-type-text').show();
711 $('input[type=submit]').show();
712 $('.terrain_references_cadastrales_custom').hide();
713
714 $('#terrain_references_cadastrales').parent().parent().hide();
715
716 /*Cache les champs inutiles*/
717 fieldTypeDemandeur('#petitionnaire', '', true);
718
719 $('#fieldsetpetitionnaire #formsDemandeur').val($('#petitionnaire').html());
720
721 addDatePicker( 'petitionnaire_particulier_date_naissance');
722 }
723
724 /*
725 Cache/montre des champs selon le type de demandeur
726 * */
727 function fieldTypeDemandeur(name,complement, particulier){
728
729 if ( particulier == true ){
730
731 $( name + ' ' + name + complement + '_particulier_civilite').parent().parent().show();
732 $( name + ' ' + name + complement + '_particulier_nom').parent().parent().show();
733 $( name + ' ' + name + complement + '_particulier_prenom').parent().parent().show();
734 $( name + ' ' + name + complement + '_particulier_date_naissance').parent().parent().show();
735 $( name + ' ' + name + complement + '_particulier_commune_naissance').parent().parent().show();
736 $( name + ' ' + name + complement + '_particulier_departement_naissance').parent().parent().show();
737
738 $( name + ' ' + name + complement + '_personne_morale_denomination').parent().parent().hide();
739 $( name + ' ' + name + complement + '_personne_morale_raison_sociale').parent().parent().hide();
740 $( name + ' ' + name + complement + '_personne_morale_siret').parent().parent().hide();
741 $( name + ' ' + name + complement + '_personne_morale_categorie_juridique').parent().parent().hide();
742 $( name + ' ' + name + complement + '_personne_morale_civilite').parent().parent().hide();
743 $( name + ' ' + name + complement + '_personne_morale_nom').parent().parent().hide();
744 $( name + ' ' + name + complement + '_personne_morale_prenom').parent().parent().hide();
745 }
746 else{
747
748 $( name + ' ' + name + complement + '_particulier_civilite').parent().parent().hide();
749 $( name + ' ' + name + complement + '_particulier_nom').parent().parent().hide();
750 $( name + ' ' + name + complement + '_particulier_prenom').parent().parent().hide();
751 $( name + ' ' + name + complement + '_particulier_date_naissance').parent().parent().hide();
752 $( name + ' ' + name + complement + '_particulier_commune_naissance').parent().parent().hide();
753 $( name + ' ' + name + complement + '_particulier_departement_naissance').parent().parent().hide();
754
755 $( name + ' ' + name + complement + '_personne_morale_denomination').parent().parent().show();
756 $( name + ' ' + name + complement + '_personne_morale_raison_sociale').parent().parent().show();
757 $( name + ' ' + name + complement + '_personne_morale_siret').parent().parent().show();
758 $( name + ' ' + name + complement + '_personne_morale_categorie_juridique').parent().parent().show();
759 $( name + ' ' + name + complement + '_personne_morale_civilite').parent().parent().show();
760 $( name + ' ' + name + complement + '_personne_morale_nom').parent().parent().show();
761 $( name + ' ' + name + complement + '_personne_morale_prenom').parent().parent().show();
762 }
763 }
764
765 /*
766 Action au clique sur le bouton " + ajouter d'autres champs"
767 * */
768 function newInputReferenceCadastrale(){
769 return '<input ' +
770 'class="champFormulaire reference_cadastrale_custom_field" ' +
771 'type="text" ' +
772 'maxlength="1" ' +
773 'size="1" ' +
774 'value="" />' +
775 '<input ' +
776 'class="champFormulaire reference_cadastrale_custom_field" ' +
777 'type="text" ' +
778 'onchange="VerifNum(this)" ' +
779 'maxlength="4" ' +
780 'size="4" ' +
781 'value="" />';
782 }
783
784 // Desactivation des fonctions widget du tableau de bord inutiles sur le nouveau
785 // tableau de bord
786 function widget_bind_move_actions() {}
787 function widget_bind_add_action() {}
788 function widget_bind_edit_actions(widget_selector) {}
789
790 function file(fichier) {
791 //
792 if (fichier == "") {
793 alert("zone vide");
794 }
795 //
796 pfenetre = window.open("../app/file.php?file="+fichier,"Visualisation","width=100,height=100,top=1,left=150,scrollbars=yes,resizable = yes");
797 //
798 fenetreouverte = true;
799 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26