mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 17:02:55 +08:00
1 line
3.7 KiB
JavaScript
1 line
3.7 KiB
JavaScript
import{d as U,L as C,r as c,D,C as T,o as r,c as u,b as e,F as _,p as I,t as h,f as i,q as E,G as f,e as y,v as A,au as N,w as M,i as S,x as F,j as V,_ as B,O,k as $}from"./index-e48f6898.js";import{e as j,f as L}from"./instrument.mutations-d68a2607.js";const R={class:""},P={class:"container w-full my-4"},q=e("hr",null,null,-1),G=e("hr",null,null,-1),z={class:"overflow-x-auto mt-4 overflow-y-scroll overscroll-contain max-h-[740px]"},H={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"},J={class:"min-w-full"},K=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"},"Description"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300"})])],-1),Q={class:"bg-white"},W={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},X={class:"text-sm leading-5 text-gray-800"},Y=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},null,-1),Z={class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},ee=["onClick"],te={action:"post",class:"p-1"},se={class:"grid grid-cols-2 gap-x-4 mb-4"},oe={class:"block col-span-2 mb-2"},ne=e("span",{class:"text-gray-700"},"Instrument Type",-1),ie={class:"block col-span-2 my-2"},ae=e("span",{class:"text-gray-700 ml-4"},"Is SI Unit",-1),le=e("hr",null,null,-1),re=U({__name:"Units",setup(de){const v=V(()=>B(()=>import("./FelModal-3c028bd6.js"),["assets/FelModal-3c028bd6.js","assets/index-e48f6898.js","assets/index-7d22ceed.css","assets/FelModal-a7d23795.css"])),l=C(),{withClientMutation:p}=O();let a=c(!1),m=c("");const d=c(!0);l.fetchUnits();const x=D(()=>l.getUnits);let s=T({});function g(){const n={name:s.name,description:s.description};p(j,{payload:n},"createUnit").then(t=>l.addUnit(t))}function w(){const n={name:s.name,description:s.description};p(L,{uid:s.uid,payload:n},"updateUnit").then(t=>l.updateUnit(t))}function b(n,t={}){d.value=n,a.value=!0,m.value=(n?"CREATE":"EDIT")+" UNIT",n?Object.assign(s,{}):Object.assign(s,{...t})}function k(){d.value===!0&&g(),d.value===!1&&w(),a.value=!1}return(n,t)=>(r(),u(_,null,[e("div",R,[e("div",P,[q,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:t[0]||(t[0]=o=>b(!0))}," Add Unit"),G]),e("div",z,[e("div",H,[e("table",J,[K,e("tbody",Q,[(r(!0),u(_,null,I(x.value,o=>(r(),u("tr",{key:o?.uid},[e("td",W,[e("div",X,h(o?.name),1)]),Y,e("td",Z,[e("button",{onClick:ce=>b(!1,o),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,ee)])]))),128))])])])])]),i(a)?(r(),E(i(v),{key:0,onClose:t[4]||(t[4]=o=>S(a)?a.value=!1:a=!1)},{header:f(()=>[e("h3",null,h(i(m)),1)]),body:f(()=>[e("form",te,[e("div",se,[e("label",oe,[ne,y(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":t[1]||(t[1]=o=>i(s).name=o),placeholder:"Name ..."},null,512),[[A,i(s).name]])]),e("label",ie,[y(e("input",{type:"checkbox","onUpdate:modelValue":t[2]||(t[2]=o=>i(s).description=o)},null,512),[[N,i(s).description]]),ae])]),le,e("button",{type:"button",onClick:t[3]||(t[3]=M(o=>k(),["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})):F("",!0)],64))}}),me=$(re,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/admin/instruments/Units.vue"]]);export{me as default};
|