| Current Path : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/ |
| Current File : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/OrderDetails-DG_8P4aR.js |
import{a4 as j,a6 as y,r as p,d as S,j as e,O as f,E as b,B as n,T as t,F as o,e as _,i as w,ac as W,ak as z,R as x,bs as v,l as g,aW as O,aZ as C,ai as A,ad as B,aF as M,ah as $,a_ as k,ay as R,a$ as D,aR as F,aA as I,aB as P,aS as q,f as E}from"./index-DjKxDI5z.js";import{B as u}from"./badge-C3s3jsxC.js";const T=r=>{switch(r){case"Pending":return"yellow";case"Confirmed":return"green";case"Cancelled":return"red";default:return"gray"}},Y=r=>{const{name:c,flat_no:i,apartment_name:l,area:m,landmark:d,city:h,pincode:s}=r;let a=`${c},
`;return i&&(a+=`${i}, `),l&&(a+=`${l}, `),a+=`${m}, ${d}, ${h} - ${s}`,a},G=()=>{const{id:r}=j(),{isOpen:c,onOpen:i,onClose:l}=y(),m=p.useRef(),d=async()=>(await E(`get_orders_item/${r}`)).data,{isLoading:h,data:s,error:a}=S({queryKey:["order",r],queryFn:d});return h?e.jsx(f,{}):a?e.jsx(b,{}):e.jsxs(n,{children:[" ",e.jsx(n,{bg:"primary.main",p:4,py:{base:"4",md:"10"},children:e.jsx(n,{className:"container",children:e.jsxs(t,{fontFamily:"Quicksand, sans-serif",fontSize:{base:24,md:32},fontWeight:700,textAlign:"center",mt:0,color:"#fff",children:["Order #",r]})})})," ",e.jsx(n,{className:"container",minH:"50vh",children:e.jsxs(o,{justify:"center",children:[" ",e.jsxs(n,{p:[2,4,5],shadow:"lg",borderWidth:"1px",borderRadius:"lg",mx:"auto",bg:"white",mt:5,w:600,maxW:"100vw",children:[e.jsxs(o,{gap:4,align:"start",children:[e.jsx(_,{src:`${w}/${s==null?void 0:s.image}`,fallbackSrc:"/imagePlaceholder.png",w:{base:"80px",md:"80px"},h:{base:"80px",md:"80px"},bgSize:"cover",borderRadius:5}),e.jsxs(n,{children:[" ",e.jsx(t,{fontSize:"md",fontWeight:600,m:0,children:s==null?void 0:s.title}),e.jsxs(t,{fontSize:"xs",fontWeight:600,m:0,color:"gray.500",children:[s==null?void 0:s.qty_text," , Qty : ",s.qty]}),e.jsx(o,{gap:2,children:e.jsxs(t,{fontSize:"md",fontWeight:600,m:0,color:"primary.text",children:[W," ",s==null?void 0:s.total_amount]})}),e.jsx(o,{gap:2,align:"center",children:e.jsxs(t,{fontSize:"sm",fontWeight:600,m:0,color:"gray.500",children:["Order Date :"," ",z(s.date).format("DD MMMM , YYYY")]})})]})]}),e.jsx(x,{my:2}),e.jsxs(o,{align:"center",justify:"space-between",children:[" ",e.jsxs(t,{fontWeight:"bold",color:"gray.600",children:["Order #",s.id]}),e.jsx(u,{colorScheme:T(s.order_status),variant:"solid",mt:1,children:s.order_status})]}),e.jsx(x,{my:2}),e.jsxs(n,{borderWidth:"1px",borderRadius:"lg",overflow:"hidden",p:{base:"2",md:"2"},bg:"white",width:"100%",mb:3,minW:"100%",cursor:"pointer",py:{base:2,md:2},children:[e.jsx(t,{fontSize:"md",fontWeight:600,m:0,color:"gray.800",children:"Delivery Address"}),e.jsxs(o,{fontWeight:600,align:"center",gap:2,color:"gray.600",fontSize:"sm",children:[" ",e.jsx(v,{fontSize:14}),e.jsxs(t,{children:[" ",s.s_phone]})]}),e.jsx(t,{fontWeight:600,color:"gray.600",fontSize:"sm",children:Y(s)})]}),e.jsx(x,{my:2,mt:5}),e.jsxs(n,{mt:5,children:[e.jsxs(o,{align:"center",justify:"space-between",children:[" ",e.jsx(t,{fontWeight:"bold",children:"Payment Status"}),e.jsx(u,{colorScheme:s.payment_type==="Paid"?"green":"red",fontWeight:"bold",variant:"solid",children:s.payment_type})]}),e.jsxs(t,{color:"gray.600",fontSize:"sm",fontWeight:600,children:["Payment Id #",s.id]}),e.jsx(g,{variant:"link",colorScheme:"green",rightIcon:e.jsx(O,{fontSize:18}),children:"Download Invoice"})]}),e.jsx(x,{my:3}),e.jsx(n,{children:e.jsx(n,{bg:"red.400",_hover:{bg:"red.500"},mt:0,width:"100%",size:"sm",as:g,color:"#000",rightIcon:e.jsx(C,{color:"#fff"}),justifyContent:"space-between",alignItems:"center",textAlign:"left",py:2,h:"fit-content",onClick:()=>{s.current_cancel_req_status!=="Approved"&&i()},children:e.jsxs(n,{children:[e.jsx(t,{fontSize:"md",color:"#fff",children:"Cancel Order"}),s.current_cancel_req_status!=="Approved"&&e.jsx(t,{fontSize:"xs",mt:1,color:"gray.100",children:"Click here to cancel the order"})]})})})]})]})}),e.jsx(N,{cancelRef:m,isOpen:c,onClose:l,currentStatus:s.current_cancel_req_status,appointID:r})]})},N=({cancelRef:r,isOpen:c,onClose:i,currentStatus:l,appointID:m})=>{A();const d=B(),h=async a=>{i()},s=M({mutationFn:async a=>{await h()},onSuccess:()=>{i()},onError:a=>{$(d,"error",JSON.stringify(a))}});return s.isPending?e.jsx(f,{}):e.jsxs(k,{motionPreset:"slideInBottom",leastDestructiveRef:r,onClose:i,isOpen:c,isCentered:!0,children:[e.jsx(R,{}),e.jsxs(D,{m:{base:2,md:0},children:[e.jsx(F,{fontSize:"md",children:"Cancel Order"}),e.jsx(I,{}),e.jsx(P,{children:"Are you sure , you want to cancel this Order ?"}),e.jsxs(q,{children:[e.jsx(g,{ref:r,onClick:i,size:"sm",minW:20,children:"No"}),e.jsx(g,{colorScheme:"red",ml:3,size:"sm",minW:20,onClick:()=>{s.mutate({})},children:"Yes"})]})]})]})};export{G as default};