mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 08:53:00 +08:00
1 line
6.2 KiB
JavaScript
1 line
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)])]),d(" Contact Edit Form Modal "),s(n)?(r(),g(J,{key:0,onClose:t[5]||(t[5]=o=>I(n)?n.value=!1:n=!1)},{header:D(()=>[e("h3",null,m(s(y)),1)]),body:D(()=>[e("form",_e,[e("div",ge,[e("label",ye,[Ce,u(e("input",{class:"form-input mt-1 block w-full",autocomplete:"off","onUpdate:modelValue":t[1]||(t[1]=o=>s(a).firstName=o),placeholder:"Full Name ..."},null,512),[[v,s(a).firstName]])]),e("label",ve,[xe,u(e("input",{class:"form-input mt-1 block w-full",autocomplete:"off","onUpdate:modelValue":t[2]||(t[2]=o=>s(a).email=o),placeholder:"Email ..."},null,512),[[v,s(a).email]])]),e("label",we,[ke,u(e("input",{class:"form-input mt-1 block w-full",autocomplete:"off","onUpdate:modelValue":t[3]||(t[3]=o=>s(a).mobilePhone=o),placeholder:"Mobile Phone ..."},null,512),[[v,s(a).mobilePhone]])])]),Te,e("button",{type:"button",onClick:t[4]||(t[4]=H(o=>V(),["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})):d("v-if",!0)],64))}}),Ee=L(Ne,[["__file","/home/aurthur/Development/Python/felicity/felicity-lims/webapp/views/client/_id/ContactTable.vue"]]),De={class:"col-span-12"},Ue={class:"bg-white shadow-md mt-2"},Pe={class:"-mb-px flex justify-start"},$e=["onClick"],Ae={class:"pt-4"},Ie=P({__name:"ClientDetail",setup(F){const c=$();let l=h("samples");const b=["samples","contacts","logs"];U(()=>"tab-"+l.value);let f=U(()=>c.getClient);return(N,y)=>(r(),p("section",De,[e("nav",Ue,[e("div",Pe,[(r(),p(T,null,A(b,n=>e("a",{key:n,class:Q(["no-underline text-gray-500 uppercase tracking-wide font-bold text-xs py-1 px-4 tab hover:bg-sky-600 hover:text-gray-200",{"tab-active":s(l)===n}]),onClick:_=>I(l)?l.value=n:l=n,href:"#"},m(n),11,$e)),64))])]),e("div",Ae,[s(l)==="samples"?(r(),g(W,{key:0})):d("v-if",!0),s(l)==="contacts"?(r(),g(Ee,{key:1,clientUid:s(f)?.uid},null,8,["clientUid"])):d("v-if",!0),s(l)==="logs"?(r(),g(ee,{key:2,targetType:"client",targetId:s(f)?.uid},null,8,["targetId"])):d("v-if",!0)])]))}}),Re=L(Ie,[["__file","/home/aurthur/Development/Python/felicity/felicity-lims/webapp/views/client/_id/ClientDetail.vue"]]);export{Re as default};
|