mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
1 line
6.4 KiB
JavaScript
1 line
6.4 KiB
JavaScript
import{d as N,aK as C,K as A,r as m,q as V,x as _,o as r,c as a,b as e,F as p,E as b,t as d,f as n,A as R,B as v,e as c,v as h,as as f,w as B,i as F,D as $,j,_ as K,M as L,k as O}from"./index-e62f5c21.js";import{c as P,d as q}from"./instrument.mutations-b1e47e8c.js";const Y={class:""},z={class:"container w-full my-4"},G=e("hr",null,null,-1),H=e("hr",null,null,-1),J=e("hr",null,null,-1),Q={class:"overflow-x-auto mt-4"},W={class:"align-middle inline-block min-w-full shadow overflow-hidden bg-white shadow-dashboard px-2 pt-1 rounded-bl-lg rounded-br-lg"},X={class:"min-w-full"},Z=e("thead",null,[e("tr",null,[e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"},"Name"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"},"Type"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"},"Manufacturer"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"},"Supplier"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300"})])],-1),ee={class:"bg-white"},te={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},se={class:"text-sm leading-5 text-gray-800"},oe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ne={class:"text-sm leading-5 text-gray-800"},le={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},re={class:"text-sm leading-5 text-sky-800"},ae={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ie={class:"text-sm leading-5 text-sky-800"},de={class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},ue=["onClick"],ce={action:"post",class:"p-1"},pe={class:"grid grid-cols-3 gap-x-4 mb-4"},me={class:"block col-span-2 mb-2"},_e=e("span",{class:"text-gray-700"},"Instrument Name",-1),be={class:"block col-span-1 mb-2"},ye=e("span",{class:"text-gray-700"},"keyword",-1),he={class:"block col-span-1 mb-2"},fe=e("span",{class:"text-gray-700 w-4/12"},"Instrument Type",-1),ge={class:"w-full"},we=e("option",null,null,-1),xe=["value"],ve={class:"block col-span-1 mb-2"},ke=e("span",{class:"text-gray-700 w-4/12"},"Manufacturer",-1),Ue={class:"w-full"},Ie=e("option",null,null,-1),Te=["value"],Se={class:"block col-span-1 mb-2"},Me=e("span",{class:"text-gray-700 w-4/12"},"Supplier",-1),Ee={class:"w-full"},De=e("option",null,null,-1),Ne=["value"],Ce={class:"block col-span-3 mb-2"},Ae=e("span",{class:"text-gray-700"},"Description",-1),Ve=e("hr",null,null,-1),Re=N({__name:"Instruments",setup(Be){const k=j(()=>K(()=>import("./FelModal-44636049.js"),["assets/FelModal-44636049.js","assets/index-e62f5c21.js","assets/index-332ec99e.css","assets/FelModal-780aeea9.css"]));C();const l=A(),{withClientMutation:g}=L();m("view");let u=m(!1),w=m("");const y=m(!0);let s=V({});l.fetchInstrumentTypes();const U=_(()=>l.getInstrumentTypes);l.fetchInstruments();const I=_(()=>l.getInstruments);l.fetchManufacturers();const T=_(()=>l.getManufacturers);l.fetchSuppliers();const S=_(()=>l.getSuppliers);function M(){const i={name:s.name,keyword:s.keyword,description:s.description,instrumentTypeUid:s.instrumentTypeUid,manufacturerUid:s.manufacturerUid,supplierUid:s.supplierUid};g(P,{payload:i},"createInstrument").then(o=>l.addInstrument(o))}function E(){const i={name:s.name,keyword:s.keyword,description:s.description,instrumentTypeUid:s.instrumentTypeUid,manufacturerUid:s.manufacturerUid,supplierUid:s.supplierUid};g(q,{uid:s.uid,payload:i},"updateInstrument").then(o=>l.updateInstrument(o))}function x(i,o={}){y.value=i,u.value=!0,w.value=(i?"CREATE":"EDIT")+" ANALYSES INSTRUMENT",i?Object.assign(s,{}):Object.assign(s,{...o})}function D(){y.value===!0&&M(),y.value===!1&&E(),u.value=!1}return(i,o)=>(r(),a(p,null,[e("div",Y,[e("div",z,[G,e("button",{class:"px-2 py-1 border-sky-800 border text-sky-800 rounded-sm transition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none",onClick:o[0]||(o[0]=t=>x(!0))}," Add Instrument"),H]),J,e("div",Q,[e("div",W,[e("table",X,[Z,e("tbody",ee,[(r(!0),a(p,null,b(I.value,t=>(r(),a("tr",{key:t?.uid},[e("td",te,[e("div",se,d(t?.name),1)]),e("td",oe,[e("div",ne,d(t?.instrumentType?.name),1)]),e("td",le,[e("div",re,d(t?.manufacturer?.name),1)]),e("td",ae,[e("div",ie,d(t?.supplier?.name),1)]),e("td",de,[e("button",{onClick:Fe=>x(!1,t),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800 rounded-sm transition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"},"Edit",8,ue)])]))),128))])])])])]),n(u)?(r(),R(n(k),{key:0,onClose:o[8]||(o[8]=t=>F(u)?u.value=!1:u=!1)},{header:v(()=>[e("h3",null,d(n(w)),1)]),body:v(()=>[e("form",ce,[e("div",pe,[e("label",me,[_e,c(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":o[1]||(o[1]=t=>n(s).name=t),placeholder:"Name ..."},null,512),[[h,n(s).name]])]),e("label",be,[ye,c(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":o[2]||(o[2]=t=>n(s).keyword=t),placeholder:"Keyword ..."},null,512),[[h,n(s).keyword]])]),e("label",he,[fe,e("div",ge,[c(e("select",{class:"form-select mt-1 w-full","onUpdate:modelValue":o[3]||(o[3]=t=>n(s).instrumentTypeUid=t)},[we,(r(!0),a(p,null,b(U.value,t=>(r(),a("option",{key:t?.uid,value:t.uid},d(t?.name),9,xe))),128))],512),[[f,n(s).instrumentTypeUid]])])]),e("label",ve,[ke,e("div",Ue,[c(e("select",{class:"form-select mt-1 w-full","onUpdate:modelValue":o[4]||(o[4]=t=>n(s).manufacturerUid=t)},[Ie,(r(!0),a(p,null,b(T.value,t=>(r(),a("option",{key:t?.uid,value:t.uid},d(t?.name),9,Te))),128))],512),[[f,n(s).manufacturerUid]])])]),e("label",Se,[Me,e("div",Ee,[c(e("select",{class:"form-select mt-1 w-full","onUpdate:modelValue":o[5]||(o[5]=t=>n(s).supplierUid=t)},[De,(r(!0),a(p,null,b(S.value,t=>(r(),a("option",{key:t?.uid,value:t.uid},d(t?.name),9,Ne))),128))],512),[[f,n(s).supplierUid]])])]),e("label",Ce,[Ae,c(e("textarea",{cols:"2",class:"form-input mt-1 block w-full","onUpdate:modelValue":o[6]||(o[6]=t=>n(s).description=t),placeholder:"Description ..."},null,512),[[h,n(s).description]])])]),Ve,e("button",{type:"button",onClick:o[7]||(o[7]=B(t=>D(),["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})):$("",!0)],64))}}),Ke=O(Re,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/admin/instruments/Instruments.vue"]]);export{Ke as default};
|