1$(document).on('click', '.set_spc_company_name', function() { //choix de la company si doublon 2 //on rempli le champ "spc_company_name" avec la valeur choisie puis on trigg le traitement. 3 var org_name_doublon = $(this).attr('data-val'); 4 let buttonNext = $(".general_inscription_form a[href=\'#next\']"); 5 if ($(this).attr('id') == 'org_name_ok') { //bouton rouge "NON Mon nom est bien ..." 6 //on recupere la liste des membership dispo pour cette org 7 var type_from = $("#new_member_admin").val(); 8 var from='check_inscription'; 9 if(type_from==1){from='new_member_admin'} 10 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 11 mod: 'membership_dispo_by_org_name', 12 vig:5, 13 from: from, 14 nom: org_name_doublon 15 }).done(function(data) { 16 if (data) { 17 $("#select_membership").html(data); 18 $("#select_membership").removeClass('d-none'); 19 $("#label_select_membership").removeClass('d-none'); 20 buttonNext.show(); //on affiche le bouton "next" 21 } 22 }); 23 }else{ 24 $('#spc_company_name').val(org_name_doublon); 25 $("#valid_org_name").trigger("click"); 26 } 27 28 29 /* OBSOLETE - 2026-07-29 30 var type_from = $("#new_member_admin").val(); 31 var from='check_inscription'; 32 if(type_from==1){from='new_member_admin'} 33 34 let buttonNext = $(".general_inscription_form a[href=\'#next\']"); 35 buttonNext.show(); 36 $("#result_ajax_company_name").html(''); //on vide le container de message 37 var org_name_doublon = $(this).attr('data-val'); 38 $(".org_name_unique").val(org_name_doublon); 39 40 if ($(this).attr('id') != 'org_name_ok') { 41 //on recupere la liste des membership dispo pour cette org 42 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 43 mod: 'membership_dispo_by_org_name', 44 vig:6, 45 from: from, 46 nom: org_name_doublon 47 }).done(function(data) { 48 if (data) { 49 $("#select_membership").html(data); 50 $("#select_membership").removeClass('d-none'); 51 //$("#valid_org_name").click(); //si on choisi un nom de la liste des doublons, on trigg le traitement. 52 } 53 }); 54 //$("#valid_org_name").click(); //si on choisi un nom de la liste des doublons, on trigg le traitement. 55 } else { 56 //on recupere la liste des membership dispo pour cette org 57 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 58 mod: 'membership_dispo_by_org_name', 59 vig:5, 60 from: from, 61 nom: org_name_doublon 62 }).done(function(data) { 63 if (data) { 64 $("#select_membership").html(data); 65 $("#select_membership").removeClass('d-none'); 66 } 67 }); 68 } */ 69}); 70 71 $(document).on('click', '#go_org_link', function() { 72 $('.go_org').show(); 73 $('#go_org_link').hide(); 74 $(".general_inscription_form a[href=\'#next\']").hide(); //on cache le btn next 75 $('#spc_company_name').prop('required',true); 76 }); 77 78 $(document).on('click', '#no_org', function() { //aucune org, on liste les membership individuel 79 $('#go_org_link').show(); 80 $('.go_org').hide(); 81 $('#spc_company_name').prop('required',false); 82 83 var type_from = $("#new_member_admin").val(); 84 var from='check_inscription'; 85 if(type_from==1){from='new_member_admin'} 86 87 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 88 mod: 'membership_dispo_by_org_name', 89 vig:4, 90 from: from, 91 }).done(function(data) { 92 if (data) { 93 $("#spc_company_name").val(''); 94 $("#select_membership").html(data); 95 $("#select_membership").removeClass('d-none'); 96 $("#label_select_membership").removeClass('d-none'); 97 $("#result_ajax_company_name").html(''); 98 $("#create_account_org_exist").val(''); 99 } 100 }); 101 let buttonNext = $(".general_inscription_form a[href=\'#next\']"); 102 buttonNext.show(); //on affiche le btn next 103 $("input[name='std[company_name]']").val(''); //on s'assure que company_name est vide 104 $("input[name='std[company_name]']").prop("required", false); 105 $("input[name='std[company_name]']").prop("readonly", true); //on ajoute readonly à company_name, c'est dans l'onglet membership qu'on valide la company 106 }); 107 108 109 $(document).ready(function() { 110 $('#bloc_prix_variable').hide(); //caché par default 111 $(".general_inscription_form a[href=\'#next\']").hide(); //le btn next est caché par default, pour forcer la validation de la compagnie 112 /**** pour declencher le datepicker quand on clique sur le input */ 113 $("[type='date']").on("click", function(e) { 114 "showPicker" in this && this.showPicker(); 115 }); 116 $("[name='cate_fiq']").on("change", function() { 117 var typeMembre = $(this).val(); 118 var create_account_org_exist=$('#create_account_org_exist').val(); 119 var org_name=$('#spc_company_name').val(); 120 var indiv = $("[name='cate_fiq'] option").filter(":selected").attr("individuel"); 121 var type_from = $("#new_member_admin").val(); 122 123 //les onglet du formulaire qui son "done" sont remis à "disabled" pour forcer la validation (les champ std et custom sont effacé qd on change de cate_fiq) 124 $('#form_inscription_membre li.done').addClass("disabled"); 125 $('#form_inscription_membre li.done').removeClass("done"); 126 127 //************************* CHAMP CUSTOM *********************************** 128 //CHAMP CUSTOM : on reload les champs si on change le type de membership 129 var msg_no_cfield=0; 130 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 131 mod: "reload_custom_field", 132 cate_fiq: typeMembre, 133 org_name:org_name, 134 create_account_org_exist:create_account_org_exist 135 }).done(function (data) { 136 if (data) {$("#wrapper_champ_custom_inscription").html(data);} 137 else{msg_no_cfield=1} 138 }); 139
140 //afficher cacher le msg "pas d'info supplémentaire" 141 if(msg_no_cfield==1 && $("#msg_no_cfield").hasClass("d-none") && type_from!=1){ 142 $("#msg_no_cfield").removeClass("d-none"); 143 $("#msg_no_cfield").addClass("d-block"); 144 }else if($("#msg_no_cfield").hasClass("d-block")){ 145 $("#msg_no_cfield").removeClass("d-block"); 146 $("#msg_no_cfield").addClass("d-none"); 147 } 148 //**************************** FIN CHAMP CUSTOM ***************************** 149 150 //afficher/cacher le champ company dans les champs std 151 if (indiv == 0) { 152 $("#auto_org_relie").show(); 153 $("#spc_company_name").attr("required", ""); //si indiv=0 => spc_company_name obligatoire 154 }else if(indiv == 2){ //indiv == 2 => membership type DUO/GROUPE 155 $("#auto_org_relie").hide(); 156 $(".ChampsCustomorganisation").hide(); 157 }else { 158 $("#auto_org_relie").show(); 159 $("#spc_company_name").removeAttr("required"); 160 } 161 162 //reload std field pour trier les champs en fonction du membership 163 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 164 mod: "reload_std_field", 165 cate_fiq: typeMembre, 166 }).done(function (data) { 167 if (data) { 168 $("#std_field_wrapper").html(data); 169 //reload du DOM std_field_wrapper donc on recopie le nom de company 170 $("input[name='std[company_name]']").val($(".org_name_unique").val()); 171 $("input[name='std[company_name]']").prop("required", false); 172 $(document).ready(function() { 173 $('input[name=\"std[company_name]\"]').prop('readonly', true); //company_name toujours en readonly à l'inscription donc pas de placeholder ni de required 174 $('input[name=\"std[company_name]\"]').attr('placeholder',''); 175 $('input[name=\"std[company_name]\"]').prop('required', false); 176 }); 177 //reload les mask dans le nouveau DOM std_field_wrapper 178 $(".mask_date").inputmask("99-99-9999"); 179 $(".mask_postalcode").inputmask("a9a 9a9"); 180 $(".mask_phone_full").inputmask("999 999-9999 \\#9999"); 181 $(".mask_phone").inputmask("999 999-9999"); 182 183 //DOM email_check 184 $("#email_check").on("blur", function(e) { 185 if( $('#form_inscription_membre').length ) { 186 valueLogin = this.value; 187 if ($("#Login").attr("id_elem") == "") self = ""; 188 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 189 mod: "Login", 190 val: valueLogin, 191 self: self, 192 }).done(function (data) { 193 194 if (data != "") { 195 $("#result_ajax_Login").html(data); 196 $("#Login").val(self); 197 // $("#Login").val(""); //si le courriel est deja utilise on vide le login 198 } else { 199 //console.log("data == ''", data); 200 $("#result_ajax_Login").html(""); 201 $("#Login").val(valueLogin); //copier le courriel dans le Login à la création du compte 202 } 203 }); 204 } 205 //$("#Login").attr("value", this.value); //copier le courriel dans le Login à la création du compte 206 }); 207 // Use window.applyPhoneMask guard to avoid error 208 if (window.applyPhoneMask && typeof window.applyPhoneMask === 'function') { 209 applyPhoneMask(".mask_phone_ext1", "999 999 9999", "999 999 9999 p.999999"); 210 applyPhoneMask(".mask_phone_ext2", "999 999-9999", "999 999-9999 p.999999"); 211 applyPhoneMask(".mask_phone_ext3", "999-999-9999", "999-999-9999 p.999999"); 212 } 213 214 } 215 }); 216 217 //check si is_prix_variable actif, si oui, on affiche le champ montant 218 var prix_variable = $("[name='cate_fiq'] option").filter(":selected").attr("is_prix_variable"); 219 if(prix_variable == 1){ 220 $('#bloc_prix_variable').show(); 221 if( $('#form_create_membership').length ){ 222 var min_prix=$("[name='cate_fiq'] option").filter(":selected").attr("montant"); 223 }else{ 224 var min_prix=$("[name='cate_fiq'] option").filter(":selected").attr("renew_montant"); 225 } 226 $("#input_prix_variable").attr("min", min_prix); 227 $("#prix_variable_minimum").html(min_prix); 228 }else{ 229 $('#bloc_prix_variable').hide(); 230 } 231 232 //check si desactive_extracost actif, si oui on cache le produit extra (abonnement journal) 233 if( $('#bloc_desactive_extracost').length ){ 234 var desactive_extracost = $("[name='cate_fiq'] option").filter(":selected").attr("desactive_extracost"); 235 if(desactive_extracost == 1){ 236 $('#bloc_desactive_extracost').hide(); 237 }else{ 238 $('#bloc_desactive_extracost').show(); 239 } 240 } 241 242 //maj de la date d'expiration si devenir membre depuis l'admin 243 if(type_from==1){ 244 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 245 mod: "get_date_renew", 246 cate_fiq: typeMembre, 247 new_member_admin:type_from 248 }).done(function (data) { 249 if(data){ 250 $('input[name=\"date_renew\"]').val(data); 251 } 252 }); 253 } 254 }); 255 256 //nom d'organisation unique 257 $('#spc_company_name').on("keydown", function() { //on change le company_name => on vide le message / on vide la selection de membership pour forcer à revalider le nom / on vide le champ caché create_account_org_exist 258 $('#select_membership').html(''); 259 $("#result_ajax_company_name").html(''); 260 $('#select_membership').addClass('d-none'); 261 $('#label_select_membership').addClass('d-none'); 262 $(".general_inscription_form a[href=\'#next\']").hide(); 263 $("#create_account_org_exist").val(''); 264 }); 265 266 //creation de compte mod contact seulement, le champ compagnie est modifiable dans les infos général, 267 /*$('#auto_org_relie').on("blur", function() { // ----------------------------------------------------------------- N'est plus actif, pb de js chez les clients, on soumet un mini form avec le nom de l'org, voir DashboardController::form_set_org() 268 var nom = $("#auto_org_relie").val(); 269 var cust_id = $("#create_account_org_exist").attr('id_elem'); 270 if(nom!=""){ 271 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 272 mod: "create_account_org_exist", 273 nom:nom, 274 cust_id:cust_id 275 }).done(function (data) { 276 $("#create_account_org_exist").val(data); 277 console.log(data); 278 console.log($(".address_type_org")); 279 if(data>0){ 280 $(".address_type_org").addClass("d-none"); $(".address_type_org").removeClass("d-block"); 281 $(".ChampsCustomorganisation").addClass("d-none"); $(".ChampsCustomorganisation").removeClass("d-block"); 282 }else{ 283 $(".address_type_org").addClass("d-block"); $(".address_type_org").removeClass("d-none"); 284 $(".ChampsCustomorganisation").addClass("d-block"); $(".ChampsCustomorganisation").removeClass("d-none"); 285 } 286 287 //si edition on autosave le company_id (NOTE on ne devrait pas etre en edition avec mod=create_account_org_exist à REVOIR) 288 var id_elem = $("#create_account_org_exist").attr('id_elem'); 289 if(id_elem>0 && data>0){ 290 $("#create_account_org_exist").val(data).trigger('change'); 291 } 292 }); 293 } 294 });*/ 295 $('[data-fichier="adresse.php"] .msgAucun').hide(); 296 $('#msg_no_cfield').addClass('d-none'); 297 //creation compte membre, validation du nom de compagnie 298 $('#valid_org_name').on("click", function() { 299 var type_from = $("#new_member_admin").val(); 300 var from='check_inscription'; 301 if(type_from==1){from='new_member_admin'} 302 303 //mettre à jour le champ hidden "create_account_org_exist" avec l'id de l'org
304 //afficher/cacher les champs org custom/adress si inscription frontend 305 var nom; 306 nom=$("#spc_company_name").val(); 307 308 // alert("["+nom+"] - ["+nom.trim()+"]"); 309 nom = nom.trim(); 310 311 if(nom!=""){ 312 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 313 mod: "create_account_org_exist", 314 nom:nom 315 }).done(function (data) { 316 $("#create_account_org_exist").val(data); 317 if(from=='check_inscription'){ 318 if(data>0){ 319 if($('[data-fichier="adresse.php"] .sectionAddrInscrip').length==1 && $('[data-fichier="adresse.php"] .sectionAddrInscrip').first().hasClass('address_type_org')){ 320 $('[data-fichier="adresse.php"] .msgAucun').show(); 321 } 322 if($('#wrapper_champ_custom_inscription .ChampsCustomorIndividuel .lesChampsCustom').length==0){ 323 $('#msg_no_cfield').removeClass('d-none'); 324 } 325 $(".address_type_org").addClass("d-none"); $(".address_type_org").removeClass("d-block"); 326 $(".ChampsCustomorganisation").addClass("d-none"); $(".ChampsCustomorganisation").removeClass("d-block"); 327 }else{ 328 $('[data-fichier="adresse.php"] .msgAucun').hide(); 329 $(".address_type_org").addClass("d-block"); $(".address_type_org").removeClass("d-none"); 330 $(".ChampsCustomorganisation").addClass("d-block"); $(".ChampsCustomorganisation").removeClass("d-none"); 331 } 332 } 333 }); 334 } 335 336 337 $("input[name='std[company_name]']").val($(".org_name_unique").val()); //copier l'org dans le champ "company_name" dans les champ standard 338 //si l'id du champ != "company_name" (par exemple section selection de membership : choix de la company VS le champ standard company), on ajoute un readonly 339 var id_elem = $(".org_name_unique").attr("id"); 340 if (id_elem != "company_name") { 341 $("input[name='std[company_name]']").prop("required", false); 342 $("input[name='std[company_name]").prop("readonly", true); 343 } 344 345 let buttonNext = $(".general_inscription_form a[href=\'#next\']"); 346 let input_org_name = $('#spc_company_name'); 347 buttonNext.show(); //on commence par afficher le btn next qu'on cache si la config membre_principal_inscription est 0 (cas on vide le champ nom org pour en mettre un autre) 348 $("#result_ajax_company_name").html(''); //on vide le container de message (cas on vide le champ nom org pour en mettre un autre) 349 350 var is_create_user = $(".org_name_unique").attr("create_user"); 351 var ClassEntreprise = $(".ChampsCustomorganisation"); 352 if (ClassEntreprise) { 353 $(".ChampsCustomorganisation").show(); 354 $(".ChampsCustomorganisation").removeClass("sectionInterdite"); 355 } 356 357 // alert("["+input_org_name.value+"] - ["+input_org_name.value.trim()+"]"); 358 // alert("["+input_org_name.value+"]"); 359 if (input_org_name.value != "" && nom!="") { 360 /** 361 * VG-069524 362 * Doit pouvoir determiner si l'org existe deja 363 */ 364 textElement = $(input_org_name); 365 366 fetch("/boutique/ajax/auto_company.php?term=" + input_org_name.value, { 367 method: "get", 368 }) 369 .then((r) => r.json()) 370 .then((json) => { 371 $(textElement).attr("org-id", ""); 372 373 json.forEach(function(companyInfo) { 374 if ($(textElement).attr("org-id") != "") { 375 return; 376 } 377 378 if (companyInfo.value === $(textElement).val()) { 379 $(textElement).attr("org-id", companyInfo.id); 380 } 381 }); 382 }) 383 .catch(alert); 384 /** 385 * VG-069524 386 */ 387 /* definir les champs adresse entreprise */ 388 const champs_compagnie = [ 389 "addr[1][entry_street_address]", 390 "addr[1][entry_address_extra]", 391 "addr[1][entry_city]", 392 "addr[1][entry_state]", 393 "addr[1][entry_postcode]", 394 "addr[1][entry_country]", 395 "addr[1][municipalite]", 396 "addr[1][region_id]", 397 "addr[1][secteur]", 398 ]; 399 const streetCompagnie = document.getElementsByName( 400 "addr[1][entry_street_address]" 401 ); 402 const apptCompagnie = document.getElementsByName( 403 "addr[1][entry_address_extra]" 404 ); 405 const VilleCompagnie = document.getElementsByName("addr[1][entry_city]"); 406 const ProvinceCompagnie = document.getElementsByName( 407 "addr[1][entry_state]" 408 ); 409 const CodePostalCompagnie = document.getElementsByName( 410 "addr[1][entry_postcode]" 411 ); 412 const CountryCompagnie = document.getElementsByName( 413 "addr[1][entry_country]" 414 ); 415 const MunicipaliteCompagnie = document.getElementsByName( 416 "addr[1][municipalite]" 417 ); 418 const RegionCompagnie = document.getElementsByName("addr[1][region_id]"); 419 const SecteurCompagnie = document.getElementsByName("addr[1][secteur]"); 420 421 422 var self = $(".org_name_unique").attr("self"); 423 var idCompany = $("#create_account_org_exist").val(); 424 var typeMembership = $("[name='cate_fiq']").val(); 425 var input_val = $(".org_name_unique").val(); 426 427 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 428 mod: "company_name", 429 input_val: input_val, 430 val: idCompany, 431 typeMembership: typeMembership, 432 from: from, 433 self: self, 434 }).done(function(data) { 435 $(".org_name_unique").attr("org-id", ''); //on vide l'attrib org-id (cas on vide le champ nom org pour en mettre un autre) 436 /* effacer les champs adresse entreprise */ 437 champs_compagnie.forEach((name) => { 438 const elements = document.getElementsByName(name); 439 if (elements[0]) { 440 elements[0].value = ""; 441 elements[0].focus(); 442 } 443 }); 444 if (data) dataParsed = JSON.parse(data); 445 if (typeof dataParsed !== "undefined" && dataParsed.type == 1 /*&& typeMembership!=''*/ ) { 446 $("#result_ajax_company_name").html(dataParsed.result); 447 //$(".org_name_unique").val(self); 448 if (is_create_user == 1) { 449 //type 1 : config membre_principal_inscription=0 : "les membres doivent être inscrit par lâadministrateur" => on cache le bouton next //buttonNext.hide(); 450 //on permet l'inscription comme membre seulement 451 if (dataParsed.list_membership) { 452 $('#select_membership').html(dataParsed.list_membership); 453 $('#select_membership').removeClass('d-none'); 454 //$('#select_membership').addClass('d-block'); 455 buttonNext.show(); 456 }else{ 457 buttonNext.hide(); 458 } 459 } 460 } else { 461 if (typeof dataParsed !== "undefined" && dataParsed.type == 2) { 462 $('.adresse_section_1').removeClass('d-none'); 463 adresse = dataParsed.result.adresse; 464 if (streetCompagnie[0]) 465 streetCompagnie[0].value = adresse.entry_street_address; 466 if (apptCompagnie[0]) 467 apptCompagnie[0].value = adresse.entry_address_extra; 468 if (VilleCompagnie[0]) VilleCompagnie[0].value = adresse.entry_city; 469 if (ProvinceCompagnie[0]) 470 ProvinceCompagnie[0].value = adresse.entry_state; 471 if (CodePostalCompagnie[0]) 472 CodePostalCompagnie[0].value = adresse.entry_postcode; 473 if (CountryCompagnie[0]) 474 CountryCompagnie[0].value = adresse.entry_country; 475 if (MunicipaliteCompagnie[0]) 476 MunicipaliteCompagnie[0].value = adresse.municipalite; 477 if (RegionCompagnie[0]) 478 RegionCompagnie[0].value = adresse.region_id; 479 if (SecteurCompagnie[0]) 480 SecteurCompagnie[0].value = adresse.secteur; 481 /***** debut traitement champs custom ********/ 482 listeChamps = dataParsed.result.custom_fields_value; 483 $.each(listeChamps, function(key, unchamp) { 484 chercher = "custom_form[" + key + "]"; 485 // dans le cas d un champs pas texte ni date ni checkbox ni interrupteur 486 if ( 487 unchamp.type != "text" && 488 unchamp.type != "date" && 489 unchamp.type != "Interrupteur" 490 ) 491 chercher ="custom_form[" + unchamp.type + "_" + unchamp.id + "]"; 492 // dans le cas d un checkbox 493 if (unchamp.type == "checkbox") chercher = chercher + "[]"; 494 option = ""; 495 if (unchamp.type == "select") option = " option"; 496 // chercher les champs custom avec ce nom 497 elements = document.getElementsByName(chercher); 498 $("[name='" + chercher + "'] " + option + "").each(function( 499 index, 500 vals 501 ) { 502 value = unchamp.value; 503 if (value instanceof Array) { 504 // dans le cas ou cest plusieurs valeurs 505 value.forEach((v) => { 506 if (v == $(this).val()) { 507 $(this).prop("checked", true); 508 $(this).prop("selected", true); 509 } 510 }); 511 } else { 512 // dans le cas d un checkbox ou radio on ne change pas de valeur 513 if (unchamp.type == "Interrupteur") { 514 if ( 515 $("#choix1_interrupteur_" + unchamp.id + "") && 516 $("#choix1_interrupteur_" + unchamp.id + "").val() == 517 value 518 ) { 519 label = $( 520 "#label1_interrupteur_" + unchamp.id + "" 521 ).val(); 522 } 523 if ( 524 $("#choix2_interrupteur_" + unchamp.id + "") && 525 $("#choix2_interrupteur_" + unchamp.id + "").val() == 526 value 527 ) { 528 label = $( 529 "#label2_interrupteur_" + unchamp.id + "" 530 ).val(); 531 } 532 533 if ( 534 typeof label !== "undefined" && 535 $("#label_interrupteur_" + unchamp.id + "").html() != 536 label 537 ) 538 $('[id_input="field_' + unchamp.id + '"]').click(); 539 } 540 if ( 541 unchamp.type != "checkbox" && 542 unchamp.type != "radio" && 543 unchamp.type != "select" && 544 unchamp.type != "Interrupteur" 545 ) { 546 $(this).val(value); 547 } 548 if (value == $(this).val()) { 549 $(this).prop("checked", true); 550 $(this).prop("selected", true); 551 } 552 } 553 }); 554 }); 555 /***** fin traitement champs custom ********/ 556 //on recupere la liste des membership dispo pour cette org 557 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 558 mod: 'membership_dispo_by_org_name', 559 vig:3, 560 from: from, 561 nom: $("#spc_company_name").val() 562 }).done(function(data) { 563 if (data) { 564 $("#select_membership").html(data); 565 $("#select_membership").removeClass('d-none'); 566 $("#label_select_membership").removeClass('d-none'); 567 //$("#valid_org_name").click(); //si on choisi un nom de la liste des doublons, on trigg le traitement. 568 } 569 }); 570 571 } else if ( 572 typeof dataParsed !== "undefined" && 573 dataParsed.type == 3 574 ) { 575 var ClassEntreprise = $(".ChampsCustomorganisation"); 576 if (ClassEntreprise) { 577 $(".ChampsCustomorganisation").hide(); 578 $(".ChampsCustomorganisation").addClass("sectionInterdite"); 579 } 580 //on recupere la liste des membership dispo pour cette org 581 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 582 mod: 'membership_dispo_by_org_name', 583 vig:2, 584 from: from, 585 nom: $("#spc_company_name").val() 586 }).done(function(data) { 587 if (data) { 588 $("#select_membership").html(data); 589 $("#select_membership").removeClass('d-none'); 590 $("#label_select_membership").removeClass('d-none'); 591 //$("#valid_org_name").click(); //si on choisi un nom de la liste des doublons, on trigg le traitement. 592 } 593 }); 594 } else if ( 595 typeof dataParsed !== "undefined" && 596 dataParsed.type == 0 //nouvelle org 597 ) { 598 //on recupere la liste des membership dispo pour cette org 599 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 600
600 mod: 'membership_dispo_by_org_name', 601 from: from, 602 vig:1, 603 nom: $("#spc_company_name").val() 604 }).done(function(data) { 605 if (data) { 606 $("#select_membership").html(data); 607 $("#select_membership").removeClass('d-none'); 608 $("#label_select_membership").removeClass('d-none'); 609 //$("#valid_org_name").click(); //si on choisi un nom de la liste des doublons, on trigg le traitement. 610 } 611 }); 612 } 613 614 $("#result_ajax_company_name").html(""); 615 if (is_create_user == 1) { 616 $("#company_name").val($(".org_name_unique").val()); //copier l'org dans le champ "company_name" dans les champ standard 617 //si l'id du champ != "company_name" (par exemple section selection de membership : choix de la company VS le champ standard company), on ajoute un readonly 618 var id_elem = $(".org_name_unique").attr("id"); 619 if (id_elem != "company_name") { 620 $("#company_name").prop("required", false); 621 $("#company_name").prop("readonly", true); 622 } 623 } 624 } 625 }); 626 } 627 }); 628 629 //VG-081159 Contact to member : check des champs custom obligatoire pour le membership 630 $(".user_to_member").on("change", function() { 631 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 632 mod: "user_to_member_custom_field", 633 val: this.value, 634 }).done(function(data) { 635 if (data) { 636 $("#user_to_member_custom_field").html(data); 637 } 638 }); 639 }); 640 641 //auto-complete nom de l'organisation 642 $(".auto_complete_org").autocomplete({ 643 source: "/boutique/ajax/auto_company.php", 644 select: function(event, ui) { 645 event.preventDefault(); 646 $(".auto_complete_org").val(ui.item.value); 647 $(".auto_complete_org").attr("org-id", ui.item.id); 648 }, 649 }); 650 651 $("#Login").on("blur", function() { 652 if (this.value != "") { 653 var self = $("#Login").attr("self"); 654 if ($("#Login").attr("id_elem") == "") self = ""; //si on est en creation dec compte on doit pas comparer self avec value sinon on declanche pas lerreur de code existe dejs 655 656 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 657 mod: "Login", 658 val: this.value, 659 self: self, 660 }).done(function(data) { 661 if (data) { 662 $("#result_ajax_Login").html(data); 663 $("#Login").val(self); 664 } else { 665 $("#result_ajax_Login").html(""); 666 } 667 }); 668 } 669 }); 670 671 $("#password2").on("blur", function(e) { 672 if (this.value != "") { 673 var pass1 = $("#password").val(); 674 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 675 mod: "password2", 676 pass2: this.value, 677 pass1: pass1, 678 }).done(function(data) { 679 if (data) { 680 $("#result_ajax_password2").html(data); 681 $("#password2").val(""); 682 } else { 683 $("#result_ajax_password2").html(""); 684 } 685 }); 686 } 687 }); 688 689 $("#email_check").on("blur", function (e) { 690 if ($("#form_inscription_membre").length) { 691 //check Login with ajax 692 var self = $(this).attr("self"); 693 //ziridha 694 if ($("#Login").attr("id_elem") == "") self = ""; 695 696 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 697 mod: "Login", 698 val: this.value, 699 self: self, 700 }).done(function (data) { 701 if (data) { 702 $("#Login").attr("value", ""); //si le courriel est deja utilise on vide le login 703 } else { 704 $("#Login").attr("value", this.value); //copier le courriel dans le Login à la création du compte 705 } 706 }); 707 708 //validation format courriel 709 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; 710 if (reg.test(this.value) == false) 711 { 712 $(this).val(''); 713 alert('Format du courriel incorrect.'); 714 } 715 } 716 }); 717 718 $("#update_password_btn").on("click", function(e) { 719 var mod = $("#password_mod").val(); 720 if ($("#password2").val() != "") { 721 var pass1 = $("#password").val(); 722 var pass2 = $("#password2").val(); 723 $.post("/gi2-modules/standard/membre/client/inc/ajax_input.php", { 724 mod: "password2", 725 pass2: pass2, 726 pass1: pass1, 727 }).done(function(data) { 728 if (data) { 729 $("#result_ajax_password2").html(data); 730 $("#password2").val(""); 731 } else { 732 $("#result_ajax_password2").html(""); 733 //maj password 734 $.post( 735 "/gi2-modules/standard/membre/client/inc/update_password_" + 736 mod + 737 ".php", { 738 mod: mod, 739 password: pass1, 740 } 741 ).done(function(data) { 742 $("#result_ajax_password2").html(data); 743 }); 744 } 745 }); 746 $.ajaxSetup({ 747 async: true 748 }); 749 } 750 }); 751 /* O B S O L E T E 752 753 $("#trigger_indiv").on("click", function(e) { 754 var ClassEntreprise = $(".ChampsCustomorganisation"); 755 if (ClassEntreprise) $(".ChampsCustomorganisation").hide(); 756 var ClassIndiv = $(".ChampsCustomorIndividuel"); 757 if (ClassIndiv) $(".ChampsCustomorIndividuel").show(); 758 759 var has_class = $("#section_indiv").hasClass("d-none"); 760 if (has_class) { 761 $("#section_indiv").removeClass("d-none"); 762 $("#section_indiv").addClass("d-block"); 763 } 764 765 var has_class2 = $("#section_org").hasClass("d-block"); 766 if (has_class2) { 767 $("#section_org").removeClass("d-block"); 768 $("#section_org").addClass("d-none"); 769 } 770 771 var has_class3 = $("#section_user").hasClass("d-block"); 772 if (has_class3) { 773 $("#section_user").removeClass("d-block"); 774 $("#section_user").addClass("d-none"); 775 } 776 }); 777 778 $("#trigger_org").on("click", function(e) { 779 var ClassEntreprise = $(".ChampsCustomorganisation"); 780 if (ClassEntreprise) { 781 $(".ChampsCustomorganisation").show(); 782 $(".ChampsCustomorganisation.sectionInterdite").hide(); 783 $(".adresse_section_1").show(); 784 $(".adresse_section_1.sectionInterdite").hide(); 785 } 786 787 var has_class = $("#section_org").hasClass("d-none"); 788 if (has_class) { 789 $("#section_org").removeClass("d-none"); 790 $("#section_org").addClass("d-block"); 791 } 792 793 var has_class2 = $("#section_indiv").hasClass("d-block"); 794 if (has_class2) { 795 $("#section_indiv").removeClass("d-block"); 796 $("#section_indiv").addClass("d-none"); 797 } 798 799 var has_class3 = $("#section_user").hasClass("d-block"); 800 if (has_class3) { 801 $("#section_user").removeClass("d-block"); 802 $("#section_user").addClass("d-none"); 803 } 804 }); 805 806 $("#trigger_user").on("click", function(e) { 807 var ClassEntreprise = $(".ChampsCustomorganisation"); 808 if (ClassEntreprise) $(".ChampsCustomorganisation").hide(); 809 var ClassIndiv = $(".ChampsCustomorIndividuel"); 810 if (ClassIndiv) $(".ChampsCustomorIndividuel").show(); 811 $(".lesChampsCustom").hide(); 812 $(".class_typeM_ALL").show(); 813 814 var has_class = $("#section_user").hasClass("d-none"); 815 if (has_class) { 816 $("#section_user").removeClass("d-none"); 817 $("#section_user").addClass("d-block"); 818 } 819 820 var has_class2 = $("#section_indiv").hasClass("d-block"); 821 if (has_class2) { 822 $("#section_indiv").removeClass("d-block"); 823 $("#section_indiv").addClass("d-none"); 824 } 825 826 var has_class3 = $("#section_org").hasClass("d-block"); 827 if (has_class3) { 828 $("#section_org").removeClass("d-block"); 829 $("#section_org").addClass("d-none"); 830 } 831 }); */ 832 833 //$('#input_tel_travail, #tel_alternatif, #numero_urgence, #Cellulaire').inputmask('999 999-9999');//VG-076430 834 }); 835 836 /*------------------------------------------------- password strong --------------------------------------------------*/ 837 838 $(document).ready(function() { 839 $("#password").keyup(function() { 840 check_pass(); 841 }); 842 }); 843 844 function check_pass() { 845 var main_lg = $("#main_lg").val(); 846 var val = document.getElementById("password").value; 847 var meter = document.getElementById("meter"); 848 var no = 0; 849 if (val != "") { 850 // If the password length is less than or equal to 6 851 if (val.length <= 6) no = 1; 852 853 // If the password length is greater than 6 and contain any lowercase alphabet or any number or any special character 854 if ( 855 val.length > 6 && 856 (val.match(/[a-z]/) || 857 val.match(/\d+/) || 858 val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) 859 ) 860 no = 2; 861 862 // If the password length is greater than 6 and contain alphabet,number,special character respectively 863 if ( 864 val.length > 6 && 865 ((val.match(/[a-z]/) && val.match(/\d+/)) || 866 (val.match(/\d+/) && val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) || 867 (val.match(/[a-z]/) && val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/))) 868 ) 869 no = 3; 870 871 // If the password length is greater than 6 and must contain alphabets,numbers and special characters 872 if ( 873 val.length > 6 && 874 val.match(/[a-z]/) && 875 val.match(/\d+/) && 876 val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) 877 ) 878 no = 4; 879 880 if (no == 1) { 881 $("#meter").animate({ 882 width: "50px" 883 }, 00); 884 meter.style.backgroundColor = "red"; 885 if (main_lg == "EN") 886 document.getElementById("pass_type").innerHTML = "Weak"; 887 else document.getElementById("pass_type").innerHTML = "Faible"; 888 } 889 890 if (no == 2) { 891 $("#meter").animate({ 892 width: "100px" 893 }, 00); 894 meter.style.backgroundColor = "#F5BCA9"; 895 if (main_lg == "EN") 896 document.getElementById("pass_type").innerHTML = "Fair"; 897 else document.getElementById("pass_type").innerHTML = "Medium"; 898 } 899 900 if (no == 3) { 901 $("#meter").animate({ 902 width: "150px" 903 }, 00); 904 meter.style.backgroundColor = "#FF8000"; 905 if (main_lg == "EN") 906 document.getElementById("pass_type").innerHTML = "Good"; 907 else document.getElementById("pass_type").innerHTML = "Bon"; 908 } 909 910 if (no == 4) { 911 $("#meter").animate({ 912 width: "200px" 913 }, 00); 914 meter.style.backgroundColor = "#00FF40"; 915 if (main_lg == "EN") 916 document.getElementById("pass_type").innerHTML = "Strong"; 917 else document.getElementById("pass_type").innerHTML = "Fort"; 918 } 919 } else { 920 meter.style.backgroundColor = "white"; 921 document.getElementById("pass_type").innerHTML = ""; 922 } 923 } 924 925 /*------------------------------------------------- form multi step http://www.jquery-steps.com/ --------------------------------------------------*/ 926 927 var form_inscription = $("#form_inscription_membre"); 928 929 form_inscription.children("div").steps({ 930 headerTag: "span.h3", 931 bodyTag: "section.form_step", 932 transitionEffect: "slideLeft", 933 /*onStepChanging: function (event, currentIndex, newIndex) { 934 form_inscription.validate().settings.ignore = ":disabled,:hidden"; 935 return form_inscription.valid(); 936 },*/ 937 onInit: function(event, currentIndex) { 938 $(".steps ul li").each(function(index) { 939 var $li = $(this); 940 var $section = $("section.form_step").eq(index); 941 var fichierClass = $section.data("fichier"); 942 var link = $(this).find("a"); 943 944 if (fichierClass) { 945 link.addClass("step-" + fichierClass); 946 } 947 948 // Add state classes 949 if (index < currentIndex) { 950 $li.addClass("completed-step"); 951 } else if (index === currentIndex) { 952 $li.addClass("active-step"); 953 } else {
954 $li.addClass("pending-step"); 955 } 956 }); 957 }, 958 onStepChanging: function(event, currentIndex, newIndex) { 959 960 // validate only when going forward 961 if (currentIndex < newIndex) { 962 form_inscription.validate().settings.ignore = ":disabled,:hidden"; 963 if (!form_inscription.valid()) { 964 if (document.getElementById('requiredFieldsModal')) 965 { 966 var modal_erreur = new bootstrap.Modal(document.getElementById('requiredFieldsModal')); 967 modal_erreur.show(); 968 } 969 }else{ 970 // Trigger function if next section has trigger-function attribute 971 // ceci va nous aider si ona abesoin de cacher/afficher quelque chose dans la section suivante 972 var $sections = form_inscription.children("div").find("section"); 973 var $nextSection = $sections.eq(newIndex); 974 if ($nextSection && $nextSection.length) { 975 var triggerFn = $nextSection.attr("trigger-function"); 976 if (triggerFn && typeof window[triggerFn] === "function") { 977 window[triggerFn](); 978 } 979 } 980 } 981 982 return form_inscription.valid(); 983 } 984 // ignore validation when going back 985 else { 986 $(this).validate().settings.ignore = ".ignore-validation"; 987 return true; 988 } 989 }, 990 991 onFinishing: function(event, currentIndex) { 992 form_inscription.validate().settings.ignore = ":disabled"; 993 //return form_inscription.valid(); 994 //form_inscription.trigger( "submit" ); alert('x'); 995 if ( 996 ( 997 $("#password2").val() != "" && 998 $("#password2").val() == $("#password").val() 999 ) || ($("quick_subscribe_form").val()==1 && form_inscription.valid() ) 1000 ) { 1001 if ($("#recaptcha_token_v3_inscription").length) { 1002 grecaptcha.ready(function() { 1003 // on recupere de 1004 sitekey = $(".g-recaptcha").data("sitekey"); 1005 grecaptcha 1006 .execute(sitekey, { 1007 action: "submit" 1008 }) 1009 .then(function(token) { 1010 $("#recaptcha_token_v3_inscription").val(token); 1011 document.getElementById("form_inscription_membre").submit(); 1012 }); 1013 }); 1014 } else if ($("#recaptcha-v2-step-identifiant .g-recaptcha-response").length > 0) { 1015 captcha_checked = $("#recaptcha-v2-step-identifiant .g-recaptcha-response").val(); 1016 1017 form_inscription.validate().settings.ignore = ":disabled,:hidden"; 1018 1019 if (captcha_checked == "") { 1020 alert("Veuillez remplir le captcha avant de continuer."); 1021 } else if(form_inscription.valid()){ 1022 document.getElementById("form_inscription_membre").submit(); 1023 } 1024 } else { 1025 form_inscription.validate().settings.ignore = ":disabled,:hidden"; 1026 if(form_inscription.valid()){ 1027 document.getElementById("form_inscription_membre").submit(); 1028 } 1029 1030 } 1031 } 1032 }, 1033 onFinished: function(event, currentIndex) { 1034 //alert("Submitted!"); 1035 }, 1036 }); 1037 1038 $("#form_edition_membre").steps({ 1039 enableAllSteps: true, 1040 enablePagination: false, 1041 headerTag: "span.h3", 1042 bodyTag: "section", 1043 transitionEffect: "slideLeft", 1044 autoFocus: true, 1045 }); 1046 1047 1048/* 1049VG-078350-6 1050lors de ledition du profil cote site , on verifie les champs obligatoires non remplies à chaque fois qu'on clique sur une tab 1051si des champs obligatoires sont vides on clone ces champs dans une modale bootstrap et on laffiche , 1052on supprime les champs originaux du formulaire pour eviter les doublons 1053on affiche la modale bootstrap avec les champs vides à remplir 1054l'utilisateur peut fermer la modale en cliquant sur le bouton fermer qui recharge la page 1055si il a rempli tous les champs obligatoires dans la modale on recharge la page avec la tab courante ouverte 1056la fonction checkRequiredFields est dans affichage_champs_cust.js 1057*/ 1058 1059 1060 1061if (document.getElementById('reloadPageButton')) { 1062 // Reload the page when the user clicks "Fermer" 1063 document.getElementById('reloadPageButton').addEventListener('click', function (e) { 1064 e.preventDefault(); 1065 // instead of realoding the page reload and add the id of the tabContentId to show the same tab after reload 1066 let tabContentId = document.querySelector('.editionuser .steps ul li.current a')?.getAttribute('aria-controls'); 1067 //remove first in case there is already a hash 1068 window.location.hash = ''; 1069 if (tabContentId) { 1070 // Only set the hash if there are no missing required fields in the modal 1071 var modalBody = document.getElementById('modalBody'); 1072 let hasEmptyRequired = false;
1073 if (modalBody) { 1074 Array.from(modalBody.querySelectorAll('[required]')).forEach(function(field) { 1075 if ( 1076 (field.type === 'checkbox' || field.type === 'radio') 1077 ) { 1078 // check if any in the same name are checked 1079 let item_check = document.getElementsByName(field.name); 1080 let itemChecked = false; 1081 item_check.forEach(item => { 1082 if (item.checked) { 1083 itemChecked = true; 1084 } 1085 }); 1086 if (!itemChecked) { 1087 hasEmptyRequired = true; 1088 } 1089 } else if ( 1090 field.type !== 'checkbox' && field.type !== 'radio' && 1091 (!field.value || field.value.trim() === "") 1092 ) { 1093 hasEmptyRequired = true; 1094 } 1095 }); 1096 } 1097 if (!modalBody || modalBody.children.length === 0 || !hasEmptyRequired) { 1098 window.location.hash = '#' + tabContentId; 1099 } 1100 } 1101 location.reload(); 1102 1103 }); 1104} 1105// check if there is a hash in the url to open the corresponding tab 1106window.addEventListener('load', function () { 1107 let hash = window.location.hash.substring(1); // Remove the '#' character 1108 if (hash) { 1109 1110 let tabLink = document.querySelector('.editionuser .steps ul li a[aria-controls="' + hash + '"]'); 1111 if (tabLink) { 1112 tabLink.click(); // Simulate a click on the tab link to open it 1113 } 1114 } 1115}); 1116 1117// On page load, check required fields 1118window.addEventListener('DOMContentLoaded', function () { 1119 document.querySelectorAll('.editionuser .steps ul li a').forEach(function (tab) { 1120 tab.addEventListener('click', function () { 1121 // passed the equivalent div of the tab to the function 1122 let tabContentId = tab.getAttribute('aria-controls'); 1123 checkRequiredFields(tabContentId); 1124 }); 1125 }); 1126 // launch it on the first tab on load 1127 let firstTab = document.querySelector('.editionuser .steps ul li a'); 1128 if (firstTab) 1129 { 1130 let firstTabContentId = firstTab.getAttribute('aria-controls'); 1131 checkRequiredFields(firstTabContentId); 1132 } 1133 1134}); 1135 1136function checkCharteEthique() { 1137 // Hide next button by default 1138 $('.actions a[href="#next"]').first().hide(); 1139 $('#jeconfirme_charte').hide(); 1140 1141 if ($('#jeconfirme_charte').length) { 1142 $('.actions a[href="#next"]').first().after($('#jeconfirme_charte')); 1143 } 1144 1145 var $charteDiv = $('#charte_ethique_texte'); 1146 if ($charteDiv.length) { 1147 setTimeout(function() { 1148 $charteDiv.scrollTop(0); 1149 }, 10); 1150 1151 $charteDiv.on('scroll', function () { 1152 if ($charteDiv.scrollTop() + $charteDiv.innerHeight() >= ($charteDiv[0].scrollHeight - 5)) { 1153 $('#jeconfirme_charte').show(); 1154 $('.actions a[href="#next"]').hide(); 1155 } 1156 }); 1157 } 1158 1159 $('#jeconfirme_charte').on('click', function() { 1160 $('.actions a[href="#next"]').first().show(); 1161 $('.actions a[href="#next"]').trigger("click"); 1162 $(this).hide(); 1163 }); 1164 1165 // When user clicks "précédent", reset state 1166 $('.actions a[href="#previous"]').on('click', function() { 1167 $('#jeconfirme_charte').hide(); 1168 $('.actions a[href="#next"]').show(); 1169 }); 1170} 1171 1172/**** toolTips frontend ***/ 1173var tooltipTriggerList = [].slice.call( 1174 document.querySelectorAll('[data-bs-toggle="tooltip"]') //data-bs-toggle="tooltip" bootstrap V5 1175); 1176 1177/* //-------------------- ne fonctionne qu'avec bootstrap 5 --- code compatible plus bas------------------ 1178var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 1179 return new bootstrap.Tooltip(tooltipTriggerEl); 1180});*/ 1181var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="tooltip"], [data-bs-toggle="tooltip"]')); 1182var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 1183 if (typeof bootstrap !== 'undefined' && bootstrap.Tooltip) { 1184 // Logique Bootstrap 5 1185 return new bootstrap.Tooltip(tooltipTriggerEl); 1186 } 1187 else if (typeof jQuery !== 'undefined' && jQuery.fn.tooltip) { 1188 // Logique Bootstrap 3 1189 // On initialise et on retourne l'élément jQuery 1190 return jQuery(tooltipTriggerEl).tooltip(); 1191 } 1192 return null; 1193}); 1194 1195 1196$('[data-toggle="tooltip"]').tooltip(); //[data-toggle="tooltip" bootstrap V3
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.