Commit f00ac3b1 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Ordre des étapes OK

Simulation de procédure en cours
parent 79ce3a2e
Loading
Loading
Loading
Loading
+11 −0
Changes for config/merged/signature.config.php: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ return [
                        'signatures',
                        'signatureflows',
                        'signatureflowsUi',
                        'triggerProcess',
                    ],
                    'privileges' => [
                        SignaturePrivileges::SIGNATURE_INDEX,
@@ -136,6 +137,16 @@ return [
                            ]
                        ]
                    ],
                    'trigger-process' => [
                        'type' => Segment::class,
                        'options' => [
                            'route' => '/trigger-process',
                            'defaults' => [
                                'action' => 'triggerProcess'
                            ]
                        ]
                    ],
                    //triggerProcess
                    'delete' => [
                        'type' => Segment::class,
                        'options' => [
+0 −1
Changes for public/dist/assets/signatureflows-0fb20351.js: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
import{o as r,c as o,a as t,w as g,v as m,r as k,F as f,b as S,d as F,e as b,f as u,t as a,g as _,h as v,i as O,j as x}from"../vendor.js";const y=(n,e)=>{const d=n.__vccOpts||n;for(const[h,i]of e)d[h]=i;return d},D={props:{recipient:{default:{}}}},E={class:"form-recipient"},M={action:"",class:"form-inline"};function L(n,e,d,h,i,s){return r(),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")])])}const V=y(D,[["render",L]]),U={components:{Recipient:V},props:{recipients:{default:[]}},methods:{handlerAdd(n){this.recipients.push({firstname:"",lastname:"",email:""})},handlerDelete(n){let e=this.recipients.indexOf(n);this.recipients.splice(e,1)}}},J={class:"form-recipients"};function A(n,e,d,h,i,s){const p=k("recipient");return r(),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")])}const P=y(U,[["render",A]]);const R={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){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;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 e=this.getStepOptions(n);console.log("options",e)},handlerDeleteStep(n){let e=this.editSignatureFlow.steps.indexOf(n);this.editSignatureFlow.steps.splice(e,1)},getLevels(n){for(let e=0;e<this.letterfiles.length;e++)if(this.letterfiles[e].name==n)return this.letterfiles[e].levels;return[]},getLevelsLabel(n){if(n.level)if(n.letterfile){let h=this.getLevels(n.letterfile);for(let i=0;i<h.length;i++)if(h[i].key==n.level)return h[i].label;return"inconnue"}else return"Pas de parapheur";else return"Non configuré"},handlerChangeMethod(n){let e=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(let e=0;e<this.get_recipients_methods.length;e++)if(this.get_recipients_methods[e].key==n)return this.get_recipients_methods[e];return null},getMethodLabel(n){let e=this.getMethod(n);return e?e.label:"N.D"},getMethodOptions(n){let e=this.getMethod(n);return e?e.options:null},getMethodOptionsDefaultValue(n){return this.getMethod(n)?[]:null},getStepOptions(n){let e=this.getMethod(n.method);return e?e.options:null},stepHasOptions(n){return this.getStepOptions(n)!=null},getLetterfile(n){for(let e=0;e<this.letterfiles.length;e++)if(this.letterfiles[e].name==n)return this.letterfiles[e];return null},getLetterfileLabel(n){let e=this.getLetterfile(n);return e?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";let e=new FormData;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";let e=new FormData;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);function Ue(n,e,d,h,i,s){const p=k("recipients");return r(),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])])])}const Je=y(R,[["render",Ue]]);let C="#signatureflows",Ae=document.querySelector(C);const Pe=x(Je,{entrypoint:Ae.dataset.entrypoint});Pe.mount(C);
+1 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −1
Changes for public/dist/manifest.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
    "css": [
      "assets/SignatureFlows-8341230d.css"
    ],
    "file": "assets/signatureflows-0fb20351.js",
    "file": "assets/signatureflows-eabf111b.js",
    "imports": [
      "_vendor.js"
    ],
