mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
1 line
5.7 KiB
JavaScript
1 line
5.7 KiB
JavaScript
import{d as F,p as R,N as $,aA as q,s as j,r as p,m as U,o as i,c as d,b as t,f as o,g,t as a,e as v,P as z,A as G,B as D,v as E,i as y,F as h,E as b,as as C,w as H,D as J,M as K,k as O}from"./index-e62f5c21.js";import Q from"./FelLoadingMessage-b4229f94.js";import W from"./FelModal-44636049.js";import{A as X,E as Y}from"./clients.mutations-8a818b76.js";import{h as Z,o as tt,a as et}from"./constants-02c93bfe.js";const st={class:""},ot={class:"grid grid-cols-12 gap-4 mt-2"},lt={class:"col-span-12"},nt={class:"bg-white rounded-sm shadow-sm hover:shadow-lg duration-500 px-4 sm:px-6 md:px-2 py-4"},it={key:0,class:"py-4 text-center"},at={key:1,class:"grid grid-cols-12 gap-3"},dt={class:"col-span-12 px-3 sm:px-0"},ct={class:"flex justify-between sm:text-sm md:text-md lg:text-lg text-gray-700 font-bold"},rt=t("hr",null,null,-1),ut={class:"grid grid-cols-2 mt-2"},mt={class:"col-span-1"},_t={class:"flex"},pt=t("span",{class:"text-gray-800 text-sm font-medium w-16"},"Province:",-1),vt={class:"text-gray-600 text-sm md:text-md"},ft={class:"flex"},ht=t("span",{class:"text-gray-800 text-sm font-medium w-16"},"District:",-1),xt={class:"text-gray-600 text-sm md:text-md"},gt={class:"flex"},yt=t("span",{class:"text-gray-800 text-sm font-medium w-16"},"Code:",-1),bt={class:"text-gray-600 text-sm md:text-md"},Ct={class:"col-span-1"},wt={class:"flex"},kt=t("span",{class:"text-gray-800 text-sm font-medium w-16"},"Email:",-1),Ut={class:"text-gray-600 text-sm md:text-md"},Dt={class:"flex"},Et=t("span",{class:"text-gray-800 text-sm font-medium w-16"},"Mobile:",-1),Tt={class:"text-gray-600 text-sm md:text-md"},Nt={action:"post",class:"p-1"},Mt={class:"grid grid-cols-2 gap-x-4 mb-4"},Bt={class:"block col-span-1 mb-2"},Pt=t("span",{class:"text-gray-700"},"Name",-1),St={class:"block col-span-1 mb-2"},Vt=t("span",{class:"text-gray-700"},"Code",-1),At={class:"grid grid-cols-3 gap-x-4 mb-4"},It={class:"block col-span-1 mb-2"},Lt=t("span",{class:"text-gray-700"},"Country",-1),Ft=t("option",null,null,-1),Rt=["value"],$t={class:"block col-span-1 mb-2"},qt=t("span",{class:"text-gray-700"},"Province",-1),jt=t("option",null,null,-1),zt=["value"],Gt={class:"block col-span-1 mb-2"},Ht=t("span",{class:"text-gray-700"},"District",-1),Jt=t("option",null,null,-1),Kt=["value"],Ot=t("hr",null,null,-1),Qt=F({__name:"Client",setup(Wt){const r=R(),{withClientMutation:w}=K(),T=$(),f=q(),{client:c,fetchingClient:N}=j(f);let u=p(!1),x=p(!1),k=p(""),l=p({}),m=p(),_=p();f.fetchClientByUid(T.query.clientUid),r.fetchCountries();function M(n){r.filterProvincesByCountry(m.value)}function B(n){r.filterDistrictsByProvince(_.value)}function P(n,s={}){x.value=n,k.value=`${n?"CREATE":"EDIT"} CLIENT`,u.value=!0,n?l.value={}:(m.value=s?.district?.province?.countryUid,_.value=s?.district?.provinceUid,l.value=s)}function S(){w(X,{payload:{name:l?.value?.name,code:l?.value?.code,districtUid:l?.value?.districtUid}},"createClient").then(n=>f.addClient(n))}function V(){w(Y,{uid:l?.value?.uid,payload:{name:l?.value?.name,code:l?.value?.code,districtUid:l?.value?.districtUid}},"updateClient").then(n=>f.updateClient(n))}function A(){x.value&&S(),x.value||V(),u.value=!1,l.value={}}return(n,s)=>{const I=U("font-awesome-icon"),L=U("router-view");return i(),d(h,null,[t("div",st,[t("div",ot,[t("section",lt,[t("div",nt,[o(N)?(i(),d("div",it,[g(Q,{message:"Fetching client metadata ..."})])):(i(),d("div",at,[t("div",dt,[t("div",ct,[t("span",null,a(o(c)?.name),1),t("div",null,[v(t("button",{onClick:s[0]||(s[0]=e=>P(!1,o(c))),class:"p-1 ml-2 border-white border text-gray-500 text-md rounded-sm transition duration-300 hover:text-sky-800 focus:outline-none"},[g(I,{icon:"fa-edit"})],512),[[z,Z(et.UPDATE,tt.CLIENT)]])])]),rt,t("div",ut,[t("div",mt,[t("div",_t,[pt,t("span",vt,a(o(c)?.name),1)]),t("div",ft,[ht,t("span",xt,a(o(c)?.district?.name),1)]),t("div",gt,[yt,t("span",bt,a(o(c)?.code),1)])]),t("div",Ct,[t("div",wt,[kt,t("span",Ut,a(o(c)?.email),1)]),t("div",Dt,[Et,t("span",Tt,a(o(c)?.mobilePhone),1)])])])])]))])])]),g(L)]),o(u)?(i(),G(W,{key:0,onClose:s[9]||(s[9]=e=>y(u)?u.value=!1:u=!1)},{header:D(()=>[t("h3",null,a(o(k)),1)]),body:D(()=>[t("form",Nt,[t("div",Mt,[t("label",Bt,[Pt,v(t("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":s[1]||(s[1]=e=>o(l).name=e),placeholder:"Name ..."},null,512),[[E,o(l).name]])]),t("label",St,[Vt,v(t("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":s[2]||(s[2]=e=>o(l).code=e),placeholder:"Code ..."},null,512),[[E,o(l).code]])])]),t("div",At,[t("label",It,[Lt,v(t("select",{class:"form-select block w-full mt-1","onUpdate:modelValue":s[3]||(s[3]=e=>y(m)?m.value=e:m=e),onChange:s[4]||(s[4]=e=>M(e))},[Ft,(i(!0),d(h,null,b(o(r).countries,e=>(i(),d("option",{key:e.uid,value:e.uid},a(e.name),9,Rt))),128))],544),[[C,o(m)]])]),t("label",$t,[qt,v(t("select",{class:"form-select block w-full mt-1","onUpdate:modelValue":s[5]||(s[5]=e=>y(_)?_.value=e:_=e),onChange:s[6]||(s[6]=e=>B(e))},[jt,(i(!0),d(h,null,b(o(r).provinces,e=>(i(),d("option",{key:e.uid,value:e.uid},a(e.name),9,zt))),128))],544),[[C,o(_)]])]),t("label",Gt,[Ht,v(t("select",{class:"form-select block w-full mt-1","onUpdate:modelValue":s[7]||(s[7]=e=>o(l).districtUid=e)},[Jt,(i(!0),d(h,null,b(o(r).districts,e=>(i(),d("option",{key:e.uid,value:e.uid},a(e.name),9,Kt))),128))],512),[[C,o(l).districtUid]])])]),Ot,t("button",{type:"button",onClick:s[8]||(s[8]=H(e=>A(),["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})):J("",!0)],64)}}}),se=O(Qt,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/client/_id/Client.vue"]]);export{se as default};
|