Commit 3dd95f6e authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Système de notification des observateurs (en cours)

parent 60c8b142
Loading
Loading
Loading
Loading
Loading

bin/unicaen-signature

100644 → 100755
+0 −0

File mode changed from 100644 to 100755.

+5 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ CREATE TABLE public.unicaen_signature_signature (
	CONSTRAINT unicaen_signature_signature_pkey PRIMARY KEY (id)
);



CREATE TABLE public.unicaen_signature_signatureflow (
	id int4 NOT NULL,
	"label" varchar(255) NULL DEFAULT NULL::character varying,
@@ -117,6 +119,9 @@ CREATE TABLE public.unicaen_signature_signatureflowstep (
	allrecipientssign bool NOT NULL DEFAULT true,
	notificationsrecipients bool NOT NULL DEFAULT false,
	editablerecipients bool NOT NULL DEFAULT false,
    observers_options TEXT DEFAULT NULL,
    observersMethod VARCHAR(64) DEFAULT NULL,

CONSTRAINT unicaen_signature_signatureflowstep_pkey PRIMARY KEY (id),
	CONSTRAINT fk_a575dc3eb4090c8a FOREIGN KEY (signatureflow_id) REFERENCES unicaen_signature_signatureflow(id)
);
+0 −1
Original line number Diff line number Diff line
import{a as v,r as C,c as i,b as e,d,t as a,e as f,w as c,v as m,f as w,F as p,g,h as b,o as s,i as N,j as O}from"../vendor.js";import{_ as E,R as x}from"../vendor2.js";const D={components:{Recipients:x},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,t){let u=this.editSignatureFlow.steps.indexOf(n);if(u==this.editSignatureFlow.steps.length&&t==1||u==0&&t==-1)return;let _=this.editSignatureFlow.steps[u];this.editSignatureFlow.steps.splice(u,1),this.editSignatureFlow.steps.splice(u+t,0,_),this.updateOrder()},updateOrder(){console.log("Update order");let n=1;this.editSignatureFlow.steps.forEach(t=>{t.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){let n=this.signatureflows.indexOf(this.editSignatureFlow);this.signatureflows[n]=JSON.parse(JSON.stringify(this.editSignatureFlow))}else this.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(){let n=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(){let n=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;let t=this.getStepOptions(n);console.log("options",t)},handlerDeleteStep(n){let t=this.editSignatureFlow.steps.indexOf(n);this.editSignatureFlow.steps.splice(t,1),this.updateOrder()},getLevels(n){for(let t=0;t<this.letterfiles.length;t++)if(this.letterfiles[t].name==n)return this.letterfiles[t].levels;return[]},getLevelsLabel(n){if(n.level)if(n.letterfile){let _=this.getLevels(n.letterfile);for(let o=0;o<_.length;o++)if(_[o].key==n.level)return _[o].label;return"inconnue"}else return"Pas de parapheur";else return"Non configuré"},handlerChangeMethod(n){let t=this.getMethodOptions(this.editStep.method);(!this.editStep.options||Array.isArray(this.editStep.options))&&(this.editStep.options={}),t.forEach(u=>{this.editStep.options.hasOwnProperty(u.key)||(this.editStep.options[u.key]=[])})},getMethod(n){for(let t=0;t<this.get_recipients_methods.length;t++)if(this.get_recipients_methods[t].key==n)return this.get_recipients_methods[t];return null},getMethodLabel(n){let t=this.getMethod(n);return t?t.label:"N.D"},getMethodOptions(n){let t=this.getMethod(n);return t?t.options:null},getMethodOptionsDefaultValue(n){return this.getMethod(n)?[]:null},getStepOptions(n){let t=this.getMethod(n.method);return t?t.options:null},stepHasOptions(n){return this.getStepOptions(n)!=null},getLetterfile(n){for(let t=0;t<this.letterfiles.length;t++)if(this.letterfiles[t].name==n)return this.letterfiles[t];return null},getLetterfileLabel(n){let t=this.getLetterfile(n);return t?t.label:"N.D"},fetch(){this.loading="Chargement des processus",v.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";let t=new FormData;t.append("action","delete"),t.append("json",JSON.stringify(n)),v.post(this.entrypoint,t).then(u=>{this.loading="",this.fetch()},u=>{this.loading="";try{this.error=u.response.data.error}catch{this.error="Une erreur inconnue est survenue côté serveur"}})},remoteSave(n){this.loading="Enregistement";let t=new FormData;t.append("action","save"),t.append("json",JSON.stringify(n)),v.post(this.entrypoint,t).then(u=>{this.loading="",this.fetch()},u=>{console.log(u),this.loading="",u.response.data.error?this.error=u.response.data.error:this.error="Une erreur inconnue est survenue côté serveur"})}},mounted(){this.fetch()}},M={class:"signatureflows"},L={key:0,class:"overlay error"},U={class:"overlay-content"},V=e("hr",null,null,-1),R={key:1,class:"overlay"},J={class:"overlay-content"},A=e("i",{class:"icon-spinner animate-spin"},null,-1),P={class:"row"},T={class:"col-md-12"},I={key:0,class:"step-edit"},j=e("label",{for:"letterfile"},"Parapheur",-1),B=["value"],q=e("label",{for:"level"},"Type de validation",-1),H=["value"],K={for:"notifications"},z=e("br",null,null,-1),G={for:"allSign"},Q={for:"editable"},W={class:"row"},X={class:"col-md-6"},Y=e("h4",null,"Destinataires",-1),Z=e("label",{for:"method"},"Méthode d'obtention des destinataires",-1),$=["value"],ee={key:0,class:"options"},te=e("h3",null,"Paramètres de récupération des destinataires",-1),le={key:0},ne=["for"],ie=["onUpdate:modelValue","value","id"],se={key:1},oe=e("div",{class:"col-md-6"},[e("h4",null,"Observateurs"),e("div",{class:"alert alert-info"}," A venir ")],-1),re={key:1,class:"signatureflows-edit"},de=e("h2",null,"Edition de la procédure",-1),ae=e("label",{for:"label"}," Intitulé ",-1),ue=e("label",{for:"description"}," Description ",-1),he={class:""},ce=e("h3",null,"étapes",-1),pe={class:"steps"},ge={class:"step"},_e=e("i",{class:"icon-location"},null,-1),Se=e("br",null,null,-1),fe=e("br",null,null,-1),be=e("br",null,null,-1),ve={key:0},me={key:1},we=e("br",null,null,-1),ye={key:2},ke={key:3},Fe=e("br",null,null,-1),Ce={key:4},Ne={key:5},Oe={class:"buttons-bar"},Ee=["onClick"],xe=["onClick"],De=["onClick"],Me=["onClick"],Le={class:"buttons-bar"},Ue=e("i",{class:"icon-location"},null,-1),Ve={class:"buttons-bar"},Re={key:2},Je={class:"signatureflow"},Ae={key:0,class:"steps"},Pe={class:"step"},Te={key:0},Ie=e("i",{class:"icon-users"},null,-1),je={key:1},Be=e("i",{class:"icon-user-1"},null,-1),qe={key:0},He={key:1},Ke={key:2},ze={key:3},Ge={key:4},Qe={class:"recipient"},We=e("i",{class:"icon-mail-alt"},null,-1),Xe={key:1,class:"alert alert-info"},Ye={class:"buttons-bar"},Ze=["onClick"],$e=["onClick"],et=e("hr",null,null,-1);function tt(n,t,u,_,o,r){const k=C("recipients");return s(),i("section",M,[o.error?(s(),i("div",L,[e("div",U,[d(a(o.error)+" ",1),V,e("a",{href:"#",class:"btn btn-default",onClick:t[0]||(t[0]=l=>o.error="")},"Fermer")])])):f("",!0),n.loading?(s(),i("div",R,[e("div",J,[A,d(" "+a(n.loading),1)])])):f("",!0),e("section",P,[e("div",T,[o.editStep?(s(),i("article",I,[e("h3",null,[d(" Modification de l'étape "),e("strong",null,a(o.editStep.label),1)]),c(e("input",{type:"text","onUpdate:modelValue":t[1]||(t[1]=l=>o.editStep.label=l),class:"form-control"},null,512),[[m,o.editStep.label]]),j,c(e("select",{"onUpdate:modelValue":t[2]||(t[2]=l=>o.editStep.letterfile=l),id:"letterfile",class:"form-control"},[(s(!0),i(p,null,g(o.letterfiles,l=>(s(),i("option",{value:l.name},a(l.label),9,B))),256))],512),[[w,o.editStep.letterfile]]),q,o.editStep.letterfile?c((s(),i("select",{key:0,"onUpdate:modelValue":t[3]||(t[3]=l=>o.editStep.level=l),id:"level",class:"form-control"},[(s(!0),i(p,null,g(r.getLevels(o.editStep.letterfile),l=>(s(),i("option",{value:l.key},a(l.label),9,H))),256))],512)),[[w,o.editStep.level]]):f("",!0),e("label",K,[c(e("input",{type:"checkbox","onUpdate:modelValue":t[4]||(t[4]=l=>o.editStep.notificationsRecipients=l),id:"notifications"},null,512),[[b,o.editStep.notificationsRecipients]]),d(" Notifications des destinataires ? ")]),z,e("label",G,[c(e("input",{type:"checkbox","onUpdate:modelValue":t[5]||(t[5]=l=>o.editStep.allRecipientsSign=l),id:"allSign"},null,512),[[b,o.editStep.allRecipientsSign]]),d(" Tous les destinataires doivent signer ? ")]),e("label",Q,[c(e("input",{type:"checkbox","onUpdate:modelValue":t[6]||(t[6]=l=>o.editStep.editable=l),id:"editable"},null,512),[[b,o.editStep.editable]]),d(" Autoriser la modification des destinataires ")]),e("div",W,[e("div",X,[Y,Z,c(e("select",{"onUpdate:modelValue":t[7]||(t[7]=l=>o.editStep.method=l),id:"method",class:"form-control",onChange:t[8]||(t[8]=(...l)=>r.handlerChangeMethod&&r.handlerChangeMethod(...l))},[(s(!0),i(p,null,g(o.get_recipients_methods,l=>(s(),i("option",{value:l.key},a(l.label),9,$))),256))],544),[[w,o.editStep.method]]),r.stepHasOptions(o.editStep)?(s(),i("section",ee,[te,(s(!0),i(p,null,g(r.getStepOptions(o.editStep),l=>(s(),i("section",null,[e("h4",null,a(l.label),1),e("p",null,a(l.description),1),l.type=="checkbox"?(s(),i("section",le,[(s(!0),i(p,null,g(l.values,(h,S)=>(s(),i("label",{for:l.key+"_"+S,class:"form-control"},[c(e("input",{"onUpdate:modelValue":F=>o.editStep.options[l.key]=F,type:"checkbox",value:S,id:l.key+"_"+S},null,8,ie),[[b,o.editStep.options[l.key]]]),d(" "+a(h),1)],8,ne))),256))])):f("",!0),l.type=="recipients"?(s(),i("section",se,[N(k,{recipients:o.editStep.options[l.key],editable:!0,onChange:r.handlerRecipientsChange},null,8,["recipients","onChange"])])):f("",!0)]))),256))])):f("",!0)]),oe]),e("nav",null,[e("button",{onClick:t[9]||(t[9]=(...l)=>r.handlerEditStepSave&&r.handlerEditStepSave(...l)),class:"btn btn-success"},"Terminer"),e("button",{onClick:t[10]||(t[10]=(...l)=>r.handlerEditStepCancel&&r.handlerEditStepCancel(...l)),class:"btn btn-danger"},"Annuler")])])):o.editSignatureFlow?(s(),i("article",re,[de,e("div",null,[ae,c(e("input",{"onUpdate:modelValue":t[11]||(t[11]=l=>o.editSignatureFlow.label=l),id:"label",type:"text",name:"label",placeholder:"Intitulé",class:"form-control input-lg"},null,512),[[m,o.editSignatureFlow.label]])]),e("div",null,[ue,c(e("textarea",{"onUpdate:modelValue":t[12]||(t[12]=l=>o.editSignatureFlow.description=l),id:"description",type:"text",name:"description",placeholder:"Une description",class:"form-control input-lg"},null,512),[[m,o.editSignatureFlow.description]])]),e("section",he,[e("section",null,[ce,e("section",pe,[(s(!0),i(p,null,g(o.editSignatureFlow.steps,l=>(s(),i("article",ge,[e("h4",null,[_e,d(" Etape "+a(l.order)+" - "+a(l.label),1)]),e("div",null,[d(" Niveau de validation : "),e("strong",null,a(r.getLevelsLabel(l)),1),Se,d(" Parapheur : "),e("strong",null,a(r.getLetterfileLabel(l.letterfile)),1),fe,d(" Destinataires : "),e("strong",null,a(r.getMethodLabel(l.method)),1),be,d(" Tous signent ? : "),l.allRecipientsSign?(s(),i("strong",ve,"Oui")):(s(),i("strong",me,"Non")),we,d(" Notifications : "),l.notificationsRecipients?(s(),i("strong",ye,"Oui")):(s(),i("strong",ke,"Non")),Fe,d(" Destinataires modifiables : "),l.editable?(s(),i("strong",Ce,"Oui")):(s(),i("strong",Ne,"Non"))]),e("nav",Oe,[e("button",{class:"btn btn-default btn-xs",onClick:h=>r.handlerEditStep(l)},"Modifier",8,Ee),e("button",{class:"btn btn-default btn-xs",onClick:h=>r.handlerDeleteStep(l)},"Supprimer",8,xe),e("button",{onClick:h=>r.handlerUp(l)},"up",8,De),e("button",{onClick:h=>r.handlerDown(l)},"down",8,Me)])]))),256)),e("nav",Le,[e("button",{onClick:t[13]||(t[13]=(...l)=>r.handlerNewStep&&r.handlerNewStep(...l)),class:"btn btn-default"},[Ue,d(" Nouvelle étape ")])])]),e("nav",Ve,[e("button",{onClick:t[14]||(t[14]=(...l)=>r.handlerEditSignatureFlowSave&&r.handlerEditSignatureFlowSave(...l)),class:"btn btn-large btn-success"}," Enregistrer la procédure "),e("button",{onClick:t[15]||(t[15]=(...l)=>r.handlerEditSignatureFlowCancel&&r.handlerEditSignatureFlowCancel(...l)),class:"btn btn-danger"}," Annuler les modifications ")])])])])):(s(),i("section",Re,[(s(!0),i(p,null,g(o.signatureflows,l=>(s(),i("article",Je,[e("h3",null,[d("Procédure : "),e("strong",null,a(l.label),1),d(),e("small",null," (ID: "+a(l.id)+")",1)]),e("p",null,[e("small",null,a(l.description),1)]),l.steps.length?(s(),i("section",Ae,[(s(!0),i(p,null,g(l.steps,h=>(s(),i("article",Pe,[e("h4",null,[d(" Etape "+a(h.order)+" - ",1),e("strong",null,a(h.label),1),h.allRecipientsSign?(s(),i("span",Te,[d(" ("),Ie,d(" Tous les destinataires doivent signer) ")])):(s(),i("span",je,[d(" ("),Be,d(" Un des destinataires doit signer) ")]))]),e("small",null,[d(" Parapheur : "),e("strong",null,a(r.getLetterfileLabel(h.letterfile)),1),d(" - Niveau de validation : "),e("strong",null,a(r.getLevelsLabel(h)),1),d(" - Destinataires : "),e("strong",null,a(r.getMethodLabel(h.method)),1),d(" - Notifications : "),h.notificationsRecipients?(s(),i("strong",qe,"OUI")):(s(),i("strong",He,"non")),d(" - Editable : "),h.editable?(s(),i("strong",Ke,"OUI")):(s(),i("strong",ze,"non")),h.method=="recipients_fixed"?(s(),i("div",Ge,[(s(!0),i(p,null,g(h.options.recipients,S=>(s(),i("span",Qe,[e("strong",null,a(S.firstname)+" "+a(S.lastname),1),e("em",null,[We,d(" "+a(S.email),1)])]))),256))])):f("",!0)])]))),256))])):(s(),i("section",Xe," Aucune étape configurée ")),e("nav",Ye,[e("button",{class:"btn btn-xs",onClick:h=>r.handlerEditSignatureFlow(l)},"Modifier la procédure",8,Ze),e("button",{class:"btn btn-xs",onClick:h=>r.handlerDeleteSignatureFlow(l)},"Supprimer la procédure",8,$e)])]))),256)),e("nav",null,[e("button",{class:"btn btn-success",onClick:t[16]||(t[16]=(...l)=>r.handlerNewSignatureFlow&&r.handlerNewSignatureFlow(...l))}," Nouvelle procédure ")])])),et])])])}const lt=E(D,[["render",tt]]);let y="#signatureflows",nt=document.querySelector(y);const it=O(lt,{entrypoint:nt.dataset.entrypoint});it.mount(y);
+1 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
    "css": [
      "assets/SignatureFlows-8341230d.css"
    ],
    "file": "assets/signatureflows-7c5d56b8.js",
    "file": "assets/signatureflows-9eb993f8.js",
    "imports": [
      "_vendor.js",
      "_vendor2.js"
Loading