+44 −7
Changes for public/src/views/SignatureFlows.vue: 44 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@
                <article v-for="s in editSignatureFlow.steps" class="step">
                  <h4>
                    <i class="icon-location"></i>
                    Etape {{ s.order }} -
                    {{ s.label }}</h4>
                  <div>
                    Niveau de validation : <strong>{{ getLevelsLabel(s) }}</strong><br>
@@ -106,6 +107,8 @@
                  <nav class="buttons-bar">
                    <button class="btn btn-default btn-xs" @click="handlerEditStep(s)">Modifier</button>
                    <button class="btn btn-default btn-xs" @click="handlerDeleteStep(s)">Supprimer</button>
                    <button @click="handlerUp(s)">up</button>
                    <button @click="handlerDown(s)">down</button>
                  </nav>
                </article>
                <nav class="buttons-bar">
@@ -116,10 +119,11 @@
                </nav>
              </section>
              <nav class="buttons-bar">
                <button @click="handlerEditSignatureFlowSave" class="btn btn-large btn-success">Enregistrer la
                  procédure
                <button @click="handlerEditSignatureFlowSave" class="btn btn-large btn-success">
                  Enregistrer la procédure
                </button>
                <button @click="handlerEditSignatureFlowCancel" class="btn btn-danger">Annuler les modifications
                <button @click="handlerEditSignatureFlowCancel" class="btn btn-danger">
                  Annuler les modifications
                </button>
              </nav>
            </section>
@@ -133,7 +137,7 @@
            <p><small>{{ sf.description }}</small></p>
            <section class="steps" v-if="sf.steps.length">
              <article v-for="s in sf.steps" class="step">
                <h4>{{ s.label }}</h4>
                <h4>Etape {{ s.order }} - {{ s.label }}</h4>
                <small>
                  Parapheur : <strong>{{ getLetterfileLabel(s.letterfile) }}</strong> -
                  Niveau de validation : <strong>{{ getLevelsLabel(s) }}</strong> -
@@ -192,6 +196,37 @@ export default {
    handlerRecipientsChange(evt) {
      console.log('handlerRecipientsChange', evt)
    },

    handlerUp(step) {
      console.log("handlerUp");
      this.moveStep(step, -1);
    },

    handlerDown(step) {
      console.log("handlerDown");
      this.moveStep(step, 1);
    },

    moveStep(step, direction) {
      let index = this.editSignatureFlow.steps.indexOf(step);
      if( (index == this.editSignatureFlow.steps.length && direction == 1)
          || (index == 0 && direction == -1) ){
        return;
      }
      let moved = this.editSignatureFlow.steps[index];
      this.editSignatureFlow.steps.splice(index, 1);
      this.editSignatureFlow.steps.splice(index+direction, 0, moved);
      this.updateOrder();
    },

    updateOrder(){
      console.log("Update order");
      let order = 1;
      this.editSignatureFlow.steps.forEach( i => {
        i.order = order++;
      });
    },

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // PROCESSUS

@@ -239,7 +274,7 @@ export default {
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // ETAPES
    handlerNewStep() {
      let autoOrder = this.editSignatureFlow.steps.length;
      let autoOrder = this.editSignatureFlow.steps.length+1;
      this.editSignatureFlow.steps.push({
        id: null,
        label: "Nouvelle étape",
@@ -270,6 +305,7 @@ export default {
    handlerDeleteStep(step) {
      let i = this.editSignatureFlow.steps.indexOf(step);
      this.editSignatureFlow.steps.splice(i, 1);
      this.updateOrder();
    },


@@ -424,10 +460,11 @@ export default {
        this.loading = "";
        this.fetch();
      }, ko => {
        console.log(ko);
        this.loading = "";
        try {
        if( ko.response.data.error ){
          this.error = ko.response.data.error;
        } catch (err) {
        } else {
          this.error = "Une erreur inconnue est survenue côté serveur";
        }
      })
Loading