{"version":3,"sources":["Scripts/src/form/setIndicatifTelephonique.js","Scripts/src/form/validation.js"],"names":["$","idPaysForMobile","idPaysForFixe","selectPaysId","tempText","indicatif","url","document","location","href","indexOf","varPaysResidence","idPays","getElementById","setIndicatif","a","options","selectedIndex","text","indicatifTemp","split","substring","length","previousElementSibling","innerHTML","value","on","this","formulaire","selectors","idConfirmation","idMessageError","classErrorName","classValidation","idSubmit","fieldsList","fieldClass","fieldClassName","fieldActiveClassName","fieldFilledClassName","fieldErrorClassName","animationField","el","active","formField","parentNode","classList","add","remove","showErrorMessage","idField","msg","fieldError","innerText","closest","flagError","callbackFocus","field","contains","forEach","call","querySelectorAll","utilities","regexMail","regexTel","testRegex","regex","champ","test","validationForm","style","display","formulaireValidationElements","map","idValidation","console","error","concat","undefined","validationSpeciale","libelleValidation","formulaireValidationElementsTelephone","filter","typeField","fieldTelephonePrincipal","principal","fieldTelephoneSecondaire","arrayIndicatif","flagMsgtel","idPrincipal","idSecondaire","callback","invalide","obligatoire","arrayMail","ajax","formSettings","urlAction","data","civilite","val","nom","prenom","email","telephonePortable","telephonePerso","codeIsoForMobile","codeIsoForFixe","sujet","message","to","type","success","j","MessageError","alert","init","onblur","onfocus","addEventListener","fieldRelation","isVisible"],"mappings":"20CAACA,EAAE,WAGF,GAAIC,GAAkB,mBAClBC,EAAgB,iBAChBC,EAAe,OACfC,EAAW,GACXC,EAAY,GAEZC,EAAMC,SAASC,SAASC,IAa5B,IAZIH,EAAII,QAAQ,0BAA2B,GAAK,IAG/CT,EAAkB,2CAClBC,EAAgB,yCAChBC,EAAe,+BACfC,EAAW,GACXC,EAAY,IAKkB,mBAApBM,kBAAiC,CAC3C,GAAIC,GAASL,SAASM,eAAeF,iBACrCR,GAAeQ,qBAGf,IAAIC,GAASL,SAASM,eAAeV,EAGtC,IAAIW,GAAe,SAAUC,GAK5B,GADAX,EAAWW,EAAEC,QAAQD,EAAEE,eAAeC,KACtB,MAAZd,GAAgC,QAAZA,EAAoB,CAC3C,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ACdM,kBAAmB,qBACnBJ,MAAO,KAEP1B,QAAS,YACTwB,aAAc,8BACdM,mBACCY,SAAU,qBACVC,YAAa,yBAEdjB,MAAO,GACPe,SAAU/D,WAAWkC,UAAUG,UAC/BkB,UAAW,YACXJ,oBAAoB,EACpBM,WAAW,IAEXnC,QAAS,UACTwB,aAAc,4BACdM,mBACCY,SAAU,qBACVC,YAAa,yBAEdjB,MAAO,GACPe,SAAU/D,WAAWkC,UAAUG,UAC/BuD,cAAe,YACfrC,UAAW,YACXJ,oBAAoB,EACpB0C,WAAW,IAEXvE,QAAS,mBACTwB,aAAc,qCACdM,kBAAmB,6BACnBJ,MAAO,GACPO,UAAW,qBACXqC,cAAe,YACfzC,oBAAoB,IAEpB7B,QAAS,iBACTwB,aAAc,mCACdM,kBAAmB,6BACnBJ,MAAO,GACPO,UAAW,qBACXqC,cAAe,UACfzC,oBAAoB,IAEpB7B,QAAS,QACTwB,aAAc,0BACdM,mBACCY,SAAU,iBACVC,YAAa,qBAEdjB,MAAO,GACPe,SAAU/D,WAAWkC,UAAUG,UAC/BkB,UAAW,UAEXjC,QAAS,UACTwB,aAAc,4BACdM,kBAAmB,sBACnBJ,MAAO","file":"static/scripts/form.js.map","sourcesContent":["$(function () {\r\n\r\n\r\n\tvar idPaysForMobile = 'CodeIsoForMobile';\r\n\tvar idPaysForFixe = 'CodeIsoForFixe';\r\n\tvar selectPaysId = 'Pays';\r\n\tvar tempText = '';\r\n\tvar indicatif = '';\r\n\r\n\tvar url = document.location.href;\r\n\tif (url.indexOf(\"inscription/coordonnees\", 0) > 0) {\r\n\r\n\r\n\t\tidPaysForMobile = 'Inscription_Coordonnees_CodeIsoForMobile';\r\n\t\tidPaysForFixe = 'Inscription_Coordonnees_CodeIsoForFixe';\r\n\t\tselectPaysId = 'Inscription_Coordonnees_Pays';\r\n\t\ttempText = '';\r\n\t\tindicatif = ''\r\n\r\n\t}\r\n\r\n\t// cas specifique formulaire groupe\r\n\tif (typeof varPaysResidence != 'undefined') {\r\n\t\tvar idPays = document.getElementById(varPaysResidence);\r\n\t\tselectPaysId = varPaysResidence;\r\n\t} else {\r\n\r\n\t\tvar idPays = document.getElementById(selectPaysId);\r\n\t}\r\n\r\n\tvar setIndicatif = function (a) {\r\n\t\t// On récupère le text de l'option sélectionnée\r\n\t\t// puis on extrait l'indicatif seul et on le met dans la .box-input\r\n\r\n\t\ttempText = a.options[a.selectedIndex].text;\r\n\t\tif (tempText != '--' && tempText != '----') {\r\n\t\t\tvar indicatifTemp = tempText.split('(');\r\n\t\t\tindicatif = indicatifTemp[1].substring(0, indicatifTemp[1].length - 1);\r\n\t\t\ta.previousElementSibling.innerHTML = indicatif;\r\n\t\t} else {\r\n\t\t\ta.previousElementSibling.innerHTML = '--';\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tif (url.indexOf(\"inscription/coordonnees\", 0) > 0) {\r\n\t\t// Si un pays de résidence est sélectionné au load\r\n\r\n\t\tif (idPays != null && idPays.options[idPays.selectedIndex].value != '') {\r\n\t\t\tsetIndicatif(document.getElementById(idPaysForMobile));\r\n\t\t\tsetIndicatif(document.getElementById(idPaysForFixe));\r\n\t\t} else {\r\n\t\t\tsetIndicatif(document.getElementById(idPaysForMobile));\r\n\t\t\tsetIndicatif(document.getElementById(idPaysForFixe));\r\n\t\t}\r\n\t} else {\r\n\r\n\t\tsetIndicatif(document.getElementById(idPaysForMobile));\r\n\t\tsetIndicatif(document.getElementById(idPaysForFixe));\r\n\t}\r\n\r\n\t// Event : selection pays de résidence\r\n\t$('#' + selectPaysId).on('change', function () {\r\n\r\n\t\t// On préremplit la combo des indicatifs téléphoniques\r\n\t\tdocument.getElementById(idPaysForMobile).value = this.value;\r\n\t\tdocument.getElementById(idPaysForFixe).value = this.value;\r\n\t\tsetIndicatif(document.getElementById(idPaysForMobile));\r\n\t\tsetIndicatif(document.getElementById(idPaysForFixe));\r\n\r\n\t});\r\n\t// On applique la même function si changement direct indicatif\r\n\t$('#' + idPaysForMobile).on('change', function () {\r\n\t\tsetIndicatif(document.getElementById(idPaysForMobile));\r\n\t});\r\n\t$('#' + idPaysForFixe).on('change', function () {\r\n\t\tsetIndicatif(document.getElementById(idPaysForFixe));\r\n\t});\r\n});","const formulaire = {\r\n\tselectors: {\r\n\t\tidConfirmation: 'confirmation',\r\n\t\tidMessageError: 'messageError',\r\n\t\tclassErrorName: 'erreur--form',\r\n\t\tclassValidation: '.field-validation',\r\n\t\tidSubmit: 'btnSubmit',\r\n\t\tfieldsList: '.field__select, .field__input, .field__textarea',\r\n\t\tfieldClass: '.field',\r\n\t\tfieldClassName: 'field',\r\n\t\tfieldActiveClassName: 'form-field--is-active',\r\n\t\tfieldFilledClassName: 'form-field--is-filled',\r\n\t\tfieldErrorClassName: 'form-field--is-error',\r\n\t},\r\n\t/// Gestion de l'animation du label au focus et au blur\r\n\tanimationField: function (el, active) {\r\n\t\tconst formField = el.parentNode;\r\n\t\tif (active) {\r\n\t\t\tformField.classList.add(formulaire.selectors.fieldActiveClassName)\r\n\t\t} else {\r\n\t\t\tformField.classList.remove(formulaire.selectors.fieldActiveClassName)\r\n\t\t\tel.value === '' ?\r\n\t\t\t\tformField.classList.remove(formulaire.selectors.fieldFilledClassName) :\r\n\t\t\t\tformField.classList.add(formulaire.selectors.fieldFilledClassName)\r\n\t\t}\r\n\t},\r\n\t/// Function appelée lorsqu'un champ obligatoire \r\n\t/// est manquant ou invalide\r\n\tshowErrorMessage: function (idField, msg) {\r\n\t\tlet fieldError = document.getElementById(idField);\r\n\t\tfieldError.innerText = msg;\r\n\t\tfieldError.classList.add(formulaire.selectors.classErrorName);\r\n\t\tfieldError.closest(formulaire.selectors.fieldClass).classList.add(formulaire.selectors.fieldErrorClassName);\r\n\t\tflagError = true;\r\n\t},\r\n\t/// Au cas où le champ soit en erreur,\r\n\t/// au focus, on retire l'erreur\r\n\tcallbackFocus: function (el) {\r\n\t\tconst field = el.parentNode.classList.contains(formulaire.selectors.fieldClassName) ? el.parentNode : el.closest('.field');\r\n\t\tfield.classList.remove(formulaire.selectors.fieldErrorClassName);\r\n\r\n\t\t[].forEach.call(field.querySelectorAll(formulaire.selectors.classValidation), function (el) {\r\n\t\t\tel.innerText = '';\r\n\t\t});\r\n\t},\r\n\t///\r\n\t/// functions utilitaires\r\n\tutilities: {\r\n\t\tregexMail: /^[a-zA-Z0-9._-]+@[a-z0-9._-]{2,}\\.[a-z]{2,4}$/,\r\n\t\tregexTel: /^((\\+\\d{1,3}(-| )?\\(?\\d\\)?(-| )?\\d{1,5})|(\\(?\\d{2,6}\\)?))(-| )?(\\d{3,4})(-| )?(\\d{4})(( x| ext)\\d{1,5}){0,1}$/,\r\n\t\ttestRegex: function (regex, champ) {\r\n\t\t\tif (!regex.test(champ)) {\r\n\t\t\t\treturn false;\r\n\t\t\t} else {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tvalidationForm: function () {\r\n\t\tvar flagError = false;\r\n\t\tdocument.getElementById(formulaire.selectors.idConfirmation).style.display = 'none';\r\n\r\n\t\t/// Validation \r\n\t\t/// des éléments obligatoires non spécifiques\r\n\t\tformulaireValidationElements.map(el => {\r\n\t\t\t/// On réinitialise les champs d'erreur\r\n\t\t\tif (document.getElementById(el.idValidation) != null)\r\n\t\t\t\tdocument.getElementById(el.idValidation).innerText = \"\";\r\n\t\t\telse\r\n\t\t\t\tconsole.error(`Le sélecteur #${el.idValidation} n'existe pas.`);\r\n\r\n\t\t\tif (el.validationSpeciale === undefined) {\r\n\t\t\t\tdocument.getElementById(el.idField).value == el.error && formulaire.showErrorMessage(el.idValidation, el.libelleValidation);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/// Validation \r\n\t\t/// des champs téléphoniques\r\n\t\tconst formulaireValidationElementsTelephone = formulaireValidationElements.filter(formulaireValidationElements => formulaireValidationElements.typeField === 'telephone' || formulaireValidationElements.typeField === 'telephoneIndicatif');\r\n\r\n\t\t/// Distinction téléphone principal vs téléphone secondaire, array des indicatifs\r\n\t\tconst fieldTelephonePrincipal = formulaireValidationElementsTelephone.filter(el => el.principal);\r\n\t\tconst fieldTelephoneSecondaire = formulaireValidationElementsTelephone.filter(el => !el.principal);\r\n\t\tconst arrayIndicatif = formulaireValidationElementsTelephone.filter(el => el.typeField === 'telephoneIndicatif');\r\n\r\n\t\tlet flagMsgtel = false;\r\n\t\tlet idPrincipal = fieldTelephonePrincipal[0].idField;\r\n\t\tlet idSecondaire = fieldTelephoneSecondaire[0].idField;\r\n\r\n\t\tif (document.getElementById(idPrincipal).value != fieldTelephonePrincipal[0].error && !fieldTelephonePrincipal[0].callback(formulaire.utilities.regexTel, document.getElementById(idPrincipal).value)) {\r\n\t\t\tformulaire.showErrorMessage(fieldTelephonePrincipal[0].idValidation, fieldTelephonePrincipal[0].libelleValidation.invalide);\r\n\t\t\tflagMsgtel = true;\r\n\t\t}\r\n\r\n\t\tif (document.getElementById(idSecondaire).value != fieldTelephoneSecondaire[0].error && !fieldTelephoneSecondaire[0].callback(formulaire.utilities.regexTel, document.getElementById(idSecondaire).value)) {\r\n\t\t\tformulaire.showErrorMessage(fieldTelephoneSecondaire[0].idValidation, fieldTelephoneSecondaire[0].libelleValidation.invalide);\r\n\t\t\tflagMsgtel = true;\r\n\t\t}\r\n\r\n\t\tif (document.getElementById(idPrincipal).value == fieldTelephonePrincipal[0].error && document.getElementById(idSecondaire).value == fieldTelephoneSecondaire[0].error) {\r\n\t\t\tformulaire.showErrorMessage(fieldTelephonePrincipal[0].idValidation, fieldTelephonePrincipal[0].libelleValidation.obligatoire);\r\n\t\t\tflagMsgtel = true;\r\n\t\t}\r\n\r\n\t\tif (!flagMsgtel) {\r\n\t\t\tarrayIndicatif.map(el => {\r\n\t\t\t\tdocument.getElementById(el.idField).value == el.error && formulaire.showErrorMessage(el.idValidation, el.libelleValidation);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t/// Validation \r\n\t\t/// du champ mail\r\n\t\tconst arrayMail = formulaireValidationElements.filter(el => el.typeField === 'email');\r\n\r\n\t\tif (document.getElementById(arrayMail[0].idField).value == arrayMail[0].error) {\r\n\t\t\tformulaire.showErrorMessage(arrayMail[0].idValidation, arrayMail[0].libelleValidation.obligatoire);\r\n\t\t} else {\r\n\t\t\tif (!arrayMail[0].callback(formulaire.utilities.regexMail, document.getElementById(arrayMail[0].idField).value)) {\r\n\t\t\t\tformulaire.showErrorMessage(arrayMail[0].idValidation, arrayMail[0].libelleValidation.invalide);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tdocument.getElementById(formulaire.selectors.idMessageError).innerText = '';\r\n\r\n\t\tif (flagError == false) {\r\n\t\t\t// Dynamiser data récupéré\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: formSettings.urlAction,\r\n\t\t\t\tdata: {\r\n\t\t\t\t\tcivilite: $(\"#Civilite\").val(),\r\n\t\t\t\t\tnom: $(\"#Nom\").val(),\r\n\t\t\t\t\tprenom: $(\"#Prenom\").val(),\r\n\t\t\t\t\temail: $(\"#Email\").val(),\r\n\t\t\t\t\ttelephonePortable: $(\"#TelMobile\").val(),\r\n\t\t\t\t\ttelephonePerso: $(\"#TelFixe\").val(),\r\n\t\t\t\t\tcodeIsoForMobile: $(\"#CodeIsoForMobile\").val(),\r\n\t\t\t\t\tcodeIsoForFixe: $(\"#CodeIsoForFixe\").val(),\r\n\t\t\t\t\tsujet: formSettings.sujet,\r\n\t\t\t\t\tmessage: $(\"#message\").val(),\r\n\t\t\t\t\tto: \"\"\r\n\t\t\t\t},\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\tsuccess: function (j) {\r\n\t\t\t\t\tif (j.MessageError != null && j.MessageError != \"\") {\r\n\t\t\t\t\t\tdocument.getElementById(formulaire.selectors.idMessageError).innerHTML = j.MessageError;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tdocument.getElementById(formulaire.selectors.idConfirmation).style.display = 'block';\r\n\t\t\t\t\t\tdocument.getElementById(formulaire.selectors.idSubmit).style.display = 'none';\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror: function (data) {\r\n\t\t\t\t\talert(\"Une erreur est survenu,l'envoi de votre demande n'a pas pu aboutir\");\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\tinit: function () {\r\n\t\t[].forEach.call(\r\n\t\t\tdocument.querySelectorAll(formulaire.selectors.fieldsList),\r\n\t\t\t(el) => {\r\n\t\t\t\tel.onblur = () => {\r\n\t\t\t\t\tformulaire.animationField(el, false)\r\n\t\t\t\t}\r\n\t\t\t\tel.onfocus = () => {\r\n\t\t\t\t\tformulaire.animationField(el, true);\r\n\t\t\t\t\tformulaire.callbackFocus(el);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tel.value != '' && formulaire.animationField(el, true);\r\n\t\t\t});\r\n\r\n\t\tdocument.getElementById(formulaire.selectors.idSubmit).addEventListener('click', function () {\r\n\t\t\tformulaire.validationForm();\r\n\t\t})\r\n\t}\r\n}\r\n\r\nvar flagError = false;\r\n\r\ndocument.addEventListener('DOMContentLoaded', function () {\r\n\tformulaire.init();\r\n})\r\n\r\n\r\nconst formulaireValidationElements = [{\r\n\tidField: 'Civilite',\r\n\tidValidation: 'Civilite_validationMessage',\r\n\tlibelleValidation: 'Civilité obligatoire',\r\n\terror: '0'\r\n}, {\r\n\tidField: 'Nom',\r\n\tidValidation: 'Nom_validationMessage',\r\n\tlibelleValidation: 'Nom obligatoire',\r\n\terror: ''\r\n}, {\r\n\tidField: 'Prenom',\r\n\tidValidation: 'Prenom_validationMessage',\r\n\tlibelleValidation: 'Prénom obligatoire',\r\n\terror: ''\r\n}, {\r\n\tidField: 'TelMobile',\r\n\tidValidation: 'TelMobile_validationMessage',\r\n\tlibelleValidation: {\r\n\t\tinvalide: 'Téléphone invalide',\r\n\t\tobligatoire: 'Téléphone obligatoire'\r\n\t},\r\n\terror: '',\r\n\tcallback: formulaire.utilities.testRegex,\r\n\ttypeField: 'telephone',\r\n\tvalidationSpeciale: true,\r\n\tprincipal: true\r\n}, {\r\n\tidField: 'TelFixe',\r\n\tidValidation: 'TelFixe_validationMessage',\r\n\tlibelleValidation: {\r\n\t\tinvalide: 'Téléphone invalide',\r\n\t\tobligatoire: 'Téléphone obligatoire'\r\n\t},\r\n\terror: '',\r\n\tcallback: formulaire.utilities.testRegex,\r\n\tfieldRelation: 'TelMobile',\r\n\ttypeField: 'telephone',\r\n\tvalidationSpeciale: true,\r\n\tisVisible: false\r\n}, {\r\n\tidField: 'CodeIsoForMobile',\r\n\tidValidation: 'CodeIsoForMobile_validationMessage',\r\n\tlibelleValidation: 'Indicatif pays obligatoire',\r\n\terror: '',\r\n\ttypeField: 'telephoneIndicatif',\r\n\tfieldRelation: 'TelMobile',\r\n\tvalidationSpeciale: true\r\n}, {\r\n\tidField: 'CodeIsoForFixe',\r\n\tidValidation: 'CodeIsoForFixe_validationMessage',\r\n\tlibelleValidation: 'Indicatif pays obligatoire',\r\n\terror: '',\r\n\ttypeField: 'telephoneIndicatif',\r\n\tfieldRelation: 'TelFixe',\r\n\tvalidationSpeciale: true\r\n}, {\r\n\tidField: 'Email',\r\n\tidValidation: 'Email_validationMessage',\r\n\tlibelleValidation: {\r\n\t\tinvalide: 'Email invalide',\r\n\t\tobligatoire: 'Email obligatoire'\r\n\t},\r\n\terror: '',\r\n\tcallback: formulaire.utilities.testRegex,\r\n\ttypeField: 'email'\r\n}, {\r\n\tidField: 'message',\r\n\tidValidation: 'Message_validationMessage',\r\n\tlibelleValidation: 'Message obligatoire',\r\n\terror: ''\r\n}];"]}