1import{j as e,Z as R,g as be,u as le,w as re,a0 as J,x as Ne,y as ve,_ as M,af as u,r as l,I as w,Q as H,ag as Ce,ah as X,ai as ye,aj as E,aa as h,ak as Pe,al as De,t as Le,am as Te,an as j,s as ke,p as ee,k as te,ao as se,z as b,P as ae,ap as Ie,K as ce,C as Me,aq as we,ar as oe,N as Ee,V as Re,ad as He}from"./index-Ba5x2QVK.js";import{L as _e,S as Be,A as ne,M as Fe,a as Oe,P as qe}from"./StateDescriptionScreen-DOoiqNSU.js";import{f as Ue}from"./formatErrorMessage-BebLn3kD.js";import{M as ze}from"./MobileStickyFooter-B4125FCe.js";import{s as Ve,a as Ge,b as Qe}from"./appointmentSelector-C8fwNuKK.js";import{g as ie}from"./form-BwVQ8j7O.js";import{f as We}from"./request-form-DAj-Bp2F.js";import{a as Ke}from"./index-CjX5232D.js";import{u as Ye}from"./useQueryAvailableSlots-BBdbEmQK.js";import"./index-CRm-aGqA.js";import{u as $e}from"./useNavigateInternalRequestForm-B0WkD3aW.js";import"./index-CIgKKhPx.js";import"./index-CoBGeWf3.js";import"./index-Dcr8iWjF.js";import"./useScreeningEissDate-A4eku7E-.js";import"./systemSettingsKey-BCUzCxG8.js";const Ze=()=>e.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[e.jsx(R.Button,{active:!0,className:"mt-1 h-64 w-full rounded-lg"}),e.jsx("div",{className:"mt-2 flex flex-col gap-1",children:e.jsx(R.Button,{active:!0,className:"h-44 w-full rounded-lg"})})]}),{Text:f}=Le,Je=()=>{const{isMobileView:g,isSharedServiceView:N}=be(),{t:a}=le(),o=re(),_=J(),B=J(),n=Ne(),{memberIdentifier:i}=ve(),v=M(Ve),r=M(Ge),F=M(Qe)??r,{AppointmentId:S,AppointmentLinks:O,CanCancel:q,CanReschedule:U,ClinicInformation:me,ClusterCode:c,GroupCode:z,IsBundledAppointment:C,SlotHelpInfo:V,SupportingInfo:G,Variants:pe}=F??{},y=!!r?.AppointmentLinks.length&&!r.IsBundledAppointment,{institutionName:de,location:xe,provider:ue,service:he,time:fe}=me??{},Q=c?.toUpperCase()===u.HPB,{queryData:ge,slotDate:Se}=Ye({appointment:F??{},isUseSlotIdListForLinkedAppt:C,type:"reschedule"}),{isSlotFetching:P,onLoadMoreSlot:D,onRefetchSlots:L,slotData:s,slotError:m}=ge,{endDate:W,isFetchingAdditionalData:K,newSlotDate:T,setNewSlotDate:k,startDate:p}=Se;l.useEffect(()=>{S||o(w(H,{mid:i??""}))},[S,o,i]);const Y=l.useMemo(()=>Ce(G),[G]),$=X(Y)===ye.HASC,{handleClickRequestForm:A}=$e({formType:ie({canCancel:q,canReschedule:U,path:B.pathname}),onSetAppointmentDetail:()=>{r&&n(h.setSelectedAppointment(r))}}),{data:d,error:x,isFetching:Z}=Ke({MemberPrn:i,Organization:X(Y)},{skip:!(c===u.SHS&&z!==E.Polyclinic)||$}),Ae=l.useCallback(()=>{const t=new URLSearchParams(_.search);if(y){const I=v?.slots[0]??null;n(h.setLinkedAppointmentMap({appointmentId:S,slot:I})),n(h.resetSelectedLinkedAppointment()),o(w(Pe,{mid:i??""}),{replace:!0})}else d&&n(h.setAppointmentSystemParams(d)),o({pathname:De,search:t.toString()})},[_.search,y,v?.slots,n,S,o,i,d]),je=l.useMemo(()=>C?e.jsx(_e,{handleRequestForm:A,linkedAppointmentSlots:{message:s?.message??"",nexPageLink:s?.nextPageLink??"",slots:s?.slots??[]},noSlotDescription:s?.message,onLoadMoreLinkedSlot:D,refetchSlots:L,showSlotDescription:e.jsxs("div",{className:"flex flex-col text-xs md:text-sm",children:[e.jsx(f,{children:a("appointment.slotContainer.doctorLimitedSlots")}),e.jsx(f,{children:a("appointment.slotContainer.allClosestAvailableTiming")})]}),slotError:m}):e.jsx(Be,{appointmentSlots:{message:s?.message??"",nexPageLink:s?.nextPageLink??"",slots:s?.slots??[]},descriptionElement:e.jsxs("div",{className:"flex flex-col text-xs md:text-sm",children:[e.jsx(f,{children:a("appointment.slotContainer.doctorLimitedSlots")}),e.jsx(f,{children:a("appointment.slotContainer.allClosestAvailableTiming")})]}),handleRequestForm:A,isLoadMore:Q?!!s?.lastSlotDate:!!Te(s?.nextPageLink??""),onLoadMoreSlot:D,refetchSlots:L,slotError:m,title:"appointment.slotContainer.chooseNewAppointmentTimeSlot"}),[C,s?.slots,s?.nextPageLink,s?.message,s?.lastSlotDate,a,A,Q,D,L,m]);return l.useEffect(()=>{j(T).isBefore(j(p))&&k(p)},[K,T,k,p]),l.useEffect(()=>{x&&ke({content:e.jsx("div",{children:ee(te.sanitize(x?.code==="LB0004"?a("LB0004Message"):Ue(x?.message??"")))}),errorCode:x?.code})},[x,a]),e.jsx("div",{className:"mt-[0.0625rem]",children:K?e.jsx(Ze,{}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-4 bg-white px-4 pb-5 pt-4",children:[e.jsx(ne,{dateTime:b(fe,ae),isHideProvider:z===E.Polyclinic&&c!==u.SHS,location:se(c,xe,de),service:he,serviceProvider:ue,title:a("appointment.currentAppointmentDetails"),variants:pe?.map(t=>t.Name)}),!y&&O?.length>0&&Ie(O)?.map(t=>e.jsxs("div",{className:"flex flex-col justify-center gap-3",children:[e.jsx("img",{alt:"link appointment",className:"object-fill md:hidden",src:Fe}),e.jsx("img",{alt:"link appointment",className:"hidden object-fill md:block",src:Oe}),e.jsx(ne,{dateTime:b(t?.ClinicInformation?.time,ae),isHideProvider:t?.GroupCode===E.Polyclinic&&t?.ClusterCode!==u.SHS,location:se(t?.ClusterCode,t?.ClinicInformation?.location,t?.ClinicInformation?.institutionName),service:t?.ClinicInformation?.service,serviceProvider:t?.ClinicInformation?.provider})]},t.AppointmentId)),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx(ce,{className:"my-1 border-[0.05rem] border-functional-stone"}),e.jsxs("div",{className:"flex flex-col items-center justify-center border border-theme-400 bg-theme-500 p-2",children:[e.jsx("span",{className:"note-description text-primary-blue-grey-4",children:"Your appointment can only be rescheduled within this period:"}),e.jsx("span",{className:"note-content font-semibold text-primary-blue-grey-4",children:`${b(p)} to ${b(W)}`})]})]}),e.jsxs("div",{className:oe("flex flex-col gap-4 w-full"),children:[e.jsx("h2",{className:"mb-0 mt-1 min-w-[16.25rem] text-base font-bold md:text-lg",children:a("appointment.chooseNewAppointmentDate")}),e.jsx(Me,{className:"lg:w-1/2",maxDate:W,minDate:p,onChange:t=>{const I=j(t?.toDate()).format(we);
1k(I),n(h.clearAppointmentSlot())},title:"New Appointment Date",value:j(T)})]})]}),e.jsxs("div",{className:"flex flex-col gap-4 px-4 pb-4",children:[e.jsx("div",{children:P||Z?e.jsx("div",{className:"mt-2 flex flex-col gap-1",children:e.jsx(R.Button,{active:!0,className:"h-44 w-full rounded-lg"})}):e.jsx("div",{children:je})}),!m?.message&&e.jsxs("div",{children:[!!V&&e.jsx("button",{className:"comment-note w-full border border-secondary-orange-2 bg-secondary-yellow p-4 text-xs [&_a]:font-bold [&_a]:text-theme-600 [&_p]:text-left",onClick:t=>{A(t)},type:"button",children:ee(te.sanitize(We({formType:ie({canCancel:q,canReschedule:U,path:B.pathname}),responseString:V}),{ALLOWED_ATTR:["href","target","rel","style"]}))}),!Z&&!P&&(s?.slots?.length??0)>0&&c===u.SHS&&!!d?.Messages&&e.jsxs(e.Fragment,{children:[e.jsx("hr",{className:"mx-4"}),e.jsx(qe,{messages:d.Messages})]})]}),!!$&&e.jsx("div",{className:"mt-2 px-2 py-5",children:e.jsx(f,{children:a("appointment.HASAppointmentSlotAvailability")})}),!P&&(s?.slots?.length??0)>0&&!m?.message&&e.jsx("section",{className:oe(g&&!N?"mb-10 pb-32":"pb-0"),children:e.jsx(ze,{className:"flex flex-col gap-y-4",children:e.jsx(Ee,{cancelText:a("button.cancel"),className:"",handleCancel:()=>{o(w(H,{mid:i??""}))},handleSubmit:Ae,okDisabled:!v,okText:a("button.next")})})})]})]})})},ft=()=>{const{t:g}
1=le(),N=re();return e.jsx(Re,{backButton:{name:g("button.back"),onBack:()=>{N(-1)}},breadcrumbs:{portal:{breadcrumbsDetails:[{title:"Appointments"}]}},title:g("appointment.rescheduleAppointment"),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx(He,{customSwitchUserNavigatePath:H,hideRelationship:!0,isShowSwitchUser:!0}),e.jsx(ce,{className:"border-1 m-0 border-functional-stone","data-testid":"mobileDivider"}),e.jsx(Je,{})]})})};export{ft 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.