| Current Path : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/ |
| Current File : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/Orders-MBRZxdIh.js |
import{r as g,d as h,j as e,O as u,B as t,T as i,F as n,a3 as y,a9 as j,aJ as b,aK as S,y as v,aP as C,a5 as w,e as D,i as W,ac as k,ak as N,f as z,a7 as F}from"./index-CDlA-3aM.js";const _=[{Name:"All",step:1,icon:e.jsx(b,{})},{Name:"Upcoming",step:2,icon:e.jsx(S,{})},{Name:"Delivered",step:3,icon:e.jsx(v,{})},{Name:"Cancelled",step:4,icon:e.jsx(C,{})}],O=({order:s})=>{const l=w();return e.jsx(t,{borderWidth:"1px",borderRadius:"lg",overflow:"hidden",boxShadow:"md",p:{base:"2",md:"2"},bg:"white",width:"100%",mb:3,minW:"100%",cursor:"pointer",py:{base:4,md:2},onClick:()=>{l(`/order/${s.id}`)},pos:"relative",children:e.jsxs(n,{gap:4,align:"start",children:[e.jsx(D,{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(t,{children:[" ",e.jsx(i,{fontSize:"md",fontWeight:600,m:0,children:s==null?void 0:s.title}),e.jsxs(i,{fontSize:"xs",fontWeight:600,m:0,color:"gray.500",children:["Order id - ",s==null?void 0:s.id]}),e.jsxs(i,{fontSize:"xs",fontWeight:600,m:0,color:"gray.500",children:[s==null?void 0:s.qty_text," , Qty : ",s.qty]}),e.jsx(n,{gap:2,children:e.jsxs(i,{fontSize:"md",fontWeight:600,m:0,color:"primary.text",children:[k," ",s==null?void 0:s.total_amount]})}),e.jsx(n,{gap:2,align:"center",children:e.jsxs(i,{fontSize:"sm",fontWeight:600,m:0,color:"gray.500",children:["Order Date : ",N(s.date).format("DD MMMM , YYYY")]})})]})]})})},q=()=>{const[s,l]=g.useState(1),o=async()=>(await z(`get_orders_item/user/${F.id}`)).data,{isLoading:d,data:x,error:p}=h({queryKey:["orders"],queryFn:o}),m=(a,r)=>r===1?a:a.filter(c=>r===2?c.delivery_status==="Not Delivered"&&c.order_status!=="Cancelled":r===3?c.delivery_status==="Delivered":r===4?c.order_status==="Cancelled":!1);if(d)return e.jsx(u,{});if(p)return e.jsx(ErrorPage,{});const f=m(x,s);return e.jsxs(t,{children:[" ",e.jsx(t,{bg:"primary.main",p:4,py:{base:"4",md:"10"},children:e.jsx(t,{className:"container",children:e.jsx(i,{fontFamily:"Quicksand, sans-serif",fontSize:{base:24,md:32},fontWeight:700,textAlign:"center",mt:0,color:"#fff",children:"Orders"})})})," ",e.jsx("div",{className:"container",children:e.jsx(n,{justify:"center",children:e.jsxs(t,{maxW:"100vw",w:"700px",minH:"80vh",children:[" ",e.jsxs(n,{gap:5,mt:5,flexDir:{base:"column",md:"row"},children:[e.jsx(t,{w:{base:"100%",md:"30%"},border:"1px solid",borderColor:"gray.200",p:4,borderRadius:4,bg:"#fff",h:"fit-content",display:{base:"flex",md:"block"},justifyContent:{base:"space-between"},children:_.map(a=>e.jsxs(n,{align:"center",gap:2,mb:3,cursor:"pointer",onClick:()=>{l(a.step)},transition:"0.3s ease",flexDir:{base:"column",md:"row"},children:[e.jsx(t,{p:2,border:"1px solid",borderColor:s===a.step?"primary.text":"gray.200",borderRadius:4,fontSize:18,color:s===a.step?"#fff":"gray.600",bg:s===a.step?"primary.text":"transparent",transition:"0.3s ease",children:a.icon}),e.jsx(i,{fontSize:14,fontWeight:s===a.step?"700":"600",color:s===a.step?"primary.text":"gray.600",transition:"0.3s ease",children:a.Name})]},a.Name))}),e.jsx(y,{spacing:1,flex:2,children:e.jsx(j.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},style:{minWidth:"100%"},children:f.map(a=>e.jsx(O,{order:a},a.id))},s)})]})]})})})]})};export{q as default};