1 |
fraynaud |
88 |
// specific openfoncier ======================================================== |
2 |
fmichon |
784 |
|
3 |
|
|
// Document is ready |
4 |
nhaye |
585 |
$(function(){ |
5 |
fmichon |
784 |
|
6 |
|
|
/** |
7 |
|
|
* Spécifique app/avis_code_barre.php pour donner le focus sur le champ de |
8 |
|
|
* recherche au chargement de la page. |
9 |
|
|
*/ |
10 |
nhaye |
585 |
$('#avis_code_barre_form #consultation').focus(); |
11 |
nhaye |
1210 |
|
12 |
|
|
/** |
13 |
|
|
* Spécifique app/maj_dates_suivi.php pour donner le focus sur le champ |
14 |
|
|
* instruction au chargement de la page si la date n'est pas vide. |
15 |
|
|
*/ |
16 |
|
|
if($('#maj_dates_form #date').val()!="") { |
17 |
|
|
$('#maj_dates_form #instruction').focus(); |
18 |
|
|
} |
19 |
nhaye |
585 |
}); |
20 |
fraynaud |
88 |
|
21 |
nhaye |
585 |
|
22 |
fmichon |
784 |
/** |
23 |
|
|
* WIDGET liés au formulaire et sousformulaire |
24 |
|
|
* |
25 |
|
|
* Ces fonctions javascript sont appelées depuis les méthodes setOnChange, |
26 |
|
|
* setOnClick, ... |
27 |
|
|
*/ |
28 |
|
|
// bible - type httpclick |
29 |
|
|
function bible() { |
30 |
fraynaud |
88 |
if(fenetreouverte==true) |
31 |
|
|
pfenetre.close(); |
32 |
|
|
var ev=document.f2.evenement.value; |
33 |
|
|
var idx=document.f2.dossier.value; |
34 |
fraynaud |
343 |
pfenetre=window.open("../app/bible.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
35 |
fraynaud |
88 |
fenetreouverte=true; |
36 |
|
|
} |
37 |
fmichon |
784 |
// bible2 - type httpclick |
38 |
fraynaud |
88 |
function bible2() |
39 |
|
|
{ |
40 |
|
|
if(fenetreouverte==true) |
41 |
|
|
pfenetre.close(); |
42 |
|
|
var ev=document.f2.evenement.value; |
43 |
|
|
var idx=document.f2.dossier.value; |
44 |
fraynaud |
343 |
pfenetre=window.open("../app/bible2.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
45 |
fraynaud |
88 |
fenetreouverte=true; |
46 |
|
|
} |
47 |
fmichon |
784 |
// bible_auto - type httpclick |
48 |
fraynaud |
88 |
function bible_auto(){ |
49 |
|
|
if(fenetreouverte==true) |
50 |
|
|
pfenetre.close(); |
51 |
|
|
var ev=document.f2.evenement.value; |
52 |
|
|
var idx=document.f2.dossier.value; |
53 |
fraynaud |
90 |
pfenetre=window.open("../app/bible_auto.php?idx="+idx+"&ev="+ev,"evenement","width=600,height=300,top=120,left=120"); |
54 |
fraynaud |
88 |
fenetreouverte=true; |
55 |
|
|
} |
56 |
fmichon |
784 |
// VerifNumdec - type text |
57 |
|
|
function VerifNumdec(champ) { |
58 |
|
|
champ.value = champ.value.replace(",", "."); // remplacement de la virgule |
59 |
|
|
//if (champ.value.lastIndexOf(".") == -1){ // champ decimal |
60 |
|
|
if (isNaN(champ.value)) { |
61 |
|
|
alert(msg_alert_error_verifnum); |
62 |
|
|
champ.value = ""; |
63 |
|
|
return; |
64 |
|
|
} |
65 |
|
|
//} |
66 |
|
|
|
67 |
|
|
} |
68 |
|
|
// Ce widget permet de charger les données d'un select en ajax |
69 |
nhaye |
1062 |
function changeDataSelect(tableName, linkedField, joker){ |
70 |
|
|
var id_dossierAutorisation = $("#dossier_autorisation").val(); |
71 |
|
|
var id = $("#"+linkedField).val(); |
72 |
|
|
link = "../app/listData.php?idx=" + id + "&tableName=" + tableName + |
73 |
|
|
"&linkedField=" + linkedField ; |
74 |
|
|
if(id_dossierAutorisation != "") { |
75 |
|
|
link += "&nature=EXIST"; |
76 |
|
|
} |
77 |
|
|
var val_tableName = $('#'+tableName).val(); |
78 |
fmichon |
784 |
$.ajax({ |
79 |
|
|
type: "GET", |
80 |
|
|
url: link, |
81 |
|
|
cache: false, |
82 |
|
|
dataType: "json", |
83 |
|
|
success: function(html){ |
84 |
|
|
|
85 |
nhaye |
1062 |
$('#'+tableName).empty(); |
86 |
fmichon |
1005 |
var selected = ""; |
87 |
nhaye |
1062 |
if(val_tableName == "") { |
88 |
fmichon |
1005 |
selected=' selected="selected"'; |
89 |
|
|
} |
90 |
fmichon |
784 |
if ( joker == true ) |
91 |
nhaye |
1062 |
$('#'+tableName).append( |
92 |
fmichon |
1005 |
'<option value=""'+selected+'>*</option>' |
93 |
fmichon |
784 |
); |
94 |
fmichon |
1005 |
else { |
95 |
nhaye |
1062 |
$('#'+tableName).append( |
96 |
|
|
'<option value=""'+selected+'>Choisir ' + tableName + '</option>' |
97 |
fmichon |
784 |
); |
98 |
fmichon |
1005 |
} |
99 |
fmichon |
784 |
if ( html !== '' ){ |
100 |
|
|
|
101 |
|
|
html = html.split(';'); |
102 |
|
|
for ( i = 0 ; i < html.length - 1 ; i++ ){ |
103 |
|
|
|
104 |
|
|
html_temp = html[i].split('_'); |
105 |
fmichon |
1005 |
selected = ""; |
106 |
nhaye |
1062 |
if(val_tableName == html_temp[0]) { |
107 |
fmichon |
1005 |
selected=' selected="selected"'; |
108 |
|
|
} |
109 |
nhaye |
1062 |
$('#'+tableName).append( |
110 |
fmichon |
1005 |
'<option value="'+html_temp[0]+'"'+selected+' >'+html_temp[1]+'</option>' |
111 |
fmichon |
784 |
); |
112 |
fmichon |
1005 |
|
113 |
fmichon |
784 |
} |
114 |
|
|
} |
115 |
|
|
}, |
116 |
|
|
async: false |
117 |
|
|
}); |
118 |
|
|
} |
119 |
nhaye |
1333 |
|
120 |
|
|
// Ce widget permet de charger les données de la demande type en ajax |
121 |
|
|
function changeDemandeTypeDataSelect(){ |
122 |
|
|
// Récupération de l'id du dossier_autorisation_type_detaille |
123 |
|
|
var id_datd = $("#dossier_autorisation_type_detaille").val(); |
124 |
|
|
|
125 |
|
|
// Récupération de la liste des paramètres de l'url |
126 |
|
|
var params = extractUrlParams(); |
127 |
nhaye |
1375 |
if ( typeof params['idx_dossier'] === "undefined" ){ |
128 |
|
|
params['idx_dossier'] = ''; |
129 |
|
|
} |
130 |
nhaye |
1333 |
|
131 |
nhaye |
1375 |
link = "../app/listDemandeType.php?idx=" + params['idx_dossier'] + "&datd="+ id_datd; |
132 |
nhaye |
1333 |
|
133 |
|
|
var val_tableName = $('#demande_type').val(); |
134 |
|
|
$.ajax({ |
135 |
|
|
type: "GET", |
136 |
|
|
url: link, |
137 |
|
|
cache: false, |
138 |
|
|
dataType: "json", |
139 |
|
|
success: function(res){ |
140 |
|
|
$('#demande_type').empty(); |
141 |
|
|
var selected = ""; |
142 |
|
|
|
143 |
|
|
if(val_tableName == "") { |
144 |
|
|
selected=' selected="selected"'; |
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
for ( j=0 ; j < res[0].length ; j++ ){ |
148 |
|
|
|
149 |
|
|
if(val_tableName == "") { |
150 |
|
|
selected=' selected="selected"'; |
151 |
|
|
} |
152 |
|
|
$('#demande_type').append( |
153 |
|
|
'<option value="'+res[0][j]+'"'+selected+' >'+res[1][j]+'</option>' |
154 |
|
|
); |
155 |
|
|
|
156 |
|
|
} |
157 |
|
|
}, |
158 |
|
|
async: false |
159 |
|
|
}); |
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
/** |
163 |
|
|
* Fonction de récupération des paramètres GET de la page |
164 |
|
|
* @return Array Tableau associatif contenant les paramètres GET |
165 |
|
|
*/ |
166 |
|
|
function extractUrlParams(){ |
167 |
|
|
var t = location.search.substring(1).split('&'); |
168 |
|
|
var f = []; |
169 |
|
|
for (var i=0; i<t.length; i++){ |
170 |
|
|
var x = t[ i ].split('='); |
171 |
|
|
f[x[0]]=x[1]; |
172 |
|
|
} |
173 |
|
|
return f; |
174 |
|
|
} |
175 |
|
|
|
176 |
fmichon |
784 |
// vuploadMulti - XXX |
177 |
|
|
function vuploadMulti(champ) { |
178 |
|
|
// |
179 |
|
|
if (fenetreouverte == true) { |
180 |
|
|
pfenetre.close(); |
181 |
|
|
} |
182 |
|
|
// |
183 |
|
|
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"); |
184 |
|
|
//pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120"); |
185 |
|
|
// |
186 |
|
|
fenetreouverte = true; |
187 |
|
|
} |
188 |
|
|
// tmpUpload - Upload XXX |
189 |
|
|
function tmpUpload(champ) { |
190 |
|
|
// |
191 |
|
|
if (fenetreouverte == true) { |
192 |
|
|
pfenetre.close(); |
193 |
|
|
} |
194 |
|
|
// |
195 |
|
|
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"); |
196 |
|
|
//pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120"); |
197 |
|
|
// |
198 |
|
|
fenetreouverte = true; |
199 |
|
|
} |
200 |
fraynaud |
88 |
|
201 |
fmichon |
784 |
|
202 |
|
|
|
203 |
|
|
/** |
204 |
|
|
* POPUP pour le téléchargement de fichier |
205 |
|
|
* |
206 |
|
|
* Ces fonctions javascript sont appelées depuis des onClick sur des |
207 |
|
|
* formulaires spécifiques pour permettre de transmettre des paramètres aux |
208 |
|
|
* éditions pdf ainsi appelées. |
209 |
|
|
*/ |
210 |
|
|
// |
211 |
fraynaud |
88 |
function dossierads_d(debut) |
212 |
|
|
{ |
213 |
|
|
//if(fenetreouverte==true) |
214 |
fmichon |
1360 |
window.location="../pdf/pdfetat.php?obj=registre_dossiers_decisions_par_type_par_date&nature=" |
215 |
fraynaud |
88 |
+document.f1.nature.value+"&idx=demo&datedebut=" |
216 |
|
|
+document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
217 |
|
|
} |
218 |
fmichon |
784 |
// |
219 |
vpihour |
1072 |
function dossier_reglementaire(){ |
220 |
vpihour |
1080 |
|
221 |
|
|
$('#bouton-PDF').remove(); |
222 |
vpihour |
1072 |
$("#msg").html(msg_loading); |
223 |
vpihour |
1080 |
|
224 |
vpihour |
1072 |
/*Requete AJAX vers le fichier edition_reglementaire.php pour mettre à jour les dossiers*/ |
225 |
|
|
$.ajax({ |
226 |
|
|
type: "GET", |
227 |
|
|
url: "../app/edition_reglementaire.php?update", |
228 |
|
|
cache: false, |
229 |
|
|
success: function(html){ |
230 |
vpihour |
840 |
|
231 |
vpihour |
1072 |
$('#msg').html( |
232 |
|
|
'<div class="message ui-widget ui-corner-all ui-state-highlight">'+ |
233 |
|
|
'<p>'+ |
234 |
|
|
'<span class="ui-icon ui-icon-info"></span>'+ |
235 |
|
|
'<span class="text">'+ |
236 |
|
|
'</span>'+ |
237 |
|
|
'</p>'+ |
238 |
|
|
'</div>' |
239 |
|
|
); |
240 |
|
|
|
241 |
|
|
if ( html.length > 2 ){ |
242 |
|
|
|
243 |
|
|
$("#msg .message").addClass("ui-state-error"); |
244 |
|
|
$("#msg .text").html(html); |
245 |
|
|
} |
246 |
|
|
else { |
247 |
|
|
|
248 |
|
|
$("#msg .message").addClass("ui-state-valid"); |
249 |
|
|
$("#msg .text").html("PDF affiche avec succes !"); |
250 |
fmichon |
1360 |
window.open("../pdf/pdfetat.php?obj=registre_dossiers_affichage_reglementaire&idx=demo"); |
251 |
vpihour |
1072 |
} |
252 |
|
|
}, |
253 |
|
|
async: false |
254 |
|
|
}); |
255 |
vpihour |
833 |
} |
256 |
vpihour |
1146 |
//Fonction de redirection pour le widget de recherche de dossier |
257 |
|
|
function widget_recherche_dossier(data,nbRes){ |
258 |
|
|
/*$('#msg').show(); |
259 |
|
|
$('#msg').html(msg_loading);*/ |
260 |
|
|
|
261 |
|
|
// S'il n'y a qu'un seul résultat, afficher un résumé |
262 |
|
|
if ( nbRes == 1 ){ |
263 |
|
|
|
264 |
|
|
window.location = "../scr/form.php?obj=dossier_instruction&action=3&" + |
265 |
|
|
"idx=" + data + "&premier=0&advs_id=&recherche=&tricol=&" + |
266 |
|
|
"selectioncol=&valide=&retour=tab"; |
267 |
|
|
} |
268 |
|
|
// S'il y a une liste de dossier, redirection vers le tableau |
269 |
|
|
else { |
270 |
|
|
|
271 |
vpihour |
1207 |
window.location = "../scr/tab.php?obj=recherche_direct&selectioncol=0&recherche=" + data; |
272 |
vpihour |
1146 |
} |
273 |
|
|
} |
274 |
vpihour |
833 |
// |
275 |
fraynaud |
88 |
function dossierdepot() |
276 |
|
|
{ |
277 |
|
|
//if(fenetreouverte==true) |
278 |
fmichon |
1360 |
window.location="../pdf/pdfetat.php?obj=registre_dossiers_depots_par_type_par_date&nature="+ |
279 |
fraynaud |
88 |
document.f1.nature.value+"&idx=demo&datedebut="+ |
280 |
|
|
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
281 |
|
|
} |
282 |
fmichon |
784 |
// |
283 |
fraynaud |
88 |
function dossierads() |
284 |
|
|
{ |
285 |
|
|
//if(fenetreouverte==true) |
286 |
fmichon |
1360 |
window.location="../pdf/pdfetat.php?obj=registre_dossiers_par_type_par_date&nature="+ |
287 |
fraynaud |
88 |
document.f1.nature.value+"&idx=demo&datedebut="+ |
288 |
|
|
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
289 |
|
|
} |
290 |
|
|
|
291 |
fmichon |
784 |
// téléchargement du fichier |
292 |
|
|
function file(fichier) { |
293 |
|
|
// |
294 |
|
|
if (fichier == "") { |
295 |
|
|
alert("zone vide"); |
296 |
|
|
} |
297 |
|
|
// |
298 |
|
|
pfenetre = window.open("../app/file.php?file="+fichier,"Visualisation","width=100,height=100,top=1,left=150,scrollbars=yes,resizable = yes"); |
299 |
|
|
// |
300 |
|
|
fenetreouverte = true; |
301 |
|
|
} |
302 |
fraynaud |
271 |
|
303 |
fmichon |
784 |
/** |
304 |
|
|
* Retour spécifique de l'écran de consultation multiple - surcharge de ajaxIt |
305 |
|
|
* @todo XXX voir les différences avec ajaxIt et si il n'est pas possible |
306 |
|
|
* d'effectuer la modification dans le core |
307 |
|
|
*/ |
308 |
vpihour |
534 |
function messageIt(objsf, link, empty) { |
309 |
|
|
// recuperation du terme recherche |
310 |
|
|
var recherche = document.getElementById("recherchedyn"); |
311 |
|
|
if (recherche != null) { |
312 |
|
|
link += "&recherche="+recherche.value; |
313 |
|
|
}else { |
314 |
|
|
link += "&recherche="; |
315 |
|
|
} |
316 |
vpihour |
558 |
// execution de la requete en GET |
317 |
vpihour |
534 |
$.ajax({ |
318 |
|
|
type: "GET", |
319 |
|
|
url: link, |
320 |
|
|
cache: false, |
321 |
|
|
success: function(html){ |
322 |
|
|
(empty == true )?$("#sousform-"+objsf).empty():''; |
323 |
|
|
$("#sousform-"+objsf).append(html); |
324 |
|
|
om_initialize_content(); |
325 |
|
|
}, |
326 |
|
|
async: false |
327 |
|
|
}); |
328 |
|
|
} |
329 |
vpihour |
536 |
|
330 |
fmichon |
784 |
/** |
331 |
|
|
* TTélécharegement de fichier pdf en ajax |
332 |
|
|
* spécifique de l'écran de consultation multiple |
333 |
|
|
*/ |
334 |
vpihour |
536 |
/* Plugin jQuery qui lance un espèce d'appel AJAX vers un script PHP de téléchargement de fichier*/ |
335 |
|
|
jQuery.download = function(url, data, method){ |
336 |
|
|
//url and data options required |
337 |
|
|
if( url && data ){ |
338 |
|
|
//data can be string of parameters or array/object |
339 |
|
|
data = typeof data == 'string' ? data : jQuery.param(data); |
340 |
|
|
//split params into form inputs |
341 |
|
|
var inputs = ''; |
342 |
|
|
jQuery.each(data.split('&'), function(){ |
343 |
|
|
var pair = this.split('='); |
344 |
|
|
inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />'; |
345 |
|
|
}); |
346 |
|
|
//send request |
347 |
|
|
jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') |
348 |
|
|
.prependTo('body').submit().remove(); |
349 |
|
|
}; |
350 |
|
|
}; |
351 |
|
|
|
352 |
fmichon |
784 |
/** |
353 |
|
|
* Cette fonction permet de charger dans un dialog jqueryui un formulaire tel |
354 |
|
|
* qu'il aurait été chargé avec ajaxIt |
355 |
nhaye |
800 |
* |
356 |
|
|
* @param objsf string : objet de sousformulaire |
357 |
|
|
* @param link string : lien vers un sousformulaire (../scr/sousform.php...) |
358 |
nhaye |
801 |
* @param width integer: width en px |
359 |
|
|
* @param height integer: height en px |
360 |
nhaye |
800 |
* @param callback function (optionel) : nom de la méthode à appeler |
361 |
|
|
* à la fermeture du dialog |
362 |
|
|
* @param callbackParams mixed (optionel) : paramètre à traiter dans la function |
363 |
|
|
* callback |
364 |
fmichon |
784 |
* |
365 |
nhaye |
800 |
**/ |
366 |
nhaye |
801 |
function popupIt(objsf, link, width, height, callback, callbackParams) { |
367 |
nhaye |
544 |
// Insertion du conteneur du dialog |
368 |
nhaye |
1270 |
var dialog = $('<div id=\"sousform-'+objsf+'\"></div>').insertAfter('#tabs-1 .formControls'); |
369 |
nhaye |
544 |
$('<input type=\"text\" name=\"recherchedyn\" id=\"recherchedyn\" value=\"\" class=\"champFormulaire\" style=\"display:none\" />').insertAfter('#sousform-'+objsf); |
370 |
|
|
|
371 |
|
|
// execution de la requete passee en parametre |
372 |
|
|
// (idem ajaxIt + callback) |
373 |
|
|
$.ajax({ |
374 |
|
|
type: "GET", |
375 |
|
|
url: link, |
376 |
|
|
cache: false, |
377 |
|
|
success: function(html){ |
378 |
|
|
//Suppression d'un precedent dialog |
379 |
|
|
dialog.empty(); |
380 |
|
|
//Ajout du contenu recupere |
381 |
|
|
dialog.append(html); |
382 |
|
|
//Initialisation du theme OM |
383 |
|
|
om_initialize_content(); |
384 |
|
|
//Creation du dialog |
385 |
|
|
$(dialog).dialog({ |
386 |
|
|
//OnClose suppression du contenu |
387 |
|
|
close: function(ev, ui) { |
388 |
nhaye |
800 |
// Si le formulaire est submit et valide on execute la méthode |
389 |
|
|
// passée en paramètre |
390 |
|
|
if (typeof(callback) === "function") { |
391 |
|
|
callback(callbackParams); |
392 |
nhaye |
557 |
} |
393 |
nhaye |
544 |
$(this).remove(); |
394 |
|
|
}, |
395 |
|
|
resizable: false, |
396 |
|
|
modal: true, |
397 |
nhaye |
801 |
width: width, |
398 |
|
|
height: height, |
399 |
fmichon |
1005 |
position: 'center', |
400 |
nhaye |
544 |
}); |
401 |
|
|
}, |
402 |
|
|
async : false |
403 |
|
|
}); |
404 |
nhaye |
802 |
//Fermeture du dialog lors d'un clic sur le bouton retour |
405 |
nhaye |
544 |
$('#sousform-'+objsf).on("click",'a.retour',function() { |
406 |
|
|
$(dialog).dialog('close').remove(); |
407 |
nhaye |
838 |
return false; |
408 |
nhaye |
544 |
}); |
409 |
|
|
} |
410 |
nhaye |
557 |
|
411 |
fmichon |
784 |
/*** |
412 |
nhaye |
800 |
* Fonction getter des paramètres de l'url courante |
413 |
fmichon |
784 |
*/ |
414 |
nhaye |
557 |
// Parse URL Queries Method |
415 |
|
|
(function($){ |
416 |
nhaye |
800 |
$.getQuery = function( query ) { |
417 |
|
|
query = query.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); |
418 |
|
|
var expr = "[\\?&]"+query+"=([^&#]*)"; |
419 |
|
|
var regex = new RegExp( expr ); |
420 |
|
|
var results = regex.exec( window.location.href ); |
421 |
|
|
if( results !== null ) { |
422 |
|
|
return results[1]; |
423 |
|
|
return decodeURIComponent(results[1].replace(/\+/g, " ")); |
424 |
|
|
} else { |
425 |
|
|
return false; |
426 |
|
|
} |
427 |
|
|
}; |
428 |
nhaye |
557 |
})(jQuery); |
429 |
vpihour |
558 |
|
430 |
vpihour |
641 |
|
431 |
vpihour |
793 |
/* |
432 |
nhaye |
800 |
* Javascript concernant la demande d'avis |
433 |
|
|
* |
434 |
|
|
* |
435 |
|
|
*/ |
436 |
|
|
|
437 |
nhaye |
802 |
/** |
438 |
|
|
* Fonction de callback appellée lors de la fermeture du dialog (popupit) |
439 |
|
|
* du retour d'avis d'un service |
440 |
|
|
**/ |
441 |
nhaye |
800 |
function returnToTab(objsf) { |
442 |
|
|
var valid=$('#sousform-'+objsf+' div.ui-state-valid'); |
443 |
|
|
if(valid.length > 0) { |
444 |
|
|
document.location.href="../scr/tab.php?obj="+$.getQuery('obj')+"&premier="+$.getQuery('premier') |
445 |
|
|
+"&advs_id="+$.getQuery('advs_id')+"&recherche="+$.getQuery('recherche')+"&tricol="+$.getQuery('tricol') |
446 |
|
|
+"&selectioncol="+$.getQuery('selectioncol'); |
447 |
|
|
} |
448 |
|
|
}; |
449 |
|
|
|
450 |
|
|
|
451 |
|
|
/* |
452 |
vpihour |
793 |
* Javascript concernant la demande |
453 |
|
|
* |
454 |
|
|
* |
455 |
|
|
*/ |
456 |
fmichon |
784 |
|
457 |
nhaye |
807 |
/** |
458 |
vpihour |
1060 |
* Fonction permettant de mettre à jour les infos du demandeur |
459 |
nhaye |
807 |
**/ |
460 |
|
|
function getDemandeurId(type) { |
461 |
|
|
var id_demandeur=$('#id_retour').val(); |
462 |
nhaye |
828 |
if($.isNumeric(id_demandeur)) { |
463 |
|
|
afficherDemandeur(id_demandeur,type); |
464 |
|
|
om_initialize_content(); |
465 |
|
|
} |
466 |
nhaye |
807 |
} |
467 |
|
|
|
468 |
nhaye |
828 |
/** |
469 |
|
|
* Fonction permettant d'afficher la synthèse d'un demandeur |
470 |
|
|
*/ |
471 |
|
|
function afficherDemandeur(id,type) { |
472 |
|
|
$.ajax({ |
473 |
|
|
type: "GET", |
474 |
|
|
url: '../app/afficher_synthese_demandeur.view.php?iddemandeur='+id+'&type='+type, |
475 |
|
|
cache: false, |
476 |
|
|
success: function(html){ |
477 |
fmichon |
1005 |
$(html).insertBefore('#add_'+type).fadeIn(500); |
478 |
|
|
|
479 |
|
|
}, |
480 |
|
|
async:false |
481 |
nhaye |
828 |
}); |
482 |
fmichon |
1005 |
affichageBoutonsDemandeurs(); |
483 |
nhaye |
828 |
} |
484 |
|
|
|
485 |
nhaye |
838 |
/** |
486 |
vpihour |
1060 |
* Fonction permettant de modifier un demandeur |
487 |
vpihour |
793 |
*/ |
488 |
nhaye |
931 |
function editDemandeur(obj,id,type,id_css) { |
489 |
nhaye |
1048 |
var url = '../scr/sousform.php?obj='+obj+'&retourformulaire=demande'; |
490 |
|
|
if(getDemandeInfo('type') == 'DM') { |
491 |
|
|
url += '&action=0&idx_demandeur='+id; |
492 |
|
|
} else { |
493 |
|
|
url += '&action=1&idx='+id; |
494 |
|
|
} |
495 |
nhaye |
1103 |
popupIt(obj, url, 860, 'auto', |
496 |
nhaye |
1048 |
replaceDemandeur, {'type':type,'id': id, 'id_css':id_css}); |
497 |
fmichon |
1005 |
affichageBoutonsDemandeurs(); |
498 |
nhaye |
838 |
} |
499 |
vpihour |
793 |
|
500 |
nhaye |
838 |
/** |
501 |
|
|
* Function permettant de remplacer un contenu déjà existant |
502 |
|
|
**/ |
503 |
|
|
function replaceDemandeur(obj) { |
504 |
nhaye |
1050 |
var new_demandeur=$('#id_retour').val(); |
505 |
nhaye |
1064 |
if($.isNumeric(new_demandeur)) { |
506 |
|
|
$.ajax({ |
507 |
|
|
type: "GET", |
508 |
|
|
url: '../app/afficher_synthese_demandeur.view.php?iddemandeur='+new_demandeur+'&type='+obj.type, |
509 |
|
|
cache: false, |
510 |
|
|
success: function(html){ |
511 |
|
|
$(obj.id_css).replaceWith(html); |
512 |
|
|
} |
513 |
|
|
}); |
514 |
|
|
} |
515 |
nhaye |
838 |
} |
516 |
|
|
/** |
517 |
|
|
* Function permettant de remplacer un contenu déjà existant |
518 |
|
|
**/ |
519 |
|
|
function removeDemandeur(id) { |
520 |
|
|
var div_class=$('#'+id).attr("class"); |
521 |
|
|
$('#'+id).remove(); |
522 |
|
|
if(div_class == "delegataire") { |
523 |
|
|
$('#add_delegataire').fadeIn(500); |
524 |
|
|
} |
525 |
fmichon |
1005 |
affichageBoutonsDemandeurs(); |
526 |
|
|
} |
527 |
|
|
|
528 |
|
|
/** |
529 |
|
|
* Fonction permettant d'afficher et cacher les boutons d'ajout de demandeurs |
530 |
|
|
*/ |
531 |
|
|
function affichageBoutonsDemandeurs(){ |
532 |
nhaye |
1090 |
|
533 |
|
|
// Si formulaire après validation on cache les boutons d'ajout de demandeurs |
534 |
|
|
url = document.location + "" ; |
535 |
|
|
|
536 |
nhaye |
1100 |
if ((url.indexOf("form.php?obj=demande&") != -1 |
537 |
|
|
|| url.indexOf("form.php?obj=demande_nouveau_dossier&") != -1 |
538 |
|
|
|| url.indexOf("form.php?obj=demande_dossier_existant&") != -1) |
539 |
|
|
&& $("form[name=f1] .form-is-valid").size() > 0 ) { |
540 |
nhaye |
1090 |
|
541 |
fmichon |
1005 |
$('#add_petitionnaire_principal').hide(); |
542 |
nhaye |
1090 |
$('#add_delegataire').hide(); |
543 |
fmichon |
1005 |
if($('input[name=delegataire][type=hidden]').size() == 0) { |
544 |
nhaye |
1090 |
$('#delegataire').hide(); |
545 |
fmichon |
1005 |
} |
546 |
|
|
$('#add_petitionnaire').hide(); |
547 |
nhaye |
1090 |
|
548 |
fmichon |
1005 |
} else { |
549 |
nhaye |
1090 |
|
550 |
|
|
// Affichage du bouton d'ajout du petitionnaire principal |
551 |
|
|
if($('input[name=petitionnaire_principal][type=hidden]').size() == 1) { |
552 |
|
|
$('#add_petitionnaire_principal').hide(); |
553 |
|
|
} else { |
554 |
|
|
$('#add_petitionnaire_principal').fadeIn(500); |
555 |
|
|
} |
556 |
|
|
|
557 |
|
|
// Affichage du bouton d'ajout du delegataire |
558 |
|
|
if($('input[name=petitionnaire_principal][type=hidden]').size() == 1 |
559 |
|
|
|| $('input[name=delegataire][type=hidden]').size() == 1) { |
560 |
|
|
$('#delegataire').fadeIn(500); |
561 |
|
|
if($('input[name=delegataire][type=hidden]').size() == 0) { |
562 |
|
|
$('#add_delegataire').fadeIn(500); |
563 |
|
|
} else { |
564 |
|
|
$('#add_delegataire').hide(); |
565 |
|
|
} |
566 |
|
|
} else { |
567 |
|
|
$('#delegataire').hide(); |
568 |
|
|
} |
569 |
|
|
|
570 |
|
|
// Affichage du bouton d'ajout de petitionnaires |
571 |
|
|
if($('input[name=petitionnaire_principal][type=hidden]').size() == 0) { |
572 |
|
|
$('#add_petitionnaire').hide(); |
573 |
|
|
} else { |
574 |
|
|
$('#add_petitionnaire').fadeIn(500); |
575 |
|
|
} |
576 |
fmichon |
1005 |
} |
577 |
nhaye |
838 |
} |
578 |
vpihour |
793 |
|
579 |
nhaye |
838 |
/** |
580 |
|
|
* Appel au chargement de la page |
581 |
|
|
**/ |
582 |
vpihour |
664 |
$(function() { |
583 |
vpihour |
805 |
changeDemandeurType('qualite'); |
584 |
vpihour |
823 |
if ( $('#type_demandeur') == 'petitionnaire' ){ |
585 |
|
|
|
586 |
|
|
addSearchIcon(); |
587 |
|
|
addDivDialog('.bloc_demandeur'); |
588 |
|
|
} |
589 |
fmichon |
1005 |
affichageBoutonsDemandeurs(); |
590 |
nhaye |
828 |
// Bind de la fonction permettant l'ajout du pétitionnaire principal |
591 |
nhaye |
838 |
$("#formulaire").on("click","#add_petitionnaire_principal", function() { |
592 |
nhaye |
828 |
popupIt('petitionnaire', |
593 |
|
|
'../scr/sousform.php?obj=petitionnaire&action=0'+ |
594 |
nhaye |
1103 |
'&retourformulaire=demande&principal=true', 860, 'auto', |
595 |
nhaye |
828 |
getDemandeurId, 'petitionnaire_principal'); |
596 |
|
|
}); |
597 |
|
|
// Bind de la fonction permettant l'ajout du délégataire |
598 |
|
|
$("#formulaire").on("click","#add_delegataire", function(event) { |
599 |
|
|
popupIt('delegataire', |
600 |
|
|
'../scr/sousform.php?obj=delegataire&action=0'+ |
601 |
nhaye |
1103 |
'&retourformulaire=demande', 860, 'auto', |
602 |
nhaye |
828 |
getDemandeurId, 'delegataire'); |
603 |
|
|
}); |
604 |
|
|
// Bind de la fonction permettant l'ajout des pétitionnaires |
605 |
|
|
$("#formulaire").on("click","#add_petitionnaire", function(event) { |
606 |
|
|
popupIt('petitionnaire', |
607 |
|
|
'../scr/sousform.php?obj=petitionnaire&action=0'+ |
608 |
nhaye |
1103 |
'&retourformulaire=demande', 860, 'auto', |
609 |
nhaye |
828 |
getDemandeurId, 'petitionnaire'); |
610 |
|
|
}); |
611 |
|
|
|
612 |
vpihour |
664 |
url = document.location + "" ; |
613 |
vpihour |
1369 |
if (( |
614 |
|
|
url.indexOf("form.php?obj=demande&") != -1 || |
615 |
|
|
url.indexOf("form.php?obj=dossier&") != -1 || |
616 |
|
|
url.indexOf("form.php?obj=dossier_instruction&") != -1 |
617 |
|
|
) |
618 |
nhaye |
1094 |
&& url.indexOf("&action=3") == -1) { |
619 |
vpihour |
1098 |
|
620 |
nhaye |
1094 |
formatFieldReferenceCadastrale(); |
621 |
|
|
} |
622 |
vpihour |
1098 |
|
623 |
nhaye |
1094 |
if (url.indexOf("form.php?obj=demande&") != -1 |
624 |
nhaye |
1100 |
&& (url.indexOf("&action=3") == -1 |
625 |
vpihour |
1104 |
&& url.indexOf("&action=2") == -1 |
626 |
nhaye |
1100 |
&& $(".form-is-valid").size() == 0)) { |
627 |
vpihour |
1098 |
|
628 |
vpihour |
1099 |
addButtonCadastraleAdesse(); |
629 |
fmichon |
1005 |
changeDemandeType(); |
630 |
|
|
} |
631 |
vpihour |
1098 |
|
632 |
nhaye |
1033 |
// Ajout de demande |
633 |
nhaye |
1100 |
if ((url.indexOf("form.php?obj=demande_nouveau_dossier&") != -1 |
634 |
|
|
|| url.indexOf("form.php?obj=demande_dossier_existant&") != -1) |
635 |
nhaye |
828 |
&& url.indexOf("&action=0") != -1 ){ |
636 |
vpihour |
1098 |
|
637 |
vpihour |
793 |
/*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/ |
638 |
vpihour |
664 |
hideFields(); |
639 |
vpihour |
676 |
} |
640 |
vpihour |
1098 |
|
641 |
nhaye |
1033 |
// Ajout de demande sur dossier existant |
642 |
nhaye |
1100 |
if (url.indexOf("form.php?obj=demande_dossier_existant&") != -1 |
643 |
|
|
&& url.indexOf("&action=0") != -1 ){ |
644 |
vpihour |
1098 |
|
645 |
nhaye |
1033 |
/*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/ |
646 |
|
|
hideFields(); |
647 |
|
|
changeDemandeType(); |
648 |
|
|
} |
649 |
fmichon |
1005 |
|
650 |
nhaye |
1033 |
// Modification de demande |
651 |
vpihour |
1369 |
if ( |
652 |
|
|
( |
653 |
|
|
url.indexOf("form.php?obj=demande&") != -1 |
654 |
|
|
|| url.indexOf("form.php?obj=demande_nouveau_dossier&") != -1 |
655 |
|
|
|| url.indexOf("form.php?obj=demande_dossier_existant&") != -1 |
656 |
|
|
) |
657 |
|
|
&& url.indexOf("&action") == -1 |
658 |
|
|
){ |
659 |
|
|
|
660 |
vpihour |
812 |
formatFieldReferenceCadastrale(); |
661 |
nhaye |
1033 |
} |
662 |
vpihour |
1351 |
|
663 |
|
|
//Gestion de la commission |
664 |
|
|
$( "#tabs" ).tabs(); |
665 |
|
|
|
666 |
|
|
// Affichage du tableau des dossier_commission au clique |
667 |
|
|
$("#dossier_commission").click(function() { |
668 |
|
|
|
669 |
|
|
var params = extractUrlParams(); |
670 |
|
|
idx = params['idx']; |
671 |
|
|
|
672 |
|
|
ajaxIt( |
673 |
|
|
'dossier_commission', |
674 |
|
|
'../scr/soustab.php?obj=dossier_commission&idxformulaire='+ |
675 |
|
|
idx + |
676 |
|
|
'&retourformulaire=commission'); |
677 |
|
|
}); |
678 |
|
|
|
679 |
|
|
// Affichage du tableau des dossier_commission posssible au clique |
680 |
|
|
$('#commission_dossiers_plannifier_retirer').click( |
681 |
|
|
function(){ |
682 |
|
|
|
683 |
|
|
var params = extractUrlParams(); |
684 |
|
|
idx = params['idx']; |
685 |
|
|
|
686 |
|
|
$('#tabs-2').empty(); |
687 |
|
|
ajouterTableauDossierCommissionPossible(idx); |
688 |
|
|
} |
689 |
|
|
); |
690 |
|
|
|
691 |
|
|
//Suppression du message et des données dans le champ dossier |
692 |
|
|
$('#commission_dossiers_plannifier_numero').click( |
693 |
|
|
function(){ |
694 |
|
|
|
695 |
|
|
$('#tabs-3 .message').remove(); |
696 |
|
|
$('#tabs-3 #dossier').val(""); |
697 |
|
|
} |
698 |
|
|
); |
699 |
vpihour |
812 |
}); |
700 |
|
|
|
701 |
|
|
/* |
702 |
|
|
* Action sur les champs pour les références cadastrales |
703 |
|
|
*/ |
704 |
|
|
function formatFieldReferenceCadastrale(){ |
705 |
vpihour |
1098 |
|
706 |
vpihour |
812 |
addNewFieldReferencesCadastrales(); |
707 |
|
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
708 |
|
|
|
709 |
vpihour |
1098 |
url = document.location + ""; |
710 |
|
|
|
711 |
vpihour |
812 |
reference_cadastrale = $('#terrain_references_cadastrales').val(); |
712 |
|
|
/*Formatage de la reference cadastrale*/ |
713 |
|
|
if ( reference_cadastrale != '' ){ |
714 |
|
|
|
715 |
|
|
/* Récupère la référence cadastrale non formatée */ |
716 |
|
|
references_cadastrales = reference_cadastrale.split(';'); |
717 |
|
|
donnees = new Array(); |
718 |
|
|
|
719 |
|
|
i = 0 ; |
720 |
|
|
/* Boucle sur les références, elles étaient séparées par un ; */ |
721 |
|
|
for ( l = 0 ; l < references_cadastrales.length - 1 ; l ++ ){ |
722 |
vpihour |
664 |
|
723 |
vpihour |
812 |
/*Récupère le code impots du qartier [CHIFFRES]*/ |
724 |
|
|
k = 0; |
725 |
|
|
donnees[i] = ''; |
726 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ){ |
727 |
vpihour |
664 |
|
728 |
vpihour |
812 |
if ( references_cadastrales[l].charAt(j) >= 0 && |
729 |
|
|
references_cadastrales[l].charAt(j) <= 9 ){ |
730 |
|
|
|
731 |
|
|
donnees[i] += references_cadastrales[l].charAt(j); |
732 |
|
|
k++; |
733 |
vpihour |
793 |
|
734 |
vpihour |
812 |
} else { |
735 |
|
|
|
736 |
|
|
i++; |
737 |
|
|
break; |
738 |
|
|
} |
739 |
|
|
} |
740 |
|
|
|
741 |
|
|
/* Récupère la section [LETTRES] */ |
742 |
|
|
donnees[i] = ''; |
743 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
744 |
|
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
745 |
|
|
|
746 |
|
|
donnees[i] += references_cadastrales[l].charAt(j); |
747 |
|
|
k++; |
748 |
|
|
|
749 |
|
|
} else { |
750 |
|
|
|
751 |
|
|
i++; |
752 |
|
|
break; |
753 |
|
|
} |
754 |
|
|
|
755 |
|
|
/* Récupère la parcelle [CHIFFRES] */ |
756 |
|
|
donnees[i] = ''; |
757 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
758 |
|
|
if ( references_cadastrales[l].charAt(j) >= 0 && |
759 |
|
|
references_cadastrales[l].charAt(j) <= 9 ){ |
760 |
vpihour |
793 |
|
761 |
vpihour |
812 |
donnees[i] += references_cadastrales[l].charAt(j); |
762 |
|
|
k++; |
763 |
|
|
|
764 |
|
|
} else { |
765 |
|
|
|
766 |
|
|
break; |
767 |
vpihour |
793 |
} |
768 |
vpihour |
812 |
|
769 |
|
|
/* Récupère les séparateurs [ A / ] et les sections */ |
770 |
nhaye |
1094 |
m = 0 ; // Nombre de suffixe |
771 |
vpihour |
812 |
if ( k < references_cadastrales[l].length ){ |
772 |
vpihour |
669 |
|
773 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
774 |
|
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
775 |
vpihour |
793 |
|
776 |
vpihour |
812 |
m++; |
777 |
|
|
donnees[++i] = references_cadastrales[l].charAt(j); |
778 |
|
|
donnees[++i] = ''; |
779 |
|
|
} |
780 |
|
|
else { |
781 |
vpihour |
793 |
|
782 |
vpihour |
669 |
donnees[i] += references_cadastrales[l].charAt(j); |
783 |
vpihour |
664 |
} |
784 |
vpihour |
812 |
} |
785 |
|
|
|
786 |
|
|
/*Créé autant de champs de que de référence */ |
787 |
vpihour |
1098 |
donnees[++i] = ';'; |
788 |
vpihour |
812 |
i++; |
789 |
vpihour |
669 |
|
790 |
vpihour |
812 |
if ( l > 0 ) { |
791 |
vpihour |
793 |
|
792 |
vpihour |
812 |
$('.reference_cadastrale_custom_fields').append( |
793 |
|
|
"<br/>" + fieldReferenceCadastraleBase() |
794 |
|
|
); |
795 |
vpihour |
664 |
} |
796 |
|
|
|
797 |
vpihour |
812 |
actionFormReferenceCadastrale(); |
798 |
|
|
|
799 |
|
|
if ( m > 0 ){ |
800 |
|
|
|
801 |
|
|
for ( j = 0 ; j < m ; j++ ){ |
802 |
vpihour |
793 |
|
803 |
vpihour |
812 |
$('#moreFieldReferenceCadastrale' + |
804 |
|
|
( $('.moreFieldReferenceCadastrale').length - 1 ) ). |
805 |
|
|
before( |
806 |
|
|
newInputReferenceCadastrale() |
807 |
|
|
); |
808 |
vpihour |
664 |
} |
809 |
vpihour |
812 |
} |
810 |
vpihour |
664 |
} |
811 |
vpihour |
812 |
/* Action sur les boutons [+ ajouter d'autres champs] et [+ ajouter |
812 |
|
|
* d'autres lignes] */ |
813 |
|
|
actionLineFormReferenceCadastrale(); |
814 |
|
|
|
815 |
|
|
/* Ajoute les données dans les champs nouvellement créés */ |
816 |
|
|
$('.reference_cadastrale_custom_field').each( |
817 |
|
|
function(index) { |
818 |
|
|
|
819 |
|
|
$(this).val(donnees[index]) |
820 |
|
|
} |
821 |
|
|
); |
822 |
|
|
} |
823 |
|
|
else{ |
824 |
|
|
actionFormReferenceCadastrale(); |
825 |
|
|
actionLineFormReferenceCadastrale(); |
826 |
|
|
} |
827 |
|
|
} |
828 |
vpihour |
641 |
|
829 |
vpihour |
664 |
/* |
830 |
vpihour |
805 |
* Ajoute les icônes pour la recherche de pétitionnaire fréquent. |
831 |
|
|
*/ |
832 |
|
|
function addSearchIcon(){ |
833 |
nhaye |
848 |
|
834 |
fmichon |
1005 |
$("#form-content:not(.form-is-valid) .search_particulier_fields,"+ |
835 |
|
|
"#form-content:not(.form-is-valid) .search_personne_morale_fields").each(function() { |
836 |
vpihour |
805 |
/*Ajout de l'icône après le champs dénomination et nom de la personne morale*/ |
837 |
nhaye |
848 |
|
838 |
vpihour |
805 |
$(this). |
839 |
nhaye |
1050 |
append( |
840 |
vpihour |
805 |
'<span '+ |
841 |
nhaye |
848 |
'class="om-icon om-icon-16 om-icon-fix search-petitionnaire-16" '+ |
842 |
vpihour |
805 |
'title="Chercher un petitionnaire"> '+ |
843 |
nhaye |
848 |
'</span>'+ |
844 |
|
|
'<span '+ |
845 |
|
|
'class="om-icon om-icon-16 om-icon-fix erase-petitionnaire delete-16" '+ |
846 |
|
|
'title="Supprimer le contenu"> '+ |
847 |
vpihour |
805 |
'</span>' |
848 |
|
|
); |
849 |
|
|
} |
850 |
|
|
); |
851 |
|
|
|
852 |
vpihour |
1060 |
/*Ajout des actions sur les boutons*/ |
853 |
nhaye |
828 |
addActionSearchIcon('#sousform-petitionnaire #form-content'); |
854 |
nhaye |
848 |
addActionRemove(); |
855 |
|
|
|
856 |
vpihour |
768 |
} |
857 |
|
|
|
858 |
nhaye |
849 |
/** |
859 |
|
|
* Fonction permettant de revenir sur le formulaire d'ajout de demandeur |
860 |
|
|
**/ |
861 |
nhaye |
848 |
function addActionRemove(){ |
862 |
|
|
$('.erase-petitionnaire').click( |
863 |
|
|
function(){ |
864 |
|
|
ajaxIt('petitionnaire','../scr/sousform.php?obj=petitionnaire&action=0'); |
865 |
|
|
}); |
866 |
|
|
} |
867 |
|
|
|
868 |
vpihour |
741 |
/* |
869 |
vpihour |
805 |
* Ajoute les actions sur les icônes de recherche |
870 |
|
|
*/ |
871 |
|
|
function addActionSearchIcon(id){ |
872 |
vpihour |
741 |
|
873 |
vpihour |
793 |
/*Si on recherche un pétitionnaire de type particulier*/ |
874 |
nhaye |
848 |
$('.search-petitionnaire-16').click( |
875 |
vpihour |
741 |
function(){ |
876 |
|
|
|
877 |
vpihour |
805 |
/*Le champ nom du particulier doit contenir au moins trois lettres*/ |
878 |
nhaye |
848 |
if ( $('#particulier_nom').val().length < 3 && |
879 |
|
|
$('#particulier_prenom').val().length < 3 && |
880 |
|
|
$('#personne_morale_denomination').val().length < 3 && |
881 |
|
|
$('#personne_morale_nom').val().length < 3 ){ |
882 |
vpihour |
805 |
|
883 |
|
|
alert('Saisissez au moins trois lettres pour la recherche'); |
884 |
|
|
return; |
885 |
|
|
} |
886 |
|
|
|
887 |
vpihour |
793 |
/*Données des champs nom et prénom du particulier*/ |
888 |
nhaye |
848 |
var donnees = "?par_nom=" + $('.search_particulier_fields #particulier_nom').val() + |
889 |
|
|
"&par_prenom=" + $('.search_particulier_fields #particulier_prenom').val() + |
890 |
|
|
"&mor_denomination="+$('#personne_morale_denomination').val() + |
891 |
|
|
"&mor_nom="+$('#personne_morale_nom').val(); |
892 |
vpihour |
741 |
|
893 |
vpihour |
805 |
/* Requête qui va récupérer les données duaddSearchIcon(es) pétitionnaire(s) |
894 |
vpihour |
793 |
* correspondant(s) à la recherche */ |
895 |
vpihour |
741 |
$.ajax({ |
896 |
|
|
type: "GET", |
897 |
|
|
url: "../app/findPetitionnaire.php" + donnees , |
898 |
|
|
cache: false, |
899 |
nhaye |
848 |
success: function(obj){ |
900 |
|
|
var freq = $.parseJSON(obj); |
901 |
|
|
var res=''; |
902 |
vpihour |
793 |
/*Si la recherche a donné des résultats*/ |
903 |
nhaye |
848 |
if ( freq.length > 0 ){ |
904 |
vpihour |
805 |
/*Limitation des résultats à 50 */ |
905 |
nhaye |
848 |
if ( freq.length > 50 ){ |
906 |
vpihour |
805 |
|
907 |
|
|
nbRes = 50; |
908 |
nhaye |
848 |
res += 'Votre recherche a donné ' + freq.length |
909 |
vpihour |
805 |
+ ' résultats. Seul les cinquantes premiers ' + |
910 |
|
|
'seront affichés.<br/>'; |
911 |
nhaye |
848 |
} else { |
912 |
|
|
nbRes = freq.length; |
913 |
vpihour |
805 |
} |
914 |
|
|
|
915 |
|
|
res += '<select>' ; |
916 |
|
|
|
917 |
vpihour |
793 |
/* Met les résultats de la recherche dans un select */ |
918 |
nhaye |
848 |
for ( i = 0 ; i < nbRes ; i++ ){ |
919 |
|
|
res += '<option value="' + freq[i].value + '">' + |
920 |
|
|
freq[i].content + |
921 |
vpihour |
793 |
'</option>'; |
922 |
vpihour |
741 |
} |
923 |
|
|
|
924 |
nhaye |
848 |
res += '</select>'; |
925 |
|
|
} else { |
926 |
|
|
res += 'Aucune correspondance trouvée.'; |
927 |
vpihour |
741 |
} |
928 |
|
|
|
929 |
vpihour |
793 |
/* Affichage de l'overlay */ |
930 |
vpihour |
741 |
$('#dialog').html(res); |
931 |
|
|
|
932 |
|
|
$( "#dialog" ).dialog({ |
933 |
|
|
modal: true, |
934 |
|
|
buttons : { |
935 |
|
|
Valider: function(){ |
936 |
nhaye |
848 |
if ( res != 'Auncune correspondance trouvée.'){ |
937 |
vpihour |
805 |
|
938 |
vpihour |
756 |
} |
939 |
nhaye |
848 |
var id = $('#dialog select option:selected').val(); |
940 |
fmichon |
1005 |
if($.isNumeric(id)) { |
941 |
|
|
ajaxIt('petitionnaire', |
942 |
|
|
'../scr/sousform.php?obj=petitionnaire&action=1&retourformulaire=demande&idx='+id); |
943 |
|
|
} |
944 |
nhaye |
848 |
// Fermeture de l'overlay |
945 |
fmichon |
1005 |
$(this).dialog( "close" ).empty(); |
946 |
vpihour |
741 |
} |
947 |
|
|
} |
948 |
|
|
}); |
949 |
|
|
}, |
950 |
|
|
}); |
951 |
|
|
} |
952 |
|
|
); |
953 |
|
|
} |
954 |
|
|
|
955 |
|
|
/* |
956 |
vpihour |
805 |
* Ajoute un div pour l'overlay dialog de jQuery |
957 |
|
|
*/ |
958 |
|
|
function addDivDialog(id){ |
959 |
|
|
|
960 |
|
|
$(id).prepend('<div id="dialog"></div>'); |
961 |
|
|
} |
962 |
|
|
|
963 |
|
|
/* |
964 |
|
|
Action au changement du select de la qualite du demandeur |
965 |
|
|
* */ |
966 |
|
|
function changeDemandeurType(id){ |
967 |
|
|
|
968 |
vpihour |
1060 |
/*Réinitialise les champs et cache les champs inutiles selon la qualité du demandeur*/ |
969 |
vpihour |
805 |
/*Si la qualite du demandeur est particulier */ |
970 |
nhaye |
1118 |
if ( $('#' + id ).val() == 'particulier' ){ |
971 |
vpihour |
805 |
|
972 |
|
|
$('.personne_morale_fields input').each( |
973 |
|
|
function(){ |
974 |
|
|
$(this).val(''); |
975 |
|
|
} |
976 |
|
|
); |
977 |
|
|
$('.personne_morale_fields select option[value=""]').each( |
978 |
|
|
function(){ |
979 |
|
|
$(this).attr('selected', 'selected'); |
980 |
|
|
} |
981 |
|
|
); |
982 |
|
|
|
983 |
|
|
$('.personne_morale_fields').hide(); |
984 |
|
|
$('.particulier_fields').show(); |
985 |
|
|
} |
986 |
vpihour |
1060 |
/*Si c'est une personne morale*/ |
987 |
vpihour |
805 |
else { |
988 |
|
|
|
989 |
|
|
$('.particulier_fields input').each( |
990 |
|
|
function(){ |
991 |
|
|
$(this).val(''); |
992 |
|
|
} |
993 |
|
|
); |
994 |
|
|
$('.particulier_fields select option[value=""]').each( |
995 |
|
|
function(){ |
996 |
|
|
$(this).attr('selected', 'selected'); |
997 |
|
|
} |
998 |
|
|
); |
999 |
|
|
|
1000 |
|
|
$('.particulier_fields').hide(); |
1001 |
|
|
$('.personne_morale_fields').show(); |
1002 |
|
|
} |
1003 |
|
|
} |
1004 |
|
|
|
1005 |
|
|
/* |
1006 |
vpihour |
1060 |
Fonction de test des champs |
1007 |
vpihour |
676 |
* */ |
1008 |
vpihour |
669 |
function isAlpha(str) { |
1009 |
vpihour |
664 |
return /^[a-zA-Z\/]+$/.test(str); |
1010 |
|
|
} |
1011 |
|
|
|
1012 |
vpihour |
768 |
function isMail(str){ |
1013 |
|
|
return /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(str); |
1014 |
|
|
} |
1015 |
|
|
|
1016 |
|
|
function isPhoneNumber(str){ |
1017 |
|
|
return /[0-9-()+]{3,20}/.test(str); |
1018 |
|
|
} |
1019 |
|
|
|
1020 |
vpihour |
793 |
function testSeparator(obj){ |
1021 |
|
|
|
1022 |
|
|
if ( obj.value != 'A' && |
1023 |
|
|
obj.value != '/' ) { |
1024 |
|
|
|
1025 |
|
|
alert('Saisissez uniquement un A ou un / comme séparateur'); |
1026 |
|
|
obj.value = ''; |
1027 |
|
|
} |
1028 |
|
|
} |
1029 |
vpihour |
1060 |
/* Fin fonction test */ |
1030 |
vpihour |
793 |
|
1031 |
vpihour |
664 |
/* |
1032 |
vpihour |
1060 |
* Ajoute les ations spécifiques pour le formulaire personnalisé d'ajout de |
1033 |
|
|
* référence cadastrale |
1034 |
|
|
*/ |
1035 |
vpihour |
664 |
function actionFormReferenceCadastrale(){ |
1036 |
vpihour |
1098 |
|
1037 |
vpihour |
664 |
$('form').submit( |
1038 |
|
|
function(){ |
1039 |
|
|
|
1040 |
vpihour |
812 |
getDataFieldReferenceCadastrale(); |
1041 |
vpihour |
664 |
} |
1042 |
|
|
); |
1043 |
nhaye |
1094 |
if( $("form[name=f1] .form-is-valid").size() == 0) { |
1044 |
vpihour |
1326 |
|
1045 |
nhaye |
1094 |
$('#moreFieldReferenceCadastrale' + |
1046 |
|
|
($('.moreFieldReferenceCadastrale').length - 1 )). |
1047 |
|
|
on("click", function() { |
1048 |
vpihour |
1098 |
|
1049 |
nhaye |
1094 |
$(this).before(newInputReferenceCadastrale()); |
1050 |
|
|
}); |
1051 |
|
|
} |
1052 |
vpihour |
762 |
|
1053 |
vpihour |
664 |
} |
1054 |
|
|
|
1055 |
vpihour |
670 |
/* |
1056 |
vpihour |
812 |
* Récupère les données saisies dans les champs de références cadastrales |
1057 |
|
|
*/ |
1058 |
|
|
function getDataFieldReferenceCadastrale(){ |
1059 |
|
|
|
1060 |
|
|
var reference_cadastrale = ''; |
1061 |
|
|
var reference_cadastrale_temp = ''; |
1062 |
|
|
|
1063 |
vpihour |
1060 |
/*Pour chacun des champs du formulaire de saisie de référence cadastrale*/ |
1064 |
vpihour |
812 |
$('.reference_cadastrale_custom_field').each( |
1065 |
|
|
function(){ |
1066 |
|
|
|
1067 |
vpihour |
1060 |
/*Si on est à la fin d'une ligne de champs*/ |
1068 |
vpihour |
812 |
if ( $(this).val() == ';' ){ |
1069 |
|
|
|
1070 |
|
|
reference_cadastrale_bis = reference_cadastrale_temp ; |
1071 |
|
|
|
1072 |
vpihour |
1060 |
/* Vérifie que les données sont correctement formatées avant de |
1073 |
|
|
* les ajouter au résultat*/ |
1074 |
vpihour |
812 |
while( reference_cadastrale_bis != ''){ |
1075 |
|
|
if ( /^([0-9]{1,4}[a-zA-Z]{1,3}[0-9]{1,5}([A\/]{1}[0-9]{1,4})*)*$/.test(reference_cadastrale_bis) ){ |
1076 |
|
|
|
1077 |
|
|
reference_cadastrale += reference_cadastrale_bis + ";"; |
1078 |
|
|
break; |
1079 |
|
|
} |
1080 |
|
|
else{ |
1081 |
|
|
|
1082 |
|
|
reference_cadastrale_bis = reference_cadastrale_bis.slice( 0, -1); |
1083 |
|
|
} |
1084 |
|
|
} |
1085 |
|
|
|
1086 |
|
|
reference_cadastrale_temp = ''; |
1087 |
|
|
} |
1088 |
|
|
|
1089 |
|
|
else { |
1090 |
|
|
|
1091 |
vpihour |
1060 |
/*Sinon, on récupère la valeur du champ*/ |
1092 |
vpihour |
812 |
reference_cadastrale_temp += $(this).val(); |
1093 |
|
|
} |
1094 |
|
|
} |
1095 |
|
|
); |
1096 |
vpihour |
1098 |
|
1097 |
vpihour |
1060 |
/*Met la valeur du résultat dans le champs généré par le framework*/ |
1098 |
vpihour |
812 |
$('#terrain_references_cadastrales').val(reference_cadastrale); |
1099 |
|
|
} |
1100 |
|
|
|
1101 |
|
|
/* |
1102 |
vpihour |
1060 |
Action pour l'ajout de nouvelle ligne dans le formulaire d'ajout |
1103 |
|
|
de référence cadastrale |
1104 |
vpihour |
670 |
* */ |
1105 |
vpihour |
669 |
function actionLineFormReferenceCadastrale(){ |
1106 |
nhaye |
1094 |
if( $("form[name=f1] .form-is-valid").size() == 0) { |
1107 |
|
|
|
1108 |
|
|
$('#morelineReferenceCadastrale').click( |
1109 |
|
|
function(){ |
1110 |
|
|
|
1111 |
|
|
/*Ajout des trois champs de base*/ |
1112 |
|
|
$('.reference_cadastrale_custom_fields'). |
1113 |
|
|
append( "<br/>" + fieldReferenceCadastraleBase()); |
1114 |
vpihour |
1098 |
|
1115 |
nhaye |
1094 |
/*Ajout du bind pour l'ajout de nouveaux champs*/ |
1116 |
|
|
$('#moreFieldReferenceCadastrale'+ |
1117 |
|
|
($('.moreFieldReferenceCadastrale').length - 1 )). |
1118 |
|
|
on("click", function() { |
1119 |
|
|
$(this).before(newInputReferenceCadastrale()); |
1120 |
|
|
}); |
1121 |
|
|
} |
1122 |
|
|
); |
1123 |
|
|
} |
1124 |
vpihour |
669 |
} |
1125 |
|
|
|
1126 |
vpihour |
664 |
/* |
1127 |
vpihour |
793 |
Met à jour le select demande_type dès qu'un |
1128 |
|
|
dossier_autorisation_type_detaille est choisi |
1129 |
vpihour |
664 |
* */ |
1130 |
vpihour |
641 |
function changeDemandeType(){ |
1131 |
vpihour |
1104 |
|
1132 |
vpihour |
793 |
var idDossierAutorisationTypeDetaille = |
1133 |
nhaye |
1053 |
$("#dossier_autorisation_type_detaille").val(); |
1134 |
vpihour |
1098 |
|
1135 |
vpihour |
812 |
/* Récupère les données saisies dans les champs pour la référence cadastrale */ |
1136 |
nhaye |
1039 |
getDataFieldReferenceCadastrale(); |
1137 |
vpihour |
812 |
|
1138 |
vpihour |
1060 |
/*Si l'identifiant fourni est correct*/ |
1139 |
vpihour |
641 |
if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){ |
1140 |
|
|
|
1141 |
vpihour |
1060 |
/*Met à jour le select de demande_type avec les données correspondant*/ |
1142 |
nhaye |
1333 |
changeDemandeTypeDataSelect(); |
1143 |
nhaye |
1090 |
if ( $('#demande_type option').size() < 2 ) { |
1144 |
vpihour |
664 |
showFormsDemande(); |
1145 |
nhaye |
1090 |
} |
1146 |
vpihour |
1060 |
|
1147 |
|
|
/*Affiche le select*/ |
1148 |
vpihour |
641 |
$('#demande_type').parent().parent().show(); |
1149 |
nhaye |
1090 |
if($('#demande_type').val() == '' ) { |
1150 |
|
|
$('.demande_hidden_bloc').each( |
1151 |
|
|
function(){ |
1152 |
|
|
$(this).hide(); |
1153 |
|
|
} |
1154 |
|
|
); |
1155 |
|
|
$('input[type=submit]').hide(); |
1156 |
|
|
} |
1157 |
vpihour |
641 |
} |
1158 |
|
|
else { |
1159 |
vpihour |
1060 |
|
1160 |
|
|
/*Sinon, cache tous les champs du formulaire*/ |
1161 |
vpihour |
641 |
hideFields(); |
1162 |
|
|
} |
1163 |
|
|
} |
1164 |
|
|
|
1165 |
vpihour |
664 |
/* |
1166 |
|
|
Ajoute le code HTML des champs pour les références cadastrales |
1167 |
|
|
* */ |
1168 |
|
|
function addNewFieldReferencesCadastrales(){ |
1169 |
vpihour |
1098 |
|
1170 |
nhaye |
1033 |
var html = '<div class="field field-type-text references_cadastrales_new_field" >'+ |
1171 |
vpihour |
664 |
'<div class="form-libelle">' + |
1172 |
|
|
'<label '+ |
1173 |
|
|
'class="libelle-terrain_references_cadastrales" '+ |
1174 |
|
|
'for="terrain_references_cadastrales">'+ |
1175 |
|
|
' terrain_references_cadastrales '+ |
1176 |
|
|
'</label>' + |
1177 |
|
|
'</div>' + |
1178 |
|
|
'<div class="form-content reference_cadastrale_custom_fields">' + |
1179 |
vpihour |
669 |
fieldReferenceCadastraleBase() + |
1180 |
vpihour |
664 |
'</div>' + |
1181 |
nhaye |
1033 |
'</div>'; |
1182 |
vpihour |
1098 |
|
1183 |
|
|
url = document.location + ""; |
1184 |
vpihour |
1369 |
if((getDemandeInfo('nature') == 'NOUV' || getDemandeInfo('nature') == 'NONE' ) && $(".form-is-valid").size() == 0 && url.indexOf('action=3') == -1 ) { |
1185 |
vpihour |
1060 |
html += '<div class="field field-type-text" id="morelineReferenceCadastrale">' + |
1186 |
|
|
'<div class="form-libelle"></div>' + |
1187 |
|
|
'<div class="form-content">' + |
1188 |
|
|
'<span class="om-form-button add-16" title="Ajouter">ajouter d\'autres lignes</span>' + |
1189 |
|
|
'</div>' + |
1190 |
|
|
'</div>'; |
1191 |
|
|
} |
1192 |
nhaye |
1033 |
|
1193 |
|
|
$('.references_cadastrales_new_field').remove(); |
1194 |
|
|
$('.moreFieldReferenceCadastrale').remove(); |
1195 |
|
|
$('#morelineReferenceCadastrale').remove(); |
1196 |
vpihour |
1369 |
$('#terrain_references_cadastrales').parent().parent().before( |
1197 |
|
|
html |
1198 |
|
|
); |
1199 |
vpihour |
664 |
} |
1200 |
|
|
|
1201 |
vpihour |
1099 |
function addButtonCadastraleAdesse(){ |
1202 |
|
|
|
1203 |
|
|
$('#terrain_superficie').parent().parent().after('<div class="field field-type-text" >' + |
1204 |
|
|
'<div class="form-libelle"></div>' + |
1205 |
|
|
'<div class="form-content buttonCadAdr">' + |
1206 |
|
|
'<input id="cad-adr-them" class="ui-button ui-widget ui-state-default ui-corner-all" type="button" value="Cadastrale < = > Adresse"/>' + |
1207 |
|
|
'</div>' + |
1208 |
|
|
'</div>' ); |
1209 |
|
|
} |
1210 |
|
|
|
1211 |
vpihour |
670 |
/* |
1212 |
vpihour |
1060 |
Séparateur caché ; pour marqué la fin d'une ligne de référence cadastrale |
1213 |
vpihour |
670 |
* */ |
1214 |
vpihour |
669 |
function hiddenSeparatorField(){ |
1215 |
vpihour |
1098 |
|
1216 |
vpihour |
669 |
return '<input ' + |
1217 |
vpihour |
1098 |
'class="reference_cadastrale_custom_field" ' + |
1218 |
vpihour |
669 |
'type="hidden" ' + |
1219 |
|
|
'maxlength="2" ' + |
1220 |
|
|
'size="2" ' + |
1221 |
|
|
'value=";" />'; |
1222 |
|
|
} |
1223 |
|
|
|
1224 |
fmichon |
1005 |
/** |
1225 |
nhaye |
1039 |
* Retourne l'info passée en paramètre (nature de la demande ou type de la demande) |
1226 |
fmichon |
1005 |
**/ |
1227 |
nhaye |
1039 |
function getDemandeInfo(info) { |
1228 |
fmichon |
1005 |
var id_demande_type = $('#demande_type').val(); |
1229 |
nhaye |
1018 |
var res = ""; |
1230 |
vpihour |
1369 |
if ( typeof id_demande_type !== "undefined" ){ |
1231 |
|
|
$.ajax({ |
1232 |
|
|
type: "GET", |
1233 |
|
|
url: "../app/getDemandeInfo.php?iddemandetype=" + id_demande_type |
1234 |
|
|
+ "&info=" + info, |
1235 |
|
|
cache: false, |
1236 |
|
|
async: false, |
1237 |
|
|
success: function(val){ |
1238 |
|
|
res = val; |
1239 |
|
|
} |
1240 |
|
|
}); |
1241 |
|
|
} |
1242 |
|
|
else { |
1243 |
|
|
|
1244 |
|
|
res = "NONE" |
1245 |
|
|
} |
1246 |
nhaye |
1018 |
return res; |
1247 |
fmichon |
1005 |
} |
1248 |
vpihour |
670 |
/* |
1249 |
vpihour |
1060 |
Ajout d'une nouvelle ligne de champ de référence cadastrale |
1250 |
|
|
Retourne le code HTML |
1251 |
vpihour |
670 |
* */ |
1252 |
vpihour |
669 |
function fieldReferenceCadastraleBase(){ |
1253 |
vpihour |
1098 |
|
1254 |
vpihour |
1099 |
url = document.location + ""; |
1255 |
|
|
|
1256 |
nhaye |
1039 |
var type = getDemandeInfo('nature'); |
1257 |
fmichon |
1005 |
var reference_cadastrale = '<input ' + |
1258 |
vpihour |
669 |
'class="champFormulaire reference_cadastrale_custom_field" ' + |
1259 |
|
|
'type="text" ' + |
1260 |
|
|
'onchange="VerifNum(this)" ' + |
1261 |
vpihour |
762 |
'maxlength="4" ' + |
1262 |
vpihour |
1120 |
'size="4" '+ |
1263 |
|
|
'placeholder="Quart." '; |
1264 |
vpihour |
1060 |
|
1265 |
fmichon |
1005 |
// désactivation des champs de référence cadastrale |
1266 |
vpihour |
1369 |
if( (type != 'NOUV' && type != 'NONE') || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) { |
1267 |
fmichon |
1005 |
reference_cadastrale += 'disabled="disabled" '; |
1268 |
|
|
} |
1269 |
vpihour |
1060 |
|
1270 |
fmichon |
1005 |
reference_cadastrale += 'value="" />'; |
1271 |
|
|
|
1272 |
|
|
reference_cadastrale += '<input ' + |
1273 |
vpihour |
669 |
'class="champFormulaire reference_cadastrale_custom_field" ' + |
1274 |
|
|
'type="text" ' + |
1275 |
vpihour |
762 |
'maxlength="3" ' + |
1276 |
vpihour |
1120 |
'size="3" '+ |
1277 |
|
|
'placeholder="Sect." '; |
1278 |
vpihour |
1060 |
|
1279 |
|
|
// désactivation des champs de référence cadastrale |
1280 |
vpihour |
1369 |
if((type != 'NOUV'&& type != 'NONE') || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) { |
1281 |
fmichon |
1005 |
reference_cadastrale += 'disabled="disabled" '; |
1282 |
|
|
} |
1283 |
vpihour |
1060 |
|
1284 |
fmichon |
1005 |
reference_cadastrale += 'value="" '+ |
1285 |
|
|
'onchange="if ( !isAlpha(this.value) ){ alert(\'Vous ne devez saisir que des lettres dans ce champs.\'); this.value = \'\'; }"/>'; |
1286 |
|
|
reference_cadastrale += '<input ' + |
1287 |
vpihour |
669 |
'class="champFormulaire reference_cadastrale_custom_field" ' + |
1288 |
|
|
'type="text" ' + |
1289 |
|
|
'onchange="VerifNum(this)" ' + |
1290 |
vpihour |
762 |
'maxlength="5" ' + |
1291 |
vpihour |
1120 |
'size="5" '+ |
1292 |
|
|
'placeholder="Parc." '; |
1293 |
vpihour |
1060 |
|
1294 |
|
|
// désactivation des champs de référence cadastrale |
1295 |
vpihour |
1369 |
if((type != 'NOUV'&& type != 'NONE') || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) { |
1296 |
fmichon |
1005 |
reference_cadastrale += 'disabled="disabled" '; |
1297 |
|
|
} |
1298 |
vpihour |
1060 |
|
1299 |
fmichon |
1005 |
reference_cadastrale += 'value="" />'; |
1300 |
nhaye |
1094 |
|
1301 |
|
|
reference_cadastrale += '<span id="moreFieldReferenceCadastrale' + |
1302 |
fmichon |
1005 |
$('.moreFieldReferenceCadastrale').length + |
1303 |
vpihour |
1098 |
'" class="moreFieldReferenceCadastrale">' + hiddenSeparatorField(); |
1304 |
nhaye |
1094 |
|
1305 |
|
|
// Si form validé pas de bouton |
1306 |
vpihour |
1098 |
url = document.location + ""; |
1307 |
vpihour |
1369 |
if( (type == 'NOUV' || type == 'NONE') && $("form[name=f1] .form-is-valid").size() == 0 && url.indexOf('action=3') == -1 ) { |
1308 |
nhaye |
1094 |
|
1309 |
vpihour |
1098 |
reference_cadastrale += |
1310 |
nhaye |
1094 |
'<span class="om-form-button add-16" title="Ajouter">ajouter d\'autres champs</span>'; |
1311 |
fmichon |
1005 |
} |
1312 |
nhaye |
1094 |
|
1313 |
|
|
reference_cadastrale += '</span>'; |
1314 |
fmichon |
1005 |
|
1315 |
|
|
return reference_cadastrale; |
1316 |
vpihour |
669 |
} |
1317 |
|
|
|
1318 |
nhaye |
802 |
/** |
1319 |
vpihour |
1060 |
* Cache les champs inutules [formulaire de demande] |
1320 |
nhaye |
802 |
**/ |
1321 |
vpihour |
641 |
function hideFields(){ |
1322 |
nhaye |
802 |
$('.demande_hidden_bloc').each( |
1323 |
vpihour |
641 |
function(){ |
1324 |
nhaye |
802 |
$(this).hide(); |
1325 |
vpihour |
641 |
} |
1326 |
|
|
); |
1327 |
|
|
|
1328 |
|
|
$('.field-type-text').hide(); |
1329 |
|
|
$('input[type=submit]').hide(); |
1330 |
|
|
$('#demande_type').parent().parent().hide(); |
1331 |
|
|
} |
1332 |
|
|
|
1333 |
vpihour |
664 |
/* |
1334 |
vpihour |
1060 |
Affiche les champs dont on a besoin dans le formulaire de demande |
1335 |
vpihour |
664 |
* */ |
1336 |
vpihour |
641 |
function showFormsDemande(){ |
1337 |
vpihour |
1098 |
|
1338 |
|
|
|
1339 |
nhaye |
1090 |
if($('#demande_type').val() != "") { |
1340 |
nhaye |
1039 |
|
1341 |
nhaye |
1090 |
$('.demande_hidden_bloc').each( |
1342 |
|
|
function(){ |
1343 |
|
|
$(this).show(); |
1344 |
|
|
} |
1345 |
|
|
); |
1346 |
vpihour |
1326 |
formatFieldReferenceCadastrale(1); |
1347 |
nhaye |
1090 |
$('.field-type-text').show(); |
1348 |
|
|
$('input[type=submit]').show(); |
1349 |
|
|
$('.terrain_references_cadastrales_custom').hide(); |
1350 |
|
|
|
1351 |
|
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
1352 |
nhaye |
1062 |
|
1353 |
nhaye |
1090 |
// Si le type de la demande est un transfert on efface la liste des demandeurs |
1354 |
|
|
if(getDemandeInfo('type') == 'DT') { |
1355 |
|
|
if($('input[name=petitionnaire_principal]').size() != -1) { |
1356 |
|
|
removeDemandeur("petitionnaire_principal_" + $('input[name=petitionnaire_principal]').val()); |
1357 |
|
|
} |
1358 |
|
|
if($('input[name=delegataire]').size() != -1) { |
1359 |
|
|
removeDemandeur("delegataire_" + $('input[name=delegataire]').val()); |
1360 |
|
|
} |
1361 |
nhaye |
1062 |
|
1362 |
nhaye |
1090 |
$('#listePetitionnaires input.demandeur_id').each(function(){ |
1363 |
|
|
if($(this).size() != -1) { |
1364 |
|
|
|
1365 |
|
|
removeDemandeur("petitionnaire_" + $(this).val()); |
1366 |
|
|
} |
1367 |
|
|
}); |
1368 |
nhaye |
1097 |
} else if ( getDemandeInfo('type') == 'DM' ) { |
1369 |
|
|
$.ajax({ |
1370 |
|
|
type: "GET", |
1371 |
|
|
url: "../app/getDemandeurList.php?dossier_autorisation=" + $('#dossier_autorisation').val(), |
1372 |
|
|
cache: false, |
1373 |
|
|
async: false, |
1374 |
|
|
success: function(html){ |
1375 |
|
|
$('#liste_demandeur').replaceWith(html); |
1376 |
|
|
} |
1377 |
|
|
}); |
1378 |
nhaye |
1090 |
} |
1379 |
nhaye |
1097 |
affichageBoutonsDemandeurs(); |
1380 |
nhaye |
1090 |
} else { |
1381 |
vpihour |
1098 |
|
1382 |
|
|
/*Récupère les references cadastrales*/ |
1383 |
|
|
getDataFieldReferenceCadastrale(); |
1384 |
|
|
|
1385 |
nhaye |
1090 |
$('.demande_hidden_bloc').each( |
1386 |
|
|
function(){ |
1387 |
|
|
$(this).hide(); |
1388 |
nhaye |
1039 |
} |
1389 |
nhaye |
1090 |
); |
1390 |
|
|
$('input[type=submit]').hide(); |
1391 |
|
|
|
1392 |
nhaye |
1039 |
} |
1393 |
vpihour |
641 |
} |
1394 |
vpihour |
651 |
|
1395 |
vpihour |
664 |
/* |
1396 |
|
|
Action au clique sur le bouton " + ajouter d'autres champs" |
1397 |
|
|
* */ |
1398 |
vpihour |
651 |
function newInputReferenceCadastrale(){ |
1399 |
vpihour |
1359 |
|
1400 |
|
|
// Champs désactivé si le formulaire a été validé et est valide |
1401 |
|
|
var type = getDemandeInfo('nature'); |
1402 |
|
|
var reference_cadastrale_disabled = ''; |
1403 |
vpihour |
1369 |
if((type != 'NOUV'&& type != 'NONE') || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) { |
1404 |
vpihour |
1359 |
reference_cadastrale_disabled = 'disabled="disabled" '; |
1405 |
|
|
} |
1406 |
|
|
|
1407 |
vpihour |
651 |
return '<input ' + |
1408 |
|
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
1409 |
|
|
'type="text" ' + |
1410 |
|
|
'maxlength="1" ' + |
1411 |
vpihour |
1326 |
'size="3" ' + |
1412 |
vpihour |
741 |
'value="" ' + |
1413 |
vpihour |
1120 |
'placeholder="Sep." ' + |
1414 |
vpihour |
1359 |
reference_cadastrale_disabled + |
1415 |
vpihour |
741 |
'onchange="testSeparator(this);"/>' + |
1416 |
vpihour |
651 |
'<input ' + |
1417 |
|
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
1418 |
|
|
'type="text" ' + |
1419 |
|
|
'onchange="VerifNum(this)" ' + |
1420 |
|
|
'maxlength="4" ' + |
1421 |
|
|
'size="4" ' + |
1422 |
vpihour |
1120 |
'placeholder="Parc." ' + |
1423 |
vpihour |
1359 |
reference_cadastrale_disabled + |
1424 |
vpihour |
651 |
'value="" />'; |
1425 |
|
|
} |
1426 |
fmichon |
660 |
|
1427 |
vpihour |
741 |
|
1428 |
|
|
|
1429 |
fmichon |
784 |
/** |
1430 |
|
|
* Desactivation des fonctions widget du tableau de bord inutiles sur le nouveau |
1431 |
|
|
* tableau de bord |
1432 |
|
|
*/ |
1433 |
fmichon |
660 |
function widget_bind_move_actions() {} |
1434 |
|
|
function widget_bind_add_action() {} |
1435 |
|
|
function widget_bind_edit_actions(widget_selector) {} |
1436 |
|
|
|
1437 |
nhaye |
848 |
// Cette fonction permet d'associer a un arbre html les fonctions jquery |
1438 |
|
|
// necessaires. Elle permet notamment lors du chargement d'une page en ajax |
1439 |
|
|
// d'associer le comportement du bouton, la gestion du calendrier et la gestion |
1440 |
|
|
// du fieldset. |
1441 |
|
|
function om_initialize_content() { |
1442 |
|
|
// Gestion du skin des boutons, liens |
1443 |
|
|
link_bind_button(); |
1444 |
|
|
// Gestion du calendrier avec le widget datepicker de jqueryui |
1445 |
|
|
inputdate_bind_datepicker(); |
1446 |
|
|
// Gestion des fieldset avec le plugin collaspsible de jquery |
1447 |
|
|
fieldset_bind_collapsible(); |
1448 |
fmichon |
1357 |
// Gestion du picker color avec le plugin minicolors |
1449 |
|
|
bind_form_field_rvb(); |
1450 |
|
|
// Gestion du widget aide à la saisie localisation avec le plugin draggable |
1451 |
|
|
// de jqueryui |
1452 |
|
|
localisation_bind_draggable(); |
1453 |
|
|
// Gestion de la redimension automatique des textarea |
1454 |
|
|
textarea_autoresize(); |
1455 |
|
|
|
1456 |
nhaye |
848 |
|
1457 |
|
|
changeDemandeurType('qualite'); |
1458 |
|
|
addSearchIcon(); |
1459 |
|
|
addDivDialog('.bloc_demandeur'); |
1460 |
fmichon |
1005 |
|
1461 |
vpihour |
881 |
} |
1462 |
|
|
|
1463 |
vpihour |
1242 |
// Retourne la valeur d'une variable GET de l'URL |
1464 |
|
|
function getQuerystring(key, default_) |
1465 |
|
|
{ |
1466 |
|
|
if (default_==null) default_=""; |
1467 |
|
|
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); |
1468 |
|
|
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)"); |
1469 |
|
|
var qs = regex.exec(window.location.href); |
1470 |
|
|
if(qs == null) |
1471 |
|
|
return default_; |
1472 |
|
|
else |
1473 |
|
|
return qs[1]; |
1474 |
|
|
} |
1475 |
|
|
|
1476 |
nhaye |
1270 |
// Récupère l'id de l'enregistrement lié au lot passé en parametre puis appel popupit |
1477 |
|
|
function overlayCerfa(idLot) { |
1478 |
|
|
$.get("../app/displayLotCerfa.php?lot="+idLot, function(data) { |
1479 |
|
|
if(data != '') { |
1480 |
|
|
popupIt('donnees_techniques', |
1481 |
|
|
'../scr/sousform.php?obj=donnees_techniques&idx='+data+ |
1482 |
|
|
'&retourformulaire=lot&maj=1&idxformulaire='+idLot, |
1483 |
|
|
950, 700); |
1484 |
|
|
|
1485 |
|
|
} else { |
1486 |
nhaye |
1271 |
// Si pas d'id retourner on créer un nouvel enregistrement de donnéees techniques |
1487 |
nhaye |
1270 |
popupIt('donnees_techniques', |
1488 |
|
|
'../scr/sousform.php?obj=donnees_techniques&retourformulaire=lot&maj=0&idxformulaire='+idLot, |
1489 |
|
|
950, 700); |
1490 |
|
|
} |
1491 |
|
|
|
1492 |
|
|
}); |
1493 |
|
|
} |
1494 |
|
|
|
1495 |
vpihour |
881 |
/* |
1496 |
|
|
* Marque comme lu une consultation |
1497 |
|
|
*/ |
1498 |
vpihour |
1242 |
function portletUpdateData(id, objet, objetc, file, field, message){ |
1499 |
vpihour |
881 |
|
1500 |
vpihour |
900 |
/*Vérifie que l'identifiant passé en paramètre est bien un chiffre |
1501 |
|
|
* et que le type d'objet est défini |
1502 |
|
|
* */ |
1503 |
|
|
if ( $.isNumeric(id) && objet != '' ){ |
1504 |
vpihour |
881 |
|
1505 |
vpihour |
1242 |
donnees = "?ido=" + id + '&obj=' + objet + '&objk=' + objetc + '&idxDossier=' + getQuerystring('idx'); |
1506 |
vpihour |
881 |
$.ajax({ |
1507 |
|
|
type: "GET", |
1508 |
vpihour |
1242 |
url: "../app/"+file+".php" + donnees , |
1509 |
vpihour |
881 |
cache: false, |
1510 |
|
|
success: function(html){ |
1511 |
|
|
|
1512 |
vpihour |
900 |
$('#sousform-' + objet + ' .message').remove(); |
1513 |
vpihour |
892 |
/*Change la valeur affiché et affiche un message valide*/ |
1514 |
vpihour |
1242 |
if ( $.parseJSON(html) == "Mise a jour effectue avec succes" || |
1515 |
vpihour |
1245 |
$.parseJSON(html).indexOf("Transfert effectue avec succes") != -1 ){ |
1516 |
vpihour |
881 |
|
1517 |
vpihour |
1242 |
// On modife le champ field |
1518 |
vpihour |
1245 |
if ( field != '' && message != '' ){ |
1519 |
vpihour |
1242 |
$('#'+field).html(message); |
1520 |
vpihour |
1245 |
html = $.parseJSON(html); |
1521 |
vpihour |
1242 |
} |
1522 |
vpihour |
1245 |
else { |
1523 |
|
|
html = $.parseJSON(html).split(';'); |
1524 |
|
|
|
1525 |
|
|
$('#'+field).html(html[0]); |
1526 |
|
|
|
1527 |
|
|
html = html[1]; |
1528 |
|
|
} |
1529 |
vpihour |
1242 |
|
1530 |
fmichon |
938 |
// On supprime l'action |
1531 |
vpihour |
1242 |
$('span.'+field+'-16').parent().parent().remove(); |
1532 |
fmichon |
938 |
// On affiche le message |
1533 |
vpihour |
900 |
$('#sousform-' + objet + ' .subtitle').after( |
1534 |
vpihour |
892 |
'<div ' + |
1535 |
|
|
'class="message ui-widget ui-corner-all ui-state-highlight ui-state-valid">' + |
1536 |
|
|
'<p>' + |
1537 |
|
|
'<span class="ui-icon ui-icon-info"></span>' + |
1538 |
|
|
'<span class="text">' + |
1539 |
vpihour |
1245 |
html + |
1540 |
vpihour |
892 |
'</span>' + |
1541 |
|
|
'</p>' + |
1542 |
|
|
'</div>' |
1543 |
|
|
); |
1544 |
vpihour |
881 |
} |
1545 |
vpihour |
892 |
/*Affichage d'une erreur*/ |
1546 |
|
|
else{ |
1547 |
vpihour |
900 |
$('#sousform-' + objet + ' .subtitle').after( |
1548 |
vpihour |
892 |
'<div ' + |
1549 |
|
|
'class="message ui-widget ui-corner-all ui-state-highlight ui-state-error">' + |
1550 |
|
|
'<p>' + |
1551 |
|
|
'<span class="ui-icon ui-icon-info"></span>' + |
1552 |
|
|
'<span class="text">' + |
1553 |
|
|
$.parseJSON(html) + |
1554 |
|
|
'</span>' + |
1555 |
|
|
'</p>' + |
1556 |
|
|
'</div>' |
1557 |
|
|
); |
1558 |
|
|
} |
1559 |
vpihour |
881 |
} |
1560 |
|
|
}); |
1561 |
|
|
} |
1562 |
|
|
} |
1563 |
vpihour |
1218 |
|
1564 |
|
|
// Affiche le sous formulaire onglet |
1565 |
vpihour |
1351 |
function redirectPortletAction(id, onglet, nom_tabs){ |
1566 |
vpihour |
1218 |
|
1567 |
vpihour |
1351 |
var nom_tabs = ( typeof nom_tabs === "undefined" ) ? ".ui-tabs" : nom_tabs; |
1568 |
|
|
var $tabs = $(nom_tabs).tabs(); |
1569 |
|
|
|
1570 |
vpihour |
1218 |
lien_onglet = $('#' + onglet).attr('href'); |
1571 |
|
|
lien_onglet = lien_onglet.substring( lien_onglet.length - 1, lien_onglet.length); |
1572 |
|
|
|
1573 |
|
|
$tabs.tabs('select', lien_onglet); |
1574 |
|
|
} |
1575 |
vpihour |
1351 |
|
1576 |
|
|
//Rajoute un dossier pour la commission id |
1577 |
|
|
function addDossierCommission(id, container){ |
1578 |
|
|
|
1579 |
|
|
link = "../app/ajouter_dossier_commission.php?idx=" + id + "&idxDossier=" + $(container+" #dossier").val(); |
1580 |
|
|
|
1581 |
|
|
$.ajax({ |
1582 |
|
|
type: "GET", |
1583 |
|
|
url: link, |
1584 |
|
|
cache: false, |
1585 |
|
|
dataType: "json", |
1586 |
|
|
success: function(i, obj){ |
1587 |
|
|
|
1588 |
|
|
$(container + " .message").remove(); |
1589 |
|
|
$(container).prepend( |
1590 |
|
|
'<div class="message ui-widget ui-corner-all ui-state-highlight">'+ |
1591 |
|
|
'<p>'+ |
1592 |
|
|
'<span class="ui-icon ui-icon-info"></span>'+ |
1593 |
|
|
'<span class="text">'+ |
1594 |
|
|
'</span>'+ |
1595 |
|
|
'</p>'+ |
1596 |
|
|
'</div>' |
1597 |
|
|
); |
1598 |
|
|
|
1599 |
|
|
// Nouveau dossier ajouté |
1600 |
|
|
if ( i.return == "1" ){ |
1601 |
|
|
|
1602 |
|
|
$(container + ' .message').addClass("ui-state-ok"); |
1603 |
|
|
$(container + ' .message .text').html("Dossier ajouté avec succès."); |
1604 |
|
|
} |
1605 |
|
|
//Dossier existe mais non ajouté |
1606 |
|
|
else if( i.return == "0" ){ |
1607 |
|
|
|
1608 |
|
|
$(container + ' .message').addClass("ui-state-error"); |
1609 |
|
|
$(container + ' .message .text').html("Une erreur s'est produite lors de l'ajout de ce dossier. " + |
1610 |
|
|
"Veuillez contacter votre administrateur"); |
1611 |
|
|
} |
1612 |
|
|
//Le dossier n'existe pas |
1613 |
|
|
else if( i.return == "-1" ){ |
1614 |
|
|
|
1615 |
|
|
$(container + ' .message').addClass("ui-state-error"); |
1616 |
|
|
$(container + ' .message .text').html("Ce dossier n'existe pas."); |
1617 |
|
|
} |
1618 |
|
|
//Le dossier est déjà à l'ordre du jour |
1619 |
|
|
else if( i.return == "2" ){ |
1620 |
|
|
|
1621 |
|
|
$(container + ' .message').addClass("ui-state-error"); |
1622 |
|
|
$(container + ' .message .text').html("Ce dossier est deja a l'ordre du jour."); |
1623 |
|
|
} |
1624 |
|
|
|
1625 |
|
|
}, |
1626 |
|
|
async: false |
1627 |
|
|
}); |
1628 |
|
|
} |
1629 |
|
|
|
1630 |
|
|
//Affichage du tableau des dossier_commission possibles |
1631 |
|
|
function ajouterTableauDossierCommissionPossible(id){ |
1632 |
|
|
|
1633 |
|
|
link = "../app/tableau_dossier_commission_possible.php?idx=" + id ; |
1634 |
|
|
|
1635 |
|
|
$.ajax({ |
1636 |
|
|
type: "GET", |
1637 |
|
|
url: link, |
1638 |
|
|
cache: false, |
1639 |
|
|
success: function(html){ |
1640 |
|
|
|
1641 |
|
|
$('#tabs-2').html(html); |
1642 |
|
|
}, |
1643 |
|
|
async: false |
1644 |
|
|
}); |
1645 |
|
|
} |
1646 |
|
|
|
1647 |
|
|
//Met à jour la liste des dossiers de la commission |
1648 |
|
|
function updateCommission(id, container){ |
1649 |
|
|
|
1650 |
|
|
var link = "../app/update_dossier_commission.php?idx=" + id ; |
1651 |
|
|
var res = 1; |
1652 |
|
|
|
1653 |
|
|
//Affiche du message de retour |
1654 |
|
|
$(container + " .message").remove(); |
1655 |
|
|
$(container).prepend( |
1656 |
|
|
'<div class="message ui-widget ui-corner-all ui-state-highlight">'+ |
1657 |
|
|
'<p>'+ |
1658 |
|
|
'<span class="ui-icon ui-icon-info"></span>'+ |
1659 |
|
|
'<span class="text">'+ |
1660 |
|
|
msg_loading + |
1661 |
|
|
'</span>'+ |
1662 |
|
|
'</p>'+ |
1663 |
|
|
'</div>' |
1664 |
|
|
); |
1665 |
|
|
|
1666 |
|
|
$(container + " input[type='checkbox']").each( |
1667 |
|
|
function(index) { |
1668 |
|
|
|
1669 |
|
|
link = "../app/update_dossier_commission.php?idx=" + id + |
1670 |
|
|
"&idxDossier=" + $(this).val(); |
1671 |
|
|
|
1672 |
|
|
//Ajoute ces dossiers de l'ordre du jour |
1673 |
|
|
if ( $(this).is(":checked")){ |
1674 |
|
|
|
1675 |
|
|
link += "&action=add"; |
1676 |
|
|
} |
1677 |
|
|
//Supprime ces dossiers de l'ordre du jour |
1678 |
|
|
else{ |
1679 |
|
|
|
1680 |
|
|
link += "&action=remove"; |
1681 |
|
|
} |
1682 |
|
|
|
1683 |
|
|
//Mise à jour des données |
1684 |
|
|
$.ajax({ |
1685 |
|
|
type: "GET", |
1686 |
|
|
url: link, |
1687 |
|
|
cache: false, |
1688 |
|
|
dataType: "json", |
1689 |
|
|
success: function(i, obj){ |
1690 |
|
|
|
1691 |
|
|
// Erreur |
1692 |
|
|
if( i.return == "-1" ){ |
1693 |
|
|
|
1694 |
|
|
res = -1; |
1695 |
|
|
} |
1696 |
|
|
}, |
1697 |
|
|
async: false |
1698 |
|
|
}); |
1699 |
|
|
} |
1700 |
|
|
); |
1701 |
|
|
|
1702 |
|
|
//le traitement a été effectué avec succés |
1703 |
|
|
if ( res == 1 ){ |
1704 |
|
|
|
1705 |
|
|
$(container + ' .message').addClass("ui-state-ok"); |
1706 |
vpihour |
1369 |
$(container + ' .message .text').html("Mise à jour réalisée avec succès."); |
1707 |
vpihour |
1351 |
} |
1708 |
|
|
//Une erreur s'est produite |
1709 |
|
|
else { |
1710 |
|
|
|
1711 |
|
|
$(container + ' .message').addClass("ui-state-error"); |
1712 |
|
|
$(container + ' .message .text').html("Une erreur s'est produite la mise à jour de la commission. " + |
1713 |
|
|
"Veuillez contacter votre administrateur"); |
1714 |
|
|
} |
1715 |
|
|
} |