hplx-feature-library 1.0.273 → 1.0.275

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ import { h as p, R as i, b as d, c as P } from "./common-utils-DnFYNMKH.js";
2
+ import { d as l } from "./dayjs.min-DEuEIfhE.js";
3
+ const u = "/preferences/doctor", _ = "/preferences/visitpad", E = "/preferences/branch", f = "patient/search", g = "../api/modelGetAddPatientSuggestion.php", h = "appointments/get", T = "/v1/patient/add", A = "/v1/patients", w = "../api/modelSavePatientImage.php", N = "../api/modelDeletePatientImage.php", I = "/patient/detail", y = "../api/modelSendRegisterOtp.php", D = "../api/modelVerifyRegisterOtp.php", j = async (r = "", o = {}, e, t, s) => {
4
+ const { doc_rid: n = "" } = o;
5
+ let a = "";
6
+ Array.isArray(r) ? a = r.map((c) => `&fields_required=${encodeURIComponent(c)}`).join("") : r && (a = `&fields_required=${encodeURIComponent(r)}`);
7
+ try {
8
+ const c = await p(s?.token, s.envName).get(
9
+ `${u}/${n || e}?branch_id=${t}` + a
10
+ ), { data: m } = c || {};
11
+ return Promise.resolve(m);
12
+ } catch (c) {
13
+ return console.error("Error fetching doctor preference:", c), Promise.reject(c);
14
+ }
15
+ }, O = async (r = "", o, e) => {
16
+ try {
17
+ const t = await i(e.token, e.envName).get(
18
+ `${E}/${o}?fields_required=${r}`
19
+ ), { data: s } = t || {};
20
+ return Promise.resolve(s);
21
+ } catch (t) {
22
+ return console.log(t), Promise.reject(t);
23
+ }
24
+ }, S = async (r, o, e) => {
25
+ try {
26
+ let t = "";
27
+ Array.isArray(r) ? t = r.map((c) => `fields_required=${encodeURIComponent(c)}`).join("&") : r && (t = `fields_required=${encodeURIComponent(r)}`);
28
+ const s = `v2${E}/${o}?${t}`, n = await i(e.token, e.envName).get(s), { data: a } = n || {};
29
+ return Promise.resolve(a);
30
+ } catch (t) {
31
+ return console.error("Error fetching branch preference:", t), Promise.reject(t);
32
+ }
33
+ }, R = async (r, o, e, t, s) => {
34
+ try {
35
+ const n = {
36
+ appnt_date: r,
37
+ // If empty then will take today's date
38
+ doctor_role_id: o,
39
+ doctor_id: t,
40
+ org_branch_id: e
41
+ }, a = await i(s.token, s.envName).post(h, {
42
+ ...n
43
+ }), { data: c } = a || {};
44
+ return Promise.resolve(c);
45
+ } catch (n) {
46
+ return n instanceof Error && console.error("Error fetching appointments:", n.message), n?.response?.status === 401 && d(), Promise.reject(n);
47
+ }
48
+ }, Y = async (r, o) => {
49
+ let e = [];
50
+ const t = await R(
51
+ l().format("YYYY-MM-DD"),
52
+ r.doctor_role_id,
53
+ r.branch_id,
54
+ r.doctor_id,
55
+ o
56
+ );
57
+ t?.appointments?.length && (e = t.appointments), window.filteredUpcomingAppts = [], e.length && (r.term?.length ? window.filteredUpcomingAppts = e.filter((s) => s.org_person_name.length && s.org_person_name.toLowerCase().includes(r.term.toLowerCase()) && s.appnt_date >= l(/* @__PURE__ */ new Date()).format("YYYY-MM-DD") && (s.remote_appnt_status === "CONFIRMED" || s.appnt_status === 0 || s.appnt_status === 3 || s.appnt_status === 5)) : window.filteredUpcomingAppts = e.filter((s) => s.appnt_date >= l(/* @__PURE__ */ new Date()).format("YYYY-MM-DD") && (s.remote_appnt_status === "CONFIRMED" || s.appnt_status === 0 || s.appnt_status === 3 || s.appnt_status === 5)));
58
+ try {
59
+ const s = await i(o.token, o.envName).post(
60
+ f,
61
+ r
62
+ ), { data: n } = s || {};
63
+ return Promise.resolve(n);
64
+ } catch (s) {
65
+ return console.log(s), null;
66
+ }
67
+ }, b = async (r) => {
68
+ try {
69
+ const o = await p(r.token, r.envName).post(
70
+ g
71
+ ), { data: e } = o || {}, { apiError: t } = e || {};
72
+ if (t)
73
+ throw new Error(t);
74
+ return Promise.resolve(e);
75
+ } catch (o) {
76
+ return o instanceof Error && console.error("Error fetching referred by list:", o.message), o?.response?.status === 401 && d(), Promise.reject(o);
77
+ }
78
+ }, $ = async (r, o) => {
79
+ try {
80
+ const e = await i(o.token, o.envName).post(T, {
81
+ ...r,
82
+ token: o.token
83
+ }), { data: t } = e || {};
84
+ return Promise.resolve(t);
85
+ } catch (e) {
86
+ return Promise.reject(e);
87
+ }
88
+ }, G = async (r, o) => {
89
+ try {
90
+ const e = await i(o.token, o.envName).put(
91
+ A + "/" + r?.person_role_id,
92
+ {
93
+ ...r
94
+ }
95
+ ), { data: t } = e || {};
96
+ return Promise.resolve(t);
97
+ } catch (e) {
98
+ return console.log(e), Promise.reject(e);
99
+ }
100
+ }, M = async (r, o) => {
101
+ try {
102
+ const e = await p(o.token, o.envName).post(
103
+ w,
104
+ r
105
+ ), { data: t } = e || {};
106
+ return Promise.resolve(t);
107
+ } catch (e) {
108
+ return console.log(e), Promise.reject(e);
109
+ }
110
+ }, U = async (r, o) => {
111
+ try {
112
+ const e = await p(o.token, o.envName).post(
113
+ N,
114
+ r
115
+ ), { data: t } = e || {};
116
+ return Promise.resolve(t);
117
+ } catch (e) {
118
+ return console.log(e), Promise.reject(e);
119
+ }
120
+ }, L = async ({
121
+ callback: r,
122
+ payload: o,
123
+ token_env: e,
124
+ isCallbackNeeded: t = !0
125
+ }) => {
126
+ try {
127
+ const s = o;
128
+ window?.partner_service_enabled === "1" && (s.partner_service_enabled = !0);
129
+ const n = await i(e.token, e.envName).post(
130
+ I,
131
+ {
132
+ ...s
133
+ }
134
+ ), { data: a } = n || {}, { error: c } = a || {};
135
+ if (c)
136
+ throw new Error(c);
137
+ if (t)
138
+ r(a);
139
+ else return a;
140
+ } catch (s) {
141
+ console.log(s);
142
+ }
143
+ }, F = async ({ doc_id: r = "", doc_rid: o = "" }, e, t, s, n) => {
144
+ try {
145
+ const a = {
146
+ branch_id: t,
147
+ doctor_id: r || s,
148
+ doctor_role_id: o || n
149
+ }, c = await p(e.token, e.envName).post(
150
+ _,
151
+ a
152
+ ), { data: m } = c || {};
153
+ return Promise.resolve(m);
154
+ } catch (a) {
155
+ return console.error("Error fetching visitpad preference:", a), Promise.reject(a);
156
+ }
157
+ }, V = async (r, o) => {
158
+ try {
159
+ const e = new URLSearchParams();
160
+ e.append("reg_mobile_number", r);
161
+ const t = await P(o.token, o.envName).post(y, e, {
162
+ headers: {
163
+ "Content-Type": "application/x-www-form-urlencoded"
164
+ }
165
+ });
166
+ return Promise.resolve(t?.data);
167
+ } catch (e) {
168
+ return console.log(e), Promise.reject(e);
169
+ }
170
+ }, x = async (r, o, e) => {
171
+ try {
172
+ const t = new URLSearchParams();
173
+ t.append("reg_mobile_number", r), t.append("reg_mobile_otp", o);
174
+ const s = await P(e.token, e.envName).post(D, t, {
175
+ headers: {
176
+ "Content-Type": "application/x-www-form-urlencoded"
177
+ }
178
+ });
179
+ return Promise.resolve(s?.data);
180
+ } catch (t) {
181
+ return console.log(t), Promise.reject(t);
182
+ }
183
+ };
184
+ export {
185
+ w as A,
186
+ I as G,
187
+ A as U,
188
+ O as a,
189
+ b,
190
+ x as c,
191
+ L as d,
192
+ M as e,
193
+ U as f,
194
+ Y as g,
195
+ $ as h,
196
+ S as i,
197
+ j,
198
+ F as k,
199
+ V as p,
200
+ G as u
201
+ };
@@ -0,0 +1 @@
1
+ "use strict";const c=require("./common-utils-BcaBj1Iw.cjs"),P=require("./dayjs.min-BawXyS7V.cjs"),A="/preferences/doctor",h="/preferences/visitpad",m="/preferences/branch",_="patient/search",u="../api/modelGetAddPatientSuggestion.php",g="appointments/get",f="/v1/patient/add",l="/v1/patients",d="../api/modelSavePatientImage.php",T="../api/modelDeletePatientImage.php",E="/patient/detail",I="../api/modelSendRegisterOtp.php",D="../api/modelVerifyRegisterOtp.php",w=async(r="",n={},e,t,o)=>{const{doc_rid:s=""}=n;let a="";Array.isArray(r)?a=r.map(i=>`&fields_required=${encodeURIComponent(i)}`).join(""):r&&(a=`&fields_required=${encodeURIComponent(r)}`);try{const i=await c.hplxAPI(o?.token,o.envName).get(`${A}/${s||e}?branch_id=${t}`+a),{data:p}=i||{};return Promise.resolve(p)}catch(i){return console.error("Error fetching doctor preference:",i),Promise.reject(i)}},N=async(r="",n,e)=>{try{const t=await c.ReArchAPI(e.token,e.envName).get(`${m}/${n}?fields_required=${r}`),{data:o}=t||{};return Promise.resolve(o)}catch(t){return console.log(t),Promise.reject(t)}},y=async(r,n,e)=>{try{let t="";Array.isArray(r)?t=r.map(i=>`fields_required=${encodeURIComponent(i)}`).join("&"):r&&(t=`fields_required=${encodeURIComponent(r)}`);const o=`v2${m}/${n}?${t}`,s=await c.ReArchAPI(e.token,e.envName).get(o),{data:a}=s||{};return Promise.resolve(a)}catch(t){return console.error("Error fetching branch preference:",t),Promise.reject(t)}},R=async(r,n,e,t,o)=>{try{const s={appnt_date:r,doctor_role_id:n,doctor_id:t,org_branch_id:e},a=await c.ReArchAPI(o.token,o.envName).post(g,{...s}),{data:i}=a||{};return Promise.resolve(i)}catch(s){return s instanceof Error&&console.error("Error fetching appointments:",s.message),s?.response?.status===401&&c.handle401Status(),Promise.reject(s)}},C=async(r,n)=>{let e=[];const t=await R(P.dayjs().format("YYYY-MM-DD"),r.doctor_role_id,r.branch_id,r.doctor_id,n);t?.appointments?.length&&(e=t.appointments),window.filteredUpcomingAppts=[],e.length&&(r.term?.length?window.filteredUpcomingAppts=e.filter(o=>o.org_person_name.length&&o.org_person_name.toLowerCase().includes(r.term.toLowerCase())&&o.appnt_date>=P.dayjs(new Date).format("YYYY-MM-DD")&&(o.remote_appnt_status==="CONFIRMED"||o.appnt_status===0||o.appnt_status===3||o.appnt_status===5)):window.filteredUpcomingAppts=e.filter(o=>o.appnt_date>=P.dayjs(new Date).format("YYYY-MM-DD")&&(o.remote_appnt_status==="CONFIRMED"||o.appnt_status===0||o.appnt_status===3||o.appnt_status===5)));try{const o=await c.ReArchAPI(n.token,n.envName).post(_,r),{data:s}=o||{};return Promise.resolve(s)}catch(o){return console.log(o),null}},v=async r=>{try{const n=await c.hplxAPI(r.token,r.envName).post(u),{data:e}=n||{},{apiError:t}=e||{};if(t)throw new Error(t);return Promise.resolve(e)}catch(n){return n instanceof Error&&console.error("Error fetching referred by list:",n.message),n?.response?.status===401&&c.handle401Status(),Promise.reject(n)}},j=async(r,n)=>{try{const e=await c.ReArchAPI(n.token,n.envName).post(f,{...r,token:n.token}),{data:t}=e||{};return Promise.resolve(t)}catch(e){return Promise.reject(e)}},O=async(r,n)=>{try{const e=await c.ReArchAPI(n.token,n.envName).put(l+"/"+r?.person_role_id,{...r}),{data:t}=e||{};return Promise.resolve(t)}catch(e){return console.log(e),Promise.reject(e)}},S=async(r,n)=>{try{const e=await c.hplxAPI(n.token,n.envName).post(d,r),{data:t}=e||{};return Promise.resolve(t)}catch(e){return console.log(e),Promise.reject(e)}},L=async(r,n)=>{try{const e=await c.hplxAPI(n.token,n.envName).post(T,r),{data:t}=e||{};return Promise.resolve(t)}catch(e){return console.log(e),Promise.reject(e)}},Y=async({callback:r,payload:n,token_env:e,isCallbackNeeded:t=!0})=>{try{const o=n;window?.partner_service_enabled==="1"&&(o.partner_service_enabled=!0);const s=await c.ReArchAPI(e.token,e.envName).post(E,{...o}),{data:a}=s||{},{error:i}=a||{};if(i)throw new Error(i);if(t)r(a);else return a}catch(o){console.log(o)}},$=async({doc_id:r="",doc_rid:n=""},e,t,o,s)=>{try{const a={branch_id:t,doctor_id:r||o,doctor_role_id:n||s},i=await c.hplxAPI(e.token,e.envName).post(h,a),{data:p}=i||{};return Promise.resolve(p)}catch(a){return console.error("Error fetching visitpad preference:",a),Promise.reject(a)}},G=async(r,n)=>{try{const e=new URLSearchParams;e.append("reg_mobile_number",r);const t=await c.hplxPHPAPI(n.token,n.envName).post(I,e,{headers:{"Content-Type":"application/x-www-form-urlencoded"}});return Promise.resolve(t?.data)}catch(e){return console.log(e),Promise.reject(e)}},M=async(r,n,e)=>{try{const t=new URLSearchParams;t.append("reg_mobile_number",r),t.append("reg_mobile_otp",n);const o=await c.hplxPHPAPI(e.token,e.envName).post(D,t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}});return Promise.resolve(o?.data)}catch(t){return console.log(t),Promise.reject(t)}};exports.ADD_PATIENT_IMAGE=d;exports.GET_PATIENT_DETAILS=E;exports.UPDATE_PATIENT_DETAIL=l;exports.addPatientDetails=j;exports.addPatientImage=S;exports.deletePatientImage=L;exports.getBranchPreferences=N;exports.getDoctorPreference=w;exports.getPatientDetails=Y;exports.getPatientList=C;exports.getReferredByList=v;exports.getV2BranchPreference=y;exports.getVisitpadPreference=$;exports.patientConsentOTPVerification=M;exports.patientConsentSendOTP=G;exports.updatePatientDetails=O;
@@ -1,4 +1,4 @@
1
- import { P as f } from "../PatientAddEdit-Bl8UC3Qt.js";
1
+ import { P as f } from "../PatientAddEdit-COJYbMRa.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./index-D5vZvm7Z.cjs");;/* empty css */const at=require("./index-CZONCDCp.cjs"),a=require("react"),st=require("./index.esm-BdlMQ1M7.cjs"),oe=require("./dayjs.min-BawXyS7V.cjs"),h=require("./common-utils-BcaBj1Iw.cjs"),x=require("./CommonConstant-COHqiSWL.cjs"),B=require("./APIAction-1zVYADts.cjs"),lt=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Yt=({conflicts:R,handleAddPatient:_,redirectAction:G})=>{const[C,b]=a.useState(!1);return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-[20%] hfl-my-5 hfl-text-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Error-700",children:"Patient/s with similar information already exists in your Clinic. To continue with an existing patient click on “Continue."})}),e.jsxRuntimeExports.jsxs("table",{className:"hfl-mx-7",children:[e.jsxRuntimeExports.jsx("thead",{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full",children:[e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[40px] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"#"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Name"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Phone No"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Email"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Branch"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-rounded-tr hfl-border-b hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]"})]})}),R.map((o,f)=>e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full hfl-border-1 hfl-border-Gray-100",children:[e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:f+1})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:o.org_person_name||o.name})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_phone||o.phone})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_email||o.email})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:"In Same Branch"})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:window.role_id=="11"&&e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"Continue",className:"hfl-text-Primary-700",onClick:()=>h.goToPatientDashboard(o.person_role_id)})})]}))]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-my-7 hfl-flex hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Success-800",children:"If your patient is not in the above list"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.Ku,{disabled:C,hierarchy:"Primary",size:"xl",textField:"Create As New Patient",className:"hfl-bg-Primary-700",onClick:()=>{b(!0),_(!0,G)}})})]})};function Wt(R){const{editPatient:_,setEditPatient:G,createAsNew:C,setCreateAsNew:b}=R,o=()=>_?"Primary":"Secondary",f=()=>C?"Primary":"Secondary";return e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-6 hfl-flex hfl-h-20 hfl-w-full hfl-items-center hfl-justify-center hfl-gap-4 hfl-border-1 hfl-border-Error-200 hfl-bg-Error-25",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"Are you updating"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:o(),size:"lg",textField:"Exisitng Patient",onClick:()=>{G(!0),b(!1)}}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"or creating a"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:f(),size:"lg",textField:"New Patient",onClick:()=>{b(!0),G(!1)}})]})}const De=15,rt=3,Kt=({isOpen:R,onClose:_,onSubmit:G,otpErrorMsg:C,setOtpErrorMsg:b,optHeading:o,otpSubHeading:f,veriftButtonTitle:m,resendOtp:J})=>{const[$,w]=a.useState(""),[F,p]=a.useState(De),[se,I]=a.useState(!1),[z,Y]=a.useState(0);a.useEffect(()=>{R&&(w(""),b(""),p(De),I(!1),Y(0))},[R,b]),a.useEffect(()=>{if(F>0&&R){const O=setInterval(()=>{p(W=>W-1)},1e3);return()=>clearInterval(O)}else F===0&&R&&I(!0)},[F,R]);const he=O=>{O.preventDefault(),String($).length===6&&G($)},de=O=>{C&&b("");const W=O.target.value;/^\d*$/.test(W)&&w(W)},fe=()=>{se&&z<rt&&(J(),Y(O=>O+1),p(De),I(!1))};return e.jsxRuntimeExports.jsxs(at.Modal,{isOpen:R,onRequestClose:_,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1032},content:{maxWidth:"400px",maxHeight:"350px",display:"flex",flexDirection:"column",justifyContent:"center",padding:"24px",margin:"auto",borderRadius:"12px"}},ariaHideApp:!1,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-justify-end",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary-Grey",icon:"Only",iconFile:"hx_close",onClick:_,size:"md",textField:""})}),e.jsxRuntimeExports.jsxs("form",{className:"hfl-z-5 hfl-relative hfl-flex hfl-h-full hfl-flex-col hfl-items-center hfl-justify-center hfl-text-center",onSubmit:he,children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:o}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-mx-auto hfl-w-[290px] hfl-pt-2 hfl-text-Gray-500",children:f}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-auto hfl-max-h-[150px] hfl-w-[315px] hfl-py-5",children:e.jsxRuntimeExports.jsx(e.wu,{inputProps:{autoFocus:!0,value:$,pattern:"[0-9]+",onChange:de},size:"xs",digits:6,errorMsg:C})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mb-4 hfl-h-4",children:z>=rt?e.jsxRuntimeExports.jsx(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Error-500",children:"Maximum resend attempts reached."}):se?e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-cursor-pointer hfl-text-Primary-700 hfl-underline",onClick:fe,children:"Resend OTP"}):e.jsxRuntimeExports.jsxs(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Gray-500",children:["Resend OTP in 00:",F<10?`0${F}`:F]})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:m,disabled:String($).length<6})]})]})},Zt=R=>{const{closeModal:_,modalIsOpen:G,pref:C,variable:b}=R,{window_var:o,token:f,envName:m}=b,[J,$]=a.useState(!1),[w,F]=a.useState({}),[p,se]=a.useState(!1),[I,z]=a.useState(null),[Y,he]=a.useState(!0),[de,fe]=a.useState(!1),[O,W]=a.useState([]),[Te,K]=a.useState(!1),[P,le]=a.useState(""),[g,nt]=a.useState(),[j,u]=a.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[re,it]=a.useState([]),[ae,H]=a.useState({name:!1,phone:!1}),[ce,ot]=a.useState([]),[ue,ht]=a.useState([]),[pe,dt]=a.useState([]),[ft,xe]=a.useState(!1),[ct,me]=a.useState(!1),[ut,ge]=a.useState(!1),[_e,pt]=a.useState([]),[k,xt]=a.useState(!1),[s,L]=a.useState({name:"",phone:"",dob:"",gender:"",honorific:"",patient_preferred_language:C?.visit_pad_json?JSON.parse(C?.visit_pad_json)?.defaultLanguage?.rows:"",age:"",age_selector:"years",blood_group:"",email:"",address:"",city:"",existingBidStr:"",pincode:"",ref_doc_name:"",ref_doc_spec:"",temp_appnt_id:"",throughChannel:"",refDocId:"",careOf:"",phoneSecondary:"",occupation:"",tag:"",phone_otp:"",regAsNew:"",image_link:"",marital_status:"",spouse_blood_group:"",married_since:"",spouse_name:"",org_person_dob:"",aadhar_number:"",custom_fields:[]}),[mt,gt]=a.useState([]),{name:ke,phone:A,age:N,dob:M,gender:Ae}=s,[Be,Oe]=a.useState(!1),[_t,je]=a.useState(s.gender),[S,Le]=a.useState("Years"),[Me,Ge]=a.useState(""),[Fe,be]=a.useState(!1),[jt,bt]=a.useState([]),v=(t,l,r,n)=>{bt([{id:1,title:t,description:l,type:r,duration:n}])},q=a.useRef(null),Ie=a.useRef(null),[ze,X]=a.useState(!1),[yt,ye]=a.useState(!1),[Et,He]=a.useState(!1),[Ve,Ee]=a.useState(!1),[qe,Re]=a.useState(!1),[ne,Rt]=a.useState(),D=g&&g.visit_pad_json&&h.isJson(g.visit_pad_json)&&JSON.parse(g.visit_pad_json),Ue=h.debounceFn((...t)=>{const[l,r]=t;At(l,r)}),i=a.useCallback((t,l)=>{ye(!1),L(r=>({...r,[t]:l})),(t==="name"||t==="phone"&&l.length>=3)&&Ue(t,l)},[Ue]),vt=t=>{i("throughChannel",t.value.trim()),xe(!1)},T=a.useMemo(()=>ne?.branch_details?.enable_mobile_otp=="1",[ne?.branch_details?.enable_mobile_otp]),Ct=t=>{i("occupation",t.trim()),me(!1)},wt=t=>{i("city",t.trim()),ge(!1)},Pt=t=>{const{value:l}=t.target,r=Dt(l);ot(r)},Nt=t=>{const{value:l}=t.target,r=Tt(l);ht(r)},St=t=>{const{value:l}=t.target,r=kt(l);pt(r)},Dt=t=>{if(pe?.length){let l=pe;return t?.length&&(l=pe.filter(r=>r.title.toLowerCase().includes(t.toLowerCase()))),l}else return[]},Tt=t=>{if(x.OccupationList?.length){let l=x.OccupationList;return t?.length&&(l=x.OccupationList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},kt=t=>{if(x.CityList?.length){let l=x.CityList;return t?.length&&(l=x.CityList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},$e=a.useRef(null),ie=a.useRef(null),ve=a.useRef(null),Ye=window.location?.pathname.includes("/frontdesk");a.useEffect(()=>{const t=h.calculateDOB(s.age,S);t&&L(l=>({...l,dob:t}))},[S,s.age]);const Ce=a.useCallback(t=>{je(t),i("gender",t),u(l=>({...l,gender:""}))},[i]),We=t=>{($e.current&&!$e.current.contains(t.target)||ie.current&&!ie.current.contains(t.target))&&H({name:!1,phone:!1}),ve.current&&!ve.current.contains(t.target)&&be(!1)},Ke=a.useCallback(()=>{le(s.image_link),K(!1),X(!1)},[s.image_link]),Ze=a.useCallback(async()=>{const t=await B.getBranchPreferences("patient_config",o?.org_branch_id_for_seg?.toString()||"",{token:f,envName:m});Rt(t)},[f,m,o?.org_branch_id_for_seg]);a.useEffect(()=>(document.addEventListener("mousedown",We),()=>{document.removeEventListener("mousedown",We)}),[]),a.useEffect(()=>{o.doctor_speciality==="Gynaecologist"&&!s.gender&&Ce("1")},[s.gender,Ce,o.doctor_speciality]),a.useEffect(()=>{s.image_link&&Ke(),s.honorific&&Ge(s.honorific)},[s.honorific,s.image_link,Ke]),a.useEffect(()=>{Ye&&Oe(!0)},[Ye]),a.useEffect(()=>{Ze()},[Ze]),a.useEffect(()=>{(async()=>{nt(C);try{const t=await B.getReferredByList({token:f,envName:m}),{total_ref_doc_details:l,through_channel:r}=t;l.length&&gt(h.parseReferredByDocList(l)),r.length&&dt(h.parseThroughChannelList(r))}catch(t){console.log("ERROR",t)}})()},[C,f,m]);const At=async(t,l)=>{const r={branch_id:o?.org_branch_id_for_seg||"",doctor_id:o?.person_id_for_seg||"",doctor_role_id:o?.doctor_role_id_for_seg||"",term:encodeURIComponent(l),limit:30},n=await B.getPatientList(r,{token:f,envName:m});if(!n){H({name:!1,phone:!1});return}!n.apiError&&Number(n.total_persons)>0?(it(n.persons),H(t==="name"?{...ae,name:!0}:{...ae,phone:!0})):H({name:!1,phone:!1})},U=a.useCallback(async()=>{if(!T||!Y)return;Re(!0),(await B.patientConsentSendOTP(A,b)).apiError?v("OTP Failed","Unable to send OTP. Please try again.","Error",3e3):v("Success","OTP sent successfully","Success",1500)},[T,Y,A,b]),Bt=a.useCallback(async t=>{(await B.patientConsentOTPVerification(A,t,b)).apiError?v("Invalid OTP","Please enter correct OTP","Error",3e3):(xt(!0),v("Success","OTP verified successfully","Success",1500),Re(!1))},[A,b]),we=t=>{switch(t){case"Appointment":return"#Appnt";default:return""}},Pe=t=>{switch(t){case"Bill":case"Appointment":return"emrPatientPopUp.php?pid=";default:return h.EAPP_ROUTES.visitpad+"?pid="}},Ot=a.useCallback(t=>{const l=r=>{L({name:r?.name||"",phone:r?.phone_number||"",gender:r?.gender||"",honorific:r?.honorific||"",patient_preferred_language:r?.patient_preferred_language||"",ref_doc_spec:r?.ref_doc_spec||"",age:r?.age.toString()||"",age_selector:"2",dob:r.org_person_dob||"",org_person_dob:r.org_person_dob||"",blood_group:r?.blood_group||"",email:r?.email||"",address:r?.address||"",city:r?.city||"",existingBidStr:r?.org_person_bid_str||"",pincode:r?.pincode||"",ref_doc_name:r?.ref_doc_name||"",temp_appnt_id:"",throughChannel:r?.through_channel||"",refDocId:r?.ref_doc_id||"",careOf:r?.care_of||"",phoneSecondary:r?.phone_secondary||"",occupation:r?.occupation||"",tag:r?.tag||"",phone_otp:"",regAsNew:"",image_link:r?.image_link||"",marital_status:r.marital_status||"",spouse_blood_group:r.spouse_blood_group||"",married_since:r.married_since||"",spouse_name:r.spouse_name||"",aadhar_number:r.aadhar_number||"",custom_fields:r.custom_fields||[]}),je(r?.gender)};B.getPatientDetails({callback:l,payload:t,token_env:{token:f,envName:m}})},[m,f]),Z=a.useCallback((t="")=>{const l=t?.toLowerCase();return M!==""?"":N!==""&&Number(N)<0&&M===""?"Invalid Age":l==="weeks"&&N!==""&&Number(N)<5907||l==="days"&&N!==""&&Number(N)<9999||l==="months"&&N!==""&&Number(N)<1358||l==="years"&&N!==""&&Number(N)<114?"":"Invalid Age"},[M,N]),Je=async t=>{He(!0);const l={branch_id:o?.org_branch_id_for_seg?.toString()||"",person_id:o?.person_id_for_seg||"",person_role_id:o?.doctor_role_id_for_seg||"",patient_role_id:t.person_role_id||""};Ot(l),H({name:!1,phone:!1}),fe(!0),F(t)},Xe=a.useCallback(()=>{let t=!0;return s.name?s.name.length<2&&(u(l=>({...l,name:"Enter at least 2 letters "})),t=!1):(u(l=>({...l,name:"Enter the Name of the Patient"})),t=!1),(g&&g.phone_number_length&&s.phone.length!==10||s.phone.length&&s.phone.length!==10)&&(u(l=>({...l,phone:"Please enter 10 digit number"})),t=!1),s.aadhar_number&&s.aadhar_number.length!=12&&(u(l=>({...l,aadhar_number:"Please enter 12 digit aadhar number"})),t=!1),Z(S).length&&M?.length===0&&(u(l=>({...l,age:"Invalid Age."})),t=!1),Ae===""&&(u(l=>({...l,gender:"Select Gender"})),t=!1),j.email.length&&(s.email&&!st.create$6().email().isValidSync(s.email)&&u(l=>({...l,email:"Email format is wrong"})),t=!1),t},[s.name,s.phone.length,s.aadhar_number,s.email,g,Z,S,M?.length,Ae,j.email.length]),Q=a.useCallback(async(t,l)=>{const r=new FormData;r.append("pid",t),r.append("bidstr",l),r.append("imgData",P);const n=await B.addPatientImage(r,{token:f,envName:m});n.apiError&&v("Error",n.apiError,"Error",3e3)},[P,m,f]),Qe=a.useCallback(async t=>{const l=new FormData;l.append("pid",t);const r=await B.deletePatientImage(l,{token:f,envName:m});r.apiError&&v("Error",r.apiError,"Error",3e3)},[m,f]),Ne=a.useCallback(async(t,l)=>{try{if(!Xe()){v("Invalid form","Please fill in the required fields","Error",3e3);return}if(T&&!k&&!p){v("Consent Required","Please provide patient consent.","Error",3e3);return}const n=new FormData;n.append("name",s.name),n.append("phone",s.phone),n.append("gender",h.getGenderKey(s.gender)),n.append("honorific",s.honorific),n.append("patient_preferred_language",s.patient_preferred_language),n.append("age",M&&M.length?M:h.calculateDate(s?.age,S)||""),n.append("age_selector",s.age_selector),n.append("blood_group",s.blood_group),n.append("email",s.email),n.append("address",s.address),n.append("city",s.city),n.append("existing_bid_str",s.existingBidStr),n.append("pincode",s.pincode),n.append("ref_doc_id",s.refDocId),n.append("ref_doc_name",s.ref_doc_name),n.append("ref_doc_spec",s.ref_doc_spec),n.append("through_channel",s.throughChannel),n.append("care_of",s.careOf),n.append("phone_secondary",s.phoneSecondary),n.append("occupation",s.occupation),n.append("tag",s.tag),n.append("marital_status",s.marital_status),n.append("married_since",s.married_since),n.append("spouse_name",s.spouse_name),n.append("spouse_blood_group",s.spouse_blood_group),n.append("aadhar_number",s.aadhar_number),n.append("custom_fields",JSON.stringify(s.custom_fields||[])),t&&n.append("reg_as_new","1");const c=Object.fromEntries(n.entries()),y=Object.fromEntries(Object.entries(c).map(([te,$t])=>[te,String($t)])),E={...y,custom_fields:JSON.parse(y.custom_fields||"[]"),doctor_role_id:o.doctor_role_id_for_seg||"",doctor_id:o.person_id_for_seg||"",org_branch_id:o.org_branch_id_for_seg||"",source:"emr",ip:""},d=await B.addPatientDetails(E,{token:f,envName:m});if(d.apiError)v("Error",d.apiError,"Error",3e3),ye(!1);else{if(t){try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_();return}else{try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}ee()}d?.conflicts?.length>0?($(!0),W(d.conflicts)):_(),Array.isArray(d?.person)||v("Success","Patient Added Successfully","Success",3e3),d!=null&&!d?.conflicts?.length&&d?.person_role_id&&(l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_())}}catch(r){console.log(r)}},[Xe,T,k,p,s,M,S,o,f,m,D,_,P,Q,g]),Lt=()=>{try{const t={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[h.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[h.EAPP_ROUTES.appointments]:["appointments_mfe"]},l=window.location?.pathname||"",r=t[l];if(!r?.length)return;const n=document.getElementById("react_emr_mfe"),c=document.getElementById("react_curtains_mfe"),y=document.querySelector(".offlineEMR3");[n,c,y].forEach(E=>{E&&E.classList.contains("hidden")&&E.classList.remove("hidden")});for(const E of r){const d=document.getElementsByClassName(E);d.length&&!d[0].classList.contains("hidden")&&d[0].classList.add("hidden")}}catch(t){console.error("Error in manipulating DOM:",t)}},et=a.useCallback(async t=>{const l={patient_id:w?.person_id,honorific:s?.honorific,name:s?.name,gender:s?.gender,age:s?.age,org_person_dob:s?.dob?s.dob:h.calculateDate(s?.age,S)||void 0,phone_number:s?.phone,email:s?.email,blood_group:s?.blood_group,patient_preferred_language:s?.patient_preferred_language,address:s?.address,city:s?.city,pincode:s?.pincode,org_person_bid_str:s?.existingBidStr,ref_doc_name:s?.ref_doc_name,ref_doc_spec:s?.ref_doc_spec,through_channel:s?.throughChannel,ref_doc_id:s?.refDocId,care_of:s?.careOf,phone_secondary:s?.phoneSecondary,occupation:s?.occupation,tag:s?.tag,marital_status:s.marital_status,married_since:s.married_since,spouse_name:s.spouse_name,spouse_blood_group:s.spouse_blood_group,image_link:s?.image_link,remote_consultation_id:"0",oc_status:!1,aadhar_number:s?.aadhar_number,person_role_id:o.doctor_role_id_for_seg||"",person_id:o.person_id_for_seg||"",branch_id:o.org_branch_id_for_seg||""},r=await B.updatePatientDetails(l,{token:f,envName:m});if(p){r&&ye(!1);const{message:n,status:c}=r||{};if(c){v("Patient Edited","Patient Edited Successfully","Success",1500);try{s?.image_link&&!P?Qe(w?.person_role_id):P&&Ve&&(Ee(!1),await Q(w?.person_role_id,s?.existingBidStr))}catch(y){console.log(y)}t!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",w?.person_role_id,w?.person_id,g,D,t):h.goToPage(Pe(t)+w?.person_role_id?.toString()+we(t)),_()}else v("Patient Not Edited",n||"Patient Not Edited","Failure",1500)}},[w?.person_id,w?.person_role_id,s,S,o,f,m,p,D,_,P,Ve,Qe,Q,g]),Mt=async()=>{try{K(!1);const t=await navigator.mediaDevices.getUserMedia({video:!0});q.current&&(q.current.srcObject=t),X(!0)}catch(t){console.error("Error accessing camera:",t)}},Gt=()=>{const t=Ie.current,l=q.current;if(t&&l){t.width=l.videoWidth,t.height=l.videoHeight;const r=t.getContext("2d");if(r){r.drawImage(l,0,0,t.width,t.height);const n=t.toDataURL();le(n),K(!1),X(!1),ee()}}},Ft=()=>{document.getElementById("upload-local-file")?.click()},It=t=>{K(!1),X(!1);const l=t.target.files?.[0];if(!l)return;const r=new FileReader;r.readAsDataURL(l),r.onloadend=()=>{const n=r.result;n&&le(n.toString()),t.target.value=""}},tt=()=>{K(!0),le(""),X(!1),ee()},ee=()=>{if(q.current){const t=q.current.srcObject;t instanceof MediaStream&&t.getTracks().forEach(l=>l.stop()),q.current.srcObject=null}},zt=a.useMemo(()=>[...ne?.patient_config?.custom_fields||[]].sort((r,n)=>r.sort-n.sort).map(r=>{const n=s.custom_fields?.find(c=>c.id===r.id);return{...r,value:n?.value||"",title:n?.value?n?.title:r.title}}),[ne?.patient_config?.custom_fields,s.custom_fields]),Se=(t,l,r)=>{L(n=>{const c=n.custom_fields?.length?n.custom_fields.map(E=>E.id===t?{...E,value:r}:E):[];return c.some(E=>E.id===t)||c.push({id:t,value:r,title:l}),{...n,custom_fields:c}})},Ht=()=>zt?.map(t=>{const{id:l,type:r,value:n,title:c}=t||{};if(!l||!r||!c)return null;switch(r){case"text":return e.jsxRuntimeExports.jsx(e.Pi,{label:c,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:n||"",placeholder:`Enter ${c}`,onChange:y=>{Se(l,c,y.target.value)}},width:"22em"},l);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:c,placeholder:`Select ${c}`,selectDate:n?new Date(n):null,dateVar:y=>{Se(l,c,y.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:y=>{Se(l,c,y)},openUp:!0,backSpaceClearDate:!0},l);default:return null}}),V=a.useCallback(t=>{z(t),p?et(t):Ne(!1,t)},[p,et,Ne]),Vt=a.useCallback(()=>{if(T&&!p&&!k){z("Rx"),U();return}V("Rx")},[T,p,k,U,V]),qt=a.useCallback(()=>{if(T&&!p&&!k){z("Bill"),U();return}V("Bill")},[T,p,k,U,V]),Ut=a.useCallback(()=>{if(T&&!p&&!k){z("Appointment"),U();return}V("Appointment")},[T,p,k,U,V]);return a.useEffect(()=>{k&&I&&(V(I),z(null))},[k,I,V]),e.jsxRuntimeExports.jsx(at.Modal,{isOpen:G,onRequestClose:()=>{ee(),_()},shouldCloseOnOverlayClick:!1,style:{content:{zIndex:1030,padding:"0px",maxWidth:"840px",maxHeight:"624px",margin:"auto",borderRadius:"12px"},overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",zIndex:1030}},children:e.jsxRuntimeExports.jsxs("div",{id:"add-patient-modal",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-16 hfl-w-full hfl-flex-row hfl-items-center hfl-justify-between hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-6",id:"add-patient-header","data-qa":"testid_addPatient",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xl",children:J?"Patient(s) with Same phone number or Email":"Add New Patient"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-items-center",children:e.jsxRuntimeExports.jsx("span",{className:"hx_close hfl-ml-4 hover:hfl-cursor-pointer",onClick:()=>{ee(),_()}})})]}),J?e.jsxRuntimeExports.jsx(Yt,{conflicts:O,handleAddPatient:Ne,redirectAction:I,manipulateExistingDOM:Lt}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-min-h-[400px] hfl-px-10 hfl-py-5",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:e.jsxRuntimeExports.jsxs("div",{ref:ve,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>be(t=>!t),children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:Me}),!Me.length&&e.jsxRuntimeExports.jsx("div",{className:`${Fe?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:j.name?j.name:void 0,inputProps:{type:"text",value:ke,placeholder:"Enter Name",onChange:t=>{i("name",t.target.value)},onBlur:()=>{const t=!(s.name.length>0);s.name.length>0&&s.name.length<2&&!Et?u(l=>({...l,name:"Enter at least 2 letters "})):u(l=>({...l,name:t?"Enter the Name of the Patient":""})),He(!1),H({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Fe&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-h-[270px] hfl-w-20 hfl-flex-col hfl-overflow-y-auto hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},children:x.HonorificList.map(t=>e.jsxRuntimeExports.jsx(e.ki,{className:"hfl-text-Primary-700",label:t.label,onSelect:()=>{Ge(t.label),be(!1),je(t.gender),i("honorific",t.label),i("gender",t.gender),L(l=>({...l,gender:t.gender,honorific:t.label}))}}))}),ae.name&&ke.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[16px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t?.org_person_name?.length>13?t?.org_person_name?.substring(0,11)+"...":t?.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone||""})]},t?.person_role_id))]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-gap-3",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:`Phone Number ${g&&g.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:j.phone?j.phone:void 0,inputProps:{maxLength:10,value:A,placeholder:"Enter Number",onChange:t=>{i("phone",t.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:t=!1,msg:l=""}=g&&g.phone_number_length||A?h.validateMobileNo(A):{};u(r=>({...r,phone:t?l:""})),H({name:!1,phone:!1})}},width:"21em",start_icon:"hx_phone"}),ae.phone&&A.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[24px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t.org_person_name?.length>13?t.org_person_name?.substring(0,11)+"...":t.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone})]},t?.person_role_id))]})]})})]}),T&&!p&&qe&&e.jsxRuntimeExports.jsx(Kt,{isOpen:qe,onClose:()=>Re(!1),onSubmit:t=>Bt(t),optHeading:"Verify with a OTP",otpSubHeading:`Please enter the OTP shared on ${A}`,veriftButtonTitle:"Verify OTP",resendOtp:U,otpErrorMsg:"",setOtpErrorMsg:()=>{}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-h-[40px] hfl-space-y-1",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-pb-[1px] hfl-text-Gray-600",children:"Gender*"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.ju,{className:`!hfl-h-[40px] hfl-w-44 ${j.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:_t,onChange:t=>Ce(t),disabled:!1}),!!j.gender&&e.jsxRuntimeExports.jsx("div",{className:"hfl-font-inter hfl-text-1 hfl-font-inter-0 hfl-leading-10 hfl-tracking-1 hfl-text-Error-500",children:j.gender})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.tj,{label:"Age or DOB*",className:"hfl-w-20",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-w-16 hfl-border-0",suffixDropdownClassName:"hfl-ml-[80px]",input1value:s.age,input2value:S,end_icon:"hx_down",errorMsg:j.age?j.age:void 0,inputProps:{type:"number",min:0,maxLength:3,placeholder:"Age",onChange:t=>{i("age",t.target.value.replace(/[^0-9]/g,"")),L(l=>({...l,dob:""}))},onBlur:()=>{u(t=>({...t,age:Z(S)}))}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"Select format"},suffixOptions:[{label:"Years",value:"years"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Days",value:"days"}],handleValChange:t=>{i("age",t),u(l=>({...l,age:Z(S)}))},handleSuffixValChange:t=>{Le(t),u(l=>({...l,age:Z(t)}))},onSuffixDropdownClick:t=>{Le(t.label),L(l=>({...l,age_selector:t.value,dob:""})),u(l=>({...l,age:Z(t.value)}))}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"DOB",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.dob&&h.isValidDate(new Date(s?.dob))?new Date(oe.dayjs(new Date(s?.dob)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,dob:oe.dayjs(t).format("YYYY-MM-DD"),age:""})),u(l=>({...l,age:""}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:s?.patient_preferred_language?x.DefinedLanguages[s.patient_preferred_language]:"English"},placeholder:"English",label:"Preferred Language",onChange:t=>{i("patient_preferred_language",t.value)},options:Object.keys(x.DefinedLanguages).map(t=>({label:x.DefinedLanguages[t],value:t})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"dropdown-language"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-6/12 hfl-flex-col ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"City",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.city,placeholder:"Enter City",onChange:t=>{i("city",t.target.value),ge(!0),St(t)},onBlur:t=>{t.stopPropagation(),ge(!1)}},width:23.5+"em"}),ut&&_e&&_e.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:_e.map(t=>e.jsxRuntimeExports.jsx(e.ki,{label:t,className:"hfl-text-Primary-700",onSelect:()=>wt(t)}))})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-pt-4",children:e.jsxRuntimeExports.jsx(e.Pi,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.pincode,placeholder:"Enter Pin",onChange:t=>{i("pincode",t.target.value)}},width:22.5+"em"})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-col",style:{height:"100%"},children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-w-[355px]",label:"Address",inputProps:{value:s?.address,placeholder:"Enter Address",onChange:t=>{i("address",t.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),de?e.jsxRuntimeExports.jsx(Wt,{setEditPatient:se,editPatient:p,createAsNew:Y,setCreateAsNew:he}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),Be?e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pb-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Marital Status"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:s.marital_status&&x.MARITAL_STATUS.find(t=>t===s.marital_status)||""},placeholder:"Marital Status",label:"Marital Status",onChange:t=>{i("marital_status",t.label)},options:x.MARITAL_STATUS.map(t=>({label:t,value:t})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"marital-status"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-flex hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"Since",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.married_since&&h.isValidDate(new Date(s?.married_since))?new Date(oe.dayjs(new Date(s?.married_since)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,married_since:oe.dayjs(t).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:s.blood_group&&x.bloodGroups.find(t=>t.value===s.blood_group)?.label||"Blood group"},onChange:t=>{i("blood_group",t.value)},options:x.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),s?.marital_status!==x.MARITAL_STATUS[0]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Spouse Name",start_icon:"hx_person",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.spouse_name,placeholder:"Enter Spouse Name",onChange:t=>{i("spouse_name",t.target.value)}},width:"21em"}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:s.spouse_blood_group?x.bloodGroups.find(t=>t.value===s.spouse_blood_group)?.label||"Spouse Blood group":"Blood group"},onChange:t=>{i("spouse_blood_group",t.value)},options:x.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:e.jsxRuntimeExports.jsx(e.tj,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:s.ref_doc_name,input2value:s.ref_doc_spec,end_icon:"hx_down",inputProps:{placeholder:"Doctor Name"},suffixInputProps:{placeholder:"Speciality"},className:"hfl-w-48",suffixClassName:"hfl-w-[100px]",suffixDropdownClassName:"hfl-ml-[160px]",options:mt,suffixOptions:x.SpecialityList,handleValChange:t=>{i("ref_doc_name",t)},handleSuffixValChange:t=>{i("ref_doc_spec",t.value)},onDropdownClick:t=>{i("ref_doc_name",t.doctor_name),i("refDocId",t.doctor_id),i("ref_doc_spec",t.specialist)},onSuffixDropdownClick:t=>{i("ref_doc_spec",t.value)}})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-4",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Existing ID (if any)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.existingBidStr,placeholder:"Enter ID",onChange:t=>{i("existingBidStr",t.target.value)}},width:"23em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Email",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:j.email?j.email:void 0,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:s.email,placeholder:"Enter Email",onChange:t=>{i("email",t.target.value.trim())},onBlur:t=>{t.target.value&&!st.create$6().email().isValidSync(t.target.value)?u(l=>({...l,email:"Email format is wrong"})):u(l=>({...l,email:""}))}},width:20.5+"em"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-flex-row hfl-flex-wrap hfl-justify-between hfl-gap-y-6 hfl-py-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Channel (How did the patient hear about you?)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.throughChannel,placeholder:"Enter Channel",onChange:t=>{i("throughChannel",t.target.value),xe(!0),Pt(t)},onBlur:t=>{t.stopPropagation(),xe(!1)}},width:"22em"}),ft&&ce&&ce.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:ce.map(t=>{const{title:l,...r}=t;return e.jsxRuntimeExports.jsx(e.ki,{label:l,className:"hfl-text-Primary-700",...r,onSelect:()=>vt({value:t.value})},t.value)})})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.careOf,placeholder:"Enter C/O",onChange:t=>{i("careOf",t.target.value)}},width:"22em"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Occupation",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.occupation,placeholder:"Enter Occupation",onChange:t=>{i("occupation",t.target.value),me(!0),Nt(t)},onBlur:t=>{t.stopPropagation(),me(!1)}},width:"22em"}),ct&&ue&&ue.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:ue.map(t=>e.jsxRuntimeExports.jsx(e.ki,{label:t,className:"hfl-text-Primary-700",onSelect:()=>Ct(t)}))})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.tag,placeholder:"Enter Tag",onChange:t=>{i("tag",t.target.value)}},width:"22em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Mobile 2",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.phoneSecondary,maxLength:10,placeholder:"Enter Secondary Number",onChange:t=>{i("phoneSecondary",t.target.value.replace(/[^0-9]/g,""))}},width:"22em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Aadhar Number",labelColor:"hfl-text-Gray-600",errorMsg:j.aadhar_number?j.aadhar_number:void 0,labelSize:"Text sm",inputProps:{value:s.aadhar_number,placeholder:"Aadhar Card Number",maxLength:12,onChange:t=>{i("aadhar_number",t.target.value)},onBlur:()=>{u(t=>({...t,aadhar_number:s.aadhar_number&&s.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-11 hfl-gap-y-6",children:Ht()})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-h-[153px] hfl-w-[200px] hfl-items-center hfl-justify-center
1
+ "use strict";const e=require("./index-D5vZvm7Z.cjs");;/* empty css */const at=require("./index-CZONCDCp.cjs"),a=require("react"),st=require("./index.esm-BdlMQ1M7.cjs"),oe=require("./dayjs.min-BawXyS7V.cjs"),h=require("./common-utils-BcaBj1Iw.cjs"),x=require("./CommonConstant-COHqiSWL.cjs"),B=require("./APIAction-Dv5KBo81.cjs"),lt=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Yt=({conflicts:R,handleAddPatient:_,redirectAction:G})=>{const[C,b]=a.useState(!1);return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-[20%] hfl-my-5 hfl-text-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Error-700",children:"Patient/s with similar information already exists in your Clinic. To continue with an existing patient click on “Continue."})}),e.jsxRuntimeExports.jsxs("table",{className:"hfl-mx-7",children:[e.jsxRuntimeExports.jsx("thead",{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full",children:[e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[40px] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"#"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Name"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Phone No"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Email"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Branch"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-rounded-tr hfl-border-b hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]"})]})}),R.map((o,f)=>e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full hfl-border-1 hfl-border-Gray-100",children:[e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:f+1})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:o.org_person_name||o.name})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_phone||o.phone})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_email||o.email})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:"In Same Branch"})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:window.role_id=="11"&&e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"Continue",className:"hfl-text-Primary-700",onClick:()=>h.goToPatientDashboard(o.person_role_id)})})]}))]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-my-7 hfl-flex hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Success-800",children:"If your patient is not in the above list"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.Ku,{disabled:C,hierarchy:"Primary",size:"xl",textField:"Create As New Patient",className:"hfl-bg-Primary-700",onClick:()=>{b(!0),_(!0,G)}})})]})};function Wt(R){const{editPatient:_,setEditPatient:G,createAsNew:C,setCreateAsNew:b}=R,o=()=>_?"Primary":"Secondary",f=()=>C?"Primary":"Secondary";return e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-6 hfl-flex hfl-h-20 hfl-w-full hfl-items-center hfl-justify-center hfl-gap-4 hfl-border-1 hfl-border-Error-200 hfl-bg-Error-25",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"Are you updating"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:o(),size:"lg",textField:"Exisitng Patient",onClick:()=>{G(!0),b(!1)}}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"or creating a"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:f(),size:"lg",textField:"New Patient",onClick:()=>{b(!0),G(!1)}})]})}const De=15,rt=3,Kt=({isOpen:R,onClose:_,onSubmit:G,otpErrorMsg:C,setOtpErrorMsg:b,optHeading:o,otpSubHeading:f,veriftButtonTitle:m,resendOtp:J})=>{const[$,w]=a.useState(""),[F,p]=a.useState(De),[se,I]=a.useState(!1),[z,Y]=a.useState(0);a.useEffect(()=>{R&&(w(""),b(""),p(De),I(!1),Y(0))},[R,b]),a.useEffect(()=>{if(F>0&&R){const O=setInterval(()=>{p(W=>W-1)},1e3);return()=>clearInterval(O)}else F===0&&R&&I(!0)},[F,R]);const he=O=>{O.preventDefault(),String($).length===6&&G($)},de=O=>{C&&b("");const W=O.target.value;/^\d*$/.test(W)&&w(W)},fe=()=>{se&&z<rt&&(J(),Y(O=>O+1),p(De),I(!1))};return e.jsxRuntimeExports.jsxs(at.Modal,{isOpen:R,onRequestClose:_,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1032},content:{maxWidth:"400px",maxHeight:"350px",display:"flex",flexDirection:"column",justifyContent:"center",padding:"24px",margin:"auto",borderRadius:"12px"}},ariaHideApp:!1,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-justify-end",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary-Grey",icon:"Only",iconFile:"hx_close",onClick:_,size:"md",textField:""})}),e.jsxRuntimeExports.jsxs("form",{className:"hfl-z-5 hfl-relative hfl-flex hfl-h-full hfl-flex-col hfl-items-center hfl-justify-center hfl-text-center",onSubmit:he,children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:o}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-mx-auto hfl-w-[290px] hfl-pt-2 hfl-text-Gray-500",children:f}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-auto hfl-max-h-[150px] hfl-w-[315px] hfl-py-5",children:e.jsxRuntimeExports.jsx(e.wu,{inputProps:{autoFocus:!0,value:$,pattern:"[0-9]+",onChange:de},size:"xs",digits:6,errorMsg:C})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mb-4 hfl-h-4",children:z>=rt?e.jsxRuntimeExports.jsx(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Error-500",children:"Maximum resend attempts reached."}):se?e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-cursor-pointer hfl-text-Primary-700 hfl-underline",onClick:fe,children:"Resend OTP"}):e.jsxRuntimeExports.jsxs(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Gray-500",children:["Resend OTP in 00:",F<10?`0${F}`:F]})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:m,disabled:String($).length<6})]})]})},Zt=R=>{const{closeModal:_,modalIsOpen:G,pref:C,variable:b}=R,{window_var:o,token:f,envName:m}=b,[J,$]=a.useState(!1),[w,F]=a.useState({}),[p,se]=a.useState(!1),[I,z]=a.useState(null),[Y,he]=a.useState(!0),[de,fe]=a.useState(!1),[O,W]=a.useState([]),[Te,K]=a.useState(!1),[P,le]=a.useState(""),[g,nt]=a.useState(),[j,u]=a.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[re,it]=a.useState([]),[ae,H]=a.useState({name:!1,phone:!1}),[ce,ot]=a.useState([]),[ue,ht]=a.useState([]),[pe,dt]=a.useState([]),[ft,xe]=a.useState(!1),[ct,me]=a.useState(!1),[ut,ge]=a.useState(!1),[_e,pt]=a.useState([]),[k,xt]=a.useState(!1),[s,L]=a.useState({name:"",phone:"",dob:"",gender:"",honorific:"",patient_preferred_language:C?.visit_pad_json?JSON.parse(C?.visit_pad_json)?.defaultLanguage?.rows:"",age:"",age_selector:"years",blood_group:"",email:"",address:"",city:"",existingBidStr:"",pincode:"",ref_doc_name:"",ref_doc_spec:"",temp_appnt_id:"",throughChannel:"",refDocId:"",careOf:"",phoneSecondary:"",occupation:"",tag:"",phone_otp:"",regAsNew:"",image_link:"",marital_status:"",spouse_blood_group:"",married_since:"",spouse_name:"",org_person_dob:"",aadhar_number:"",custom_fields:[]}),[mt,gt]=a.useState([]),{name:ke,phone:A,age:N,dob:M,gender:Ae}=s,[Be,Oe]=a.useState(!1),[_t,je]=a.useState(s.gender),[S,Le]=a.useState("Years"),[Me,Ge]=a.useState(""),[Fe,be]=a.useState(!1),[jt,bt]=a.useState([]),v=(t,l,r,n)=>{bt([{id:1,title:t,description:l,type:r,duration:n}])},q=a.useRef(null),Ie=a.useRef(null),[ze,X]=a.useState(!1),[yt,ye]=a.useState(!1),[Et,He]=a.useState(!1),[Ve,Ee]=a.useState(!1),[qe,Re]=a.useState(!1),[ne,Rt]=a.useState(),D=g&&g.visit_pad_json&&h.isJson(g.visit_pad_json)&&JSON.parse(g.visit_pad_json),Ue=h.debounceFn((...t)=>{const[l,r]=t;At(l,r)}),i=a.useCallback((t,l)=>{ye(!1),L(r=>({...r,[t]:l})),(t==="name"||t==="phone"&&l.length>=3)&&Ue(t,l)},[Ue]),vt=t=>{i("throughChannel",t.value.trim()),xe(!1)},T=a.useMemo(()=>ne?.branch_details?.enable_mobile_otp=="1",[ne?.branch_details?.enable_mobile_otp]),Ct=t=>{i("occupation",t.trim()),me(!1)},wt=t=>{i("city",t.trim()),ge(!1)},Pt=t=>{const{value:l}=t.target,r=Dt(l);ot(r)},Nt=t=>{const{value:l}=t.target,r=Tt(l);ht(r)},St=t=>{const{value:l}=t.target,r=kt(l);pt(r)},Dt=t=>{if(pe?.length){let l=pe;return t?.length&&(l=pe.filter(r=>r.title.toLowerCase().includes(t.toLowerCase()))),l}else return[]},Tt=t=>{if(x.OccupationList?.length){let l=x.OccupationList;return t?.length&&(l=x.OccupationList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},kt=t=>{if(x.CityList?.length){let l=x.CityList;return t?.length&&(l=x.CityList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},$e=a.useRef(null),ie=a.useRef(null),ve=a.useRef(null),Ye=window.location?.pathname.includes("/frontdesk");a.useEffect(()=>{const t=h.calculateDOB(s.age,S);t&&L(l=>({...l,dob:t}))},[S,s.age]);const Ce=a.useCallback(t=>{je(t),i("gender",t),u(l=>({...l,gender:""}))},[i]),We=t=>{($e.current&&!$e.current.contains(t.target)||ie.current&&!ie.current.contains(t.target))&&H({name:!1,phone:!1}),ve.current&&!ve.current.contains(t.target)&&be(!1)},Ke=a.useCallback(()=>{le(s.image_link),K(!1),X(!1)},[s.image_link]),Ze=a.useCallback(async()=>{const t=await B.getBranchPreferences("patient_config",o?.org_branch_id_for_seg?.toString()||"",{token:f,envName:m});Rt(t)},[f,m,o?.org_branch_id_for_seg]);a.useEffect(()=>(document.addEventListener("mousedown",We),()=>{document.removeEventListener("mousedown",We)}),[]),a.useEffect(()=>{o.doctor_speciality==="Gynaecologist"&&!s.gender&&Ce("1")},[s.gender,Ce,o.doctor_speciality]),a.useEffect(()=>{s.image_link&&Ke(),s.honorific&&Ge(s.honorific)},[s.honorific,s.image_link,Ke]),a.useEffect(()=>{Ye&&Oe(!0)},[Ye]),a.useEffect(()=>{Ze()},[Ze]),a.useEffect(()=>{(async()=>{nt(C);try{const t=await B.getReferredByList({token:f,envName:m}),{total_ref_doc_details:l,through_channel:r}=t;l.length&&gt(h.parseReferredByDocList(l)),r.length&&dt(h.parseThroughChannelList(r))}catch(t){console.log("ERROR",t)}})()},[C,f,m]);const At=async(t,l)=>{const r={branch_id:o?.org_branch_id_for_seg||"",doctor_id:o?.person_id_for_seg||"",doctor_role_id:o?.doctor_role_id_for_seg||"",term:encodeURIComponent(l),limit:30},n=await B.getPatientList(r,{token:f,envName:m});if(!n){H({name:!1,phone:!1});return}!n.apiError&&Number(n.total_persons)>0?(it(n.persons),H(t==="name"?{...ae,name:!0}:{...ae,phone:!0})):H({name:!1,phone:!1})},U=a.useCallback(async()=>{if(!T||!Y)return;Re(!0),(await B.patientConsentSendOTP(A,b)).apiError?v("OTP Failed","Unable to send OTP. Please try again.","Error",3e3):v("Success","OTP sent successfully","Success",1500)},[T,Y,A,b]),Bt=a.useCallback(async t=>{(await B.patientConsentOTPVerification(A,t,b)).apiError?v("Invalid OTP","Please enter correct OTP","Error",3e3):(xt(!0),v("Success","OTP verified successfully","Success",1500),Re(!1))},[A,b]),we=t=>{switch(t){case"Appointment":return"#Appnt";default:return""}},Pe=t=>{switch(t){case"Bill":case"Appointment":return"emrPatientPopUp.php?pid=";default:return h.EAPP_ROUTES.visitpad+"?pid="}},Ot=a.useCallback(t=>{const l=r=>{L({name:r?.name||"",phone:r?.phone_number||"",gender:r?.gender||"",honorific:r?.honorific||"",patient_preferred_language:r?.patient_preferred_language||"",ref_doc_spec:r?.ref_doc_spec||"",age:r?.age.toString()||"",age_selector:"2",dob:r.org_person_dob||"",org_person_dob:r.org_person_dob||"",blood_group:r?.blood_group||"",email:r?.email||"",address:r?.address||"",city:r?.city||"",existingBidStr:r?.org_person_bid_str||"",pincode:r?.pincode||"",ref_doc_name:r?.ref_doc_name||"",temp_appnt_id:"",throughChannel:r?.through_channel||"",refDocId:r?.ref_doc_id||"",careOf:r?.care_of||"",phoneSecondary:r?.phone_secondary||"",occupation:r?.occupation||"",tag:r?.tag||"",phone_otp:"",regAsNew:"",image_link:r?.image_link||"",marital_status:r.marital_status||"",spouse_blood_group:r.spouse_blood_group||"",married_since:r.married_since||"",spouse_name:r.spouse_name||"",aadhar_number:r.aadhar_number||"",custom_fields:r.custom_fields||[]}),je(r?.gender)};B.getPatientDetails({callback:l,payload:t,token_env:{token:f,envName:m}})},[m,f]),Z=a.useCallback((t="")=>{const l=t?.toLowerCase();return M!==""?"":N!==""&&Number(N)<0&&M===""?"Invalid Age":l==="weeks"&&N!==""&&Number(N)<5907||l==="days"&&N!==""&&Number(N)<9999||l==="months"&&N!==""&&Number(N)<1358||l==="years"&&N!==""&&Number(N)<114?"":"Invalid Age"},[M,N]),Je=async t=>{He(!0);const l={branch_id:o?.org_branch_id_for_seg?.toString()||"",person_id:o?.person_id_for_seg||"",person_role_id:o?.doctor_role_id_for_seg||"",patient_role_id:t.person_role_id||""};Ot(l),H({name:!1,phone:!1}),fe(!0),F(t)},Xe=a.useCallback(()=>{let t=!0;return s.name?s.name.length<2&&(u(l=>({...l,name:"Enter at least 2 letters "})),t=!1):(u(l=>({...l,name:"Enter the Name of the Patient"})),t=!1),(g&&g.phone_number_length&&s.phone.length!==10||s.phone.length&&s.phone.length!==10)&&(u(l=>({...l,phone:"Please enter 10 digit number"})),t=!1),s.aadhar_number&&s.aadhar_number.length!=12&&(u(l=>({...l,aadhar_number:"Please enter 12 digit aadhar number"})),t=!1),Z(S).length&&M?.length===0&&(u(l=>({...l,age:"Invalid Age."})),t=!1),Ae===""&&(u(l=>({...l,gender:"Select Gender"})),t=!1),j.email.length&&(s.email&&!st.create$6().email().isValidSync(s.email)&&u(l=>({...l,email:"Email format is wrong"})),t=!1),t},[s.name,s.phone.length,s.aadhar_number,s.email,g,Z,S,M?.length,Ae,j.email.length]),Q=a.useCallback(async(t,l)=>{const r=new FormData;r.append("pid",t),r.append("bidstr",l),r.append("imgData",P);const n=await B.addPatientImage(r,{token:f,envName:m});n.apiError&&v("Error",n.apiError,"Error",3e3)},[P,m,f]),Qe=a.useCallback(async t=>{const l=new FormData;l.append("pid",t);const r=await B.deletePatientImage(l,{token:f,envName:m});r.apiError&&v("Error",r.apiError,"Error",3e3)},[m,f]),Ne=a.useCallback(async(t,l)=>{try{if(!Xe()){v("Invalid form","Please fill in the required fields","Error",3e3);return}if(T&&!k&&!p){v("Consent Required","Please provide patient consent.","Error",3e3);return}const n=new FormData;n.append("name",s.name),n.append("phone",s.phone),n.append("gender",h.getGenderKey(s.gender)),n.append("honorific",s.honorific),n.append("patient_preferred_language",s.patient_preferred_language),n.append("age",M&&M.length?M:h.calculateDate(s?.age,S)||""),n.append("age_selector",s.age_selector),n.append("blood_group",s.blood_group),n.append("email",s.email),n.append("address",s.address),n.append("city",s.city),n.append("existing_bid_str",s.existingBidStr),n.append("pincode",s.pincode),n.append("ref_doc_id",s.refDocId),n.append("ref_doc_name",s.ref_doc_name),n.append("ref_doc_spec",s.ref_doc_spec),n.append("through_channel",s.throughChannel),n.append("care_of",s.careOf),n.append("phone_secondary",s.phoneSecondary),n.append("occupation",s.occupation),n.append("tag",s.tag),n.append("marital_status",s.marital_status),n.append("married_since",s.married_since),n.append("spouse_name",s.spouse_name),n.append("spouse_blood_group",s.spouse_blood_group),n.append("aadhar_number",s.aadhar_number),n.append("custom_fields",JSON.stringify(s.custom_fields||[])),t&&n.append("reg_as_new","1");const c=Object.fromEntries(n.entries()),y=Object.fromEntries(Object.entries(c).map(([te,$t])=>[te,String($t)])),E={...y,custom_fields:JSON.parse(y.custom_fields||"[]"),doctor_role_id:o.doctor_role_id_for_seg||"",doctor_id:o.person_id_for_seg||"",org_branch_id:o.org_branch_id_for_seg||"",source:"emr",ip:""},d=await B.addPatientDetails(E,{token:f,envName:m});if(d.apiError)v("Error",d.apiError,"Error",3e3),ye(!1);else{if(t){try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_();return}else{try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}ee()}d?.conflicts?.length>0?($(!0),W(d.conflicts)):_(),Array.isArray(d?.person)||v("Success","Patient Added Successfully","Success",3e3),d!=null&&!d?.conflicts?.length&&d?.person_role_id&&(l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_())}}catch(r){console.log(r)}},[Xe,T,k,p,s,M,S,o,f,m,D,_,P,Q,g]),Lt=()=>{try{const t={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[h.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[h.EAPP_ROUTES.appointments]:["appointments_mfe"]},l=window.location?.pathname||"",r=t[l];if(!r?.length)return;const n=document.getElementById("react_emr_mfe"),c=document.getElementById("react_curtains_mfe"),y=document.querySelector(".offlineEMR3");[n,c,y].forEach(E=>{E&&E.classList.contains("hidden")&&E.classList.remove("hidden")});for(const E of r){const d=document.getElementsByClassName(E);d.length&&!d[0].classList.contains("hidden")&&d[0].classList.add("hidden")}}catch(t){console.error("Error in manipulating DOM:",t)}},et=a.useCallback(async t=>{const l={patient_id:w?.person_id,honorific:s?.honorific,name:s?.name,gender:s?.gender,age:s?.age,org_person_dob:s?.dob?s.dob:h.calculateDate(s?.age,S)||void 0,phone_number:s?.phone,email:s?.email,blood_group:s?.blood_group,patient_preferred_language:s?.patient_preferred_language,address:s?.address,city:s?.city,pincode:s?.pincode,org_person_bid_str:s?.existingBidStr,ref_doc_name:s?.ref_doc_name,ref_doc_spec:s?.ref_doc_spec,through_channel:s?.throughChannel,ref_doc_id:s?.refDocId,care_of:s?.careOf,phone_secondary:s?.phoneSecondary,occupation:s?.occupation,tag:s?.tag,marital_status:s.marital_status,married_since:s.married_since,spouse_name:s.spouse_name,spouse_blood_group:s.spouse_blood_group,image_link:s?.image_link,remote_consultation_id:"0",oc_status:!1,aadhar_number:s?.aadhar_number,person_role_id:o.doctor_role_id_for_seg||"",person_id:o.person_id_for_seg||"",branch_id:o.org_branch_id_for_seg||""},r=await B.updatePatientDetails(l,{token:f,envName:m});if(p){r&&ye(!1);const{message:n,status:c}=r||{};if(c){v("Patient Edited","Patient Edited Successfully","Success",1500);try{s?.image_link&&!P?Qe(w?.person_role_id):P&&Ve&&(Ee(!1),await Q(w?.person_role_id,s?.existingBidStr))}catch(y){console.log(y)}t!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",w?.person_role_id,w?.person_id,g,D,t):h.goToPage(Pe(t)+w?.person_role_id?.toString()+we(t)),_()}else v("Patient Not Edited",n||"Patient Not Edited","Failure",1500)}},[w?.person_id,w?.person_role_id,s,S,o,f,m,p,D,_,P,Ve,Qe,Q,g]),Mt=async()=>{try{K(!1);const t=await navigator.mediaDevices.getUserMedia({video:!0});q.current&&(q.current.srcObject=t),X(!0)}catch(t){console.error("Error accessing camera:",t)}},Gt=()=>{const t=Ie.current,l=q.current;if(t&&l){t.width=l.videoWidth,t.height=l.videoHeight;const r=t.getContext("2d");if(r){r.drawImage(l,0,0,t.width,t.height);const n=t.toDataURL();le(n),K(!1),X(!1),ee()}}},Ft=()=>{document.getElementById("upload-local-file")?.click()},It=t=>{K(!1),X(!1);const l=t.target.files?.[0];if(!l)return;const r=new FileReader;r.readAsDataURL(l),r.onloadend=()=>{const n=r.result;n&&le(n.toString()),t.target.value=""}},tt=()=>{K(!0),le(""),X(!1),ee()},ee=()=>{if(q.current){const t=q.current.srcObject;t instanceof MediaStream&&t.getTracks().forEach(l=>l.stop()),q.current.srcObject=null}},zt=a.useMemo(()=>[...ne?.patient_config?.custom_fields||[]].sort((r,n)=>r.sort-n.sort).map(r=>{const n=s.custom_fields?.find(c=>c.id===r.id);return{...r,value:n?.value||"",title:n?.value?n?.title:r.title}}),[ne?.patient_config?.custom_fields,s.custom_fields]),Se=(t,l,r)=>{L(n=>{const c=n.custom_fields?.length?n.custom_fields.map(E=>E.id===t?{...E,value:r}:E):[];return c.some(E=>E.id===t)||c.push({id:t,value:r,title:l}),{...n,custom_fields:c}})},Ht=()=>zt?.map(t=>{const{id:l,type:r,value:n,title:c}=t||{};if(!l||!r||!c)return null;switch(r){case"text":return e.jsxRuntimeExports.jsx(e.Pi,{label:c,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:n||"",placeholder:`Enter ${c}`,onChange:y=>{Se(l,c,y.target.value)}},width:"22em"},l);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:c,placeholder:`Select ${c}`,selectDate:n?new Date(n):null,dateVar:y=>{Se(l,c,y.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:y=>{Se(l,c,y)},openUp:!0,backSpaceClearDate:!0},l);default:return null}}),V=a.useCallback(t=>{z(t),p?et(t):Ne(!1,t)},[p,et,Ne]),Vt=a.useCallback(()=>{if(T&&!p&&!k){z("Rx"),U();return}V("Rx")},[T,p,k,U,V]),qt=a.useCallback(()=>{if(T&&!p&&!k){z("Bill"),U();return}V("Bill")},[T,p,k,U,V]),Ut=a.useCallback(()=>{if(T&&!p&&!k){z("Appointment"),U();return}V("Appointment")},[T,p,k,U,V]);return a.useEffect(()=>{k&&I&&(V(I),z(null))},[k,I,V]),e.jsxRuntimeExports.jsx(at.Modal,{isOpen:G,onRequestClose:()=>{ee(),_()},shouldCloseOnOverlayClick:!1,style:{content:{zIndex:1030,padding:"0px",maxWidth:"840px",maxHeight:"624px",margin:"auto",borderRadius:"12px"},overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",zIndex:1030}},children:e.jsxRuntimeExports.jsxs("div",{id:"add-patient-modal",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-16 hfl-w-full hfl-flex-row hfl-items-center hfl-justify-between hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-6",id:"add-patient-header","data-qa":"testid_addPatient",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xl",children:J?"Patient(s) with Same phone number or Email":"Add New Patient"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-items-center",children:e.jsxRuntimeExports.jsx("span",{className:"hx_close hfl-ml-4 hover:hfl-cursor-pointer",onClick:()=>{ee(),_()}})})]}),J?e.jsxRuntimeExports.jsx(Yt,{conflicts:O,handleAddPatient:Ne,redirectAction:I,manipulateExistingDOM:Lt}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-min-h-[400px] hfl-px-10 hfl-py-5",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:e.jsxRuntimeExports.jsxs("div",{ref:ve,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>be(t=>!t),children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:Me}),!Me.length&&e.jsxRuntimeExports.jsx("div",{className:`${Fe?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:j.name?j.name:void 0,inputProps:{type:"text",value:ke,placeholder:"Enter Name",onChange:t=>{i("name",t.target.value)},onBlur:()=>{const t=!(s.name.length>0);s.name.length>0&&s.name.length<2&&!Et?u(l=>({...l,name:"Enter at least 2 letters "})):u(l=>({...l,name:t?"Enter the Name of the Patient":""})),He(!1),H({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Fe&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-h-[270px] hfl-w-20 hfl-flex-col hfl-overflow-y-auto hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},children:x.HonorificList.map(t=>e.jsxRuntimeExports.jsx(e.ki,{className:"hfl-text-Primary-700",label:t.label,onSelect:()=>{Ge(t.label),be(!1),je(t.gender),i("honorific",t.label),i("gender",t.gender),L(l=>({...l,gender:t.gender,honorific:t.label}))}}))}),ae.name&&ke.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[16px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t?.org_person_name?.length>13?t?.org_person_name?.substring(0,11)+"...":t?.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone||""})]},t?.person_role_id))]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-gap-3",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:`Phone Number ${g&&g.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:j.phone?j.phone:void 0,inputProps:{maxLength:10,value:A,placeholder:"Enter Number",onChange:t=>{i("phone",t.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:t=!1,msg:l=""}=g&&g.phone_number_length||A?h.validateMobileNo(A):{};u(r=>({...r,phone:t?l:""})),H({name:!1,phone:!1})}},width:"21em",start_icon:"hx_phone"}),ae.phone&&A.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[24px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t.org_person_name?.length>13?t.org_person_name?.substring(0,11)+"...":t.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone})]},t?.person_role_id))]})]})})]}),T&&!p&&qe&&e.jsxRuntimeExports.jsx(Kt,{isOpen:qe,onClose:()=>Re(!1),onSubmit:t=>Bt(t),optHeading:"Verify with a OTP",otpSubHeading:`Please enter the OTP shared on ${A}`,veriftButtonTitle:"Verify OTP",resendOtp:U,otpErrorMsg:"",setOtpErrorMsg:()=>{}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-h-[40px] hfl-space-y-1",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-pb-[1px] hfl-text-Gray-600",children:"Gender*"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.ju,{className:`!hfl-h-[40px] hfl-w-44 ${j.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:_t,onChange:t=>Ce(t),disabled:!1}),!!j.gender&&e.jsxRuntimeExports.jsx("div",{className:"hfl-font-inter hfl-text-1 hfl-font-inter-0 hfl-leading-10 hfl-tracking-1 hfl-text-Error-500",children:j.gender})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.tj,{label:"Age or DOB*",className:"hfl-w-20",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-w-16 hfl-border-0",suffixDropdownClassName:"hfl-ml-[80px]",input1value:s.age,input2value:S,end_icon:"hx_down",errorMsg:j.age?j.age:void 0,inputProps:{type:"number",min:0,maxLength:3,placeholder:"Age",onChange:t=>{i("age",t.target.value.replace(/[^0-9]/g,"")),L(l=>({...l,dob:""}))},onBlur:()=>{u(t=>({...t,age:Z(S)}))}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"Select format"},suffixOptions:[{label:"Years",value:"years"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Days",value:"days"}],handleValChange:t=>{i("age",t),u(l=>({...l,age:Z(S)}))},handleSuffixValChange:t=>{Le(t),u(l=>({...l,age:Z(t)}))},onSuffixDropdownClick:t=>{Le(t.label),L(l=>({...l,age_selector:t.value,dob:""})),u(l=>({...l,age:Z(t.value)}))}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"DOB",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.dob&&h.isValidDate(new Date(s?.dob))?new Date(oe.dayjs(new Date(s?.dob)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,dob:oe.dayjs(t).format("YYYY-MM-DD"),age:""})),u(l=>({...l,age:""}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:s?.patient_preferred_language?x.DefinedLanguages[s.patient_preferred_language]:"English"},placeholder:"English",label:"Preferred Language",onChange:t=>{i("patient_preferred_language",t.value)},options:Object.keys(x.DefinedLanguages).map(t=>({label:x.DefinedLanguages[t],value:t})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"dropdown-language"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-6/12 hfl-flex-col ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"City",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.city,placeholder:"Enter City",onChange:t=>{i("city",t.target.value),ge(!0),St(t)},onBlur:t=>{t.stopPropagation(),ge(!1)}},width:23.5+"em"}),ut&&_e&&_e.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:_e.map(t=>e.jsxRuntimeExports.jsx(e.ki,{label:t,className:"hfl-text-Primary-700",onSelect:()=>wt(t)}))})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-pt-4",children:e.jsxRuntimeExports.jsx(e.Pi,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.pincode,placeholder:"Enter Pin",onChange:t=>{i("pincode",t.target.value)}},width:22.5+"em"})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-col",style:{height:"100%"},children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-w-[355px]",label:"Address",inputProps:{value:s?.address,placeholder:"Enter Address",onChange:t=>{i("address",t.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),de?e.jsxRuntimeExports.jsx(Wt,{setEditPatient:se,editPatient:p,createAsNew:Y,setCreateAsNew:he}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),Be?e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pb-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Marital Status"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:s.marital_status&&x.MARITAL_STATUS.find(t=>t===s.marital_status)||""},placeholder:"Marital Status",label:"Marital Status",onChange:t=>{i("marital_status",t.label)},options:x.MARITAL_STATUS.map(t=>({label:t,value:t})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"marital-status"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-flex hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"Since",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.married_since&&h.isValidDate(new Date(s?.married_since))?new Date(oe.dayjs(new Date(s?.married_since)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,married_since:oe.dayjs(t).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:s.blood_group&&x.bloodGroups.find(t=>t.value===s.blood_group)?.label||"Blood group"},onChange:t=>{i("blood_group",t.value)},options:x.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),s?.marital_status!==x.MARITAL_STATUS[0]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Spouse Name",start_icon:"hx_person",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.spouse_name,placeholder:"Enter Spouse Name",onChange:t=>{i("spouse_name",t.target.value)}},width:"21em"}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:s.spouse_blood_group?x.bloodGroups.find(t=>t.value===s.spouse_blood_group)?.label||"Spouse Blood group":"Blood group"},onChange:t=>{i("spouse_blood_group",t.value)},options:x.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:e.jsxRuntimeExports.jsx(e.tj,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:s.ref_doc_name,input2value:s.ref_doc_spec,end_icon:"hx_down",inputProps:{placeholder:"Doctor Name"},suffixInputProps:{placeholder:"Speciality"},className:"hfl-w-48",suffixClassName:"hfl-w-[100px]",suffixDropdownClassName:"hfl-ml-[160px]",options:mt,suffixOptions:x.SpecialityList,handleValChange:t=>{i("ref_doc_name",t)},handleSuffixValChange:t=>{i("ref_doc_spec",t.value)},onDropdownClick:t=>{i("ref_doc_name",t.doctor_name),i("refDocId",t.doctor_id),i("ref_doc_spec",t.specialist)},onSuffixDropdownClick:t=>{i("ref_doc_spec",t.value)}})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-4",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Existing ID (if any)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.existingBidStr,placeholder:"Enter ID",onChange:t=>{i("existingBidStr",t.target.value)}},width:"23em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Email",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:j.email?j.email:void 0,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:s.email,placeholder:"Enter Email",onChange:t=>{i("email",t.target.value.trim())},onBlur:t=>{t.target.value&&!st.create$6().email().isValidSync(t.target.value)?u(l=>({...l,email:"Email format is wrong"})):u(l=>({...l,email:""}))}},width:20.5+"em"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-flex-row hfl-flex-wrap hfl-justify-between hfl-gap-y-6 hfl-py-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Channel (How did the patient hear about you?)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.throughChannel,placeholder:"Enter Channel",onChange:t=>{i("throughChannel",t.target.value),xe(!0),Pt(t)},onBlur:t=>{t.stopPropagation(),xe(!1)}},width:"22em"}),ft&&ce&&ce.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:ce.map(t=>{const{title:l,...r}=t;return e.jsxRuntimeExports.jsx(e.ki,{label:l,className:"hfl-text-Primary-700",...r,onSelect:()=>vt({value:t.value})},t.value)})})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.careOf,placeholder:"Enter C/O",onChange:t=>{i("careOf",t.target.value)}},width:"22em"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Occupation",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.occupation,placeholder:"Enter Occupation",onChange:t=>{i("occupation",t.target.value),me(!0),Nt(t)},onBlur:t=>{t.stopPropagation(),me(!1)}},width:"22em"}),ct&&ue&&ue.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:ue.map(t=>e.jsxRuntimeExports.jsx(e.ki,{label:t,className:"hfl-text-Primary-700",onSelect:()=>Ct(t)}))})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.tag,placeholder:"Enter Tag",onChange:t=>{i("tag",t.target.value)}},width:"22em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Mobile 2",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.phoneSecondary,maxLength:10,placeholder:"Enter Secondary Number",onChange:t=>{i("phoneSecondary",t.target.value.replace(/[^0-9]/g,""))}},width:"22em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Aadhar Number",labelColor:"hfl-text-Gray-600",errorMsg:j.aadhar_number?j.aadhar_number:void 0,labelSize:"Text sm",inputProps:{value:s.aadhar_number,placeholder:"Aadhar Card Number",maxLength:12,onChange:t=>{i("aadhar_number",t.target.value)},onBlur:()=>{u(t=>({...t,aadhar_number:s.aadhar_number&&s.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-11 hfl-gap-y-6",children:Ht()})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-h-[153px] hfl-w-[200px] hfl-items-center hfl-justify-center
2
2
  hfl-rounded-3xl hfl-border-4
3
3
  hfl-border-White hfl-bg-Primary-50 hfl-shadow-lg`,children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-flex-col hfl-items-center hfl-justify-between
4
4
  ${Te?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Camera",className:"hfl-mb-2",onClick:Mt,icon:"Left",iconFile:"hx_camera"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("input",{id:"upload-local-file",type:"file",style:{display:"none"},accept:"image/*",onChange:It}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:"Upload",icon:"Left",iconFile:"hx_image-add",onClick:Ft})]})]}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-flex
@@ -6,7 +6,7 @@ import { c as gl } from "./index.esm-Bn1Rklqj.js";
6
6
  import { d as pe } from "./dayjs.min-DEuEIfhE.js";
7
7
  import { e as ga, i as _a, d as ba, f as ya, p as va, j as wa, k as ja, l as _l, a as Le, m as bl, g as yl, v as vl, n as wl, E as Fe } from "./common-utils-DnFYNMKH.js";
8
8
  import { H as Ca, D as Ge, M as Ie, b as ue, S as Na, C as ze, O as He } from "./CommonConstant-Bj7SvPfU.js";
9
- import { a as Pa, b as Sa, p as Da, c as Ea, d as Ta, e as Ba, f as Oa, h as Ra, u as Aa, g as ka } from "./APIAction-DDp65siP.js";
9
+ import { a as Pa, b as Sa, p as Da, c as Ea, d as Ta, e as Ba, f as Oa, h as Ra, u as Aa, g as ka } from "./APIAction-C7xjHE4s.js";
10
10
  const jl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200" }), Ma = ({ conflicts: N, handleAddPatient: _, redirectAction: I }) => {
11
11
  const [S, y] = n(!1);
12
12
  return /* @__PURE__ */ l.jsxs("div", { children: [
@@ -1,5 +1,6 @@
1
- import { CREATE_APPOINTMENT_RESPONSE, CREATE_BILL_RESPONSE, GET_APPOINTMENTS_RESPONSE, GET_BILLS_RESPONSE, GET_BILL_ITEMS_RESPONSE, GET_DOCTOR_LIST_RESPONSE, GET_PATIENT_POPUP_VISIT_RESPONSE, GET_SERVICE_LIST_RESPONSE, GET_VISIT_ALL_RESPONSE, UPDATE_APPOINTMENT_RESPONSE, UPDATE_BILL_RESPONSE, UPDATE_PATIENT_RESPONSE, GET_REFERRED_BY_LISTS_RESPONSE, GET_APPOINTMENT_WITHOUT_BILL_RESPONSE, DELETE_PATIENT_IMAGE_RESPONSE, ADD_PATIENT_IMAGE_RESPONSE, GET_PAST_DUE_RESPONSE, GET_BILL_SUMMARY_RESPONSE, SAVE_PAYMENT_RESPONSE, GET_REFERRAL_RESPONSE, POST_REFERAL_RESPONSE, GET_PAYMENTS_RESPONSE, DELETE_TRANSACTION_RESPONSE, GET_ALL_BILL_PAYMENT_RESPONSE, GET_ABHA_USER_INFO_RESPONSE, GET_ABHA_ADDRESS_RESPONSE, GENERATE_OTP_BY_ABHA_ADDRESS_RESPONSE, VERIFY_ABHA_OTP_RESPONSE, GET_ABHA_CONSENT_RESPONSE, GET_INSURANCE_LIST_RESPONSE, GET_TEST_RANGE_RESPONSE, UPDATE_WALLET_RESPONSE, GET_WALLET_BALANCE_RESPONSE, GET_WALLET_TRANSACTION_RESPONSE, GET_PATIENT_POPUP_HPLXLAB_RESPONSE, GET_IPD_CASE_RESPONSE, UPDATE_PAYMENT_DETAILS_RESPONSE, PatientIDsState, T_TranslationRecord } from '../../types/PatientPopupTypes';
1
+ import { CREATE_APPOINTMENT_RESPONSE, CREATE_BILL_RESPONSE, GET_APPOINTMENTS_RESPONSE, GET_BILLS_RESPONSE, GET_BILL_ITEMS_RESPONSE, GET_DOCTOR_LIST_RESPONSE, GET_PATIENT_POPUP_VISIT_RESPONSE, GET_SERVICE_LIST_RESPONSE, GET_VISIT_ALL_RESPONSE, UPDATE_APPOINTMENT_RESPONSE, UPDATE_BILL_RESPONSE, UPDATE_PATIENT_RESPONSE, GET_REFERRED_BY_LISTS_RESPONSE, GET_APPOINTMENT_WITHOUT_BILL_RESPONSE, DELETE_PATIENT_IMAGE_RESPONSE, ADD_PATIENT_IMAGE_RESPONSE, GET_PAST_DUE_RESPONSE, GET_BILL_SUMMARY_RESPONSE, SAVE_PAYMENT_RESPONSE, GET_REFERRAL_RESPONSE, POST_REFERAL_RESPONSE, GET_PAYMENTS_RESPONSE, DELETE_TRANSACTION_RESPONSE, GET_ALL_BILL_PAYMENT_RESPONSE, GET_ABHA_USER_INFO_RESPONSE, GET_ABHA_ADDRESS_RESPONSE, GENERATE_OTP_BY_ABHA_ADDRESS_RESPONSE, VERIFY_ABHA_OTP_RESPONSE, GET_ABHA_CONSENT_RESPONSE, GET_INSURANCE_LIST_RESPONSE, GET_TEST_RANGE_RESPONSE, UPDATE_WALLET_RESPONSE, GET_WALLET_BALANCE_RESPONSE, GET_WALLET_TRANSACTION_RESPONSE, GET_IPD_CASE_RESPONSE, UPDATE_PAYMENT_DETAILS_RESPONSE, PatientIDsState, T_TranslationRecord } from '../../types/PatientPopupTypes';
2
2
  import { ENV_PARAMS, GET_BRANCH_PREFERENCE_RESPONSE, GET_PATIENT_DETAILS_RESPONSE } from '../../types/ApiResponseTypes';
3
+ import { ITestTemplatePatientData, I_Lad_Order } from '../../print-pdf/src/lib/print-lab-report/types';
3
4
  export declare const getPatientDetails: ({ callback, }: {
4
5
  callback: (data: GET_PATIENT_DETAILS_RESPONSE | undefined) => void;
5
6
  }, pr_id: string, token_env: ENV_PARAMS) => Promise<void>;
@@ -24,7 +25,11 @@ export declare const createAppointment: (appointmentData: any, skip_appnt_bill:
24
25
  export declare const updateAppointment: (appointmentData: any, skip_appnt_bill: any, patient_name: string, pr_id: string, token_env: ENV_PARAMS) => Promise<UPDATE_APPOINTMENT_RESPONSE>;
25
26
  export declare const getBillPreferences: (fields_required: string, token_env: ENV_PARAMS) => Promise<GET_BRANCH_PREFERENCE_RESPONSE>;
26
27
  export declare const getVisitDataByDate: (visit_date: string, pr_id: string, visit_id: string, token_env: ENV_PARAMS) => Promise<GET_VISIT_ALL_RESPONSE>;
27
- export declare const patientPopUpHPLXLab: (page_size: number, page_number: number, pr_id: string, token_env: ENV_PARAMS) => Promise<GET_PATIENT_POPUP_HPLXLAB_RESPONSE>;
28
+ export declare const getLabOrders: (page_size: number, page_number: number, pr_id: string, token_env: ENV_PARAMS) => Promise<{
29
+ orders: I_Lad_Order[];
30
+ total: number;
31
+ }>;
32
+ export declare const getLabReportDetails: (resultIds: string[], token_env: ENV_PARAMS) => Promise<ITestTemplatePatientData>;
28
33
  export declare const patientPopUpVisits: (page_size: number, page_number: number, pr_id: string, token_env: ENV_PARAMS) => Promise<GET_PATIENT_POPUP_VISIT_RESPONSE>;
29
34
  export declare const updatePatientDetails: (payload: any, token_env: ENV_PARAMS, patientIds?: PatientIDsState) => Promise<UPDATE_PATIENT_RESPONSE>;
30
35
  export declare const getReferredByList: (token_env: ENV_PARAMS) => Promise<GET_REFERRED_BY_LISTS_RESPONSE>;
@@ -1,8 +1,12 @@
1
- import { ENV_PARAMS, GET_PATIENT_DETAILS_RESPONSE } from '../../../types/ApiResponseTypes';
1
+ import { ENV_PARAMS, GET_PATIENT_DETAILS_RESPONSE, GET_VISITPAD_PREFERENCES_RESPONSE, GET_BRANCH_PREFERENCE_RESPONSE } from '../../../types/ApiResponseTypes';
2
+ import { I_Lad_Order, I_LAB_TEST_TEMPLATE } from '../../../print-pdf/src/lib/print-lab-report/types';
3
+ export type IFlattenedLabRecord = Omit<I_Lad_Order, 'test_templates'> & I_LAB_TEST_TEMPLATE;
2
4
  interface HPLXLabProps {
3
5
  patientDetails?: GET_PATIENT_DETAILS_RESPONSE;
4
6
  showToast: (title: string, description: string, type: string, duration: number) => void;
5
7
  variable: ENV_PARAMS;
8
+ visitpad_preference: GET_VISITPAD_PREFERENCES_RESPONSE | undefined;
9
+ branch_preference: GET_BRANCH_PREFERENCE_RESPONSE | undefined;
6
10
  }
7
11
  declare const HPLXLab: (props: HPLXLabProps) => import("react/jsx-runtime").JSX.Element;
8
12
  export default HPLXLab;
@@ -1,4 +1,4 @@
1
- import { P as f } from "../PatientPopupContainer-Uv3jDlBH.js";
1
+ import { P as f } from "../PatientPopupContainer-kPcDNoYR.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -10,7 +10,6 @@ export declare const GET_APPOINTMENTS = "/v1/appointments";
10
10
  export declare const GET_BILL_SUMMARY = "v1/bill-summary";
11
11
  export declare const GET_VISIT_ALL = "/v2/visit/all";
12
12
  export declare const GET_PATIENT_POPUP_VISIT = "/v1/visits";
13
- export declare const GET_PATIENT_POPUP_HPLXLAB = "v1/labs/patients";
14
13
  export declare const GET_BRANCH_PREFERENCE = "/preferences/branch";
15
14
  export declare const PUT_APPOINTMENTS = "/v1/appointment";
16
15
  export declare const GET_REFERREDBY_DOCTOR = "../api/modelGetAddPatientSuggestion.php";
@@ -32,3 +31,5 @@ export declare const UPDATE_WALLET = "v1/wallet";
32
31
  export declare const GET_IPD_CASE = "../ipd/api/modelCheckIpdCase.php";
33
32
  export declare const GET_LIS_BY_ORGBIDSTR = "/v2/lis-reports";
34
33
  export declare const SEND_ATTACH_LIS = "v1/partner/lis-reports/share";
34
+ export declare const GET_LAB_ORDER_DETAILS = "v1/lab/order/test_templates";
35
+ export declare const LAB_ORDERS = "v1/lab/orders";