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 |
|
|
}); |
12 |
fraynaud |
88 |
|
13 |
nhaye |
585 |
|
14 |
fmichon |
784 |
/** |
15 |
|
|
* WIDGET liés au formulaire et sousformulaire |
16 |
|
|
* |
17 |
|
|
* Ces fonctions javascript sont appelées depuis les méthodes setOnChange, |
18 |
|
|
* setOnClick, ... |
19 |
|
|
*/ |
20 |
|
|
// bible - type httpclick |
21 |
|
|
function bible() { |
22 |
fraynaud |
88 |
if(fenetreouverte==true) |
23 |
|
|
pfenetre.close(); |
24 |
|
|
var ev=document.f2.evenement.value; |
25 |
|
|
var idx=document.f2.dossier.value; |
26 |
fraynaud |
343 |
pfenetre=window.open("../app/bible.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
27 |
fraynaud |
88 |
fenetreouverte=true; |
28 |
|
|
} |
29 |
fmichon |
784 |
// bible2 - type httpclick |
30 |
fraynaud |
88 |
function bible2() |
31 |
|
|
{ |
32 |
|
|
if(fenetreouverte==true) |
33 |
|
|
pfenetre.close(); |
34 |
|
|
var ev=document.f2.evenement.value; |
35 |
|
|
var idx=document.f2.dossier.value; |
36 |
fraynaud |
343 |
pfenetre=window.open("../app/bible2.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
37 |
fraynaud |
88 |
fenetreouverte=true; |
38 |
|
|
} |
39 |
fmichon |
784 |
// bible_auto - type httpclick |
40 |
fraynaud |
88 |
function bible_auto(){ |
41 |
|
|
if(fenetreouverte==true) |
42 |
|
|
pfenetre.close(); |
43 |
|
|
var ev=document.f2.evenement.value; |
44 |
|
|
var idx=document.f2.dossier.value; |
45 |
fraynaud |
90 |
pfenetre=window.open("../app/bible_auto.php?idx="+idx+"&ev="+ev,"evenement","width=600,height=300,top=120,left=120"); |
46 |
fraynaud |
88 |
fenetreouverte=true; |
47 |
|
|
} |
48 |
fmichon |
784 |
// VerifNumdec - type text |
49 |
|
|
function VerifNumdec(champ) { |
50 |
|
|
champ.value = champ.value.replace(",", "."); // remplacement de la virgule |
51 |
|
|
//if (champ.value.lastIndexOf(".") == -1){ // champ decimal |
52 |
|
|
if (isNaN(champ.value)) { |
53 |
|
|
alert(msg_alert_error_verifnum); |
54 |
|
|
champ.value = ""; |
55 |
|
|
return; |
56 |
|
|
} |
57 |
|
|
//} |
58 |
|
|
|
59 |
|
|
} |
60 |
|
|
// Ce widget permet de charger les données d'un select en ajax |
61 |
|
|
function changeDataSelect(tn, ds, joker){ |
62 |
|
|
|
63 |
|
|
var id = $("#"+ds+" option:selected").val(); |
64 |
|
|
link = "../app/listData.php?idx=" + id + "&tn=" + tn + "&ds=" + ds; |
65 |
|
|
$.ajax({ |
66 |
|
|
type: "GET", |
67 |
|
|
url: link, |
68 |
|
|
cache: false, |
69 |
|
|
dataType: "json", |
70 |
|
|
success: function(html){ |
71 |
|
|
|
72 |
|
|
$('#'+tn).empty(); |
73 |
|
|
|
74 |
|
|
if ( joker == true ) |
75 |
|
|
$('#'+tn).append( |
76 |
|
|
'<option value="" selected="selected">*</option>' |
77 |
|
|
); |
78 |
|
|
else |
79 |
|
|
$('#'+tn).append( |
80 |
|
|
'<option value="" selected="selected">Choisir ' + tn + '</option>' |
81 |
|
|
); |
82 |
|
|
|
83 |
|
|
if ( html !== '' ){ |
84 |
|
|
|
85 |
|
|
html = html.split(';'); |
86 |
|
|
for ( i = 0 ; i < html.length - 1 ; i++ ){ |
87 |
|
|
|
88 |
|
|
html_temp = html[i].split('_'); |
89 |
|
|
$('#'+tn).append( |
90 |
|
|
'<option value="'+html_temp[0]+'" >'+html_temp[1]+'</option>' |
91 |
|
|
); |
92 |
|
|
} |
93 |
|
|
} |
94 |
|
|
}, |
95 |
|
|
async: false |
96 |
|
|
}); |
97 |
|
|
} |
98 |
|
|
// vuploadMulti - XXX |
99 |
|
|
function vuploadMulti(champ) { |
100 |
|
|
// |
101 |
|
|
if (fenetreouverte == true) { |
102 |
|
|
pfenetre.close(); |
103 |
|
|
} |
104 |
|
|
// |
105 |
|
|
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"); |
106 |
|
|
//pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120"); |
107 |
|
|
// |
108 |
|
|
fenetreouverte = true; |
109 |
|
|
} |
110 |
|
|
// tmpUpload - Upload XXX |
111 |
|
|
function tmpUpload(champ) { |
112 |
|
|
// |
113 |
|
|
if (fenetreouverte == true) { |
114 |
|
|
pfenetre.close(); |
115 |
|
|
} |
116 |
|
|
// |
117 |
|
|
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"); |
118 |
|
|
//pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120"); |
119 |
|
|
// |
120 |
|
|
fenetreouverte = true; |
121 |
|
|
} |
122 |
fraynaud |
88 |
|
123 |
fmichon |
784 |
|
124 |
|
|
|
125 |
|
|
/** |
126 |
|
|
* POPUP pour le téléchargement de fichier |
127 |
|
|
* |
128 |
|
|
* Ces fonctions javascript sont appelées depuis des onClick sur des |
129 |
|
|
* formulaires spécifiques pour permettre de transmettre des paramètres aux |
130 |
|
|
* éditions pdf ainsi appelées. |
131 |
|
|
*/ |
132 |
|
|
// |
133 |
fraynaud |
88 |
function dossierads_d(debut) |
134 |
|
|
{ |
135 |
|
|
//if(fenetreouverte==true) |
136 |
|
|
window.location="../pdf/pdfetat.php?obj=dossier_ads_d&nature=" |
137 |
|
|
+document.f1.nature.value+"&idx=demo&datedebut=" |
138 |
|
|
+document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
139 |
|
|
} |
140 |
fmichon |
784 |
// |
141 |
vpihour |
833 |
function dossier_m(){ |
142 |
vpihour |
840 |
window.location="../pdf/pdfetat.php?obj=dossier_m&idx=demo"; |
143 |
|
|
/*Requete AJAX vers le fichier edition_m.php pour mettre à jour les dossiers*/ |
144 |
|
|
$.ajax({ |
145 |
|
|
type: "GET", |
146 |
|
|
url: "../app/edition_m.php?update", |
147 |
|
|
cache: false, |
148 |
|
|
success: function(html){ |
149 |
|
|
if ( html.length > 2 ){ |
150 |
|
|
|
151 |
|
|
alert(html); |
152 |
|
|
} |
153 |
|
|
}, |
154 |
|
|
async: false |
155 |
|
|
}); |
156 |
vpihour |
833 |
} |
157 |
|
|
// |
158 |
fraynaud |
88 |
function dossierdepot() |
159 |
|
|
{ |
160 |
|
|
//if(fenetreouverte==true) |
161 |
|
|
window.location="../pdf/pdfetat.php?obj=dossier_depot&nature="+ |
162 |
|
|
document.f1.nature.value+"&idx=demo&datedebut="+ |
163 |
|
|
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
164 |
|
|
} |
165 |
fmichon |
784 |
// |
166 |
fraynaud |
88 |
function dossierads() |
167 |
|
|
{ |
168 |
|
|
//if(fenetreouverte==true) |
169 |
|
|
window.location="../pdf/pdfetat.php?obj=dossier_ads&nature="+ |
170 |
|
|
document.f1.nature.value+"&idx=demo&datedebut="+ |
171 |
|
|
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
172 |
|
|
} |
173 |
|
|
|
174 |
fmichon |
784 |
// téléchargement du fichier |
175 |
|
|
function file(fichier) { |
176 |
|
|
// |
177 |
|
|
if (fichier == "") { |
178 |
|
|
alert("zone vide"); |
179 |
|
|
} |
180 |
|
|
// |
181 |
|
|
pfenetre = window.open("../app/file.php?file="+fichier,"Visualisation","width=100,height=100,top=1,left=150,scrollbars=yes,resizable = yes"); |
182 |
|
|
// |
183 |
|
|
fenetreouverte = true; |
184 |
|
|
} |
185 |
fraynaud |
271 |
|
186 |
fmichon |
784 |
/** |
187 |
|
|
* Retour spécifique de l'écran de consultation multiple - surcharge de ajaxIt |
188 |
|
|
* @todo XXX voir les différences avec ajaxIt et si il n'est pas possible |
189 |
|
|
* d'effectuer la modification dans le core |
190 |
|
|
*/ |
191 |
vpihour |
534 |
function messageIt(objsf, link, empty) { |
192 |
|
|
// recuperation du terme recherche |
193 |
|
|
var recherche = document.getElementById("recherchedyn"); |
194 |
|
|
if (recherche != null) { |
195 |
|
|
link += "&recherche="+recherche.value; |
196 |
|
|
}else { |
197 |
|
|
link += "&recherche="; |
198 |
|
|
} |
199 |
vpihour |
558 |
// execution de la requete en GET |
200 |
vpihour |
534 |
$.ajax({ |
201 |
|
|
type: "GET", |
202 |
|
|
url: link, |
203 |
|
|
cache: false, |
204 |
|
|
success: function(html){ |
205 |
|
|
(empty == true )?$("#sousform-"+objsf).empty():''; |
206 |
|
|
$("#sousform-"+objsf).append(html); |
207 |
|
|
om_initialize_content(); |
208 |
|
|
}, |
209 |
|
|
async: false |
210 |
|
|
}); |
211 |
|
|
} |
212 |
vpihour |
536 |
|
213 |
fmichon |
784 |
/** |
214 |
|
|
* TTélécharegement de fichier pdf en ajax |
215 |
|
|
* spécifique de l'écran de consultation multiple |
216 |
|
|
*/ |
217 |
vpihour |
536 |
/* Plugin jQuery qui lance un espèce d'appel AJAX vers un script PHP de téléchargement de fichier*/ |
218 |
|
|
jQuery.download = function(url, data, method){ |
219 |
|
|
//url and data options required |
220 |
|
|
if( url && data ){ |
221 |
|
|
//data can be string of parameters or array/object |
222 |
|
|
data = typeof data == 'string' ? data : jQuery.param(data); |
223 |
|
|
//split params into form inputs |
224 |
|
|
var inputs = ''; |
225 |
|
|
jQuery.each(data.split('&'), function(){ |
226 |
|
|
var pair = this.split('='); |
227 |
|
|
inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />'; |
228 |
|
|
}); |
229 |
|
|
//send request |
230 |
|
|
jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') |
231 |
|
|
.prependTo('body').submit().remove(); |
232 |
|
|
}; |
233 |
|
|
}; |
234 |
|
|
|
235 |
fmichon |
784 |
/** |
236 |
|
|
* Cette fonction permet de charger dans un dialog jqueryui un formulaire tel |
237 |
|
|
* qu'il aurait été chargé avec ajaxIt |
238 |
nhaye |
800 |
* |
239 |
|
|
* @param objsf string : objet de sousformulaire |
240 |
|
|
* @param link string : lien vers un sousformulaire (../scr/sousform.php...) |
241 |
nhaye |
801 |
* @param width integer: width en px |
242 |
|
|
* @param height integer: height en px |
243 |
nhaye |
800 |
* @param callback function (optionel) : nom de la méthode à appeler |
244 |
|
|
* à la fermeture du dialog |
245 |
|
|
* @param callbackParams mixed (optionel) : paramètre à traiter dans la function |
246 |
|
|
* callback |
247 |
fmichon |
784 |
* |
248 |
nhaye |
800 |
**/ |
249 |
nhaye |
801 |
function popupIt(objsf, link, width, height, callback, callbackParams) { |
250 |
nhaye |
544 |
// Insertion du conteneur du dialog |
251 |
|
|
var dialog = $('<div id=\"sousform-'+objsf+'\"></div>').insertAfter('.formControls'); |
252 |
|
|
$('<input type=\"text\" name=\"recherchedyn\" id=\"recherchedyn\" value=\"\" class=\"champFormulaire\" style=\"display:none\" />').insertAfter('#sousform-'+objsf); |
253 |
|
|
|
254 |
|
|
// execution de la requete passee en parametre |
255 |
|
|
// (idem ajaxIt + callback) |
256 |
|
|
$.ajax({ |
257 |
|
|
type: "GET", |
258 |
|
|
url: link, |
259 |
|
|
cache: false, |
260 |
|
|
success: function(html){ |
261 |
|
|
//Suppression d'un precedent dialog |
262 |
|
|
dialog.empty(); |
263 |
|
|
//Ajout du contenu recupere |
264 |
|
|
dialog.append(html); |
265 |
|
|
//Initialisation du theme OM |
266 |
|
|
om_initialize_content(); |
267 |
|
|
//Creation du dialog |
268 |
|
|
$(dialog).dialog({ |
269 |
|
|
//OnClose suppression du contenu |
270 |
|
|
close: function(ev, ui) { |
271 |
nhaye |
800 |
// Si le formulaire est submit et valide on execute la méthode |
272 |
|
|
// passée en paramètre |
273 |
|
|
if (typeof(callback) === "function") { |
274 |
|
|
callback(callbackParams); |
275 |
nhaye |
557 |
} |
276 |
nhaye |
544 |
$(this).remove(); |
277 |
|
|
}, |
278 |
|
|
resizable: false, |
279 |
|
|
modal: true, |
280 |
nhaye |
801 |
width: width, |
281 |
|
|
height: height, |
282 |
nhaye |
544 |
}); |
283 |
|
|
}, |
284 |
|
|
async : false |
285 |
|
|
}); |
286 |
nhaye |
802 |
//Fermeture du dialog lors d'un clic sur le bouton retour |
287 |
nhaye |
544 |
$('#sousform-'+objsf).on("click",'a.retour',function() { |
288 |
|
|
$(dialog).dialog('close').remove(); |
289 |
nhaye |
838 |
return false; |
290 |
nhaye |
544 |
}); |
291 |
|
|
} |
292 |
nhaye |
557 |
|
293 |
fmichon |
784 |
/*** |
294 |
nhaye |
800 |
* Fonction getter des paramètres de l'url courante |
295 |
fmichon |
784 |
*/ |
296 |
nhaye |
557 |
// Parse URL Queries Method |
297 |
|
|
(function($){ |
298 |
nhaye |
800 |
$.getQuery = function( query ) { |
299 |
|
|
query = query.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); |
300 |
|
|
var expr = "[\\?&]"+query+"=([^&#]*)"; |
301 |
|
|
var regex = new RegExp( expr ); |
302 |
|
|
var results = regex.exec( window.location.href ); |
303 |
|
|
if( results !== null ) { |
304 |
|
|
return results[1]; |
305 |
|
|
return decodeURIComponent(results[1].replace(/\+/g, " ")); |
306 |
|
|
} else { |
307 |
|
|
return false; |
308 |
|
|
} |
309 |
|
|
}; |
310 |
nhaye |
557 |
})(jQuery); |
311 |
vpihour |
558 |
|
312 |
vpihour |
641 |
|
313 |
vpihour |
793 |
/* |
314 |
nhaye |
800 |
* Javascript concernant la demande d'avis |
315 |
|
|
* |
316 |
|
|
* |
317 |
|
|
*/ |
318 |
|
|
|
319 |
nhaye |
802 |
/** |
320 |
|
|
* Fonction de callback appellée lors de la fermeture du dialog (popupit) |
321 |
|
|
* du retour d'avis d'un service |
322 |
|
|
**/ |
323 |
nhaye |
800 |
function returnToTab(objsf) { |
324 |
|
|
var valid=$('#sousform-'+objsf+' div.ui-state-valid'); |
325 |
|
|
if(valid.length > 0) { |
326 |
|
|
document.location.href="../scr/tab.php?obj="+$.getQuery('obj')+"&premier="+$.getQuery('premier') |
327 |
|
|
+"&advs_id="+$.getQuery('advs_id')+"&recherche="+$.getQuery('recherche')+"&tricol="+$.getQuery('tricol') |
328 |
|
|
+"&selectioncol="+$.getQuery('selectioncol'); |
329 |
|
|
} |
330 |
|
|
}; |
331 |
|
|
|
332 |
|
|
|
333 |
|
|
/* |
334 |
vpihour |
793 |
* Javascript concernant la demande |
335 |
|
|
* |
336 |
|
|
* |
337 |
|
|
*/ |
338 |
fmichon |
784 |
|
339 |
nhaye |
807 |
/** |
340 |
nhaye |
838 |
* Function permettant de mettre à jour les infos du demandeur |
341 |
nhaye |
807 |
**/ |
342 |
|
|
function getDemandeurId(type) { |
343 |
|
|
var id_demandeur=$('#id_retour').val(); |
344 |
nhaye |
828 |
if($.isNumeric(id_demandeur)) { |
345 |
|
|
if(type != 'petitionnaire') { |
346 |
|
|
$('#add_'+type).hide(); |
347 |
|
|
} |
348 |
|
|
|
349 |
|
|
afficherDemandeur(id_demandeur,type); |
350 |
|
|
om_initialize_content(); |
351 |
|
|
} |
352 |
nhaye |
807 |
} |
353 |
|
|
|
354 |
nhaye |
828 |
/** |
355 |
|
|
* Fonction permettant d'afficher la synthèse d'un demandeur |
356 |
|
|
*/ |
357 |
|
|
function afficherDemandeur(id,type) { |
358 |
|
|
$.ajax({ |
359 |
|
|
type: "GET", |
360 |
|
|
url: '../app/afficher_synthese_demandeur.view.php?iddemandeur='+id+'&type='+type, |
361 |
|
|
cache: false, |
362 |
|
|
success: function(html){ |
363 |
nhaye |
838 |
$(html).insertBefore('#add_'+type).fadeIn(500);; |
364 |
nhaye |
828 |
} |
365 |
|
|
}); |
366 |
|
|
} |
367 |
|
|
|
368 |
nhaye |
838 |
/** |
369 |
|
|
* Function permettant de modifier un demandeur |
370 |
vpihour |
793 |
*/ |
371 |
nhaye |
838 |
function editDemandeur(id,type,id_css) { |
372 |
|
|
popupIt(type, |
373 |
|
|
'../scr/sousform.php?obj='+type+'&action=1'+ |
374 |
|
|
'&retourformulaire=demande&idx='+id, 780, 500, |
375 |
|
|
replaceDemandeur, {'type':type,'id': id, 'id_css':id_css}); |
376 |
|
|
changeDemandeurType('qualite'); |
377 |
|
|
addSearchIcon(); |
378 |
|
|
addDivDialog('.bloc_demandeur'); |
379 |
|
|
} |
380 |
vpihour |
793 |
|
381 |
nhaye |
838 |
/** |
382 |
|
|
* Function permettant de remplacer un contenu déjà existant |
383 |
|
|
**/ |
384 |
|
|
function replaceDemandeur(obj) { |
385 |
|
|
$.ajax({ |
386 |
|
|
type: "GET", |
387 |
|
|
url: '../app/afficher_synthese_demandeur.view.php?iddemandeur='+obj.id+'&type='+obj.type, |
388 |
|
|
cache: false, |
389 |
|
|
success: function(html){ |
390 |
|
|
$(obj.id_css).replaceWith(html); |
391 |
|
|
} |
392 |
|
|
}); |
393 |
|
|
} |
394 |
|
|
/** |
395 |
|
|
* Function permettant de remplacer un contenu déjà existant |
396 |
|
|
**/ |
397 |
|
|
function removeDemandeur(id) { |
398 |
|
|
var div_class=$('#'+id).attr("class"); |
399 |
|
|
$('#'+id).remove(); |
400 |
|
|
if(div_class == "delegataire") { |
401 |
|
|
$('#add_delegataire').fadeIn(500); |
402 |
|
|
} |
403 |
|
|
if(div_class == "petitionnaire_principal") { |
404 |
|
|
$('#add_petitionnaire_principal').fadeIn(500); |
405 |
|
|
} |
406 |
|
|
} |
407 |
vpihour |
793 |
|
408 |
nhaye |
838 |
/** |
409 |
|
|
* Appel au chargement de la page |
410 |
|
|
**/ |
411 |
vpihour |
664 |
$(function() { |
412 |
vpihour |
805 |
changeDemandeurType('qualite'); |
413 |
vpihour |
823 |
if ( $('#type_demandeur') == 'petitionnaire' ){ |
414 |
|
|
|
415 |
|
|
addSearchIcon(); |
416 |
|
|
addDivDialog('.bloc_demandeur'); |
417 |
|
|
} |
418 |
nhaye |
838 |
if($('input[name=petitionnaire_principal][type=hidden]').size() == 1) { |
419 |
|
|
$('#add_petitionnaire_principal').hide(); |
420 |
|
|
} |
421 |
|
|
if($('input[name=delegataire][type=hidden]').size() == 1) { |
422 |
|
|
$('#add_delegataire').hide(); |
423 |
|
|
} |
424 |
nhaye |
828 |
// Bind de la fonction permettant l'ajout du pétitionnaire principal |
425 |
nhaye |
838 |
$("#formulaire").on("click","#add_petitionnaire_principal", function() { |
426 |
nhaye |
828 |
popupIt('petitionnaire', |
427 |
|
|
'../scr/sousform.php?obj=petitionnaire&action=0'+ |
428 |
|
|
'&retourformulaire=demande&principal=true', 780, 500, |
429 |
|
|
getDemandeurId, 'petitionnaire_principal'); |
430 |
|
|
}); |
431 |
|
|
// Bind de la fonction permettant l'ajout du délégataire |
432 |
|
|
$("#formulaire").on("click","#add_delegataire", function(event) { |
433 |
|
|
popupIt('delegataire', |
434 |
|
|
'../scr/sousform.php?obj=delegataire&action=0'+ |
435 |
|
|
'&retourformulaire=demande', 780, 500, |
436 |
|
|
getDemandeurId, 'delegataire'); |
437 |
|
|
}); |
438 |
|
|
// Bind de la fonction permettant l'ajout des pétitionnaires |
439 |
|
|
$("#formulaire").on("click","#add_petitionnaire", function(event) { |
440 |
|
|
popupIt('petitionnaire', |
441 |
|
|
'../scr/sousform.php?obj=petitionnaire&action=0'+ |
442 |
|
|
'&retourformulaire=demande', 780, 500, |
443 |
|
|
getDemandeurId, 'petitionnaire'); |
444 |
|
|
}); |
445 |
|
|
|
446 |
|
|
|
447 |
vpihour |
664 |
url = document.location + "" ; |
448 |
mlimic |
836 |
if (url.indexOf("form.php?obj=demande&") != -1 |
449 |
nhaye |
828 |
&& url.indexOf("&action=0") != -1 ){ |
450 |
vpihour |
793 |
/*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/ |
451 |
vpihour |
664 |
hideFields(); |
452 |
vpihour |
676 |
} |
453 |
vpihour |
664 |
|
454 |
mlimic |
836 |
if (url.indexOf("form.php?obj=demande&") != -1 |
455 |
nhaye |
828 |
&& url.indexOf("&action=1") != -1 ){ |
456 |
vpihour |
664 |
|
457 |
vpihour |
812 |
formatFieldReferenceCadastrale(); |
458 |
|
|
} |
459 |
|
|
}); |
460 |
|
|
|
461 |
|
|
/* |
462 |
|
|
* Action sur les champs pour les références cadastrales |
463 |
|
|
*/ |
464 |
|
|
function formatFieldReferenceCadastrale(){ |
465 |
|
|
addNewFieldReferencesCadastrales(); |
466 |
|
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
467 |
|
|
|
468 |
|
|
reference_cadastrale = $('#terrain_references_cadastrales').val(); |
469 |
|
|
/*Formatage de la reference cadastrale*/ |
470 |
|
|
if ( reference_cadastrale != '' ){ |
471 |
|
|
|
472 |
|
|
/* Récupère la référence cadastrale non formatée */ |
473 |
|
|
references_cadastrales = reference_cadastrale.split(';'); |
474 |
|
|
donnees = new Array(); |
475 |
|
|
|
476 |
|
|
i = 0 ; |
477 |
|
|
/* Boucle sur les références, elles étaient séparées par un ; */ |
478 |
|
|
for ( l = 0 ; l < references_cadastrales.length - 1 ; l ++ ){ |
479 |
vpihour |
664 |
|
480 |
vpihour |
812 |
/*Récupère le code impots du qartier [CHIFFRES]*/ |
481 |
|
|
k = 0; |
482 |
|
|
donnees[i] = ''; |
483 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ){ |
484 |
vpihour |
664 |
|
485 |
vpihour |
812 |
if ( references_cadastrales[l].charAt(j) >= 0 && |
486 |
|
|
references_cadastrales[l].charAt(j) <= 9 ){ |
487 |
|
|
|
488 |
|
|
donnees[i] += references_cadastrales[l].charAt(j); |
489 |
|
|
k++; |
490 |
vpihour |
793 |
|
491 |
vpihour |
812 |
} else { |
492 |
|
|
|
493 |
|
|
i++; |
494 |
|
|
break; |
495 |
|
|
} |
496 |
|
|
} |
497 |
|
|
|
498 |
|
|
/* Récupère la section [LETTRES] */ |
499 |
|
|
donnees[i] = ''; |
500 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
501 |
|
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
502 |
|
|
|
503 |
|
|
donnees[i] += references_cadastrales[l].charAt(j); |
504 |
|
|
k++; |
505 |
|
|
|
506 |
|
|
} else { |
507 |
|
|
|
508 |
|
|
i++; |
509 |
|
|
break; |
510 |
|
|
} |
511 |
|
|
|
512 |
|
|
/* Récupère la parcelle [CHIFFRES] */ |
513 |
|
|
donnees[i] = ''; |
514 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
515 |
|
|
if ( references_cadastrales[l].charAt(j) >= 0 && |
516 |
|
|
references_cadastrales[l].charAt(j) <= 9 ){ |
517 |
vpihour |
793 |
|
518 |
vpihour |
812 |
donnees[i] += references_cadastrales[l].charAt(j); |
519 |
|
|
k++; |
520 |
|
|
|
521 |
|
|
} else { |
522 |
|
|
|
523 |
|
|
break; |
524 |
vpihour |
793 |
} |
525 |
vpihour |
812 |
|
526 |
|
|
/* Récupère les séparateurs [ A / ] et les sections */ |
527 |
|
|
m = 0 ; |
528 |
|
|
if ( k < references_cadastrales[l].length ){ |
529 |
vpihour |
669 |
|
530 |
|
|
for ( j = k ; j < references_cadastrales[l].length ; j++ ) |
531 |
|
|
if ( isAlpha(references_cadastrales[l].charAt(j)) ){ |
532 |
vpihour |
793 |
|
533 |
vpihour |
812 |
m++; |
534 |
|
|
donnees[++i] = references_cadastrales[l].charAt(j); |
535 |
|
|
donnees[++i] = ''; |
536 |
|
|
} |
537 |
|
|
else { |
538 |
vpihour |
793 |
|
539 |
vpihour |
669 |
donnees[i] += references_cadastrales[l].charAt(j); |
540 |
vpihour |
664 |
} |
541 |
vpihour |
812 |
} |
542 |
|
|
|
543 |
|
|
/*Créé autant de champs de que de référence */ |
544 |
|
|
donnees[++i] = ';'; |
545 |
|
|
i++; |
546 |
vpihour |
669 |
|
547 |
vpihour |
812 |
if ( l > 0 ) { |
548 |
vpihour |
793 |
|
549 |
vpihour |
812 |
$('.reference_cadastrale_custom_fields').append( |
550 |
|
|
"<br/>" + fieldReferenceCadastraleBase() |
551 |
|
|
); |
552 |
vpihour |
664 |
} |
553 |
|
|
|
554 |
vpihour |
812 |
actionFormReferenceCadastrale(); |
555 |
|
|
|
556 |
|
|
if ( m > 0 ){ |
557 |
|
|
|
558 |
|
|
for ( j = 0 ; j < m ; j++ ){ |
559 |
vpihour |
793 |
|
560 |
vpihour |
812 |
$('#moreFieldReferenceCadastrale' + |
561 |
|
|
( $('.moreFieldReferenceCadastrale').length - 1 ) ). |
562 |
|
|
before( |
563 |
|
|
newInputReferenceCadastrale() |
564 |
|
|
); |
565 |
vpihour |
664 |
} |
566 |
vpihour |
812 |
} |
567 |
vpihour |
664 |
} |
568 |
vpihour |
812 |
/* Action sur les boutons [+ ajouter d'autres champs] et [+ ajouter |
569 |
|
|
* d'autres lignes] */ |
570 |
|
|
actionLineFormReferenceCadastrale(); |
571 |
|
|
|
572 |
|
|
/* Ajoute les données dans les champs nouvellement créés */ |
573 |
|
|
$('.reference_cadastrale_custom_field').each( |
574 |
|
|
function(index) { |
575 |
|
|
|
576 |
|
|
$(this).val(donnees[index]) |
577 |
|
|
} |
578 |
|
|
); |
579 |
|
|
} |
580 |
|
|
else{ |
581 |
|
|
actionFormReferenceCadastrale(); |
582 |
|
|
actionLineFormReferenceCadastrale(); |
583 |
|
|
} |
584 |
|
|
} |
585 |
vpihour |
641 |
|
586 |
vpihour |
664 |
/* |
587 |
vpihour |
805 |
* Ajoute les icônes pour la recherche de pétitionnaire fréquent. |
588 |
|
|
*/ |
589 |
|
|
function addSearchIcon(){ |
590 |
nhaye |
848 |
|
591 |
|
|
$('.search_particulier_fields, .search_personne_morale_fields').each(function() { |
592 |
vpihour |
805 |
/*Ajout de l'icône après le champs dénomination et nom de la personne morale*/ |
593 |
nhaye |
848 |
|
594 |
vpihour |
805 |
$(this). |
595 |
|
|
after( |
596 |
|
|
'<span '+ |
597 |
nhaye |
848 |
'class="om-icon om-icon-16 om-icon-fix search-petitionnaire-16" '+ |
598 |
vpihour |
805 |
'title="Chercher un petitionnaire"> '+ |
599 |
nhaye |
848 |
'</span>'+ |
600 |
|
|
'<span '+ |
601 |
|
|
'class="om-icon om-icon-16 om-icon-fix erase-petitionnaire delete-16" '+ |
602 |
|
|
'title="Supprimer le contenu"> '+ |
603 |
vpihour |
805 |
'</span>' |
604 |
|
|
); |
605 |
|
|
} |
606 |
|
|
); |
607 |
|
|
|
608 |
nhaye |
828 |
addActionSearchIcon('#sousform-petitionnaire #form-content'); |
609 |
nhaye |
848 |
addActionRemove(); |
610 |
|
|
|
611 |
vpihour |
768 |
} |
612 |
|
|
|
613 |
nhaye |
849 |
/** |
614 |
|
|
* Fonction permettant de revenir sur le formulaire d'ajout de demandeur |
615 |
|
|
**/ |
616 |
nhaye |
848 |
function addActionRemove(){ |
617 |
|
|
$('.erase-petitionnaire').click( |
618 |
|
|
function(){ |
619 |
|
|
ajaxIt('petitionnaire','../scr/sousform.php?obj=petitionnaire&action=0'); |
620 |
|
|
}); |
621 |
|
|
} |
622 |
|
|
|
623 |
vpihour |
741 |
/* |
624 |
vpihour |
805 |
* Ajoute les actions sur les icônes de recherche |
625 |
|
|
*/ |
626 |
|
|
function addActionSearchIcon(id){ |
627 |
vpihour |
741 |
|
628 |
vpihour |
793 |
/*Si on recherche un pétitionnaire de type particulier*/ |
629 |
nhaye |
848 |
$('.search-petitionnaire-16').click( |
630 |
vpihour |
741 |
function(){ |
631 |
|
|
|
632 |
vpihour |
805 |
/*Le champ nom du particulier doit contenir au moins trois lettres*/ |
633 |
nhaye |
848 |
if ( $('#particulier_nom').val().length < 3 && |
634 |
|
|
$('#particulier_prenom').val().length < 3 && |
635 |
|
|
$('#personne_morale_denomination').val().length < 3 && |
636 |
|
|
$('#personne_morale_nom').val().length < 3 ){ |
637 |
vpihour |
805 |
|
638 |
|
|
alert('Saisissez au moins trois lettres pour la recherche'); |
639 |
|
|
return; |
640 |
|
|
} |
641 |
|
|
|
642 |
vpihour |
793 |
/*Données des champs nom et prénom du particulier*/ |
643 |
nhaye |
848 |
var donnees = "?par_nom=" + $('.search_particulier_fields #particulier_nom').val() + |
644 |
|
|
"&par_prenom=" + $('.search_particulier_fields #particulier_prenom').val() + |
645 |
|
|
"&mor_denomination="+$('#personne_morale_denomination').val() + |
646 |
|
|
"&mor_nom="+$('#personne_morale_nom').val(); |
647 |
vpihour |
741 |
|
648 |
vpihour |
805 |
/* Requête qui va récupérer les données duaddSearchIcon(es) pétitionnaire(s) |
649 |
vpihour |
793 |
* correspondant(s) à la recherche */ |
650 |
vpihour |
741 |
$.ajax({ |
651 |
|
|
type: "GET", |
652 |
|
|
url: "../app/findPetitionnaire.php" + donnees , |
653 |
|
|
cache: false, |
654 |
nhaye |
848 |
success: function(obj){ |
655 |
|
|
console.log($.parseJSON(obj)); |
656 |
|
|
var freq = $.parseJSON(obj); |
657 |
|
|
var res=''; |
658 |
vpihour |
793 |
/*Si la recherche a donné des résultats*/ |
659 |
nhaye |
848 |
if ( freq.length > 0 ){ |
660 |
vpihour |
805 |
/*Limitation des résultats à 50 */ |
661 |
nhaye |
848 |
if ( freq.length > 50 ){ |
662 |
vpihour |
805 |
|
663 |
|
|
nbRes = 50; |
664 |
nhaye |
848 |
res += 'Votre recherche a donné ' + freq.length |
665 |
vpihour |
805 |
+ ' résultats. Seul les cinquantes premiers ' + |
666 |
|
|
'seront affichés.<br/>'; |
667 |
nhaye |
848 |
} else { |
668 |
|
|
nbRes = freq.length; |
669 |
vpihour |
805 |
} |
670 |
|
|
|
671 |
|
|
res += '<select>' ; |
672 |
|
|
|
673 |
vpihour |
793 |
/* Met les résultats de la recherche dans un select */ |
674 |
nhaye |
848 |
for ( i = 0 ; i < nbRes ; i++ ){ |
675 |
|
|
res += '<option value="' + freq[i].value + '">' + |
676 |
|
|
freq[i].content + |
677 |
vpihour |
793 |
'</option>'; |
678 |
vpihour |
741 |
} |
679 |
|
|
|
680 |
nhaye |
848 |
res += '</select>'; |
681 |
|
|
} else { |
682 |
|
|
res += 'Aucune correspondance trouvée.'; |
683 |
vpihour |
741 |
} |
684 |
|
|
|
685 |
vpihour |
793 |
/* Affichage de l'overlay */ |
686 |
vpihour |
741 |
$('#dialog').html(res); |
687 |
|
|
|
688 |
|
|
$( "#dialog" ).dialog({ |
689 |
|
|
modal: true, |
690 |
|
|
buttons : { |
691 |
|
|
Valider: function(){ |
692 |
nhaye |
848 |
if ( res != 'Auncune correspondance trouvée.'){ |
693 |
vpihour |
805 |
|
694 |
vpihour |
756 |
} |
695 |
nhaye |
848 |
var id = $('#dialog select option:selected').val(); |
696 |
|
|
ajaxIt('petitionnaire', |
697 |
|
|
'../scr/sousform.php?obj=petitionnaire&action=1&retourformulaire=demande&idx='+id); |
698 |
|
|
// Fermeture de l'overlay |
699 |
vpihour |
741 |
$(this).dialog( "close" ); |
700 |
|
|
} |
701 |
|
|
} |
702 |
|
|
}); |
703 |
|
|
}, |
704 |
|
|
}); |
705 |
|
|
} |
706 |
|
|
); |
707 |
|
|
} |
708 |
|
|
|
709 |
|
|
/* |
710 |
vpihour |
805 |
* Ajoute un div pour l'overlay dialog de jQuery |
711 |
|
|
*/ |
712 |
|
|
function addDivDialog(id){ |
713 |
|
|
|
714 |
|
|
$(id).prepend('<div id="dialog"></div>'); |
715 |
|
|
} |
716 |
|
|
|
717 |
|
|
/* |
718 |
|
|
Action au changement du select de la qualite du demandeur |
719 |
|
|
* */ |
720 |
|
|
function changeDemandeurType(id){ |
721 |
|
|
|
722 |
|
|
/*Si la qualite du demandeur est particulier */ |
723 |
|
|
if ( $('#' + id + ' option:selected').val() == 'particulier' ){ |
724 |
|
|
|
725 |
|
|
$('.personne_morale_fields input').each( |
726 |
|
|
function(){ |
727 |
|
|
$(this).val(''); |
728 |
|
|
} |
729 |
|
|
); |
730 |
|
|
$('.personne_morale_fields select option[value=""]').each( |
731 |
|
|
function(){ |
732 |
|
|
$(this).attr('selected', 'selected'); |
733 |
|
|
} |
734 |
|
|
); |
735 |
|
|
|
736 |
|
|
$('.personne_morale_fields').hide(); |
737 |
|
|
$('.particulier_fields').show(); |
738 |
|
|
} |
739 |
|
|
else { |
740 |
|
|
|
741 |
|
|
$('.particulier_fields input').each( |
742 |
|
|
function(){ |
743 |
|
|
$(this).val(''); |
744 |
|
|
} |
745 |
|
|
); |
746 |
|
|
$('.particulier_fields select option[value=""]').each( |
747 |
|
|
function(){ |
748 |
|
|
$(this).attr('selected', 'selected'); |
749 |
|
|
} |
750 |
|
|
); |
751 |
|
|
|
752 |
|
|
$('.particulier_fields').hide(); |
753 |
|
|
$('.personne_morale_fields').show(); |
754 |
|
|
} |
755 |
|
|
} |
756 |
|
|
|
757 |
|
|
/* |
758 |
vpihour |
793 |
Function de test des champs |
759 |
vpihour |
676 |
* */ |
760 |
vpihour |
669 |
function isAlpha(str) { |
761 |
vpihour |
664 |
return /^[a-zA-Z\/]+$/.test(str); |
762 |
|
|
} |
763 |
|
|
|
764 |
vpihour |
768 |
function isMail(str){ |
765 |
|
|
return /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(str); |
766 |
|
|
} |
767 |
|
|
|
768 |
|
|
function isPhoneNumber(str){ |
769 |
|
|
return /[0-9-()+]{3,20}/.test(str); |
770 |
|
|
} |
771 |
|
|
|
772 |
vpihour |
793 |
function testSeparator(obj){ |
773 |
|
|
|
774 |
|
|
if ( obj.value != 'A' && |
775 |
|
|
obj.value != '/' ) { |
776 |
|
|
|
777 |
|
|
alert('Saisissez uniquement un A ou un / comme séparateur'); |
778 |
|
|
obj.value = ''; |
779 |
|
|
} |
780 |
|
|
} |
781 |
|
|
|
782 |
|
|
/* FIN */ |
783 |
|
|
|
784 |
vpihour |
664 |
/* |
785 |
vpihour |
793 |
Ajoute les ations spécifiques pour le formulaire personnalisé d'ajout de |
786 |
|
|
référence cadastrale |
787 |
vpihour |
664 |
* */ |
788 |
|
|
function actionFormReferenceCadastrale(){ |
789 |
|
|
$('form').submit( |
790 |
|
|
function(){ |
791 |
|
|
|
792 |
vpihour |
812 |
getDataFieldReferenceCadastrale(); |
793 |
vpihour |
664 |
} |
794 |
|
|
); |
795 |
vpihour |
669 |
|
796 |
vpihour |
793 |
$('#moreFieldReferenceCadastrale' + |
797 |
|
|
($('.moreFieldReferenceCadastrale').length - 1 )). |
798 |
|
|
on("click", function() { |
799 |
vpihour |
669 |
$(this).before(newInputReferenceCadastrale()); |
800 |
vpihour |
664 |
}); |
801 |
vpihour |
762 |
|
802 |
vpihour |
664 |
} |
803 |
|
|
|
804 |
vpihour |
670 |
/* |
805 |
vpihour |
812 |
* Récupère les données saisies dans les champs de références cadastrales |
806 |
|
|
*/ |
807 |
|
|
function getDataFieldReferenceCadastrale(){ |
808 |
|
|
|
809 |
|
|
var reference_cadastrale = ''; |
810 |
|
|
var reference_cadastrale_temp = ''; |
811 |
|
|
|
812 |
|
|
$('.reference_cadastrale_custom_field').each( |
813 |
|
|
function(){ |
814 |
|
|
|
815 |
|
|
if ( $(this).val() == ';' ){ |
816 |
|
|
|
817 |
|
|
reference_cadastrale_bis = reference_cadastrale_temp ; |
818 |
|
|
|
819 |
|
|
while( reference_cadastrale_bis != ''){ |
820 |
|
|
if ( /^([0-9]{1,4}[a-zA-Z]{1,3}[0-9]{1,5}([A\/]{1}[0-9]{1,4})*)*$/.test(reference_cadastrale_bis) ){ |
821 |
|
|
|
822 |
|
|
reference_cadastrale += reference_cadastrale_bis + ";"; |
823 |
|
|
break; |
824 |
|
|
} |
825 |
|
|
else{ |
826 |
|
|
|
827 |
|
|
reference_cadastrale_bis = reference_cadastrale_bis.slice( 0, -1); |
828 |
|
|
} |
829 |
|
|
} |
830 |
|
|
|
831 |
|
|
|
832 |
|
|
reference_cadastrale_temp = ''; |
833 |
|
|
} |
834 |
|
|
|
835 |
|
|
else { |
836 |
|
|
|
837 |
|
|
reference_cadastrale_temp += $(this).val(); |
838 |
|
|
} |
839 |
|
|
|
840 |
|
|
} |
841 |
|
|
); |
842 |
|
|
|
843 |
|
|
$('#terrain_references_cadastrales').val(reference_cadastrale); |
844 |
|
|
} |
845 |
|
|
|
846 |
|
|
/* |
847 |
vpihour |
670 |
Action pour l'ajout de nouvelle ligne |
848 |
|
|
* */ |
849 |
vpihour |
669 |
function actionLineFormReferenceCadastrale(){ |
850 |
|
|
$('#morelineReferenceCadastrale').click( |
851 |
|
|
function(){ |
852 |
|
|
|
853 |
vpihour |
793 |
$('.reference_cadastrale_custom_fields'). |
854 |
|
|
append( "<br/>" + fieldReferenceCadastraleBase()); |
855 |
|
|
|
856 |
|
|
$('#moreFieldReferenceCadastrale'+ |
857 |
|
|
($('.moreFieldReferenceCadastrale').length - 1 )). |
858 |
|
|
on("click", function() { |
859 |
vpihour |
669 |
$(this).before(newInputReferenceCadastrale()); |
860 |
|
|
}); |
861 |
vpihour |
762 |
|
862 |
|
|
|
863 |
vpihour |
669 |
} |
864 |
|
|
); |
865 |
|
|
} |
866 |
|
|
|
867 |
vpihour |
664 |
/* |
868 |
vpihour |
793 |
Met à jour le select demande_type dès qu'un |
869 |
|
|
dossier_autorisation_type_detaille est choisi |
870 |
vpihour |
664 |
* */ |
871 |
vpihour |
641 |
function changeDemandeType(){ |
872 |
|
|
|
873 |
vpihour |
793 |
var idDossierAutorisationTypeDetaille = |
874 |
|
|
$("#dossier_autorisation_type_detaille option:selected").val(); |
875 |
vpihour |
641 |
|
876 |
vpihour |
812 |
/* Récupère les données saisies dans les champs pour la référence cadastrale */ |
877 |
|
|
getDataFieldReferenceCadastrale(); |
878 |
|
|
|
879 |
vpihour |
641 |
if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){ |
880 |
|
|
|
881 |
|
|
changeDataSelect('demande_type','dossier_autorisation_type_detaille'); |
882 |
vpihour |
664 |
if ( $('#demande_type option').size() < 2 ) |
883 |
|
|
showFormsDemande(); |
884 |
vpihour |
641 |
|
885 |
|
|
$('#demande_type').parent().parent().show(); |
886 |
vpihour |
651 |
|
887 |
vpihour |
812 |
formatFieldReferenceCadastrale(); |
888 |
vpihour |
641 |
} |
889 |
|
|
else { |
890 |
|
|
hideFields(); |
891 |
|
|
} |
892 |
|
|
} |
893 |
|
|
|
894 |
vpihour |
664 |
/* |
895 |
|
|
Ajoute le code HTML des champs pour les références cadastrales |
896 |
|
|
* */ |
897 |
|
|
function addNewFieldReferencesCadastrales(){ |
898 |
|
|
$('.references_cadastrales_new_field').remove(); |
899 |
vpihour |
669 |
$('.moreFieldReferenceCadastrale').remove(); |
900 |
vpihour |
672 |
$('#morelineReferenceCadastrale').remove(); |
901 |
vpihour |
793 |
$('.buttonCadAdr').remove(); |
902 |
vpihour |
664 |
$('.localisation .fieldsetContent').prepend( |
903 |
|
|
'<div class="field field-type-text references_cadastrales_new_field" >'+ |
904 |
|
|
'<div class="form-libelle">' + |
905 |
|
|
'<label '+ |
906 |
|
|
'class="libelle-terrain_references_cadastrales" '+ |
907 |
|
|
'for="terrain_references_cadastrales">'+ |
908 |
|
|
' terrain_references_cadastrales '+ |
909 |
|
|
'</label>' + |
910 |
|
|
'</div>' + |
911 |
|
|
'<div class="form-content reference_cadastrale_custom_fields">' + |
912 |
vpihour |
669 |
fieldReferenceCadastraleBase() + |
913 |
vpihour |
664 |
'</div>' + |
914 |
|
|
'</div>' + |
915 |
vpihour |
669 |
'<div class="field field-type-text" id="morelineReferenceCadastrale">' + |
916 |
vpihour |
664 |
'<div class="form-libelle"></div>' + |
917 |
|
|
'<div class="form-content">' + |
918 |
vpihour |
669 |
' + ajouter d\'autres lignes' + |
919 |
vpihour |
664 |
'</div>' + |
920 |
vpihour |
688 |
'</div>' |
921 |
vpihour |
664 |
); |
922 |
vpihour |
688 |
$('#terrain_superficie').parent().parent().after('<div class="field field-type-text" >' + |
923 |
|
|
'<div class="form-libelle"></div>' + |
924 |
vpihour |
793 |
'<div class="form-content buttonCadAdr">' + |
925 |
vpihour |
688 |
'<input id="cad-adr-them" class="ui-button ui-widget ui-state-default ui-corner-all" type="button" value="Cadastrale < = > Adresse"/>' + |
926 |
|
|
'</div>' + |
927 |
|
|
'</div>' ); |
928 |
vpihour |
664 |
} |
929 |
|
|
|
930 |
vpihour |
670 |
/* |
931 |
|
|
Séparateur caché ; |
932 |
|
|
* */ |
933 |
vpihour |
669 |
function hiddenSeparatorField(){ |
934 |
|
|
return '<input ' + |
935 |
|
|
'class="reference_cadastrale_custom_field " ' + |
936 |
|
|
'type="hidden" ' + |
937 |
|
|
'maxlength="2" ' + |
938 |
|
|
'size="2" ' + |
939 |
|
|
'value=";" />'; |
940 |
|
|
} |
941 |
|
|
|
942 |
vpihour |
670 |
/* |
943 |
|
|
Ajout d'une nouvelle ligne de champ |
944 |
|
|
* */ |
945 |
vpihour |
669 |
function fieldReferenceCadastraleBase(){ |
946 |
|
|
return '<input ' + |
947 |
|
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
948 |
|
|
'type="text" ' + |
949 |
|
|
'onchange="VerifNum(this)" ' + |
950 |
vpihour |
762 |
'maxlength="4" ' + |
951 |
|
|
'size="4" ' + |
952 |
vpihour |
669 |
'value="" />' + |
953 |
|
|
'<input ' + |
954 |
|
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
955 |
|
|
'type="text" ' + |
956 |
vpihour |
762 |
'maxlength="3" ' + |
957 |
|
|
'size="3" ' + |
958 |
|
|
'value="" '+ |
959 |
|
|
'onchange="if ( !isAlpha(this.value) ){ alert(\'Vous ne devez saisir que des lettres dans ce champs.\'); this.value = \'\'; }"/>' + |
960 |
vpihour |
669 |
'<input ' + |
961 |
|
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
962 |
|
|
'type="text" ' + |
963 |
|
|
'onchange="VerifNum(this)" ' + |
964 |
vpihour |
762 |
'maxlength="5" ' + |
965 |
|
|
'size="5" ' + |
966 |
vpihour |
669 |
'value="" />' + |
967 |
|
|
'<span id="moreFieldReferenceCadastrale' + $('.moreFieldReferenceCadastrale').length + '" class="moreFieldReferenceCadastrale">' + |
968 |
|
|
hiddenSeparatorField() + |
969 |
|
|
' + ajouter d\'autres champs' + |
970 |
|
|
'</span>'; |
971 |
|
|
} |
972 |
|
|
|
973 |
nhaye |
802 |
/** |
974 |
|
|
* Cache les champs inutules |
975 |
|
|
**/ |
976 |
vpihour |
641 |
function hideFields(){ |
977 |
nhaye |
802 |
$('.demande_hidden_bloc').each( |
978 |
vpihour |
641 |
function(){ |
979 |
nhaye |
802 |
$(this).hide(); |
980 |
vpihour |
641 |
} |
981 |
|
|
); |
982 |
|
|
|
983 |
|
|
$('.field-type-text').hide(); |
984 |
|
|
$('input[type=submit]').hide(); |
985 |
|
|
$('#demande_type').parent().parent().hide(); |
986 |
|
|
} |
987 |
|
|
|
988 |
vpihour |
664 |
/* |
989 |
|
|
Affiche les champs dont on a besoin |
990 |
|
|
* */ |
991 |
vpihour |
641 |
function showFormsDemande(){ |
992 |
nhaye |
802 |
$('.demande_hidden_bloc').each( |
993 |
vpihour |
641 |
function(){ |
994 |
nhaye |
802 |
$(this).show(); |
995 |
vpihour |
641 |
} |
996 |
|
|
); |
997 |
|
|
|
998 |
|
|
$('.field-type-text').show(); |
999 |
|
|
$('input[type=submit]').show(); |
1000 |
vpihour |
664 |
$('.terrain_references_cadastrales_custom').hide(); |
1001 |
|
|
|
1002 |
|
|
$('#terrain_references_cadastrales').parent().parent().hide(); |
1003 |
vpihour |
641 |
} |
1004 |
vpihour |
651 |
|
1005 |
vpihour |
664 |
/* |
1006 |
|
|
Action au clique sur le bouton " + ajouter d'autres champs" |
1007 |
|
|
* */ |
1008 |
vpihour |
651 |
function newInputReferenceCadastrale(){ |
1009 |
|
|
return '<input ' + |
1010 |
|
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
1011 |
|
|
'type="text" ' + |
1012 |
|
|
'maxlength="1" ' + |
1013 |
|
|
'size="1" ' + |
1014 |
vpihour |
741 |
'value="" ' + |
1015 |
|
|
'onchange="testSeparator(this);"/>' + |
1016 |
vpihour |
651 |
'<input ' + |
1017 |
|
|
'class="champFormulaire reference_cadastrale_custom_field" ' + |
1018 |
|
|
'type="text" ' + |
1019 |
|
|
'onchange="VerifNum(this)" ' + |
1020 |
|
|
'maxlength="4" ' + |
1021 |
|
|
'size="4" ' + |
1022 |
|
|
'value="" />'; |
1023 |
|
|
} |
1024 |
fmichon |
660 |
|
1025 |
vpihour |
741 |
|
1026 |
|
|
|
1027 |
fmichon |
784 |
/** |
1028 |
|
|
* Desactivation des fonctions widget du tableau de bord inutiles sur le nouveau |
1029 |
|
|
* tableau de bord |
1030 |
|
|
*/ |
1031 |
fmichon |
660 |
function widget_bind_move_actions() {} |
1032 |
|
|
function widget_bind_add_action() {} |
1033 |
|
|
function widget_bind_edit_actions(widget_selector) {} |
1034 |
|
|
|
1035 |
nhaye |
848 |
// Cette fonction permet d'associer a un arbre html les fonctions jquery |
1036 |
|
|
// necessaires. Elle permet notamment lors du chargement d'une page en ajax |
1037 |
|
|
// d'associer le comportement du bouton, la gestion du calendrier et la gestion |
1038 |
|
|
// du fieldset. |
1039 |
|
|
function om_initialize_content() { |
1040 |
|
|
// Gestion du skin des boutons, liens |
1041 |
|
|
link_bind_button(); |
1042 |
|
|
// Gestion du calendrier avec le widget datepicker de jqueryui |
1043 |
|
|
inputdate_bind_datepicker(); |
1044 |
|
|
// Gestion des fieldset avec le plugin collaspsible de jquery |
1045 |
|
|
fieldset_bind_collapsible(); |
1046 |
|
|
|
1047 |
|
|
changeDemandeurType('qualite'); |
1048 |
|
|
addSearchIcon(); |
1049 |
|
|
addDivDialog('.bloc_demandeur'); |
1050 |
vpihour |
881 |
} |
1051 |
|
|
|
1052 |
|
|
/* |
1053 |
|
|
* Marque comme lu une consultation |
1054 |
|
|
*/ |
1055 |
vpihour |
900 |
function markedAsRead(id, objet, objetc){ |
1056 |
vpihour |
881 |
|
1057 |
vpihour |
900 |
/*Vérifie que l'identifiant passé en paramètre est bien un chiffre |
1058 |
|
|
* et que le type d'objet est défini |
1059 |
|
|
* */ |
1060 |
|
|
if ( $.isNumeric(id) && objet != '' ){ |
1061 |
vpihour |
881 |
|
1062 |
vpihour |
900 |
donnees = "?ido=" + id + '&obj=' + objet + '&objk=' + objetc; |
1063 |
|
|
alert(donnees); |
1064 |
vpihour |
881 |
$.ajax({ |
1065 |
|
|
type: "GET", |
1066 |
|
|
url: "../app/marquer_comme_lu.php" + donnees , |
1067 |
|
|
cache: false, |
1068 |
|
|
success: function(html){ |
1069 |
|
|
|
1070 |
vpihour |
900 |
$('#sousform-' + objet + ' .message').remove(); |
1071 |
vpihour |
892 |
|
1072 |
|
|
/*Change la valeur affiché et affiche un message valide*/ |
1073 |
vpihour |
881 |
if ( $.parseJSON(html) == "Mise a jour effectue avec succes"){ |
1074 |
|
|
|
1075 |
|
|
$('#lu').html('Oui'); |
1076 |
vpihour |
900 |
$('#sousform-' + objet + ' .subtitle').after( |
1077 |
vpihour |
892 |
'<div ' + |
1078 |
|
|
'class="message ui-widget ui-corner-all ui-state-highlight ui-state-valid">' + |
1079 |
|
|
'<p>' + |
1080 |
|
|
'<span class="ui-icon ui-icon-info"></span>' + |
1081 |
|
|
'<span class="text">' + |
1082 |
|
|
$.parseJSON(html) + |
1083 |
|
|
'</span>' + |
1084 |
|
|
'</p>' + |
1085 |
|
|
'</div>' |
1086 |
|
|
); |
1087 |
vpihour |
881 |
} |
1088 |
vpihour |
892 |
/*Affichage d'une erreur*/ |
1089 |
|
|
else{ |
1090 |
vpihour |
900 |
$('#sousform-' + objet + ' .subtitle').after( |
1091 |
vpihour |
892 |
'<div ' + |
1092 |
|
|
'class="message ui-widget ui-corner-all ui-state-highlight ui-state-error">' + |
1093 |
|
|
'<p>' + |
1094 |
|
|
'<span class="ui-icon ui-icon-info"></span>' + |
1095 |
|
|
'<span class="text">' + |
1096 |
|
|
$.parseJSON(html) + |
1097 |
|
|
'</span>' + |
1098 |
|
|
'</p>' + |
1099 |
|
|
'</div>' |
1100 |
|
|
); |
1101 |
|
|
} |
1102 |
vpihour |
881 |
} |
1103 |
|
|
}); |
1104 |
|
|
} |
1105 |
|
|
} |