1 |
var pfenetre; |
// specific openfoncier ======================================================== |
2 |
var fenetreouverte = false; |
// OnReady |
3 |
// espagnol |
$(function(){ |
4 |
var lang_calendrier = "calendar"; |
// Document is ready |
5 |
var lang_numerique = "vous devez saisir que des nombres"; |
$('#avis_code_barre_form #consultation').focus(); |
6 |
|
}); |
|
// Parametrage du calendrier jquery ui |
|
|
var currDate = new Date (); |
|
|
var currYear = currDate.getFullYear(); |
|
|
var maxYear = currYear + 20; |
|
|
var minYear = currYear - 120; |
|
|
var dateFormat = 'dd/mm/yy'; |
|
7 |
|
|
|
$(function() { |
|
|
// Affichage du menu |
|
|
$("#menu-list").accordion({ |
|
|
autoHeight: false, |
|
|
collapsible: true, |
|
|
active : false |
|
|
}); |
|
|
// Skin en bouton |
|
|
$("button, input:submit, input:reset, input:button, p.linkjsclosewindow").button(); |
|
|
// |
|
|
var $tabs = $("#formulaire").tabs({ |
|
|
select: function(event, ui) { |
|
|
// Suppression du contenu de l'onglet precedemment selectionne |
|
|
// #ui-tabs-X correspond uniquement aux ids des onglets charges |
|
|
// dynamiquement |
|
|
selectedTabIndex = $tabs.tabs('option', 'selected'); |
|
|
$("#ui-tabs-"+selectedTabIndex).empty(); |
|
|
// Gestion de la recherche |
|
|
// Si le nouvel onglet clique est un onglet qui charge dynamiquement |
|
|
// son contenu |
|
|
var url = $.data(ui.tab, 'load.tabs'); |
|
|
if (url) { |
|
|
// On affiche la recherche |
|
|
var recherche = document.getElementById("recherchedyn").value; |
|
|
url += "&recherche="+recherche; |
|
|
$("#recherche_onglet").removeAttr("style"); |
|
|
$tabs.tabs("url", ui.index, url); |
|
|
} else { |
|
|
// On cache la recherche |
|
|
$("#recherche_onglet").attr("style", "display:none;") |
|
|
} |
|
|
return true; |
|
|
}, |
|
|
ajaxOptions: { |
|
|
error: function(xhr, status, index, anchor) { |
|
|
$(anchor.hash).html("Couldn't load this tab. We'll try to fix this as soon as possible. If this wouldn't be a demo."); |
|
|
} |
|
|
} |
|
|
}); |
|
|
// |
|
|
$(".datepicker").datepicker({ |
|
|
dateFormat: dateFormat, |
|
|
changeMonth: true, |
|
|
changeYear: true, |
|
|
yearRange: minYear+':'+maxYear, |
|
|
showOn: 'button', |
|
|
buttonImage: '../img/calendar.png', |
|
|
buttonImageOnly: true, |
|
|
constrainInput: true |
|
|
}); |
|
|
// |
|
|
$("#accordion").accordion({ |
|
|
autoHeight: false, |
|
|
collapsible: true, |
|
|
active : false |
|
|
}); |
|
|
// |
|
|
$("fieldset.collapsible").collapse(); |
|
|
$("fieldset.startClosed").collapse( { closed: true } ); |
|
|
// Widget |
|
|
widget_bind_move_actions(); |
|
|
widget_bind_edit_actions(); |
|
|
widget_bind_add_action(); |
|
|
}); |
|
8 |
|
|
9 |
function aide (obj) |
function bible(){ |
10 |
{ |
if(fenetreouverte==true) |
11 |
if (fenetreouverte == true) |
pfenetre.close(); |
12 |
pfenetre.close (); |
var ev=document.f2.evenement.value; |
13 |
pfenetre = window.open ("../doc/"+obj+".html", "Aide", "toolbar=no, scrollbars=yes, status=no, width=600, height=400, top=120, left=120"); |
var idx=document.f2.dossier.value; |
14 |
fenetreouverte = true; |
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 traces (fichier) |
function bible2() |
19 |
{ |
{ |
20 |
if (fenetreouverte == true) |
if(fenetreouverte==true) |
21 |
pfenetre.close (); |
pfenetre.close(); |
22 |
pfenetre = window.open ("../tmp/"+fichier, "Traces", "toolbar=no, scrollbars=yes, status=no, width=600, height=400, top=120, left=120"); |
var ev=document.f2.evenement.value; |
23 |
fenetreouverte = true; |
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 vdate (origine) |
function bible_auto(){ |
29 |
{ |
if(fenetreouverte==true) |
30 |
if (fenetreouverte == true) |
pfenetre.close(); |
31 |
pfenetre.close (); |
var ev=document.f2.evenement.value; |
32 |
pfenetre = window.open ("../spg/calendrier.php?origine="+origine, "Calendrier", "width=310, height=230, top=120, left=120"); |
var idx=document.f2.dossier.value; |
33 |
fenetreouverte = true; |
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 fdate (champ) |
function dossierads_d(debut) |
38 |
{ |
{ |
39 |
var flag = 0; |
//if(fenetreouverte==true) |
40 |
var jour = ""; |
window.location="../pdf/pdfetat.php?obj=dossier_ads_d&nature=" |
41 |
var mois = ""; |
+document.f1.nature.value+"&idx=demo&datedebut=" |
42 |
var annee = ""; |
+document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
43 |
|
} |
|
if (champ.value.lastIndexOf("/") == -1 && (champ.value.length == 6 || champ.value.length == 8)) |
|
|
{ |
|
|
jour = champ.value.substring(0,2); |
|
|
mois = champ.value.substring(2,4); |
|
|
if (champ.value.length == 6) |
|
|
annee = "20"+champ.value.substring(4,6); |
|
|
if (champ.value.length == 8) |
|
|
annee = champ.value.substring(4,8); |
|
|
} |
|
|
|
|
|
if (champ.value.lastIndexOf("/") != -1 && (champ.value.length == 8 || champ.value.length == 10)) |
|
|
{ |
|
|
jour = champ.value.substring(0,2); |
|
|
mois = champ.value.substring(3,5); |
|
|
if (champ.value.length == 8) |
|
|
annee = "20"+champ.value.substring(6,8); |
|
|
if (champ.value.length == 10) |
|
|
annee = champ.value.substring(6,10); |
|
|
} |
|
|
|
|
|
if (isNaN (jour) || isNaN (mois) || isNaN (annee)) |
|
|
{ |
|
|
flag = 1; |
|
|
} |
|
|
|
|
|
if (jour < '01' || jour > '31' || mois < '01' || mois > '12' || annee < '0000' || annee > '9999') |
|
|
{ |
|
|
flag = 1; |
|
|
} |
|
44 |
|
|
45 |
if (flag == 0) |
function dossierdepot() |
46 |
{ |
{ |
47 |
champ.value = jour+"/"+mois+"/"+annee; |
//if(fenetreouverte==true) |
48 |
} |
window.location="../pdf/pdfetat.php?obj=dossier_depot&nature="+ |
49 |
else |
document.f1.nature.value+"&idx=demo&datedebut="+ |
50 |
{ |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
|
champ.value = ""; |
|
|
alert("La date n'est pas valide!") |
|
|
return; |
|
|
} |
|
51 |
} |
} |
52 |
|
|
53 |
function ftime (champ) |
function dossierads() |
54 |
{ |
{ |
55 |
var flag = 0; |
//if(fenetreouverte==true) |
56 |
var heure = ""; |
window.location="../pdf/pdfetat.php?obj=dossier_ads&nature="+ |
57 |
var minute = ""; |
document.f1.nature.value+"&idx=demo&datedebut="+ |
58 |
var seconde = ""; |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
59 |
|
} |
60 |
|
|
61 |
if (champ.value.lastIndexOf(":") == -1 && (champ.value.length == 2 || champ.value.length == 4 || champ.value.length == 6)) |
|
62 |
{ |
function VerifNumdec(champ) { |
63 |
heure = champ.value.substring(0,2); |
champ.value = champ.value.replace(",", "."); // remplacement de la virgule |
64 |
if (champ.value.length == 2) |
//if (champ.value.lastIndexOf(".") == -1){ // champ decimal |
65 |
{ |
if (isNaN(champ.value)) { |
66 |
minute = "00"; |
alert(msg_alert_error_verifnum); |
67 |
seconde = "00"; |
champ.value = ""; |
68 |
} |
return; |
|
if (champ.value.length == 4) |
|
|
{ |
|
|
minute = champ.value.substring(2,4); |
|
|
seconde = "00"; |
|
|
} |
|
|
if (champ.value.length == 6) |
|
|
{ |
|
|
minute = champ.value.substring(2,4); |
|
|
seconde = champ.value.substring(4,6); |
|
69 |
} |
} |
70 |
} |
//} |
71 |
|
|
72 |
if (champ.value.lastIndexOf(":") != -1 && (champ.value.length == 5 || champ.value.length == 8)) |
} |
73 |
{ |
/* -- Debut -- */ |
74 |
heure = champ.value.substring(0,2); |
function messageIt(objsf, link, empty) { |
75 |
if (champ.value.length == 5) |
// recuperation du terme recherche |
76 |
{ |
var recherche = document.getElementById("recherchedyn"); |
77 |
minute = champ.value.substring(3,5); |
if (recherche != null) { |
78 |
seconde = "00"; |
link += "&recherche="+recherche.value; |
79 |
} |
}else { |
80 |
if (champ.value.length == 8) |
link += "&recherche="; |
|
{ |
|
|
minute = champ.value.substring(3,5); |
|
|
seconde = champ.value.substring(6,8); |
|
|
} |
|
|
} |
|
|
|
|
|
if (isNaN (heure) || isNaN (minute) || isNaN (seconde)) |
|
|
{ |
|
|
flag = 1; |
|
|
} |
|
|
|
|
|
if (heure < '00' || heure > '23' || minute < '00' || minute > '59' || seconde < '00' || seconde > '59') |
|
|
{ |
|
|
flag = 1; |
|
|
} |
|
|
|
|
|
if (flag == 0) |
|
|
{ |
|
|
champ.value = heure+":"+minute+":"+seconde; |
|
|
} |
|
|
else |
|
|
{ |
|
|
champ.value = ""; |
|
|
alert("L'heure n'est pas valide!") |
|
|
return; |
|
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 |
function vupload (origine) |
jQuery.download = function(url, data, method){ |
98 |
{ |
//url and data options required |
99 |
if (fenetreouverte == true) |
if( url && data ){ |
100 |
pfenetre.close (); |
//data can be string of parameters or array/object |
101 |
pfenetre=window.open("../spg/upload.php?origine="+origine,"Upload","width=300,height=200,top=120,left=120"); |
data = typeof data == 'string' ? data : jQuery.param(data); |
102 |
fenetreouverte=true; |
//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 |
function VerifNum (champ) |
var expr = "[\\?&]"+query+"=([^&#]*)"; |
169 |
{ |
var regex = new RegExp( expr ); |
170 |
if (isNaN (champ.value)) |
var results = regex.exec( window.location.href ); |
171 |
{ |
if( results !== null ) { |
172 |
alert (lang_numerique); |
return results[1]; |
173 |
champ.value = ""; |
return decodeURIComponent(results[1].replace(/\+/g, " ")); |
174 |
return; |
} 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 |
champ.value = champ.value.replace (".", ""); |
// |
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 |
function genaff(file) { |
// |
230 |
if (fenetreouverte == true) { |
if (fenetreouverte == true) { |
231 |
pfenetre.close(); |
pfenetre.close(); |
232 |
} |
} |
233 |
pfenetre = window.open("../spg/genaff.php?file="+file, "fichier", "width=600,height=400,top=120,left=120,scrollbars=yes"); |
// |
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; |
fenetreouverte = true; |
238 |
} |
} |
239 |
|
|
240 |
function adresse_postale(form,libelle_voie,numero_voie) |
/* |
241 |
{ |
Ajoute le formulaire d'jout de référence cadastrale personnalisé |
242 |
if(fenetreouverte==true) |
* */ |
243 |
pfenetre.close(); |
$(function() { |
244 |
pfenetre=window.open("../sig/adresse_postale.php?form="+form+"&libelle_voie="+libelle_voie.replace('\'','\\\'')+"&numero_voie="+numero_voie,"adresse_postale","width=400,height=400,top=120,left=120"); |
|
245 |
fenetreouverte=true; |
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 .formControls').remove(); |
259 |
|
|
260 |
|
$('#test').html($('#test .formEntete').html()); |
261 |
|
|
262 |
|
$('#test #particulier_prenom').parent().append( |
263 |
|
'<span class="om-icon om-icon-16 om-icon-fix search-part-16" title="Chercher un petitionnaire"></span>' |
264 |
|
); |
265 |
|
$('#test #personne_morale_raison_sociale').parent().append( |
266 |
|
'<span class="om-icon om-icon-16 om-icon-fix search-mor-16" title="Chercher un petitionnaire"></span>' |
267 |
|
); |
268 |
|
$('#test input[id=personne_morale_prenom]').after( |
269 |
|
'<span class="om-icon om-icon-16 om-icon-fix search-mor-16" title="Chercher un petitionnaire"></span>' |
270 |
|
); |
271 |
|
|
272 |
|
obj = $('#type_demandeur').parent(); |
273 |
|
obj.empty(); |
274 |
|
obj.html( |
275 |
|
'<select id="type_demandeur" class="champFormulaire selectTypeDemandeur" name="type_demandeur" size="1">' + |
276 |
|
'<option selected="selected" value="particulier">particulier</option>' + |
277 |
|
'<option value="personne_morale">personne morale</option>' + |
278 |
|
'</select>' |
279 |
|
); |
280 |
|
|
281 |
|
setSelectCivilite(); |
282 |
|
}, |
283 |
|
async: false |
284 |
|
}); |
285 |
|
|
286 |
|
$('.lots').append(createFieldset('Pétitionnaire(s)', 'petitionnaire__0')); |
287 |
|
$('#petitionnaire__0').after( |
288 |
|
'<div class="field field-type-text morePetitionnaire" style="display: table-row;">' + |
289 |
|
'<div class="form-libelle">' + |
290 |
|
'<label class="libelle-more_petitionnaire" for="terrain_superficie"> + Ajouter un autre pétitionnaire </label>' + |
291 |
|
'</div>' + |
292 |
|
'<div class="form-content">' + |
293 |
|
'</div>' + |
294 |
|
'</div>'); |
295 |
|
|
296 |
|
$('.morePetitionnaire').click( function() { |
297 |
|
$('#fieldsetpetitionnaire__0 .morePetitionnaire').before( |
298 |
|
'<div id="petitionnaire__' + $('#fieldsetpetitionnaire__0 .fieldsetContent').size() +'" class="fieldsetContent">'+ |
299 |
|
$('#fieldsetpetitionnaire__0 .formsDemandeur').val() + |
300 |
|
'</div>' |
301 |
|
); |
302 |
|
|
303 |
|
nb = $('#fieldsetpetitionnaire__0 .fieldsetContent').size() - 1; |
304 |
|
|
305 |
|
changeIdNameField('petitionnaire__' + nb, '_' + nb ); |
306 |
|
|
307 |
|
addDatePicker( 'petitionnaire__' + nb + ' #particulier_date_naissance_' + nb); |
308 |
|
|
309 |
|
addActionSearch('petitionnaire__' + nb, '_' + nb); |
310 |
|
|
311 |
|
setTypeDemandeur('petitionnaire__' + nb, '_' + nb ); |
312 |
|
|
313 |
|
$('html, body').animate({ |
314 |
|
scrollTop: $('#petitionnaire__' + nb + ' #type_demandeur').offset().top |
315 |
|
}, 1000); |
316 |
|
}); |
317 |
|
|
318 |
|
$('.lots').append(createFieldset('Délégataire', 'delegataire')); |
319 |
|
setDelegataire(); |
320 |
|
setPetitionnaire(); |
321 |
|
setTypeDemandeur('petitionnaire__0', '_0'); |
322 |
|
|
323 |
|
$('#petitionnaire__0').before( |
324 |
|
'<div id="dialog" title="Résultats de votre recherche"></div>' |
325 |
|
); |
326 |
|
|
327 |
|
hideFields(); |
328 |
|
} |
329 |
|
|
330 |
|
if ( $('#date_demande').length > 0 |
331 |
|
&& !$('#dossier_autorisation_type_detaille').is(':disabled') |
332 |
|
&& url.indexOf("form.php?obj=demande&action=1") != -1 ){ |
333 |
|
|
334 |
|
addNewFieldReferencesCadastrales(); |
335 |
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
336 |
|
|
337 |
|
reference_cadastrale = $('#terrain_references_cadastrales').val(); |
338 |
|
/*Formatage de la reference cadastrale*/ |
339 |
|
if ( reference_cadastrale != '' ){ |
340 |
|
|
341 |
|
references_cadastrales = reference_cadastrale.split(';'); |
342 |
|
donnees = new Array(); |
343 |
|
|
344 |
|
i = 0 ; |
345 |
|
for ( l = 0 ; l < references_cadastrales.length - 1 ; l ++ ){ |
346 |
|
|
347 |
|
k = 0; |
348 |
|
donnees[i] = ''; |
349 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
350 |
|
if ( references_cadastrales[l].charAt(j) >= 0 && references_cadastrales[l].charAt(j) <= 9 ){ |
351 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
352 |
|
k++; |
353 |
|
} else { |
354 |
|
i++; |
355 |
|
break; |
356 |
|
} |
357 |
|
|
358 |
|
|
359 |
|
donnees[i] = ''; |
360 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
361 |
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
362 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
363 |
|
k++; |
364 |
|
} else { |
365 |
|
i++; |
366 |
|
break; |
367 |
|
} |
368 |
|
|
369 |
|
donnees[i] = ''; |
370 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
371 |
|
if ( references_cadastrales[l].charAt(j) >= 0 && references_cadastrales[l].charAt(j) <= 9 ){ |
372 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
373 |
|
k++; |
374 |
|
} else { |
375 |
|
break; |
376 |
|
} |
377 |
|
|
378 |
|
m = 0 ; |
379 |
|
if ( k < references_cadastrales[l].length ){ |
380 |
|
|
381 |
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
382 |
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
383 |
|
m++; |
384 |
|
donnees[++i] = references_cadastrales[l].charAt(j); |
385 |
|
donnees[++i] = ''; |
386 |
|
} |
387 |
|
else { |
388 |
|
donnees[i] += references_cadastrales[l].charAt(j); |
389 |
|
} |
390 |
|
} |
391 |
|
|
392 |
|
donnees[++i] = ';'; |
393 |
|
i++; |
394 |
|
|
395 |
|
if ( l > 0 ) |
396 |
|
$('.reference_cadastrale_custom_fields').append( "<br/>" + fieldReferenceCadastraleBase()); |
397 |
|
actionFormReferenceCadastrale(); |
398 |
|
|
399 |
|
if ( m > 0 ){ |
400 |
|
|
401 |
|
for ( j = 0 ; j < m ; j++ ) |
402 |
|
$('#moreFieldReferenceCadastrale' + ( $('.moreFieldReferenceCadastrale').length - 1 ) ).before(newInputReferenceCadastrale()); |
403 |
|
} |
404 |
|
} |
405 |
|
|
406 |
|
actionLineFormReferenceCadastrale(); |
407 |
|
|
408 |
|
$('.reference_cadastrale_custom_field').each( |
409 |
|
function(index) { |
410 |
|
$(this).val(donnees[index]) |
411 |
|
} |
412 |
|
); |
413 |
|
} |
414 |
|
} |
415 |
|
}); |
416 |
|
|
417 |
|
/* |
418 |
|
Création du formuliare pour le petitionnaire |
419 |
|
* */ |
420 |
|
function setPetitionnaire(){ |
421 |
|
$('#petitionnaire__0').prepend("<br/>" + $('#test').html() + "<br/>"); |
422 |
|
$('#test').parent().remove(); |
423 |
|
|
424 |
|
addActionSearch('petitionnaire__0', '_0'); |
425 |
|
|
426 |
} |
} |
427 |
|
|
428 |
/** |
/* |
429 |
* WIDGET |
Action au changement du select du type de demandeur |
430 |
*/ |
* */ |
431 |
// Cette fonction permet d'associer aux colonnes des actions de deplacement |
function setTypeDemandeur(id, complement){ |
432 |
// des widgets |
$('#'+id + ' select[id="type_demandeur"]').on('change', |
433 |
function widget_bind_move_actions() { |
function() { |
434 |
// |
|
435 |
$( ".column" ).sortable({ |
if ( $(this).find('option:selected').first().text() == 'particulier' ) |
436 |
connectWith: ".column", |
fieldTypeDemandeur('#' + id, true, complement); |
437 |
handle: ".widget-header-move", |
else |
438 |
stop: function(event, ui) { |
fieldTypeDemandeur('#' + id, false, complement); |
|
var order = "" |
|
|
$(".column").each(function(){ |
|
|
order += $(this).attr('id') + "="; |
|
|
order += $(this).sortable("toArray").join("x") + "&"; |
|
|
}) |
|
|
$("#info").load("../spg/widgetctl.php?action=update&"+order); |
|
439 |
} |
} |
440 |
}); |
); |
|
// |
|
|
$( ".column" ).disableSelection(); |
|
441 |
} |
} |
442 |
|
|
443 |
// Cette fonction permet d'associer a l'icone "ajouter" l'action d'ajouter un |
/* |
444 |
// nouveau widget |
Création du formulaire pour le délégataire |
445 |
function widget_bind_add_action() { |
* */ |
446 |
// |
function setDelegataire(){ |
447 |
$(".widget-add-action").click(function() { |
$('#delegataire').html($('#test').html()); |
448 |
$("#widget_").remove(); |
|
449 |
// |
$('#delegataire #type_demandeur').parent().parent().remove(); |
450 |
$.get("../spg/widgetctl.php?action=insert", function(data) { |
$('#delegataire #personne_morale_denomination').parent().parent().remove(); |
451 |
$(data).prependTo("#column_1").effect("highlight"); |
$('#delegataire #personne_morale_raison_sociale').parent().parent().remove(); |
452 |
widget_bind_edit_actions("#widget_"); |
$('#delegataire #personne_morale_siret').parent().parent().remove(); |
453 |
$("button, input:submit, input:reset, input:button, p.linkjsclosewindow").button(); |
$('#delegataire #personne_morale_categorie_juridique').parent().parent().remove(); |
454 |
}); |
$('#delegataire #personne_morale_civilite').parent().parent().remove(); |
455 |
}); |
$('#delegataire #personne_morale_nom').parent().parent().remove(); |
456 |
|
$('#delegataire #personne_morale_prenom').parent().parent().remove(); |
457 |
|
$('#delegataire #frequent').parent().parent().remove(); |
458 |
|
$('#delegataire .search-part-16').remove(); |
459 |
|
|
460 |
|
changeIdNameField('delegataire', ''); |
461 |
|
addDatePicker('delegataire #particulier_date_naissance'); |
462 |
} |
} |
463 |
|
|
464 |
// Cette fonction permet d'associer a un widget ou a tous les widgets les |
/* |
465 |
// differentes actions possibles sur ce ou ces derniers : plier/deplier, |
Change les id et les name des champs |
466 |
// supprimer, ... |
* */ |
467 |
function widget_bind_edit_actions(widget_selector) { |
function changeIdNameField(id, complement){ |
468 |
|
|
469 |
// Initialisation de l'argument de la fonction si besoin |
$('#' + id + ' input').each( |
470 |
widget_selector = typeof(widget_selector) != 'undefined' ? widget_selector : ""; |
function(){ |
471 |
|
$(this).attr('name', id + '__' + $(this).attr('name') ); |
472 |
// Ajout de l'icone "reduire" |
$(this).attr('id', $(this).attr('id') + complement ); |
473 |
$(widget_selector+" .widget-header").prepend( "<span class='ui-icon ui-icon-minusthick'></span>"); |
} |
474 |
|
); |
|
// Ajout de l'icone "supprimer" |
|
|
$(widget_selector+" .widget-header-edit").prepend( "<span class='ui-icon ui-icon-closethick'></span>"); |
|
|
|
|
|
// Bind de l'evenement click sur l'icone "reduire" |
|
|
$(widget_selector+" .widget-header .ui-icon-minusthick" ).click(function() { |
|
|
// On change l'icone "reduire" par l'icone "deplier" ou l'inverse |
|
|
$(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"); |
|
|
// On cache le contenu du widget ou on l'affiche |
|
|
$(this).parents(".widget:first").find(".widget-content-wrapper").toggle(); |
|
|
}); |
|
475 |
|
|
476 |
// Bind de l'evenement click sur l'icone "supprimer" |
$('#' + id + ' select').each( |
477 |
$(widget_selector+" .widget-header-edit .ui-icon-closethick" ).click(function() { |
function(){ |
478 |
// On recupere l'attribut id de l'element parent representant le widget |
$(this).attr('name', id + '__' + $(this).attr('name') ); |
479 |
widget = $(this).parents(".widget:first").attr('id'); |
$(this).attr('id', $(this).attr('id') + complement ); |
480 |
// Si le widget n'est pas le widget d'ajout |
} |
481 |
if (widget != "widget_") { |
); |
482 |
// On appelle le script permettant de realiser l'action supprimer dans |
|
483 |
// la base de donnees |
|
484 |
$("#info").load("../spg/widgetctl.php?action=delete&widget="+widget); |
} |
485 |
} |
|
486 |
// On supprime le widget de l'affichage |
/* |
487 |
$(this).parents(".widget:first").hide("highlight", function() { |
Ajoute les le datespicker sur les champs de date |
488 |
$(this).remove(); |
* */ |
489 |
}); |
function addDatePicker(id){ |
490 |
|
|
491 |
|
$("#" + id ).datepicker({ |
492 |
|
dateFormat: dateFormat, |
493 |
|
changeMonth: true, |
494 |
|
changeYear: true, |
495 |
|
yearRange: minYear+':'+maxYear, |
496 |
|
showOn: 'button', |
497 |
|
buttonImage: '../img/calendar.png', |
498 |
|
buttonImageOnly: true, |
499 |
|
constrainInput: true |
500 |
}); |
}); |
501 |
|
} |
502 |
|
|
503 |
|
/* |
504 |
|
Ajout de l'action de recherche des pétitionnaire fréquent dans un overlay |
505 |
|
* */ |
506 |
|
function addActionSearch(id, complement){ |
507 |
|
|
508 |
|
$('#' + id + ' .search-part-16').click( |
509 |
|
function(){ |
510 |
|
|
511 |
|
var donnees = "?type=particulier&par_nom="; |
512 |
|
$('#' + id + ' .search_particulier_fields input').each( |
513 |
|
function(i){ |
514 |
|
|
515 |
|
donnees += $(this).val() + (( i == 0 ) ? '&par_prenom=' : '') ; |
516 |
|
} |
517 |
|
); |
518 |
|
|
519 |
|
$.ajax({ |
520 |
|
type: "GET", |
521 |
|
url: "../app/findPetitionnaire.php" + donnees , |
522 |
|
cache: false, |
523 |
|
success: function(html){ |
524 |
|
|
525 |
|
res = 'Auncune correspondance trouvée.'; |
526 |
|
|
527 |
|
if ( html.length > 2 ){ |
528 |
|
|
529 |
|
res = '<select>' ; |
530 |
|
donnees = html.split(';'); |
531 |
|
|
532 |
|
for ( i = 0 ; i < donnees.length - 1 ; i++ ){ |
533 |
|
|
534 |
|
val = donnees[i].replace('"', ''); |
535 |
|
line = donnees[i].split('_'); |
536 |
|
|
537 |
|
res += '<option value="' + val + '">' + line[1] + ' ' + line[2] + ' - ' + line[3] + '</option>'; |
538 |
|
} |
539 |
|
|
540 |
|
res += '</select>' ; |
541 |
|
} |
542 |
|
|
543 |
|
$('#dialog').html(res); |
544 |
|
|
545 |
|
$( "#dialog" ).dialog({ |
546 |
|
modal: true, |
547 |
|
buttons : { |
548 |
|
Valider: function(){ |
549 |
|
|
550 |
|
if ( res != 'Auncune correspondance trouvée.' ){ |
551 |
|
donnees = $('#dialog select option:selected').val(); |
552 |
|
donnees = donnees.split('_'); |
553 |
|
|
554 |
|
if ( $.isNumeric(donnees[4]) ) |
555 |
|
$('#' + id + ' select[id="particulier_civilite' + complement + '"] option[value="' + $.trim(donnees[4]) + '"]').attr('selected','selected'); |
556 |
|
$('#' + id + ' input[id="particulier_nom' + complement + '"]').val($.trim(donnees[1])); |
557 |
|
$('#' + id + ' input[id="particulier_prenom' + complement + '"]').val($.trim(donnees[2])); |
558 |
|
date = $.trim(donnees[3]).split('-'); |
559 |
|
date = date[2] + "/" + date[1] + "/" + date[0] ; |
560 |
|
$('#' + id + ' input[id="particulier_date_naissance' + complement + '"]').val(date); |
561 |
|
$('#' + id + ' input[id="particulier_commune_naissance' + complement + '"]').val($.trim(donnees[10])); |
562 |
|
$('#' + id + ' input[id="particulier_departement_naissance' + complement + '"]').val($.trim(donnees[11])); |
563 |
|
|
564 |
|
changeValInputDemandeur(id, donnees, complement); |
565 |
|
} |
566 |
|
|
567 |
|
$(this).dialog( "close" ); |
568 |
|
} |
569 |
|
} |
570 |
|
}); |
571 |
|
}, |
572 |
|
async: false |
573 |
|
}); |
574 |
|
} |
575 |
|
); |
576 |
|
|
577 |
|
$('#' + id + ' .search-mor-16').click( |
578 |
|
function(){ |
579 |
|
|
580 |
|
var donnees = "?type=personne_morale"+ |
581 |
|
"&mor_denomination="+$('#'+id+' input[id="personne_morale_denomination' + complement + '"]').val() + |
582 |
|
"&mor_nom="+$('#'+id+' input[id="personne_morale_nom' + complement + '"]').val(); |
583 |
|
|
584 |
|
$.ajax({ |
585 |
|
type: "GET", |
586 |
|
url: "../app/findPetitionnaire.php" + donnees , |
587 |
|
cache: false, |
588 |
|
success: function(html){ |
589 |
|
|
590 |
|
res = 'Auncune correspondance trouvée.'; |
591 |
|
|
592 |
|
if ( html > 2 ){ |
593 |
|
|
594 |
|
res = '<select>' ; |
595 |
|
donnees = html.split(';'); |
596 |
|
|
597 |
|
for ( i = 0 ; i < donnees.length - 1 ; i++ ){ |
598 |
|
|
599 |
|
val = donnees[i].replace('"', ''); |
600 |
|
line = donnees[i].split('_'); |
601 |
|
|
602 |
|
res += '<option value="' + val + '">' + line[5] + ' ' + line[6] + '</option>'; |
603 |
|
} |
604 |
|
|
605 |
|
res += '</select>' ; |
606 |
|
} |
607 |
|
|
608 |
|
$('#dialog').html(res); |
609 |
|
|
610 |
|
$( "#dialog" ).dialog({ |
611 |
|
modal: true, |
612 |
|
buttons : { |
613 |
|
Valider: function(){ |
614 |
|
|
615 |
|
if ( res != 'Auncune correspondance trouvée.' ){ |
616 |
|
donnees = $('#dialog select option:selected').val(); |
617 |
|
donnees = donnees.split('_'); |
618 |
|
|
619 |
|
if ( $.isNumeric(donnees[8]) ) |
620 |
|
$('#' + id + ' select[id="personne_morale_civilite' + complement + '"] option[value="' + $.trim(donnees[8]) + '"]').attr('selected','selected'); |
621 |
|
$('#' + id + ' input[id="personne_morale_denomination' + complement + '"]').val($.trim(donnees[5])); |
622 |
|
$('#' + id + ' input[id="personne_morale_raison_sociale' + complement + '"]').val($.trim(donnees[12])); |
623 |
|
$('#' + id + ' input[id="personne_morale_siret' + complement + '"]').val($.trim(donnees[6])); |
624 |
|
$('#' + id + ' input[id="personne_morale_categorie_juridique' + complement + '"]').val($.trim(donnees[13])); |
625 |
|
$('#' + id + ' input[id="personne_morale_nom' + complement + '"]').val($.trim(donnees[7])); |
626 |
|
$('#' + id + ' input[id="personne_morale_prenom' + complement + '"]').val($.trim(donnees[9])); |
627 |
|
|
628 |
|
changeValInputDemandeur(id, donnees, complement); |
629 |
|
} |
630 |
|
$(this).dialog( "close" ); |
631 |
|
} |
632 |
|
} |
633 |
|
}); |
634 |
|
}, |
635 |
|
async: false |
636 |
|
}); |
637 |
|
} |
638 |
|
); |
639 |
} |
} |
640 |
|
|
641 |
// Cette fonction permet lors de la validation du formulaire d'ajout de widget, |
/* |
642 |
// d'appeler le script PHP permettant de faire le traitement d'ajout dans la |
Change les valeurs des champs en commun des particuliers et des personnes morales |
643 |
// base puis d'ajouter a l'ecran le nouveau widget |
* */ |
644 |
function widget_add_form_post() { |
function changeValInputDemandeur(id, donnees, complement){ |
645 |
// serialisation des valeurs du formulaire |
|
646 |
data = "widget_add_form_valid=true&widget="+$("#widget_add_form select").val(); |
$('#' + id + ' input[id="demandeur' + complement + '"]').val($.trim(donnees[0])); |
647 |
// execution de la requete en POST pour ajouter le widget |
/*Teste si la valeur retournée est TRUE*/ |
648 |
|
if ( donnees[28] === 't' ){ |
649 |
|
$('#' + id + ' input[id="notification' + complement + '"]').attr('checked', 'checked'); |
650 |
|
$('#' + id + ' input[id="notification' + complement + '"]').val('Oui'); |
651 |
|
} |
652 |
|
$('#' + id + ' input[id="frequent' + complement + '"]').attr('checked','checked'); |
653 |
|
$('#' + id + ' input[id="frequent' + complement + '"]').val('Oui'); |
654 |
|
$('#' + id + ' input[id="numero' + complement + '"]').val($.trim(donnees[14])); |
655 |
|
$('#' + id + ' input[id="voie' + complement + '"]').val($.trim(donnees[15])); |
656 |
|
$('#' + id + ' input[id="complement' + complement + '"]').val($.trim(donnees[16])); |
657 |
|
$('#' + id + ' input[id="lieu_dit' + complement + '"]').val($.trim(donnees[17])); |
658 |
|
$('#' + id + ' input[id="localite' + complement + '"]').val($.trim(donnees[18])); |
659 |
|
$('#' + id + ' input[id="code_postal' + complement + '"]').val($.trim(donnees[19])); |
660 |
|
$('#' + id + ' input[id="bp' + complement + '"]').val($.trim(donnees[20])); |
661 |
|
$('#' + id + ' input[id="cedex' + complement + '"]').val($.trim(donnees[21])); |
662 |
|
$('#' + id + ' input[id="pays' + complement + '"]').val($.trim(donnees[22])); |
663 |
|
$('#' + id + ' input[id="division_territoriale' + complement + '"]').val($.trim(donnees[23])); |
664 |
|
$('#' + id + ' input[id="telephone_fixe' + complement + '"]').val($.trim(donnees[24])); |
665 |
|
$('#' + id + ' input[id="telephone_mobile' + complement + '"]').val($.trim(donnees[25])); |
666 |
|
$('#' + id + ' input[id="indicatif' + complement + '"]').val($.trim(donnees[26])); |
667 |
|
$('#' + id + ' input[id="courriel' + complement + '"]').val($.trim(donnees[27])); |
668 |
|
} |
669 |
|
|
670 |
|
/* |
671 |
|
Création des select pour la civilité |
672 |
|
* */ |
673 |
|
function setSelectCivilite(){ |
674 |
|
|
675 |
$.ajax({ |
$.ajax({ |
676 |
type: "POST", |
type: "GET", |
677 |
url: "../spg/widgetctl.php?action=insert", |
url: "../app/civilite.php", |
678 |
|
dataType: "json", |
679 |
cache: false, |
cache: false, |
|
data: data, |
|
680 |
success: function(html){ |
success: function(html){ |
681 |
// On cache le widget d'ajout |
if ( html != '' ){ |
682 |
$("#widget_").hide("highlight", function() { |
|
683 |
// On supprime le widget d'ajout |
$('#particulier_civilite').parent().html('<select id="particulier_civilite" class="champFormulaire" size="1" name="particulier_civilite">' + |
684 |
$("#widget_").remove(); |
'<option value="" selected="selected">choisir particulier_civilite</option>'); |
685 |
// On recupere la vue du widget que l'on vient d'ajouter |
$('#personne_morale_civilite').parent().html('<select id="personne_morale_civilite" class="champFormulaire" size="1" name="personne_morale_civilite">' + |
686 |
$.get("../spg/widgetctl.php?action=view&widget="+html, function(data) { |
'<option value="" selected="selected">choisir personne_morale_civilite</option>'); |
687 |
// On affiche le widget ajoute dans la premiere colonne |
|
688 |
$(data).prependTo("#column_1").effect("highlight"); |
civilites = html.split(';'); |
689 |
// On associe les actions du widget |
for ( i = 0 ; i < civilites.length - 1 ; i++ ){ |
690 |
widget_bind_edit_actions("#widget_"+html); |
|
691 |
}); |
civilite = civilites[i].split('_'); |
692 |
}); |
$('#particulier_civilite').append('<option value="' + civilite[0] + '">' + civilite[1] + '</option>'); |
693 |
} |
$('#personne_morale_civilite').append('<option value="' + civilite[0] + '">' + civilite[1] + '</option>'); |
694 |
|
} |
695 |
|
|
696 |
|
$('#particulier_civilite').append('</select>'); |
697 |
|
$('#personne_morale_civilite').append('</select>'); |
698 |
|
} |
699 |
|
}, |
700 |
|
async: false |
701 |
}); |
}); |
702 |
} |
} |
703 |
|
|
704 |
|
/* |
705 |
|
Retourne le code HTML d'un fieldset |
706 |
|
* */ |
707 |
|
function createFieldset(name, className){ |
708 |
|
return '<fieldset class="cadre ui-corner-all ui-widget-content" id="fieldset' + className + '">' + |
709 |
|
'<legend class="ui-corner-all ui-widget-content ui-state-active">' + name + ' </legend>' + |
710 |
|
'<input class="formsDemandeur" type="hidden" val=""/>'+ |
711 |
|
'<div class="fieldsetContent " id="' + className + '">' + |
712 |
|
'</div>' + |
713 |
|
'<div class="visualClear"></div>' + |
714 |
|
'</div>' + |
715 |
|
'</fieldset>'; |
716 |
|
} |
717 |
|
|
718 |
|
/* |
719 |
|
Test str est une lettre de l'alphabet |
720 |
|
* */ |
721 |
|
function isAlpha(str) { |
722 |
|
return /^[a-zA-Z\/]+$/.test(str); |
723 |
|
} |
724 |
|
|
725 |
|
/* |
726 |
|
Ajoute les ations spécifiques pour le formulaire personnalisé d'ajout de référence cadastrale |
727 |
|
* */ |
728 |
|
function actionFormReferenceCadastrale(){ |
729 |
|
$('form').submit( |
730 |
|
function(){ |
731 |
|
|
732 |
|
var reference_cadastrale = ''; |
733 |
|
var reference_cadastrale_temp = ''; |
734 |
|
|
735 |
|
$('.reference_cadastrale_custom_field').each( |
736 |
|
function(){ |
737 |
|
|
738 |
|
if ( $(this).val() == ';' ){ |
739 |
|
|
740 |
|
reference_cadastrale_bis = reference_cadastrale_temp + ( ( reference_cadastrale_temp != '' && reference_cadastrale_temp.length > 0 ) ? ';' : '' ); |
741 |
|
if ( /^([0-9]{1,4}[a-zA-Z]{1,3}[0-9]{1,5}([A\/]{1}[0-9]{1,4})*;)*$/.test(reference_cadastrale_bis) ){ |
742 |
|
|
743 |
|
reference_cadastrale += reference_cadastrale_bis; |
744 |
|
} |
745 |
|
reference_cadastrale_temp = ''; |
746 |
|
} |
747 |
|
else |
748 |
|
reference_cadastrale_temp += $(this).val(); |
749 |
|
|
750 |
|
} |
751 |
|
); |
752 |
|
|
753 |
|
$('#terrain_references_cadastrales').val(reference_cadastrale); |
754 |
|
} |
755 |
|
); |
756 |
|
|
757 |
// specific openfoncier ======================================================== |
$('#moreFieldReferenceCadastrale' + ($('.moreFieldReferenceCadastrale').length - 1 )).on("click", function() { |
758 |
|
$(this).before(newInputReferenceCadastrale()); |
759 |
function bible(){ |
}); |
760 |
if(fenetreouverte==true) |
|
|
pfenetre.close(); |
|
|
var ev=document.f2.evenement.value; |
|
|
var idx=document.f2.dossier.value; |
|
|
pfenetre=window.open("../app/bible.php?ev="+ev+"&idx="+idx,"bible","width=600,height=100,top=120,left=120"); |
|
|
fenetreouverte=true; |
|
|
} |
|
|
|
|
|
function bible2() |
|
|
{ |
|
|
if(fenetreouverte==true) |
|
|
pfenetre.close(); |
|
|
var ev=document.f2.evenement.value; |
|
|
var idx=document.f2.dossier.value; |
|
|
pfenetre=window.open("../app/bible2.php?ev="+ev,"bible","width=600,height=100,top=120,left=120"); |
|
|
fenetreouverte=true; |
|
761 |
} |
} |
762 |
|
|
763 |
function bible_auto(){ |
/* |
764 |
if(fenetreouverte==true) |
Action pour l'ajout de nouvelle ligne |
765 |
pfenetre.close(); |
* */ |
766 |
var ev=document.f2.evenement.value; |
function actionLineFormReferenceCadastrale(){ |
767 |
var idx=document.f2.dossier.value; |
$('#morelineReferenceCadastrale').click( |
768 |
pfenetre=window.open("../app/bible_auto.php?idx="+idx+"&ev="+ev,"evenement","width=600,height=300,top=120,left=120"); |
function(){ |
769 |
fenetreouverte=true; |
|
770 |
|
$('.reference_cadastrale_custom_fields').append( "<br/>" + fieldReferenceCadastraleBase()); |
771 |
|
$('#moreFieldReferenceCadastrale'+ ($('.moreFieldReferenceCadastrale').length - 1 )).on("click", function() { |
772 |
|
$(this).before(newInputReferenceCadastrale()); |
773 |
|
}); |
774 |
|
|
775 |
|
|
776 |
|
} |
777 |
|
); |
778 |
} |
} |
779 |
|
|
780 |
function dossierads_d(debut) |
/* |
781 |
{ |
Met à jour le select demande_type dès qu'un dossier_autorisation_type_detaille est choisi |
782 |
//if(fenetreouverte==true) |
* */ |
783 |
window.location="../pdf/pdfetat.php?obj=dossier_ads_d&nature=" |
function changeDemandeType(){ |
784 |
+document.f1.nature.value+"&idx=demo&datedebut=" |
|
785 |
+document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
var idDossierAutorisationTypeDetaille = $("#dossier_autorisation_type_detaille option:selected").val(); |
786 |
|
|
787 |
|
if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){ |
788 |
|
|
789 |
|
changeDataSelect('demande_type','dossier_autorisation_type_detaille'); |
790 |
|
if ( $('#demande_type option').size() < 2 ) |
791 |
|
showFormsDemande(); |
792 |
|
|
793 |
|
$('#demande_type').parent().parent().show(); |
794 |
|
|
795 |
|
addNewFieldReferencesCadastrales(); |
796 |
|
|
797 |
|
actionFormReferenceCadastrale(); |
798 |
|
actionLineFormReferenceCadastrale() |
799 |
|
} |
800 |
|
else { |
801 |
|
hideFields(); |
802 |
|
} |
803 |
|
} |
804 |
|
|
805 |
|
/* |
806 |
|
Ajoute le code HTML des champs pour les références cadastrales |
807 |
|
* */ |
808 |
|
function addNewFieldReferencesCadastrales(){ |
809 |
|
$('.references_cadastrales_new_field').remove(); |
810 |
|
$('.moreFieldReferenceCadastrale').remove(); |
811 |
|
$('#morelineReferenceCadastrale').remove(); |
812 |
|
$('.localisation .fieldsetContent').prepend( |
813 |
|
'<div class="field field-type-text references_cadastrales_new_field" >'+ |
814 |
|
'<div class="form-libelle">' + |
815 |
|
'<label '+ |
816 |
|
'class="libelle-terrain_references_cadastrales" '+ |
817 |
|
'for="terrain_references_cadastrales">'+ |
818 |
|
' terrain_references_cadastrales '+ |
819 |
|
'</label>' + |
820 |
|
'</div>' + |
821 |
|
'<div class="form-content reference_cadastrale_custom_fields">' + |
822 |
|
fieldReferenceCadastraleBase() + |
823 |
|
'</div>' + |
824 |
|
'</div>' + |
825 |
|
'<div class="field field-type-text" id="morelineReferenceCadastrale">' + |
826 |
|
'<div class="form-libelle"></div>' + |
827 |
|
'<div class="form-content">' + |
828 |
|
' + ajouter d\'autres lignes' + |
829 |
|
'</div>' + |
830 |
|
'</div>' |
831 |
|
); |
832 |
|
$('#terrain_superficie').parent().parent().after('<div class="field field-type-text" >' + |
833 |
|
'<div class="form-libelle"></div>' + |
834 |
|
'<div class="form-content">' + |
835 |
|
'<input id="cad-adr-them" class="ui-button ui-widget ui-state-default ui-corner-all" type="button" value="Cadastrale < = > Adresse"/>' + |
836 |
|
'</div>' + |
837 |
|
'</div>' ); |
838 |
|
} |
839 |
|
|
840 |
|
/* |
841 |
|
Séparateur caché ; |
842 |
|
* */ |
843 |
|
function hiddenSeparatorField(){ |
844 |
|
return '<input ' + |
845 |
|
'class="reference_cadastrale_custom_field " ' + |
846 |
|
'type="hidden" ' + |
847 |
|
'maxlength="2" ' + |
848 |
|
'size="2" ' + |
849 |
|
'value=";" />'; |
850 |
|
} |
851 |
|
|
852 |
|
/* |
853 |
|
Ajout d'une nouvelle ligne de champ |
854 |
|
* */ |
855 |
|
function fieldReferenceCadastraleBase(){ |
856 |
|
return '<input ' + |
857 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
858 |
|
'type="text" ' + |
859 |
|
'onchange="VerifNum(this)" ' + |
860 |
|
'maxlength="4" ' + |
861 |
|
'size="4" ' + |
862 |
|
'value="" />' + |
863 |
|
'<input ' + |
864 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
865 |
|
'type="text" ' + |
866 |
|
'maxlength="3" ' + |
867 |
|
'size="3" ' + |
868 |
|
'value="" '+ |
869 |
|
'onchange="if ( !isAlpha(this.value) ){ alert(\'Vous ne devez saisir que des lettres dans ce champs.\'); this.value = \'\'; }"/>' + |
870 |
|
'<input ' + |
871 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
872 |
|
'type="text" ' + |
873 |
|
'onchange="VerifNum(this)" ' + |
874 |
|
'maxlength="5" ' + |
875 |
|
'size="5" ' + |
876 |
|
'value="" />' + |
877 |
|
'<span id="moreFieldReferenceCadastrale' + $('.moreFieldReferenceCadastrale').length + '" class="moreFieldReferenceCadastrale">' + |
878 |
|
hiddenSeparatorField() + |
879 |
|
' + ajouter d\'autres champs' + |
880 |
|
'</span>'; |
881 |
|
} |
882 |
|
|
883 |
|
/* |
884 |
|
Cache les champs inutules |
885 |
|
* */ |
886 |
|
function hideFields(){ |
887 |
|
$('.bloc').each( |
888 |
|
function(){ |
889 |
|
if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') ) |
890 |
|
$(this).hide(); |
891 |
|
} |
892 |
|
); |
893 |
|
|
894 |
|
$('.field-type-text').hide(); |
895 |
|
$('input[type=submit]').hide(); |
896 |
|
$('#demande_type').parent().parent().hide(); |
897 |
} |
} |
898 |
|
|
899 |
function dossierdepot() |
/* |
900 |
{ |
Affiche les champs dont on a besoin |
901 |
//if(fenetreouverte==true) |
* */ |
902 |
window.location="../pdf/pdfetat.php?obj=dossier_depot&nature="+ |
function showFormsDemande(){ |
903 |
document.f1.nature.value+"&idx=demo&datedebut="+ |
$('.bloc').each( |
904 |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
function(){ |
905 |
|
if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') ) |
906 |
|
$(this).show(); |
907 |
|
} |
908 |
|
); |
909 |
|
|
910 |
|
$('.field-type-text').show(); |
911 |
|
$('input[type=submit]').show(); |
912 |
|
$('.terrain_references_cadastrales_custom').hide(); |
913 |
|
|
914 |
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
915 |
|
|
916 |
|
/*Cache les champs inutiles*/ |
917 |
|
fieldTypeDemandeur('#petitionnaire__0', true, '_0'); |
918 |
|
|
919 |
|
$('#fieldsetpetitionnaire__0 .formsDemandeur').val($('#petitionnaire__0').html()); |
920 |
|
|
921 |
|
changeIdNameField('petitionnaire__0', '_0'); |
922 |
|
|
923 |
|
addDatePicker('petitionnaire__0 #particulier_date_naissance_0'); |
924 |
} |
} |
925 |
|
|
926 |
function dossierads() |
/* |
927 |
{ |
Cache/montre des champs selon le type de demandeur |
928 |
//if(fenetreouverte==true) |
* */ |
929 |
window.location="../pdf/pdfetat.php?obj=dossier_ads&nature="+ |
function fieldTypeDemandeur(name, particulier, complement){ |
930 |
document.f1.nature.value+"&idx=demo&datedebut="+ |
|
931 |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
if ( particulier == true ){ |
932 |
} |
|
933 |
|
$(name + ' select[id="particulier_civilite' + complement + '"] option[value=""]').attr('selected', 'selected'); |
934 |
|
$(name + ' input[id="particulier_nom' + complement + '"]').val(''); |
935 |
|
$(name + ' input[id="particulier_prenom' + complement + '"]').val(''); |
936 |
|
$(name + ' input[id="particulier_date_naissance' + complement + '"]').val(''); |
937 |
|
$(name + ' input[id="particulier_commune_naissance' + complement + '"]').val(''); |
938 |
|
$(name + ' input[id="particulier_departement_naissance' + complement + '"]').val(''); |
939 |
|
|
940 |
|
$( name + ' .particulier_fields').show(); |
941 |
|
$( name + ' .personne_morale_fields').hide(); |
942 |
|
} |
943 |
|
else{ |
944 |
|
|
945 |
|
$(name + ' select[id="personne_morale_civilite' + complement + '"] option[value=""]').attr('selected', 'selected'); |
946 |
|
$(name + ' input[id="personne_morale_denomination' + complement + '"]').val(''); |
947 |
|
$(name + ' input[id="personne_morale_raison_sociale' + complement + '"]').val(''); |
948 |
|
$(name + ' input[id="personne_morale_siret' + complement + '"]').val(''); |
949 |
|
$(name + ' input[id="personne_morale_categorie_juridique' + complement + '"]').val(''); |
950 |
|
$(name + ' input[id="personne_morale_nom' + complement + '"]').val(''); |
951 |
|
$(name + ' input[id="personne_morale_prenom' + complement + '"]').val(''); |
952 |
|
$( name + ' .particulier_fields').hide(); |
953 |
|
$( name + ' .personne_morale_fields').show(); |
954 |
|
} |
955 |
|
} |
956 |
|
|
957 |
|
/* |
958 |
|
Action au clique sur le bouton " + ajouter d'autres champs" |
959 |
|
* */ |
960 |
|
function newInputReferenceCadastrale(){ |
961 |
|
return '<input ' + |
962 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
963 |
|
'type="text" ' + |
964 |
|
'maxlength="1" ' + |
965 |
|
'size="1" ' + |
966 |
|
'value="" ' + |
967 |
|
'onchange="testSeparator(this);"/>' + |
968 |
|
'<input ' + |
969 |
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
970 |
|
'type="text" ' + |
971 |
|
'onchange="VerifNum(this)" ' + |
972 |
|
'maxlength="4" ' + |
973 |
|
'size="4" ' + |
974 |
|
'value="" />'; |
975 |
|
} |
976 |
|
|
977 |
|
function testSeparator(obj){ |
978 |
|
|
979 |
|
if ( obj.value != 'A' && |
980 |
|
obj.value != '/' ) { |
981 |
|
|
982 |
|
alert('Saisissez uniquement un A ou un / comme séparateur'); |
983 |
|
obj.value = ''; |
984 |
|
} |
985 |
|
} |
986 |
|
|
987 |
|
// Desactivation des fonctions widget du tableau de bord inutiles sur le nouveau |
988 |
|
// tableau de bord |
989 |
|
function widget_bind_move_actions() {} |
990 |
|
function widget_bind_add_action() {} |
991 |
|
function widget_bind_edit_actions(widget_selector) {} |
992 |
|
|
993 |
|
function file(fichier) { |
994 |
|
// |
995 |
|
if (fichier == "") { |
996 |
|
alert("zone vide"); |
997 |
|
} |
998 |
|
// |
999 |
|
pfenetre = window.open("../app/file.php?file="+fichier,"Visualisation","width=100,height=100,top=1,left=150,scrollbars=yes,resizable = yes"); |
1000 |
|
// |
1001 |
|
fenetreouverte = true; |
1002 |
|
} |