| Current Path : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/ |
| Current File : /home/users/unlimited/www/web.medimeet.codeskitter.site/assets/AppointmentDetails-BvAQN1W6.js |
import{a1 as Dr,aw as Gr,r as m,j as e,ad as br,ai as qe,aF as Sr,ah as le,ax as Hr,ay as Lr,az as Zr,aR as vr,aA as _r,aB as wr,ao as Je,ap as er,R as U,aS as Cr,l as v,av as Rr,a7 as Or,a5 as Vr,p as Mr,a4 as Qr,a6 as rr,d as H,O as Ar,B as x,T as f,F as $,a2 as Xr,i as Be,U as Jr,aT as et,aU as rt,P as tr,Q as nr,aV as sr,aW as ir,V as or,W as ar,a8 as tt,a9 as nt,ak as Pe,Y as st,aX as it,aC as J,aY as ot,aZ as at,n as ct,e as oe,a_ as lt,a$ as dt,f as Z}from"./index-DjKxDI5z.js";import{g as ut}from"./StatusBadge-CxKdYbIz.js";import{R as ft}from"./RatingStars-0jzraH7h.js";import{T as ht}from"./textarea-BkR2wR26.js";import{G as mt}from"./index-gQxugxPn.js";import{B as cr}from"./badge-C3s3jsxC.js";import{I as lr}from"./input-element-CWSNfoFK.js";import{C as gt,a as xt}from"./card-body-CtBNYAnn.js";const dr=Dr({displayName:"CalendarIcon",viewBox:"0 0 14 14",d:"M10.8889,5.5 L3.11111,5.5 L3.11111,7.05556 L10.8889,7.05556 L10.8889,5.5 Z M12.4444,1.05556 L11.6667,1.05556 L11.6667,0 L10.1111,0 L10.1111,1.05556 L3.88889,1.05556 L3.88889,0 L2.33333,0 L2.33333,1.05556 L1.55556,1.05556 C0.692222,1.05556 0.00777777,1.75556 0.00777777,2.61111 L0,12.5 C0,13.3556 0.692222,14 1.55556,14 L12.4444,14 C13.3,14 14,13.3556 14,12.5 L14,2.61111 C14,1.75556 13.3,1.05556 12.4444,1.05556 Z M12.4444,12.5 L1.55556,12.5 L1.55556,3.94444 L12.4444,3.94444 L12.4444,12.5 Z M8.55556,8.61111 L3.11111,8.61111 L3.11111,10.1667 L8.55556,10.1667 L8.55556,8.61111 Z"});function yt(t){return Gr({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M17.011 9.385v5.128l3.989 3.487v-12z"},child:[]},{tag:"path",attr:{d:"M3.887 6h10.08c1.468 0 3.033 1.203 3.033 2.803v8.196a.991 .991 0 0 1 -.975 1h-10.373c-1.667 0 -2.652 -1.5 -2.652 -3l.01 -8a.882 .882 0 0 1 .208 -.71a.841 .841 0 0 1 .67 -.287z"},child:[]}]})(t)}const ur=t=>{const s=window.open(t,"_blank");s&&(s.focus(),s.onload=()=>{s.load(),s.onafterprint=()=>{s.close()}})},ge=t=>{},Fe=typeof window>"u"?m.useEffect:m.useLayoutEffect,Ir=t=>typeof t=="number"&&t>0,fr=t=>Ir(t)?t:0,ze=t=>Math.round(100*t)/100,We=t=>Math.round(2*t)/2,hr=t=>t===0?0:-1*ze(t),jt={},pt="rr--group",bt="rr--box",St="rr--svg",Lt="rr--reset",mr="rr--focus-reset",vt="rr--svg-stop-1",_t="rr--svg-stop-2",gr="rr--on",xr="rr--off",ce={ZOOM:"rr--fx-zoom",POSITION:"rr--fx-position",OPACITY:"rr--fx-opacity",COLORS:"rr--fx-colors"},xe={SMALL:"rr--rx-sm",MEDIUM:"rr--rx-md",LARGE:"rr--rx-lg",FULL:"rr--rx-full"},Ae={SMALL:"rr--gap-sm",MEDIUM:"rr--gap-md",LARGE:"rr--gap-lg"},Ie={SMALL:"rr--space-sm",MEDIUM:"rr--space-md",LARGE:"rr--space-lg"},wt="rr--pointer",Ct="rr--disabled",Rt="rr--dir-y",Ot="rr--dir-x",Mt="rr--has-stroke",At="rr--has-border",It="rr--hf-box-on",Et="rr--hf-box-int",kt="rr--hf-box-off",$t="rr--hf-svg-on",Bt="rr--hf-svg-off",ye={FILL:"--rr--fill-on-color",BOX:"--rr--box-on-color",BORDER:"--rr--border-on-color",STROKE:"--rr--stroke-on-color"},je={FILL:"--rr--fill-off-color",BOX:"--rr--box-off-color",BORDER:"--rr--border-off-color",STROKE:"--rr--stroke-off-color"},Ft="--rr--border-width",Er="horizontal",kr="vertical",Ee="svg",yr="box",A={NONE:"none",SMALL:"small",MEDIUM:"medium",LARGE:"large",FULL:"full"},ee={NONE:"none",ZOOM:"zoom",POSITION:"position",OPACITY:"opacity",COLORS:"colors"},Y={FILL:"activeFillColor",BOX:"activeBoxColor",BORDER:"activeBoxBorderColor",STROKE:"activeStrokeColor"},pe={FILL:"inactiveFillColor",BOX:"inactiveBoxColor",BORDER:"inactiveBoxBorderColor",STROKE:"inactiveStrokeColor"};function zt({itemShapes:t,testId:s,itemStrokeWidth:n=0,orientation:a=Er,hasHF:c=!1}){const l=n>0?-n/2:0,S=n>0?`${l} ${l}`:"0 0",y=m.useId(),j=m.useRef(null),[g,C]=m.useState(null),[b,R]=m.useState(!1),W=m.useRef(null),B=m.useRef(null),F=m.useCallback(h=>{const{width:I,height:L,x:q,y:r}=h.getBBox();if(((...O)=>O.every(w=>typeof w=="number"))(I,L,q,r)){const O=`${S} ${ze(I+n)} ${ze(L+n)}`,w=`${hr(q)} ${hr(r)}`;C({viewBox:O,translateData:w})}},[n,S]);return Fe(()=>{if(j.current){const{width:h,height:I,x:L,y:q}=j.current.getBBox();if(h===0&&I===0&&L===0&&q===0){const r=function(O){if(!O||!O.parentElement)return null;let w=O==null?void 0:O.parentElement;for(;w&&window.getComputedStyle(w).display!=="none";)w=w.parentElement;return w}(j.current);r&&(B.current=r,R(!0))}else R(!1);F(j.current)}},[t,n,c]),Fe(()=>{if(b&&B.current)return W.current=new MutationObserver((h,I)=>{h.forEach(()=>{window.getComputedStyle(B.current).display==="none"||(F(j.current),I.disconnect())})}),W.current.observe(B.current,{attributes:!0}),()=>{var h;(h=W.current)==null||h.disconnect()}},[b,F]),e.jsxs("svg",{"aria-hidden":"true",className:St,xmlns:"http://www.w3.org/2000/svg",viewBox:g?g.viewBox:"0 0 0 0",preserveAspectRatio:"xMidYMid meet",...n>0?{strokeWidth:n}:{},...s,children:[c&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:y,...a===kr?{gradientTransform:"rotate(90)"}:{},children:[e.jsx("stop",{className:vt,offset:"50%"}),e.jsx("stop",{className:_t,offset:"50%"})]})}),e.jsx("g",{ref:j,shapeRendering:"geometricPrecision",...function(){if(g){const h=`translate(${g==null?void 0:g.translateData})`;return h==="translate(0 0)"?{}:{transform:h}}return{transform:void 0}}(),...c?{fill:`url('#${y}')`}:{},children:t})]})}function $r(t,s,n){switch(s){case Y.FILL:return t[ye.FILL]=n,!0;case Y.BOX:return t[ye.BOX]=n,!0;case Y.BORDER:return t[ye.BORDER]=n,!0;case Y.STROKE:return t[ye.STROKE]=n,!0}return!1}function Wt(t,s,n){if(!$r(t,s,n))switch(s){case pe.FILL:t[je.FILL]=n;break;case pe.BOX:t[je.BOX]=n;break;case pe.BORDER:t[je.BORDER]=n;break;case pe.STROKE:t[je.STROKE]=n}}function qt(t,s,n){const a={};let c;for(const[l,S]of Object.entries(t))$r(a,l,S[s]);return n?(c=Array(s).fill({}),c.push(a)):c=Array(s+1).fill(a),c}const ke=t=>`${t} ${ce.COLORS}`;function Pt({className:t,radius:s,readOnly:n,isDisabled:a,isDynamic:c,transition:l,orientation:S,absoluteBoxBorderWidth:y,absoluteStrokeWidth:j,spaceBetween:g,spaceInside:C}){const b=c?wt:"",R=function(L){switch(L){case A.SMALL:return Ae.SMALL;case A.MEDIUM:return Ae.MEDIUM;case A.LARGE:return Ae.LARGE;default:return""}}(g),W=function(L){switch(L){case A.SMALL:return Ie.SMALL;case A.MEDIUM:return Ie.MEDIUM;case A.LARGE:return Ie.LARGE;default:return""}}(C),B=!n&&a?Ct:"",F=c&&l!==ee.NONE?function(L){switch(L){case ee.ZOOM:return ke(ce.ZOOM);case ee.POSITION:return ke(ce.POSITION);case ee.OPACITY:return ke(ce.OPACITY);case ee.COLORS:return ce.COLORS;default:return""}}(l):"",h=S===kr?Rt:Ot,I=function(L){switch(L){case A.SMALL:return xe.SMALL;case A.MEDIUM:return xe.MEDIUM;case A.LARGE:return xe.LARGE;case A.FULL:return xe.FULL;default:return""}}(s);return`${pt} ${h} ${j>0?Mt:""} ${y>0?At:""}
${F} ${I} ${b} ${B} ${R}
${W} ${t}`.replace(/ +/g," ").trimEnd()}function Nt(t,s,n){return Array.from({length:s},(a,c)=>t?c===n?gr:xr:c<=n?gr:xr)}function Tt(t,s,n){const a=Math.floor(We(t));return Array.from({length:s},(c,l)=>n==="box"?l>a?kt:l===a?Et:It:l>a?Bt:$t)}function jr(t,s){const n={};Ir(s)&&(n[Ft]=`${s}px`);const a=Object.entries(t);if(a.length>0)for(const[c,l]of a)Wt(n,c,l);return n}const Ut=[Y.FILL,Y.BOX,Y.STROKE,Y.BORDER];function $e(t,s,n=!1){return Array.from({length:t},(a,c)=>n&&s<0?c===t-1?0:-1:s<=0?c===0?0:-1:s>0?c===s?0:-1:void 0)}const Yt="@smastrom/react-rating",Kt=t=>`[${Yt}] - Nothing's returned from rendering. Reason: ${t}.`;function ae(t,s){return t.shouldRender=!1,t.reason=Kt(s),t}const pr="itemShapes is not a valid JSX element",Dt=e.jsx("polygon",{points:"25 9.02 16.4 7.75 12.46 0 8.59 7.79 0 9.14 6.21 15.23 4.85 23.81 12.55 19.79 20.3 23.74 18.85 15.17 25 9.02"});e.jsx("path",{d:"M12.5,18.16l-7.73,5.61,2.95-9.08L0,9.07H9.55S12.5,0,12.5,0l2.95,9.07h9.55l-7.73,5.62,2.95,9.08-7.73-5.61Z"});e.jsx("path",{d:"M112.46,57.88c-.23-.72-.88-1.22-1.63-1.27l-6.63-.46-2.45-6.19c-.27-.7-.95-1.16-1.7-1.16h0c-.75,0-1.42,.46-1.7,1.16l-2.5,6.23-6.58,.42c-.75,.05-1.4,.55-1.63,1.27-.24,.73,0,1.53,.58,2.02l5.07,4.28-1.51,5.92c-.21,.82,.1,1.69,.78,2.19,.66,.48,1.55,.5,2.24,.07l5.23-3.31h.02l5.63,3.56c.29,.19,.63,.29,.97,.29,1.02,0,1.83-.84,1.83-1.86,0-.16-.02-.31-.06-.47l-1.6-6.48,5.04-4.2c.59-.49,.82-1.29,.58-2.02Z"});e.jsx("path",{d:"M22.72,8.24h-6.68L13.97,1.88c-.81-2.51-2.13-2.51-2.95,0l-2.07,6.36H2.28c-2.63,0-3.04,1.25-.91,2.8l5.41,3.93-2.06,6.36c-.81,2.51,.25,3.28,2.39,1.73l5.41-3.93,5.41,3.93c2.13,1.55,3.2,.77,2.39-1.73l-2.07-6.36,5.41-3.93c2.13-1.55,1.72-2.8-.91-2.8Z"});e.jsx("path",{d:"M11.58,.77c.51-1.02,1.33-1.02,1.84,0l2.34,4.73c.5,1.02,1.84,2,2.98,2.16l5.22,.76c1.13,.17,1.39,.95,.57,1.75l-3.78,3.68c-.82,.8-1.33,2.37-1.14,3.5l.89,5.2c.19,1.13-.48,1.61-1.49,1.08l-4.67-2.45c-1.01-.53-2.67-.53-3.68,0l-4.67,2.46c-1.01,.53-1.68,.05-1.49-1.08l.89-5.2c.19-1.13-.32-2.7-1.14-3.5L.48,10.17c-.82-.8-.56-1.58,.57-1.75l5.22-.76c1.13-.16,2.47-1.14,2.98-2.16L11.58,.77h0Z"});e.jsx("path",{d:"M19.29,1.61c-2.15-2.15-5.63-2.15-7.78,0,0,0,0,0,0,0l-1.06,1.06-1.06-1.06C7.24-.54,3.76-.54,1.61,1.61-.54,3.76-.54,7.24,1.61,9.39l1.06,1.06,7.78,7.78,7.78-7.78,1.06-1.06c2.15-2.15,2.15-5.63,0-7.78,0,0,0,0,0,0Z"});const Gt={itemShapes:Dt,itemStrokeWidth:2,activeFillColor:"#ffb23f",inactiveFillColor:"#fff7ed",activeStrokeColor:"#e17b21",inactiveStrokeColor:"#eda76a"},Br=m.forwardRef(({value:t,items:s=5,readOnly:n=!1,onChange:a=ge,onHoverChange:c=ge,onFocus:l=ge,onBlur:S=ge,preventDefault:y="all",isDisabled:j=!1,highlightOnlySelected:g=!1,orientation:C=Er,spaceBetween:b=A.NONE,spaceInside:R=A.SMALL,radius:W=A.NONE,transition:B=ee.COLORS,itemStyles:F=Gt,isRequired:h=!1,halfFillMode:I=Ee,visibleLabelId:L,visibleItemLabelIds:q,invisibleItemLabels:r,invisibleLabel:O=n?t>0?`Rated ${t} on ${s}`:"Not rated":"Rating Selection",resetLabel:w="Reset rating",id:be,className:re,style:Se},K)=>{const E=Array.from({length:s},(i,o)=>o+1),V=n&&!Number.isInteger(t),de=V&&!g,k=V&&g?Math.round(t):t,M=!n&&!j,Q=k>=.25,Le=typeof re=="string"?re:"",te=I===yr?yr:Ee,X=de&&!(i=>Number.isInteger(We(i)))(k),d=!h&&!n,N=h?s:s+1,P=de?function(i,o){const u=We(o);return Number.isInteger(u)?i.indexOf(u):Math.floor(u)}(E,k):E.indexOf(k),{staticColors:ve,arrayColors:_e,itemShapes:ue,absoluteStrokeWidth:Ne,absoluteBoxBorderWidth:fe}=m.useMemo(()=>{const{itemShapes:i,itemStrokeWidth:o,boxBorderWidth:u,...p}=F,_=function(z){const D={...z},he={},me=Object.entries(D);if(me.length>0)for(const[T,G]of me)if(Array.isArray(G)||typeof G=="string"){if(Array.isArray(G))for(const Yr of Ut)if(Yr===T){const Xe=G.filter(Kr=>typeof Kr=="string");Xe.length>0&&(he[T]=Xe,delete D[T])}else delete D[T]}else delete D[T];return{arrayColors:he,staticColors:D}}(p);return{itemShapes:i,absoluteStrokeWidth:fr(o),absoluteBoxBorderWidth:fr(u),..._}},[F]),Te=Object.keys(_e).length>0,ne=m.useCallback((i,o)=>({dynamicClassNames:X?Tt(k,s,te):Nt(g,s,i),dynamicCssVars:o&&Te?qt(_e,i,g):[]}),[_e,Te,g,te,X,s,k]),we=m.useCallback(()=>Ke($e(N,P,!h)),[P,N,h]),Ue=m.useRef(!0),Ye=m.useRef(!0),Ce=m.useRef(null),se=m.useRef([]),Re=m.useRef(!1),[ie,Oe]=m.useState({staticCssVars:jr(ve,fe),...ne(P,Q)}),[Fr,Ke]=m.useState(()=>M?$e(N,P,!h):[]);Fe(()=>{M&&se.current&&(Re.current=function(i){return i?getComputedStyle(i).getPropertyValue("direction")==="rtl":!1}(se.current[0]))},[M]),m.useEffect(()=>{if(!Ue.current)return Oe({staticCssVars:jr(ve,fe),...ne(P,Q)});Ue.current=!1},[ve,ne,fe,P,Q]),m.useEffect(()=>{if(!Ye.current&&M)return we();Ye.current=!1},[M,we]);const{shouldRender:zr,reason:Wr}=function({items:i,itemShapes:o}){const u={shouldRender:!0,reason:""};if(typeof i!="number"||i<1||i>10)return ae(u,"items is invalid");if(!o)return ae(u,"itemStyles needs at least the property itemShapes set");if(!Array.isArray(o)&&!m.isValidElement(o))return ae(u,pr);if(Array.isArray(o)){if(o.length!==i)return ae(u,"itemShapes length mismatch");if(!o.every(p=>m.isValidElement(p)))return ae(u,pr)}return u}({items:s,itemShapes:ue});if(!zr)return console.error(Wr),null;function Me(i,o,u=()=>{}){se.current.some(p=>p===i.relatedTarget)?u():o()}function De(){c(0),we()}function qr(i){Me(i,()=>{De()}),Oe({...ie,...ne(P,Q)})}function Ge(i){Me(i,()=>{De(),S()})}function He(i,o){const u=!h&&o===E.length?0:o+1;Me(i,()=>{l(),c(u)},()=>{c(u)})}function Ze(i){Ke($e(N,i,!h)),se.current[i].focus()}const Pr=Pt({className:Le,radius:W,readOnly:n,isDisabled:j,isDynamic:M,transition:B,orientation:C,absoluteBoxBorderWidth:fe,absoluteStrokeWidth:Ne,spaceBetween:b,spaceInside:R});function Ve(i){return{ref:o=>se.current[i]=o}}function Qe(i){return{tabIndex:Fr[i],onKeyDown:o=>function(u,p){let _=0;const z=h?E.length-1:E.length,D=p-1,he=p+1,me=!h&&p===E.length,T=p===0?z:D,G=z===p?0:he;switch(u.code){case"Shift":case"Tab":return!0;case"ArrowDown":case"ArrowRight":return _=Re.current?T:G,Ze(_);case"ArrowUp":case"ArrowLeft":return _=Re.current?G:T,Ze(_);case"Enter":case"Space":return y!=="all"&&y!=="click"||u.preventDefault(),a(me?0:p+1)}u.stopPropagation()}(o,i)}}function Nr(i){return{onClick:o=>function(u,p){y!=="all"&&y!=="keydown"||u.preventDefault(),u.stopPropagation(),a(h||P!==p?p+1:0)}(o,i),onMouseEnter:()=>function(o){c(o+1),Oe({...ie,...ne(o,!0)})}(i),onMouseLeave:qr}}function Tr(i){if(n)return{};const o={};if(Array.isArray(q))o["aria-labelledby"]=q[i];else{const u=Array.isArray(r)?r:E.map((p,_)=>`Rate ${_+1}`);o["aria-label"]=u[i]}return j&&(o["aria-disabled"]="true"),{role:"radio","aria-checked":i+1===k,...o}}function Ur(i){const o={itemShapes:Array.isArray(ue)?ue[i]:ue,itemStrokeWidth:Ne,orientation:C,hasHF:!1,testId:{}};return X&&te===Ee&&(o.hasHF=i===P),o}return e.jsx("div",{id:be,className:Pr,style:{...Se,...ie.staticCssVars},ref:function(i){M&&!h&&(Ce.current=i),K&&(K.current=i)},...function(){if(!n){const i=h&&!j,o={role:"radiogroup","aria-required":i};return i&&(o["aria-invalid"]=k<=0),typeof L=="string"&&L.length>0?o["aria-labelledby"]=L:o["aria-label"]=O,o}return{role:"img","aria-label":O}}(),...jt,children:E.map((i,o)=>{return e.jsxs(m.Fragment,{children:[e.jsx("div",{className:`${bt} ${ie.dynamicClassNames[o]}`,style:ie.dynamicCssVars[o],...Tr(o),...(p=o,M?{...Ve(p),...Qe(p),...Nr(p),onFocus:_=>He(_,p),onBlur:_=>Ge(_)}:{}),children:e.jsx(zt,{...Ur(o)})}),d&&o===E.length-1&&e.jsx("div",{...(u=o+1,{className:Lt,role:"radio","aria-label":w,"aria-checked":k===0,onClick:()=>a(0),onFocus:_=>{var z;He(_,u),(z=Ce.current)==null||z.classList.add(mr)},onBlur:_=>{var z;Ge(_),(z=Ce.current)==null||z.classList.remove(mr)},...Qe(u),...Ve(u),...j?{"aria-disabled":"true"}:{}})})]},i);var u,p})})});Br.displayName="Rating";const Ht=async t=>{const s=await Rr(Or.token,"add_doctor_review",t);if(s.response!==200)throw new Error(s.message);return s.data};function Zt({doctID:t,AppID:s,isOpen:n,onClose:a,patient_id:c}){const[l,S]=m.useState(5),[y,j]=m.useState(null),g=br(),C=qe(),b=Sr({mutationFn:async()=>{await Ht({doctor_id:t,points:l,description:y,user_id:c,appointment_id:s})},onSuccess:()=>{le(g,"success","Success"),C.invalidateQueries(["appointment",s]),C.invalidateQueries(["doctor",t]),C.invalidateQueries(["doctors"]),a()},onError:R=>{le(g,"error",R.message),a()}});return e.jsxs(Hr,{isOpen:n,onClose:a,isCentered:!0,size:"md",children:[e.jsx(Lr,{}),e.jsxs(Zr,{children:[e.jsx(vr,{bg:"primary.main",py:1,color:"#fff",fontSize:16,children:"Doctor Rating"}),e.jsx(_r,{top:"2px",color:"#fff"}),e.jsxs(wr,{children:[e.jsxs(Je,{mt:4,children:[e.jsx(er,{fontWeight:600,children:"Rating"}),e.jsx(Br,{style:{maxWidth:200},value:l,onChange:S})]}),e.jsxs(Je,{mt:4,children:[e.jsx(er,{fontWeight:600,children:"Notes"}),e.jsx(ht,{onChange:R=>{j(R.target.value)}})]})]}),e.jsx(U,{}),e.jsxs(Cr,{pb:2,pt:2,children:[e.jsx(v,{colorScheme:"gray",mr:3,onClick:a,size:"sm",children:"Close"}),e.jsx(v,{colorScheme:"blue",size:"sm",w:48,onClick:()=>{b.mutate()},isLoading:b.isPending,isDisabled:b.isPending,children:"Add"})]})]})]})}const Vt=t=>{const s=Pe(t);return{month:s.format("MMM"),date:s.format("DD"),year:s.format("YYYY")}};function Qt(t){const s=`${Be}/${t}`;window.open(s,"_blank")}const dn=()=>{const t=Vr(),s=qe(),{settingsData:n}=Mr(),a=n==null?void 0:n.find(d=>d.id_name==="clinic_location_latitude"),c=n==null?void 0:n.find(d=>d.id_name==="clinic_location_longitude"),{id:l}=Qr(),{isOpen:S,onOpen:y,onClose:j}=rr(),{isOpen:g,onOpen:C,onClose:b}=rr(),R=m.useRef(),W=async()=>(await Z(`get_appointment/${l}`)).data,B=async()=>(await Z(`get_appointment_cancel_req/appointment/${l}`)).data,F=async()=>(await Z(`get_invoice/appointment/${l}`)).data,h=async()=>(await Z(`get_prescription/appointment/${l}`)).data,I=async()=>(await Z(`get_appointment_check_in_doct_date/${r==null?void 0:r.doct_id}/${r==null?void 0:r.date}`)).data,L=async()=>(await Z(`get_patient_file/patient/${r==null?void 0:r.patient_id}`)).data,{isLoading:q,data:r}=H({queryKey:["appointment",l],queryFn:W}),{isLoading:O,data:w}=H({queryKey:["appointment-req-history",l],queryFn:B}),{isLoading:be,data:re}=H({queryKey:["invoice",l],queryFn:F}),{isLoading:Se,data:K}=H({queryKey:["prescription",l],queryFn:h}),{isFetching:E,data:V,refetch:de}=H({queryKey:["queue",r==null?void 0:r.doct_id,r==null?void 0:r.date],queryFn:I,enabled:!!r}),{isLoading:k,data:M}=H({queryKey:["patient-files",r==null?void 0:r.patient_id],queryFn:L,enabled:!!r}),{month:Q,date:Le,year:te}=Vt(r==null?void 0:r.date),X=V==null?void 0:V.findIndex(d=>(d==null?void 0:d.appointment_id)==l);return q||O||be||Se||E||k?e.jsx(Ar,{}):e.jsxs(x,{children:[" ",e.jsx(x,{bg:"primary.main",p:4,py:{base:"4",md:"10"},children:e.jsx(x,{className:"container",children:e.jsxs(f,{fontFamily:"Quicksand, sans-serif",fontSize:{base:24,md:32},fontWeight:700,textAlign:"center",mt:0,color:"#fff",children:["Appointment #",l]})})})," ",e.jsx(x,{className:"container",minH:"80vh",children:e.jsxs($,{justify:"center",children:[" ",e.jsxs(x,{p:[2,4,5],shadow:"lg",borderWidth:"1px",borderRadius:"lg",mx:"auto",bg:"white",mt:10,w:600,maxW:"100vw",children:[e.jsxs($,{alignItems:"center",mb:5,children:[e.jsx(Xr,{size:"xl",src:`${Be}/${r.doct_image}`}),e.jsxs(x,{ml:3,children:[e.jsxs(f,{fontSize:"lg",fontWeight:"bold",children:[r.doct_f_name," ",r.doct_l_name]}),e.jsx(f,{fontWeight:600,color:"gray.600",fontSize:["sm","sm"],children:r.doct_specialization}),e.jsx(f,{fontWeight:600,color:"gray.600",fontSize:["sm","sm"],children:r.dept_title}),e.jsxs(f,{fontWeight:600,color:"gray.600",fontSize:["xs","xs"],display:"flex",gap:2,alignItems:"center",children:[e.jsx(ft,{rating:r.average_rating})," (",r.number_of_reviews,")"]}),e.jsxs(f,{fontWeight:600,color:"gray.600",fontSize:["xs","xs"],display:"flex",align:"center",gap:2,mt:1,children:[e.jsx(Jr,{fontSize:12})," ",e.jsxs(f,{mt:"-2px",children:[r.total_appointment_done,"+ Happy Clients"]})]})]})]}),(r==null?void 0:r.status)==="Visited"||(r==null?void 0:r.status)==="Completed"?e.jsx(v,{colorScheme:"blue",variant:"solid",width:"100%",size:"xs",onClick:C,children:"Review Doctor"}):e.jsx(U,{}),r.type==="OPD"&&(r==null?void 0:r.status)==="Confirmed"?X>=0?e.jsx(v,{fontWeight:600,color:"#fff",mt:2,bg:"green.700",_hover:{bg:"green.700"},size:"sm",rightIcon:e.jsx(et,{fontSize:18}),onClick:()=>{s.invalidateQueries(["queue",r==null?void 0:r.doct_id,r==null?void 0:r.date]),de()},children:`Queue Number. - ${X+1}`}):e.jsx(v,{fontWeight:600,color:"#fff",mt:2,bg:"green.700",_hover:{bg:"green.700"},size:"sm",rightIcon:e.jsx(rt,{fontSize:18}),onClick:()=>{t(`/appointment-success/${l}`)},children:"Check-In"}):null,e.jsxs($,{align:"center",justify:"space-between",mt:5,children:[" ",e.jsxs(f,{fontWeight:"bold",color:"gray.600",children:["Appointment #",r.id]}),ut(r==null?void 0:r.status)]}),e.jsxs(x,{children:[" ",e.jsxs(f,{fontWeight:600,color:"gray.600",fontSize:"sm",children:["Patient : ",r.patient_f_name," ",r.patient_l_name]}),e.jsx(cr,{colorScheme:r.type==="Emergency"?"red":"green",fontSize:{base:"xs",md:"xs"},fontWeight:800,children:r.type})]}),e.jsx(U,{my:2}),e.jsx(x,{overflow:"hidden",p:5,children:e.jsxs($,{align:"center",justify:"space-between",gap:5,children:[e.jsxs(x,{flex:1,children:[" ",e.jsx(f,{children:"Date"}),e.jsxs(tr,{w:"100%",children:[e.jsx(lr,{pointerEvents:"none",children:e.jsx(dr,{color:"gray.800"})}),e.jsx(nr,{variant:"flushed",isReadOnly:!0,defaultValue:`${Q} ${Le} ${te}`,fontWeight:600,fontSize:"sm"})]})]}),e.jsxs(x,{flex:1,children:[e.jsx(f,{children:"Time"}),e.jsxs(tr,{w:"100%",children:[e.jsx(lr,{pointerEvents:"none",children:e.jsx(dr,{color:"gray.800"})}),e.jsx(nr,{variant:"flushed",isReadOnly:!0,defaultValue:r.time_slots,fontWeight:600,fontSize:"sm"})]})]})]})}),(r==null?void 0:r.type)==="Video Consultant"&&e.jsxs($,{gap:4,children:[" ",e.jsx(v,{isDisabled:(r==null?void 0:r.status)==="Cancelled"||(r==null?void 0:r.status)==="Rejected",colorScheme:"green",mt:5,width:"100%",size:"sm",leftIcon:e.jsx(yt,{fontSize:"20px"}),onClick:()=>{window.open(r==null?void 0:r.meeting_link,"_blank")},children:"Join Meeting"})]}),e.jsx(U,{my:2,mt:5}),e.jsxs(x,{mt:5,children:[e.jsxs($,{align:"center",justify:"space-between",children:[" ",e.jsx(f,{fontWeight:"bold",children:"Prescriptions - "})]}),K.length?K==null?void 0:K.map((d,N)=>e.jsxs(v,{justifyContent:"flex-start",w:"100%",variant:"link",colorScheme:"green",rightIcon:e.jsx(ir,{fontSize:18}),onClick:()=>{ur(d!=null&&d.pdf_file?`${Be}/${d==null?void 0:d.pdf_file}`:`${sr}/prescription/generatePDF/${d.id}`)},children:["Download Prescription #",N+1]},d.id)):e.jsxs(or,{status:"error",size:"sm",fontSize:"sm",py:1,fontWeight:600,borderRadius:4,children:[e.jsx(ar,{}),"Prescriptions Not Found!"]})]}),e.jsx(U,{my:2,mt:5}),e.jsxs(x,{mt:5,children:[e.jsxs($,{align:"center",justify:"space-between",mb:3,children:[" ",e.jsx(f,{fontWeight:"bold",children:"Patient Files - "})]}),M.length?e.jsx(tt,{children:M==null?void 0:M.map(d=>e.jsx(nt.div,{initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{duration:.7},children:e.jsx(gt,{cursor:"pointer",mb:4,onClick:()=>{},children:e.jsx(xt,{p:4,children:e.jsxs($,{align:"center",justify:"space-between",children:[e.jsxs($,{align:"center",gap:4,children:[" ",e.jsx(mt,{fontSize:24,color:"#2D3748"}),e.jsxs(x,{children:[e.jsx(f,{fontSize:14,fontWeight:600,mb:0,children:d.file_name}),e.jsxs(f,{fontSize:12,fontWeight:600,children:[d.f_name," ",d.l_name," |"," ",Pe(d.created_at).format("D-MMM-YY HH:MM A")]})]})]}),e.jsx(st,{icon:e.jsx(it,{}),colorScheme:"blue",size:"sm",onClick:N=>{N.stopPropagation(),Qt(d.file)}})]})})})},d.id))}):e.jsxs(or,{status:"error",size:"sm",fontSize:"sm",py:1,fontWeight:600,borderRadius:4,children:[e.jsx(ar,{}),"Files Not Found!"]})]}),e.jsx(U,{my:2,mt:5}),e.jsxs(x,{mt:5,children:[e.jsxs($,{align:"center",justify:"space-between",children:[" ",e.jsx(f,{fontWeight:"bold",children:"Payment Status"}),e.jsx(cr,{colorScheme:"green",fontWeight:"bold",variant:"solid",children:(r==null?void 0:r.payment_status)||"Not Paid"})]}),e.jsxs(f,{color:"gray.600",fontSize:"sm",fontWeight:600,children:["Payment Id #",r.id]}),re?e.jsx(v,{variant:"link",colorScheme:"green",rightIcon:e.jsx(ir,{fontSize:18}),onClick:()=>{ur(`${sr}/invoice/generatePDF/${re.id}`)},children:"Download Invoice"}):null]}),e.jsx(en,{doctID:r==null?void 0:r.doct_id}),e.jsx(x,{mt:5,children:e.jsx(v,{leftIcon:e.jsx(ot,{}),colorScheme:"gray",variant:"solid",width:"100%",size:"sm",as:J,href:`https://www.google.com/maps?q=${a.value},${c.value}`,isExternal:!0,children:"Make direction to clinic location"})}),e.jsx(U,{my:2}),["Pending","Confirmed","Rescheduled","Cancelled"].includes(r==null?void 0:r.status)&&e.jsxs(x,{children:[e.jsx(x,{bg:"red.400",_hover:{bg:"red.500"},mt:5,width:"100%",size:"sm",as:v,color:"#000",rightIcon:e.jsx(at,{color:"#fff"}),justifyContent:"space-between",alignItems:"center",textAlign:"left",py:2,h:"fit-content",onClick:()=>{r.current_cancel_req_status==="Approved"||r.current_cancel_req_status==="Rejected"||y()},children:e.jsxs(x,{children:[e.jsx(f,{fontSize:"sm",color:"#fff",children:"Appointment Cancellation"}),r.current_cancel_req_status!=="Approved"||r.current_cancel_req_status!=="Rejected"&&e.jsxs(f,{fontSize:"xs",mt:1,color:"gray.100",children:["Click Here to"," ",r.current_cancel_req_status===null?"Initiate":"Delete"," ","Cancelletion Request"]}),r.current_cancel_req_status!==null&&e.jsxs(f,{fontSize:"xs",mt:1,color:"gray.100",children:["Current status -"," ",r.current_cancel_req_status]})]})}),r.current_cancel_req_status!==null&&e.jsxs(x,{bg:"gray.200",borderRadius:"md",px:2,py:1,mt:2,children:[e.jsx(f,{fontSize:"sm",fontWeight:600,mb:2,children:"Request History"}),w==null?void 0:w.map(d=>e.jsx(Jt,{item:d},d.id))]})]})]})]})}),e.jsx(Xt,{cancelRef:R,isOpen:S,onClose:j,currentStatus:r.current_cancel_req_status,appointID:l}),g&&e.jsx(Zt,{patient_id:r==null?void 0:r.patient_id,doctID:r==null?void 0:r.doct_id,AppID:r==null?void 0:r.id,isOpen:g,onClose:b})]})},Xt=({cancelRef:t,isOpen:s,onClose:n,currentStatus:a,appointID:c})=>{const l=qe(),S=br(),y=async g=>{let C={appointment_id:g.id,status:g.status};try{const b=await Rr(Or.token,g.url,C);return b.response===200?(le(S,"success","Success!"),l.invalidateQueries("cartdata"),b):(le(S,"error",b.message),b)}catch(b){return b}},j=Sr({mutationFn:async g=>{await y(g)},onSuccess:()=>{l.invalidateQueries(["appointment-req-history",c]),l.invalidateQueries(["appointment",c]),n()},onError:g=>{le(S,"error",JSON.stringify(g))}});return j.isPending?e.jsx(Ar,{}):e.jsxs(lt,{motionPreset:"slideInBottom",leastDestructiveRef:t,onClose:n,isOpen:s,isCentered:!0,children:[e.jsx(Lr,{}),e.jsxs(dt,{m:{base:2,md:0},children:[e.jsxs(vr,{fontSize:"md",children:[a===null?"Cancel Appointment":"Delete Cancellation Request"," ","?"]}),e.jsx(_r,{}),e.jsxs(wr,{children:[a===null?"Are you sure , you want to cancel this appointment":"Are you sure , you want to delete cancellation request"," ","?"]}),e.jsxs(Cr,{children:[e.jsx(v,{ref:t,onClick:n,size:"sm",minW:20,children:"No"}),e.jsx(v,{colorScheme:"red",ml:3,size:"sm",minW:20,onClick:()=>{a===null?j.mutate({id:c,status:"Initiated",url:"appointment_cancellation"}):a==="Initiated"&&j.mutate({id:c,status:"Initiated",url:"delete_appointment_cancellation"})},children:"Yes"})]})]})]})},Jt=({item:t})=>{const s=n=>{switch(n){case"Initiated":return"yellow.400";case"Rejected":return"red.500";case"Approved":return"green.500";case"Processing":return"orange.400";default:return"gray.500"}};return e.jsxs(x,{children:[" ",e.jsxs($,{gap:5,align:"center",children:[e.jsx(x,{bg:s(t.status),width:"8px",height:"8px",borderRadius:"50%"}),e.jsxs(x,{children:[" ",e.jsx(f,{fontSize:"sm",fontWeight:600,children:t.status}),e.jsx(f,{fontSize:"xs",fontWeight:500,color:"gray.600",children:Pe(t.created_at).format("DD-MM-YYYY hh:mm A")})]})]}),e.jsx(U,{borderColor:"#fff",my:2,borderWidth:1})]})},en=({doctID:t})=>{const s=async()=>(await Z(`get_doctor/${t}`)).data,{data:n}=H({queryKey:["Doctor",t],queryFn:s}),{settingsData:a}=Mr(),c=a==null?void 0:a.find(y=>y.id_name==="clinic_location_latitude"),l=a==null?void 0:a.find(y=>y.id_name==="clinic_location_longitude"),S=a==null?void 0:a.find(y=>y.id_name==="ambulance_number");return e.jsx(e.Fragment,{children:n&&e.jsxs(x,{mt:5,children:[e.jsx(f,{fontWeight:"bold",children:"Contact Us"}),e.jsxs(ct,{spacing:8,mt:2,children:[e.jsxs(v,{variant:"link",colorScheme:"gray",color:"gray.600",display:"flex",flexDir:"column",as:J,href:`tel:${n.isd_code}${n.phone}`,isExternal:!0,children:[e.jsx(oe,{src:"/phone.png",w:9}),e.jsx(f,{mt:2,fontSize:"sm",children:"Phone"})]}),e.jsxs(v,{variant:"link",colorScheme:"gray",color:"gray.600",display:"flex",flexDir:"column",as:J,href:`https://wa.me/${n.isd_code}${n.phone}`,isExternal:!0,children:[e.jsx(oe,{src:"/whatsapp.png",w:9}),e.jsx(f,{mt:2,fontSize:"sm",children:"Whatspp"})]}),e.jsxs(v,{variant:"link",colorScheme:"gray",color:"gray.600",display:"flex",flexDir:"column",as:J,isExternal:!0,href:`mailto:${n.email}`,children:[e.jsx(oe,{src:"/gmail.png",w:9}),e.jsx(f,{mt:2,fontSize:"sm",children:"Gmail"})]}),e.jsxs(v,{variant:"link",colorScheme:"gray",color:"gray.600",display:"flex",flexDir:"column",as:J,isExternal:!0,href:`https://www.google.com/maps?q=${c.value},${l.value}`,children:[e.jsx(oe,{src:"/google-maps.png",w:9}),e.jsx(f,{mt:2,fontSize:"sm",children:"Location"})]}),e.jsxs(v,{variant:"link",colorScheme:"gray",color:"gray.600",display:"flex",flexDir:"column",as:J,isExternal:!0,href:`tel:${S.value}`,children:[e.jsx(oe,{src:"/ambulance.png",w:9}),e.jsx(f,{mt:2,fontSize:"sm",children:"Ambulance"})]})]})]})})};export{dn as default};