mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 08:53:00 +08:00
2 lines
6.2 KiB
JavaScript
2 lines
6.2 KiB
JavaScript
|
import{d as P,ac as $,ad as j,s as B,r as h,o as r,g as p,y as d,h as e,i as u,C,F as T,z as A,t as m,G as q,j as s,l as z,L as G,D as g,E as D,v,w as H,k as I,I as J,ak as K,_ as L,U,H as Q}from"./index-cd9e6ac8.js";import{t as W}from"./SampleListing-d714979c.js";import{D as X,a as Y,b as Z}from"./clients.mutations-1bc962d0.js";import{h as x,o as w,a as k}from"./constants-99d18042.js";import{t as ee}from"./AuditLog-efe68260.js";import"./samples-84482611.js";const te={class:"overflow-x-auto"},oe={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"},se={class:"min-w-full"},ae=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"}," Full 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"}," Email "),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Phone "),e("th",{class:"px-1 py-1 border-b-2 border-gray-300"})])],-1),le={class:"bg-white"},ne={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ie={class:"flex items-center"},re={class:"text-sm leading-5 text-gray-800"},ce={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},de={class:"text-sm leading-5 text-sky-800"},ue={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},me={class:"text-sm leading-5 text-sky-800"},pe={class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},be=["onClick"],he=["onClick"],fe={key:0,class:"py-4 text-center"},_e={action:"post",class:"p-1"},ge={class:"grid grid-cols-2 gap-x-4 mb-4"},ye={class:"block col-span-1 mb-2"},Ce=e("span",{class:"text-gray-700"},"Full Name",-1),ve={class:"block col-span-1 mb-2"},xe=e("span",{class:"text-gray-700"},"Email",-1),we={class:"block col-span-1 mb-2"},ke=e("span",{class:"text-gray-700"},"Mobile Phone",-1),Te=e("hr",null,null,-1),Ne=P({__name:"ContactTable",props:{clientUid:String},setup(F){let c=$(),l=j();const{withClientMutation:b}=K(),{clientContacts:f,fetchingClientContacts:N}=B(c);let y=h(""),n=h(!1),_=h(!1),a=h({});c.fetchClientContacts(l.query.clientUid);function M(){b(Y,{payload:{clientUid:l.query.clientUid,firstName:a.value.firstName,mobilePhone:a.value.mobilePhone,email:a.value.email}},"createClientContact").then(i=>c.addClientContact(i))}function S(){b(Z,{uid:a.value.uid,payload:{clientUid:l.query.clientUid,firstName:a.value.firstName,mobilePhone:a.value.mobilePhone,email:a.value.email}},"updateClientContact").then(i=>c.updateClientContact(i))}function E(i,t={}){_.value=i,y.value=(i?"CREATE":"EDIT")+" CONTACT",n.value=!0,i?Object.assign(a,{}):Object.assign(a.value,{...t})}function V(){_.value===!0&&M(),_.value||S(),n.value=!1}function O(i){b(X,{uid:i},"deleteClientContact").then(t=>c.deleteClientContact(t?.uid))}return(i,t)=>(r(),p(T,null,[d(" Contacts Table View "),e("div",te,[u(e("button",{onClick:t[0]||(t[0]=o=>E(!0)),class:"px-1 py-0 mb-4 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Add Contact ",512),[[C,x(k.CREATE,w.CLIENT)]]),e("div",oe,[e("table",se,[ae,e("tbody",le,[(r(!0),p(T,null,A(s(f),o=>(r(),p("tr",{key:o.uid},[e("td",ne,[e("div",ie,[e("div",null,[e("div",re,m(o.firstName)+" "+m(o.lastName),1)])])]),e("td",ce,[e("div",de,m(o.email),1)]),e("td",ue,[e("div",me,m(o.mobilePhone),1)]),e("td",pe,[u(e("button",{onClick:R=>E(!1,o),class:"px-2 py-1 mr-2 border-gray-500 border text-orange-500rounded-smtransition duration-300 hover:bg-gray-700 hover:text-white focus:outline-none"}," Edit ",8,be),[[C,x(k.UPDATE,w.CLIENT)]]),q(),u(e("button",{onClick:R=>O(o?.uid),class:"px-2 py-1 mr-2 border-orange-500 border text-orange-500rounded-smtransition duration-300 hover:bg-orange-700 hover:text-white focus:outline-none"}," Deactivate ",8,he),[[C,x(k.UPDATE,w.CLIENT)]])])]))),128))])]),s(N)?(r(),p("div",fe,[z(G,{message:"Fetching client contacts ..."})])):d("v-if",!0)])]),
|