hplx-feature-library 1.0.242 → 1.0.244
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.
- package/dist/{APIAction-DB6Ulkss.cjs → APIAction-BgDEMmVd.cjs} +1 -1
- package/dist/{APIAction-CTNOzVOC.js → APIAction-DT8TOViB.js} +1 -1
- package/dist/PatientAddEdit/index.js +1 -1
- package/dist/{PatientAddEdit-9W7ONHSd.js → PatientAddEdit-C5MnysOS.js} +2 -2
- package/dist/{PatientAddEdit-DmpV8z5a.cjs → PatientAddEdit-CuYCmfEb.cjs} +1 -1
- package/dist/PatientPopup/index.js +1 -1
- package/dist/{PatientPopupContainer-CcwFx1Ab.js → PatientPopupContainer-B22ovGqI.js} +1601 -1599
- package/dist/{PatientPopupContainer-Civd7dNi.cjs → PatientPopupContainer-C1e2JhZV.cjs} +8 -8
- package/dist/{PrintModal-DIQQvMzo.js → PrintModal-CcCy9eHR.js} +8 -8
- package/dist/{PrintModal-ojUmGPqg.cjs → PrintModal-rXhKwrHs.cjs} +4 -4
- package/dist/SearchPatients/index.js +1 -1
- package/dist/{SearchPatients-BsO-G0KT.js → SearchPatients-B91CFBhq.js} +2 -2
- package/dist/{SearchPatients-C0MLXdT-.cjs → SearchPatients-BjIvDU18.cjs} +1 -1
- package/dist/UserProfile/index.js +1 -1
- package/dist/{UserProfile-DRf9rznF.js → UserProfile-1Pll0yKL.js} +1 -1
- package/dist/{UserProfile-BqDIctDl.cjs → UserProfile-C47Wg1As.cjs} +1 -1
- package/dist/common/utils/common-utils.d.ts +1 -0
- package/dist/{common-utils-DrDXKNhv.cjs → common-utils-Cw6aYEiU.cjs} +5 -5
- package/dist/{common-utils-CprPMjtz.js → common-utils-DOjdqsiU.js} +106 -105
- package/dist/hplx-feature-library.css +1 -1
- package/dist/index.js +5 -5
- package/dist/print-pdf/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./common-utils-
|
|
1
|
+
"use strict";const i=require("./common-utils-Cw6aYEiU.cjs"),P=require("./dayjs.min-DXp74Ozx.cjs"),m="/preferences/doctor",d="/preferences/visitpad",E="/preferences/branch",u="patient/search",A="../api/modelGetAddPatientSuggestion.php",g="appointments/get",_="/v1/patient/add",h="/v1/patients",f="../api/modelSavePatientImage.php",I="../api/modelDeletePatientImage.php",l="/patient/detail",D=async(s="",t={},e,n,r)=>{const{doc_rid:o=""}=t;let a="";Array.isArray(s)?a=s.map(c=>`&fields_required=${encodeURIComponent(c)}`).join(""):s&&(a=`&fields_required=${encodeURIComponent(s)}`);try{const c=await i.hplxAPI(r?.token,r.envName).get(`${m}/${o||e}?branch_id=${n}`+a),{data:p}=c||{};return Promise.resolve(p)}catch(c){return console.error("Error fetching doctor preference:",c),Promise.reject(c)}},T=async(s="",t,e)=>{try{const n=await i.ReArchAPI(e.token,e.envName).get(`${E}/${t}?fields_required=${s}`),{data:r}=n||{};return Promise.resolve(r)}catch(n){return console.log(n),Promise.reject(n)}},w=async(s,t,e,n,r)=>{try{const o={appnt_date:s,doctor_role_id:t,doctor_id:n,org_branch_id:e},a=await i.ReArchAPI(r.token,r.envName).post(g,{...o}),{data:c}=a||{};return Promise.resolve(c)}catch(o){return o instanceof Error&&console.error("Error fetching appointments:",o.message),o?.response?.status===401&&i.handle401Status(),Promise.reject(o)}},y=async(s,t)=>{let e=[];const n=await w(P.dayjs().format("YYYY-MM-DD"),s.doctor_role_id,s.branch_id,s.doctor_id,t);n?.appointments?.length&&(e=n.appointments),window.filteredUpcomingAppts=[],e.length&&(s.term?.length?window.filteredUpcomingAppts=e.filter(r=>r.org_person_name.length&&r.org_person_name.toLowerCase().includes(s.term.toLowerCase())&&r.appnt_date>=P.dayjs(new Date).format("YYYY-MM-DD")&&(r.remote_appnt_status==="CONFIRMED"||r.appnt_status===0||r.appnt_status===3||r.appnt_status===5)):window.filteredUpcomingAppts=e.filter(r=>r.appnt_date>=P.dayjs(new Date).format("YYYY-MM-DD")&&(r.remote_appnt_status==="CONFIRMED"||r.appnt_status===0||r.appnt_status===3||r.appnt_status===5)));try{const r=await i.ReArchAPI(t.token,t.envName).post(u,s),{data:o}=r||{};return Promise.resolve(o)}catch(r){return console.log(r),null}},N=async s=>{try{const t=await i.hplxAPI(s.token,s.envName).post(A),{data:e}=t||{},{apiError:n}=e||{};if(n)throw new Error(n);return Promise.resolve(e)}catch(t){return t instanceof Error&&console.error("Error fetching referred by list:",t.message),t?.response?.status===401&&i.handle401Status(),Promise.reject(t)}},R=async(s,t)=>{try{const e=await i.ReArchAPI(t.token,t.envName).post(_,{...s,token:t.token}),{data:n}=e||{};return Promise.resolve(n)}catch(e){return Promise.reject(e)}},j=async(s,t)=>{try{const e=await i.ReArchAPI(t.token,t.envName).put(h+"/"+s?.person_role_id,{...s}),{data:n}=e||{};return Promise.resolve(n)}catch(e){return console.log(e),Promise.reject(e)}},v=async(s,t)=>{try{const e=await i.hplxAPI(t.token,t.envName).post(f,s),{data:n}=e||{};return Promise.resolve(n)}catch(e){return console.log(e),Promise.reject(e)}},Y=async(s,t)=>{try{const e=await i.hplxAPI(t.token,t.envName).post(I,s),{data:n}=e||{};return Promise.resolve(n)}catch(e){return console.log(e),Promise.reject(e)}},C=async({callback:s,payload:t,token_env:e,isCallbackNeeded:n=!0})=>{try{const r=t;window?.partner_service_enabled==="1"&&(r.partner_service_enabled=!0);const o=await i.ReArchAPI(e.token,e.envName).post(l,{...r}),{data:a}=o||{},{error:c}=a||{};if(c)throw new Error(c);if(n)s(a);else return a}catch(r){console.log(r)}},G=async({doc_id:s="",doc_rid:t=""},e,n,r,o)=>{try{const a={branch_id:n,doctor_id:s||r,doctor_role_id:t||o},c=await i.hplxAPI(e.token,e.envName).post(d,a),{data:p}=c||{};return Promise.resolve(p)}catch(a){return console.error("Error fetching visitpad preference:",a),Promise.reject(a)}};exports.GET_PATIENT_DETAILS=l;exports.addPatientDetails=R;exports.addPatientImage=v;exports.deletePatientImage=Y;exports.getBranchPreferences=T;exports.getDoctorPreference=D;exports.getPatientDetails=C;exports.getPatientList=y;exports.getReferredByList=N;exports.getVisitpadPreference=G;exports.updatePatientDetails=j;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as p, R as i, b as d } from "./common-utils-
|
|
1
|
+
import { h as p, R as i, b as d } from "./common-utils-DOjdqsiU.js";
|
|
2
2
|
import { d as l } from "./dayjs.min-D52_GdfV.js";
|
|
3
3
|
const P = "/preferences/doctor", E = "/preferences/visitpad", u = "/preferences/branch", f = "patient/search", _ = "../api/modelGetAddPatientSuggestion.php", g = "appointments/get", h = "/v1/patient/add", A = "/v1/patients", w = "../api/modelSavePatientImage.php", D = "../api/modelDeletePatientImage.php", T = "/patient/detail", R = async (s = "", t = {}, e, o, r) => {
|
|
4
4
|
const { doc_rid: n = "" } = t;
|
|
@@ -4,9 +4,9 @@ import { M as la } from "./index-T1lUjzhG.js";
|
|
|
4
4
|
import { useState as n, useRef as Y, useCallback as q, useEffect as k, useMemo as aa } from "react";
|
|
5
5
|
import { c as Ke } from "./index.esm-Bn1Rklqj.js";
|
|
6
6
|
import { d as ee } from "./dayjs.min-D52_GdfV.js";
|
|
7
|
-
import { a as ae, i as ta, d as ra, c as sa, p as na, e as oa, f as Qe, g as Xe, v as el, j as ll, E as je, k as ia, l as al } from "./common-utils-
|
|
7
|
+
import { a as ae, i as ta, d as ra, c as sa, p as na, e as oa, f as Qe, g as Xe, v as el, j as ll, E as je, k as ia, l as al } from "./common-utils-DOjdqsiU.js";
|
|
8
8
|
import { H as ha, D as Ce, M as Ne, b as le, S as da, C as Pe, O as De } from "./CommonConstant-Bj7SvPfU.js";
|
|
9
|
-
import { a as fa, b as ca, c as pa, d as ua, u as ma, g as ga, e as xa, f as _a } from "./APIAction-
|
|
9
|
+
import { a as fa, b as ca, c as pa, d as ua, u as ma, g as ga, e as xa, f as _a } from "./APIAction-DT8TOViB.js";
|
|
10
10
|
const tl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200" }), ba = ({ conflicts: M, handleAddPatient: v, redirectAction: T }) => {
|
|
11
11
|
const [N, L] = n(!1);
|
|
12
12
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./index-DQlbIHh3.cjs");;/* empty css */const Tt=require("./index-DkA8S5IK.cjs"),n=require("react"),Oe=require("./index.esm-BdlMQ1M7.cjs"),K=require("./dayjs.min-DXp74Ozx.cjs"),h=require("./common-utils-DrDXKNhv.cjs"),p=require("./CommonConstant-COHqiSWL.cjs"),P=require("./APIAction-DB6Ulkss.cjs"),Me=()=>t.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Lt=({conflicts:k,handleAddPatient:b,redirectAction:B})=>{const[v,A]=n.useState(!1);return t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx("div",{className:"hfl-mx-[20%] hfl-my-5 hfl-text-center",children:t.jsxRuntimeExports.jsx(t.bs,{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."})}),t.jsxRuntimeExports.jsxs("table",{className:"hfl-mx-7",children:[t.jsxRuntimeExports.jsx("thead",{children:t.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full",children:[t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"#"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Name"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Phone No"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Email"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Branch"})}),t.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]"})]})}),k.map((o,u)=>t.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full hfl-border-1 hfl-border-Gray-100",children:[t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:u+1})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:o.org_person_name||o.name})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_phone||o.phone})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_email||o.email})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:"In Same Branch"})}),t.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"&&t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:"Secondary",size:"sm",textField:"Continue",className:"hfl-text-Primary-700",onClick:async()=>{window.location.href.includes("/frontdesk")?window.location.href=window.origin+"/md/viewPatientDashboard.php?pid="+o?.person_role_id?.toString():h.goToPage(`viewPatientDashboard.php?pid=${o.person_role_id}`)}})})]}))]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-my-7 hfl-flex hfl-items-center hfl-justify-center",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:"hfl-text-Success-800",children:"If your patient is not in the above list"})}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-center",children:t.jsxRuntimeExports.jsx(t.Ku,{disabled:v,hierarchy:"Primary",size:"xl",textField:"Create As New Patient",className:"hfl-bg-Primary-700",onClick:()=>{A(!0),b(!0,B)}})})]})};function kt(k){const{editPatient:b,setEditPatient:B,createAsNew:v,setCreateAsNew:A}=k,o=()=>b?"Primary":"Secondary",u=()=>v?"Primary":"Secondary";return t.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:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"Are you updating"}),t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:o(),size:"lg",textField:"Exisitng Patient",onClick:()=>{B(!0),A(!1)}}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"or creating a"}),t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:u(),size:"lg",textField:"New Patient",onClick:()=>{A(!0),B(!1)}})]})}const Gt=k=>{const{closeModal:b,modalIsOpen:B,pref:v,variable:A}=k,{window_var:o,token:u,envName:j}=A,[Z,Fe]=n.useState(!1),[T,Ie]=n.useState({}),[G,ze]=n.useState(!1),[He,J]=n.useState(""),[qe,Ue]=n.useState(!1),[xe,Ve]=n.useState(!1),[Ye,$e]=n.useState([]),[me,L]=n.useState(!1),[w,q]=n.useState(""),[m,We]=n.useState(),[x,c]=n.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[U,Ke]=n.useState([]),[V,C]=n.useState({name:!1,phone:!1}),[Q,Ze]=n.useState([]),[X,Je]=n.useState([]),[ee,Qe]=n.useState([]),[Xe,te]=n.useState(!1),[et,se]=n.useState(!1),[tt,le]=n.useState(!1),[re,st]=n.useState([]),[l,E]=n.useState({name:"",phone:"",dob:"",gender:"",honorific:"",patient_preferred_language:v?.visit_pad_json?JSON.parse(v?.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:[]}),[lt,rt]=n.useState([]),{name:ge,phone:O,age:y,dob:M,gender:at}=l,[_e,je]=n.useState(!1),[nt,ae]=n.useState(l.gender),[N,be]=n.useState("Years"),[ye,Ee]=n.useState(""),[Re,ne]=n.useState(!1),[ot,it]=n.useState([]),S=(e,s,r,a)=>{it([{id:1,title:e,description:s,type:r,duration:a}])},D=n.useRef(null),ve=n.useRef(null),[we,F]=n.useState(!1),[Ce,Y]=n.useState(!1),[ht,Ne]=n.useState(!1),[dt,oe]=n.useState(!1),[Pe,ft]=n.useState(),R=m&&m.visit_pad_json&&h.isJson(m.visit_pad_json)&&JSON.parse(m.visit_pad_json),Se=h.debounceFn((...e)=>{const[s,r]=e;yt(s,r)}),i=n.useCallback((e,s)=>{Y(!1),E(r=>({...r,[e]:s})),(e==="name"||e==="phone"&&s.length>=3)&&Se(e,s)},[Se]),ct=e=>{i("throughChannel",e.value.trim()),te(!1)},pt=e=>{i("occupation",e.trim()),se(!1)},ut=e=>{i("city",e.trim()),le(!1)},xt=e=>{const{value:s}=e.target,r=_t(s);Ze(r)},mt=e=>{const{value:s}=e.target,r=jt(s);Je(r)},gt=e=>{const{value:s}=e.target,r=bt(s);st(r)},_t=e=>{if(ee?.length){let s=ee;return e?.length&&(s=ee.filter(r=>r.title.toLowerCase().includes(e.toLowerCase()))),s}else return[]},jt=e=>{if(p.OccupationList?.length){let s=p.OccupationList;return e?.length&&(s=p.OccupationList.filter(r=>r.toLowerCase().includes(e.toLowerCase()))),s}else return[]},bt=e=>{if(p.CityList?.length){let s=p.CityList;return e?.length&&(s=p.CityList.filter(r=>r.toLowerCase().includes(e.toLowerCase()))),s}else return[]},De=n.useRef(null),$=n.useRef(null),ie=n.useRef(null),Be=window.location?.pathname.includes("/frontdesk");n.useEffect(()=>{const e=h.calculateDOB(l.age,N);e&&E(s=>({...s,dob:e}))},[N,l.age]);const he=n.useCallback(e=>{ae(e),i("gender",e),c(s=>({...s,gender:""}))},[i]),Ae=e=>{(De.current&&!De.current.contains(e.target)||$.current&&!$.current.contains(e.target))&&C({name:!1,phone:!1}),ie.current&&!ie.current.contains(e.target)&&ne(!1)},Te=n.useCallback(()=>{q(l.image_link),L(!1),F(!1)},[l.image_link]),Le=n.useCallback(async()=>{const e=await P.getBranchPreferences("patient_config",o?.org_branch_id_for_seg?.toString()||"",{token:u,envName:j});ft(e)},[u,j,o?.org_branch_id_for_seg]);n.useEffect(()=>(document.addEventListener("mousedown",Ae),()=>{document.removeEventListener("mousedown",Ae)}),[]),n.useEffect(()=>{o.doctor_speciality==="Gynaecologist"&&!l.gender&&he("1")},[l.gender,he,o.doctor_speciality]),n.useEffect(()=>{l.image_link&&Te(),l.honorific&&Ee(l.honorific)},[l.honorific,l.image_link,Te]),n.useEffect(()=>{Be&&je(!0)},[Be]),n.useEffect(()=>{Le()},[Le]),n.useEffect(()=>{(async()=>{We(v);try{const e=await P.getReferredByList({token:u,envName:j}),{total_ref_doc_details:s,through_channel:r}=e;s.length&&rt(h.parseReferredByDocList(s)),r.length&&Qe(h.parseThroughChannelList(r))}catch(e){console.log("ERROR",e)}})()},[v,u,j]);const yt=async(e,s)=>{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(s),limit:30},a=await P.getPatientList(r,{token:u,envName:j});if(!a){C({name:!1,phone:!1});return}!a.apiError&&Number(a.total_persons)>0?(Ke(a.persons),C(e==="name"?{...V,name:!0}:{...V,phone:!0})):C({name:!1,phone:!1})},de=e=>{switch(e){case"Appointment":return"#Appnt";default:return""}},fe=e=>{switch(e){case"Bill":case"Appointment":return"emrPatientPopUp.php?pid=";default:return h.EAPP_ROUTES.visitpad+"?pid="}},Et=n.useCallback(e=>{const s=r=>{E({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||[]}),ae(r?.gender)};P.getPatientDetails({callback:s,payload:e,token_env:{token:u,envName:j}})},[j,u]),ke=async e=>{Ne(!0);const s={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:e.person_role_id||""};Et(s),C({name:!1,phone:!1}),Ve(!0),Ie(e)},Rt=()=>{let e=!0;return l.name?l.name.length<2&&(c(s=>({...s,name:"Enter at least 2 letters "})),e=!1):(c(s=>({...s,name:"Enter the Name of the Patient"})),e=!1),(m&&m.phone_number_length&&l.phone.length!=10||l.phone.length&&l.phone.length!=10)&&(c(s=>({...s,phone:"Please enter 10 digit number"})),e=!1),l.aadhar_number&&l.aadhar_number.length!=12&&(c(s=>({...s,aadhar_number:"Please enter 12 digit aadhar number"})),e=!1),I(N).length&&M?.length===0&&(c(s=>({...s,age:"Invalid Age."})),e=!1),at===""&&(c(s=>({...s,gender:"Select Gender"})),e=!1),x.email.length&&(l.email&&!Oe.create$6().email().isValidSync(l.email)&&c(s=>({...s,email:"Email format is wrong"})),e=!1),e},W=async(e,s)=>{try{if(!Rt()){S("Invalid form","Please fill in the required fields","Error",3e3);return}const a=new FormData;a.append("name",l.name),a.append("phone",l.phone),a.append("gender",h.getGenderKey(l.gender)),a.append("honorific",l.honorific),a.append("patient_preferred_language",l.patient_preferred_language),a.append("age",M&&M.length?M:h.calculateDate(l?.age,N)||""),a.append("age_selector",l.age_selector),a.append("blood_group",l.blood_group),a.append("email",l.email),a.append("address",l.address),a.append("city",l.city),a.append("existing_bid_str",l.existingBidStr),a.append("pincode",l.pincode),a.append("ref_doc_id",l.refDocId),a.append("ref_doc_name",l.ref_doc_name),a.append("ref_doc_spec",l.ref_doc_spec),a.append("through_channel",l.throughChannel),a.append("care_of",l.careOf),a.append("phone_secondary",l.phoneSecondary),a.append("occupation",l.occupation),a.append("tag",l.tag),a.append("marital_status",l.marital_status),a.append("married_since",l.married_since),a.append("spouse_name",l.spouse_name),a.append("spouse_blood_group",l.spouse_blood_group),a.append("aadhar_number",l.aadhar_number),a.append("custom_fields",JSON.stringify(l.custom_fields||[])),e&&a.append("reg_as_new","1");const f=Object.fromEntries(a.entries()),g=Object.fromEntries(Object.entries(f).map(([H,At])=>[H,String(At)])),_={...g,custom_fields:JSON.parse(g.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 P.addPatientDetails(_,{token:u,envName:j});if(d.apiError)S("Error",d.apiError,"Error",3e3),Y(!1);else{if(e){try{w&&await ce(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(H){console.log(H)}s!=="Rx"&&R&&R?.mode_of_patient_popup?.include=="1"&&typeof o.patientPopupHandler<"u"?o.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),m,R,s):h.goToPage(fe(s)+d.person_role_id.toString()+de(s)),b();return}else{try{w&&await ce(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(H){console.log(H)}z()}d?.conflicts?.length>0?(Fe(!0),$e(d.conflicts)):b(),Array.isArray(d?.person)||S("Success","Patient Added Successfully","Success",3e3),d!=null&&!d?.conflicts?.length&&d?.person_role_id&&(s!=="Rx"&&R&&R?.mode_of_patient_popup?.include=="1"&&typeof o.patientPopupHandler<"u"?o.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),m,R,s):h.goToPage(fe(s)+d.person_role_id.toString()+de(s)),b())}}catch(r){console.log(r)}},vt=()=>{try{const e={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[h.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[h.EAPP_ROUTES.appointments]:["appointments_mfe"]},s=window.location?.pathname||"",r=e[s];if(!r?.length)return;const a=document.getElementById("react_emr_mfe"),f=document.getElementById("react_curtains_mfe"),g=document.querySelector(".offlineEMR3");[a,f,g].forEach(_=>{_&&_.classList.contains("hidden")&&_.classList.remove("hidden")});for(const _ of r){const d=document.getElementsByClassName(_);d.length&&!d[0].classList.contains("hidden")&&d[0].classList.add("hidden")}}catch(e){console.error("Error in manipulating DOM:",e)}},ce=async(e,s)=>{const r=new FormData;r.append("pid",e),r.append("bidstr",s),r.append("imgData",w);const a=await P.addPatientImage(r,{token:u,envName:j});a.apiError&&S("Error",a.apiError,"Error",3e3)},pe=async e=>{const s={patient_id:T?.person_id,honorific:l?.honorific,name:l?.name,gender:l?.gender,age:l?.age,org_person_dob:l?.dob?l.dob:h.calculateDate(l?.age,N)||void 0,phone_number:l?.phone,email:l?.email,blood_group:l?.blood_group,patient_preferred_language:l?.patient_preferred_language,address:l?.address,city:l?.city,pincode:l?.pincode,org_person_bid_str:l?.existingBidStr,ref_doc_name:l?.ref_doc_name,ref_doc_spec:l?.ref_doc_spec,through_channel:l?.throughChannel,ref_doc_id:l?.refDocId,care_of:l?.careOf,phone_secondary:l?.phoneSecondary,occupation:l?.occupation,tag:l?.tag,marital_status:l.marital_status,married_since:l.married_since,spouse_name:l.spouse_name,spouse_blood_group:l.spouse_blood_group,image_link:l?.image_link,remote_consultation_id:"0",oc_status:!1,aadhar_number:l?.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 P.updatePatientDetails(s,{token:u,envName:j});if(G){r&&Y(!1);const{message:a,status:f}=r||{};if(f){S("Patient Edited","Patient Edited Successfully","Success",1500);try{l?.image_link&&!w?wt(T?.person_role_id):w&&dt&&(oe(!1),await ce(T?.person_role_id,l?.existingBidStr))}catch(g){console.log(g)}e!=="Rx"&&R&&R?.mode_of_patient_popup?.include=="1"&&typeof o.patientPopupHandler<"u"?o.patientPopupHandler("addpatient",T?.person_role_id,T?.person_id,m,R,e):h.goToPage(fe(e)+T?.person_role_id?.toString()+de(e)),b()}else S("Patient Not Edited",a||"Patient Not Edited","Failure",1500)}},wt=async e=>{const s=new FormData;s.append("pid",e);const r=await P.deletePatientImage(s,{token:u,envName:j});r.apiError&&S("Error",r.apiError,"Error",3e3)},I=(e="")=>{const s=e?.toLowerCase();return M!==""?"":y!==""&&Number(y)<0&&l?.dob===""?"Invalid Age":s==="weeks"&&y!==""&&Number(y)<5907||s==="days"&&y!==""&&Number(y)<9999||s==="months"&&y!==""&&Number(y)<1358||s==="years"&&y!==""&&Number(y)<114?"":"Invalid Age"},Ct=async()=>{try{L(!1);const e=await navigator.mediaDevices.getUserMedia({video:!0});D.current&&(D.current.srcObject=e),F(!0)}catch(e){console.error("Error accessing camera:",e)}},Nt=()=>{const e=ve.current,s=D.current;if(e&&s){e.width=s.videoWidth,e.height=s.videoHeight;const r=e.getContext("2d");if(r){r.drawImage(s,0,0,e.width,e.height);const a=e.toDataURL();q(a),L(!1),F(!1),z()}}},Pt=()=>{document.getElementById("upload-local-file")?.click()},St=e=>{L(!1),F(!1);const s=e.target.files?.[0];if(!s)return;const r=new FileReader;r.readAsDataURL(s),r.onloadend=()=>{const a=r.result;a&&q(a.toString()),e.target.value=""}},Ge=()=>{L(!0),q(""),F(!1),z()},z=()=>{if(D.current){const e=D.current.srcObject;e instanceof MediaStream&&e.getTracks().forEach(s=>s.stop()),D.current.srcObject=null}},Dt=n.useMemo(()=>[...Pe?.patient_config?.custom_fields||[]].sort((r,a)=>r.sort-a.sort).map(r=>{const a=l.custom_fields?.find(f=>f.id===r.id);return{...r,value:a?.value||"",title:a?.value?a?.title:r.title}}),[Pe?.patient_config?.custom_fields,l.custom_fields]),ue=(e,s,r)=>{E(a=>{const f=a.custom_fields?.length?a.custom_fields.map(_=>_.id===e?{..._,value:r}:_):[];return f.some(_=>_.id===e)||f.push({id:e,value:r,title:s}),{...a,custom_fields:f}})},Bt=()=>Dt?.map(e=>{const{id:s,type:r,value:a,title:f}=e||{};if(!s||!r||!f)return null;switch(r){case"text":return t.jsxRuntimeExports.jsx(t.Ps,{label:f,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:a||"",placeholder:`Enter ${f}`,onChange:g=>{ue(s,f,g.target.value)}},width:"22em"},s);case"date":return t.jsxRuntimeExports.jsx(t.ZC,{label:f,placeholder:`Select ${f}`,selectDate:a?new Date(a):null,dateVar:g=>{ue(s,f,g.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:g=>{ue(s,f,g)},openUp:!0,backSpaceClearDate:!0},s);default:return null}});return t.jsxRuntimeExports.jsx(Tt.Modal,{isOpen:B,onRequestClose:()=>{z(),b()},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:t.jsxRuntimeExports.jsxs("div",{id:"add-patient-modal",children:[t.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:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text xl",children:Z?"Patient(s) with Same phone number or Email":"Add New Patient"}),t.jsxRuntimeExports.jsx("div",{className:"hfl-items-center",children:t.jsxRuntimeExports.jsx("span",{className:"hx_close hfl-ml-4 hover:hfl-cursor-pointer",onClick:()=>{z(),b()}})})]}),Z?t.jsxRuntimeExports.jsx(Lt,{conflicts:Ye,handleAddPatient:W,redirectAction:He,manipulateExistingDOM:vt}):t.jsxRuntimeExports.jsxs("div",{className:"hfl-min-h-[400px] hfl-px-10 hfl-py-5",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:t.jsxRuntimeExports.jsxs("div",{ref:ie,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>ne(e=>!e),children:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:ye}),!ye.length&&t.jsxRuntimeExports.jsx("div",{className:`${Re?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:x.name?x.name:void 0,inputProps:{type:"text",value:ge,placeholder:"Enter Name",onChange:e=>{i("name",e.target.value)},onBlur:()=>{const e=!(l.name.length>0);l.name.length>0&&l.name.length<2&&!ht?c(s=>({...s,name:"Enter at least 2 letters "})):c(s=>({...s,name:e?"Enter the Name of the Patient":""})),Ne(!1),C({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Re&&t.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:p.HonorificList.map(e=>t.jsxRuntimeExports.jsx(t.ks,{className:"hfl-text-Primary-700",label:e.label,onSelect:()=>{Ee(e.label),ne(!1),ae(e.gender),i("honorific",e.label),i("gender",e.gender),E(s=>({...s,gender:e.gender,honorific:e.label}))}}))}),V.name&&ge.length>0&&t.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:$,children:[t.jsxRuntimeExports.jsx(t.bs,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),U&&U?.slice(0,7)?.map(e=>t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>ke(e),children:[t.jsxRuntimeExports.jsxs(t.bs,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[e?.org_person_name?.length>13?e?.org_person_name?.substring(0,11)+"...":e?.org_person_name,`(${e.ageStr||h.calculateAge(e.age)}, ${h.getGender(parseInt(e.org_person_gender.toString()))})`]}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:e.org_person_phone||""})]},e?.person_role_id))]})]}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Ps,{label:`Phone Number ${m&&m.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:x.phone?x.phone:void 0,inputProps:{maxLength:10,value:O,placeholder:"Enter Number",onChange:e=>{i("phone",e.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:e=!1,msg:s=""}=m&&m.phone_number_length||O?h.validateMobileNo(O):{};c(r=>({...r,phone:e?s:""})),C({name:!1,phone:!1})}},width:"21em",start_icon:"hx_phone"}),V.phone&&O.length>0&&t.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:$,children:[t.jsxRuntimeExports.jsx(t.bs,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),U&&U?.slice(0,7)?.map(e=>t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>ke(e),children:[t.jsxRuntimeExports.jsxs(t.bs,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[e.org_person_name?.length>13?e.org_person_name?.substring(0,11)+"...":e.org_person_name,`(${e.ageStr||h.calculateAge(e.age)}, ${h.getGender(parseInt(e.org_person_gender.toString()))})`]}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:e.org_person_phone})]},e?.person_role_id))]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-h-[40px] hfl-space-y-1",children:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-pb-[1px] hfl-text-Gray-600",children:"Gender*"}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.ju,{className:`!hfl-h-[40px] hfl-w-44 ${x.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:nt,onChange:e=>he(e),disabled:!1}),!!x.gender&&t.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:x.gender})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[t.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:t.jsxRuntimeExports.jsx(t.ej,{label:"Age or DOB*",className:"hfl-w-20",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-w-16 hfl-border-0",suffixDropdownClassName:"hfl-ml-[80px]",input1value:l.age,input2value:N,end_icon:"hx_down",errorMsg:x.age?x.age:void 0,inputProps:{type:"number",min:0,maxLength:3,placeholder:"Age",onChange:e=>{i("age",e.target.value.replace(/[^0-9]/g,"")),E(s=>({...s,dob:""}))},onBlur:()=>{c(e=>({...e,age:I(N)}))}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"Select format"},suffixOptions:[{label:"Years",value:"years"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Days",value:"days"}],handleValChange:e=>{i("age",e),c(s=>({...s,age:I(N)}))},handleSuffixValChange:e=>{be(e),c(s=>({...s,age:I(e)}))},onSuffixDropdownClick:e=>{be(e.label),E(s=>({...s,age_selector:e.value,dob:""})),c(s=>({...s,age:I(e.value)}))}})}),t.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:t.jsxRuntimeExports.jsx(t.ZC,{className:"hfl-relative",placeholder:"DOB",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:l?.dob&&h.isValidDate(new Date(l?.dob))?new Date(K.dayjs(new Date(l?.dob)).format("DD-MMM-YYYY")):"",dateVar:e=>{E(s=>({...s,dob:K.dayjs(e).format("YYYY-MM-DD"),age:""})),c(s=>({...s,age:""}))},isborderRequired:!0,maxDate:new Date})})]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-1",children:t.jsxRuntimeExports.jsx(t.Ap,{value:{label:l?.patient_preferred_language?p.DefinedLanguages[l.patient_preferred_language]:"English"},placeholder:"English",label:"Preferred Language",onChange:e=>{i("patient_preferred_language",e.value)},options:Object.keys(p.DefinedLanguages).map(e=>({label:p.DefinedLanguages[e],value:e})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"dropdown-language"})})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-6",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-6/12 hfl-flex-col ",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"City",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.city,placeholder:"Enter City",onChange:e=>{i("city",e.target.value),le(!0),gt(e)},onBlur:e=>{e.stopPropagation(),le(!1)}},width:23.5+"em"}),tt&&re&&re.length>0&&t.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:re.map(e=>t.jsxRuntimeExports.jsx(t.ks,{label:e,className:"hfl-text-Primary-700",onSelect:()=>ut(e)}))})]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-pt-4",children:t.jsxRuntimeExports.jsx(t.Ps,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.pincode,placeholder:"Enter Pin",onChange:e=>{i("pincode",e.target.value)}},width:22.5+"em"})})]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-col",style:{height:"100%"},children:t.jsxRuntimeExports.jsx(t.bu,{className:"hfl-w-[355px]",label:"Address",inputProps:{value:l?.address,placeholder:"Enter Address",onChange:e=>{i("address",e.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),xe?t.jsxRuntimeExports.jsx(kt,{setEditPatient:ze,editPatient:G,createAsNew:qe,setCreateAsNew:Ue,showEditPrompt:xe}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),_e?t.jsxRuntimeExports.jsxs("div",{className:"",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pb-6",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),t.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Marital Status"})})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[t.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:t.jsxRuntimeExports.jsx(t.Ap,{value:{label:l.marital_status&&p.MARITAL_STATUS.find(e=>e===l.marital_status)||""},placeholder:"Marital Status",label:"Marital Status",onChange:e=>{i("marital_status",e.label)},options:p.MARITAL_STATUS.map(e=>({label:e,value:e})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"marital-status"})}),t.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-flex hfl-space-y-2",children:t.jsxRuntimeExports.jsx(t.ZC,{className:"hfl-relative",placeholder:"Since",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:l?.married_since&&h.isValidDate(new Date(l?.married_since))?new Date(K.dayjs(new Date(l?.married_since)).format("DD-MMM-YYYY")):"",dateVar:e=>{E(s=>({...s,married_since:K.dayjs(e).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),t.jsxRuntimeExports.jsx(t.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:l.blood_group&&p.bloodGroups.find(e=>e.value===l.blood_group)?.label||"Blood group"},onChange:e=>{i("blood_group",e.value)},options:p.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),l?.marital_status!==p.MARITAL_STATUS[0]&&t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Spouse Name",start_icon:"hx_person",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l.spouse_name,placeholder:"Enter Spouse Name",onChange:e=>{i("spouse_name",e.target.value)}},width:"21em"}),t.jsxRuntimeExports.jsx(t.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:l.spouse_blood_group?p.bloodGroups.find(e=>e.value===l.spouse_blood_group)?.label||"Spouse Blood group":"Blood group"},onChange:e=>{i("spouse_blood_group",e.value)},options:p.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),t.jsxRuntimeExports.jsx(Me,{}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:t.jsxRuntimeExports.jsx(t.ej,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:l.ref_doc_name,input2value:l.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:lt,suffixOptions:p.SpecialityList,handleValChange:e=>{i("ref_doc_name",e)},handleSuffixValChange:e=>{i("ref_doc_spec",e.value)},onDropdownClick:e=>{i("ref_doc_name",e.doctor_name),i("refDocId",e.doctor_id),i("ref_doc_spec",e.specialist)},onSuffixDropdownClick:e=>{i("ref_doc_spec",e.value)}})}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-4",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Existing ID (if any)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.existingBidStr,placeholder:"Enter ID",onChange:e=>{i("existingBidStr",e.target.value)}},width:"23em"}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Email",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:x.email?x.email:void 0,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:l.email,placeholder:"Enter Email",onChange:e=>{i("email",e.target.value.trim())},onBlur:e=>{e.target.value&&!Oe.create$6().email().isValidSync(e.target.value)?c(s=>({...s,email:"Email format is wrong"})):c(s=>({...s,email:""}))}},width:20.5+"em"})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-flex-row hfl-flex-wrap hfl-justify-between hfl-gap-y-6 hfl-py-6",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Channel (How did the patient hear about you?)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.throughChannel,placeholder:"Enter Channel",onChange:e=>{i("throughChannel",e.target.value),te(!0),xt(e)},onBlur:e=>{e.stopPropagation(),te(!1)}},width:"22em"}),Xe&&Q&&Q.length>0&&t.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:Q.map(e=>{const{title:s,...r}=e;return t.jsxRuntimeExports.jsx(t.ks,{label:s,className:"hfl-text-Primary-700",...r,onSelect:()=>ct({value:e.value})},e.value)})})]}),t.jsxRuntimeExports.jsx(t.Ps,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.careOf,placeholder:"Enter C/O",onChange:e=>{i("careOf",e.target.value)}},width:"22em"})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Occupation",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.occupation,placeholder:"Enter Occupation",onChange:e=>{i("occupation",e.target.value),se(!0),mt(e)},onBlur:e=>{e.stopPropagation(),se(!1)}},width:"22em"}),et&&X&&X.length>0&&t.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:X.map(e=>t.jsxRuntimeExports.jsx(t.ks,{label:e,className:"hfl-text-Primary-700",onSelect:()=>pt(e)}))})]}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l.tag,placeholder:"Enter Tag",onChange:e=>{i("tag",e.target.value)}},width:"22em"}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Mobile 2",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l.phoneSecondary,maxLength:10,placeholder:"Enter Secondary Number",onChange:e=>{i("phoneSecondary",e.target.value.replace(/[^0-9]/g,""))}},width:"22em"}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Aadhar Number",labelColor:"hfl-text-Gray-600",errorMsg:x.aadhar_number?x.aadhar_number:void 0,labelSize:"Text sm",inputProps:{value:l.aadhar_number,placeholder:"Aadhar Card Number",maxLength:12,onChange:e=>{i("aadhar_number",e.target.value)},onBlur:()=>{c(e=>({...e,aadhar_number:l.aadhar_number&&l.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"}),t.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-11 hfl-gap-y-6",children:Bt()})]}),t.jsxRuntimeExports.jsx(Me,{}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3",children:t.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-h-[153px] hfl-w-[200px] hfl-items-center hfl-justify-center
|
|
1
|
+
"use strict";const t=require("./index-DQlbIHh3.cjs");;/* empty css */const Tt=require("./index-DkA8S5IK.cjs"),n=require("react"),Oe=require("./index.esm-BdlMQ1M7.cjs"),K=require("./dayjs.min-DXp74Ozx.cjs"),h=require("./common-utils-Cw6aYEiU.cjs"),p=require("./CommonConstant-COHqiSWL.cjs"),P=require("./APIAction-BgDEMmVd.cjs"),Me=()=>t.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Lt=({conflicts:k,handleAddPatient:b,redirectAction:B})=>{const[v,A]=n.useState(!1);return t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx("div",{className:"hfl-mx-[20%] hfl-my-5 hfl-text-center",children:t.jsxRuntimeExports.jsx(t.bs,{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."})}),t.jsxRuntimeExports.jsxs("table",{className:"hfl-mx-7",children:[t.jsxRuntimeExports.jsx("thead",{children:t.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full",children:[t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"#"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Name"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Phone No"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Email"})}),t.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:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Branch"})}),t.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]"})]})}),k.map((o,u)=>t.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full hfl-border-1 hfl-border-Gray-100",children:[t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:u+1})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:o.org_person_name||o.name})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_phone||o.phone})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_email||o.email})}),t.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:"In Same Branch"})}),t.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"&&t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:"Secondary",size:"sm",textField:"Continue",className:"hfl-text-Primary-700",onClick:async()=>{window.location.href.includes("/frontdesk")?window.location.href=window.origin+"/md/viewPatientDashboard.php?pid="+o?.person_role_id?.toString():h.goToPage(`viewPatientDashboard.php?pid=${o.person_role_id}`)}})})]}))]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-my-7 hfl-flex hfl-items-center hfl-justify-center",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:"hfl-text-Success-800",children:"If your patient is not in the above list"})}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-center",children:t.jsxRuntimeExports.jsx(t.Ku,{disabled:v,hierarchy:"Primary",size:"xl",textField:"Create As New Patient",className:"hfl-bg-Primary-700",onClick:()=>{A(!0),b(!0,B)}})})]})};function kt(k){const{editPatient:b,setEditPatient:B,createAsNew:v,setCreateAsNew:A}=k,o=()=>b?"Primary":"Secondary",u=()=>v?"Primary":"Secondary";return t.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:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"Are you updating"}),t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:o(),size:"lg",textField:"Exisitng Patient",onClick:()=>{B(!0),A(!1)}}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"or creating a"}),t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:u(),size:"lg",textField:"New Patient",onClick:()=>{A(!0),B(!1)}})]})}const Gt=k=>{const{closeModal:b,modalIsOpen:B,pref:v,variable:A}=k,{window_var:o,token:u,envName:j}=A,[Z,Fe]=n.useState(!1),[T,Ie]=n.useState({}),[G,ze]=n.useState(!1),[He,J]=n.useState(""),[qe,Ue]=n.useState(!1),[xe,Ve]=n.useState(!1),[Ye,$e]=n.useState([]),[me,L]=n.useState(!1),[w,q]=n.useState(""),[m,We]=n.useState(),[x,c]=n.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[U,Ke]=n.useState([]),[V,C]=n.useState({name:!1,phone:!1}),[Q,Ze]=n.useState([]),[X,Je]=n.useState([]),[ee,Qe]=n.useState([]),[Xe,te]=n.useState(!1),[et,se]=n.useState(!1),[tt,le]=n.useState(!1),[re,st]=n.useState([]),[l,E]=n.useState({name:"",phone:"",dob:"",gender:"",honorific:"",patient_preferred_language:v?.visit_pad_json?JSON.parse(v?.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:[]}),[lt,rt]=n.useState([]),{name:ge,phone:O,age:y,dob:M,gender:at}=l,[_e,je]=n.useState(!1),[nt,ae]=n.useState(l.gender),[N,be]=n.useState("Years"),[ye,Ee]=n.useState(""),[Re,ne]=n.useState(!1),[ot,it]=n.useState([]),S=(e,s,r,a)=>{it([{id:1,title:e,description:s,type:r,duration:a}])},D=n.useRef(null),ve=n.useRef(null),[we,F]=n.useState(!1),[Ce,Y]=n.useState(!1),[ht,Ne]=n.useState(!1),[dt,oe]=n.useState(!1),[Pe,ft]=n.useState(),R=m&&m.visit_pad_json&&h.isJson(m.visit_pad_json)&&JSON.parse(m.visit_pad_json),Se=h.debounceFn((...e)=>{const[s,r]=e;yt(s,r)}),i=n.useCallback((e,s)=>{Y(!1),E(r=>({...r,[e]:s})),(e==="name"||e==="phone"&&s.length>=3)&&Se(e,s)},[Se]),ct=e=>{i("throughChannel",e.value.trim()),te(!1)},pt=e=>{i("occupation",e.trim()),se(!1)},ut=e=>{i("city",e.trim()),le(!1)},xt=e=>{const{value:s}=e.target,r=_t(s);Ze(r)},mt=e=>{const{value:s}=e.target,r=jt(s);Je(r)},gt=e=>{const{value:s}=e.target,r=bt(s);st(r)},_t=e=>{if(ee?.length){let s=ee;return e?.length&&(s=ee.filter(r=>r.title.toLowerCase().includes(e.toLowerCase()))),s}else return[]},jt=e=>{if(p.OccupationList?.length){let s=p.OccupationList;return e?.length&&(s=p.OccupationList.filter(r=>r.toLowerCase().includes(e.toLowerCase()))),s}else return[]},bt=e=>{if(p.CityList?.length){let s=p.CityList;return e?.length&&(s=p.CityList.filter(r=>r.toLowerCase().includes(e.toLowerCase()))),s}else return[]},De=n.useRef(null),$=n.useRef(null),ie=n.useRef(null),Be=window.location?.pathname.includes("/frontdesk");n.useEffect(()=>{const e=h.calculateDOB(l.age,N);e&&E(s=>({...s,dob:e}))},[N,l.age]);const he=n.useCallback(e=>{ae(e),i("gender",e),c(s=>({...s,gender:""}))},[i]),Ae=e=>{(De.current&&!De.current.contains(e.target)||$.current&&!$.current.contains(e.target))&&C({name:!1,phone:!1}),ie.current&&!ie.current.contains(e.target)&&ne(!1)},Te=n.useCallback(()=>{q(l.image_link),L(!1),F(!1)},[l.image_link]),Le=n.useCallback(async()=>{const e=await P.getBranchPreferences("patient_config",o?.org_branch_id_for_seg?.toString()||"",{token:u,envName:j});ft(e)},[u,j,o?.org_branch_id_for_seg]);n.useEffect(()=>(document.addEventListener("mousedown",Ae),()=>{document.removeEventListener("mousedown",Ae)}),[]),n.useEffect(()=>{o.doctor_speciality==="Gynaecologist"&&!l.gender&&he("1")},[l.gender,he,o.doctor_speciality]),n.useEffect(()=>{l.image_link&&Te(),l.honorific&&Ee(l.honorific)},[l.honorific,l.image_link,Te]),n.useEffect(()=>{Be&&je(!0)},[Be]),n.useEffect(()=>{Le()},[Le]),n.useEffect(()=>{(async()=>{We(v);try{const e=await P.getReferredByList({token:u,envName:j}),{total_ref_doc_details:s,through_channel:r}=e;s.length&&rt(h.parseReferredByDocList(s)),r.length&&Qe(h.parseThroughChannelList(r))}catch(e){console.log("ERROR",e)}})()},[v,u,j]);const yt=async(e,s)=>{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(s),limit:30},a=await P.getPatientList(r,{token:u,envName:j});if(!a){C({name:!1,phone:!1});return}!a.apiError&&Number(a.total_persons)>0?(Ke(a.persons),C(e==="name"?{...V,name:!0}:{...V,phone:!0})):C({name:!1,phone:!1})},de=e=>{switch(e){case"Appointment":return"#Appnt";default:return""}},fe=e=>{switch(e){case"Bill":case"Appointment":return"emrPatientPopUp.php?pid=";default:return h.EAPP_ROUTES.visitpad+"?pid="}},Et=n.useCallback(e=>{const s=r=>{E({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||[]}),ae(r?.gender)};P.getPatientDetails({callback:s,payload:e,token_env:{token:u,envName:j}})},[j,u]),ke=async e=>{Ne(!0);const s={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:e.person_role_id||""};Et(s),C({name:!1,phone:!1}),Ve(!0),Ie(e)},Rt=()=>{let e=!0;return l.name?l.name.length<2&&(c(s=>({...s,name:"Enter at least 2 letters "})),e=!1):(c(s=>({...s,name:"Enter the Name of the Patient"})),e=!1),(m&&m.phone_number_length&&l.phone.length!=10||l.phone.length&&l.phone.length!=10)&&(c(s=>({...s,phone:"Please enter 10 digit number"})),e=!1),l.aadhar_number&&l.aadhar_number.length!=12&&(c(s=>({...s,aadhar_number:"Please enter 12 digit aadhar number"})),e=!1),I(N).length&&M?.length===0&&(c(s=>({...s,age:"Invalid Age."})),e=!1),at===""&&(c(s=>({...s,gender:"Select Gender"})),e=!1),x.email.length&&(l.email&&!Oe.create$6().email().isValidSync(l.email)&&c(s=>({...s,email:"Email format is wrong"})),e=!1),e},W=async(e,s)=>{try{if(!Rt()){S("Invalid form","Please fill in the required fields","Error",3e3);return}const a=new FormData;a.append("name",l.name),a.append("phone",l.phone),a.append("gender",h.getGenderKey(l.gender)),a.append("honorific",l.honorific),a.append("patient_preferred_language",l.patient_preferred_language),a.append("age",M&&M.length?M:h.calculateDate(l?.age,N)||""),a.append("age_selector",l.age_selector),a.append("blood_group",l.blood_group),a.append("email",l.email),a.append("address",l.address),a.append("city",l.city),a.append("existing_bid_str",l.existingBidStr),a.append("pincode",l.pincode),a.append("ref_doc_id",l.refDocId),a.append("ref_doc_name",l.ref_doc_name),a.append("ref_doc_spec",l.ref_doc_spec),a.append("through_channel",l.throughChannel),a.append("care_of",l.careOf),a.append("phone_secondary",l.phoneSecondary),a.append("occupation",l.occupation),a.append("tag",l.tag),a.append("marital_status",l.marital_status),a.append("married_since",l.married_since),a.append("spouse_name",l.spouse_name),a.append("spouse_blood_group",l.spouse_blood_group),a.append("aadhar_number",l.aadhar_number),a.append("custom_fields",JSON.stringify(l.custom_fields||[])),e&&a.append("reg_as_new","1");const f=Object.fromEntries(a.entries()),g=Object.fromEntries(Object.entries(f).map(([H,At])=>[H,String(At)])),_={...g,custom_fields:JSON.parse(g.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 P.addPatientDetails(_,{token:u,envName:j});if(d.apiError)S("Error",d.apiError,"Error",3e3),Y(!1);else{if(e){try{w&&await ce(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(H){console.log(H)}s!=="Rx"&&R&&R?.mode_of_patient_popup?.include=="1"&&typeof o.patientPopupHandler<"u"?o.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),m,R,s):h.goToPage(fe(s)+d.person_role_id.toString()+de(s)),b();return}else{try{w&&await ce(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(H){console.log(H)}z()}d?.conflicts?.length>0?(Fe(!0),$e(d.conflicts)):b(),Array.isArray(d?.person)||S("Success","Patient Added Successfully","Success",3e3),d!=null&&!d?.conflicts?.length&&d?.person_role_id&&(s!=="Rx"&&R&&R?.mode_of_patient_popup?.include=="1"&&typeof o.patientPopupHandler<"u"?o.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),m,R,s):h.goToPage(fe(s)+d.person_role_id.toString()+de(s)),b())}}catch(r){console.log(r)}},vt=()=>{try{const e={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[h.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[h.EAPP_ROUTES.appointments]:["appointments_mfe"]},s=window.location?.pathname||"",r=e[s];if(!r?.length)return;const a=document.getElementById("react_emr_mfe"),f=document.getElementById("react_curtains_mfe"),g=document.querySelector(".offlineEMR3");[a,f,g].forEach(_=>{_&&_.classList.contains("hidden")&&_.classList.remove("hidden")});for(const _ of r){const d=document.getElementsByClassName(_);d.length&&!d[0].classList.contains("hidden")&&d[0].classList.add("hidden")}}catch(e){console.error("Error in manipulating DOM:",e)}},ce=async(e,s)=>{const r=new FormData;r.append("pid",e),r.append("bidstr",s),r.append("imgData",w);const a=await P.addPatientImage(r,{token:u,envName:j});a.apiError&&S("Error",a.apiError,"Error",3e3)},pe=async e=>{const s={patient_id:T?.person_id,honorific:l?.honorific,name:l?.name,gender:l?.gender,age:l?.age,org_person_dob:l?.dob?l.dob:h.calculateDate(l?.age,N)||void 0,phone_number:l?.phone,email:l?.email,blood_group:l?.blood_group,patient_preferred_language:l?.patient_preferred_language,address:l?.address,city:l?.city,pincode:l?.pincode,org_person_bid_str:l?.existingBidStr,ref_doc_name:l?.ref_doc_name,ref_doc_spec:l?.ref_doc_spec,through_channel:l?.throughChannel,ref_doc_id:l?.refDocId,care_of:l?.careOf,phone_secondary:l?.phoneSecondary,occupation:l?.occupation,tag:l?.tag,marital_status:l.marital_status,married_since:l.married_since,spouse_name:l.spouse_name,spouse_blood_group:l.spouse_blood_group,image_link:l?.image_link,remote_consultation_id:"0",oc_status:!1,aadhar_number:l?.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 P.updatePatientDetails(s,{token:u,envName:j});if(G){r&&Y(!1);const{message:a,status:f}=r||{};if(f){S("Patient Edited","Patient Edited Successfully","Success",1500);try{l?.image_link&&!w?wt(T?.person_role_id):w&&dt&&(oe(!1),await ce(T?.person_role_id,l?.existingBidStr))}catch(g){console.log(g)}e!=="Rx"&&R&&R?.mode_of_patient_popup?.include=="1"&&typeof o.patientPopupHandler<"u"?o.patientPopupHandler("addpatient",T?.person_role_id,T?.person_id,m,R,e):h.goToPage(fe(e)+T?.person_role_id?.toString()+de(e)),b()}else S("Patient Not Edited",a||"Patient Not Edited","Failure",1500)}},wt=async e=>{const s=new FormData;s.append("pid",e);const r=await P.deletePatientImage(s,{token:u,envName:j});r.apiError&&S("Error",r.apiError,"Error",3e3)},I=(e="")=>{const s=e?.toLowerCase();return M!==""?"":y!==""&&Number(y)<0&&l?.dob===""?"Invalid Age":s==="weeks"&&y!==""&&Number(y)<5907||s==="days"&&y!==""&&Number(y)<9999||s==="months"&&y!==""&&Number(y)<1358||s==="years"&&y!==""&&Number(y)<114?"":"Invalid Age"},Ct=async()=>{try{L(!1);const e=await navigator.mediaDevices.getUserMedia({video:!0});D.current&&(D.current.srcObject=e),F(!0)}catch(e){console.error("Error accessing camera:",e)}},Nt=()=>{const e=ve.current,s=D.current;if(e&&s){e.width=s.videoWidth,e.height=s.videoHeight;const r=e.getContext("2d");if(r){r.drawImage(s,0,0,e.width,e.height);const a=e.toDataURL();q(a),L(!1),F(!1),z()}}},Pt=()=>{document.getElementById("upload-local-file")?.click()},St=e=>{L(!1),F(!1);const s=e.target.files?.[0];if(!s)return;const r=new FileReader;r.readAsDataURL(s),r.onloadend=()=>{const a=r.result;a&&q(a.toString()),e.target.value=""}},Ge=()=>{L(!0),q(""),F(!1),z()},z=()=>{if(D.current){const e=D.current.srcObject;e instanceof MediaStream&&e.getTracks().forEach(s=>s.stop()),D.current.srcObject=null}},Dt=n.useMemo(()=>[...Pe?.patient_config?.custom_fields||[]].sort((r,a)=>r.sort-a.sort).map(r=>{const a=l.custom_fields?.find(f=>f.id===r.id);return{...r,value:a?.value||"",title:a?.value?a?.title:r.title}}),[Pe?.patient_config?.custom_fields,l.custom_fields]),ue=(e,s,r)=>{E(a=>{const f=a.custom_fields?.length?a.custom_fields.map(_=>_.id===e?{..._,value:r}:_):[];return f.some(_=>_.id===e)||f.push({id:e,value:r,title:s}),{...a,custom_fields:f}})},Bt=()=>Dt?.map(e=>{const{id:s,type:r,value:a,title:f}=e||{};if(!s||!r||!f)return null;switch(r){case"text":return t.jsxRuntimeExports.jsx(t.Ps,{label:f,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:a||"",placeholder:`Enter ${f}`,onChange:g=>{ue(s,f,g.target.value)}},width:"22em"},s);case"date":return t.jsxRuntimeExports.jsx(t.ZC,{label:f,placeholder:`Select ${f}`,selectDate:a?new Date(a):null,dateVar:g=>{ue(s,f,g.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:g=>{ue(s,f,g)},openUp:!0,backSpaceClearDate:!0},s);default:return null}});return t.jsxRuntimeExports.jsx(Tt.Modal,{isOpen:B,onRequestClose:()=>{z(),b()},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:t.jsxRuntimeExports.jsxs("div",{id:"add-patient-modal",children:[t.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:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text xl",children:Z?"Patient(s) with Same phone number or Email":"Add New Patient"}),t.jsxRuntimeExports.jsx("div",{className:"hfl-items-center",children:t.jsxRuntimeExports.jsx("span",{className:"hx_close hfl-ml-4 hover:hfl-cursor-pointer",onClick:()=>{z(),b()}})})]}),Z?t.jsxRuntimeExports.jsx(Lt,{conflicts:Ye,handleAddPatient:W,redirectAction:He,manipulateExistingDOM:vt}):t.jsxRuntimeExports.jsxs("div",{className:"hfl-min-h-[400px] hfl-px-10 hfl-py-5",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:t.jsxRuntimeExports.jsxs("div",{ref:ie,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>ne(e=>!e),children:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:ye}),!ye.length&&t.jsxRuntimeExports.jsx("div",{className:`${Re?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:x.name?x.name:void 0,inputProps:{type:"text",value:ge,placeholder:"Enter Name",onChange:e=>{i("name",e.target.value)},onBlur:()=>{const e=!(l.name.length>0);l.name.length>0&&l.name.length<2&&!ht?c(s=>({...s,name:"Enter at least 2 letters "})):c(s=>({...s,name:e?"Enter the Name of the Patient":""})),Ne(!1),C({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Re&&t.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:p.HonorificList.map(e=>t.jsxRuntimeExports.jsx(t.ks,{className:"hfl-text-Primary-700",label:e.label,onSelect:()=>{Ee(e.label),ne(!1),ae(e.gender),i("honorific",e.label),i("gender",e.gender),E(s=>({...s,gender:e.gender,honorific:e.label}))}}))}),V.name&&ge.length>0&&t.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:$,children:[t.jsxRuntimeExports.jsx(t.bs,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),U&&U?.slice(0,7)?.map(e=>t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>ke(e),children:[t.jsxRuntimeExports.jsxs(t.bs,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[e?.org_person_name?.length>13?e?.org_person_name?.substring(0,11)+"...":e?.org_person_name,`(${e.ageStr||h.calculateAge(e.age)}, ${h.getGender(parseInt(e.org_person_gender.toString()))})`]}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:e.org_person_phone||""})]},e?.person_role_id))]})]}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.Ps,{label:`Phone Number ${m&&m.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:x.phone?x.phone:void 0,inputProps:{maxLength:10,value:O,placeholder:"Enter Number",onChange:e=>{i("phone",e.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:e=!1,msg:s=""}=m&&m.phone_number_length||O?h.validateMobileNo(O):{};c(r=>({...r,phone:e?s:""})),C({name:!1,phone:!1})}},width:"21em",start_icon:"hx_phone"}),V.phone&&O.length>0&&t.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:$,children:[t.jsxRuntimeExports.jsx(t.bs,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),U&&U?.slice(0,7)?.map(e=>t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>ke(e),children:[t.jsxRuntimeExports.jsxs(t.bs,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[e.org_person_name?.length>13?e.org_person_name?.substring(0,11)+"...":e.org_person_name,`(${e.ageStr||h.calculateAge(e.age)}, ${h.getGender(parseInt(e.org_person_gender.toString()))})`]}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:e.org_person_phone})]},e?.person_role_id))]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-h-[40px] hfl-space-y-1",children:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-pb-[1px] hfl-text-Gray-600",children:"Gender*"}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(t.ju,{className:`!hfl-h-[40px] hfl-w-44 ${x.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:nt,onChange:e=>he(e),disabled:!1}),!!x.gender&&t.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:x.gender})]})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[t.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:t.jsxRuntimeExports.jsx(t.ej,{label:"Age or DOB*",className:"hfl-w-20",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-w-16 hfl-border-0",suffixDropdownClassName:"hfl-ml-[80px]",input1value:l.age,input2value:N,end_icon:"hx_down",errorMsg:x.age?x.age:void 0,inputProps:{type:"number",min:0,maxLength:3,placeholder:"Age",onChange:e=>{i("age",e.target.value.replace(/[^0-9]/g,"")),E(s=>({...s,dob:""}))},onBlur:()=>{c(e=>({...e,age:I(N)}))}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"Select format"},suffixOptions:[{label:"Years",value:"years"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Days",value:"days"}],handleValChange:e=>{i("age",e),c(s=>({...s,age:I(N)}))},handleSuffixValChange:e=>{be(e),c(s=>({...s,age:I(e)}))},onSuffixDropdownClick:e=>{be(e.label),E(s=>({...s,age_selector:e.value,dob:""})),c(s=>({...s,age:I(e.value)}))}})}),t.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:t.jsxRuntimeExports.jsx(t.ZC,{className:"hfl-relative",placeholder:"DOB",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:l?.dob&&h.isValidDate(new Date(l?.dob))?new Date(K.dayjs(new Date(l?.dob)).format("DD-MMM-YYYY")):"",dateVar:e=>{E(s=>({...s,dob:K.dayjs(e).format("YYYY-MM-DD"),age:""})),c(s=>({...s,age:""}))},isborderRequired:!0,maxDate:new Date})})]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-1",children:t.jsxRuntimeExports.jsx(t.Ap,{value:{label:l?.patient_preferred_language?p.DefinedLanguages[l.patient_preferred_language]:"English"},placeholder:"English",label:"Preferred Language",onChange:e=>{i("patient_preferred_language",e.value)},options:Object.keys(p.DefinedLanguages).map(e=>({label:p.DefinedLanguages[e],value:e})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"dropdown-language"})})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-6",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-6/12 hfl-flex-col ",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"City",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.city,placeholder:"Enter City",onChange:e=>{i("city",e.target.value),le(!0),gt(e)},onBlur:e=>{e.stopPropagation(),le(!1)}},width:23.5+"em"}),tt&&re&&re.length>0&&t.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:re.map(e=>t.jsxRuntimeExports.jsx(t.ks,{label:e,className:"hfl-text-Primary-700",onSelect:()=>ut(e)}))})]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-pt-4",children:t.jsxRuntimeExports.jsx(t.Ps,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.pincode,placeholder:"Enter Pin",onChange:e=>{i("pincode",e.target.value)}},width:22.5+"em"})})]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-col",style:{height:"100%"},children:t.jsxRuntimeExports.jsx(t.bu,{className:"hfl-w-[355px]",label:"Address",inputProps:{value:l?.address,placeholder:"Enter Address",onChange:e=>{i("address",e.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),xe?t.jsxRuntimeExports.jsx(kt,{setEditPatient:ze,editPatient:G,createAsNew:qe,setCreateAsNew:Ue,showEditPrompt:xe}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),_e?t.jsxRuntimeExports.jsxs("div",{className:"",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pb-6",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),t.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:t.jsxRuntimeExports.jsx(t.bs,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Marital Status"})})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[t.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:t.jsxRuntimeExports.jsx(t.Ap,{value:{label:l.marital_status&&p.MARITAL_STATUS.find(e=>e===l.marital_status)||""},placeholder:"Marital Status",label:"Marital Status",onChange:e=>{i("marital_status",e.label)},options:p.MARITAL_STATUS.map(e=>({label:e,value:e})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"marital-status"})}),t.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-flex hfl-space-y-2",children:t.jsxRuntimeExports.jsx(t.ZC,{className:"hfl-relative",placeholder:"Since",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:l?.married_since&&h.isValidDate(new Date(l?.married_since))?new Date(K.dayjs(new Date(l?.married_since)).format("DD-MMM-YYYY")):"",dateVar:e=>{E(s=>({...s,married_since:K.dayjs(e).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),t.jsxRuntimeExports.jsx(t.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:l.blood_group&&p.bloodGroups.find(e=>e.value===l.blood_group)?.label||"Blood group"},onChange:e=>{i("blood_group",e.value)},options:p.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),l?.marital_status!==p.MARITAL_STATUS[0]&&t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Spouse Name",start_icon:"hx_person",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l.spouse_name,placeholder:"Enter Spouse Name",onChange:e=>{i("spouse_name",e.target.value)}},width:"21em"}),t.jsxRuntimeExports.jsx(t.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:l.spouse_blood_group?p.bloodGroups.find(e=>e.value===l.spouse_blood_group)?.label||"Spouse Blood group":"Blood group"},onChange:e=>{i("spouse_blood_group",e.value)},options:p.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),t.jsxRuntimeExports.jsx(Me,{}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:t.jsxRuntimeExports.jsx(t.ej,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:l.ref_doc_name,input2value:l.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:lt,suffixOptions:p.SpecialityList,handleValChange:e=>{i("ref_doc_name",e)},handleSuffixValChange:e=>{i("ref_doc_spec",e.value)},onDropdownClick:e=>{i("ref_doc_name",e.doctor_name),i("refDocId",e.doctor_id),i("ref_doc_spec",e.specialist)},onSuffixDropdownClick:e=>{i("ref_doc_spec",e.value)}})}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-4",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Existing ID (if any)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.existingBidStr,placeholder:"Enter ID",onChange:e=>{i("existingBidStr",e.target.value)}},width:"23em"}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Email",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:x.email?x.email:void 0,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:l.email,placeholder:"Enter Email",onChange:e=>{i("email",e.target.value.trim())},onBlur:e=>{e.target.value&&!Oe.create$6().email().isValidSync(e.target.value)?c(s=>({...s,email:"Email format is wrong"})):c(s=>({...s,email:""}))}},width:20.5+"em"})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-flex-row hfl-flex-wrap hfl-justify-between hfl-gap-y-6 hfl-py-6",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Channel (How did the patient hear about you?)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.throughChannel,placeholder:"Enter Channel",onChange:e=>{i("throughChannel",e.target.value),te(!0),xt(e)},onBlur:e=>{e.stopPropagation(),te(!1)}},width:"22em"}),Xe&&Q&&Q.length>0&&t.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:Q.map(e=>{const{title:s,...r}=e;return t.jsxRuntimeExports.jsx(t.ks,{label:s,className:"hfl-text-Primary-700",...r,onSelect:()=>ct({value:e.value})},e.value)})})]}),t.jsxRuntimeExports.jsx(t.Ps,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.careOf,placeholder:"Enter C/O",onChange:e=>{i("careOf",e.target.value)}},width:"22em"})]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[t.jsxRuntimeExports.jsx(t.Ps,{label:"Occupation",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l?.occupation,placeholder:"Enter Occupation",onChange:e=>{i("occupation",e.target.value),se(!0),mt(e)},onBlur:e=>{e.stopPropagation(),se(!1)}},width:"22em"}),et&&X&&X.length>0&&t.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:X.map(e=>t.jsxRuntimeExports.jsx(t.ks,{label:e,className:"hfl-text-Primary-700",onSelect:()=>pt(e)}))})]}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l.tag,placeholder:"Enter Tag",onChange:e=>{i("tag",e.target.value)}},width:"22em"}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Mobile 2",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:l.phoneSecondary,maxLength:10,placeholder:"Enter Secondary Number",onChange:e=>{i("phoneSecondary",e.target.value.replace(/[^0-9]/g,""))}},width:"22em"}),t.jsxRuntimeExports.jsx(t.Ps,{label:"Aadhar Number",labelColor:"hfl-text-Gray-600",errorMsg:x.aadhar_number?x.aadhar_number:void 0,labelSize:"Text sm",inputProps:{value:l.aadhar_number,placeholder:"Aadhar Card Number",maxLength:12,onChange:e=>{i("aadhar_number",e.target.value)},onBlur:()=>{c(e=>({...e,aadhar_number:l.aadhar_number&&l.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"}),t.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-11 hfl-gap-y-6",children:Bt()})]}),t.jsxRuntimeExports.jsx(Me,{}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3",children:t.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:[t.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-flex-col hfl-items-center hfl-justify-between
|
|
4
4
|
${me?"":"hfl-hidden"}`,children:[t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:"Primary",size:"lg",textField:"Camera",className:"hfl-mb-2",onClick:Ct,icon:"Left",iconFile:"hx_camera"}),t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx("input",{id:"upload-local-file",type:"file",style:{display:"none"},accept:"image/*",onChange:St}),t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:"Secondary",size:"lg",textField:"Upload",icon:"Left",iconFile:"hx_image-add",onClick:Pt})]})]}),t.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-flex
|