1import{u as S,x as I,w as T,y as O,_ as m,r as k,ai as h,j as e,p as N,k as _,bK as B,an as U,z,N as L,aa as p,bJ as F,G as H,H as R,bx as G,fx as V,I as v,f5 as W,s as Y,Q as C,V as K,ad as Q}from"./index-Ba5x2QVK.js";import{f as g}from"./formatErrorMessage-BebLn3kD.js";import{s as J,n as q,v as X}from"./appointmentSelector-C8fwNuKK.js";import{u as Z}from"./index-CoBGeWf3.js";import{S as $}from"./bookNextAppointment.type-k46mBbEd.js";import{a as ee}from"./index-Dcr8iWjF.js";import"./index-CRm-aGqA.js";import"./index-CjX5232D.js";import{u as te}from"./useReloadNativeApi-CyXRmCYb.js";const se=()=>{const{t:s}=S(),n=I(),u=T(),{memberIdentifier:r}=O(),o=m(J),{isSingleOrganizationVcService:b,selectedDoctor:x,selectedLocation:i,selectedServiceType:l}=m(q),t=m(X),{handleReloadAppointmentWithReplace:y}=te(),[j]=ee(),[P,{isLoading:D}]=Z(),c=k.useMemo(()=>l?.ServicesByOrganization.find(a=>a?.Organization===i?.OrganizationCode),[i?.OrganizationCode,l?.ServicesByOrganization]),M=c?.ServiceType,A=i?.ClusterCode===h.NHG||i?.ClusterCode===h.NUHS,f=()=>{u(v(C,{mid:r??""}))},w=async()=>{try{await j({Address:[{Block:t?.MainAddress?.Block??"",Building:t?.MainAddress?.Building??"",City:t?.MainAddress?.City??"",Country:t?.MainAddress?.Country??"",FullAddress:"",Level:t?.MainAddress?.Level??"",PostalCode:t?.MainAddress?.PostalCode??"",Street:t?.MainAddress?.Street??"",Unit:t?.MainAddress?.Unit??"",Use:"home"},{Block:t?.DeliveryAddress?.Block??"",Building:"",City:"SG",Country:"Singapore",FullAddress:"",Level:t?.DeliveryAddress?.Level??"",PostalCode:t?.DeliveryAddress?.PostalCode??"",Street:t?.DeliveryAddress?.Street??"",Unit:t?.DeliveryAddress?.Unit??"",Use:"temp"}],Contact:t?.Contact??"",Email:t?.Email??"",MemberPrn:r,TargetSource:"OAS"}).unwrap(),n(p.resetVcpPatientDetails())}catch(a){throw console.warn("Failed to update patient information",a),new Error("Failed to update profile")}},E=async()=>{n(p.setNewAppointment({selectedDateTime:null})),w();try{const a=await P({IsConcatErrorCode:!A,MemberPrn:r,Organization:F(i?.OrganizationCode),PatientDetails:t,ServiceType:M,SlotId:o?.slots?.[0]?.id??"",Start:o?.slots?.[0]?.startDateTime??"",Status:$.Booked}).unwrap();a&&(n(H.util.invalidateTags([R,G])),n(p.setNewAppointment({successResponse:a})),y(V))}catch(a){const d=a;A?u(v(W,{mid:r??""}),{replace:!0,state:{error:d?.code??"",errorMessage:g(d?.message??"")}}):(Y({content:N(g(d?.message??"")),errorCode:d?.code??""}),f())}};return e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"bg-white px-4 pb-5 pt-4",children:[e.jsx("div",{className:"mb-3 text-base font-bold",children:s("appointment.pleaseCheckAppointmentDetails")}),e.jsx("span",{className:"text-functional-iron",children:N(_.sanitize(s("appointment.confirmDescription")))})]}),e.jsx("div",{className:"p-4","data-testid":"normal-slots",children:e.jsxs("div",{className:"rounded-2xl bg-white px-4 pb-6 pt-4",children:[!!l?.Name&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 text-functional-iron",children:[s("appointment.serviceType"),":"]}),e.jsx("div",{className:"font-semibold",children:c?.DisplayName||c?.Name})]}),!!i?.Name&&!b&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 text-functional-iron",children:[s("appointment.location"),":"]}),e.jsx("div",{className:"font-semibold",children:i?.Name})]}),!!x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 text-functional-iron",children:[s("appointment.doctor"),":"]}),e.jsx("div",{className:"gbmask font-semibold",children:B(x)})]}),!!o?.slots?.[0]?.startDateTime&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 text-functional-iron",children:[s("appointment.appointmentDate"),":"]}),e.jsx("div",{className:"font-semibold",children:U(o?.slots?.[0]?.startDateTime).format("DD MMM YYYY (ddd)")}),e.jsxs("div",{className:"mt-3 text-functional-iron",children:[s("appointment.appointmentTime"),":"]}),e.jsx("div",{className:"font-semibold",children:z(o?.slots?.[0]?.startDateTime,"hh:mm A")})]})]})})]}),e.jsx("div",{className:"mb-4 mt-auto px-4",children:e.jsx(L,{cancelText:s("button.cancel"),handleCancel:f,handleSubmit:E,isLoading:D,okText:s("button.confirm")})})]})},pe=()=>{const s=T(),{t:n}=S();return e.jsx(K,{backButton:{name:n("button.back"),onBack:()=>{s(-1)}}
1,breadcrumbs:{portal:{breadcrumbsDetails:[{title:"Appointments"}]}},title:n("appointment.breadcrumbs.newAppointment"),children:e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsx(Q,{customSwitchUserNavigatePath:C,hideRelationship:!0,isShowSwitchUser:!0}),e.jsx(se,{})]})})};export{pe 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.