felicity-lims/felicity/templates/static/assets/Departments-e5bfa827.js
2024-11-01 08:48:45 +02:00

1 line
3.2 KiB
JavaScript

import{d as g,L as w,r as d,C as D,D as k,o as i,c as u,b as e,F as b,p as C,t as h,f as r,q as E,G as f,e as A,v as T,w as M,i as N,x as F,j as O,_ as P,bx as R,by as S,O as j,k as B}from"./index-e48f6898.js";const V={class:"container w-full my-4"},$=e("hr",null,null,-1),L=e("hr",null,null,-1),U={class:"overflow-x-auto mt-4"},I={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"},q={class:"min-w-full"},G=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"})])],-1),z={class:"bg-white"},H={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},J={class:"flex items-center"},K={class:"text-sm leading-5 text-gray-800"},Q={class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},W=["onClick"],X={action:"post",class:"p-1"},Y={class:"grid grid-cols-2 gap-x-4 mb-4"},Z={class:"block col-span-2 mb-2"},ee=e("span",{class:"text-gray-700"},"Department Name",-1),te=e("hr",null,null,-1),se=g({__name:"Departments",setup(oe){const v=O(()=>P(()=>import("./FelModal-3c028bd6.js"),["assets/FelModal-3c028bd6.js","assets/index-e48f6898.js","assets/index-7d22ceed.css","assets/FelModal-a7d23795.css"])),l=w(),{withClientMutation:c}=j();let a=d(!1),m=d(""),n=D({});const p=d(!0);l.fetchDepartments({});const y=k(()=>l.getDepartments);function _(s,t){p.value=s,a.value=!0,m.value=(s?"CREATE":"EDIT")+" Department",s?Object.assign(n,{...new Object}):Object.assign(n,{...t})}function x(){p.value===!0?c(R,{payload:{name:n.name}},"createDepartment").then(s=>l.addDepartment(s)):c(S,{uid:n.uid,payload:{name:n.name}},"updateDepartment").then(s=>l.updateDepartment(s)),a.value=!1}return(s,t)=>(i(),u(b,null,[e("div",V,[$,e("button",{onClick:t[0]||(t[0]=o=>_(!0,null)),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"},"Add Department"),L,e("div",U,[e("div",I,[e("table",q,[G,e("tbody",z,[(i(!0),u(b,null,C(y.value,o=>(i(),u("tr",{key:o?.uid},[e("td",H,[e("div",J,[e("div",null,[e("div",K,h(o?.name),1)])])]),e("td",Q,[e("button",{onClick:ne=>_(!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,W)])]))),128))])])])])]),r(a)?(i(),E(r(v),{key:0,onClose:t[3]||(t[3]=o=>N(a)?a.value=!1:a=!1)},{header:f(()=>[e("h3",null,h(r(m)),1)]),body:f(()=>[e("form",X,[e("div",Y,[e("label",Z,[ee,A(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":t[1]||(t[1]=o=>r(n).name=o),placeholder:"Name ..."},null,512),[[T,r(n).name]])])]),te,e("button",{type:"button",onClick:t[2]||(t[2]=M(o=>x(),["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))}}),re=B(se,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/admin/laboratory/Departments.vue"]]);export{re as default};