1/** FORM OPTIONS **/ 2$(document).ready(function () { 3 var loader = '<img src="'+PATH+'lib/images/ajax-loader3.gif" alt="Chargement" class="center-block text-center no-float" id="loader_ajax" />'; 4 var path_controller = PATH + 'controllers/ct_ajx.main.php'; 5 /* EVENT SUR BTN */ 6 $('body').append('<div class="modal fade in" id="modal" tabindex="-1" role="dialog" aria-labelledby="labelModal" aria-hidden="false" style="display: none;"><div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">Ã</span></button> <h3 class="modal-title" id="labelModal">Ajouter un membre à mon groupe</h3></div><div class="modal-body"></div><div class="modal-footer" style="display: none;"><button type="button" class="btn btn-default" data-dismiss="modal">Retour</button><button type="submit" class="btn btn-primary">Valider</button></div>'); 7 var societe = $('.container_planning').find('input[name=idSociete_hidden]').val(); 8 if(societe == 706) { 9 $(document).on("click", ".chk_type", function (e) { 10 //Click sur type d'évènements 2ème 11 if($(this).closest('fieldset').parent().next().is('div')){ 12 var fieldset1 = $(this).closest('fieldset').parent(); 13 var fieldset2 = $(this).closest('fieldset').parent().next(); 14 runEffect(fieldset1,'drop'); 15 runEffect(fieldset2,'slide-show'); 16 }else{ 17 var form = $(this).closest('fieldset').parent().parent(); 18 form.submit(); 19 return false; 20 } 21 }); 22 $(document).on("change", "select.sel-type", function (e) { 23 //Click sur type d'évènements 1er déclenché 24 e.preventDefault(); 25 var fieldset1 = $(this).closest('fieldset').parent(); 26 // if($(this).closest('fieldset').parent().next().is('div')){ 27 // //Si membre on affiche le truc de membre 28 // var fieldset2 = $(this).closest('fieldset').parent().next(); 29 // runEffect(fieldset1,'drop'); 30 // runEffect(fieldset2,'slide-show'); 31 // }else{ 32 // //Si pas de membre on submit 33 runEffect(fieldset1,'drop'); 34 $('.sel-type.open').removeClass('open'); 35 var form = $(this).closest('fieldset').parent().parent(); 36 var idUser = $(this).closest('fieldset').closest('form').attr('id').replace('form_options_', ''); 37 console.log("onChange sel-type idUser:"+idUser); 38 var idType = e.target.value; 39 var urgence = e.target.selectedOptions[0].getAttribute('data-urgence'); 40 form.submit(); 41 console.log("urgence :"+urgence); 42 if (urgence) { 43 var modalString = '#modalUrgence_' + idUser + '_' + idType; 44 console.log("Modal SHOW :"+modalString); 45 if ($(modalString).length) { 46 $(modalString).modal('show'); 47 } 48 } 49 50 return false; 51 // } 52 }); 53 54 $(document).on("click", "#clicMembrePriseRDV", function (e) { 55 e.preventDefault(); 56 var form = $(this).closest('fieldset').parent().closest('form'); 57 var idUser = form.attr('id').replace('form_options_', ''); 58 59 var activeType = $(this).closest('fieldset').parent().parent().find('#activeType').val(); 60 if(activeType == 1){ 61 var fieldset1 = $(this).closest('fieldset').parent(); 62 63 var fieldset2 = $('#choixType_'+idUser).parent(); 64 // var fieldset2 = $(this).closest('fieldset').parent().next(); 65 66 runEffect(fieldset1,'drop'); 67 runEffect(fieldset2,'slide-show'); 68 var $form = $(this).closest('fieldset').parent().parent(); 69 } else { 70 var $form = $(this).closest('fieldset').parent().parent(); 71 72 $form.submit(); 73 // $(this).closest('div.form-wrapper').removeClass('in'); 74 // $(this).closest('div.form-wrapper').parent().find('.container-agenda').removeClass('hidden'); 75 } 76 return false; 77 }); 78 79 $(document).on("click", ".chk_choix_1", function (e) { 80 e.preventDefault(); 81 var form = $(this).closest('fieldset').parent().closest('form'); 82 var idUser = form.attr('id').replace('form_options_', ''); 83 84 //Click sur Seul 85 var activeType = $(this).closest('fieldset').parent().parent().find('#activeType').val(); 86 var fieldset1 = $(this).closest('fieldset').parent(); 87 if(activeType == 1){ 88 var fieldset2 = $('#choixType_'+idUser).parent(); 89 // var fieldset2 = $(this).closest('fieldset').parent().next(); 90 runEffect(fieldset1,'drop'); 91 runEffect(fieldset2,'slide-show'); 92 93 $('#choixType_'+idUser).append('<input type="hidden" name="clicMult" id="chk_choix_1" value="1">'); 94 return false; 95 }else{ 96 $(this).closest('div.form-wrapper').removeClass('in'); 97 $(this).closest('div.form-wrapper').parent().find('.container-agenda').removeClass('hidden'); 98 return false; 99 } 100 }); 101 $(document).on('click', "#clicMembrePriseRDVMult", function (e) { 102 var activeType = $(this).closest('fieldset').parent().parent().find('#activeType').val(); 103 104 var form = $(this).closest('fieldset').parent().closest('form'); 105 var idUser = form.attr('id').replace('form_options_', ''); 106 107 e.preventDefault(); 108 if(activeType == 1){ 109 var options = $('#tabContact_mult option:selected'); 110 var selected = []; 111 var i = 0; 112 113 $(options).each(function(){ 114 selected[i] = []; 115 selected[i].push($(this).val()); 116 selected[i].push($(this).text()); 117 i++; 118 }); 119 120 var fieldset1 = $(this).closest('fieldset').parent(); 121 var fieldset2= $('#choixTypeMultazer_' + idUser).parent(); 122 runEffect(fieldset1,'drop'); 123 runEffect(fieldset2,'slide-show'); 124 var listeType = $(this).closest('form').find('.selectpicker.sel-type > option').removeClass('chk_type'); 125 var selectHTML = ''; 126 selected.forEach(function(patient) { 127 selectHTML+="<p>Pour : <strong>" + patient[1] + '</strong></p>'; 128 selectHTML+='<select class="form-control" name="tabTypeContact_mult[]" data-size="4" id="tabContact_multa'+i+'" multiple="" title="Choissisez le type du rdv">'; 129 for(i=1;i<listeType.length;i++) { 130 selectHTML+=listeType[i].outerHTML; 131 } 132 selectHTML+='</select><br>'; 133 }); 134 $('#choixTypeParPersonne_' + idUser).append(selectHTML); 135 $('#choixTypeParPersonne_' + idUser).append('<button class="btn btn-primary" type="submit">Suivant</button>'); 136 } else { 137 var $form = $(this).closest('fieldset').parent().parent(); 138 $form.submit(); 139 } 140 }); 141 $(document).on("click", ".chk_choix_2", function (e) { 142 console.log("chk choix 2"); 143 var form = $(this).closest('fieldset').parent().closest('form'); 144 var idUser = form.attr('id').replace('form_options_', ''); 145 //Click sur plusieurs membres de la famille 146 e.preventDefault(); 147 var fieldset1 = $(this).closest('fieldset').parent(); 148 var fieldset2 = $('#contactsGr_' + idUser).parent(); 149 // var fieldset2 = $(this).closest('fieldset').parent().next().next().next(); 150 runEffect(fieldset1,'drop'); 151 runEffect(fieldset2,'slide-show'); 152 // return false;
153 }); 154 155 $(document).on("click", ".chk_choix_3", function (e) { 156 console.log("chk choix 3"); 157 var form = $(this).closest('fieldset').parent().closest('form'); 158 var idUser = form.attr('id').replace('form_options_', ''); 159 //Pour un membre de la famille 160 e.preventDefault(); 161 var fieldset1 = $(this).closest('fieldset').parent(); 162 var fieldset2 = $('#contactsGr2_' + idUser).parent(); 163 runEffect(fieldset1,'drop'); 164 runEffect(fieldset2,'slide-show'); 165 // return false; 166 }); 167 } else { 168 $(document).on("change", "select.sel-type", function (e) { 169 //Click sur un élément du select qui contient les types d'évènements 170 e.preventDefault(); 171 console.log('select.sel-type this =>'); 172 console.log(this); 173 174 var form = $(this).closest('fieldset').parent().closest('form'); 175 var idUser = form.attr('id').replace('form_options_', ''); 176 console.log("onChange sel-type idUser:"+idUser); 177 var optionSelected = $("option:selected", this); 178 var idType = e.target.value; 179 console.log('idType:'+idType); 180 var urgence = e.target.selectedOptions[0].getAttribute('data-urgence'); 181 182 if ($(optionSelected).hasClass('isSousType')) { 183 console.log("isSousType"); 184 console.log("urgence :"+urgence); 185 if (urgence) { 186 var modalString = '#modalUrgence_' + idUser + '_' + idType; 187 console.log("Modal SHOW :"+modalString); 188 if ($(modalString).length) { 189 $(modalString).modal('show'); 190 } 191 } 192 //Si le type a des sous-sous-types 193 var idType = this.value; 194 195 form.append("<input type='hidden' name='isSousType' value='1'>"); 196 197 var fieldset1 = $(this).closest('fieldset').parent(); 198 var fieldset2 = form.find('.choixSousType_' + idType).parent(); 199 200 $('#choixMult_' + idUser + ' div:nth-child(2)').removeClass('col-md-2').addClass('col-md-3'); 201 $('#choixMult_' + idUser + ' div:nth-child(4)').removeClass('col-md-2').addClass('col-md-3'); 202 203 $('#choixMult_' + idUser + ' div:nth-child(3)').remove(); 204 runEffect(fieldset1,'drop'); 205 runEffect(fieldset2, 'slide-show'); 206 207 } else { 208 console.log("NO isSousType"); 209 //Si le type cliqué n'est pas un sous sous type 210 var fieldset1 = $(this).closest('fieldset').parent(); 211 212 //Si membre on affiche le truc de membre 213 if($('#contactsGr_' + idUser).length){ 214 console.log('#contactsGr_' + idUser); 215 var fieldset2 = $(this).closest('fieldset').parent().next(); 216 runEffect(fieldset1,'drop'); 217 runEffect(fieldset2, 'slide-show'); 218 console.log("urgence :"+urgence); 219 if (urgence) { 220 var modalString = '#modalUrgence_' + idUser + '_' + idType; 221 console.log("Modal SHOW :"+modalString); 222 if ($(modalString).length) { 223 $(modalString).modal('show'); 224 } 225 } 226 } else { 227 console.log('NO #contactsGr_' + idUser); 228 //Si pas de membre on submit 229 runEffect(fieldset1,'drop'); 230 $('.sel-type.open').removeClass('open'); 231 var form = $(this).closest('fieldset').parent().parent(); 232 form.submit(); 233 console.log("urgence :"+urgence); 234 if (urgence) { 235 var modalString = '#modalUrgence_' + idUser + '_' + idType; 236 console.log("Modal SHOW :"+modalString); 237 if ($(modalString).length) { 238 $(modalString).modal('show'); 239 } 240 } 241 return false; 242 } 243 } 244 245 }); 246 247 $(document).on("click",".chk_choix_1", function (e){ 248 //Click sur Seul 249 var activeType = $(this).closest('fieldset').parent().parent().find('#activeType').val(); 250 if(activeType == 1){ 251 var $form = $(this).closest('fieldset').parent().parent(); 252 $form.submit(); 253 return false; 254 }else{ 255 $(this).closest('div.form-wrapper').removeClass('in'); 256 $(this).closest('div.form-wrapper').parent().find('.container-agenda').removeClass('hidden'); 257 return false; 258 } 259 }); 260 261 $(document).on("click",".chk_choix_2", function (e){ 262 //Click sur plusieurs membres de la famille 263 e.preventDefault(); 264 var fieldset1 = $(this).closest('fieldset').parent(); 265 var fieldset2 = $(this).closest('fieldset').parent().next(); 266 runEffect(fieldset1,'drop'); 267 runEffect(fieldset2,'slide-show'); 268 }); 269 270 $(document).on("click",".chk_choix_3", function (e){ 271 //Pour un membre de la famille 272 e.preventDefault(); 273 var fieldset1 = $(this).closest('fieldset').parent(); 274 var fieldset2 = $(this).closest('fieldset').parent().next().next(); 275 runEffect(fieldset1,'drop'); 276 runEffect(fieldset2,'slide-show'); 277 }); 278 279 $(document).on('click', '.submitSousType', function (e) { 280 e.preventDefault(); 281 $('.sel-type.open').removeClass('open'); 282 var form = $(this).closest('fieldset').parent().closest('form'); 283 var idUser = form.attr('id').replace('form_options_', ''); 284 console.log("click submitSousType idUser:"+idUser); 285 //Si des membres existent 286 if ($('#contactsGr_' + idUser).length) { 287 288 var fieldset1 = $(this).closest('fieldset').parent(); 289 var fieldset2 = $('#choixMult_' + idUser).parent(); 290 runEffect(fieldset1,'drop'); 291 runEffect(fieldset2,'slide-show'); 292 } else { 293 //si seul 294 var activeType = $(this).closest('fieldset').parent().parent().find('#activeType').val(); 295 if(activeType == 1){ 296 var $form = $(this).closest('fieldset').parent().parent(); 297 $form.submit(); 298 return false; 299 }else{ 300 $(this).closest('div.form-wrapper').removeClass('in'); 301 $(this).closest('div.form-wrapper').parent().find('.container-agenda').removeClass('hidden'); 302 return false; 303 } 304 } 305 }); 306 } 307
308 $(document).on('change', '.selectpickerSousType', function (e) { 309 var optionSelected = $("option:selected", this); 310 if (optionSelected.length > 0) { 311 $(this).closest('fieldset').find('.submitSousType').prop('disabled', false); 312 313 } else { 314 $(this).closest('fieldset').find('.submitSousType').prop('disabled', true); 315 } 316 }); 317 318$(document).on("click",".btn-add-contact", function (e){ 319 e.preventDefault(); 320 var fieldset1 = $(this).closest('fieldset').parent(); 321 var fieldset2 = $(this).closest('fieldset').parent().next(); 322 runEffect(fieldset1,'drop'); 323 runEffect(fieldset2,'slide-show'); 324 // return false; 325}); 326/* FORM INSERT */ 327$(document).on("click",".chk_me", function (e){ 328 e.preventDefault(); 329 $('#contact_checked').val('me'); 330 var fieldset1 = $(this).closest('fieldset').parent(); 331 var fieldset2 = $(this).closest('fieldset').parent().next().next().next().next(); 332 runEffect(fieldset1,'drop'); 333 runEffect(fieldset2,'slide-show'); 334 // return false; 335}); 336$(document).on("click",".sel_member", function (e){ 337 e.preventDefault(); 338 $('#contact_checked').val($('#tabContact_mult_2 option:selected').val()); 339 var fieldset1 = $(this).closest('fieldset').parent(); 340 var fieldset2 = $(this).closest('fieldset').parent().next().next(); 341 runEffect(fieldset1,'drop'); 342 runEffect(fieldset2,'slide-show'); 343 // return false; 344}); 345$(document).on("click",".add_member", function (e){ 346 e.preventDefault(); 347 $('#contact_checked').val('add_member'); 348 var fieldset1 = $(this).closest('fieldset').parent(); 349 var fieldset2 = $(this).closest('fieldset').parent().next(); 350 runEffect(fieldset1,'drop'); 351 runEffect(fieldset2,'slide-show'); 352 // return false; 353}); 354$(document).on("click",".chk_member", function (e){ 355 e.preventDefault(); 356 $('#contact_checked').val('member'); 357 var fieldset1 = $(this).closest('fieldset').parent(); 358 var fieldset2 = $(this).closest('fieldset').parent().next().next(); 359 runEffect(fieldset1,'drop'); 360 runEffect(fieldset2,'slide-show'); 361 // return false; 362}); 363$(document).on("click",".btn_add_member", function (e){ 364 e.preventDefault(); 365 var fieldset1 = $(this).closest('fieldset').parent(); 366 var fieldset2 = $(this).closest('fieldset').parent().next(); 367 runEffect(fieldset1,'drop'); 368 runEffect(fieldset2,'slide-show'); 369 // return false; 370}); 371function runEffect(selectedDiv,selectedEffect) { 372 var options = {}; 373 // some effects have required parameters 374 if ( selectedEffect === "scale" ) { 375 options = { percent: 0 }; 376 } else if ( selectedEffect === "transfer" ) { 377 options = { to: "#button", className: "ui-effects-transfer" }; 378 } else if ( selectedEffect === "size" ) { 379 options = { to: { width: 200, height: 60 } }; 380 } 381 if(selectedEffect == 'slide-show'){ 382 selectedDiv.show('slide', {direction: 'right'}, 1000); 383 }else{ 384 selectedDiv.effect( selectedEffect, options, 500 );//, callback 385 } 386}; 387 388$('#modal').on('show.bs.modal', function (event) { 389 // event.preventDefault(); 390 var button = $(event.relatedTarget); 391 var title = button.data('title'); 392 var modal = $(this); 393 modal.find('.modal-title').text(title); 394 395 var action = button.data('action') 396 console.log('action :'+action) 397 if(action == 'ajout_groupe'){ 398 modal.find('.modal-footer').css('display','none'); 399 modal.find('.modal-body').load(PATH + "views/patient/form_ajout_groupe.htm", function(responseTxt, statusTxt, xhr){ 400 if(statusTxt == "success"){ 401 $('#form_ajout_groupe').bootstrapValidator({ 402 feedbackIcons: { 403 valid: 'glyphicon glyphicon-ok', 404 invalid: 'glyphicon glyphicon-remove', 405 validating: 'glyphicon glyphicon-refresh' 406 }, 407 fields: { 408 nomMembreGroupe: { 409 validators: { 410 notEmpty: { 411 message: 'Vous devez indiquer un nom' 412 } 413 } 414 }, 415 prenomMembreGroupe: { 416 validators: { 417 notEmpty: { 418 message: 'Vous devez indiquer un prénom' 419 } 420 } 421 }, 422 telMembreGroupe: { 423 validators: { 424 digits: { 425 message: 'Le numéro de téléphone doit être composé uniquement de chiffres' 426 }, 427 notEmpty: { 428 message: 'Un numéro de téléphone est requis' 429 } 430 } 431 } 432 } 433 }).on('success.form.bv', function(e) { 434 e.preventDefault(); 435 var $form = $(e.target), 436 validator = $form.data('bootstrapValidator'), 437 submitButton = validator.getSubmitButton(); 438 439 $.ajax({ 440 type: "POST", 441 url: PATH+'controllers/ct_ajx.contact.admin.php', 442 data: $('form#form_ajout_groupe').serialize(), 443 success: function(msg){ 444 console.log(msg); 445 $("#reponse_ajout_groupe").html(msg); 446 //FERMETURE MODAL 447 $("#modal").modal("hide"); 448 //SCROLL div_groupe_contact 449 // $(documentBody).animate({scrollTop: $('#top').offset().top}, 2000,'easeInOutCubic'); 450 return false;
451 }, 452 error : function(resultat, statut, erreur){ 453 var msg = '<span class="txt-orange">Une erreur interne est survenue, votre demande à échouée!</span>'; 454 $("#reponse_ajout_groupe").html(msg); 455 return false; 456 } 457 }); 458 }); 459 } 460 if(statusTxt == "error") 461 alert("Error: " + xhr.status + ": " + xhr.statusText); 462 }); 463 }else if(action == 'reponse_notif' || action == 'rdv_notif'){ 464 let idNotif = button.data('notif'); 465 modal.find('.modal-footer').css('display','none'); 466 $.ajax({ 467 url: PATH + "views/patient/form_notif.php", 468 method: "POST", 469 data: { action: action, idNotif: idNotif }, 470 success: function(response) { 471 modal.find('.modal-body').html(response); 472 }, 473 error: function(xhr, status, error) { 474 console.error("Une erreur s'est produite: ", error); 475 modal.find('.modal-body').html('<p>Erreur lors du chargement du formulaire. Veuillez réessayer.</p>'); 476 } 477 }); 478 } else { 479 modal.find('.modal-footer').css('display','none'); 480 modal.find('.modal-body').load(PATH + "views/patient/form_recherche_membre.htm", function(responseTxt, statusTxt, xhr){ 481 if(statusTxt == "success"){ 482 $('#form_rech_membre').bootstrapValidator({ 483 feedbackIcons: { 484 valid: 'glyphicon glyphicon-ok', 485 invalid: 'glyphicon glyphicon-remove', 486 validating: 'glyphicon glyphicon-refresh' 487 }, 488 fields: { 489 nomMembreGroupe: { 490 validators: { 491 notEmpty: { 492 message: 'Vous devez indiquer un nom' 493 } 494 } 495 }, 496 prenomMembreGroupe: { 497 validators: { 498 notEmpty: { 499 message: 'Vous devez indiquer un prénom' 500 } 501 } 502 }, 503 telMembreGroupe: { 504 validators: { 505 digits: { 506 message: 'Le numéro de téléphone doit être composé uniquement de chiffres' 507 }, 508 notEmpty: { 509 message: 'Un numéro de téléphone est requis' 510 } 511 } 512 } 513 } 514 }).on('success.form.bv', function(e) { 515 e.preventDefault(); 516 var $form = $(e.target), 517 validator = $form.data('bootstrapValidator'), 518 submitButton = validator.getSubmitButton(); 519 520 $.ajax({ 521 type: "POST", 522 url: PATH+'controllers/ct_ajx.contact.admin.php', 523 data: $('form#form_rech_membre').serialize(), 524 success: function(msg){ 525 console.log(msg); 526 $("#reponse_rech_membre").html(msg); 527 //FERMETURE MODAL 528 // $("#modal").modal("hide"); 529 //SCROLL div_groupe_contact 530 // $(documentBody).animate({scrollTop: $('#top').offset().top}, 2000,'easeInOutCubic'); 531 return false; 532 }, 533 error : function(resultat, statut, erreur){ 534 var msg = '<span class="txt-orange">Une erreur interne est survenue, votre demande à échouée!</span>'; 535 $("#reponse_rech_membre").html(msg); 536 return false; 537 } 538 }); 539 }); 540 } 541 if(statusTxt == "error") 542 alert("Error: " + xhr.status + ": " + xhr.statusText); 543 }); 544 } 545}); 546$(document).on("click",".btn-close-notif", function (event) { 547 var idNotif = $(this).data('notif'); 548 var notif = $(this).closest('.snippetss');//notification-contact? 549 $.ajax({ 550 type: "POST", 551 url: PATH+'controllers/ct_ajx.contact.admin.php', 552 data: {idNotif:idNotif,action:'close_notif'}, 553 success: function(msg){ 554 // $("#reponse_reponse_notif").html(msg); 555 notif.after(msg); 556 notif.fadeOut(400, function() { 557 $(this).remove(); 558 }); 559 return false; 560 }, 561 error : function(resultat, statut, erreur){ 562 var msg = '<span class="txt-orange">Une erreur interne est survenue, votre demande à échouée!</span>'; 563 notif.after(msg); 564 // $("#reponse_reponse_notif").html(msg); 565 return false; 566 } 567 }); 568 event.preventDefault(); 569}); 570$(document).on("submit","#form_reponse_notif", function (event) { 571 $.ajax({ 572 type: "POST", 573 url: PATH+'controllers/ct_ajx.contact.admin.php', 574 data: $('form#form_reponse_notif').serialize(), 575 success: function(msg){ 576 $("#reponse_reponse_notif").html(msg); 577 // location.reload(); 578 return false; 579 }, 580 error : function(resultat, statut, erreur){ 581 var msg = '<span class="txt-orange">Une erreur interne est survenue, votre demande à échouée!</span>'; 582 $("#reponse_reponse_notif").html(msg); 583 return false;
584 } 585 }); 586 event.preventDefault(); 587}); 588 589$("#modal").on('hide.bs.modal', function () { 590 location.reload(); 591}); 592 593 /** 594 * Listener pour les select de supertype 595 * (utilisé quand on ajoute la sélection du supertype au planning pour avoir une étape de plus) 596 */ 597 $('.sel-superType').on('change', el => { 598 const idUser = el.target.getAttribute('data-idUser'); 599 const idSuperType = el.target.value; 600 let list_users = 0; 601 let stepToShow, stepToHide; 602 if (idUser.includes("-")) { 603 list_users = idUser;//idUser.replace("#", "-"); 604 stepToShow = $(`#sousType_${list_users}_${idSuperType}`).parent(); 605 stepToHide = $(`#multitype_${list_users}`).parent(); 606 }else{ 607 stepToShow = $(`#sousType_${idUser}_${idSuperType}`).parent(); 608 stepToHide = $(`#multitype_${idUser}`).parent(); 609 } 610 let form_options; 611 if(list_users !== 0){ 612 form_options = 'form_options_'+list_users; 613 // document.getElementById(`form_options_${list_user}`).appendChild(inputSuperType); 614 // console.log('form_options:'+form_options); 615 }else{ 616 form_options = 'form_options_'+idUser; 617 // document.getElementById(`form_options_${idUser}`).appendChild(inputSuperType); 618 // console.log('form_options:'+form_options); 619 } 620 runEffect(stepToHide, 'drop'); 621 if(stepToShow.length){ 622 runEffect(stepToShow, 'slide-show'); 623 }else{ 624 handleSelectChange(el.target); 625 return false; 626 } 627 628 const inputSuperType = document.createElement('input'); 629 inputSuperType.setAttribute('type', 'hidden'); 630 inputSuperType.setAttribute('value', idSuperType); 631 inputSuperType.setAttribute('name', 'idSuperType'); 632 633 document.getElementById(form_options).appendChild(inputSuperType); 634 /** On boucle sur les step{i} pour désactiver les select associés à d'autres supertype */ 635 let loop = true; 636 for (let i = 1; loop; i++) { 637 // let stepEl = document.querySelector(`#form_options_${idUser} #step${i}`); 638 let stepEl = document.querySelector(`#`+form_options+` #step${i}`); 639 console.log('stepEl (step : '+i+'):'+stepEl); 640 if (stepEl === null) { 641 loop = false; 642 } else { 643 /** On désactive les selects non visible, celui visible est celui qu'on va utilisé */ 644 if (stepEl.style.display === 'none') { 645 // document.querySelector(`#form_options_${idUser} #step${i} select`).disabled = true; 646 document.querySelector(`#`+form_options+` #step${i} select`).disabled = true; 647 } 648 } 649 } 650 }); 651 function handleSelectChange(selectElement) { 652 console.log('handleSelectChange'); 653 var form = $(selectElement).closest('fieldset').parent().closest('form'); 654 var idUser = form.attr('id').replace('form_options_', ''); 655 var optionSelected = $("option:selected", selectElement); 656 var idType = selectElement.value; 657 var urgence = selectElement.selectedOptions[0].getAttribute('data-urgence'); 658 659 if ($(optionSelected).hasClass('isSousType')) { 660 if (urgence) { 661 var modalString = '#modalUrgence_' + idUser + '_' + idType; 662 if ($(modalString).length) { 663 $(modalString).modal('show'); 664 } 665 } 666 // Si le type a des sous-sous-types 667 form.append("<input type='hidden' name='isSousType' value='1'>"); 668 669 var fieldset1 = $(selectElement).closest('fieldset').parent(); 670 var fieldset2 = form.find('.choixSousType_' + idType).parent(); 671 672 $('#choixMult_' + idUser + ' div:nth-child(2)').removeClass('col-md-2').addClass('col-md-3'); 673 $('#choixMult_' + idUser + ' div:nth-child(4)').removeClass('col-md-2').addClass('col-md-3'); 674 675 $('#choixMult_' + idUser + ' div:nth-child(3)').remove(); 676 runEffect(fieldset1, 'drop'); 677 runEffect(fieldset2, 'slide-show'); 678 } else { 679 var fieldset1 = $(selectElement).closest('fieldset').parent(); 680 if ($('#contactsGr_' + idUser).length) { 681 var fieldset2 = $(selectElement).closest('fieldset').parent().next(); 682 runEffect(fieldset1, 'drop'); 683 runEffect(fieldset2, 'slide-show'); 684 if (urgence) { 685 var modalString = '#modalUrgence_' + idUser + '_' + idType; 686 if ($(modalString).length) { 687 $(modalString).modal('show'); 688 } 689 } 690 } else { 691 runEffect(fieldset1, 'drop'); 692 $('.sel-type.open').removeClass('open'); 693 $('.sel-type').attr("disabled", true); 694 selectElement.setAttribute("name", "tyEvent_mult"); 695 var form = $(selectElement).closest('fieldset').parent().parent(); 696 form.submit(); 697 if (urgence) { 698 var modalString = '#modalUrgence_' + idUser + '_' + idType; 699 if ($(modalString).length) { 700 $(modalString).modal('show'); 701 } 702 } 703 return false;
704 } 705 } 706 } 707 //Réparation du code pour prendre un rdv pour un membre après avoir sélectionné un créneau en étant déconnecté 708 $('#clicMembrePriseRDV').on('click', () => { 709 const currentFieldset = $('#form_ins .step2'); 710 const nextFieldset = $('#form_ins .step4'); 711 const idContact = $('#tabContact_mult_2').val(); 712 713 //Changement valeur en l'idContact de membre sélectionné 714 $('#contact_checked').val(idContact); 715 716 runEffect(currentFieldset,'drop'); 717 runEffect(nextFieldset,'slide-show'); 718 }); 719 720 /** FCT CALENDRIER **/ 721//cache lien au clic 722$(document).on("click","a.all-plages", function () { 723 $(this).parent().addClass('hidden'); 724}); 725//btn suivant/precedent 726$(document).on("click","#btn_prec", function (e) { 727 if($('#reponse_rdv_notif').length > 0){ 728 e.preventDefault(); 729 var $dateLastSem = $(this).parent().find('#dateLastSem').val(); 730 var $idUser_hidden = $(this).parent().find('#idUser_hidden').val(); 731 var $typeEvenement_hidden = $(this).parent().find('#typeEvenement_hidden').val(); 732 var $liste_contacts = $(this).closest('.bloc-planning').find("#order_contacts").val(); 733 var $target = $(this).closest('.bloc-planning'); 734 const moveEvent = $(this).closest('.bloc-planning').find('input[name=moveEvent]').val() ?? ''; 735 736 if($(this).closest('.bloc-planning').find("input[name=PrevSuivMult]").val() == '1') { 737 var $liste_contacts = $(this).closest('.bloc-planning').find("input[name=contactsTypes]").val(); 738 var $idUser_hidden = $(this).closest('.bloc-planning').find('input[name=idUser]').val(); 739 var $dateLastSem = $(this).closest('.bloc-planning').find('input[name=dateLastSem]').val(); 740 $.ajax({ 741 type: 'POST', 742 url: path_controller, 743 data : { 744 dateLastSem : $dateLastSem, 745 idUser_hidden : $idUser_hidden, 746 typeEvenement_hidden : $typeEvenement_hidden, 747 liste_contacts : $liste_contacts, 748 clic_semaine_prec : '1', 749 clic_semaine_mult: '1', 750 moveEvent: moveEvent 751 }, 752 beforeSend: function(){ 753 $target.empty(); 754 $target.append(loader); 755 }, 756 success: function(data, status) { 757 $('#loader_ajax').remove(); 758 $target.html(data); 759 } 760 }); 761 } else { 762 var stringSousType = $(this).closest('.bloc-planning').find('input[name=stringSousType]').val(); 763 const idSuperType = $(this).closest('.bloc-planning').find('input[name=idSuperType]').val() ?? ''; 764 $.ajax({ 765 type: 'POST', 766 url: path_controller, 767 data : { 768 dateLastSem : $dateLastSem, 769 idUser_hidden : $idUser_hidden, 770 typeEvenement_hidden : $typeEvenement_hidden, 771 liste_contacts : $liste_contacts, 772 clic_semaine_prec: '1', 773 stringSousType: stringSousType, 774 idSuperType: idSuperType, 775 moveEvent: moveEvent 776 }, 777 beforeSend: function(){ 778 $target.empty(); 779 $target.append(loader); 780 }, 781 success: function(data, status) { 782 $('#loader_ajax').remove(); 783 $target.html(data); 784 } 785 }); 786 } 787 } 788}); 789 790$(document).on("click","#btn_suiv", function (e) { 791 if($('#reponse_rdv_notif').length > 0){ 792 e.preventDefault(); 793 var $dateNewSem = $(this).parent().find('#dateNewSem').val(); 794 var $idUser_hidden = $(this).parent().find('#idUser_hidden').val(); 795 var $typeEvenement_hidden = $(this).parent().find('#typeEvenement_hidden').val(); 796 var $liste_contacts = $(this).closest('.bloc-planning').find("#order_contacts").val(); 797 var $target = $(this).closest('.bloc-planning'); 798 const moveEvent = $(this).closest('.bloc-planning').find('input[name=moveEvent]').val() ?? ''; 799 800 if($(this).closest('.bloc-planning').find("input[name=PrevSuivMult]").val() == '1') { 801 var $liste_contacts = $(this).closest('.bloc-planning').find("input[name=contactsTypes]").val(); 802 var $idUser_hidden = $(this).closest('.bloc-planning').find('input[name=idUser]').val(); 803 var $dateNewSem = $(this).closest('.bloc-planning').find('input[name=dateNewSem]').val(); 804 805 $.ajax({ 806 type: 'POST', 807 url: path_controller, 808 data : { 809 dateNewSem : $dateNewSem, 810 idUser_hidden : $idUser_hidden, 811 typeEvenement_hidden : $typeEvenement_hidden, 812 liste_contacts : $liste_contacts,
813 clic_semaine_suiv : '1', 814 clic_semaine_mult: '1', 815 moveEvent: moveEvent 816 }, 817 beforeSend: function(){ 818 $target.empty(); 819 $target.append(loader); 820 }, 821 success: function(data, status) { 822 $('#loader_ajax').remove(); 823 $target.html(data); 824 } 825 }); 826 } else { 827 var stringSousType = $(this).closest('.bloc-planning').find('input[name=stringSousType]').val(); 828 const idSuperType = $(this).closest('.bloc-planning').find('input[name=idSuperType]').val() ?? ''; 829 830 $.ajax({ 831 type: 'POST', 832 url: path_controller, 833 data : { 834 dateNewSem : $dateNewSem, 835 idUser_hidden : $idUser_hidden, 836 typeEvenement_hidden : $typeEvenement_hidden, 837 liste_contacts : $liste_contacts, 838 clic_semaine_suiv: '1', 839 stringSousType: stringSousType, 840 idSuperType: idSuperType, 841 moveEvent: moveEvent 842 }, 843 beforeSend: function(){ 844 $target.empty(); 845 $target.append(loader); 846 }, 847 success: function(data, status) { 848 $('#loader_ajax').remove(); 849 $target.html(data); 850 } 851 }); 852 } 853 } 854}); 855 856$(document).on("click","#prochaine_dispo", function (e) { 857 if($('#reponse_rdv_notif').length > 0){ 858 e.preventDefault(); 859 var $dateNewSem = $(this).data('datedispo'); 860 var $idUser_hidden = $(this).data('userdispo'); 861 var $typeEvenement_hidden = $(this).data('typedispo'); 862 var $liste_contacts = $(this).closest('.bloc-planning').find("#order_contacts").val(); 863 var $target = $(this).closest('.bloc-planning'); 864 let stringSousType = $(this).closest('.bloc-planning').find('input[name=stringSousType]').val(); 865 const idSuperType = $(this).closest('.bloc-planning').find('input[name=idSuperType]').val() ?? ''; 866 const moveEvent = $(this).closest('.bloc-planning').find('input[name=moveEvent]').val() ?? ''; 867 868 $.ajax({ 869 type: 'POST', 870 url: path_controller, 871 data : { 872 dateNewSem : $dateNewSem, 873 idUser_hidden : $idUser_hidden, 874 typeEvenement_hidden : $typeEvenement_hidden, 875 liste_contacts : $liste_contacts, 876 clic_semaine_suiv: '1', 877 stringSousType: stringSousType, 878 idSuperType: idSuperType, 879 moveEvent: moveEvent 880 }, 881 beforeSend: function(){ 882 $target.empty(); 883 $target.append(loader); 884 }, 885 success: function(data, status) { 886 $('#loader_ajax').remove(); 887 $target.html(data); 888 } 889 }); 890 } 891}); 892/* 893| Ouverture modal ajout event 894*/ 895$('#confirmAjout').on('show.bs.modal', function (e) { 896 /* VALIDATION RDV 1:SESSION 2:ALERTE RETURN CONTENT + ETAT*/ 897 console.log("confirmAjout show modal function.selectionEventPlanning"); 898 if($('#reponse_rdv_notif').length > 0){ 899 var modalBody = $(this).find('.modal-body'); 900 var thisModal = $(this); 901 var buttonConf = $(e.relatedTarget); 902 if(buttonConf.attr('data-mult') == '1') { 903 console.log('validationRDVMult'); 904 var $infos = buttonConf.attr('data-infos'); 905 var $idUser_hidden = buttonConf.closest('.table-wrapper').children('input[name="idUser"]').val(); 906 var $idSociete_hidden = buttonConf.closest('.table-wrapper').children('input[name="idSociete_hidden"]').val(); 907 var $liste_contacts = buttonConf.closest('.bloc-planning').find("input[name=contactsTypes]").val(); 908 var nextEvent = buttonConf.attr('data-next'); 909 $.ajax({ 910 type: 'POST', 911 url: path_controller, 912 async:true, 913 dataType : 'json', 914 data : {'action' : 'validationRDVMult','infos' : $infos,'idUser':$idUser_hidden,'idSociete':$idSociete_hidden,'liste_c' : $liste_contacts, 'proch
914ainEvent': nextEvent}, 915 success: function(data) { 916 etat = data['etat']; 917 content = data['content']; 918 modalBody.html(content); 919 if($('#dpDebut'))$('#dpDebut').datepicker(); 920 if($('#dpFin'))$('#dpFin').datepicker(); 921 922 } 923 }); 924 925 } else { 926 console.log('validationRDV'); 927 var $infos = buttonConf.attr('data-infos'); 928 var $idUser_hidden = buttonConf.closest('.table-wrapper').children('input[name="idUser_hidden"]').val(); 929 var $idSociete_hidden = buttonConf.closest('.table-wrapper').children('input[name="idSociete_hidden"]').val(); 930 // var $liste_contacts = buttonConf.closest('.bloc-planning').find("input[name=order_contacts]").val(); 931 var $liste_contacts = $('#reponse_rdv_notif').find("input[name=order_contacts]").val(); 932 console.log('liste_contacts:'+$liste_contacts); 933 $title = buttonConf.attr('data-title'); 934 thisModal.find('.modal-title').text($title); 935 //ALERTE ICI CI RDV FUTUR 936 $.ajax({ 937 type: 'POST', 938 url: path_controller, 939 async:true, 940 dataType : 'json', 941 data : {'action' : 'validationRDV','infos' : $infos,'idUser':$idUser_hidden,'idSociete':$idSociete_hidden,'liste_c' : $liste_contacts}, 942 success: function(data) { 943 etat = data['etat']; 944 content = data['content']; 945 thisModal.find('.btn.btn-default').text('Fermer'); 946 if(etat == '-1' || etat == '0' || etat == '10' || etat == '20'){ 947 //NON CONNECTE 948 thisModal.find('#btnConfirmAjout').addClass("hidden"); 949 thisModal.find('#btnConfirmAjout').attr("disabled", "disabled"); 950 }else if(etat == '110' || etat == '210'){ 951 thisModal.find('#btnConfirmAjout').attr("disabled", "disabled"); 952 } else if (etat == '-2') { 953 thisModal.find('#btnConfirmAjout').addClass("hidden"); 954 thisModal.find('#btnConfirmAjout').attr("disabled", "disabled"); 955 thisModal.find('.btn.btn-default').text('Conserver mon rdv actuel'); 956 } else { 957 thisModal.find('#btnConfirmAjout').removeClass("hidden"); 958 thisModal.find('#btnConfirmAjout').removeAttr("disabled"); 959 } 960 modalBody.html(content); 961 if($('#dpDebut'))$('#dpDebut').datepicker(); 962 if($('#dpFin'))$('#dpFin').datepicker(); 963 } 964 }); 965 } 966 } 967}); 968$(document).on('keyup', 'textarea.descriptifEvenement_r', function(event) { 969 var desactive = false; 970 $('.descriptifEvenement_r').each(function () { 971 if(this.value == '')desactive = true; 972 }); 973 if (desactive == true) { 974 $('#btnConfirmAjout').attr("disabled", "disabled"); 975 }else{ 976 $('#btnConfirmAjout').removeClass("hidden"); 977 $('#btnConfirmAjout').removeAttr("disabled"); 978 } 979 event.preventDefault(); 980 return false; 981}); 982$('#confirmAjout').find('.modal-footer #btnConfirmAjout').on('click', function(e){ 983 if($('#reponse_rdv_notif').length > 0){ 984 e.preventDefault(); 985 var $target = $('.modal-body'); 986 var $val_input = $(this).parent().parent().find('#infos_plage_add').val(); 987 var $typeEvenement_hidden = $(this).parent().parent().find('#typeEvenement_add').val(); 988 var $idUser_hidden = $(this).parent().parent().find('#idUser_add').val(); 989 var $tab_contacts = $(this).parent().parent().find('#listeContact_add').val(); 990 var $priseRdvMult = $(this).closest('.modal-content').find('input[name^=priseRdvMult]').val(); 991 var $liste_descriptif = ''; 992 var $listeEvent = $(this).closest('.modal-content').find('input[name^=listeEvent]').val(); 993 //$(this).closest($('.modal-content')).find('textarea[name^="descriptifEvenement"]').each(function() { 994 $(this).closest('.modal-content').find('textarea[name^="descriptifEvenement"]').each(function() { 995 $liste_descriptif += $(this).val()+'#@#'; 996 }); 997 var $tab_pref; 998 999 let stringSousType = $('input[name="stringSousType"]').val(); 1000 1001 const deplaceEvent = $(this).closest('.modal-content').find('input[name^=remplace_event]').val() ?? ''; 1002 const previousIdEvenement = $(this).closest('.modal-content').find('input[name^=previousEvent]').val() ?? ''; 1003 1004 if($(this).parent().parent().find('#chk_pref').is(':checked')){ 1005 console.log('creation ticket pref'); 1006 $tab_pref = 0; 1007 $(this).parent().parent().find('#form_pref').find('input[type="checkbox"]').each(function(){ 1008 if($(this).is(':checked')){ 1009 val_ck = parseInt($(this).val()); 1010 $tab_pref += +val_ck; 1011 } 1012 }); 1013 $tab_pref += '@' + $('#form_pref').find('#dpDebut').val() + '@' 1014 + $('#form_pref').find('#dpFin').val() + '@' 1015 + $('#form_pref').find('#pref_heure_deb').val() + '@' 1016 + $('#form_pref').find('#pref_heure_fin').val(); 1017 } 1018 $.ajax({ 1019 type: 'POST', 1020 url: path_controller, 1021 data : { 1022 val_input : $val_input, 1023 idUser_hidden : $idUser_hidden, 1024 typeEvenement_hidden : $typeEvenement_hidden, 1025 descriptifEvenement : $liste_descriptif, 1026 tab_contacts : $tab_contacts, 1027 tab_pref : $tab_pref, 1028 clic_insert_event : '1', 1029 priseRdvMult: $priseRdvMult, 1030 listeEvent: $listeEvent,
1031 stringSousType: stringSousType, 1032 deplaceEvent: deplaceEvent, 1033 previousIdEvenement: previousIdEvenement 1034 }, 1035 beforeSend: function(){ 1036 $target.append(loader); 1037 }, 1038 success: function(data, status) { 1039 $('#loader_ajax').remove(); 1040 $('#loader_ajax').empty(); 1041 $target.remove($('#loader_ajax')); 1042 $('#btnConfirmAjout').attr("disabled", "disabled"); 1043 $('#btnConfirmAjout').remove(); 1044 $target.html(data); 1045 } 1046 }); 1047 } 1048 return false; 1049}); 1050});
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.