1 |
// specific openfoncier ======================================================== |
// specific openfoncier ======================================================== |
2 |
|
// OnReady |
3 |
|
$(function(){ |
4 |
|
// Document is ready |
5 |
|
$('#avis_code_barre_form #consultation').focus(); |
6 |
|
}); |
7 |
|
|
8 |
|
|
9 |
function bible(){ |
function bible(){ |
10 |
if(fenetreouverte==true) |
if(fenetreouverte==true) |
11 |
pfenetre.close(); |
pfenetre.close(); |
12 |
var ev=document.f2.evenement.value; |
var ev=document.f2.evenement.value; |
13 |
var idx=document.f2.dossier.value; |
var idx=document.f2.dossier.value; |
14 |
pfenetre=window.open("../app/bible.php?ev="+ev+"&idx="+idx,"bible","width=600,height=100,top=120,left=120"); |
pfenetre=window.open("../app/bible.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
15 |
fenetreouverte=true; |
fenetreouverte=true; |
16 |
} |
} |
17 |
|
|
21 |
pfenetre.close(); |
pfenetre.close(); |
22 |
var ev=document.f2.evenement.value; |
var ev=document.f2.evenement.value; |
23 |
var idx=document.f2.dossier.value; |
var idx=document.f2.dossier.value; |
24 |
pfenetre=window.open("../app/bible2.php?ev="+ev,"bible","width=600,height=100,top=120,left=120"); |
pfenetre=window.open("../app/bible2.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
25 |
fenetreouverte=true; |
fenetreouverte=true; |
26 |
} |
} |
27 |
|
|
58 |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
59 |
} |
} |
60 |
|
|
61 |
function onSaisieSelect(evt){ |
|
62 |
//ne pas faire la transformation sur la couche mais sur un clone |
function VerifNumdec(champ) { |
63 |
// specifique openfoncier |
champ.value = champ.value.replace(",", "."); // remplacement de la virgule |
64 |
geom = evt.feature.geometry.clone() |
//if (champ.value.lastIndexOf(".") == -1){ // champ decimal |
65 |
geom.transform(mercator, projection_externe); |
if (isNaN(champ.value)) { |
66 |
if(fenetreouverte==true) |
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(); |
pfenetre.close(); |
221 |
//compatibilite IE -> mettre des ' au lieu de " |
} |
222 |
pfenetre=window.open("../app/form_sig.php?obj="+obj+"&idx="+idx+"&geom="+geom+"&table="+table+"&champ="+champ, 'saisie_geometrie', 'width=400,height=300,top=120,left=120' ); |
// |
223 |
fenetreouverte=true; |
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 |
|
|
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(){ |
520 |
|
|
521 |
|
var idDossierAutorisationTypeDetaille = $("#dossier_autorisation_type_detaille option:selected").val(); |
522 |
|
|
523 |
|
if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){ |
524 |
|
|
525 |
|
changeDataSelect('demande_type','dossier_autorisation_type_detaille'); |
526 |
|
if ( $('#demande_type option').size() < 2 ) |
527 |
|
showFormsDemande(); |
528 |
|
|
529 |
|
$('#demande_type').parent().parent().show(); |
530 |
|
|
531 |
|
addNewFieldReferencesCadastrales(); |
532 |
|
|
533 |
|
actionFormReferenceCadastrale(); |
534 |
|
actionLineFormReferenceCadastrale() |
535 |
|
} |
536 |
|
else { |
537 |
|
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(){ |
616 |
|
$('.bloc').each( |
617 |
|
function(){ |
618 |
|
if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') ) |
619 |
|
$(this).hide(); |
620 |
|
} |
621 |
|
); |
622 |
|
|
623 |
|
$('.field-type-text').hide(); |
624 |
|
$('input[type=submit]').hide(); |
625 |
|
$('#demande_type').parent().parent().hide(); |
626 |
|
} |
627 |
|
|
628 |
|
/* |
629 |
|
Affiche les champs dont on a besoin |
630 |
|
* */ |
631 |
|
function showFormsDemande(){ |
632 |
|
$('.bloc').each( |
633 |
|
function(){ |
634 |
|
if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') ) |
635 |
|
$(this).show(); |
636 |
|
} |
637 |
|
); |
638 |
|
|
639 |
|
$('.field-type-text').show(); |
640 |
|
$('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 |
|
|