1import{_ as vt}from"./Cz-f0fHP.js";import gt from"./9_wLNDwv.js";import ht from"./B9V2gHXc.js";import it from"./ChEQ7gDa.js";import{j as N,f as et,k as y,y as lt,B as $,H as ct,l as rt,O as yt,o as n,v as O,w as ot,c as l,m as Z,a as t,C as xt,b as k,n as e,s as pt,t as x,F as W,r as tt,I as dt,q as R,S as bt,p as wt,e as St,_ as Ct,g as kt,d as F,u as At,P as Dt,K as $t,N as Pt}from"./C7Sj1lDM.js";import{a as It,f as st}from"./CUJSzP4y.js";import{u as P,a as K}from"./rEPpWb1a.js";import{u as ut}from"./D40jfCPr.js";import{u as mt}from"./DE2atnCO.js";import"./DvP36zQl.js";import{u as nt}from"./Ey8N0aj2.js";import{f as Tt,r as Rt,h as Mt}from"./Dq4B99Cl.js";import"./BaHpk6b5.js";import"./Dx5M1Wb0.js";import"./CbfgUM0u.js";import{p as Bt}from"./DVsKGQAT.js";import{u as Lt}from"./B9yVn_5Q.js";import{_ as Et}from"./BkhNUBYQ.js";import{_ as Nt}from"./BAhaaeuT.js";import{_ as Vt}from"./BCFlSnkT.js";import jt from"./Xb40pWa3.js";import{d as zt}from"./C0glgldZ.js";import{_ as Ut}from"./BIkOdQlM.js";import{u as Wt}from"./D_U6Pzlo.js";import{a as U}from"./B1Kf2XAv.js";import"./CHiaU2li.js";import"./BPYzwKfX.js";import"./BEVyzBnq.js";import"./BuY_DmmP.js";import"./CaqjC_Yo.js";import"./DezqB40z.js";import"./CIcnSpLG.js";import"./DWTX1NrE.js";import"./D5GcujnY.js";import"./DW1eZEJX.js";import"./CyqyKP3X.js";import"./BwCY_19y.js";import"./tcbAcolK.js";import"./BziXllrq.js";import"./6wJkXcvO.js";import"./BoWSGm6D.js";import"./noiN9owZ.js";import"./D1TSqnZr.js";function ft(){const r=N(),{data:v,error:a,loading:m,action:p}=nt(async d=>Tt(d),{autoExecute:!1,onSuccess:d=>{ut().setAllDoctorAppointments(d.data)},onError:d=>{P(d,r)}});return{data:v,error:a,loading:m,action:p}}function qt(){const r=N(),v=K(),{data:a,error:m,loading:p,action:d}=nt(async(c,u,o)=>Rt(c,u,o),{autoExecute:!1,onSuccess:c=>{v.success(r,c.data.message)},onError:c=>{P(c,r)}});return{data:a,error:m,loading:p,action:d}}function Yt(){const r=N(),v=K(),{data:a,error:m,loading:p,action:d}=nt(async c=>Mt(c),{autoExecute:!1,onSuccess:c=>{v.success(r,c.data.message)},onError:c=>{P(c,r)}});return{data:a,error:m,loading:p,action:d}}const at=r=>(wt("data-v-e3752d6b"),r=r(),St(),r),Ft={class:"w-full px-3 lg:px-10 py-5"},Ot=at(()=>t("div",null,"Reschedule Appointment",-1)),Kt=at(()=>t("label",{for:"date",class:"text-sm block mb-1 text-surface-300"}," Date ",-1)),Gt=at(()=>t("span",{class:"text-2xs text-surface-300"},"MM/DD/YYYY",-1)),Ht={key:0,class:"w-full mt-3 lg:mt-5"},Jt={class:"w-full flex flex-wrap gap-3 mt-1"},Qt=["onClick"],Xt={key:1,class:"w-full mt-3 lg:mt-5"},Zt={key:0},te={key:0},ee={key:1},oe=et({__name:"RescheduleModal",props:{visible:{type:Boolean,required:!0},appointmentId:{type:Number,required:!0},timeSlot:{type:Array,required:!0},doctorAvailability:{type:Array,required:!0}},emits:["update:visible"],setup(r,{emit:v}){const a=r,m=ft(),p=mt(),d=qt(),c=K(),u=y(null),o=y(null),b=N(),I=new Date;let M=I.getMonth(),w=I.getFullYear(),q=M===11?0:M+1,Y=q===0?w+1:w;const B=y(new Date);B.value.setMonth(q-1),B.value.setFullYear(Y+1);const T=y(a.doctorAvailability),L=lt(),G=$(()=>L.user),H=$(()=>{const i=T.value.map(S=>S.day),_=new Date,D=[];for(let S=0;S<365;S++){const E=new Date(_.getTime()+S*864e5),g=E.toLocaleString("en-US",{weekday:"long"});i.includes(g)||D.push(E)}return D}),J=i=>{o.value=i};async function C(){if(u.value==null||o.value==null){c.error(b,"Please select a valid date and time!");return}const i=st(u.value);try{await d.action(a.appointmentId,i,o.value),m.action({status:"pending"}),A()}catch(_){P(_,b)}}function Q(i){i.preventDefault(),C()}const V=$(()=>{if(u.value){const i={weekday:"long"};return u.value.toLocaleDateString("en-US",i)}return""}),X=async()=>{u.value&&await s(st(u.value));const i=a.timeSlot.find(_=>_.day.toLowerCase()===V.value.toLowerCase());j.value=i?i.availableTimeSlots:[]},j=y([]);async function s(i){var _;try{return p.action((_=G.value)==null?void 0:_.uuid,i)}catch(D){P(D,b)}}const f=v,A=()=>{f("update:visible",!1)};return ct(()=>a.visible,i=>{i?document.body.classList.add("no-scroll"):document.body.classList.remove("no-scroll")}),rt(async()=>{a.visible&&document.body.classList.add("no-scroll")}),yt(()=>{document.body.classList.remove("no-scroll")}),(i,_)=>{const D=gt,S=ht,E=it;return n(),O(bt,{name:"fade"},{default:ot(()=>[r.visible?(n(),l("div",{key:0,class:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50",onClick:Z(A,["self"])},[t("div",{class:"bg-white rounded shadow-lg max-w-4xl w-full m-3",onClick:_[1]||(_[1]=Z(()=>{},["stop"]))},[t("div",Ft,[Ot,t("form",{class:"pt-5",onSubmit:Z(C,["prevent"]),onKeydown:xt(Q,["enter"])},[t("div",null,[Kt,k(D,{modelValue:e(u),"onUpdate:modelValue":[_[0]||(_[0]=g=>pt(u)?u.value=g:null),X],manualInput:!1,inputId:"date",inline:"",minDate:e(I),maxDate:e(B),"disabled-dates":e(H)},null,8,["modelValue","minDate","maxDate","disabled-dates"]),Gt]),e(j).length>0?(n(),l("div",Ht,[t("h3",null," Doctor's Available Time on "+x(e(It)(e(u)))+": ",1),t("div",Jt,[(n(!0),l(W,null,tt(e(j),g=>(n(),l("button",{type:"button",onClick:h=>J(g),class:dt(["bg-primary-500 hover:bg-primary-900 px-3 py-2 rounded-md text-white",`${e(o)===g?"bg-primary-800":""}`]),key:g},x(g),11,Qt))),128))])])):(n(),l("div",Xt,[e(V)?(n(),l("div",Zt,[e(p).loading.value===!1?(n(),l("div",te,[t("p",null,"No available time slots for "+x(e(V)),1)])):(n(),l("div",ee,[k(S,{mode:"indeterminate",class:"h-1"})]))])):R("",!0)])),e(o)?(n(),O(E,{key:2,label:"Book Consultation",class:"w-full !rou
1nded-[30px] mt-[34px] h-[44px] lg:h-[48px]",loading:e(d).loading.value,disabled:!e(o),onClick:C},null,8,["loading","disabled"])):R("",!0)],32)])])])):R("",!0)]),_:1})}}}),ne=Ct(oe,[["__scopeId","data-v-e3752d6b"]]),ae={class:"w-full doc-dash-shadow px-4 py-4 rounded flex flex-col gap-y-3 justify-between"},se={class:"flex flex-col lg:flex-row gap-x-3"},ie={class:"flex flex-col gap-y-2 text-sm"},le={class:"flex items-center gap-x-2"},ce={class:"w-10 h-10 min-w-10 min-h-10 overflow-hidden border shadow-lg rounded-full"},re=["src"],pe={class:"text-lg lg:text-xl capitalize"},de={class:"lg:pl-12 flex flex-col gap-y-2"},ue=t("span",{class:"text-surface-900"},"Appointment Date:",-1),me=t("span",{class:"text-surface-900"},"Time:",-1),fe={key:0},_e=t("span",{class:"text-surface-900"},"Sex:",-1),ve={class:"flex flex-wrap gap-y-2 gap-x-4 justify-center text-sm lg:text-base"},ge=et({__name:"doctor-card",props:{appointment:{},doctorAvailability:{},timeSlot:{}},emits:["appointmentId"],setup(r,{emit:v}){Lt();const a=r;N();const m=kt(),p=y(!1),d=()=>{m.push(`/doctor/chats/${a.appointment.appointmentId}/${a.appointment.chat.chatUuid}/${a.appointment.patient.uuid}`)},c=v;y("");function u(){c("appointmentId",a.appointment.appointmentId)}return(o,b)=>{const I=vt,M=ne;return n(),l(W,null,[t("div",ae,[t("div",se,[t("div",ie,[t("div",le,[t("div",ce,[t("img",{src:e(Bt),class:"h-full w-full"},null,8,re)]),t("div",pe,[k(I,{class:"hover:text-primary-500",to:`/doctor/consultations/user/${o.appointment.patient.uuid}`},{default:ot(()=>[F(x(o.appointment.patient.fullName),1)]),_:1},8,["to"])])]),t("div",de,[t("div",null,[ue,F(" "+x(o.appointment.date),1)]),t("div",null,[me,F(" "+x(o.appointment.time),1)]),o.appointment.patient.gender?(n(),l("div",fe,[_e,F(" "+x(o.appointment.patient.gender),1)])):R("",!0)])])]),t("div",ve,[t("button",{onClick:d,class:"bg-primary-600 px-4 lg:px-6 py-2 text-primary-500 rounded-[30px]"}," Check Appointment "),o.appointment.status=="pending"?(n(),l("button",{key:0,onClick:b[0]||(b[0]=w=>p.value=!0),class:"bg-primary-600 px-4 lg:px-6 py-2 text-primary-500 rounded-[30px]"}," Reschedule ")):R("",!0),o.appointment.status=="pending"?(n(),l("button",{key:1,onClick:u,class:"border border-surface-900 px-4 lg:px-6 py-2 text-surface-900 rounded-[30px]"}," Cancel ")):R("",!0)])]),k(M,{visible:e(p),"appointment-id":o.appointment.appointmentId,"doctor-availability":o.doctorAvailability,"time-slot":o.timeSlot,"onUpdate:visible":b[1]||(b[1]=w=>p.value=w)},null,8,["visible","appointment-id","doctor-availability","time-slot"])],64)}}}),he={class:"w-full h-auto min-h-screen px-[26px] py-12"},ye={class:"w-full flex flex-col md:flex-row justify-between mb-5 gap-y-2 md:gap-y-0"},xe=t("div",{class:"text-2xl"},"Consultations",-1),be={class:"dash-shadow rounded-lg flex px-3 items-center"},we=t("img",{class:"w-5 h-5",src:Ut},null,-1),Se={class:"flex gap-x-2"},Ce={class:"circle-badge"},ke=t("div",null,"Appointments",-1),Ae={class:"w-full flex flex-col sm:flex-row gap-y-5 text-sm justify-around border-b border-v-slate text-center text-surface-300 mt-3"},De=["onClick"],$e={class:"flex flex-col gap-y-6 min-h-[70vh] lg:min-h-[80vh] justify-between"},Pe={key:0},Ie={class:"grid grid-cols-1 md:grid-cols-2 mt-6 gap-6"},Te={key:1},Re={key:0,class:"text-center mt-5"},Me={key:1,class:"text-center mt-5"},Be={class:"flex flex-col items-center p-4 lg:p-8 bg-surface-0 dark:bg-surface-900 rounded"},Le=t("div",{class:"rounded-full bg-primary text-primary-contrast inline-flex justify-center items-center h-24 w-24"},[t("i",{class:"pi pi-question text-5xl"})],-1),Ee={class:"font-bold text-2xl block mb-2 lg:mt-6 text-center"},Ne={class:"mb-0"},Ve={class:"flex items-center gap-2 mt-6"},Po=et({__name:"index",setup(r){At({title:"MySmartMedic - Doctor Consultations",meta:[{name:"",content:""}]});const v=ut(),a=$(()=>v.allDoctorAppointments),m=$(()=>v.allDoctorAppointmentsPagination),p=ft(),d=lt(),c=Wt();mt();const u=$(()=>d.user),o=Dt(),b=$(()=>v.virtualDoctor),I=$(()=>v.doctorAvailability),M=K(),w=N(),q=Yt(),Y=y(""),B=y(0),T=y(""),L=y(""),G=[{label:"Pending Appointments",value:"pending"},{label:"Ongoing Appointments",value:"ongoing"},{label:"Completed Appointments",value:"completed"},{label:"Canceled Appointments",value:"cancelled"},{label:"Others",value:"no_show"}],H=()=>{o.require({group:"headless",header:"Are you sure you want to cancel this appointment?",message:"This action cannot be undone.",accept:()=>{q.action(Y.value)},reject:()=>{o.close(),M.info(w,"Appointment not cancelled!")}})},J=s=>{Y.value=s,H()};async function C(s){try{await p.action(s||{page:1,per_page:U.perPageSize}),m.value!==null&&(B.value=m.value.currentPage)}catch(f){P(f,w)}}const Q=async s=>{const f={status:L.value,page:s,per_page:U.perPageSize};await C(f)},V=async s=>{if(!s){await C();return}const f={page:1,per_page:U.perPageSize,search:s};try{await C(f)}catch(A){P(A,w)}},X=zt(s=>{V(s)},500);ct(T,s=>{X(s)});const j=async s=>{L.value=s;const f={page:1,per_page:U.perPageSize,search:T.value,status:s};try{await C(f)}catch(A){P(A,w)}};return rt(async()=>{var f;L.value="pending";const s={page:1,per_page:U.perPageSize,status:"pending"};C(s),c.action((f=u.value)==null?void 0:f.uuid)}),(s,f)=>{var g;const A=ge,i=Et,_=Nt,D=Vt,S=it,E=jt;return n(),l(W,null,[t("div",he,[t("div",ye,[xe,t("div",be,[we,$t(t("input",{type:"text","onUpdate:modelValue":f[0]||(f[0]=h=>pt(T)?T.value=h:null),class:"w-full lg:w-[500px] h-[48px] pl-1 outline-none",placeholder:"Search Consultations"},null,512),[[Pt,e(T)]])])]),t("div",Se,[t("div",Ce,x(e(a).length),1),ke]),t("div",Ae,[(n(),l(W,null,tt(G,h=>t("button",{class:dt([e(L)===h.value?"border-w-slate text-primary-500":"","border-b h-full py-2 w-full"]),onClick:z=>j(h.value)},x(h.label),11,De)),64))]),t("div",$e,[e(a)&&e(a).length>0&&e(p).loading.value===!1?(n(),l("div",Pe,[t("div",Ie,[(n(!0),l(W,null,tt(e(a),h=>{var z;return n(),O(A,{"doctor-availability":((z=e(b))==null?void 0:z.availability)??[],"time-slot":e(I),appointment:h,onAppointmentId:J},null,8,["doctor-availability","time-slot","appointment"])}),256))])])):(n(),l("div",Te,[e(p).loading.value?(n(),l("div",Re,[k(i)])):(n(),l("div",Me,[k(_,{showTitle:!0,title:"No Appointment found!"})]))])),e(m)&&((g=e(m))==null?void 0:g.total)>0?(n(),O(D,{key:2,paginator:e(m),"current-page":e(B),"onUpdate:page":Q},null,8,["paginator","current-page"])):R("",!0)])]),k(E,{group:"headless",class:"w-full mx-3 lg:w-[35rem]"},{container:ot(({message:h,acceptCallback:z,rejectCallback:_t})=>[t("div",Be,[Le,t("span",Ee,x(h.header),1),t("p",Ne,x(h.message),1),t("div",Ve,[k(S,{label:"Save",onClick:z},null,8,["onClick"]),k(S,{label:"Cancel",outlined:"",onClick:_t},null,8,["onClick"])])])]),_:1})],64)}}});
1export{Po as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.