felicity-lims/felicity/templates/static/assets/ManageAnalyses-94bd1f74.js
2024-11-17 19:39:30 +02:00

1 line
4.8 KiB
JavaScript

import{d as Y,N as R,ar as I,W as V,x as $,y as x,r as v,z as j,o as l,c as i,b as e,e as m,F as p,E as b,t as c,f as A,as as F,w as k,A as z,B as C,C as G,j as K,_ as O,S as T,c7 as W,c8 as q,M as H,k as J}from"./index-e62f5c21.js";const Q=e("hr",null,null,-1),X={action:"post",class:"mt-4"},Z={class:"flex justify-start items-center mr-4"},ee=e("span",{class:"text-gray-700"},"Analyses Template (Auto)",-1),te={class:"block mx-4"},se=e("option",null,null,-1),oe=["value"],ne=e("hr",{class:"mt-4 mb-2"},null,-1),ae={class:"font-bold"},le=e("hr",{class:"mb-4 mt-2"},null,-1),re={class:"col-span-2 overflow-y-scroll overscroll-contain max-h-[540px] bg-white"},ie={class:"w-full"},ce={class:"min-w-full"},de={class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},ue=["checked","onChange"],pe=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},"Analysis",-1),ye=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},"Keyword",-1),he=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},"Description",-1),_e={class:"bg-white"},me={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-200"},be=["checked","onChange"],fe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-200"},ge={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-200"},we={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-200"},xe=e("hr",null,null,-1),ve=Y({__name:"ManageAnalyses",emits:["changeTab"],setup(Ae,{emit:S}){const B=K(()=>O(()=>import("./FelAccordion-66724ba0.js"),["assets/FelAccordion-66724ba0.js","assets/index-e62f5c21.js","assets/index-332ec99e.css"])),{withClientMutation:f}=H(),g=R(),d=I(),y=V(),M=$(()=>d.getAnalysesServices);x(()=>{d.fetchAnalysesTemplates(),d.fetchAnalysesServices({})});const E=S,w=t=>{E("changeTab",t)},h=v(),U=async()=>{try{T.fire({title:"Are you sure?",text:"You want to apply this template to add analyses?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, apply now!",cancelButtonText:"No, cancel apply!"}).then(t=>{t.isConfirmed&&f(W,{uid:g.params.sampleUid,analysisTemplateUid:h.value},"samplesApplyTemplate").then(s=>w("analysis-results"))})}catch{}},a=v([]);x(()=>{a.value=[...y.analysisResults?.map(t=>t.analysisUid)]});const _=t=>{a.value.includes(t)?a.value=a.value.filter(s=>s!==t):a.value=[...a.value,t]},u=t=>a.value.includes(t),D=t=>t.every(s=>u(s.uid)),L=t=>{t.every(s=>u(s.uid))?t.forEach(s=>_(s.uid)):t.forEach(s=>{u(s.uid)||_(s.uid)})},N=async()=>{const t=y.analysisResults?.filter(n=>!a.value.includes(n.analysisUid)).map(n=>n.uid),s=a.value.filter(n=>!y.analysisResults?.map(o=>o.analysisUid).includes(n));try{T.fire({title:"Are you sure?",text:"You want to apply these changes to the analyses?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, apply now!",cancelButtonText:"No, cancel apply!"}).then(n=>{n.isConfirmed&&f(q,{sampleUid:g.params.sampleUid,payload:{cancel:t,add:s}},"manageAnalyses").then(o=>w("analysis-results"))})}catch{}};return(t,s)=>{const n=j("motion-slide-right");return l(),i(p,null,[e("section",null,[Q,m((l(),i("form",X,[e("div",Z,[ee,e("label",te,[m(e("select",{class:"form-select block w-full py-1","onUpdate:modelValue":s[0]||(s[0]=o=>h.value=o)},[se,(l(!0),i(p,null,b(A(d).analysesTemplates,o=>(l(),i("option",{key:o.uid,value:o.uid},c(o.name),9,oe))),128))],512),[[F,h.value]])]),e("button",{type:"button",onClick:s[1]||(s[1]=k(o=>U(),["prevent"])),class:"border border-sky-800 bg-sky-800 text-white rounded-sm px-2 py-1 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Apply Template ")])])),[[n]])]),ne,e("h3",ae,"Manually Modify Analyses: ("+c(a.value?.length)+")",1),le,e("section",re,[e("div",ie,[(l(!0),i(p,null,b(M.value,(o,P)=>(l(),z(A(B),{key:P},{title:C(()=>[G(c(o[0]),1)]),body:C(()=>[e("table",ce,[e("thead",null,[e("tr",null,[e("th",de,[e("input",{type:"checkbox",class:"",checked:D(o[1]),onChange:r=>L(o[1])},null,40,ue)]),pe,ye,he])]),e("tbody",_e,[(l(!0),i(p,null,b(o[1],r=>m((l(),i("tr",{key:r?.uid},[e("td",me,[e("input",{type:"checkbox",class:"border-red-500",checked:u(r?.uid),onChange:ke=>_(r?.uid)},null,40,be)]),e("td",fe,c(r?.name),1),e("td",ge,c(r?.keyword),1),e("td",we,c(r?.description),1)])),[[n]])),128))])])]),_:2},1024))),128)),xe,e("button",{type:"button",onClick:s[2]||(s[2]=k(o=>N(),["prevent"])),class:"border border-sky-800 bg-sky-800 text-white rounded-sm px-2 py-1 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Apply Changes ")])])],64)}}}),Te=J(ve,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/sample/_id/ManageAnalyses.vue"]]);export{Te as default};