Changes for public/dist/assets/signatureflows-5ab2ee16.js: 1 added line, 0 removed lines.
Original line number
Diff line number
Diff line
import{aasb,rask,casr,bast,dasu,tasd,easf,wasS,v,fasm,Fasp,gasc,o,hasC,iasN,jasO}from"../vendor.js";import{_asE,RasM}from"../vendor2.js";constD={components:{Recipients:M},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)},handlerUp(n){console.log("handlerUp"),this.moveStep(n,-1)},handlerDown(n){console.log("handlerDown"),this.moveStep(n,1)},moveStep(n,e){leta=this.editSignatureFlow.steps.indexOf(n);if(a==this.editSignatureFlow.steps.length&&e==1||a==0&&e==-1)return;letg=this.editSignatureFlow.steps[a];this.editSignatureFlow.steps.splice(a,1),this.editSignatureFlow.steps.splice(a+e,0,g),this.updateOrder()},updateOrder(){console.log("Update order");letn=1;this.editSignatureFlow.steps.forEach(e=>{e.order=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+1;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),this.updateOrder()},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){letg=this.getLevels(n.letterfile);for(leti=0;i<g.length;i++)if(g[i].key==n.level)returng[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(a=>{this.editStep.options.hasOwnProperty(a.key)||(this.editStep.options[a.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(a=>{this.loading="",this.fetch()},a=>{this.loading="";try{this.error=a.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(a=>{this.loading="",this.fetch()},a=>{console.log(a),this.loading="",a.response.data.error?this.error=a.response.data.error:this.error="Une erreur inconnue est survenue côté serveur"})}},mounted(){this.fetch()}},L={class:"signatureflows"},x={key:0,class:"overlay error"},U={class:"overlay-content"},V=t("hr",null,null,-1),J={key:1,class:"overlay"},P={class:"overlay-content"},A=t("i",{class:"icon-spinner animate-spin"},null,-1),R={class:"row"},I={class:"col-md-12"},T={key:0,class:"signatureflows-edit"},j=t("h2",null,"Edition de la procédure",-1),B=t("label",{for:"label"}," Intitulé ",-1),q=t("label",{for:"description"}," Description ",-1),H={class:""},K={key:0,class:"step-edit"},z=t("label",{for:"letterfile"},"Parapheur",-1),G=["value"],Q=t("label",{for:"level"},"Type de validation",-1),W=["value"],X=t("label",{for:"method"},"Méthode d'obtention des destinataires",-1),Y=["value"],Z={key:1,class:"options"},$=t("h3",null,"Paramètres de récupération des destinataires",-1),ee={key:0},te=["for"],le=["onUpdate:modelValue","value","id"],ne={key:1},ie={key:1},se=t("h3",null,"étapes",-1),re={class:"steps"},oe={class:"step"},de=t("i",{class:"icon-location"},null,-1),ae=t("br",null,null,-1),ue=t("br",null,null,-1),he={class:"buttons-bar"},pe=["onClick"],ce=["onClick"],ge=["onClick"],Se=["onClick"],fe={class:"buttons-bar"},_e=t("i",{class:"icon-location"},null,-1),be={class:"buttons-bar"},ve={key:1},me={class:"signatureflow"},we={key:0,class:"steps"},ye={class:"step"},Fe={key:1,class:"alert alert-info"},ke={class:"buttons-bar"},Ce=["onClick"],Ne=["onClick"],Oe=t("hr",null,null,-1);functionEe(n,e,a,g,i,s){consty=k("recipients");returno(),r("section",L,[i.error?(o(),r("div",x,[t("div",U,[u(d(i.error)+"",1),V,t("a",{href:"#",class:"btn btn-default",onClick:e[0]||(e[0]=l=>i.error="")},"Fermer")])])):f("",!0),n.loading?(o(),r("div",J,[t("div",P,[A,u(""+d(n.loading),1)])])):f("",!0),t("section",R,[t("div",I,[i.editSignatureFlow?(o(),r("article",T,[j,t("div",null,[B,S(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),[[v,i.editSignatureFlow.label]])]),t("div",null,[q,S(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),[[v,i.editSignatureFlow.description]])]),t("section",H,[i.editStep?(o(),r("article",K,[t("h3",null,[u(" Modification de l'étape "),t("strong",null,d(i.editStep.label),1)]),S(t("input",{type:"text","onUpdate:modelValue":e[3]||(e[3]=l=>i.editStep.label=l),class:"form-control"},null,512),[[v,i.editStep.label]]),z,S(t("select",{"onUpdate:modelValue":e[4]||(e[4]=l=>i.editStep.letterfile=l),id:"letterfile",class:"form-control"},[(o(!0),r(p,null,c(i.letterfiles,l=>(o(),r("option",{value:l.name},d(l.label),9,G))),256))],512),[[m,i.editStep.letterfile]]),Q,i.editStep.letterfile?S((o(),r("select",{key:0,"onUpdate:modelValue":e[5]||(e[5]=l=>i.editStep.level=l),id:"level",class:"form-control"},[(o(!0),r(p,null,c(s.getLevels(i.editStep.letterfile),l=>(o(),r("option",{value:l.key},d(l.label),9,W))),256))],512)),[[m,i.editStep.level]]):f("",!0),X,S(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))},[(o(!0),r(p,null,c(i.get_recipients_methods,l=>(o(),r("option",{value:l.key},d(l.label),9,Y))),256))],544),[[m,i.editStep.method]]),s.stepHasOptions(i.editStep)?(o(),r("section",Z,[$,(o(!0),r(p,null,c(s.getStepOptions(i.editStep),l=>(o(),r("section",null,[t("h4",null,d(l.label),1),t("p",null,d(l.description),1),t("p",null,d(l.type),1),l.type=="checkbox"?(o(),r("section",ee,[(o(!0),r(p,null,c(l.values,(h,_)=>(o(),r("label",{for:l.key+"_"+_,class:"form-control"},[S(t("input",{"onUpdate:modelValue":F=>i.editStep.options[l.key]=F,type:"checkbox",value:_,id:l.key+"_"+_},null,8,le),[[C,i.editStep.options[l.key]]]),u(""+d(h),1)],8,te))),256))])):f("",!0),l.type=="recipients"?(o(),r("section",ne,[N(y,{recipients:i.editStep.options[l.key],editable:!0,onChange:s.handlerRecipientsChange},null,8,["recipients","onChange"])])):f("",!0)]))),256))])):f("",!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")])])):(o(),r("section",ie,[se,t("section",re,[(o(!0),r(p,null,c(i.editSignatureFlow.steps,l=>(o(),r("article",oe,[t("h4",null,[de,u(" Etape "+d(l.order)+" - "+d(l.label),1)]),t("div",null,[u(" Niveau de validation : "),t("strong",null,d(s.getLevelsLabel(l)),1),ae,u(" Parapheur : "),t("strong",null,d(s.getLetterfileLabel(l.letterfile)),1),ue,u(" Destinataires : "),t("strong",null,d(s.getMethodLabel(l.method)),1)]),t("nav",he,[t("button",{class:"btn btn-default btn-xs",onClick:h=>s.handlerEditStep(l)},"Modifier",8,pe),t("button",{class:"btn btn-default btn-xs",onClick:h=>s.handlerDeleteStep(l)},"Supprimer",8,ce),t("button",{onClick:h=>s.handlerUp(l)},"up",8,ge),t("button",{onClick:h=>s.handlerDown(l)},"down",8,Se)])]))),256)),t("nav",fe,[t("button",{onClick:e[10]||(e[10]=(...l)=>s.handlerNewStep&&s.handlerNewStep(...l)),class:"btn btn-default"},[_e,u(" Nouvelle étape ")])])]),t("nav",be,[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 ")])]))])])):(o(),r("section",ve,[(o(!0),r(p,null,c(i.signatureflows,l=>(o(),r("article",me,[t("h3",null,[u("Procédure : "),t("strong",null,d(l.label),1),u(),t("small",null," (ID: "+d(l.id)+")",1)]),t("p",null,[t("small",null,d(l.description),1)]),l.steps.length?(o(),r("section",we,[(o(!0),r(p,null,c(l.steps,h=>(o(),r("article",ye,[t("h4",null,"Etape "+d(h.order)+" - "+d(h.label),1),t("small",null,[u(" Parapheur : "),t("strong",null,d(s.getLetterfileLabel(h.letterfile)),1),u(" - Niveau de validation : "),t("strong",null,d(s.getLevelsLabel(h)),1),u(" - Destinataires : "),t("strong",null,d(s.getMethodLabel(h.method)),1)])]))),256))])):(o(),r("section",Fe," Aucune étape configurée ")),t("nav",ke,[t("button",{class:"btn btn-xs",onClick:h=>s.handlerEditSignatureFlow(l)},"Modifier la procédure",8,Ce),t("button",{class:"btn btn-xs",onClick:h=>s.handlerDeleteSignatureFlow(l)},"Supprimer la procédure",8,Ne)])]))),256)),t("nav",null,[t("button",{class:"btn btn-success",onClick:e[13]||(e[13]=(...l)=>s.handlerNewSignatureFlow&&s.handlerNewSignatureFlow(...l))}," Nouvelle procédure ")])])),Oe])])])}constMe=E(D,[["render",Ee]]);letw="#signatureflows",De=document.querySelector(w);constLe=O(Me,{entrypoint:De.dataset.entrypoint});Le.mount(w);