1import{g as Ne,u as K,j as e,ar as L,N as je,w as X,x as Z,r as l,aa as ye,Q as E,aA as ee,dM as te,t as Ae,e6 as Y,dG as H,aj as _,af as He,ay as Te,y as Ie,fA as Ke,a6 as Be,G as pe,H as ge,bw as xe,s as U,v as F,I as O,p as w,k as R,fB as Ve,bP as Me,ec as Ce,_ as fe,dJ as he,V as qe,ad as Ye,K as De,fC as D}from"./index-BlUglE8p.js";import{f as v}from"./formatErrorMessage-BebLn3kD.js";import{i as $e,a as Je}from"./appointmentSelector-C8fwNuKK.js";import{u as We,m as Ee,T as Pe,M as $,a as Xe}from"./MobileRegQuestionnaire-D-qIvT48.js";import"./index-CeRbi4Gd.js";import"./index-BGJv5mcs.js";import"./index-kmm9dWaN.js";import"./index-CCaVJYrE.js";import{b as W}from"./StateDescriptionScreen-mE9AkH0k.js";import"./index-D2UauBG9.js";import{Q as Se}from"./mobileRegistration-CIBFkTyE.js";import{g as Ze}from"./getMessageSettingByCode-CPfSezc2.js";import{M as ve}from"./MobileStickyFooter-DzNkFyXF.js";import{C as et}from"./success-DXtqsWKN.js";import"./CustomCheckboxOption-CfwQ5iF-.js";import"./QuestionForm-KadC7loc.js";import"./formatListStyleAsHtml-0azDkRSW.js";import"./index-DNqDLPfJ.js";import"./form-BRFcwQhG.js";import"./request-form-vJyr_WmQ.js";import"./useNavigateInternalRequestForm-rvYqIjJI.js";const tt="/assets/mreg-friendly-error-DKoHRdBS.svg",st=({onClickAction:s})=>{const{isMobileView:d,isSharedServiceView:i}=Ne(),{t:n}=K();return e.jsxs("div",{className:L(!d&&!i&&"lg:h-full","flex h-[calc(100dvh-8.9rem)] flex-col overflow-y-auto"),children:[e.jsxs("div",{className:L(!d&&!i&&"lg:grow-0","flex grow flex-col bg-white p-4"),children:[e.jsx("div",{className:"text-base font-semibold",children:n("appointment.mobileReg.singhealth.afterActualiseDesc1")}),e.jsxs("div",{className:"text-base font-normal text-functional-iron",children:[" ",n("appointment.mobileReg.singhealth.afterActualiseDesc2")," ",e.jsx("span",{className:"font-semibold",children:n("appointment.mobileReg.singhealth.afterActualiseDesc3")})," ",n("appointment.mobileReg.singhealth.afterActualiseDesc4")]})]}),e.jsx("section",{className:L(d||i?"pb-20":"bg-white px-4 pb-4 lg:pt-48"),children:e.jsx(ve,{className:"flex flex-col gap-y-4",children:e.jsx(je,{handleSubmit:s,okText:n("button.next")})})})]})},{Text:J}=Ae,nt=({encounterId:s,memberIdentifier:d})=>{const{isMobileView:i,isSharedServiceView:n}=Ne(),{t:m}=K(),p=X(),t=Z(),o=l.useCallback(()=>{t(ye.setIsHideQueueReminder(!1)),p(E,{replace:!0}),p({pathname:ee(te,{encounter:s}),search:d?`?mid=${d}`:""})},[t,s,p,d]);return e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsxs("div",{className:"flex h-80 flex-col items-center justify-center gap-6 bg-theme-500",children:[e.jsx("img",{alt:"Success Tick",className:"w-20",src:et}),e.jsx(J,{className:"px-3 text-center text-2xl font-bold",children:m("appointment.mobileReg.checkedIn")}),e.jsx(J,{className:"text-xs font-normal",children:m("appointment.mobileReg.registerAgain")})]}),e.jsxs("div",{className:"flex flex-col px-4 text-sm font-normal",children:[e.jsx(J,{children:m("appointment.mobileReg.next")}),e.jsxs("ul",{className:"list-disc pl-6",children:[e.jsx("li",{children:e.jsxs(Y,{i18nKey:"appointment.mobileReg.getQueueNo",children:["Get your ",e.jsx("span",{className:"font-bold",children:"Queue Number"})]})}),e.jsx("li",{children:e.jsxs(Y,{i18nKey:"appointment.mobileReg.trackQueueStatus",children:["Track 'Live' ",e.jsx("span",{className:"font-bold",children:"Queue Status"})]})}),e.jsx("li",{children:e.jsxs(Y,{i18nKey:"appointment.mobileReg.carePlan",children:["Follow your ",e.jsx("span",{className:"font-bold",children:"Care Plan"})]})})]})]})]}),e.jsx("section",{className:L(i||n?"pb-20":"py-6","mt-auto"),children:e.jsx(ve,{className:"flex flex-col gap-y-4 px-4",children:e.jsx(je,{handleSubmit:o,okText:m("appointment.mobileReg.button.checkQueue")})})})]})},{Text:be}=Ae,it=({appointmentDetails:s,isCheckedIn:d,mainQuestions:i,onCheckIn:n,otherQuestions:m,paymentQuestions:p,todayAppointment:t})=>{const{t:o}=K(),h=X(),T=Z(),a=t?.SourceSystem===H.CEQMS,r=s?.SourceSystem===H.NGEMR,y=r&&s?.GroupCode===_.Polyclinic,k=r&&s?.GroupCode!==_.Polyclinic,g=s?.ClusterCode===He.NHG&&s.GroupCode===_.Polyclinic,A=l.useMemo(()=>
1s?.SupportingInfo?.find(N=>N.Type===Te.Organization)?.Id,[s?.SupportingInfo]),S=i&&i.length>0,I=m&&m.length>0,M=p&&p.length>0,[c,z]=l.useState(!1),[b,G]=l.useState(!1),[x,se]=l.useState(!1),[B,Oe]=l.useState(""),[ne,we]=l.useState(""),[ie,Re]=l.useState([]),[oe,ke]=l.useState([]),[ae,ze]=l.useState([]),{memberIdentifier:f}=Ie(),[re,{error:ce,isLoading:le,isSuccess:Ge}]=We(),[me,{isLoading:Qe}]=Ke(),{data:Le,isFetching:_e}=Be({Codes:[Se]},{skip:!(g&&a)}),V=Ze(Se,Le??[]),de=l.useCallback(async({mainQns:N,otherQns:P,paymentQns:C})=>{const Q=()=>y&&!a?{Appointment:s?.RegistrationAppointmentId??"",IsNgemrSoc:!1,Item:a?[...N,...P,...C]:N,Location:"",MemberPrn:f,Organization:A??"",OrganizationUnit:s?.OrganizationUnit??"",Other:a?[]:P,IsCeqms:a,IsNHGP:g}:{Appointment:t?.AppointmentId??"",IsNgemrSoc:k,Item:a?[...N,...P,...C]:N,Location:t?.Location??"",MemberPrn:f,Organization:t?.Organization??"",OrganizationUnit:t?.OrganizationUnit??"",Other:a?[]:P,IsCeqms:a,IsNHGP:g};try{const u=await re(Q()).unwrap();r&&!u.QueueNumber&&u.ErrorText&&we(u.ErrorText);let j="";if(u.EncounterId)j=u.EncounterId;else if(!y){const{data:Ue}=await me({MemberPrn:f,Organization:t?.Organization??"",TogglePreload:!1}),ue=Ue?.TodayAppointments?.find(Fe=>Fe.AppointmentId===t?.AppointmentId);ue?.EncounterId&&(j=ue.EncounterId)}j?(r&&(T(Ee.util.invalidateTags([Pe])),u.ErrorText&&T(ye.setMregSuccessErrText(u.ErrorText)),h(E,{replace:!0}),h({pathname:ee(te,{encounter:j}),search:f?`?mid=${f}`:""})),Oe(j)):(T(pe.util.invalidateTags([ge,xe])),r||U({btnText:o("appointment.viewAppointments"),content:e.jsxs(e.Fragment,{children:[e.jsx(be,{children:o("appointment.mobileReg.error.noEncounterId")}),e.jsx(be,{children:o("appointment.mobileReg.error.tryAgain")})]}),onClose:()=>{F.destroyAll(),h(O(E,{mid:f??""}))}}))}catch(u){if(T(pe.util.invalidateTags([ge,xe])),!r){const j=u;U({btnText:o("appointment.viewAppointments"),content:e.jsx("div",{children:w(R.sanitize(v(j?.message??"")))}),onClose:()=>{F.destroyAll(),h(O(E,{mid:f??""}))}})}}},[y,a,t?.AppointmentId,t?.Location,t?.Organization,t?.OrganizationUnit,k,f,g,s?.RegistrationAppointmentId,s?.OrganizationUnit,A,re,r,me,h,T,o]);l.useEffect(()=>{S||z(!0),I||G(!0),M||se(!0),b&&c&&x&&de({mainQns:ie,otherQns:oe,paymentQns:ae})},[ie,de,S,I,c,b,oe,ae,M,x]);const q=l.useCallback(N=>{const P=[...i??[],...m??[],...p??[]];if(N){const C=Object.entries(N.getFieldsValue()).map(([Q,u])=>({answer:Array.isArray(u)?u.join("|"):u,linkId:Q,type:P.find(j=>j.LinkId===Q)?.Type}));if(S&&!c){if(g&&a&&(C[0]?.answer).toLowerCase()===Ve.yes.toLowerCase()){U({btnText:o("button.ok"),title:V?.Title,content:e.jsx("div",{children:w(R.sanitize(v(V?.Value??"")))}),onClose:()=>{h(O(E,{mid:f??""})),F.destroyAll()}});return}Re(C),z(!0)}else I&&c&&!b?(ke(C),G(!0)):M&&c&&b&&!x&&(ze(C),se(!0))}},[S,I,M,a,c,g,b,x,i,f,h,V,m,p,o]);return le||Qe||_e?e.jsx("div",{className:"flex h-40 flex-col items-center justify-center text-center",children:e.jsx(Me,{"data-testid":"loading-spinner"})}):e.jsxs(e.Fragment,{children:[!!S&&!c&&e.jsx($,{isMobilePay:!1,onNext:q,questions:i,renderHealthPriority:!r}),!!I&&!!c&&!b&&e.jsx($,{isMobilePay:t?.ShowMobilePay,onNext:q,questions:m,renderHealthPriority:!r}),!!M&&!!b&&!!c&&!x&&e.jsx($,{isMobilePay:t?.ShowMobilePay,onNext:q,questions:p,renderHealthPriority:!r}),!r&&!!Ge&&!!B&&!d&&e.jsx(st,{onClickAction:n}),!r&&!!d&&!!B&&e.jsx(nt,{encounterId:B,memberIdentifier:f}),!!r&&!le&&!!ce&&e.jsx(W,{description:e.jsx("div",{className:"flex flex-col items-center gap-2 text-center",children:e.jsx("div",{className:"text-sm font-normal",children:w(R.sanitize(v(ce?.message??"")))})}),image:Ce}),!!ne&&e.jsx(W,{description:e.jsx("div",{className:"flex flex-col items-center gap-2 text-center",children:e.jsx("div",{className:" text-sm font-normal",children:v(ne)})}),image:tt})]})},Mt=()=>{const s=X(),d=Z(),{t:i}=K(),{memberIdentifier:n}=Ie(),[m,p]=l.useState(!1),t=fe($e),o=fe(Je),h=()=>{p(!0)},T=l.useMemo(()=>o?.SupportingInfo?.find(c=>c.Type===Te.Organization)?.Id,[o?.SupportingInfo]),a=o?.SourceSystem===H.NGEMR,r=a&&o?.GroupCode===_.Polyclinic,y=t?.SourceSystem===H.CEQMS,k=()=>r&&!y?{Location:"",MemberPrn:n,MobilePay:!1,Organization:T??"",OrganizationUnit:o?.OrganizationUnit??"",ScreeningStatus:""}:{Location:t?.Location??"",MemberPrn:n,MobilePay:t?.ShowMobilePay,Organization:t?.Organization??"",OrganizationUnit:t?.OrganizationUnit??"",ScreeningStatus:t?.ScreeningStatus??""},{data:g,error:A,isFetching:S}=Xe(k(),{skip:(m||t?.ScreeningStatus===he.failed||t?.ScreeningStatus===he.success)&&!t?.ShowMobilePay});l.useEffect(()=>{!S&&A&&(d(Ee.util.invalidateTags([Pe])),a||U({btnText:i("appointment.viewAppointments"),content:e.jsxs(e.Fragment,{children:[e.jsx("div",{children:w(R.sanitize(v(A?.message??"")))}),e.jsx("div",{children:i("appointment.mobileReg.error.tryAgain")})]}),onClose:()=>{F.destroyAll(),s(O(E,{mid:n??""}))}}))},[d,s,S,a,A,n,i]);const I=()=>
1{s(O(E,{mid:n??""}))},M=()=>{if(a&&A)return e.jsx(W,{description:e.jsx("div",{className:"flex flex-col items-center gap-2 text-center",children:e.jsx("div",{className:"text-sm font-normal",children:w(R.sanitize(v(A?.message??"")))})}),image:Ce});r&&g?.AllowSkipQuestionnaire&&s({pathname:ee(te,{encounter:g?.EncounterId??""}),search:n?`?mid=${n}`:""},{replace:!0});const c=g?.Item??[],z=y?c.filter(x=>x.Category===D.GENERAL)??[]:c,b=y?c.filter(x=>x.Category===D.SPECIALTY)??[]:g?.Others,G=y?c.filter(x=>x.Category===D.PAYMENT)??[]:[];return e.jsx(it,{appointmentDetails:o,isCheckedIn:m,mainQuestions:z,onCheckIn:h,otherQuestions:b,paymentQuestions:G,todayAppointment:t})};return e.jsx(qe,{backButton:m?void 0:{name:i("button.back"),onBack:I},breadcrumbs:{portal:{breadcrumbsDetails:[{title:"Appointments"}]}},title:"Registration",children:e.jsxs("div",{className:"flex h-full grow flex-col",children:[!m&&e.jsxs(e.Fragment,{children:[e.jsx(Ye,{hideRelationship:!0}),e.jsx(De,{className:"border-1 m-0 border-functional-stone","data-testid":"mobileDivider"})]}),S?e.jsx("div",{className:"flex h-40 flex-col items-center justify-center text-center",children:e.jsx(Me,{})}):M()]})})};export{Mt 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.