Your IP : 216.73.216.93


Current Path : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/
Upload File :
Current File : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/LabTestDetails-DtPIxk8k.js

import{a4 as _,ad as z,ai as C,d as w,aF as T,a7 as o,j as e,O as u,B as d,n as h,e as v,i as D,a3 as B,T as i,H as L,R,al as k,l as F,ah as l,aG as A,aH as q,av as E,f as H}from"./index-DjKxDI5z.js";import{u as P}from"./CartData-BEXTpW6W.js";import{B as W}from"./badge-C3s3jsxC.js";function G(){const{id:x}=_(),{cartData:f,cartLoading:j}=P(),c=z(),m=C(),p=async()=>(await H(`get_lab_test/${x}`)).data,{isLoading:y,data:a}=w({queryKey:["Lab-test",x],queryFn:p}),g=t=>{if(o){let r=!1;return f.forEach(s=>{s.lab_test_id===t.id&&(r=!0)}),r}else return!1},b=(t,r)=>{const s=t/100*r;return parseFloat(t)+parseFloat(s)},S=async t=>{let r={user_id:o.id,product_id:null,price:t.price??"",total_price:b(t.price,t.tax)??"",mrp:t.mrp??"",tax:t.tax??"",qty:1,qty_text:"",lab_test_id:t.id};try{const s=await E(o.token,"add_cart",r);return s.response===200?(l(c,"success","Added to cart!"),m.invalidateQueries("cartdata"),s):(l(c,"error",s.message),s)}catch(s){return s}},n=T({mutationFn:async t=>{await S(t)},onSuccess:()=>{m.invalidateQueries("cartdata")},onError:t=>{l(c,"error",JSON.stringify(t))}});return y||o&&j||n!=null&&n.isPending?e.jsx(u,{}):e.jsxs(d,{minH:"50vh",children:[n.isPending?e.jsx(u,{}):"",e.jsx("div",{className:"container",children:e.jsxs(d,{p:[2,4,5],shadow:"lg",borderWidth:"1px",borderRadius:"lg",maxW:"3xl",mx:"auto",bg:"white",mt:10,children:[e.jsxs(h,{spacing:[2,4,6],flexDirection:["column","column","row"],align:"center",children:[e.jsx(v,{boxSize:{base:"100%",md:"200px"},objectFit:"cover",src:a.image?`${D}/${a.image}`:"/ctscan.svg",alt:a.title,borderRadius:"md"}),e.jsxs(B,{align:"start",spacing:[2,2],children:[e.jsx(i,{fontSize:["sm","md"],color:"gray.400",fontWeight:"bold",children:a.lab_cat_title}),e.jsx(L,{size:["lg","lg"],color:"primary.text",children:a.title}),e.jsx(i,{fontSize:["sm","md"],color:"gray.500",children:a.sub_title}),e.jsx(W,{colorScheme:"green",fontSize:["0.7em","0.9em"],paddingX:4,children:a.offer_text}),e.jsx(i,{fontSize:["sm","md"],color:"gray.600",children:a.description})]})]}),e.jsx(R,{my:[2,3,4]}),e.jsxs(k,{direction:["column","row"],spacing:[4,5,4],justify:"space-between",align:["left","center"],children:[e.jsxs(d,{children:[e.jsxs(i,{fontSize:["lg","xl"],fontWeight:"bold",color:"primary.text",children:["₹",a.price]}),e.jsxs(h,{children:[e.jsxs(i,{fontSize:["xs","sm"],color:"gray.500",as:"del",children:["₹",a.mrp]}),e.jsxs(i,{fontSize:["xs","sm"],color:"gray.500",children:["(Inclusive of ",a.tax,"% tax)"]})]})]}),e.jsx(F,{colorScheme:"blue",size:"sm",leftIcon:g(a)?e.jsx(A,{fontSize:20,style:{marginRight:"5px"}}):e.jsx(q,{fontSize:20,style:{marginRight:"5px"}}),minW:"200px",onClick:()=>{if(!o)return l(c,"error","Please Login First");n.mutate(a)},children:g(a)?"Added To Cart":"Add to Cart"})]})]})})]})}export{G as default};