felicity-lims/felicity/templates/static/assets/SuppliersListing-0090c423.js
2024-11-17 19:39:30 +02:00

1 line
4 KiB
JavaScript

import{d as C,K as I,r as u,q as L,x as A,o as p,c as _,b as e,F as y,E as P,t as m,f as i,A as M,B as g,e as v,v as x,w as R,i as T,D as U,j as B,_ as F,G as V,H as N,M as $,k as j}from"./index-e62f5c21.js";import{g as O,h as q}from"./instrument.mutations-b1e47e8c.js";const r=a=>(V("data-v-33160deb"),a=a(),N(),a),G={class:"container w-full my-4"},H=r(()=>e("hr",null,null,-1)),K=r(()=>e("hr",null,null,-1)),z={class:"overflow-x-auto mt-4"},J={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"},W=r(()=>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"},"Supplier"),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)),X={class:"bg-white"},Y={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Z={class:"flex items-center"},ee={class:"text-sm leading-5 text-gray-800"},te={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},se={class:"text-sm leading-5 text-sky-800"},oe={class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},ne=["onClick"],ie={action:"post",class:"p-1"},le={class:"grid grid-cols-2 gap-x-4 mb-4"},re={class:"block col-span-1 mb-2"},ae=r(()=>e("span",{class:"text-gray-700"},"Name",-1)),de={class:"block col-span-2 mb-2"},pe=r(()=>e("span",{class:"text-gray-700"},"Description",-1)),ce=r(()=>e("hr",null,null,-1)),ue=C({__name:"SuppliersListing",setup(a){const w=B(()=>F(()=>import("./FelModal-44636049.js"),["assets/FelModal-44636049.js","assets/index-e62f5c21.js","assets/index-332ec99e.css","assets/FelModal-780aeea9.css"])),d=I(),{withClientMutation:b}=$();let l=u(!1),h=u(""),s=L({});const c=u(!0);d.fetchSuppliers();const k=A(()=>d.getSuppliers);function S(){const n={name:s.name,description:s.description};b(O,{payload:n},"createSupplier").then(t=>d.addSupplier(t))}function D(){const n={name:s.name,description:s.description};b(q,{uid:s.uid,payload:n},"updateSupplier").then(t=>d.updateSupplier(t))}function f(n,t={}){c.value=n,l.value=!0,h.value=(n?"CREATE":"EDIT")+" SUPPLIER",n?Object.assign(s,{}):Object.assign(s,{...t})}function E(){c.value===!0&&S(),c.value===!1&&D(),l.value=!1}return(n,t)=>(p(),_(y,null,[e("div",G,[H,e("button",{onClick:t[0]||(t[0]=o=>f(!0)),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 Supplier"),K,e("div",z,[e("div",J,[e("table",Q,[W,e("tbody",X,[(p(!0),_(y,null,P(k.value,o=>(p(),_("tr",{key:o?.uid},[e("td",Y,[e("div",Z,[e("div",null,[e("div",ee,m(o?.name),1)])])]),e("td",te,[e("div",se,m(o?.description),1)]),e("td",oe,[e("button",{onClick:_e=>f(!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,ne)])]))),128))])])])])]),i(l)?(p(),M(i(w),{key:0,onClose:t[4]||(t[4]=o=>T(l)?l.value=!1:l=!1)},{header:g(()=>[e("h3",null,m(i(h)),1)]),body:g(()=>[e("form",ie,[e("div",le,[e("label",re,[ae,v(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),[[x,i(s).name]])]),e("label",de,[pe,v(e("textarea",{cols:"2",class:"form-input mt-1 block w-full","onUpdate:modelValue":t[2]||(t[2]=o=>i(s).description=o),placeholder:"Description ..."},null,512),[[x,i(s).description]])])]),ce,e("button",{type:"button",onClick:t[3]||(t[3]=R(o=>E(),["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})):U("",!0)],64))}});const he=j(ue,[["__scopeId","data-v-33160deb"],["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/admin/suppliers/SuppliersListing.vue"]]);export{he as default};