Changes for public/dist/assets/signatureflows-0fb20351.js: 1 added line, 0 removed lines.
Original line number
Diff line number
Diff line
import{oasr,caso,aast,wasg,vasm,rask,Fasf,basS,dasF,easb,fasu,tasa,gas_,hasv,iasO,jasx}from"../vendor.js";consty=(n,e)=>{constd=n.__vccOpts||n;for(const[h,i]ofe)d[h]=i;returnd},D={props:{recipient:{default:{}}}},E={class:"form-recipient"},M={action:"",class:"form-inline"};functionL(n,e,d,h,i,s){returnr(),o("section",E,[t("form",M,[g(t("input",{type:"text",class:"form-control",placeholder:"Nom","onUpdate:modelValue":e[0]||(e[0]=p=>d.recipient.lastname=p)},null,512),[[m,d.recipient.lastname]]),g(t("input",{type:"text",class:"form-control",placeholder:"Prénom","onUpdate:modelValue":e[1]||(e[1]=p=>d.recipient.firstname=p)},null,512),[[m,d.recipient.firstname]]),g(t("input",{type:"text",class:"form-control",placeholder:"Email","onUpdate:modelValue":e[2]||(e[2]=p=>d.recipient.email=p)},null,512),[[m,d.recipient.email]]),t("button",{class:"btn btn-xs btn-default",onClick:e[3]||(e[3]=p=>n.$emit("delete",d.recipient))},"Supprimer")])])}constV=y(D,[["render",L]]),U={components:{Recipient:V},props:{recipients:{default:[]}},methods:{handlerAdd(n){this.recipients.push({firstname:"",lastname:"",email:""})},handlerDelete(n){lete=this.recipients.indexOf(n);this.recipients.splice(e,1)}}},J={class:"form-recipients"};functionA(n,e,d,h,i,s){constp=k("recipient");returnr(),o("section",J,[(r(!0),o(f,null,S(d.recipients,l=>(r(),o("article",null,[F(p,{recipient:l,onDelete:c=>s.handlerDelete(l)},null,8,["recipient","onDelete"])]))),256)),t("button",{onClick:e[0]||(e[0]=(...l)=>s.handlerAdd&&s.handlerAdd(...l))},"Ajouter")])}constP=y(U,[["render",A]]);constR={components:{Recipients:P},props:{entrypoint:{required:!0,type:String}},data(){return{signatureflows:[],letterfiles:[],get_recipients_methods:null,editStep:null,editedStep:null,editSignatureFlow:null,editedSignatureFlow:null,error:""}},methods:{handlerRecipientsChange(n){console.log("handlerRecipientsChange",n)},handlerEditSignatureFlow(n){this.editedSignatureFlow=n,this.editSignatureFlow=JSON.parse(JSON.stringify(n))},handlerDeleteSignatureFlow(n){this.remoteDelete(n)},handlerEditSignatureFlowCancel(){this.editedStep=null,this.editStep=null,this.editSignatureFlow=null,this.editedSignatureFlow=null},handlerEditSignatureFlowSave(){if(this.editedSignatureFlow){letn=this.signatureflows.indexOf(this.editSignatureFlow);this.signatureflows[n]=JSON.parse(JSON.stringify(this.editSignatureFlow))}elsethis.signatureflows.push(JSON.parse(JSON.stringify(this.editSignatureFlow)));this.remoteSave(this.editSignatureFlow),this.editSignatureFlow=null},handlerNewSignatureFlow(){this.editSignatureFlow={id:null,label:"Nouvelle procédure",description:"",letterfile:"",level:"",steps:[],options:null}},handlerNewStep(){letn=this.editSignatureFlow.steps.length;this.editSignatureFlow.steps.push({id:null,label:"Nouvelle étape",order:n,letterfile:null,level:null,allValid:!1,getReceipedMethd:"todo"})},handlerEditStepCancel(){this.editStep=null,this.editedStep=null},handlerEditStepSave(){letn=this.editSignatureFlow.steps.indexOf(this.editedStep);this.editSignatureFlow.steps[n]=JSON.parse(JSON.stringify(this.editStep)),this.editStep=null,this.editedStep=null},handlerEditStep(n){this.editStep=JSON.parse(JSON.stringify(n)),this.editedStep=n;lete=this.getStepOptions(n);console.log("options",e)},handlerDeleteStep(n){lete=this.editSignatureFlow.steps.indexOf(n);this.editSignatureFlow.steps.splice(e,1)},getLevels(n){for(lete=0;e<this.letterfiles.length;e++)if(this.letterfiles[e].name==n)returnthis.letterfiles[e].levels;return[]},getLevelsLabel(n){if(n.level)if(n.letterfile){leth=this.getLevels(n.letterfile);for(leti=0;i<h.length;i++)if(h[i].key==n.level)returnh[i].label;return"inconnue"}elsereturn"Pas de parapheur";elsereturn"Non configuré"},handlerChangeMethod(n){lete=this.getMethodOptions(this.editStep.method);(!this.editStep.options||Array.isArray(this.editStep.options))&&(this.editStep.options={}),e.forEach(d=>{this.editStep.options.hasOwnProperty(d.key)||(this.editStep.options[d.key]=[])})},getMethod(n){for(lete=0;e<this.get_recipients_methods.length;e++)if(this.get_recipients_methods[e].key==n)returnthis.get_recipients_methods[e];returnnull},getMethodLabel(n){lete=this.getMethod(n);returne?e.label:"N.D"},getMethodOptions(n){lete=this.getMethod(n);returne?e.options:null},getMethodOptionsDefaultValue(n){returnthis.getMethod(n)?[]:null},getStepOptions(n){lete=this.getMethod(n.method);returne?e.options:null},stepHasOptions(n){returnthis.getStepOptions(n)!=null},getLetterfile(n){for(lete=0;e<this.letterfiles.length;e++)if(this.letterfiles[e].name==n)returnthis.letterfiles[e];returnnull},getLetterfileLabel(n){lete=this.getLetterfile(n);returne?e.label:"N.D"},fetch(){this.loading="Chargement des processus",b.get(this.entrypoint).then(n=>{this.signatureflows=n.data.signatureflows,this.letterfiles=n.data.letterfiles,this.get_recipients_methods=n.data.get_recipients_methods,this.loading=""},n=>{this.error=""})},remoteDelete(n){this.loading="Suppression";lete=newFormData;e.append("action","delete"),e.append("json",JSON.stringify(n)),b.post(this.entrypoint,e).then(d=>{this.loading="",this.fetch()},d=>{this.loading="";try{this.error=d.response.data.error}catch{this.error="Une erreur inconnue est survenue côté serveur"}})},remoteSave(n){this.loading="Enregistement";lete=newFormData;e.append("action","save"),e.append("json",JSON.stringify(n)),b.post(this.entrypoint,e).then(d=>{this.loading="",this.fetch()},d=>{this.loading="";try{this.error=d.response.data.error}catch{this.error="Une erreur inconnue est survenue côté serveur"}})}},mounted(){this.fetch()}},j={class:"signatureflows"},I={key:0,class:"overlay error"},T={class:"overlay-content"},B=t("hr",null,null,-1),q={key:1,class:"overlay"},H={class:"overlay-content"},K=t("i",{class:"icon-spinner animate-spin"},null,-1),z={class:"row"},G={class:"col-md-12"},Q={key:0,class:"signatureflows-edit"},W=t("h2",null,"Edition de la procédure",-1),X=t("label",{for:"label"}," Intitulé ",-1),Y=t("label",{for:"description"}," Description ",-1),Z={class:""},$={key:0,class:"step-edit"},ee=t("label",{for:"letterfile"},"Parapheur",-1),te=["value"],le=t("label",{for:"level"},"Type de validation",-1),ne=["value"],ie=t("label",{for:"method"},"Méthode d'obtention des destinataires",-1),se=["value"],re={key:1,class:"options"},oe=t("h3",null,"Paramètres de récupération des destinataires",-1),de={key:0},ae=["for"],ue=["onUpdate:modelValue","value","id"],ce={key:1},he={key:1},pe=t("h3",null,"étapes",-1),ge={class:"steps"},fe={class:"step"},Se=t("i",{class:"icon-location"},null,-1),_e=t("br",null,null,-1),me=t("br",null,null,-1),be={class:"buttons-bar"},ve=["onClick"],ye=["onClick"],we={class:"buttons-bar"},ke=t("i",{class:"icon-location"},null,-1),Fe={class:"buttons-bar"},Ce={key:1},Ne={class:"signatureflow"},Oe={key:0,class:"steps"},xe={class:"step"},De={key:1,class:"alert alert-info"},Ee={class:"buttons-bar"},Me=["onClick"],Le=["onClick"],Ve=t("hr",null,null,-1);functionUe(n,e,d,h,i,s){constp=k("recipients");returnr(),o("section",j,[i.error?(r(),o("div",I,[t("div",T,[u(a(i.error)+"",1),B,t("a",{href:"#",class:"btn btn-default",onClick:e[0]||(e[0]=l=>i.error="")},"Fermer")])])):_("",!0),n.loading?(r(),o("div",q,[t("div",H,[K,u(""+a(n.loading),1)])])):_("",!0),t("section",z,[t("div",G,[i.editSignatureFlow?(r(),o("article",Q,[W,t("div",null,[X,g(t("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>i.editSignatureFlow.label=l),id:"label",type:"text",name:"label",placeholder:"Intitulé",class:"form-control input-lg"},null,512),[[m,i.editSignatureFlow.label]])]),t("div",null,[Y,g(t("textarea",{"onUpdate:modelValue":e[2]||(e[2]=l=>i.editSignatureFlow.description=l),id:"description",type:"text",name:"description",placeholder:"Une description",class:"form-control input-lg"},null,512),[[m,i.editSignatureFlow.description]])]),t("section",Z,[i.editStep?(r(),o("article",$,[t("h3",null,[u(" Modification de l'étape "),t("strong",null,a(i.editStep.label),1)]),g(t("input",{type:"text","onUpdate:modelValue":e[3]||(e[3]=l=>i.editStep.label=l),class:"form-control"},null,512),[[m,i.editStep.label]]),ee,g(t("select",{"onUpdate:modelValue":e[4]||(e[4]=l=>i.editStep.letterfile=l),id:"letterfile",class:"form-control"},[(r(!0),o(f,null,S(i.letterfiles,l=>(r(),o("option",{value:l.name},a(l.label),9,te))),256))],512),[[v,i.editStep.letterfile]]),le,i.editStep.letterfile?g((r(),o("select",{key:0,"onUpdate:modelValue":e[5]||(e[5]=l=>i.editStep.level=l),id:"level",class:"form-control"},[(r(!0),o(f,null,S(s.getLevels(i.editStep.letterfile),l=>(r(),o("option",{value:l.key},a(l.label),9,ne))),256))],512)),[[v,i.editStep.level]]):_("",!0),ie,g(t("select",{"onUpdate:modelValue":e[6]||(e[6]=l=>i.editStep.method=l),id:"method",class:"form-control",onChange:e[7]||(e[7]=(...l)=>s.handlerChangeMethod&&s.handlerChangeMethod(...l))},[(r(!0),o(f,null,S(i.get_recipients_methods,l=>(r(),o("option",{value:l.key},a(l.label),9,se))),256))],544),[[v,i.editStep.method]]),s.stepHasOptions(i.editStep)?(r(),o("section",re,[oe,(r(!0),o(f,null,S(s.getStepOptions(i.editStep),l=>(r(),o("section",null,[t("h4",null,a(l.label),1),t("p",null,a(l.description),1),t("p",null,a(l.type),1),l.type=="checkbox"?(r(),o("section",de,[(r(!0),o(f,null,S(l.values,(c,w)=>(r(),o("label",{for:l.key+"_"+w,class:"form-control"},[g(t("input",{"onUpdate:modelValue":N=>i.editStep.options[l.key]=N,type:"checkbox",value:c.id,id:l.key+"_"+w},null,8,ue),[[O,i.editStep.options[l.key]]]),u(""+a(c.label),1)],8,ae))),256))])):_("",!0),l.type=="recipients"?(r(),o("section",ce,[F(p,{recipients:i.editStep.options[l.key],onChange:s.handlerRecipientsChange},null,8,["recipients","onChange"])])):_("",!0)]))),256))])):_("",!0),t("nav",null,[t("button",{onClick:e[8]||(e[8]=(...l)=>s.handlerEditStepSave&&s.handlerEditStepSave(...l)),class:"btn btn-success"},"Terminer"),t("button",{onClick:e[9]||(e[9]=(...l)=>s.handlerEditStepCancel&&s.handlerEditStepCancel(...l)),class:"btn btn-danger"},"Annuler")])])):(r(),o("section",he,[pe,t("section",ge,[(r(!0),o(f,null,S(i.editSignatureFlow.steps,l=>(r(),o("article",fe,[t("h4",null,[Se,u(""+a(l.label),1)]),t("div",null,[u(" Niveau de validation : "),t("strong",null,a(s.getLevelsLabel(l)),1),_e,u(" Parapheur : "),t("strong",null,a(s.getLetterfileLabel(l.letterfile)),1),me,u(" Destinataires : "),t("strong",null,a(s.getMethodLabel(l.method)),1)]),t("nav",be,[t("button",{class:"btn btn-default btn-xs",onClick:c=>s.handlerEditStep(l)},"Modifier",8,ve),t("button",{class:"btn btn-default btn-xs",onClick:c=>s.handlerDeleteStep(l)},"Supprimer",8,ye)])]))),256)),t("nav",we,[t("button",{onClick:e[10]||(e[10]=(...l)=>s.handlerNewStep&&s.handlerNewStep(...l)),class:"btn btn-default"},[ke,u(" Nouvelle étape ")])])]),t("nav",Fe,[t("button",{onClick:e[11]||(e[11]=(...l)=>s.handlerEditSignatureFlowSave&&s.handlerEditSignatureFlowSave(...l)),class:"btn btn-large btn-success"},"Enregistrer la procédure "),t("button",{onClick:e[12]||(e[12]=(...l)=>s.handlerEditSignatureFlowCancel&&s.handlerEditSignatureFlowCancel(...l)),class:"btn btn-danger"},"Annuler les modifications ")])]))])])):(r(),o("section",Ce,[(r(!0),o(f,null,S(i.signatureflows,l=>(r(),o("article",Ne,[t("h3",null,[u("Procédure : "),t("strong",null,a(l.label),1),u(),t("small",null," (ID: "+a(l.id)+")",1)]),t("p",null,[t("small",null,a(l.description),1)]),l.steps.length?(r(),o("section",Oe,[(r(!0),o(f,null,S(l.steps,c=>(r(),o("article",xe,[t("h4",null,a(c.label),1),t("small",null,[u(" Parapheur : "),t("strong",null,a(s.getLetterfileLabel(c.letterfile)),1),u(" - Niveau de validation : "),t("strong",null,a(s.getLevelsLabel(c)),1),u(" - Destinataires : "),t("strong",null,a(s.getMethodLabel(c.method)),1)])]))),256))])):(r(),o("section",De," Aucune étape configurée ")),t("nav",Ee,[t("button",{class:"btn btn-xs",onClick:c=>s.handlerEditSignatureFlow(l)},"Modifier la procédure",8,Me),t("button",{class:"btn btn-xs",onClick:c=>s.handlerDeleteSignatureFlow(l)},"Supprimer la procédure",8,Le)])]))),256)),t("nav",null,[t("button",{class:"btn btn-success",onClick:e[13]||(e[13]=(...l)=>s.handlerNewSignatureFlow&&s.handlerNewSignatureFlow(...l))}," Nouvelle procédure ")])])),Ve])])])}constJe=y(R,[["render",Ue]]);letC="#signatureflows",Ae=document.querySelector(C);constPe=x(Je,{entrypoint:Ae.dataset.entrypoint});Pe.mount(C);