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/Appoinments-CAwk6Q6W.js

import{aI as S,r as C,d as w,j as e,O as k,E as A,B as r,T as n,F as d,V as D,W as F,X as N,l as h,L as W,q as z,a3 as f,a9 as v,aJ as R,aK as _,aL as Y,aM as B,aN as M,y as T,aO as E,aP as L,aQ as P,a5 as I,ak as m,R as O,m as V,f as q,a7 as H}from"./index-CDlA-3aM.js";import{g as Q}from"./StatusBadge-kb4wYcEV.js";import{B as $}from"./badge-DWO6rCuf.js";const u=S("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});u.displayName="Spacer";const K=[{Name:"All",step:1,icon:e.jsx(R,{})},{Name:"Upcoming",step:2,icon:e.jsx(_,{})},{Name:"Pending",step:3,icon:e.jsx(Y,{})},{Name:"Confirmed",step:4,icon:e.jsx(B,{})},{Name:"Rejected",step:5,icon:e.jsx(M,{})},{Name:"Completed",step:6,icon:e.jsx(T,{})},{Name:"Rescheduled",step:7,icon:e.jsx(E,{})},{Name:"Cancelled",step:8,icon:e.jsx(L,{})},{Name:"Visited",step:9,icon:e.jsx(P,{})}],U=({appointment:s})=>{const l=I(),i=c=>{const o=m(c,"YYYY-MM-DD");return{month:o.format("MMM"),date:o.format("DD"),year:o.format("YYYY")}};return e.jsx(r,{borderWidth:"1px",borderRadius:"lg",overflow:"hidden",boxShadow:"md",p:{base:"2",md:"2"},bg:"white",width:"100%",mb:6,minW:"100%",cursor:"pointer",py:{base:4,md:2},onClick:()=>{l(`/appointment/${s.id}`)},pos:"relative",children:e.jsxs(d,{align:"center",gap:2,justify:"space-between",children:[e.jsxs(r,{flex:1,children:[" ",e.jsx(n,{fontSize:"md",fontWeight:"bold",color:"gray.800",textAlign:"center",children:i(s.date).month}),e.jsx(n,{fontSize:"3xl",fontWeight:"700",color:"blue.600",textAlign:"center",children:i(s.date).date}),e.jsx(n,{fontSize:"md",fontWeight:"bold",color:"gray.800",textAlign:"center",children:i(s.date).year})]}),e.jsxs(r,{flex:5,children:[" ",e.jsxs(r,{children:[" ",e.jsxs(n,{fontWeight:"bold",fontSize:{base:"sm",md:"md"},children:["Name: ",s.patient_f_name," ",s.patient_l_name," , ID - #",s.id]}),e.jsxs(n,{fontWeight:"bold",fontSize:{base:"sm",md:"sm"},color:"gray.700",children:["Time -"," ",m(s.time_slots,"hh:mm:ss").format("hh:mm A")]}),e.jsx($,{mb:1,colorScheme:s.type==="Emergency"?"red":"green",fontSize:{base:"xs",md:"xs"},children:s.type})]})," ",Q(s.status),e.jsx(O,{my:1}),e.jsxs(n,{fontWeight:"bold",fontSize:{base:"sm",md:"sm"},color:"gray.700",children:["Doctor - ",s.doct_f_name," ",s.doct_l_name]}),e.jsx(n,{fontWeight:"bold",fontSize:{base:"sm",md:"sm"},color:"gray.700",children:s.dept_title})]}),e.jsx(f,{align:"end",spacing:1,flex:2,children:e.jsxs(h,{colorScheme:"blue",size:"xs",onClick:c=>{c.stopPropagation(),l(`/doctor/${s.doct_id}`)},children:["Rebook ",e.jsx(u,{mx:1})," ",e.jsx(V,{})]})})]})})},Z=()=>{const[s,l]=C.useState(1),i=async()=>(await q(`get_appointment/user/${H.id}`)).data,{isLoading:c,data:o,error:j}=w({queryKey:["appointments"],queryFn:i}),g=(t,y)=>{const p=new Date;return t.filter(a=>{const x=new Date(a.date);switch(y){case 1:return!0;case 2:return x>p&&a.status!=="Completed"&&a.status!=="Cancelled"&&a.status!=="Rejected";case 3:return a.status==="Pending";case 4:return a.status==="Confirmed";case 5:return a.status==="Rejected";case 6:return a.status==="Completed";case 7:return a.status==="Rescheduled";case 8:return a.status==="Cancelled";case 9:return a.status==="Visited";default:return!0}}).sort((a,x)=>new Date(x.date)-new Date(a.date))};if(c)return e.jsx(k,{});if(j)return e.jsx(A,{});const b=g(o,s);return e.jsxs(r,{children:[" ",e.jsx(r,{bg:"primary.main",p:4,py:{base:"4",md:"10"},children:e.jsx(r,{className:"container",children:e.jsx(n,{fontFamily:"Quicksand, sans-serif",fontSize:{base:24,md:32},fontWeight:700,textAlign:"center",mt:0,color:"#fff",children:"Appointments"})})})," ",e.jsx("div",{className:"container",children:e.jsx(d,{justify:"center",children:e.jsxs(r,{maxW:"100vw",w:"700px",minH:"80vh",px:2,children:[o.length?e.jsxs(d,{gap:5,mt:5,flexDir:{base:"column",md:"row"},children:[e.jsx(r,{overflowX:"scroll",w:{base:"100%",md:"30%"},border:"1px solid",borderColor:"gray.200",borderRadius:4,bg:"#FFF",h:"fit-content",sx:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none"},children:e.jsx(r,{w:{base:"fit-content",md:"100%"},p:4,bg:"#fff",h:"fit-content",display:{base:"flex",md:"block"},justifyContent:{base:"space-between"},gap:{base:5},children:K.map(t=>e.jsxs(d,{align:"center",gap:2,mb:3,cursor:"pointer",onClick:()=>{l(t.step)},transition:"0.3s ease",flexDir:{base:"column",md:"row"},children:[e.jsx(r,{p:2,border:"1px solid",borderColor:s===t.step?"primary.text":"gray.200",borderRadius:4,fontSize:18,color:s===t.step?"#fff":"gray.600",bg:s===t.step?"primary.text":"transparent",transition:"0.3s ease",children:t.icon}),e.jsx(n,{fontSize:14,fontWeight:s===t.step?"700":"600",color:s===t.step?"primary.text":"gray.600",transition:"0.3s ease",children:t.Name})]},t.Name))})}),e.jsx(f,{spacing:1,flex:2,children:e.jsx(v.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},style:{minWidth:"100%"},children:b.map(t=>e.jsx(U,{appointment:t},t.id))},s)})]}):e.jsxs(r,{mt:5,children:[e.jsxs(D,{status:"error",children:[e.jsx(F,{}),e.jsx(N,{children:"Appointments Not Found!"})]}),e.jsx(h,{mt:5,colorScheme:"blue",w:"100%",size:"sm",leftIcon:e.jsx(z,{}),as:W,to:"/book-appointment",children:"Make Appointment"})]})," "]})})})]})};export{Z as default};