hplx-feature-library 1.0.308 → 1.0.310
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-BPjQvoDr.cjs → APIAction-BC572SUh.cjs} +1 -1
- package/dist/{APIAction-Cn6CnUPj.js → APIAction-Dh1jeN3Q.js} +2 -2
- package/dist/AllInvestigations/index.js +1 -1
- package/dist/{AllInvestigationsTable-o7sUrypz.js → AllInvestigationsTable-6WZYLxgn.js} +121 -121
- package/dist/AllInvestigationsTable-IN3Gv1wb.cjs +80 -0
- package/dist/Attachments/index.js +1 -1
- package/dist/Attachments-C5eZR_b9.cjs +186 -0
- package/dist/{Attachments-Bl0Bb93j.js → Attachments-Ddu-Ak3N.js} +36 -36
- package/dist/NineDots/index.js +1 -1
- package/dist/{NineDots-BenIdNn6.cjs → NineDots-CEKYCz_l.cjs} +1 -1
- package/dist/{NineDots-BovmR9lR.js → NineDots-CZxm95h0.js} +1 -1
- package/dist/PatientAddEdit/index.js +1 -1
- package/dist/{PatientAddEdit-BsvMkDPi.js → PatientAddEdit-Bsa6mPrj.js} +5 -5
- package/dist/{PatientAddEdit-CiUyGlRS.cjs → PatientAddEdit-CtM4xbMa.cjs} +1 -1
- package/dist/PatientPopup/index.js +1 -1
- package/dist/PatientPopupContainer-DOJniw5Q.cjs +36 -0
- package/dist/{PatientPopupContainer-BjejzoZp.js → PatientPopupContainer-VaUWBPAN.js} +512 -512
- package/dist/PediatricsCalculator/index.js +1 -1
- package/dist/{PediatricsCalculatorTable-CoHNZcKB.js → PediatricsCalculatorTable-Bsotwgba.js} +2 -2
- package/dist/{PediatricsCalculatorTable-Bfnfpscv.cjs → PediatricsCalculatorTable-C59lNMNS.cjs} +1 -1
- package/dist/{PrintModal-BYaI_gvN.cjs → PrintModal-D8CPsVQ6.cjs} +46 -46
- package/dist/{PrintModal-Dnu4I6Bq.js → PrintModal-DAhX2jNv.js} +587 -587
- package/dist/SearchPatients/index.js +1 -1
- package/dist/{SearchPatients-BURn-eU9.cjs → SearchPatients-1FVfZoeQ.cjs} +1 -1
- package/dist/{SearchPatients-BTmBvIpk.js → SearchPatients-tEIv_TBu.js} +3 -3
- package/dist/UserProfile/index.js +1 -1
- package/dist/{UserProfile-D9u7TGPM.js → UserProfile-CXotmcbO.js} +4 -4
- package/dist/{UserProfile-BcdsuEnn.cjs → UserProfile-DeVg1Gym.cjs} +1 -1
- package/dist/{common-utils-BmJs-CNu.cjs → common-utils-D1ID7-VY.cjs} +1 -1
- package/dist/{common-utils-fQX0KRKT.js → common-utils-P_6EPLut.js} +1 -1
- package/dist/{dayjs.min-Dx50Uhvr.js → dayjs.min-CI-igRZR.js} +15 -15
- package/dist/dayjs.min-Dq_-qqjW.cjs +1 -0
- package/dist/hplx-feature-library.css +1 -1
- package/dist/index-C8nmTIgQ.cjs +102 -0
- package/dist/{index-DPIXOYYJ.js → index-CJFGOBPb.js} +2 -2
- package/dist/{index-Cuk4eOa2.js → index-D9tHKxGo.js} +19 -19
- package/dist/index-DfcUmlge.cjs +17 -0
- package/dist/{index-D-5bovl6.js → index-Ku_Lrm51.js} +565 -565
- package/dist/index-fA2CtGkU.cjs +32 -0
- package/dist/index.js +9 -9
- package/dist/print-pdf/index.js +1 -1
- package/package.json +2 -2
- package/dist/AllInvestigationsTable-DKMxC37E.cjs +0 -80
- package/dist/Attachments-DP1L4bRq.cjs +0 -186
- package/dist/PatientPopupContainer-CNb0MKZc.cjs +0 -36
- package/dist/dayjs.min-QUFnA3Sz.cjs +0 -1
- package/dist/index-83gl7aAu.cjs +0 -32
- package/dist/index-D-bucTJp.cjs +0 -102
- package/dist/index-Dsi-BJd2.cjs +0 -17
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { j as l, b as o, K as C, w as pa, P as v, k as fe, a as ua, t as ml, Z as Me, A as ce, c as ma, q as xa } from "./index-
|
|
1
|
+
import { j as l, b as o, K as C, w as pa, P as v, k as fe, a as ua, t as ml, Z as Me, A as ce, c as ma, q as xa } from "./index-Ku_Lrm51.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { M as Nl } from "./index-
|
|
3
|
+
import { M as Nl } from "./index-D9tHKxGo.js";
|
|
4
4
|
import { useState as n, useEffect as M, useRef as re, useCallback as x, useMemo as xl } from "react";
|
|
5
5
|
import { c as gl } from "./index.esm-Bn1Rklqj.js";
|
|
6
|
-
import { d as pe } from "./dayjs.min-
|
|
6
|
+
import { d as pe } from "./dayjs.min-CI-igRZR.js";
|
|
7
7
|
import { E as Le } from "./CommonTypes-BzMrYraH.js";
|
|
8
8
|
import { H as ga, D as Fe, M as Ge, b as ue, S as _a, C as Ie, O as ze } from "./CommonConstant-BMwbE0IZ.js";
|
|
9
|
-
import { e as ba, i as ya, d as va, f as wa, p as ja, j as Ca, k as Na, l as _l, a as He, m as bl, g as yl, v as vl, n as wl } from "./common-utils-
|
|
10
|
-
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-
|
|
9
|
+
import { e as ba, i as ya, d as va, f as wa, p as ja, j as Ca, k as Na, l as _l, a as He, m as bl, g as yl, v as vl, n as wl } from "./common-utils-P_6EPLut.js";
|
|
10
|
+
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-Dh1jeN3Q.js";
|
|
11
11
|
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 }) => {
|
|
12
12
|
const [S, y] = n(!1);
|
|
13
13
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./index-D-bucTJp.cjs");;/* empty css */const nt=require("./index-83gl7aAu.cjs"),a=require("react"),lt=require("./index.esm-BdlMQ1M7.cjs"),oe=require("./dayjs.min-QUFnA3Sz.cjs"),De=require("./CommonTypes-Bg9068wC.cjs"),x=require("./CommonConstant-BUchL6Rc.cjs"),c=require("./common-utils-BmJs-CNu.cjs"),B=require("./APIAction-BPjQvoDr.cjs"),rt=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Wt=({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,d)=>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:d+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:()=>c.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 Kt(R){const{editPatient:_,setEditPatient:G,createAsNew:C,setCreateAsNew:b}=R,o=()=>_?"Primary":"Secondary",d=()=>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:d(),size:"lg",textField:"New Patient",onClick:()=>{b(!0),G(!1)}})]})}const Te=15,at=3,Zt=({isOpen:R,onClose:_,onSubmit:G,otpErrorMsg:C,setOtpErrorMsg:b,optHeading:o,otpSubHeading:d,veriftButtonTitle:m,resendOtp:J})=>{const[$,w]=a.useState(""),[F,p]=a.useState(Te),[se,I]=a.useState(!1),[z,Y]=a.useState(0);a.useEffect(()=>{R&&(w(""),b(""),p(Te),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<at&&(J(),Y(O=>O+1),p(Te),I(!1))};return e.jsxRuntimeExports.jsxs(nt.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:d}),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>=at?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})]})]})},Jt=R=>{const{closeModal:_,modalIsOpen:G,pref:C,variable:b}=R,{window_var:o,token:d,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([]),[ke,K]=a.useState(!1),[P,le]=a.useState(""),[g,it]=a.useState(),[j,u]=a.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[re,ot]=a.useState([]),[ae,H]=a.useState({name:!1,phone:!1}),[ce,ht]=a.useState([]),[ue,dt]=a.useState([]),[pe,ft]=a.useState([]),[ct,xe]=a.useState(!1),[ut,me]=a.useState(!1),[pt,ge]=a.useState(!1),[_e,xt]=a.useState([]),[k,mt]=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:[]}),[gt,_t]=a.useState([]),{name:Ae,phone:A,age:N,dob:M,gender:Be}=s,[Oe,Le]=a.useState(!1),[jt,je]=a.useState(s.gender),[S,Me]=a.useState("Years"),[Ge,Fe]=a.useState(""),[Ie,be]=a.useState(!1),[bt,yt]=a.useState([]),v=(t,l,r,n)=>{yt([{id:1,title:t,description:l,type:r,duration:n}])},q=a.useRef(null),ze=a.useRef(null),[He,X]=a.useState(!1),[Et,ye]=a.useState(!1),[Rt,Ve]=a.useState(!1),[qe,Ee]=a.useState(!1),[Ue,Re]=a.useState(!1),[ne,vt]=a.useState(),D=g&&g.visit_pad_json&&c.isJson(g.visit_pad_json)&&JSON.parse(g.visit_pad_json),$e=c.debounceFn((...t)=>{const[l,r]=t;Bt(l,r)}),i=a.useCallback((t,l)=>{ye(!1),L(r=>({...r,[t]:l})),(t==="name"||t==="phone"&&l.length>=3)&&$e(t,l)},[$e]),Ct=t=>{i("throughChannel",t.value.trim()),xe(!1)},T=a.useMemo(()=>ne?.branch_details?.enable_mobile_otp=="1",[ne?.branch_details?.enable_mobile_otp]),wt=t=>{i("occupation",t.trim()),me(!1)},Pt=t=>{i("city",t.trim()),ge(!1)},Nt=t=>{const{value:l}=t.target,r=Tt(l);ht(r)},St=t=>{const{value:l}=t.target,r=kt(l);dt(r)},Dt=t=>{const{value:l}=t.target,r=At(l);xt(r)},Tt=t=>{if(pe?.length){let l=pe;return t?.length&&(l=pe.filter(r=>r.title.toLowerCase().includes(t.toLowerCase()))),l}else return[]},kt=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[]},At=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[]},Ye=a.useRef(null),ie=a.useRef(null),ve=a.useRef(null),We=window.location?.pathname.includes("/frontdesk");a.useEffect(()=>{const t=c.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]),Ke=t=>{(Ye.current&&!Ye.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)},Ze=a.useCallback(()=>{le(s.image_link),K(!1),X(!1)},[s.image_link]),Je=a.useCallback(async()=>{const t=await B.getBranchPreferences("patient_config",o?.org_branch_id_for_seg?.toString()||"",{token:d,envName:m});vt(t)},[d,m,o?.org_branch_id_for_seg]);a.useEffect(()=>(document.addEventListener("mousedown",Ke),()=>{document.removeEventListener("mousedown",Ke)}),[]),a.useEffect(()=>{o.doctor_speciality==="Gynaecologist"&&!s.gender&&Ce("1")},[s.gender,Ce,o.doctor_speciality]),a.useEffect(()=>{s.image_link&&Ze(),s.honorific&&Fe(s.honorific)},[s.honorific,s.image_link,Ze]),a.useEffect(()=>{We&&Le(!0)},[We]),a.useEffect(()=>{Je()},[Je]),a.useEffect(()=>{(async()=>{it(C);try{const t=await B.getReferredByList({token:d,envName:m}),{total_ref_doc_details:l,through_channel:r}=t;l.length&&_t(c.parseReferredByDocList(l)),r.length&&ft(c.parseThroughChannelList(r))}catch(t){console.log("ERROR",t)}})()},[C,d,m]);const Bt=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:d,envName:m});if(!n){H({name:!1,phone:!1});return}!n.apiError&&Number(n.total_persons)>0?(ot(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]),Ot=a.useCallback(async t=>{(await B.patientConsentOTPVerification(A,t,b)).apiError?v("Invalid OTP","Please enter correct OTP","Error",3e3):(mt(!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 De.EAPP_ROUTES.visitpad+"?pid="}},Lt=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:d,envName:m}})},[m,d]),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]),Xe=async t=>{Ve(!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||""};Lt(l),H({name:!1,phone:!1}),fe(!0),F(t)},Qe=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),Be===""&&(u(l=>({...l,gender:"Select Gender"})),t=!1),j.email.length&&(s.email&&!lt.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,Be,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:d,envName:m});n.apiError&&v("Error",n.apiError,"Error",3e3)},[P,m,d]),et=a.useCallback(async t=>{const l=new FormData;l.append("pid",t);const r=await B.deletePatientImage(l,{token:d,envName:m});r.apiError&&v("Error",r.apiError,"Error",3e3)},[m,d]),Ne=a.useCallback(async(t,l)=>{try{if(!Qe()){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",c.getGenderKey(s.gender)),n.append("honorific",s.honorific),n.append("patient_preferred_language",s.patient_preferred_language),n.append("age",M&&M.length?M:c.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 f=Object.fromEntries(n.entries()),y=Object.fromEntries(Object.entries(f).map(([te,Yt])=>[te,String(Yt)])),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:""},h=await B.addPatientDetails(E,{token:d,envName:m});if(h.apiError)v("Error",h.apiError,"Error",3e3),ye(!1);else{if(t){try{P&&await Q(h.person_role_id.toString(),h.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",h.person_role_id.toString(),h.person_id.toString(),g,D,l):c.goToPage(Pe(l)+h.person_role_id.toString()+we(l)),_();return}else{try{P&&await Q(h.person_role_id.toString(),h.org_person_bid_str.toString())}catch(te){console.log(te)}ee()}h?.conflicts?.length>0?($(!0),W(h.conflicts)):_(),Array.isArray(h?.person)||v("Success","Patient Added Successfully","Success",3e3),h!=null&&!h?.conflicts?.length&&h?.person_role_id&&(l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",h.person_role_id.toString(),h.person_id.toString(),g,D,l):c.goToPage(Pe(l)+h.person_role_id.toString()+we(l)),_())}}catch(r){console.log(r)}},[Qe,T,k,p,s,M,S,o,d,m,D,_,P,Q,g]),Mt=()=>{try{const t={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[De.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[De.EAPP_ROUTES.appointments]:["appointments_mfe"]},l=window.location?.pathname||"",r=t[l];if(!r?.length)return;const n=document.getElementById("react_emr_mfe"),f=document.getElementById("react_curtains_mfe"),y=document.querySelector(".offlineEMR3");[n,f,y].forEach(E=>{E&&E.classList.contains("hidden")&&E.classList.remove("hidden")});for(const E of r){const h=document.getElementsByClassName(E);h.length&&!h[0].classList.contains("hidden")&&h[0].classList.add("hidden")}}catch(t){console.error("Error in manipulating DOM:",t)}},tt=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:c.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:d,envName:m});if(p){r&&ye(!1);const{message:n,status:f}=r||{};if(f){v("Patient Edited","Patient Edited Successfully","Success",1500);try{s?.image_link&&!P?et(w?.person_role_id):P&&qe&&(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):c.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,d,m,p,D,_,P,qe,et,Q,g]),Gt=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)}},Ft=()=>{const t=ze.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()}}},It=()=>{document.getElementById("upload-local-file")?.click()},zt=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=""}},st=()=>{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}},Ht=a.useMemo(()=>[...ne?.patient_config?.custom_fields||[]].sort((r,n)=>r.sort-n.sort).map(r=>{const n=s.custom_fields?.find(f=>f.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 f=n.custom_fields?.length?n.custom_fields.map(E=>E.id===t?{...E,value:r}:E):[];return f.some(E=>E.id===t)||f.push({id:t,value:r,title:l}),{...n,custom_fields:f}})},Vt=()=>Ht?.map(t=>{const{id:l,type:r,value:n,title:f}=t||{};if(!l||!r||!f)return null;switch(r){case"text":return e.jsxRuntimeExports.jsx(e.Pi,{label:f,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:n||"",placeholder:`Enter ${f}`,onChange:y=>{Se(l,f,y.target.value)}},width:"22em"},l);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:f,placeholder:`Select ${f}`,selectDate:n?new Date(n):null,dateVar:y=>{Se(l,f,y.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:y=>{Se(l,f,y)},openUp:!0,backSpaceClearDate:!0},l);default:return null}}),V=a.useCallback(t=>{z(t),p?tt(t):Ne(!1,t)},[p,tt,Ne]),qt=a.useCallback(()=>{if(T&&!p&&!k){z("Rx"),U();return}V("Rx")},[T,p,k,U,V]),Ut=a.useCallback(()=>{if(T&&!p&&!k){z("Bill"),U();return}V("Bill")},[T,p,k,U,V]),$t=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(nt.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(Wt,{conflicts:O,handleAddPatient:Ne,redirectAction:I,manipulateExistingDOM:Mt}):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:Ge}),!Ge.length&&e.jsxRuntimeExports.jsx("div",{className:`${Ie?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:j.name?j.name:void 0,inputProps:{type:"text",value:Ae,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&&!Rt?u(l=>({...l,name:"Enter at least 2 letters "})):u(l=>({...l,name:t?"Enter the Name of the Patient":""})),Ve(!1),H({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Ie&&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:()=>{Fe(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&&Ae.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:()=>Xe(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||c.calculateAge(t.age)}, ${c.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?c.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:()=>Xe(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||c.calculateAge(t.age)}, ${c.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&&Ue&&e.jsxRuntimeExports.jsx(Zt,{isOpen:Ue,onClose:()=>Re(!1),onSubmit:t=>Ot(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:jt,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=>{Me(t),u(l=>({...l,age:Z(t)}))},onSuffixDropdownClick:t=>{Me(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&&c.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),Dt(t)},onBlur:t=>{t.stopPropagation(),ge(!1)}},width:23.5+"em"}),pt&&_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:()=>Pt(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(Kt,{setEditPatient:se,editPatient:p,createAsNew:Y,setCreateAsNew:he}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),Oe?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&&c.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(rt,{}),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:gt,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&&!lt.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),Nt(t)},onBlur:t=>{t.stopPropagation(),xe(!1)}},width:"22em"}),ct&&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:()=>Ct({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),St(t)},onBlur:t=>{t.stopPropagation(),me(!1)}},width:"22em"}),ut&&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:()=>wt(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:Vt()})]}),e.jsxRuntimeExports.jsx(rt,{}),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-C8nmTIgQ.cjs");;/* empty css */const nt=require("./index-fA2CtGkU.cjs"),a=require("react"),lt=require("./index.esm-BdlMQ1M7.cjs"),oe=require("./dayjs.min-Dq_-qqjW.cjs"),De=require("./CommonTypes-Bg9068wC.cjs"),x=require("./CommonConstant-BUchL6Rc.cjs"),c=require("./common-utils-D1ID7-VY.cjs"),B=require("./APIAction-BC572SUh.cjs"),rt=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Wt=({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,d)=>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:d+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:()=>c.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 Kt(R){const{editPatient:_,setEditPatient:G,createAsNew:C,setCreateAsNew:b}=R,o=()=>_?"Primary":"Secondary",d=()=>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:d(),size:"lg",textField:"New Patient",onClick:()=>{b(!0),G(!1)}})]})}const Te=15,at=3,Zt=({isOpen:R,onClose:_,onSubmit:G,otpErrorMsg:C,setOtpErrorMsg:b,optHeading:o,otpSubHeading:d,veriftButtonTitle:m,resendOtp:J})=>{const[$,w]=a.useState(""),[F,p]=a.useState(Te),[se,I]=a.useState(!1),[z,Y]=a.useState(0);a.useEffect(()=>{R&&(w(""),b(""),p(Te),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<at&&(J(),Y(O=>O+1),p(Te),I(!1))};return e.jsxRuntimeExports.jsxs(nt.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:d}),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>=at?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})]})]})},Jt=R=>{const{closeModal:_,modalIsOpen:G,pref:C,variable:b}=R,{window_var:o,token:d,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([]),[ke,K]=a.useState(!1),[P,le]=a.useState(""),[g,it]=a.useState(),[j,u]=a.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[re,ot]=a.useState([]),[ae,H]=a.useState({name:!1,phone:!1}),[ce,ht]=a.useState([]),[ue,dt]=a.useState([]),[pe,ft]=a.useState([]),[ct,xe]=a.useState(!1),[ut,me]=a.useState(!1),[pt,ge]=a.useState(!1),[_e,xt]=a.useState([]),[k,mt]=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:[]}),[gt,_t]=a.useState([]),{name:Ae,phone:A,age:N,dob:M,gender:Be}=s,[Oe,Le]=a.useState(!1),[jt,je]=a.useState(s.gender),[S,Me]=a.useState("Years"),[Ge,Fe]=a.useState(""),[Ie,be]=a.useState(!1),[bt,yt]=a.useState([]),v=(t,l,r,n)=>{yt([{id:1,title:t,description:l,type:r,duration:n}])},q=a.useRef(null),ze=a.useRef(null),[He,X]=a.useState(!1),[Et,ye]=a.useState(!1),[Rt,Ve]=a.useState(!1),[qe,Ee]=a.useState(!1),[Ue,Re]=a.useState(!1),[ne,vt]=a.useState(),D=g&&g.visit_pad_json&&c.isJson(g.visit_pad_json)&&JSON.parse(g.visit_pad_json),$e=c.debounceFn((...t)=>{const[l,r]=t;Bt(l,r)}),i=a.useCallback((t,l)=>{ye(!1),L(r=>({...r,[t]:l})),(t==="name"||t==="phone"&&l.length>=3)&&$e(t,l)},[$e]),Ct=t=>{i("throughChannel",t.value.trim()),xe(!1)},T=a.useMemo(()=>ne?.branch_details?.enable_mobile_otp=="1",[ne?.branch_details?.enable_mobile_otp]),wt=t=>{i("occupation",t.trim()),me(!1)},Pt=t=>{i("city",t.trim()),ge(!1)},Nt=t=>{const{value:l}=t.target,r=Tt(l);ht(r)},St=t=>{const{value:l}=t.target,r=kt(l);dt(r)},Dt=t=>{const{value:l}=t.target,r=At(l);xt(r)},Tt=t=>{if(pe?.length){let l=pe;return t?.length&&(l=pe.filter(r=>r.title.toLowerCase().includes(t.toLowerCase()))),l}else return[]},kt=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[]},At=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[]},Ye=a.useRef(null),ie=a.useRef(null),ve=a.useRef(null),We=window.location?.pathname.includes("/frontdesk");a.useEffect(()=>{const t=c.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]),Ke=t=>{(Ye.current&&!Ye.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)},Ze=a.useCallback(()=>{le(s.image_link),K(!1),X(!1)},[s.image_link]),Je=a.useCallback(async()=>{const t=await B.getBranchPreferences("patient_config",o?.org_branch_id_for_seg?.toString()||"",{token:d,envName:m});vt(t)},[d,m,o?.org_branch_id_for_seg]);a.useEffect(()=>(document.addEventListener("mousedown",Ke),()=>{document.removeEventListener("mousedown",Ke)}),[]),a.useEffect(()=>{o.doctor_speciality==="Gynaecologist"&&!s.gender&&Ce("1")},[s.gender,Ce,o.doctor_speciality]),a.useEffect(()=>{s.image_link&&Ze(),s.honorific&&Fe(s.honorific)},[s.honorific,s.image_link,Ze]),a.useEffect(()=>{We&&Le(!0)},[We]),a.useEffect(()=>{Je()},[Je]),a.useEffect(()=>{(async()=>{it(C);try{const t=await B.getReferredByList({token:d,envName:m}),{total_ref_doc_details:l,through_channel:r}=t;l.length&&_t(c.parseReferredByDocList(l)),r.length&&ft(c.parseThroughChannelList(r))}catch(t){console.log("ERROR",t)}})()},[C,d,m]);const Bt=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:d,envName:m});if(!n){H({name:!1,phone:!1});return}!n.apiError&&Number(n.total_persons)>0?(ot(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]),Ot=a.useCallback(async t=>{(await B.patientConsentOTPVerification(A,t,b)).apiError?v("Invalid OTP","Please enter correct OTP","Error",3e3):(mt(!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 De.EAPP_ROUTES.visitpad+"?pid="}},Lt=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:d,envName:m}})},[m,d]),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]),Xe=async t=>{Ve(!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||""};Lt(l),H({name:!1,phone:!1}),fe(!0),F(t)},Qe=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),Be===""&&(u(l=>({...l,gender:"Select Gender"})),t=!1),j.email.length&&(s.email&&!lt.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,Be,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:d,envName:m});n.apiError&&v("Error",n.apiError,"Error",3e3)},[P,m,d]),et=a.useCallback(async t=>{const l=new FormData;l.append("pid",t);const r=await B.deletePatientImage(l,{token:d,envName:m});r.apiError&&v("Error",r.apiError,"Error",3e3)},[m,d]),Ne=a.useCallback(async(t,l)=>{try{if(!Qe()){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",c.getGenderKey(s.gender)),n.append("honorific",s.honorific),n.append("patient_preferred_language",s.patient_preferred_language),n.append("age",M&&M.length?M:c.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 f=Object.fromEntries(n.entries()),y=Object.fromEntries(Object.entries(f).map(([te,Yt])=>[te,String(Yt)])),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:""},h=await B.addPatientDetails(E,{token:d,envName:m});if(h.apiError)v("Error",h.apiError,"Error",3e3),ye(!1);else{if(t){try{P&&await Q(h.person_role_id.toString(),h.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",h.person_role_id.toString(),h.person_id.toString(),g,D,l):c.goToPage(Pe(l)+h.person_role_id.toString()+we(l)),_();return}else{try{P&&await Q(h.person_role_id.toString(),h.org_person_bid_str.toString())}catch(te){console.log(te)}ee()}h?.conflicts?.length>0?($(!0),W(h.conflicts)):_(),Array.isArray(h?.person)||v("Success","Patient Added Successfully","Success",3e3),h!=null&&!h?.conflicts?.length&&h?.person_role_id&&(l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",h.person_role_id.toString(),h.person_id.toString(),g,D,l):c.goToPage(Pe(l)+h.person_role_id.toString()+we(l)),_())}}catch(r){console.log(r)}},[Qe,T,k,p,s,M,S,o,d,m,D,_,P,Q,g]),Mt=()=>{try{const t={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[De.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[De.EAPP_ROUTES.appointments]:["appointments_mfe"]},l=window.location?.pathname||"",r=t[l];if(!r?.length)return;const n=document.getElementById("react_emr_mfe"),f=document.getElementById("react_curtains_mfe"),y=document.querySelector(".offlineEMR3");[n,f,y].forEach(E=>{E&&E.classList.contains("hidden")&&E.classList.remove("hidden")});for(const E of r){const h=document.getElementsByClassName(E);h.length&&!h[0].classList.contains("hidden")&&h[0].classList.add("hidden")}}catch(t){console.error("Error in manipulating DOM:",t)}},tt=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:c.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:d,envName:m});if(p){r&&ye(!1);const{message:n,status:f}=r||{};if(f){v("Patient Edited","Patient Edited Successfully","Success",1500);try{s?.image_link&&!P?et(w?.person_role_id):P&&qe&&(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):c.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,d,m,p,D,_,P,qe,et,Q,g]),Gt=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)}},Ft=()=>{const t=ze.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()}}},It=()=>{document.getElementById("upload-local-file")?.click()},zt=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=""}},st=()=>{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}},Ht=a.useMemo(()=>[...ne?.patient_config?.custom_fields||[]].sort((r,n)=>r.sort-n.sort).map(r=>{const n=s.custom_fields?.find(f=>f.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 f=n.custom_fields?.length?n.custom_fields.map(E=>E.id===t?{...E,value:r}:E):[];return f.some(E=>E.id===t)||f.push({id:t,value:r,title:l}),{...n,custom_fields:f}})},Vt=()=>Ht?.map(t=>{const{id:l,type:r,value:n,title:f}=t||{};if(!l||!r||!f)return null;switch(r){case"text":return e.jsxRuntimeExports.jsx(e.Pi,{label:f,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:n||"",placeholder:`Enter ${f}`,onChange:y=>{Se(l,f,y.target.value)}},width:"22em"},l);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:f,placeholder:`Select ${f}`,selectDate:n?new Date(n):null,dateVar:y=>{Se(l,f,y.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:y=>{Se(l,f,y)},openUp:!0,backSpaceClearDate:!0},l);default:return null}}),V=a.useCallback(t=>{z(t),p?tt(t):Ne(!1,t)},[p,tt,Ne]),qt=a.useCallback(()=>{if(T&&!p&&!k){z("Rx"),U();return}V("Rx")},[T,p,k,U,V]),Ut=a.useCallback(()=>{if(T&&!p&&!k){z("Bill"),U();return}V("Bill")},[T,p,k,U,V]),$t=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(nt.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(Wt,{conflicts:O,handleAddPatient:Ne,redirectAction:I,manipulateExistingDOM:Mt}):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:Ge}),!Ge.length&&e.jsxRuntimeExports.jsx("div",{className:`${Ie?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:j.name?j.name:void 0,inputProps:{type:"text",value:Ae,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&&!Rt?u(l=>({...l,name:"Enter at least 2 letters "})):u(l=>({...l,name:t?"Enter the Name of the Patient":""})),Ve(!1),H({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Ie&&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:()=>{Fe(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&&Ae.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:()=>Xe(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||c.calculateAge(t.age)}, ${c.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?c.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:()=>Xe(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||c.calculateAge(t.age)}, ${c.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&&Ue&&e.jsxRuntimeExports.jsx(Zt,{isOpen:Ue,onClose:()=>Re(!1),onSubmit:t=>Ot(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:jt,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=>{Me(t),u(l=>({...l,age:Z(t)}))},onSuffixDropdownClick:t=>{Me(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&&c.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),Dt(t)},onBlur:t=>{t.stopPropagation(),ge(!1)}},width:23.5+"em"}),pt&&_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:()=>Pt(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(Kt,{setEditPatient:se,editPatient:p,createAsNew:Y,setCreateAsNew:he}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),Oe?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&&c.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(rt,{}),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:gt,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&&!lt.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),Nt(t)},onBlur:t=>{t.stopPropagation(),xe(!1)}},width:"22em"}),ct&&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:()=>Ct({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),St(t)},onBlur:t=>{t.stopPropagation(),me(!1)}},width:"22em"}),ut&&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:()=>wt(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:Vt()})]}),e.jsxRuntimeExports.jsx(rt,{}),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
|
${ke?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Camera",className:"hfl-mb-2",onClick:Gt,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:zt}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:"Upload",icon:"Left",iconFile:"hx_image-add",onClick:It})]})]}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-flex
|