felicity-lims/felicity/static/assets/index-36101df2.js
2023-04-23 16:54:32 +02:00

1 line
14 KiB
JavaScript

import{d as le,b3 as ie,P as ae,ad as re,r as x,A as $,q as de,B as ue,o as n,g as l,h as e,t as r,j as a,F as c,z as _,l as F,E as A,G as O,y as B,D as M,i as h,v as C,R as b,w as v,k as I,I as L,b4 as ce,ak as _e,_ as pe}from"./index-cd9e6ac8.js";import{A as he}from"./Accordion-c90ef061.js";import{a as me,b as fe,c as ye,d as ve}from"./reflex.mutations-5235d12f.js";const xe={class:"mt-4 mb-2 text-xl text-gray-600 font-semibold tracking-wide"},be={class:"leading-2 text-md italic tracking-wide"},ge=e("hr",null,null,-1),ke=e("hr",null,null,-1),we=["onClick"],Re={class:"ml-1"},Ae={class:"flex justify-start items-center mb-2"},Ce=e("h4",{class:"text-l leading-4 italic"},"Reflex Action Brains",-1),Ue=["onClick"],Ve={class:"grid grid-cols-3 gap-4"},Ee={class:"flex justify-between items-center"},Fe={class:"my-2 text-l text-gray-600 font-bold"},Be=["onClick"],Ne=e("hr",{class:"my-2"},null,-1),Se=e("h4",{class:"my-2 text-md text-gray-500 font-semibold"},"Analyses Criteria",-1),De={class:"flex justify-start items-baseline flex-wrap"},je={class:"flex"},Te={class:"px-2 py-1 border border-gray-500 bg-gray-500 text-white transition duration-300 focus:outline-none"},$e={class:"px-2 py-1 border-gray-500 border text-gray-500 transition duration-300 hover:bg-gray-700 hover:text-white focus:outline-none"},Oe=e("h4",{class:"my-2 text-md text-gray-500 font-semibold"},"Add New Analyses",-1),Me={class:"flex justify-start items-baseline flex-wrap"},Ie={class:"flex"},Le={class:"px-2 py-1 border-gray-500 border text-gray-500 transition duration-300 focus:outline-none"},Xe={class:"px-2 py-1 border border-gray-500 bg-gray-500 text-white transition duration-300 focus:outline-none"},qe=e("h4",{class:"my-2 text-md text-gray-500 font-semibold"},"Finalise",-1),ze={class:"flex justify-start items-baseline flex-wrap"},Pe={class:"flex"},Ge={class:"px-2 py-1 border border-gray-500 bg-gray-500 text-white transition duration-300 focus:outline-none"},He={class:"px-2 py-1 border-gray-500 border text-gray-500 transition duration-300 hover:bg-gray-700 hover:text-white focus:outline-none"},Je={action:"post",class:"p-1"},Ke={class:"grid grid-cols-2 gap-x-4 mb-4"},Qe={class:"block col-span-1 mb-2"},We=e("span",{class:"text-gray-700"},"Level",-1),Ye={class:"block col-span-2 mb-2"},Ze=e("span",{class:"text-gray-700"},"Target Analyses",-1),et=e("option",{value:""},null,-1),tt=["value"],st={class:"block col-span-2 mb-2"},ot=e("span",{class:"text-gray-700"},"Description",-1),nt=e("hr",null,null,-1),lt={action:"post",class:"p-1"},it={class:"grid grid-cols-3 gap-x-4 mb-4"},at={class:"block col-span-3 mb-2"},rt=e("span",{class:"text-gray-700"},"Description",-1),dt={id:"criteria"},ut=e("hr",null,null,-1),ct={class:"flex justify-between items-center py-2"},_t=e("h5",null,"Criteria",-1),pt=e("span",{class:"text-orange-600"},null,-1),ht=e("hr",{class:"mb-4"},null,-1),mt={class:"flex items-center justify-between"},ft={class:"flex items-top gap-x-2"},yt={class:"flex flex-col whitespace-nowrap mb-2"},vt=e("span",{class:"text-gray-700"},"Analysis",-1),xt=["onUpdate:modelValue","onChange"],bt=e("option",{value:""},null,-1),gt=["value"],kt={class:"flex flex-col whitespace-nowrap mb-2"},wt=e("span",{class:"text-white"},".",-1),Rt=["onUpdate:modelValue"],At=e("option",{value:"eq"},"=",-1),Ct=e("option",{value:"gt"},">",-1),Ut=e("option",{value:"lt"},"<",-1),Vt=e("option",{value:"neq"},"≠",-1),Et=[At,Ct,Ut,Vt],Ft={class:"block col-span-1 mb-2"},Bt=e("span",{class:"text-gray-700"},"Result",-1),Nt=["onUpdate:modelValue"],St=["onUpdate:modelValue"],Dt=e("option",{value:""},null,-1),jt=["value"],Tt={class:""},$t=["onClick"],Ot=e("hr",null,null,-1),Mt={id:"add-new"},It=e("hr",null,null,-1),Lt={class:"flex justify-between items-center py-2"},Xt=e("h5",null,"Add New",-1),qt=e("span",{class:"text-orange-600"},null,-1),zt=e("hr",{class:"mb-4"},null,-1),Pt={class:"flex items-center justify-between"},Gt={class:"flex items-top gap-x-4"},Ht={class:"flex flex-col whitespace-nowrap mb-2"},Jt=e("span",{class:"text-gray-700"},"Analysis",-1),Kt=["onUpdate:modelValue"],Qt=e("option",{value:""},null,-1),Wt=["value"],Yt={class:"block col-span-1 mb-2"},Zt=e("span",{class:"text-gray-700"},"Count",-1),es=["onUpdate:modelValue"],ts={class:""},ss=["onClick"],os=e("hr",null,null,-1),ns={id:"criteria"},ls=e("hr",null,null,-1),is={class:"flex justify-between items-center py-2"},as=e("h5",null,"Finalize",-1),rs=e("span",{class:"text-orange-600"},null,-1),ds=e("hr",{class:"mb-4"},null,-1),us={class:"flex items-center justify-between"},cs={class:"flex items-top gap-x-4"},_s={class:"flex flex-col whitespace-nowrap mb-2"},ps=e("span",{class:"text-gray-700"},"Analysis",-1),hs=["onUpdate:modelValue","onChange"],ms=e("option",{value:""},null,-1),fs=["value"],ys={class:"block col-span-1 mb-2"},vs=e("span",{class:"text-gray-700"},"Result",-1),xs=["onUpdate:modelValue"],bs=["onUpdate:modelValue"],gs=e("option",{value:""},null,-1),ks=["value"],ws={class:""},Rs=["onClick"],As=e("hr",null,null,-1),Cs=e("hr",null,null,-1),Us=le({__name:"index",setup(Vs){const m=ie(),X=ae(),{withClientMutation:V}=_e(),q=re();let g=x(!1),E=x(""),p=$({});const k=x(!0);let w=x(!1),u=$({addNew:[],analysesValues:[],finalise:[]});de(async()=>{m.fetchReflexRuleByUid(q.params.uid)});const z=i=>{const s=ce(i);return s.charAt(0).toUpperCase()+s.slice(1)},R=X.getAnalysesServicesSimple;function P(){const i={reflexRuleUid:m.reflexRule?.uid,level:p.level,description:p.description,analyses:p.analyses};V(me,{payload:i},"createReflexAction").then(s=>m.addReflexAction(s))}function G(){const i={reflexRuleUid:m.reflexRule?.uid,level:p.level,description:p.description,analyses:p.analyses};V(fe,{payload:i},"updateReflexAction").then(s=>m.updateReflexAction(s))}function j(i,s={}){if(k.value=i,g.value=!0,E.value=(i?"CREATE":"EDIT")+" REFLEX ACTION",i)Object.assign(p,{});else{let f=[];s.analyses?.forEach(t=>f.push(t?.uid)),Object.assign(p,{...s,analyses:f})}}function H(){k.value===!0&&P(),k.value===!1&&G(),g.value=!1}const N=x();function J(){const i={...u,reflexActionUid:N.value};V(ye,{payload:i},"createReflexBrain").then(s=>m.updateReflexBrain(s))}function K(){const i={...u,reflexActionUid:N.value};V(ve,{uid:u.uid,payload:i},"updateReflexBrain").then(s=>m.updateReflexBrain(s))}function Q(){u.analysesValues?.push({operator:"eq"})}function W(i){u.analysesValues?.splice(i,1)}let S=x([]);function Y(i,s){const f=R?.find(t=>t.uid===s.analysisUid);s.value=void 0,S.value=f?.resultOptions||[]}function Z(){u.addNew?.push({})}function ee(i){u.addNew?.splice(i,1)}function te(){u.finalise?.push({})}function se(i){u.finalise?.splice(i,1)}let D=x([]);function oe(i,s){const f=R?.find(t=>t.uid===s.analysisUid);s.value=void 0,D.value=f?.resultOptions||[]}function T(i,s={}){k.value=i,w.value=!0,E.value=(i?"CREATE":"EDIT")+" REFLEX BRAIN",N.value=s.uid,i?Object.assign(u,{}):Object.assign(u,{...s})}function ne(){k.value===!0&&J(),k.value===!1&&K(),w.value=!1}return(i,s)=>{const f=ue("font-awesome-icon");return n(),l(c,null,[e("h3",xe,r(a(m).reflexRule?.name),1),e("p",be,r(a(m).reflexRule?.description),1),ge,e("button",{onClick:s[0]||(s[0]=t=>j(!0)),class:"my-4 px-2 py-1 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Add Reflex Action "),ke,(n(!0),l(c,null,_(a(m).reflexRule?.reflexActions,t=>(n(),l("section",{class:"col-span-1",key:t?.uid},[F(he,null,{title:A(()=>[e("span",{class:"p-2",onClick:d=>j(!1,t)},[F(f,{icon:"edit",class:"text-md text-gray-400 mr-1"})],8,we),O(" Reflex Action Level "+r(t?.level)+" targeting ",1),(n(!0),l(c,null,_(t?.analyses,d=>(n(),l("span",Re,r(d?.name)+",",1))),256))]),body:A(()=>[e("div",Ae,[Ce,e("button",{onClick:d=>T(!0,t),class:"ml-4 px-2 py-1 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Add Brain ",8,Ue)]),e("div",Ve,[(n(!0),l(c,null,_(t?.brains,(d,o)=>(n(),l("div",{key:d?.uid,class:"block col-span-1 bg-white py-2 px-4 m"},[e("div",Ee,[e("h2",Fe,r(z(o+1))+" Brain ",1),e("span",{class:"p-2",onClick:y=>T(!1,d)},[F(f,{icon:"edit",class:"text-md text-gray-400 mr-1"})],8,Be)]),e("h3",null,r(d?.description),1),Ne,e("div",null,[Se,(n(!0),l(c,null,_(d?.analysesValues,(y,U)=>(n(),l("div",{key:U},[e("div",De,[e("div",je,[e("button",Te,r(y?.analysis?.name),1),e("button",$e,r(y?.value),1)])])]))),128)),Oe,(n(!0),l(c,null,_(d?.addNew,(y,U)=>(n(),l("div",{key:U},[e("div",Me,[e("div",Ie,[e("button",Le,[O(r(y?.count)+" ",1),F(f,{icon:"asterisk",class:"text-l text-gray-600 mx-1"})]),e("button",Xe,r(y?.analysis?.name),1)])])]))),128)),qe,(n(!0),l(c,null,_(d?.finalise,(y,U)=>(n(),l("div",{key:U},[e("div",ze,[e("div",Pe,[e("button",Ge,r(y?.analysis?.name),1),e("button",He,r(y?.value),1)])])]))),128))])]))),128))])]),_:2},1024)]))),128)),B(" Reflex Action Edit Form Modal "),a(g)?(n(),M(L,{key:0,onClose:s[5]||(s[5]=t=>I(g)?g.value=!1:g=!1)},{header:A(()=>[e("h3",null,r(a(E)),1)]),body:A(()=>[e("form",Je,[e("div",Ke,[e("label",Qe,[We,h(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":s[1]||(s[1]=t=>a(p).level=t),type:"number",placeholder:"Name ..."},null,512),[[C,a(p).level]])]),e("label",Ye,[Ze,h(e("select",{name:"analyses",id:"analyses","onUpdate:modelValue":s[2]||(s[2]=t=>a(p).analyses=t),class:"form-input mt-1 block w-full",multiple:""},[et,(n(!0),l(c,null,_(a(R),t=>(n(),l("option",{key:t.uid,value:t.uid},r(t.name),9,tt))),128))],512),[[b,a(p).analyses]])]),e("label",st,[ot,h(e("textarea",{cols:"2",class:"form-input mt-1 block w-full","onUpdate:modelValue":s[3]||(s[3]=t=>a(p).description=t),placeholder:"Description ..."},null,512),[[C,a(p).description]])])]),nt,e("button",{type:"button",onClick:s[4]||(s[4]=v(t=>H(),["prevent"])),class:"-mb-4 w-full border border-sky-800 bg-sky-800 text-white rounded-sm px-4 py-2 m-2 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Save Form ")])]),_:1})):B("v-if",!0),B(" Reflex Brain Edit Form Modal "),a(w)?(n(),M(L,{key:1,onClose:s[11]||(s[11]=t=>I(w)?w.value=!1:w=!1)},{header:A(()=>[e("h3",null,r(a(E)),1)]),body:A(()=>[e("form",lt,[e("div",it,[e("label",at,[rt,h(e("textarea",{cols:"2",class:"form-input mt-1 block w-full","onUpdate:modelValue":s[6]||(s[6]=t=>a(u).description=t),placeholder:"Description ..."},null,512),[[C,a(u).description]])]),e("section",dt,[ut,e("div",ct,[_t,pt,e("button",{onClick:s[7]||(s[7]=v(t=>Q(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Add Criteria ")]),ht,(n(!0),l(c,null,_(a(u).analysesValues,(t,d)=>(n(),l("div",{key:d},[e("div",mt,[e("div",ft,[e("label",yt,[vt,h(e("select",{name:"analysisService",id:"analysisService","onUpdate:modelValue":o=>t.analysisUid=o,class:"form-input mt-1",onChange:o=>Y(o,t)},[bt,(n(!0),l(c,null,_(a(R),o=>(n(),l("option",{key:o.uid,value:o.uid},r(o.name),9,gt))),128))],40,xt),[[b,t.analysisUid]])]),e("label",kt,[wt,h(e("select",{name:"operator",id:"operator","onUpdate:modelValue":o=>t.operator=o,class:"form-input mt-1"},Et,8,Rt),[[b,t.operator]])]),e("label",Ft,[Bt,a(S).length==0?h((n(),l("input",{key:0,class:"form-input mt-1 block w-full","onUpdate:modelValue":o=>t.value=o,type:"text",placeholder:"Result ..."},null,8,Nt)),[[C,t.value]]):h((n(),l("select",{key:1,name:"criteriaValue",id:"criteriaValue","onUpdate:modelValue":o=>t.value=o,class:"form-input mt-1"},[Dt,(n(!0),l(c,null,_(a(S),o=>(n(),l("option",{key:o.uid,value:o.value},r(o.value),9,jt))),128))],8,St)),[[b,t.value]])])]),e("div",Tt,[e("button",{onClick:v(o=>W(d),["prevent"]),class:"px-2 py-1 mr-2 border-orange-600 border text-orange-600rounded-smtransition duration-300 hover:bg-orange-600 hover:text-white focus:outline-none"}," Remove ",8,$t)])]),Ot]))),128))]),e("section",Mt,[It,e("div",Lt,[Xt,qt,e("button",{onClick:s[8]||(s[8]=v(t=>Z(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Add New ")]),zt,(n(!0),l(c,null,_(a(u).addNew,(t,d)=>(n(),l("div",{key:d},[e("div",Pt,[e("div",Gt,[e("label",Ht,[Jt,h(e("select",{name:"analysisService",id:"analysisService","onUpdate:modelValue":o=>t.analysisUid=o,class:"form-input mt-1"},[Qt,(n(!0),l(c,null,_(a(R),o=>(n(),l("option",{key:o.uid,value:o.uid},r(o.name),9,Wt))),128))],8,Kt),[[b,t.analysisUid]])]),e("label",Yt,[Zt,h(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":o=>t.count=o,type:"number",placeholder:"How Many ...",default:"1"},null,8,es),[[C,t.count]])])]),e("div",ts,[e("button",{onClick:v(o=>ee(d),["prevent"]),class:"px-2 py-1 mr-2 border-orange-600 border text-orange-600rounded-smtransition duration-300 hover:bg-orange-600 hover:text-white focus:outline-none"}," Remove ",8,ss)])]),os]))),128))]),e("section",ns,[ls,e("div",is,[as,rs,e("button",{onClick:s[9]||(s[9]=v(t=>te(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Add Final ")]),ds,(n(!0),l(c,null,_(a(u).finalise,(t,d)=>(n(),l("div",{key:d},[e("div",us,[e("div",cs,[e("label",_s,[ps,h(e("select",{name:"analysisService",id:"analysisService","onUpdate:modelValue":o=>t.analysisUid=o,class:"form-input mt-1",onChange:o=>oe(o,t)},[ms,(n(!0),l(c,null,_(a(R),o=>(n(),l("option",{key:o.uid,value:o.uid},r(o.name),9,fs))),128))],40,hs),[[b,t.analysisUid]])]),e("label",ys,[vs,a(D).length==0?h((n(),l("input",{key:0,class:"form-input mt-1 block w-full","onUpdate:modelValue":o=>t.value=o,type:"text",placeholder:"Result ..."},null,8,xs)),[[C,t.value]]):h((n(),l("select",{key:1,name:"finalValue",id:"finalValue","onUpdate:modelValue":o=>t.value=o,class:"form-input mt-1"},[gs,(n(!0),l(c,null,_(a(D),o=>(n(),l("option",{key:o.uid,value:o.uid},r(o.value),9,ks))),128))],8,bs)),[[b,t.value]])])]),e("div",ws,[e("button",{onClick:v(o=>se(d),["prevent"]),class:"px-2 py-1 mr-2 border-orange-600 border text-orange-600rounded-smtransition duration-300 hover:bg-orange-600 hover:text-white focus:outline-none"}," Remove ",8,Rs)])]),As]))),128))])]),Cs,e("button",{type:"button",onClick:s[10]||(s[10]=v(t=>ne(),["prevent"])),class:"-mb-4 w-full border border-sky-800 bg-sky-800 text-white rounded-sm px-4 py-2 m-2 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Save Form ")])]),_:1})):B("v-if",!0)],64)}}}),Ns=pe(Us,[["__file","/home/aurthur/Development/Python/felicity/felicity-lims/webapp/views/admin/reflex/_id/index.vue"]]);export{Ns as default};