felicity-lims/felicity/templates/static/assets/Suppliers-f2c45108.js
2023-11-10 18:48:39 +02:00

1 line
4.2 KiB
JavaScript

import{_ as I,t as A,w as P}from"./shipment-53265c2d.js";import{f as F,G as L,r as u,c as M,d as R,h as p,k as _,x as e,F as y,ak as T,D as m,u as i,y as v,j as U,A as x,ag as g,i as V,p as B,e as N,_ as $}from"./_plugin-vue_export-helper-dacf3d65.js";import{e as j,f as O}from"./instrument.mutations-db9aed1a.js";import{v as w,a as G}from"./runtime-dom.esm-bundler-98433118.js";const l=a=>(B("data-v-e57bedbd"),a=a(),N(),a),q={class:"container w-full my-4"},z=l(()=>e("hr",null,null,-1)),H=l(()=>e("hr",null,null,-1)),J={class:"overflow-x-auto mt-4"},K={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=l(()=>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"},re={class:"grid grid-cols-2 gap-x-4 mb-4"},le={class:"block col-span-1 mb-2"},ae=l(()=>e("span",{class:"text-gray-700"},"Name",-1)),de={class:"block col-span-2 mb-2"},pe=l(()=>e("span",{class:"text-gray-700"},"Description",-1)),ce=l(()=>e("hr",null,null,-1)),ue=F({__name:"Suppliers",setup(a){const k=L(()=>I(()=>import("./SimpleModal-9e28c074.js"),["assets/SimpleModal-9e28c074.js","assets/_plugin-vue_export-helper-dacf3d65.js","assets/runtime-dom.esm-bundler-98433118.js","assets/SimpleModal-f645a074.css"])),d=A(),{withClientMutation:b}=P();let r=u(!1),h=u(""),s=M({});const c=u(!0);d.fetchSuppliers();const S=R(()=>d.getSuppliers);function D(){const n={name:s.name,description:s.description};b(j,{payload:n},"createSupplier").then(t=>d.addSupplier(t))}function E(){const n={name:s.name,description:s.description};b(O,{uid:s.uid,payload:n},"updateSupplier").then(t=>d.updateSupplier(t))}function f(n,t={}){c.value=n,r.value=!0,h.value=(n?"CREATE":"EDIT")+" SUPPLIER",n?Object.assign(s,{}):Object.assign(s,{...t})}function C(){c.value===!0&&D(),c.value===!1&&E(),r.value=!1}return(n,t)=>(p(),_(y,null,[e("div",q,[z,e("button",{onClick:t[0]||(t[0]=o=>f(!0)),class:"px-2 py-1 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"},"Add Supplier"),H,e("div",J,[e("div",K,[e("table",Q,[W,e("tbody",X,[(p(!0),_(y,null,T(i(S),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))])])])])]),v(" Location Edit Form Modal "),i(r)?(p(),U(i(k),{key:0,onClose:t[4]||(t[4]=o=>V(r)?r.value=!1:r=!1)},{header:x(()=>[e("h3",null,m(i(h)),1)]),body:x(()=>[e("form",ie,[e("div",re,[e("label",le,[ae,g(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),[[w,i(s).name]])]),e("label",de,[pe,g(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),[[w,i(s).description]])])]),ce,e("button",{type:"button",onClick:t[3]||(t[3]=G(o=>C(),["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})):v("v-if",!0)],64))}});const ye=$(ue,[["__scopeId","data-v-e57bedbd"],["__file","/home/aurthurm/Development/felicity-lims/webapp/views/admin/suppliers/Suppliers.vue"]]);export{ye as default};