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