hplx-feature-library 1.0.264 → 1.0.265

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.
@@ -1,4 +1,4 @@
1
- import { P as f } from "../PatientAddEdit-Bsk_4kOY.js";
1
+ import { P as f } from "../PatientAddEdit-DPUUVgt-.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -0,0 +1,7 @@
1
+ "use strict";const e=require("./index-D4uYXq_j.cjs");;/* empty css */const at=require("./index-Dqp7vsb7.cjs"),a=require("react"),st=require("./index.esm-BdlMQ1M7.cjs"),oe=require("./dayjs.min-b-u3u61q.cjs"),h=require("./common-utils-d6QnkaWh.cjs"),x=require("./CommonConstant-COHqiSWL.cjs"),B=require("./APIAction-CW7tpjtQ.cjs"),lt=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Yt=({conflicts:R,handleAddPatient:_,redirectAction:G})=>{const[C,b]=a.useState(!1);return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-[20%] hfl-my-5 hfl-text-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Error-700",children:"Patient/s with similar information already exists in your Clinic. To continue with an existing patient click on “Continue."})}),e.jsxRuntimeExports.jsxs("table",{className:"hfl-mx-7",children:[e.jsxRuntimeExports.jsx("thead",{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full",children:[e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[40px] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"#"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Name"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Phone No"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Email"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Branch"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-rounded-tr hfl-border-b hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]"})]})}),R.map((o,f)=>e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full hfl-border-1 hfl-border-Gray-100",children:[e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:f+1})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:o.org_person_name||o.name})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_phone||o.phone})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:o.org_person_email||o.email})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-500",children:"In Same Branch"})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:window.role_id=="11"&&e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"Continue",className:"hfl-text-Primary-700",onClick: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}`)}})})]}))]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-my-7 hfl-flex hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Success-800",children:"If your patient is not in the above list"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.Ku,{disabled:C,hierarchy:"Primary",size:"xl",textField:"Create As New Patient",className:"hfl-bg-Primary-700",onClick:()=>{b(!0),_(!0,G)}})})]})};function Wt(R){const{editPatient:_,setEditPatient:G,createAsNew:C,setCreateAsNew:b}=R,o=()=>_?"Primary":"Secondary",f=()=>C?"Primary":"Secondary";return e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-6 hfl-flex hfl-h-20 hfl-w-full hfl-items-center hfl-justify-center hfl-gap-4 hfl-border-1 hfl-border-Error-200 hfl-bg-Error-25",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"Are you updating"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:o(),size:"lg",textField:"Exisitng Patient",onClick:()=>{G(!0),b(!1)}}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"or creating a"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:f(),size:"lg",textField:"New Patient",onClick:()=>{b(!0),G(!1)}})]})}const De=15,rt=3,Kt=({isOpen:R,onClose:_,onSubmit:G,otpErrorMsg:C,setOtpErrorMsg:b,optHeading:o,otpSubHeading:f,veriftButtonTitle:m,resendOtp:J})=>{const[$,w]=a.useState(""),[F,u]=a.useState(De),[se,I]=a.useState(!1),[z,Y]=a.useState(0);a.useEffect(()=>{R&&(w(""),b(""),u(De),I(!1),Y(0))},[R,b]),a.useEffect(()=>{if(F>0&&R){const O=setInterval(()=>{u(W=>W-1)},1e3);return()=>clearInterval(O)}else F===0&&R&&I(!0)},[F,R]);const he=O=>{O.preventDefault(),String($).length===6&&G($)},de=O=>{C&&b("");const W=O.target.value;/^\d*$/.test(W)&&w(W)},fe=()=>{se&&z<rt&&(J(),Y(O=>O+1),u(De),I(!1))};return e.jsxRuntimeExports.jsxs(at.Modal,{isOpen:R,onRequestClose:_,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1032},content:{maxWidth:"400px",maxHeight:"350px",display:"flex",flexDirection:"column",justifyContent:"center",padding:"24px",margin:"auto",borderRadius:"12px"}},ariaHideApp:!1,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-justify-end",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary-Grey",icon:"Only",iconFile:"hx_close",onClick:_,size:"md",textField:""})}),e.jsxRuntimeExports.jsxs("form",{className:"hfl-z-5 hfl-relative hfl-flex hfl-h-full hfl-flex-col hfl-items-center hfl-justify-center hfl-text-center",onSubmit:he,children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:o}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-mx-auto hfl-w-[290px] hfl-pt-2 hfl-text-Gray-500",children:f}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-auto hfl-max-h-[150px] hfl-w-[315px] hfl-py-5",children:e.jsxRuntimeExports.jsx(e.wu,{inputProps:{autoFocus:!0,value:$,pattern:"[0-9]+",onChange:de},size:"xs",digits:6,errorMsg:C})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mb-4 hfl-h-4",children:z>=rt?e.jsxRuntimeExports.jsx(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Error-500",children:"Maximum resend attempts reached."}):se?e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-cursor-pointer hfl-text-Primary-700 hfl-underline",onClick:fe,children:"Resend OTP"}):e.jsxRuntimeExports.jsxs(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Gray-500",children:["Resend OTP in 00:",F<10?`0${F}`:F]})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:m,disabled:String($).length<6})]})]})},Zt=R=>{const{closeModal:_,modalIsOpen:G,pref:C,variable:b}=R,{window_var:o,token:f,envName:m}=b,[J,$]=a.useState(!1),[w,F]=a.useState({}),[u,se]=a.useState(!1),[I,z]=a.useState(null),[Y,he]=a.useState(!0),[de,fe]=a.useState(!1),[O,W]=a.useState([]),[Te,K]=a.useState(!1),[P,le]=a.useState(""),[g,nt]=a.useState(),[j,p]=a.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[re,it]=a.useState([]),[ae,H]=a.useState({name:!1,phone:!1}),[ce,ot]=a.useState([]),[pe,ht]=a.useState([]),[ue,dt]=a.useState([]),[ft,xe]=a.useState(!1),[ct,me]=a.useState(!1),[pt,ge]=a.useState(!1),[_e,ut]=a.useState([]),[k,xt]=a.useState(!1),[s,L]=a.useState({name:"",phone:"",dob:"",gender:"",honorific:"",patient_preferred_language:C?.visit_pad_json?JSON.parse(C?.visit_pad_json)?.defaultLanguage?.rows:"",age:"",age_selector:"years",blood_group:"",email:"",address:"",city:"",existingBidStr:"",pincode:"",ref_doc_name:"",ref_doc_spec:"",temp_appnt_id:"",throughChannel:"",refDocId:"",careOf:"",phoneSecondary:"",occupation:"",tag:"",phone_otp:"",regAsNew:"",image_link:"",marital_status:"",spouse_blood_group:"",married_since:"",spouse_name:"",org_person_dob:"",aadhar_number:"",custom_fields:[]}),[mt,gt]=a.useState([]),{name:ke,phone:A,age:N,dob:M,gender:Ae}=s,[Be,Oe]=a.useState(!1),[_t,je]=a.useState(s.gender),[S,Le]=a.useState("Years"),[Me,Ge]=a.useState(""),[Fe,be]=a.useState(!1),[jt,bt]=a.useState([]),v=(t,l,r,n)=>{bt([{id:1,title:t,description:l,type:r,duration:n}])},q=a.useRef(null),Ie=a.useRef(null),[ze,X]=a.useState(!1),[yt,ye]=a.useState(!1),[Et,He]=a.useState(!1),[Ve,Ee]=a.useState(!1),[qe,Re]=a.useState(!1),[ne,Rt]=a.useState(),D=g&&g.visit_pad_json&&h.isJson(g.visit_pad_json)&&JSON.parse(g.visit_pad_json),Ue=h.debounceFn((...t)=>{const[l,r]=t;At(l,r)}),i=a.useCallback((t,l)=>{ye(!1),L(r=>({...r,[t]:l})),(t==="name"||t==="phone"&&l.length>=3)&&Ue(t,l)},[Ue]),vt=t=>{i("throughChannel",t.value.trim()),xe(!1)},T=a.useMemo(()=>ne?.branch_details?.enable_mobile_otp=="1",[ne?.branch_details?.enable_mobile_otp]),Ct=t=>{i("occupation",t.trim()),me(!1)},wt=t=>{i("city",t.trim()),ge(!1)},Pt=t=>{const{value:l}=t.target,r=Dt(l);ot(r)},Nt=t=>{const{value:l}=t.target,r=Tt(l);ht(r)},St=t=>{const{value:l}=t.target,r=kt(l);ut(r)},Dt=t=>{if(ue?.length){let l=ue;return t?.length&&(l=ue.filter(r=>r.title.toLowerCase().includes(t.toLowerCase()))),l}else return[]},Tt=t=>{if(x.OccupationList?.length){let l=x.OccupationList;return t?.length&&(l=x.OccupationList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},kt=t=>{if(x.CityList?.length){let l=x.CityList;return t?.length&&(l=x.CityList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},$e=a.useRef(null),ie=a.useRef(null),ve=a.useRef(null),Ye=window.location?.pathname.includes("/frontdesk");a.useEffect(()=>{const t=h.calculateDOB(s.age,S);t&&L(l=>({...l,dob:t}))},[S,s.age]);const Ce=a.useCallback(t=>{je(t),i("gender",t),p(l=>({...l,gender:""}))},[i]),We=t=>{($e.current&&!$e.current.contains(t.target)||ie.current&&!ie.current.contains(t.target))&&H({name:!1,phone:!1}),ve.current&&!ve.current.contains(t.target)&&be(!1)},Ke=a.useCallback(()=>{le(s.image_link),K(!1),X(!1)},[s.image_link]),Ze=a.useCallback(async()=>{const t=await B.getBranchPreferences("patient_config",o?.org_branch_id_for_seg?.toString()||"",{token:f,envName:m});Rt(t)},[f,m,o?.org_branch_id_for_seg]);a.useEffect(()=>(document.addEventListener("mousedown",We),()=>{document.removeEventListener("mousedown",We)}),[]),a.useEffect(()=>{o.doctor_speciality==="Gynaecologist"&&!s.gender&&Ce("1")},[s.gender,Ce,o.doctor_speciality]),a.useEffect(()=>{s.image_link&&Ke(),s.honorific&&Ge(s.honorific)},[s.honorific,s.image_link,Ke]),a.useEffect(()=>{Ye&&Oe(!0)},[Ye]),a.useEffect(()=>{Ze()},[Ze]),a.useEffect(()=>{(async()=>{nt(C);try{const t=await B.getReferredByList({token:f,envName:m}),{total_ref_doc_details:l,through_channel:r}=t;l.length&&gt(h.parseReferredByDocList(l)),r.length&&dt(h.parseThroughChannelList(r))}catch(t){console.log("ERROR",t)}})()},[C,f,m]);const At=async(t,l)=>{const r={branch_id:o?.org_branch_id_for_seg||"",doctor_id:o?.person_id_for_seg||"",doctor_role_id:o?.doctor_role_id_for_seg||"",term:encodeURIComponent(l),limit:30},n=await B.getPatientList(r,{token:f,envName:m});if(!n){H({name:!1,phone:!1});return}!n.apiError&&Number(n.total_persons)>0?(it(n.persons),H(t==="name"?{...ae,name:!0}:{...ae,phone:!0})):H({name:!1,phone:!1})},U=a.useCallback(async()=>{if(!T||!Y)return;Re(!0),(await B.patientConsentSendOTP(A,b)).apiError?v("OTP Failed","Unable to send OTP. Please try again.","Error",3e3):v("Success","OTP sent successfully","Success",1500)},[T,Y,A,b]),Bt=a.useCallback(async t=>{(await B.patientConsentOTPVerification(A,t,b)).apiError?v("Invalid OTP","Please enter correct OTP","Error",3e3):(xt(!0),v("Success","OTP verified successfully","Success",1500),Re(!1))},[A,b]),we=t=>{switch(t){case"Appointment":return"#Appnt";default:return""}},Pe=t=>{switch(t){case"Bill":case"Appointment":return"emrPatientPopUp.php?pid=";default:return h.EAPP_ROUTES.visitpad+"?pid="}},Ot=a.useCallback(t=>{const l=r=>{L({name:r?.name||"",phone:r?.phone_number||"",gender:r?.gender||"",honorific:r?.honorific||"",patient_preferred_language:r?.patient_preferred_language||"",ref_doc_spec:r?.ref_doc_spec||"",age:r?.age.toString()||"",age_selector:"2",dob:r.org_person_dob||"",org_person_dob:r.org_person_dob||"",blood_group:r?.blood_group||"",email:r?.email||"",address:r?.address||"",city:r?.city||"",existingBidStr:r?.org_person_bid_str||"",pincode:r?.pincode||"",ref_doc_name:r?.ref_doc_name||"",temp_appnt_id:"",throughChannel:r?.through_channel||"",refDocId:r?.ref_doc_id||"",careOf:r?.care_of||"",phoneSecondary:r?.phone_secondary||"",occupation:r?.occupation||"",tag:r?.tag||"",phone_otp:"",regAsNew:"",image_link:r?.image_link||"",marital_status:r.marital_status||"",spouse_blood_group:r.spouse_blood_group||"",married_since:r.married_since||"",spouse_name:r.spouse_name||"",aadhar_number:r.aadhar_number||"",custom_fields:r.custom_fields||[]}),je(r?.gender)};B.getPatientDetails({callback:l,payload:t,token_env:{token:f,envName:m}})},[m,f]),Z=a.useCallback((t="")=>{const l=t?.toLowerCase();return M!==""?"":N!==""&&Number(N)<0&&M===""?"Invalid Age":l==="weeks"&&N!==""&&Number(N)<5907||l==="days"&&N!==""&&Number(N)<9999||l==="months"&&N!==""&&Number(N)<1358||l==="years"&&N!==""&&Number(N)<114?"":"Invalid Age"},[M,N]),Je=async t=>{He(!0);const l={branch_id:o?.org_branch_id_for_seg?.toString()||"",person_id:o?.person_id_for_seg||"",person_role_id:o?.doctor_role_id_for_seg||"",patient_role_id:t.person_role_id||""};Ot(l),H({name:!1,phone:!1}),fe(!0),F(t)},Xe=a.useCallback(()=>{let t=!0;return s.name?s.name.length<2&&(p(l=>({...l,name:"Enter at least 2 letters "})),t=!1):(p(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)&&(p(l=>({...l,phone:"Please enter 10 digit number"})),t=!1),s.aadhar_number&&s.aadhar_number.length!=12&&(p(l=>({...l,aadhar_number:"Please enter 12 digit aadhar number"})),t=!1),Z(S).length&&M?.length===0&&(p(l=>({...l,age:"Invalid Age."})),t=!1),Ae===""&&(p(l=>({...l,gender:"Select Gender"})),t=!1),j.email.length&&(s.email&&!st.create$6().email().isValidSync(s.email)&&p(l=>({...l,email:"Email format is wrong"})),t=!1),t},[s.name,s.phone.length,s.aadhar_number,s.email,g,Z,S,M?.length,Ae,j.email.length]),Q=a.useCallback(async(t,l)=>{const r=new FormData;r.append("pid",t),r.append("bidstr",l),r.append("imgData",P);const n=await B.addPatientImage(r,{token:f,envName:m});n.apiError&&v("Error",n.apiError,"Error",3e3)},[P,m,f]),Qe=a.useCallback(async t=>{const l=new FormData;l.append("pid",t);const r=await B.deletePatientImage(l,{token:f,envName:m});r.apiError&&v("Error",r.apiError,"Error",3e3)},[m,f]),Ne=a.useCallback(async(t,l)=>{try{if(!Xe()){v("Invalid form","Please fill in the required fields","Error",3e3);return}if(T&&!k&&!u){v("Consent Required","Please provide patient consent.","Error",3e3);return}const n=new FormData;n.append("name",s.name),n.append("phone",s.phone),n.append("gender",h.getGenderKey(s.gender)),n.append("honorific",s.honorific),n.append("patient_preferred_language",s.patient_preferred_language),n.append("age",M&&M.length?M:h.calculateDate(s?.age,S)||""),n.append("age_selector",s.age_selector),n.append("blood_group",s.blood_group),n.append("email",s.email),n.append("address",s.address),n.append("city",s.city),n.append("existing_bid_str",s.existingBidStr),n.append("pincode",s.pincode),n.append("ref_doc_id",s.refDocId),n.append("ref_doc_name",s.ref_doc_name),n.append("ref_doc_spec",s.ref_doc_spec),n.append("through_channel",s.throughChannel),n.append("care_of",s.careOf),n.append("phone_secondary",s.phoneSecondary),n.append("occupation",s.occupation),n.append("tag",s.tag),n.append("marital_status",s.marital_status),n.append("married_since",s.married_since),n.append("spouse_name",s.spouse_name),n.append("spouse_blood_group",s.spouse_blood_group),n.append("aadhar_number",s.aadhar_number),n.append("custom_fields",JSON.stringify(s.custom_fields||[])),t&&n.append("reg_as_new","1");const c=Object.fromEntries(n.entries()),y=Object.fromEntries(Object.entries(c).map(([te,$t])=>[te,String($t)])),E={...y,custom_fields:JSON.parse(y.custom_fields||"[]"),doctor_role_id:o.doctor_role_id_for_seg||"",doctor_id:o.person_id_for_seg||"",org_branch_id:o.org_branch_id_for_seg||"",source:"emr",ip:""},d=await B.addPatientDetails(E,{token:f,envName:m});if(d.apiError)v("Error",d.apiError,"Error",3e3),ye(!1);else{if(t){try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_();return}else{try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}ee()}d?.conflicts?.length>0?($(!0),W(d.conflicts)):_(),Array.isArray(d?.person)||v("Success","Patient Added Successfully","Success",3e3),d!=null&&!d?.conflicts?.length&&d?.person_role_id&&(l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_())}}catch(r){console.log(r)}},[Xe,T,k,u,s,M,S,o,f,m,D,_,P,Q,g]),Lt=()=>{try{const t={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[h.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[h.EAPP_ROUTES.appointments]:["appointments_mfe"]},l=window.location?.pathname||"",r=t[l];if(!r?.length)return;const n=document.getElementById("react_emr_mfe"),c=document.getElementById("react_curtains_mfe"),y=document.querySelector(".offlineEMR3");[n,c,y].forEach(E=>{E&&E.classList.contains("hidden")&&E.classList.remove("hidden")});for(const E of r){const d=document.getElementsByClassName(E);d.length&&!d[0].classList.contains("hidden")&&d[0].classList.add("hidden")}}catch(t){console.error("Error in manipulating DOM:",t)}},et=a.useCallback(async t=>{const l={patient_id:w?.person_id,honorific:s?.honorific,name:s?.name,gender:s?.gender,age:s?.age,org_person_dob:s?.dob?s.dob:h.calculateDate(s?.age,S)||void 0,phone_number:s?.phone,email:s?.email,blood_group:s?.blood_group,patient_preferred_language:s?.patient_preferred_language,address:s?.address,city:s?.city,pincode:s?.pincode,org_person_bid_str:s?.existingBidStr,ref_doc_name:s?.ref_doc_name,ref_doc_spec:s?.ref_doc_spec,through_channel:s?.throughChannel,ref_doc_id:s?.refDocId,care_of:s?.careOf,phone_secondary:s?.phoneSecondary,occupation:s?.occupation,tag:s?.tag,marital_status:s.marital_status,married_since:s.married_since,spouse_name:s.spouse_name,spouse_blood_group:s.spouse_blood_group,image_link:s?.image_link,remote_consultation_id:"0",oc_status:!1,aadhar_number:s?.aadhar_number,person_role_id:o.doctor_role_id_for_seg||"",person_id:o.person_id_for_seg||"",branch_id:o.org_branch_id_for_seg||""},r=await B.updatePatientDetails(l,{token:f,envName:m});if(u){r&&ye(!1);const{message:n,status:c}=r||{};if(c){v("Patient Edited","Patient Edited Successfully","Success",1500);try{s?.image_link&&!P?Qe(w?.person_role_id):P&&Ve&&(Ee(!1),await Q(w?.person_role_id,s?.existingBidStr))}catch(y){console.log(y)}t!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof window.patientPopupHandler<"u"?window.patientPopupHandler("addpatient",w?.person_role_id,w?.person_id,g,D,t):h.goToPage(Pe(t)+w?.person_role_id?.toString()+we(t)),_()}else v("Patient Not Edited",n||"Patient Not Edited","Failure",1500)}},[w?.person_id,w?.person_role_id,s,S,o,f,m,u,D,_,P,Ve,Qe,Q,g]),Mt=async()=>{try{K(!1);const t=await navigator.mediaDevices.getUserMedia({video:!0});q.current&&(q.current.srcObject=t),X(!0)}catch(t){console.error("Error accessing camera:",t)}},Gt=()=>{const t=Ie.current,l=q.current;if(t&&l){t.width=l.videoWidth,t.height=l.videoHeight;const r=t.getContext("2d");if(r){r.drawImage(l,0,0,t.width,t.height);const n=t.toDataURL();le(n),K(!1),X(!1),ee()}}},Ft=()=>{document.getElementById("upload-local-file")?.click()},It=t=>{K(!1),X(!1);const l=t.target.files?.[0];if(!l)return;const r=new FileReader;r.readAsDataURL(l),r.onloadend=()=>{const n=r.result;n&&le(n.toString()),t.target.value=""}},tt=()=>{K(!0),le(""),X(!1),ee()},ee=()=>{if(q.current){const t=q.current.srcObject;t instanceof MediaStream&&t.getTracks().forEach(l=>l.stop()),q.current.srcObject=null}},zt=a.useMemo(()=>[...ne?.patient_config?.custom_fields||[]].sort((r,n)=>r.sort-n.sort).map(r=>{const n=s.custom_fields?.find(c=>c.id===r.id);return{...r,value:n?.value||"",title:n?.value?n?.title:r.title}}),[ne?.patient_config?.custom_fields,s.custom_fields]),Se=(t,l,r)=>{L(n=>{const c=n.custom_fields?.length?n.custom_fields.map(E=>E.id===t?{...E,value:r}:E):[];return c.some(E=>E.id===t)||c.push({id:t,value:r,title:l}),{...n,custom_fields:c}})},Ht=()=>zt?.map(t=>{const{id:l,type:r,value:n,title:c}=t||{};if(!l||!r||!c)return null;switch(r){case"text":return e.jsxRuntimeExports.jsx(e.Pi,{label:c,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:n||"",placeholder:`Enter ${c}`,onChange:y=>{Se(l,c,y.target.value)}},width:"22em"},l);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:c,placeholder:`Select ${c}`,selectDate:n?new Date(n):null,dateVar:y=>{Se(l,c,y.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:y=>{Se(l,c,y)},openUp:!0,backSpaceClearDate:!0},l);default:return null}}),V=a.useCallback(t=>{z(t),u?et(t):Ne(!1,t)},[u,et,Ne]),Vt=a.useCallback(()=>{if(T&&!u&&!k){z("Rx"),U();return}V("Rx")},[T,u,k,U,V]),qt=a.useCallback(()=>{if(T&&!u&&!k){z("Bill"),U();return}V("Bill")},[T,u,k,U,V]),Ut=a.useCallback(()=>{if(T&&!u&&!k){z("Appointment"),U();return}V("Appointment")},[T,u,k,U,V]);return a.useEffect(()=>{k&&I&&(V(I),z(null))},[k,I,V]),e.jsxRuntimeExports.jsx(at.Modal,{isOpen:G,onRequestClose:()=>{ee(),_()},shouldCloseOnOverlayClick:!1,style:{content:{zIndex:1030,padding:"0px",maxWidth:"840px",maxHeight:"624px",margin:"auto",borderRadius:"12px"},overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",zIndex:1030}},children:e.jsxRuntimeExports.jsxs("div",{id:"add-patient-modal",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-16 hfl-w-full hfl-flex-row hfl-items-center hfl-justify-between hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-6",id:"add-patient-header","data-qa":"testid_addPatient",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xl",children:J?"Patient(s) with Same phone number or Email":"Add New Patient"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-items-center",children:e.jsxRuntimeExports.jsx("span",{className:"hx_close hfl-ml-4 hover:hfl-cursor-pointer",onClick:()=>{ee(),_()}})})]}),J?e.jsxRuntimeExports.jsx(Yt,{conflicts:O,handleAddPatient:Ne,redirectAction:I,manipulateExistingDOM:Lt}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-min-h-[400px] hfl-px-10 hfl-py-5",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:e.jsxRuntimeExports.jsxs("div",{ref:ve,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>be(t=>!t),children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:Me}),!Me.length&&e.jsxRuntimeExports.jsx("div",{className:`${Fe?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:j.name?j.name:void 0,inputProps:{type:"text",value:ke,placeholder:"Enter Name",onChange:t=>{i("name",t.target.value)},onBlur:()=>{const t=!(s.name.length>0);s.name.length>0&&s.name.length<2&&!Et?p(l=>({...l,name:"Enter at least 2 letters "})):p(l=>({...l,name:t?"Enter the Name of the Patient":""})),He(!1),H({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Fe&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-h-[270px] hfl-w-20 hfl-flex-col hfl-overflow-y-auto hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},children:x.HonorificList.map(t=>e.jsxRuntimeExports.jsx(e.ki,{className:"hfl-text-Primary-700",label:t.label,onSelect:()=>{Ge(t.label),be(!1),je(t.gender),i("honorific",t.label),i("gender",t.gender),L(l=>({...l,gender:t.gender,honorific:t.label}))}}))}),ae.name&&ke.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[16px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t?.org_person_name?.length>13?t?.org_person_name?.substring(0,11)+"...":t?.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone||""})]},t?.person_role_id))]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-gap-3",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:`Phone Number ${g&&g.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:j.phone?j.phone:void 0,inputProps:{maxLength:10,value:A,placeholder:"Enter Number",onChange:t=>{i("phone",t.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:t=!1,msg:l=""}=g&&g.phone_number_length||A?h.validateMobileNo(A):{};p(r=>({...r,phone:t?l:""})),H({name:!1,phone:!1})}},width:"21em",start_icon:"hx_phone"}),ae.phone&&A.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[24px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t.org_person_name?.length>13?t.org_person_name?.substring(0,11)+"...":t.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone})]},t?.person_role_id))]})]})})]}),T&&!u&&qe&&e.jsxRuntimeExports.jsx(Kt,{isOpen:qe,onClose:()=>Re(!1),onSubmit:t=>Bt(t),optHeading:"Verify with a OTP",otpSubHeading:`Please enter the OTP shared on ${A}`,veriftButtonTitle:"Verify OTP",resendOtp:U,otpErrorMsg:"",setOtpErrorMsg:()=>{}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-h-[40px] hfl-space-y-1",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-pb-[1px] hfl-text-Gray-600",children:"Gender*"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.ju,{className:`!hfl-h-[40px] hfl-w-44 ${j.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:_t,onChange:t=>Ce(t),disabled:!1}),!!j.gender&&e.jsxRuntimeExports.jsx("div",{className:"hfl-font-inter hfl-text-1 hfl-font-inter-0 hfl-leading-10 hfl-tracking-1 hfl-text-Error-500",children:j.gender})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.tj,{label:"Age or DOB*",className:"hfl-w-20",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-w-16 hfl-border-0",suffixDropdownClassName:"hfl-ml-[80px]",input1value:s.age,input2value:S,end_icon:"hx_down",errorMsg:j.age?j.age:void 0,inputProps:{type:"number",min:0,maxLength:3,placeholder:"Age",onChange:t=>{i("age",t.target.value.replace(/[^0-9]/g,"")),L(l=>({...l,dob:""}))},onBlur:()=>{p(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),p(l=>({...l,age:Z(S)}))},handleSuffixValChange:t=>{Le(t),p(l=>({...l,age:Z(t)}))},onSuffixDropdownClick:t=>{Le(t.label),L(l=>({...l,age_selector:t.value,dob:""})),p(l=>({...l,age:Z(t.value)}))}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"DOB",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.dob&&h.isValidDate(new Date(s?.dob))?new Date(oe.dayjs(new Date(s?.dob)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,dob:oe.dayjs(t).format("YYYY-MM-DD"),age:""})),p(l=>({...l,age:""}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:s?.patient_preferred_language?x.DefinedLanguages[s.patient_preferred_language]:"English"},placeholder:"English",label:"Preferred Language",onChange:t=>{i("patient_preferred_language",t.value)},options:Object.keys(x.DefinedLanguages).map(t=>({label:x.DefinedLanguages[t],value:t})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"dropdown-language"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-6/12 hfl-flex-col ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"City",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.city,placeholder:"Enter City",onChange:t=>{i("city",t.target.value),ge(!0),St(t)},onBlur:t=>{t.stopPropagation(),ge(!1)}},width:23.5+"em"}),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:()=>wt(t)}))})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-pt-4",children:e.jsxRuntimeExports.jsx(e.Pi,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.pincode,placeholder:"Enter Pin",onChange:t=>{i("pincode",t.target.value)}},width:22.5+"em"})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-col",style:{height:"100%"},children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-w-[355px]",label:"Address",inputProps:{value:s?.address,placeholder:"Enter Address",onChange:t=>{i("address",t.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),de?e.jsxRuntimeExports.jsx(Wt,{setEditPatient:se,editPatient:u,createAsNew:Y,setCreateAsNew:he}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),Be?e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pb-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Marital Status"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:s.marital_status&&x.MARITAL_STATUS.find(t=>t===s.marital_status)||""},placeholder:"Marital Status",label:"Marital Status",onChange:t=>{i("marital_status",t.label)},options:x.MARITAL_STATUS.map(t=>({label:t,value:t})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"marital-status"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-flex hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"Since",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.married_since&&h.isValidDate(new Date(s?.married_since))?new Date(oe.dayjs(new Date(s?.married_since)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,married_since:oe.dayjs(t).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:s.blood_group&&x.bloodGroups.find(t=>t.value===s.blood_group)?.label||"Blood group"},onChange:t=>{i("blood_group",t.value)},options:x.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),s?.marital_status!==x.MARITAL_STATUS[0]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Spouse Name",start_icon:"hx_person",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.spouse_name,placeholder:"Enter Spouse Name",onChange:t=>{i("spouse_name",t.target.value)}},width:"21em"}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:s.spouse_blood_group?x.bloodGroups.find(t=>t.value===s.spouse_blood_group)?.label||"Spouse Blood group":"Blood group"},onChange:t=>{i("spouse_blood_group",t.value)},options:x.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:e.jsxRuntimeExports.jsx(e.tj,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:s.ref_doc_name,input2value:s.ref_doc_spec,end_icon:"hx_down",inputProps:{placeholder:"Doctor Name"},suffixInputProps:{placeholder:"Speciality"},className:"hfl-w-48",suffixClassName:"hfl-w-[100px]",suffixDropdownClassName:"hfl-ml-[160px]",options:mt,suffixOptions:x.SpecialityList,handleValChange:t=>{i("ref_doc_name",t)},handleSuffixValChange:t=>{i("ref_doc_spec",t.value)},onDropdownClick:t=>{i("ref_doc_name",t.doctor_name),i("refDocId",t.doctor_id),i("ref_doc_spec",t.specialist)},onSuffixDropdownClick:t=>{i("ref_doc_spec",t.value)}})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-pb-6 hfl-pt-4",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Existing ID (if any)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.existingBidStr,placeholder:"Enter ID",onChange:t=>{i("existingBidStr",t.target.value)}},width:"23em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Email",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:j.email?j.email:void 0,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:s.email,placeholder:"Enter Email",onChange:t=>{i("email",t.target.value.trim())},onBlur:t=>{t.target.value&&!st.create$6().email().isValidSync(t.target.value)?p(l=>({...l,email:"Email format is wrong"})):p(l=>({...l,email:""}))}},width:20.5+"em"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-flex-row hfl-flex-wrap hfl-justify-between hfl-gap-y-6 hfl-py-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Channel (How did the patient hear about you?)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.throughChannel,placeholder:"Enter Channel",onChange:t=>{i("throughChannel",t.target.value),xe(!0),Pt(t)},onBlur:t=>{t.stopPropagation(),xe(!1)}},width:"22em"}),ft&&ce&&ce.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:ce.map(t=>{const{title:l,...r}=t;return e.jsxRuntimeExports.jsx(e.ki,{label:l,className:"hfl-text-Primary-700",...r,onSelect:()=>vt({value:t.value})},t.value)})})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.careOf,placeholder:"Enter C/O",onChange:t=>{i("careOf",t.target.value)}},width:"22em"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Occupation",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.occupation,placeholder:"Enter Occupation",onChange:t=>{i("occupation",t.target.value),me(!0),Nt(t)},onBlur:t=>{t.stopPropagation(),me(!1)}},width:"22em"}),ct&&pe&&pe.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:pe.map(t=>e.jsxRuntimeExports.jsx(e.ki,{label:t,className:"hfl-text-Primary-700",onSelect:()=>Ct(t)}))})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.tag,placeholder:"Enter Tag",onChange:t=>{i("tag",t.target.value)}},width:"22em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Mobile 2",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.phoneSecondary,maxLength:10,placeholder:"Enter Secondary Number",onChange:t=>{i("phoneSecondary",t.target.value.replace(/[^0-9]/g,""))}},width:"22em"}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Aadhar Number",labelColor:"hfl-text-Gray-600",errorMsg:j.aadhar_number?j.aadhar_number:void 0,labelSize:"Text sm",inputProps:{value:s.aadhar_number,placeholder:"Aadhar Card Number",maxLength:12,onChange:t=>{i("aadhar_number",t.target.value)},onBlur:()=>{p(t=>({...t,aadhar_number:s.aadhar_number&&s.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-11 hfl-gap-y-6",children:Ht()})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-h-[153px] hfl-w-[200px] hfl-items-center hfl-justify-center
2
+ hfl-rounded-3xl hfl-border-4
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
+ ${Te?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Camera",className:"hfl-mb-2",onClick:Mt,icon:"Left",iconFile:"hx_camera"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("input",{id:"upload-local-file",type:"file",style:{display:"none"},accept:"image/*",onChange:It}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:"Upload",icon:"Left",iconFile:"hx_image-add",onClick:Ft})]})]}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-flex
5
+ ${ze?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx("canvas",{ref:Ie,style:{display:"none"}}),e.jsxRuntimeExports.jsx("video",{ref:q,className:"hfl-object-fit hfl-h-full hfl-w-full hfl-rounded-3xl",autoPlay:!0}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-bottom-0 hfl-left-0 hfl-right-0 hfl-flex hfl-justify-around",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Cancel",className:"hfl-mb-2 hfl-bg-Error-600 hover:hfl-bg-Error-700",onClick:tt}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Capture",className:"hfl-mb-2 hfl-bg-Primary-600",onClick:Gt})]})]}),e.jsxRuntimeExports.jsx("div",{className:Te||P||ze?"hfl-hidden":"",onClick:()=>{Ee(!0),K(!0)},"data-qa":"profile-img",children:e.jsxRuntimeExports.jsxs("svg",{width:"76",height:"72",viewBox:"0 0 76 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.4",d:"M75.375 26.0477V57.1667C75.6016 59.1092 75.3857 61.0778 74.7434 62.925C74.1011 64.7722 73.0491 66.4501 71.6663 67.8329C70.2834 69.2158 68.6055 70.2678 66.7583 70.9101C64.9111 71.5524 62.9425 71.7683 61 71.5417H15C13.0575 71.7683 11.0889 71.5524 9.2417 70.9101C7.3945 70.2678 5.71661 69.2158 4.33373 67.8329C2.95086 66.4501 1.89887 64.7722 1.25659 62.925C0.614305 61.0778 0.398381 59.1092 0.624996 57.1667V18.8333C0.398381 16.8908 0.614305 14.9222 1.25659 13.075C1.89887 11.2278 2.95086 9.54994 4.33373 8.16707C5.71661 6.7842 7.3945 5.73221 9.2417 5.08992C11.0889 4.44764 13.0575 4.23172 15 4.45833H48.7333C48.9029 4.46277 49.0695 4.50469 49.221 4.58109C49.3725 4.65748 49.5052 4.76645 49.6096 4.90019C49.7141 5.03393 49.7876 5.18911 49.825 5.35462C49.8624 5.52013 49.8626 5.69187 49.8258 5.8575C48.9214 10.3365 49.831 14.9913 52.355 18.8004C54.879 22.6094 58.8112 25.2613 63.2885 26.1742C66.8321 26.8826 70.5088 26.4602 73.7995 24.9667C73.975 24.8968 74.1649 24.8712 74.3526 24.8921C74.5403 24.9131 74.72 24.9799 74.8757 25.0868C75.0314 25.1936 75.1584 25.3372 75.2455 25.5048C75.3326 25.6724 75.3771 25.8588 75.375 26.0477Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M69.2877 46.2877L52.2217 29.2217C51.4989 28.5016 50.5202 28.0973 49.5 28.0973C48.4798 28.0973 47.5011 28.5016 46.7783 29.2217L27.8417 48.1583C27.4834 48.5095 27.0017 48.7062 26.5 48.7062C25.9983 48.7062 25.5166 48.5095 25.1583 48.1583L21.555 44.555C20.8322 43.835 19.8536 43.4307 18.8333 43.4307C17.8131 43.4307 16.8344 43.835 16.1117 44.555L6.71233 53.9543C6.49661 54.1698 6.37527 54.4621 6.375 54.767V57.1667C6.375 63.2233 8.94333 65.7917 15 65.7917H61C67.0567 65.7917 69.625 63.2233 69.625 57.1667V47.1003C69.6247 46.7954 69.5034 46.5031 69.2877 46.2877Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M22.6667 31.2917C22.0374 31.2939 21.4139 31.1722 20.8317 30.9335C20.2494 30.6948 19.7199 30.3438 19.2734 29.9004C18.3715 29.005 17.8623 27.7881 17.8577 26.5172C17.8532 25.2464 18.3536 24.0258 19.249 23.124C20.1444 22.2221 21.3613 21.7129 22.6322 21.7083H22.6667C23.9375 21.7083 25.1563 22.2132 26.0549 23.1118C26.9535 24.0104 27.4583 25.2292 27.4583 26.5C27.4583 27.7708 26.9535 28.9896 26.0549 29.8882C25.1563 30.7868 23.9375 31.2917 22.6667 31.2917Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M74.5317 7.21833L68.7817 1.46833C68.2421 0.930873 67.5116 0.629108 66.75 0.629108C65.9884 0.629108 65.2579 0.930873 64.7183 1.46833L58.9683 7.21833C58.4605 7.76333 58.184 8.48418 58.1972 9.229C58.2103 9.97382 58.512 10.6845 59.0388 11.2112C59.5655 11.738 60.2762 12.0397 61.021 12.0528C61.7658 12.066 62.4867 11.7895 63.0317 11.2817L63.875 10.4422V18.8333C63.875 19.5958 64.1779 20.3271 64.7171 20.8663C65.2562 21.4054 65.9875 21.7083 66.75 21.7083C67.5125 21.7083 68.2438 21.4054 68.7829 20.8663C69.3221 20.3271 69.625 19.5958 69.625 18.8333V10.4422L70.4683 11.2817C71.0133 11.7895 71.7342 12.066 72.479 12.0528C73.2238 12.0397 73.9345 11.738 74.4612 11.2112C74.988 10.6845 75.2897 9.97382 75.3028 9.229C75.316 8.48418 75.0395 7.76333 74.5317 7.21833Z",fill:"#396CE8"})]})}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-h-full hfl-w-full
6
+ ${P?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx("img",{src:P,alt:"ProfilePicturePreview",className:"hfl-h-full hfl-w-full hfl-rounded-3xl hfl-object-cover"}),e.jsxRuntimeExports.jsx("div",{className:`hfl-absolute hfl-right-2 hfl-top-2 hfl-flex hfl-h-[40px]
7
+ hfl-w-[40px] hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-rounded-full hfl-bg-White`,onClick:()=>{Ee(!0),tt()},children:e.jsxRuntimeExports.jsx("i",{className:"hx_delete hfl-text-[22px]"})})]})]})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",children:["If you want to add more details,"," "]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-cursor-pointer hfl-text-Primary-700",onClick:()=>{Oe(!0)},children:"Click Here"})]})]}),e.jsxRuntimeExports.jsx("div",{className:`${Be?"":"hfl-flex hfl-w-full"} hfl-sticky hfl-bottom-0 hfl-bg-White`,children:J?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[118px] hfl-w-full hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-1",style:{boxShadow:"-3px -1px 4px rgba(0, 0, 0, 0.25)"},children:[window.location?.href.indexOf("/frontdesk")==-1&&e.jsxRuntimeExports.jsx(e.Ku,{disabled:yt,hierarchy:"Primary",size:"sm",textField:"Add & Create Rx",className:"hfl-bg-Primary-600",onClick:Vt}),e.jsxRuntimeExports.jsx("div",{children:window.location?.href.indexOf("/frontdesk")==-1&&e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:"or"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"Add & Create Bill",className:"hfl-w-[190px] hfl-flex-1 hfl-justify-center hfl-text-Primary-700",onClick:qt}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"Add & Create Appointment",className:"hfl-w-[190px] hfl-flex-1 hfl-justify-center hfl-text-Primary-700",onClick:Ut})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[100]",children:e.jsxRuntimeExports.jsx(e.qh,{toastList:jt})})]})})]})})};exports.PatientAddEdit=Zt;
@@ -1,51 +1,51 @@
1
- import { j as l, b as h, K as C, w as pa, P as v, k as fe, a as ua, t as ml, Z as Le, A as ce, c as ma, q as xa } from "./index-BZg5otIE.js";
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 Le, A as ce, c as ma, q as xa } from "./index-BZg5otIE.js";
2
2
  /* empty css */
3
3
  import { M as Nl } from "./index-Bw4Rb7rV.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
6
  import { d as pe } from "./dayjs.min-mOIokT7c.js";
7
- import { a as me, i as ga, d as _a, e as ba, p as ya, f as va, j as ja, k as _l, l as bl, g as yl, v as vl, m as jl, E as Fe } from "./common-utils-DyBcT-ea.js";
8
- import { H as wa, D as Ge, M as Ie, b as ue, S as Ca, C as ze, O as He } from "./CommonConstant-Bj7SvPfU.js";
7
+ import { a as me, i as ga, d as _a, e as ba, p as ya, f as va, j as wa, k as _l, l as bl, g as yl, v as vl, m as wl, E as Fe } from "./common-utils-DyBcT-ea.js";
8
+ import { H as ja, D as Ge, M as Ie, b as ue, S as Ca, C as ze, O as He } from "./CommonConstant-Bj7SvPfU.js";
9
9
  import { a as Na, b as Pa, p as Sa, c as Da, d as Ea, e as Ta, f as Ba, h as Oa, u as Ra, g as Aa } from "./APIAction-DC2OLVlQ.js";
10
- const wl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200" }), ka = ({ conflicts: N, handleAddPatient: _, redirectAction: I }) => {
10
+ const jl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200" }), ka = ({ conflicts: N, handleAddPatient: _, redirectAction: I }) => {
11
11
  const [S, y] = n(!1);
12
12
  return /* @__PURE__ */ l.jsxs("div", { children: [
13
- /* @__PURE__ */ l.jsx("div", { className: "hfl-mx-[20%] hfl-my-5 hfl-text-center", children: /* @__PURE__ */ l.jsx(h, { 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." }) }),
13
+ /* @__PURE__ */ l.jsx("div", { className: "hfl-mx-[20%] hfl-my-5 hfl-text-center", children: /* @__PURE__ */ l.jsx(o, { 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." }) }),
14
14
  /* @__PURE__ */ l.jsxs("table", { className: "hfl-mx-7", children: [
15
15
  /* @__PURE__ */ l.jsx("thead", { children: /* @__PURE__ */ l.jsxs("tr", { className: "hfl-w-full", children: [
16
16
  /* @__PURE__ */ l.jsx(
17
17
  "th",
18
18
  {
19
19
  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]",
20
- children: /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "#" })
20
+ children: /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "#" })
21
21
  }
22
22
  ),
23
23
  /* @__PURE__ */ l.jsx(
24
24
  "th",
25
25
  {
26
26
  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]",
27
- children: /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Name" })
27
+ children: /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Name" })
28
28
  }
29
29
  ),
30
30
  /* @__PURE__ */ l.jsx(
31
31
  "th",
32
32
  {
33
33
  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]",
34
- children: /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Phone No" })
34
+ children: /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Phone No" })
35
35
  }
36
36
  ),
37
37
  /* @__PURE__ */ l.jsx(
38
38
  "th",
39
39
  {
40
40
  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]",
41
- children: /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Email" })
41
+ children: /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Email" })
42
42
  }
43
43
  ),
44
44
  /* @__PURE__ */ l.jsx(
45
45
  "th",
46
46
  {
47
47
  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]",
48
- children: /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Branch" })
48
+ children: /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text sm", className: "hfl-flex hfl-items-center hfl-text-Gray-500", children: "Branch" })
49
49
  }
50
50
  ),
51
51
  /* @__PURE__ */ l.jsx(
@@ -55,12 +55,12 @@ const wl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full h
55
55
  }
56
56
  )
57
57
  ] }) }),
58
- N.map((i, f) => /* @__PURE__ */ l.jsxs("tr", { className: "hfl-w-full hfl-border-1 hfl-border-Gray-100", children: [
59
- /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-800", children: f + 1 }) }),
60
- /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-800", children: i.org_person_name || i.name }) }),
61
- /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-500", children: i.org_person_phone || i.phone }) }),
62
- /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-500", children: i.org_person_email || i.email }) }),
63
- /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-500", children: "In Same Branch" }) }),
58
+ N.map((h, f) => /* @__PURE__ */ l.jsxs("tr", { className: "hfl-w-full hfl-border-1 hfl-border-Gray-100", children: [
59
+ /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-800", children: f + 1 }) }),
60
+ /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-800", children: h.org_person_name || h.name }) }),
61
+ /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-500", children: h.org_person_phone || h.phone }) }),
62
+ /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-500", children: h.org_person_email || h.email }) }),
63
+ /* @__PURE__ */ l.jsx("td", { className: "hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ", children: /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text md", className: " hfl-flex hfl-items-center hfl-text-Gray-500", children: "In Same Branch" }) }),
64
64
  /* @__PURE__ */ l.jsx(
65
65
  "td",
66
66
  {
@@ -73,7 +73,7 @@ const wl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full h
73
73
  textField: "Continue",
74
74
  className: "hfl-text-Primary-700",
75
75
  onClick: async () => {
76
- window.location.href.includes("/frontdesk") ? window.location.href = window.origin + "/md/viewPatientDashboard.php?pid=" + i?.person_role_id?.toString() : me(`viewPatientDashboard.php?pid=${i.person_role_id}`);
76
+ window.location.href.includes("/frontdesk") ? window.location.href = window.origin + "/md/viewPatientDashboard.php?pid=" + h?.person_role_id?.toString() : me(`viewPatientDashboard.php?pid=${h.person_role_id}`);
77
77
  }
78
78
  }
79
79
  )
@@ -81,7 +81,7 @@ const wl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full h
81
81
  )
82
82
  ] }))
83
83
  ] }),
84
- /* @__PURE__ */ l.jsx("div", { className: "hfl-my-7 hfl-flex hfl-items-center hfl-justify-center", children: /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text md", className: "hfl-text-Success-800", children: "If your patient is not in the above list" }) }),
84
+ /* @__PURE__ */ l.jsx("div", { className: "hfl-my-7 hfl-flex hfl-items-center hfl-justify-center", children: /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text md", className: "hfl-text-Success-800", children: "If your patient is not in the above list" }) }),
85
85
  /* @__PURE__ */ l.jsx("div", { className: "hfl-flex hfl-justify-center", children: /* @__PURE__ */ l.jsx(
86
86
  C,
87
87
  {
@@ -98,13 +98,13 @@ const wl = () => /* @__PURE__ */ l.jsx("div", { className: "hfl-h-0 hfl-w-full h
98
98
  ] });
99
99
  };
100
100
  function Ma(N) {
101
- const { editPatient: _, setEditPatient: I, createAsNew: S, setCreateAsNew: y } = N, i = () => _ ? "Primary" : "Secondary", f = () => S ? "Primary" : "Secondary";
101
+ const { editPatient: _, setEditPatient: I, createAsNew: S, setCreateAsNew: y } = N, h = () => _ ? "Primary" : "Secondary", f = () => S ? "Primary" : "Secondary";
102
102
  return /* @__PURE__ */ l.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: [
103
- /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text md", className: "hfl-text-Error-700", children: "Are you updating" }),
103
+ /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text md", className: "hfl-text-Error-700", children: "Are you updating" }),
104
104
  /* @__PURE__ */ l.jsx(
105
105
  C,
106
106
  {
107
- hierarchy: i(),
107
+ hierarchy: h(),
108
108
  size: "lg",
109
109
  textField: "Exisitng Patient",
110
110
  onClick: () => {
@@ -112,7 +112,7 @@ function Ma(N) {
112
112
  }
113
113
  }
114
114
  ),
115
- /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text md", className: "hfl-text-Error-700", children: "or creating a" }),
115
+ /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text md", className: "hfl-text-Error-700", children: "or creating a" }),
116
116
  /* @__PURE__ */ l.jsx(
117
117
  C,
118
118
  {
@@ -132,7 +132,7 @@ const Ve = 15, Cl = 3, La = ({
132
132
  onSubmit: I,
133
133
  otpErrorMsg: S,
134
134
  setOtpErrorMsg: y,
135
- optHeading: i,
135
+ optHeading: h,
136
136
  otpSubHeading: f,
137
137
  veriftButtonTitle: m,
138
138
  resendOtp: Q
@@ -187,8 +187,8 @@ const Ve = 15, Cl = 3, La = ({
187
187
  className: "hfl-z-5 hfl-relative hfl-flex hfl-h-full hfl-flex-col hfl-items-center hfl-justify-center hfl-text-center",
188
188
  onSubmit: xe,
189
189
  children: [
190
- /* @__PURE__ */ l.jsx(h, { variant: "Semibold", type: "Text lg", children: i }),
191
- /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text sm", className: "hfl-mx-auto hfl-w-[290px] hfl-pt-2 hfl-text-Gray-500", children: f }),
190
+ /* @__PURE__ */ l.jsx(o, { variant: "Semibold", type: "Text lg", children: h }),
191
+ /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text sm", className: "hfl-mx-auto hfl-w-[290px] hfl-pt-2 hfl-text-Gray-500", children: f }),
192
192
  /* @__PURE__ */ l.jsx("div", { className: "hfl-mx-auto hfl-max-h-[150px] hfl-w-[315px] hfl-py-5", children: /* @__PURE__ */ l.jsx(
193
193
  pa,
194
194
  {
@@ -203,8 +203,8 @@ const Ve = 15, Cl = 3, La = ({
203
203
  errorMsg: S
204
204
  }
205
205
  ) }),
206
- /* @__PURE__ */ l.jsx("div", { className: "hfl-mb-4 hfl-h-4", children: V >= Cl ? /* @__PURE__ */ l.jsx(h, { type: "Text sm", variant: "Regular", className: "hfl-text-Error-500", children: "Maximum resend attempts reached." }) : se ? /* @__PURE__ */ l.jsx(
207
- h,
206
+ /* @__PURE__ */ l.jsx("div", { className: "hfl-mb-4 hfl-h-4", children: V >= Cl ? /* @__PURE__ */ l.jsx(o, { type: "Text sm", variant: "Regular", className: "hfl-text-Error-500", children: "Maximum resend attempts reached." }) : se ? /* @__PURE__ */ l.jsx(
207
+ o,
208
208
  {
209
209
  variant: "Semibold",
210
210
  type: "Text sm",
@@ -212,7 +212,7 @@ const Ve = 15, Cl = 3, La = ({
212
212
  onClick: _e,
213
213
  children: "Resend OTP"
214
214
  }
215
- ) : /* @__PURE__ */ l.jsxs(h, { type: "Text sm", variant: "Regular", className: "hfl-text-Gray-500", children: [
215
+ ) : /* @__PURE__ */ l.jsxs(o, { type: "Text sm", variant: "Regular", className: "hfl-text-Gray-500", children: [
216
216
  "Resend OTP in 00:",
217
217
  z < 10 ? `0${z}` : z
218
218
  ] }) }),
@@ -224,7 +224,7 @@ const Ve = 15, Cl = 3, La = ({
224
224
  }
225
225
  );
226
226
  }, Ua = (N) => {
227
- const { closeModal: _, modalIsOpen: I, pref: S, variable: y } = N, { window_var: i, token: f, envName: m } = y, [Q, W] = n(!1), [D, z] = n({}), [u, se] = n(!1), [H, V] = n(null), [J, xe] = n(!0), [ge, _e] = n(!1), [L, Z] = n([]), [qe, K] = n(!1), [E, ne] = n(""), [g, Pl] = n(), [b, p] = n({
227
+ const { closeModal: _, modalIsOpen: I, pref: S, variable: y } = N, { window_var: h, token: f, envName: m } = y, [Q, W] = n(!1), [D, z] = n({}), [u, se] = n(!1), [H, V] = n(null), [J, xe] = n(!0), [ge, _e] = n(!1), [L, Z] = n([]), [qe, K] = n(!1), [E, ne] = n(""), [g, Pl] = n(), [b, p] = n({
228
228
  name: "",
229
229
  phone: "",
230
230
  age: "",
@@ -234,7 +234,7 @@ const Ve = 15, Cl = 3, La = ({
234
234
  }), [ie, Sl] = n([]), [oe, q] = n({
235
235
  name: !1,
236
236
  phone: !1
237
- }), [be, Dl] = n([]), [ye, El] = n([]), [ve, Tl] = n([]), [Bl, je] = n(!1), [Ol, we] = n(!1), [Rl, Ce] = n(!1), [Ne, Al] = n([]), [A, kl] = n(!1), [a, F] = n({
237
+ }), [be, Dl] = n([]), [ye, El] = n([]), [ve, Tl] = n([]), [Bl, we] = n(!1), [Ol, je] = n(!1), [Rl, Ce] = n(!1), [Ne, Al] = n([]), [A, kl] = n(!1), [a, F] = n({
238
238
  name: "",
239
239
  phone: "",
240
240
  dob: "",
@@ -284,20 +284,20 @@ const Ve = 15, Cl = 3, La = ({
284
284
  }, $ = re(null), Qe = re(null), [el, ee] = n(!1), [zl, De] = n(!1), [Hl, ll] = n(!1), [al, Ee] = n(!1), [tl, Te] = n(!1), [he, Vl] = n(), O = g && g.visit_pad_json && ga(g.visit_pad_json) && JSON.parse(g.visit_pad_json), rl = _a((...e) => {
285
285
  const [t, r] = e;
286
286
  Ql(t, r);
287
- }), o = x(
287
+ }), i = x(
288
288
  (e, t) => {
289
289
  De(!1), F((r) => ({ ...r, [e]: t })), (e === "name" || e === "phone" && t.length >= 3) && rl(e, t);
290
290
  },
291
291
  [rl]
292
292
  ), ql = (e) => {
293
- o("throughChannel", e.value.trim()), je(!1);
293
+ i("throughChannel", e.value.trim()), we(!1);
294
294
  }, R = xl(
295
295
  () => he?.branch_details?.enable_mobile_otp == "1",
296
296
  [he?.branch_details?.enable_mobile_otp]
297
297
  ), Yl = (e) => {
298
- o("occupation", e.trim()), we(!1);
298
+ i("occupation", e.trim()), je(!1);
299
299
  }, $l = (e) => {
300
- o("city", e.trim()), Ce(!1);
300
+ i("city", e.trim()), Ce(!1);
301
301
  }, Ul = (e) => {
302
302
  const { value: t } = e.target, r = Zl(t);
303
303
  Dl(r);
@@ -344,12 +344,12 @@ const Ve = 15, Cl = 3, La = ({
344
344
  }, [B, a.age]);
345
345
  const Oe = x(
346
346
  (e) => {
347
- Pe(e), o("gender", e), p((t) => ({
347
+ Pe(e), i("gender", e), p((t) => ({
348
348
  ...t,
349
349
  gender: ""
350
350
  }));
351
351
  },
352
- [o]
352
+ [i]
353
353
  ), il = (e) => {
354
354
  (sl.current && !sl.current.contains(e.target) || de.current && !de.current.contains(e.target)) && q({ name: !1, phone: !1 }), Be.current && !Be.current.contains(e.target) && Se(!1);
355
355
  }, ol = x(() => {
@@ -357,16 +357,16 @@ const Ve = 15, Cl = 3, La = ({
357
357
  }, [a.image_link]), hl = x(async () => {
358
358
  const e = await Na(
359
359
  "patient_config",
360
- i?.org_branch_id_for_seg?.toString() || "",
360
+ h?.org_branch_id_for_seg?.toString() || "",
361
361
  { token: f, envName: m }
362
362
  );
363
363
  Vl(e);
364
- }, [f, m, i?.org_branch_id_for_seg]);
364
+ }, [f, m, h?.org_branch_id_for_seg]);
365
365
  M(() => (document.addEventListener("mousedown", il), () => {
366
366
  document.removeEventListener("mousedown", il);
367
367
  }), []), M(() => {
368
- i.doctor_speciality === "Gynaecologist" && !a.gender && Oe("1");
369
- }, [a.gender, Oe, i.doctor_speciality]), M(() => {
368
+ h.doctor_speciality === "Gynaecologist" && !a.gender && Oe("1");
369
+ }, [a.gender, Oe, h.doctor_speciality]), M(() => {
370
370
  a.image_link && ol(), a.honorific && Ke(a.honorific);
371
371
  }, [a.honorific, a.image_link, ol]), M(() => {
372
372
  nl && We(!0);
@@ -385,9 +385,9 @@ const Ve = 15, Cl = 3, La = ({
385
385
  }, [S, f, m]);
386
386
  const Ql = async (e, t) => {
387
387
  const r = {
388
- branch_id: i?.org_branch_id_for_seg || "",
389
- doctor_id: i?.person_id_for_seg || "",
390
- doctor_role_id: i?.doctor_role_id_for_seg || "",
388
+ branch_id: h?.org_branch_id_for_seg || "",
389
+ doctor_id: h?.person_id_for_seg || "",
390
+ doctor_role_id: h?.doctor_role_id_for_seg || "",
391
391
  term: encodeURIComponent(t),
392
392
  limit: 30
393
393
  }, s = await Aa(r, { token: f, envName: m });
@@ -470,9 +470,9 @@ const Ve = 15, Cl = 3, La = ({
470
470
  ), dl = async (e) => {
471
471
  ll(!0);
472
472
  const t = {
473
- branch_id: i?.org_branch_id_for_seg?.toString() || "",
474
- person_id: i?.person_id_for_seg || "",
475
- person_role_id: i?.doctor_role_id_for_seg || "",
473
+ branch_id: h?.org_branch_id_for_seg?.toString() || "",
474
+ person_id: h?.person_id_for_seg || "",
475
+ person_role_id: h?.doctor_role_id_for_seg || "",
476
476
  patient_role_id: e.person_role_id || ""
477
477
  };
478
478
  la(t), q({ name: !1, phone: !1 }), _e(!0), z(e);
@@ -539,18 +539,18 @@ const Ve = 15, Cl = 3, La = ({
539
539
  return;
540
540
  }
541
541
  const s = new FormData();
542
- s.append("name", a.name), s.append("phone", a.phone), s.append("gender", ja(a.gender)), s.append("honorific", a.honorific), s.append("patient_preferred_language", a.patient_preferred_language), s.append("age", G && G.length ? G : _l(a?.age, B) || ""), s.append("age_selector", a.age_selector), s.append("blood_group", a.blood_group), s.append("email", a.email), s.append("address", a.address), s.append("city", a.city), s.append("existing_bid_str", a.existingBidStr), s.append("pincode", a.pincode), s.append("ref_doc_id", a.refDocId), s.append("ref_doc_name", a.ref_doc_name), s.append("ref_doc_spec", a.ref_doc_spec), s.append("through_channel", a.throughChannel), s.append("care_of", a.careOf), s.append("phone_secondary", a.phoneSecondary), s.append("occupation", a.occupation), s.append("tag", a.tag), s.append("marital_status", a.marital_status), s.append("married_since", a.married_since), s.append("spouse_name", a.spouse_name), s.append("spouse_blood_group", a.spouse_blood_group), s.append("aadhar_number", a.aadhar_number), s.append("custom_fields", JSON.stringify(a.custom_fields || [])), e && s.append("reg_as_new", "1");
543
- const c = Object.fromEntries(s.entries()), j = Object.fromEntries(
542
+ s.append("name", a.name), s.append("phone", a.phone), s.append("gender", wa(a.gender)), s.append("honorific", a.honorific), s.append("patient_preferred_language", a.patient_preferred_language), s.append("age", G && G.length ? G : _l(a?.age, B) || ""), s.append("age_selector", a.age_selector), s.append("blood_group", a.blood_group), s.append("email", a.email), s.append("address", a.address), s.append("city", a.city), s.append("existing_bid_str", a.existingBidStr), s.append("pincode", a.pincode), s.append("ref_doc_id", a.refDocId), s.append("ref_doc_name", a.ref_doc_name), s.append("ref_doc_spec", a.ref_doc_spec), s.append("through_channel", a.throughChannel), s.append("care_of", a.careOf), s.append("phone_secondary", a.phoneSecondary), s.append("occupation", a.occupation), s.append("tag", a.tag), s.append("marital_status", a.marital_status), s.append("married_since", a.married_since), s.append("spouse_name", a.spouse_name), s.append("spouse_blood_group", a.spouse_blood_group), s.append("aadhar_number", a.aadhar_number), s.append("custom_fields", JSON.stringify(a.custom_fields || [])), e && s.append("reg_as_new", "1");
543
+ const c = Object.fromEntries(s.entries()), w = Object.fromEntries(
544
544
  Object.entries(c).map(([te, ca]) => [te, String(ca)])
545
- ), w = {
546
- ...j,
547
- custom_fields: JSON.parse(j.custom_fields || "[]"),
548
- doctor_role_id: i.doctor_role_id_for_seg || "",
549
- doctor_id: i.person_id_for_seg || "",
550
- org_branch_id: i.org_branch_id_for_seg || "",
545
+ ), j = {
546
+ ...w,
547
+ custom_fields: JSON.parse(w.custom_fields || "[]"),
548
+ doctor_role_id: h.doctor_role_id_for_seg || "",
549
+ doctor_id: h.person_id_for_seg || "",
550
+ org_branch_id: h.org_branch_id_for_seg || "",
551
551
  source: "emr",
552
552
  ip: ""
553
- }, d = await Oa(w, { token: f, envName: m });
553
+ }, d = await Oa(j, { token: f, envName: m });
554
554
  if (d.apiError)
555
555
  P("Error", d.apiError, "Error", 3e3), De(!1);
556
556
  else {
@@ -560,7 +560,7 @@ const Ve = 15, Cl = 3, La = ({
560
560
  } catch (te) {
561
561
  console.log(te);
562
562
  }
563
- t !== "Rx" && O && O?.mode_of_patient_popup?.include == "1" && typeof i.patientPopupHandler < "u" ? i.patientPopupHandler(
563
+ t !== "Rx" && O && O?.mode_of_patient_popup?.include == "1" && typeof window.patientPopupHandler < "u" ? window.patientPopupHandler(
564
564
  "addpatient",
565
565
  d.person_role_id.toString(),
566
566
  d.person_id.toString(),
@@ -577,7 +577,7 @@ const Ve = 15, Cl = 3, La = ({
577
577
  }
578
578
  ae();
579
579
  }
580
- d?.conflicts?.length > 0 ? (W(!0), Z(d.conflicts)) : _(), Array.isArray(d?.person) || P("Success", "Patient Added Successfully", "Success", 3e3), d != null && !d?.conflicts?.length && d?.person_role_id && (t !== "Rx" && O && O?.mode_of_patient_popup?.include == "1" && typeof i.patientPopupHandler < "u" ? i.patientPopupHandler(
580
+ d?.conflicts?.length > 0 ? (W(!0), Z(d.conflicts)) : _(), Array.isArray(d?.person) || P("Success", "Patient Added Successfully", "Success", 3e3), d != null && !d?.conflicts?.length && d?.person_role_id && (t !== "Rx" && O && O?.mode_of_patient_popup?.include == "1" && typeof window.patientPopupHandler < "u" ? window.patientPopupHandler(
581
581
  "addpatient",
582
582
  d.person_role_id.toString(),
583
583
  d.person_id.toString(),
@@ -598,7 +598,7 @@ const Ve = 15, Cl = 3, La = ({
598
598
  a,
599
599
  G,
600
600
  B,
601
- i,
601
+ h,
602
602
  f,
603
603
  m,
604
604
  O,
@@ -620,12 +620,12 @@ const Ve = 15, Cl = 3, La = ({
620
620
  [Fe.appointments]: ["appointments_mfe"]
621
621
  }, t = window.location?.pathname || "", r = e[t];
622
622
  if (!r?.length) return;
623
- const s = document.getElementById("react_emr_mfe"), c = document.getElementById("react_curtains_mfe"), j = document.querySelector(".offlineEMR3");
624
- [s, c, j].forEach((w) => {
625
- w && w.classList.contains("hidden") && w.classList.remove("hidden");
623
+ const s = document.getElementById("react_emr_mfe"), c = document.getElementById("react_curtains_mfe"), w = document.querySelector(".offlineEMR3");
624
+ [s, c, w].forEach((j) => {
625
+ j && j.classList.contains("hidden") && j.classList.remove("hidden");
626
626
  });
627
- for (const w of r) {
628
- const d = document.getElementsByClassName(w);
627
+ for (const j of r) {
628
+ const d = document.getElementsByClassName(j);
629
629
  d.length && !d[0].classList.contains("hidden") && d[0].classList.add("hidden");
630
630
  }
631
631
  } catch (e) {
@@ -664,9 +664,9 @@ const Ve = 15, Cl = 3, La = ({
664
664
  remote_consultation_id: "0",
665
665
  oc_status: !1,
666
666
  aadhar_number: a?.aadhar_number,
667
- person_role_id: i.doctor_role_id_for_seg || "",
668
- person_id: i.person_id_for_seg || "",
669
- branch_id: i.org_branch_id_for_seg || ""
667
+ person_role_id: h.doctor_role_id_for_seg || "",
668
+ person_id: h.person_id_for_seg || "",
669
+ branch_id: h.org_branch_id_for_seg || ""
670
670
  }, r = await Ra(t, { token: f, envName: m });
671
671
  if (u) {
672
672
  r && De(!1);
@@ -675,10 +675,10 @@ const Ve = 15, Cl = 3, La = ({
675
675
  P("Patient Edited", "Patient Edited Successfully", "Success", 1500);
676
676
  try {
677
677
  a?.image_link && !E ? cl(D?.person_role_id) : E && al && (Ee(!1), await le(D?.person_role_id, a?.existingBidStr));
678
- } catch (j) {
679
- console.log(j);
678
+ } catch (w) {
679
+ console.log(w);
680
680
  }
681
- e !== "Rx" && O && O?.mode_of_patient_popup?.include == "1" && typeof i.patientPopupHandler < "u" ? i.patientPopupHandler(
681
+ e !== "Rx" && O && O?.mode_of_patient_popup?.include == "1" && typeof window.patientPopupHandler < "u" ? window.patientPopupHandler(
682
682
  "addpatient",
683
683
  D?.person_role_id,
684
684
  D?.person_id,
@@ -697,7 +697,7 @@ const Ve = 15, Cl = 3, La = ({
697
697
  D?.person_role_id,
698
698
  a,
699
699
  B,
700
- i,
700
+ h,
701
701
  f,
702
702
  m,
703
703
  u,
@@ -755,8 +755,8 @@ const Ve = 15, Cl = 3, La = ({
755
755
  };
756
756
  }), [he?.patient_config?.custom_fields, a.custom_fields]), Me = (e, t, r) => {
757
757
  F((s) => {
758
- const c = s.custom_fields?.length ? s.custom_fields.map((w) => w.id === e ? { ...w, value: r } : w) : [];
759
- return c.some((w) => w.id === e) || c.push({
758
+ const c = s.custom_fields?.length ? s.custom_fields.map((j) => j.id === e ? { ...j, value: r } : j) : [];
759
+ return c.some((j) => j.id === e) || c.push({
760
760
  id: e,
761
761
  value: r,
762
762
  title: t
@@ -779,8 +779,8 @@ const Ve = 15, Cl = 3, La = ({
779
779
  inputProps: {
780
780
  value: s || "",
781
781
  placeholder: `Enter ${c}`,
782
- onChange: (j) => {
783
- Me(t, c, j.target.value);
782
+ onChange: (w) => {
783
+ Me(t, c, w.target.value);
784
784
  }
785
785
  },
786
786
  width: "22em"
@@ -794,13 +794,13 @@ const Ve = 15, Cl = 3, La = ({
794
794
  label: c,
795
795
  placeholder: `Select ${c}`,
796
796
  selectDate: s ? new Date(s) : null,
797
- dateVar: (j) => {
798
- Me(t, c, j.toDateString() || "");
797
+ dateVar: (w) => {
798
+ Me(t, c, w.toDateString() || "");
799
799
  },
800
800
  isborderRequired: !0,
801
801
  width: "22em",
802
- clearDate: (j) => {
803
- Me(t, c, j);
802
+ clearDate: (w) => {
803
+ Me(t, c, w);
804
804
  },
805
805
  openUp: !0,
806
806
  backSpaceClearDate: !0
@@ -867,7 +867,7 @@ const Ve = 15, Cl = 3, La = ({
867
867
  id: "add-patient-header",
868
868
  "data-qa": "testid_addPatient",
869
869
  children: [
870
- /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text xl", children: Q ? "Patient(s) with Same phone number or Email" : "Add New Patient" }),
870
+ /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text xl", children: Q ? "Patient(s) with Same phone number or Email" : "Add New Patient" }),
871
871
  /* @__PURE__ */ l.jsx("div", { className: "hfl-items-center", children: /* @__PURE__ */ l.jsx(
872
872
  "span",
873
873
  {
@@ -904,7 +904,7 @@ const Ve = 15, Cl = 3, La = ({
904
904
  className: "-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",
905
905
  onClick: () => Se((e) => !e),
906
906
  children: [
907
- /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text md", className: "hfl-px-1 hfl-py-1 hfl-text-Gray-700", children: Ze }),
907
+ /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text md", className: "hfl-px-1 hfl-py-1 hfl-text-Gray-700", children: Ze }),
908
908
  !Ze.length && /* @__PURE__ */ l.jsx("div", { className: `${Xe ? "hx_up" : "hx_down"} -hfl-mr-2` })
909
909
  ]
910
910
  }
@@ -918,7 +918,7 @@ const Ve = 15, Cl = 3, La = ({
918
918
  value: Ye,
919
919
  placeholder: "Enter Name",
920
920
  onChange: (e) => {
921
- o("name", e.target.value);
921
+ i("name", e.target.value);
922
922
  },
923
923
  onBlur: () => {
924
924
  const e = !(a.name.length > 0);
@@ -945,13 +945,13 @@ const Ve = 15, Cl = 3, La = ({
945
945
  style: {
946
946
  boxShadow: "0px 24px 48px -12px rgba(16, 24, 40, 0.18)"
947
947
  },
948
- children: wa.map((e) => /* @__PURE__ */ l.jsx(
948
+ children: ja.map((e) => /* @__PURE__ */ l.jsx(
949
949
  fe,
950
950
  {
951
951
  className: "hfl-text-Primary-700",
952
952
  label: e.label,
953
953
  onSelect: () => {
954
- Ke(e.label), Se(!1), Pe(e.gender), o("honorific", e.label), o("gender", e.gender), F((t) => ({
954
+ Ke(e.label), Se(!1), Pe(e.gender), i("honorific", e.label), i("gender", e.gender), F((t) => ({
955
955
  ...t,
956
956
  gender: e.gender,
957
957
  honorific: e.label
@@ -970,7 +970,7 @@ const Ve = 15, Cl = 3, La = ({
970
970
  },
971
971
  ref: de,
972
972
  children: [
973
- /* @__PURE__ */ l.jsx(h, { className: "hfl-text-Primary-600", variant: "Regular", type: "Text md", children: "Existing Patients" }),
973
+ /* @__PURE__ */ l.jsx(o, { className: "hfl-text-Primary-600", variant: "Regular", type: "Text md", children: "Existing Patients" }),
974
974
  ie && ie?.slice(0, 7)?.map((e) => /* @__PURE__ */ l.jsxs(
975
975
  "div",
976
976
  {
@@ -978,7 +978,7 @@ const Ve = 15, Cl = 3, La = ({
978
978
  onMouseDown: () => dl(e),
979
979
  children: [
980
980
  /* @__PURE__ */ l.jsxs(
981
- h,
981
+ o,
982
982
  {
983
983
  variant: "Regular",
984
984
  type: "Text md",
@@ -991,7 +991,7 @@ const Ve = 15, Cl = 3, La = ({
991
991
  ]
992
992
  }
993
993
  ),
994
- /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text sm", className: "hfl-text-Gray-500", children: e.org_person_phone || "" })
994
+ /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text sm", className: "hfl-text-Gray-500", children: e.org_person_phone || "" })
995
995
  ]
996
996
  },
997
997
  e?.person_role_id
@@ -1014,7 +1014,7 @@ const Ve = 15, Cl = 3, La = ({
1014
1014
  value: k,
1015
1015
  placeholder: "Enter Number",
1016
1016
  onChange: (e) => {
1017
- o("phone", e.target.value.replace(/[^0-9]/g, ""));
1017
+ i("phone", e.target.value.replace(/[^0-9]/g, ""));
1018
1018
  },
1019
1019
  onBlur: () => {
1020
1020
  const { isError: e = !1, msg: t = "" } = g && g.phone_number_length ? vl(k) : k ? vl(k) : {};
@@ -1037,7 +1037,7 @@ const Ve = 15, Cl = 3, La = ({
1037
1037
  },
1038
1038
  ref: de,
1039
1039
  children: [
1040
- /* @__PURE__ */ l.jsx(h, { className: "hfl-text-Primary-600", variant: "Regular", type: "Text md", children: "Existing Patients" }),
1040
+ /* @__PURE__ */ l.jsx(o, { className: "hfl-text-Primary-600", variant: "Regular", type: "Text md", children: "Existing Patients" }),
1041
1041
  ie && ie?.slice(0, 7)?.map((e) => /* @__PURE__ */ l.jsxs(
1042
1042
  "div",
1043
1043
  {
@@ -1045,7 +1045,7 @@ const Ve = 15, Cl = 3, La = ({
1045
1045
  onMouseDown: () => dl(e),
1046
1046
  children: [
1047
1047
  /* @__PURE__ */ l.jsxs(
1048
- h,
1048
+ o,
1049
1049
  {
1050
1050
  variant: "Regular",
1051
1051
  type: "Text md",
@@ -1058,7 +1058,7 @@ const Ve = 15, Cl = 3, La = ({
1058
1058
  ]
1059
1059
  }
1060
1060
  ),
1061
- /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text sm", className: "hfl-text-Gray-500", children: e.org_person_phone })
1061
+ /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text sm", className: "hfl-text-Gray-500", children: e.org_person_phone })
1062
1062
  ]
1063
1063
  },
1064
1064
  e?.person_role_id
@@ -1085,7 +1085,7 @@ const Ve = 15, Cl = 3, La = ({
1085
1085
  ),
1086
1086
  /* @__PURE__ */ l.jsxs("div", { className: "hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-4", children: [
1087
1087
  /* @__PURE__ */ l.jsxs("div", { className: "hfl-h-[40px] hfl-space-y-1", children: [
1088
- /* @__PURE__ */ l.jsx(h, { variant: "Medium", type: "Text sm", className: "hfl-pb-[1px] hfl-text-Gray-600", children: "Gender*" }),
1088
+ /* @__PURE__ */ l.jsx(o, { variant: "Medium", type: "Text sm", className: "hfl-pb-[1px] hfl-text-Gray-600", children: "Gender*" }),
1089
1089
  /* @__PURE__ */ l.jsxs("div", { children: [
1090
1090
  /* @__PURE__ */ l.jsx(
1091
1091
  ua,
@@ -1123,7 +1123,7 @@ const Ve = 15, Cl = 3, La = ({
1123
1123
  maxLength: 3,
1124
1124
  placeholder: "Age",
1125
1125
  onChange: (e) => {
1126
- o("age", e.target.value.replace(/[^0-9]/g, "")), F((t) => ({
1126
+ i("age", e.target.value.replace(/[^0-9]/g, "")), F((t) => ({
1127
1127
  ...t,
1128
1128
  dob: ""
1129
1129
  }));
@@ -1144,7 +1144,7 @@ const Ve = 15, Cl = 3, La = ({
1144
1144
  { label: "Days", value: "days" }
1145
1145
  ],
1146
1146
  handleValChange: (e) => {
1147
- o("age", e), p((t) => ({
1147
+ i("age", e), p((t) => ({
1148
1148
  ...t,
1149
1149
  age: X(B)
1150
1150
  }));
@@ -1177,7 +1177,7 @@ const Ve = 15, Cl = 3, La = ({
1177
1177
  label: "",
1178
1178
  labelSize: "Text sm",
1179
1179
  labelColor: "hfl-text-Gray-700",
1180
- selectDate: a?.dob && jl(new Date(a?.dob)) ? new Date(pe(new Date(a?.dob)).format("DD-MMM-YYYY")) : "",
1180
+ selectDate: a?.dob && wl(new Date(a?.dob)) ? new Date(pe(new Date(a?.dob)).format("DD-MMM-YYYY")) : "",
1181
1181
  dateVar: (e) => {
1182
1182
  F((t) => ({
1183
1183
  ...t,
@@ -1202,7 +1202,7 @@ const Ve = 15, Cl = 3, La = ({
1202
1202
  placeholder: "English",
1203
1203
  label: "Preferred Language",
1204
1204
  onChange: (e) => {
1205
- o("patient_preferred_language", e.value);
1205
+ i("patient_preferred_language", e.value);
1206
1206
  },
1207
1207
  options: Object.keys(Ge).map((e) => ({
1208
1208
  label: Ge[e],
@@ -1226,7 +1226,7 @@ const Ve = 15, Cl = 3, La = ({
1226
1226
  value: a?.city,
1227
1227
  placeholder: "Enter City",
1228
1228
  onChange: (e) => {
1229
- o("city", e.target.value), Ce(!0), Jl(e);
1229
+ i("city", e.target.value), Ce(!0), Jl(e);
1230
1230
  },
1231
1231
  onBlur: (e) => {
1232
1232
  e.stopPropagation(), Ce(!1);
@@ -1264,7 +1264,7 @@ const Ve = 15, Cl = 3, La = ({
1264
1264
  value: a?.pincode,
1265
1265
  placeholder: "Enter Pin",
1266
1266
  onChange: (e) => {
1267
- o("pincode", e.target.value);
1267
+ i("pincode", e.target.value);
1268
1268
  }
1269
1269
  },
1270
1270
  width: 22.5 + "em"
@@ -1280,7 +1280,7 @@ const Ve = 15, Cl = 3, La = ({
1280
1280
  value: a?.address,
1281
1281
  placeholder: "Enter Address",
1282
1282
  onChange: (e) => {
1283
- o("address", e.target.value);
1283
+ i("address", e.target.value);
1284
1284
  }
1285
1285
  },
1286
1286
  isDynamicHeight: !0,
@@ -1302,7 +1302,7 @@ const Ve = 15, Cl = 3, La = ({
1302
1302
  /* @__PURE__ */ l.jsxs("div", { className: "hfl-relative", children: [
1303
1303
  /* @__PURE__ */ l.jsx("span", { className: "hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200" }),
1304
1304
  /* @__PURE__ */ l.jsx("span", { className: "hfl-relative hfl-bg-White hfl-px-4", children: /* @__PURE__ */ l.jsx(
1305
- h,
1305
+ o,
1306
1306
  {
1307
1307
  variant: "Medium",
1308
1308
  type: "Text sm",
@@ -1322,7 +1322,7 @@ const Ve = 15, Cl = 3, La = ({
1322
1322
  placeholder: "Marital Status",
1323
1323
  label: "Marital Status",
1324
1324
  onChange: (e) => {
1325
- o("marital_status", e.label);
1325
+ i("marital_status", e.label);
1326
1326
  },
1327
1327
  options: Ie.map((e) => ({
1328
1328
  label: e,
@@ -1342,7 +1342,7 @@ const Ve = 15, Cl = 3, La = ({
1342
1342
  label: "",
1343
1343
  labelSize: "Text sm",
1344
1344
  labelColor: "hfl-text-Gray-700",
1345
- selectDate: a?.married_since && jl(new Date(a?.married_since)) ? new Date(pe(new Date(a?.married_since)).format("DD-MMM-YYYY")) : "",
1345
+ selectDate: a?.married_since && wl(new Date(a?.married_since)) ? new Date(pe(new Date(a?.married_since)).format("DD-MMM-YYYY")) : "",
1346
1346
  dateVar: (e) => {
1347
1347
  F((t) => ({
1348
1348
  ...t,
@@ -1363,7 +1363,7 @@ const Ve = 15, Cl = 3, La = ({
1363
1363
  label: a.blood_group && ue.find((e) => e.value === a.blood_group)?.label || "Blood group"
1364
1364
  },
1365
1365
  onChange: (e) => {
1366
- o("blood_group", e.value);
1366
+ i("blood_group", e.value);
1367
1367
  },
1368
1368
  options: ue,
1369
1369
  className: "!hfl-h-11 hfl-w-[370px]",
@@ -1383,7 +1383,7 @@ const Ve = 15, Cl = 3, La = ({
1383
1383
  value: a.spouse_name,
1384
1384
  placeholder: "Enter Spouse Name",
1385
1385
  onChange: (e) => {
1386
- o("spouse_name", e.target.value);
1386
+ i("spouse_name", e.target.value);
1387
1387
  }
1388
1388
  },
1389
1389
  width: "21em"
@@ -1398,7 +1398,7 @@ const Ve = 15, Cl = 3, La = ({
1398
1398
  label: a.spouse_blood_group ? ue.find((e) => e.value === a.spouse_blood_group)?.label || "Spouse Blood group" : "Blood group"
1399
1399
  },
1400
1400
  onChange: (e) => {
1401
- o("spouse_blood_group", e.value);
1401
+ i("spouse_blood_group", e.value);
1402
1402
  },
1403
1403
  options: ue,
1404
1404
  className: "!hfl-h-11 hfl-w-[370px]",
@@ -1407,7 +1407,7 @@ const Ve = 15, Cl = 3, La = ({
1407
1407
  )
1408
1408
  ] })
1409
1409
  ] }),
1410
- /* @__PURE__ */ l.jsx(wl, {}),
1410
+ /* @__PURE__ */ l.jsx(jl, {}),
1411
1411
  /* @__PURE__ */ l.jsx("div", { className: "hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6", children: /* @__PURE__ */ l.jsx(
1412
1412
  ml,
1413
1413
  {
@@ -1425,16 +1425,16 @@ const Ve = 15, Cl = 3, La = ({
1425
1425
  options: Ml,
1426
1426
  suffixOptions: Ca,
1427
1427
  handleValChange: (e) => {
1428
- o("ref_doc_name", e);
1428
+ i("ref_doc_name", e);
1429
1429
  },
1430
1430
  handleSuffixValChange: (e) => {
1431
- o("ref_doc_spec", e.value);
1431
+ i("ref_doc_spec", e.value);
1432
1432
  },
1433
1433
  onDropdownClick: (e) => {
1434
- o("ref_doc_name", e.doctor_name), o("refDocId", e.doctor_id), o("ref_doc_spec", e.specialist);
1434
+ i("ref_doc_name", e.doctor_name), i("refDocId", e.doctor_id), i("ref_doc_spec", e.specialist);
1435
1435
  },
1436
1436
  onSuffixDropdownClick: (e) => {
1437
- o("ref_doc_spec", e.value);
1437
+ i("ref_doc_spec", e.value);
1438
1438
  }
1439
1439
  }
1440
1440
  ) }),
@@ -1449,7 +1449,7 @@ const Ve = 15, Cl = 3, La = ({
1449
1449
  value: a?.existingBidStr,
1450
1450
  placeholder: "Enter ID",
1451
1451
  onChange: (e) => {
1452
- o("existingBidStr", e.target.value);
1452
+ i("existingBidStr", e.target.value);
1453
1453
  }
1454
1454
  },
1455
1455
  width: "23em"
@@ -1468,7 +1468,7 @@ const Ve = 15, Cl = 3, La = ({
1468
1468
  value: a.email,
1469
1469
  placeholder: "Enter Email",
1470
1470
  onChange: (e) => {
1471
- o("email", e.target.value.trim());
1471
+ i("email", e.target.value.trim());
1472
1472
  },
1473
1473
  onBlur: (e) => {
1474
1474
  e.target.value && !gl().email().isValidSync(e.target.value) ? p((t) => ({
@@ -1497,10 +1497,10 @@ const Ve = 15, Cl = 3, La = ({
1497
1497
  value: a?.throughChannel,
1498
1498
  placeholder: "Enter Channel",
1499
1499
  onChange: (e) => {
1500
- o("throughChannel", e.target.value), je(!0), Ul(e);
1500
+ i("throughChannel", e.target.value), we(!0), Ul(e);
1501
1501
  },
1502
1502
  onBlur: (e) => {
1503
- e.stopPropagation(), je(!1);
1503
+ e.stopPropagation(), we(!1);
1504
1504
  }
1505
1505
  },
1506
1506
  width: "22em"
@@ -1538,7 +1538,7 @@ const Ve = 15, Cl = 3, La = ({
1538
1538
  value: a?.careOf,
1539
1539
  placeholder: "Enter C/O",
1540
1540
  onChange: (e) => {
1541
- o("careOf", e.target.value);
1541
+ i("careOf", e.target.value);
1542
1542
  }
1543
1543
  },
1544
1544
  width: "22em"
@@ -1556,10 +1556,10 @@ const Ve = 15, Cl = 3, La = ({
1556
1556
  value: a?.occupation,
1557
1557
  placeholder: "Enter Occupation",
1558
1558
  onChange: (e) => {
1559
- o("occupation", e.target.value), we(!0), Wl(e);
1559
+ i("occupation", e.target.value), je(!0), Wl(e);
1560
1560
  },
1561
1561
  onBlur: (e) => {
1562
- e.stopPropagation(), we(!1);
1562
+ e.stopPropagation(), je(!1);
1563
1563
  }
1564
1564
  },
1565
1565
  width: "22em"
@@ -1593,7 +1593,7 @@ const Ve = 15, Cl = 3, La = ({
1593
1593
  value: a.tag,
1594
1594
  placeholder: "Enter Tag",
1595
1595
  onChange: (e) => {
1596
- o("tag", e.target.value);
1596
+ i("tag", e.target.value);
1597
1597
  }
1598
1598
  },
1599
1599
  width: "22em"
@@ -1610,7 +1610,7 @@ const Ve = 15, Cl = 3, La = ({
1610
1610
  maxLength: 10,
1611
1611
  placeholder: "Enter Secondary Number",
1612
1612
  onChange: (e) => {
1613
- o("phoneSecondary", e.target.value.replace(/[^0-9]/g, ""));
1613
+ i("phoneSecondary", e.target.value.replace(/[^0-9]/g, ""));
1614
1614
  }
1615
1615
  },
1616
1616
  width: "22em"
@@ -1628,7 +1628,7 @@ const Ve = 15, Cl = 3, La = ({
1628
1628
  placeholder: "Aadhar Card Number",
1629
1629
  maxLength: 12,
1630
1630
  onChange: (e) => {
1631
- o("aadhar_number", e.target.value);
1631
+ i("aadhar_number", e.target.value);
1632
1632
  },
1633
1633
  onBlur: () => {
1634
1634
  p((e) => ({
@@ -1642,7 +1642,7 @@ const Ve = 15, Cl = 3, La = ({
1642
1642
  ),
1643
1643
  /* @__PURE__ */ l.jsx("div", { className: "hfl-grid hfl-grid-cols-2 hfl-gap-x-11 hfl-gap-y-6", children: oa() })
1644
1644
  ] }),
1645
- /* @__PURE__ */ l.jsx(wl, {}),
1645
+ /* @__PURE__ */ l.jsx(jl, {}),
1646
1646
  /* @__PURE__ */ l.jsx("div", { className: "hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3", children: /* @__PURE__ */ l.jsxs(
1647
1647
  "div",
1648
1648
  {
@@ -1800,12 +1800,12 @@ const Ve = 15, Cl = 3, La = ({
1800
1800
  }
1801
1801
  ) })
1802
1802
  ] }) : /* @__PURE__ */ l.jsxs("div", { className: "hfl-flex hfl-flex-row hfl-items-center hfl-justify-center", children: [
1803
- /* @__PURE__ */ l.jsxs(h, { variant: "Regular", type: "Text md", children: [
1803
+ /* @__PURE__ */ l.jsxs(o, { variant: "Regular", type: "Text md", children: [
1804
1804
  "If you want to add more details,",
1805
1805
  " "
1806
1806
  ] }),
1807
1807
  /* @__PURE__ */ l.jsx(
1808
- h,
1808
+ o,
1809
1809
  {
1810
1810
  variant: "Medium",
1811
1811
  type: "Text md",
@@ -1835,7 +1835,7 @@ const Ve = 15, Cl = 3, La = ({
1835
1835
  onClick: ha
1836
1836
  }
1837
1837
  ),
1838
- /* @__PURE__ */ l.jsx("div", { children: window.location?.href.indexOf("/frontdesk") == -1 && /* @__PURE__ */ l.jsx(h, { variant: "Regular", type: "Text sm", children: "or" }) }),
1838
+ /* @__PURE__ */ l.jsx("div", { children: window.location?.href.indexOf("/frontdesk") == -1 && /* @__PURE__ */ l.jsx(o, { variant: "Regular", type: "Text sm", children: "or" }) }),
1839
1839
  /* @__PURE__ */ l.jsxs("div", { className: "hfl-flex hfl-items-start hfl-gap-2", children: [
1840
1840
  /* @__PURE__ */ l.jsx(
1841
1841
  C,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { P as r } from "./PediatricsCalculatorTable-C4TFowA1.js";
2
2
  import { P as e } from "./PatientPopupContainer-BgJxmRSX.js";
3
3
  import { A as i } from "./Attachments-C00pNXTg.js";
4
- import { P } from "./PatientAddEdit-Bsk_4kOY.js";
4
+ import { P } from "./PatientAddEdit-DPUUVgt-.js";
5
5
  import { S as m } from "./SearchPatients-6f4jy1uO.js";
6
6
  import { N as n } from "./NineDots-DknhZch4.js";
7
7
  import { U as d } from "./UserProfile-DJTBA4wh.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hplx-feature-library",
3
3
  "private": false,
4
- "version": "1.0.264",
4
+ "version": "1.0.265",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "npm i hplx-react-elements-dev@qa && vite",
@@ -1,7 +0,0 @@
1
- "use strict";const e=require("./index-D4uYXq_j.cjs");;/* empty css */const at=require("./index-Dqp7vsb7.cjs"),a=require("react"),st=require("./index.esm-BdlMQ1M7.cjs"),oe=require("./dayjs.min-b-u3u61q.cjs"),h=require("./common-utils-d6QnkaWh.cjs"),x=require("./CommonConstant-COHqiSWL.cjs"),B=require("./APIAction-CW7tpjtQ.cjs"),lt=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-h-0 hfl-w-full hfl-border-1 hfl-border-Gray-200"}),Yt=({conflicts:R,handleAddPatient:_,redirectAction:G})=>{const[C,b]=a.useState(!1);return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-[20%] hfl-my-5 hfl-text-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Error-700",children:"Patient/s with similar information already exists in your Clinic. To continue with an existing patient click on “Continue."})}),e.jsxRuntimeExports.jsxs("table",{className:"hfl-mx-7",children:[e.jsxRuntimeExports.jsx("thead",{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full",children:[e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[40px] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"#"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Name"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Phone No"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Email"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-border hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Gray-500",children:"Branch"})}),e.jsxRuntimeExports.jsx("th",{className:"hfl-w-[20%] hfl-max-w-[40px] hfl-rounded-tl hfl-rounded-tr hfl-border-b hfl-border-r hfl-border-Blue_gray-100 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-[6px]"})]})}),R.map((i,f)=>e.jsxRuntimeExports.jsxs("tr",{className:"hfl-w-full hfl-border-1 hfl-border-Gray-100",children:[e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:f+1})}),e.jsxRuntimeExports.jsx("td",{className:"hfl-border-Blue_gray-100 hfl-px-2 hfl-py-[6px] ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:" hfl-flex hfl-items-center hfl-text-Gray-800",children:i.org_person_name||i.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:i.org_person_phone||i.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:i.org_person_email||i.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:async()=>{window.location.href.includes("/frontdesk")?window.location.href=window.origin+"/md/viewPatientDashboard.php?pid="+i?.person_role_id?.toString():h.goToPage(`viewPatientDashboard.php?pid=${i.person_role_id}`)}})})]}))]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-my-7 hfl-flex hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Success-800",children:"If your patient is not in the above list"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.Ku,{disabled:C,hierarchy:"Primary",size:"xl",textField:"Create As New Patient",className:"hfl-bg-Primary-700",onClick:()=>{b(!0),_(!0,G)}})})]})};function Wt(R){const{editPatient:_,setEditPatient:G,createAsNew:C,setCreateAsNew:b}=R,i=()=>_?"Primary":"Secondary",f=()=>C?"Primary":"Secondary";return e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-6 hfl-flex hfl-h-20 hfl-w-full hfl-items-center hfl-justify-center hfl-gap-4 hfl-border-1 hfl-border-Error-200 hfl-bg-Error-25",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"Are you updating"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:i(),size:"lg",textField:"Exisitng Patient",onClick:()=>{G(!0),b(!1)}}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-text-Error-700",children:"or creating a"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:f(),size:"lg",textField:"New Patient",onClick:()=>{b(!0),G(!1)}})]})}const De=15,rt=3,Kt=({isOpen:R,onClose:_,onSubmit:G,otpErrorMsg:C,setOtpErrorMsg:b,optHeading:i,otpSubHeading:f,veriftButtonTitle:m,resendOtp:J})=>{const[$,w]=a.useState(""),[F,u]=a.useState(De),[se,I]=a.useState(!1),[z,Y]=a.useState(0);a.useEffect(()=>{R&&(w(""),b(""),u(De),I(!1),Y(0))},[R,b]),a.useEffect(()=>{if(F>0&&R){const O=setInterval(()=>{u(W=>W-1)},1e3);return()=>clearInterval(O)}else F===0&&R&&I(!0)},[F,R]);const he=O=>{O.preventDefault(),String($).length===6&&G($)},de=O=>{C&&b("");const W=O.target.value;/^\d*$/.test(W)&&w(W)},fe=()=>{se&&z<rt&&(J(),Y(O=>O+1),u(De),I(!1))};return e.jsxRuntimeExports.jsxs(at.Modal,{isOpen:R,onRequestClose:_,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1032},content:{maxWidth:"400px",maxHeight:"350px",display:"flex",flexDirection:"column",justifyContent:"center",padding:"24px",margin:"auto",borderRadius:"12px"}},ariaHideApp:!1,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-justify-end",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary-Grey",icon:"Only",iconFile:"hx_close",onClick:_,size:"md",textField:""})}),e.jsxRuntimeExports.jsxs("form",{className:"hfl-z-5 hfl-relative hfl-flex hfl-h-full hfl-flex-col hfl-items-center hfl-justify-center hfl-text-center",onSubmit:he,children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:i}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-mx-auto hfl-w-[290px] hfl-pt-2 hfl-text-Gray-500",children:f}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mx-auto hfl-max-h-[150px] hfl-w-[315px] hfl-py-5",children:e.jsxRuntimeExports.jsx(e.wu,{inputProps:{autoFocus:!0,value:$,pattern:"[0-9]+",onChange:de},size:"xs",digits:6,errorMsg:C})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mb-4 hfl-h-4",children:z>=rt?e.jsxRuntimeExports.jsx(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Error-500",children:"Maximum resend attempts reached."}):se?e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-cursor-pointer hfl-text-Primary-700 hfl-underline",onClick:fe,children:"Resend OTP"}):e.jsxRuntimeExports.jsxs(e.bi,{type:"Text sm",variant:"Regular",className:"hfl-text-Gray-500",children:["Resend OTP in 00:",F<10?`0${F}`:F]})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:m,disabled:String($).length<6})]})]})},Zt=R=>{const{closeModal:_,modalIsOpen:G,pref:C,variable:b}=R,{window_var:i,token:f,envName:m}=b,[J,$]=a.useState(!1),[w,F]=a.useState({}),[u,se]=a.useState(!1),[I,z]=a.useState(null),[Y,he]=a.useState(!0),[de,fe]=a.useState(!1),[O,W]=a.useState([]),[Te,K]=a.useState(!1),[P,le]=a.useState(""),[g,nt]=a.useState(),[j,p]=a.useState({name:"",phone:"",age:"",gender:"",email:"",aadhar_number:""}),[re,it]=a.useState([]),[ae,H]=a.useState({name:!1,phone:!1}),[ce,ot]=a.useState([]),[pe,ht]=a.useState([]),[ue,dt]=a.useState([]),[ft,xe]=a.useState(!1),[ct,me]=a.useState(!1),[pt,ge]=a.useState(!1),[_e,ut]=a.useState([]),[k,xt]=a.useState(!1),[s,L]=a.useState({name:"",phone:"",dob:"",gender:"",honorific:"",patient_preferred_language:C?.visit_pad_json?JSON.parse(C?.visit_pad_json)?.defaultLanguage?.rows:"",age:"",age_selector:"years",blood_group:"",email:"",address:"",city:"",existingBidStr:"",pincode:"",ref_doc_name:"",ref_doc_spec:"",temp_appnt_id:"",throughChannel:"",refDocId:"",careOf:"",phoneSecondary:"",occupation:"",tag:"",phone_otp:"",regAsNew:"",image_link:"",marital_status:"",spouse_blood_group:"",married_since:"",spouse_name:"",org_person_dob:"",aadhar_number:"",custom_fields:[]}),[mt,gt]=a.useState([]),{name:ke,phone:A,age:N,dob:M,gender:Ae}=s,[Be,Oe]=a.useState(!1),[_t,je]=a.useState(s.gender),[S,Le]=a.useState("Years"),[Me,Ge]=a.useState(""),[Fe,be]=a.useState(!1),[jt,bt]=a.useState([]),v=(t,l,r,n)=>{bt([{id:1,title:t,description:l,type:r,duration:n}])},q=a.useRef(null),Ie=a.useRef(null),[ze,X]=a.useState(!1),[yt,ye]=a.useState(!1),[Et,He]=a.useState(!1),[Ve,Ee]=a.useState(!1),[qe,Re]=a.useState(!1),[ne,Rt]=a.useState(),D=g&&g.visit_pad_json&&h.isJson(g.visit_pad_json)&&JSON.parse(g.visit_pad_json),Ue=h.debounceFn((...t)=>{const[l,r]=t;At(l,r)}),o=a.useCallback((t,l)=>{ye(!1),L(r=>({...r,[t]:l})),(t==="name"||t==="phone"&&l.length>=3)&&Ue(t,l)},[Ue]),vt=t=>{o("throughChannel",t.value.trim()),xe(!1)},T=a.useMemo(()=>ne?.branch_details?.enable_mobile_otp=="1",[ne?.branch_details?.enable_mobile_otp]),Ct=t=>{o("occupation",t.trim()),me(!1)},wt=t=>{o("city",t.trim()),ge(!1)},Pt=t=>{const{value:l}=t.target,r=Dt(l);ot(r)},Nt=t=>{const{value:l}=t.target,r=Tt(l);ht(r)},St=t=>{const{value:l}=t.target,r=kt(l);ut(r)},Dt=t=>{if(ue?.length){let l=ue;return t?.length&&(l=ue.filter(r=>r.title.toLowerCase().includes(t.toLowerCase()))),l}else return[]},Tt=t=>{if(x.OccupationList?.length){let l=x.OccupationList;return t?.length&&(l=x.OccupationList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},kt=t=>{if(x.CityList?.length){let l=x.CityList;return t?.length&&(l=x.CityList.filter(r=>r.toLowerCase().includes(t.toLowerCase()))),l}else return[]},$e=a.useRef(null),ie=a.useRef(null),ve=a.useRef(null),Ye=window.location?.pathname.includes("/frontdesk");a.useEffect(()=>{const t=h.calculateDOB(s.age,S);t&&L(l=>({...l,dob:t}))},[S,s.age]);const Ce=a.useCallback(t=>{je(t),o("gender",t),p(l=>({...l,gender:""}))},[o]),We=t=>{($e.current&&!$e.current.contains(t.target)||ie.current&&!ie.current.contains(t.target))&&H({name:!1,phone:!1}),ve.current&&!ve.current.contains(t.target)&&be(!1)},Ke=a.useCallback(()=>{le(s.image_link),K(!1),X(!1)},[s.image_link]),Ze=a.useCallback(async()=>{const t=await B.getBranchPreferences("patient_config",i?.org_branch_id_for_seg?.toString()||"",{token:f,envName:m});Rt(t)},[f,m,i?.org_branch_id_for_seg]);a.useEffect(()=>(document.addEventListener("mousedown",We),()=>{document.removeEventListener("mousedown",We)}),[]),a.useEffect(()=>{i.doctor_speciality==="Gynaecologist"&&!s.gender&&Ce("1")},[s.gender,Ce,i.doctor_speciality]),a.useEffect(()=>{s.image_link&&Ke(),s.honorific&&Ge(s.honorific)},[s.honorific,s.image_link,Ke]),a.useEffect(()=>{Ye&&Oe(!0)},[Ye]),a.useEffect(()=>{Ze()},[Ze]),a.useEffect(()=>{(async()=>{nt(C);try{const t=await B.getReferredByList({token:f,envName:m}),{total_ref_doc_details:l,through_channel:r}=t;l.length&&gt(h.parseReferredByDocList(l)),r.length&&dt(h.parseThroughChannelList(r))}catch(t){console.log("ERROR",t)}})()},[C,f,m]);const At=async(t,l)=>{const r={branch_id:i?.org_branch_id_for_seg||"",doctor_id:i?.person_id_for_seg||"",doctor_role_id:i?.doctor_role_id_for_seg||"",term:encodeURIComponent(l),limit:30},n=await B.getPatientList(r,{token:f,envName:m});if(!n){H({name:!1,phone:!1});return}!n.apiError&&Number(n.total_persons)>0?(it(n.persons),H(t==="name"?{...ae,name:!0}:{...ae,phone:!0})):H({name:!1,phone:!1})},U=a.useCallback(async()=>{if(!T||!Y)return;Re(!0),(await B.patientConsentSendOTP(A,b)).apiError?v("OTP Failed","Unable to send OTP. Please try again.","Error",3e3):v("Success","OTP sent successfully","Success",1500)},[T,Y,A,b]),Bt=a.useCallback(async t=>{(await B.patientConsentOTPVerification(A,t,b)).apiError?v("Invalid OTP","Please enter correct OTP","Error",3e3):(xt(!0),v("Success","OTP verified successfully","Success",1500),Re(!1))},[A,b]),we=t=>{switch(t){case"Appointment":return"#Appnt";default:return""}},Pe=t=>{switch(t){case"Bill":case"Appointment":return"emrPatientPopUp.php?pid=";default:return h.EAPP_ROUTES.visitpad+"?pid="}},Ot=a.useCallback(t=>{const l=r=>{L({name:r?.name||"",phone:r?.phone_number||"",gender:r?.gender||"",honorific:r?.honorific||"",patient_preferred_language:r?.patient_preferred_language||"",ref_doc_spec:r?.ref_doc_spec||"",age:r?.age.toString()||"",age_selector:"2",dob:r.org_person_dob||"",org_person_dob:r.org_person_dob||"",blood_group:r?.blood_group||"",email:r?.email||"",address:r?.address||"",city:r?.city||"",existingBidStr:r?.org_person_bid_str||"",pincode:r?.pincode||"",ref_doc_name:r?.ref_doc_name||"",temp_appnt_id:"",throughChannel:r?.through_channel||"",refDocId:r?.ref_doc_id||"",careOf:r?.care_of||"",phoneSecondary:r?.phone_secondary||"",occupation:r?.occupation||"",tag:r?.tag||"",phone_otp:"",regAsNew:"",image_link:r?.image_link||"",marital_status:r.marital_status||"",spouse_blood_group:r.spouse_blood_group||"",married_since:r.married_since||"",spouse_name:r.spouse_name||"",aadhar_number:r.aadhar_number||"",custom_fields:r.custom_fields||[]}),je(r?.gender)};B.getPatientDetails({callback:l,payload:t,token_env:{token:f,envName:m}})},[m,f]),Z=a.useCallback((t="")=>{const l=t?.toLowerCase();return M!==""?"":N!==""&&Number(N)<0&&M===""?"Invalid Age":l==="weeks"&&N!==""&&Number(N)<5907||l==="days"&&N!==""&&Number(N)<9999||l==="months"&&N!==""&&Number(N)<1358||l==="years"&&N!==""&&Number(N)<114?"":"Invalid Age"},[M,N]),Je=async t=>{He(!0);const l={branch_id:i?.org_branch_id_for_seg?.toString()||"",person_id:i?.person_id_for_seg||"",person_role_id:i?.doctor_role_id_for_seg||"",patient_role_id:t.person_role_id||""};Ot(l),H({name:!1,phone:!1}),fe(!0),F(t)},Xe=a.useCallback(()=>{let t=!0;return s.name?s.name.length<2&&(p(l=>({...l,name:"Enter at least 2 letters "})),t=!1):(p(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)&&(p(l=>({...l,phone:"Please enter 10 digit number"})),t=!1),s.aadhar_number&&s.aadhar_number.length!=12&&(p(l=>({...l,aadhar_number:"Please enter 12 digit aadhar number"})),t=!1),Z(S).length&&M?.length===0&&(p(l=>({...l,age:"Invalid Age."})),t=!1),Ae===""&&(p(l=>({...l,gender:"Select Gender"})),t=!1),j.email.length&&(s.email&&!st.create$6().email().isValidSync(s.email)&&p(l=>({...l,email:"Email format is wrong"})),t=!1),t},[s.name,s.phone.length,s.aadhar_number,s.email,g,Z,S,M?.length,Ae,j.email.length]),Q=a.useCallback(async(t,l)=>{const r=new FormData;r.append("pid",t),r.append("bidstr",l),r.append("imgData",P);const n=await B.addPatientImage(r,{token:f,envName:m});n.apiError&&v("Error",n.apiError,"Error",3e3)},[P,m,f]),Qe=a.useCallback(async t=>{const l=new FormData;l.append("pid",t);const r=await B.deletePatientImage(l,{token:f,envName:m});r.apiError&&v("Error",r.apiError,"Error",3e3)},[m,f]),Ne=a.useCallback(async(t,l)=>{try{if(!Xe()){v("Invalid form","Please fill in the required fields","Error",3e3);return}if(T&&!k&&!u){v("Consent Required","Please provide patient consent.","Error",3e3);return}const n=new FormData;n.append("name",s.name),n.append("phone",s.phone),n.append("gender",h.getGenderKey(s.gender)),n.append("honorific",s.honorific),n.append("patient_preferred_language",s.patient_preferred_language),n.append("age",M&&M.length?M:h.calculateDate(s?.age,S)||""),n.append("age_selector",s.age_selector),n.append("blood_group",s.blood_group),n.append("email",s.email),n.append("address",s.address),n.append("city",s.city),n.append("existing_bid_str",s.existingBidStr),n.append("pincode",s.pincode),n.append("ref_doc_id",s.refDocId),n.append("ref_doc_name",s.ref_doc_name),n.append("ref_doc_spec",s.ref_doc_spec),n.append("through_channel",s.throughChannel),n.append("care_of",s.careOf),n.append("phone_secondary",s.phoneSecondary),n.append("occupation",s.occupation),n.append("tag",s.tag),n.append("marital_status",s.marital_status),n.append("married_since",s.married_since),n.append("spouse_name",s.spouse_name),n.append("spouse_blood_group",s.spouse_blood_group),n.append("aadhar_number",s.aadhar_number),n.append("custom_fields",JSON.stringify(s.custom_fields||[])),t&&n.append("reg_as_new","1");const c=Object.fromEntries(n.entries()),y=Object.fromEntries(Object.entries(c).map(([te,$t])=>[te,String($t)])),E={...y,custom_fields:JSON.parse(y.custom_fields||"[]"),doctor_role_id:i.doctor_role_id_for_seg||"",doctor_id:i.person_id_for_seg||"",org_branch_id:i.org_branch_id_for_seg||"",source:"emr",ip:""},d=await B.addPatientDetails(E,{token:f,envName:m});if(d.apiError)v("Error",d.apiError,"Error",3e3),ye(!1);else{if(t){try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof i.patientPopupHandler<"u"?i.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_();return}else{try{P&&await Q(d.person_role_id.toString(),d.org_person_bid_str.toString())}catch(te){console.log(te)}ee()}d?.conflicts?.length>0?($(!0),W(d.conflicts)):_(),Array.isArray(d?.person)||v("Success","Patient Added Successfully","Success",3e3),d!=null&&!d?.conflicts?.length&&d?.person_role_id&&(l!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof i.patientPopupHandler<"u"?i.patientPopupHandler("addpatient",d.person_role_id.toString(),d.person_id.toString(),g,D,l):h.goToPage(Pe(l)+d.person_role_id.toString()+we(l)),_())}}catch(r){console.log(r)}},[Xe,T,k,u,s,M,S,i,f,m,D,_,P,Q,g]),Lt=()=>{try{const t={"/md/viewRemoteAppointments.php":["onlineConsultationHead","bannerPopupWrap","calendarViewClassDiv"],[h.EAPP_ROUTES.consultations]:["onlineConsultationHead","newPaddingMarginEMR","bannerPopupWrap","consultations_mfe"],[h.EAPP_ROUTES.appointments]:["appointments_mfe"]},l=window.location?.pathname||"",r=t[l];if(!r?.length)return;const n=document.getElementById("react_emr_mfe"),c=document.getElementById("react_curtains_mfe"),y=document.querySelector(".offlineEMR3");[n,c,y].forEach(E=>{E&&E.classList.contains("hidden")&&E.classList.remove("hidden")});for(const E of r){const d=document.getElementsByClassName(E);d.length&&!d[0].classList.contains("hidden")&&d[0].classList.add("hidden")}}catch(t){console.error("Error in manipulating DOM:",t)}},et=a.useCallback(async t=>{const l={patient_id:w?.person_id,honorific:s?.honorific,name:s?.name,gender:s?.gender,age:s?.age,org_person_dob:s?.dob?s.dob:h.calculateDate(s?.age,S)||void 0,phone_number:s?.phone,email:s?.email,blood_group:s?.blood_group,patient_preferred_language:s?.patient_preferred_language,address:s?.address,city:s?.city,pincode:s?.pincode,org_person_bid_str:s?.existingBidStr,ref_doc_name:s?.ref_doc_name,ref_doc_spec:s?.ref_doc_spec,through_channel:s?.throughChannel,ref_doc_id:s?.refDocId,care_of:s?.careOf,phone_secondary:s?.phoneSecondary,occupation:s?.occupation,tag:s?.tag,marital_status:s.marital_status,married_since:s.married_since,spouse_name:s.spouse_name,spouse_blood_group:s.spouse_blood_group,image_link:s?.image_link,remote_consultation_id:"0",oc_status:!1,aadhar_number:s?.aadhar_number,person_role_id:i.doctor_role_id_for_seg||"",person_id:i.person_id_for_seg||"",branch_id:i.org_branch_id_for_seg||""},r=await B.updatePatientDetails(l,{token:f,envName:m});if(u){r&&ye(!1);const{message:n,status:c}=r||{};if(c){v("Patient Edited","Patient Edited Successfully","Success",1500);try{s?.image_link&&!P?Qe(w?.person_role_id):P&&Ve&&(Ee(!1),await Q(w?.person_role_id,s?.existingBidStr))}catch(y){console.log(y)}t!=="Rx"&&D&&D?.mode_of_patient_popup?.include=="1"&&typeof i.patientPopupHandler<"u"?i.patientPopupHandler("addpatient",w?.person_role_id,w?.person_id,g,D,t):h.goToPage(Pe(t)+w?.person_role_id?.toString()+we(t)),_()}else v("Patient Not Edited",n||"Patient Not Edited","Failure",1500)}},[w?.person_id,w?.person_role_id,s,S,i,f,m,u,D,_,P,Ve,Qe,Q,g]),Mt=async()=>{try{K(!1);const t=await navigator.mediaDevices.getUserMedia({video:!0});q.current&&(q.current.srcObject=t),X(!0)}catch(t){console.error("Error accessing camera:",t)}},Gt=()=>{const t=Ie.current,l=q.current;if(t&&l){t.width=l.videoWidth,t.height=l.videoHeight;const r=t.getContext("2d");if(r){r.drawImage(l,0,0,t.width,t.height);const n=t.toDataURL();le(n),K(!1),X(!1),ee()}}},Ft=()=>{document.getElementById("upload-local-file")?.click()},It=t=>{K(!1),X(!1);const l=t.target.files?.[0];if(!l)return;const r=new FileReader;r.readAsDataURL(l),r.onloadend=()=>{const n=r.result;n&&le(n.toString()),t.target.value=""}},tt=()=>{K(!0),le(""),X(!1),ee()},ee=()=>{if(q.current){const t=q.current.srcObject;t instanceof MediaStream&&t.getTracks().forEach(l=>l.stop()),q.current.srcObject=null}},zt=a.useMemo(()=>[...ne?.patient_config?.custom_fields||[]].sort((r,n)=>r.sort-n.sort).map(r=>{const n=s.custom_fields?.find(c=>c.id===r.id);return{...r,value:n?.value||"",title:n?.value?n?.title:r.title}}),[ne?.patient_config?.custom_fields,s.custom_fields]),Se=(t,l,r)=>{L(n=>{const c=n.custom_fields?.length?n.custom_fields.map(E=>E.id===t?{...E,value:r}:E):[];return c.some(E=>E.id===t)||c.push({id:t,value:r,title:l}),{...n,custom_fields:c}})},Ht=()=>zt?.map(t=>{const{id:l,type:r,value:n,title:c}=t||{};if(!l||!r||!c)return null;switch(r){case"text":return e.jsxRuntimeExports.jsx(e.Pi,{label:c,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:n||"",placeholder:`Enter ${c}`,onChange:y=>{Se(l,c,y.target.value)}},width:"22em"},l);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:c,placeholder:`Select ${c}`,selectDate:n?new Date(n):null,dateVar:y=>{Se(l,c,y.toDateString()||"")},isborderRequired:!0,width:"22em",clearDate:y=>{Se(l,c,y)},openUp:!0,backSpaceClearDate:!0},l);default:return null}}),V=a.useCallback(t=>{z(t),u?et(t):Ne(!1,t)},[u,et,Ne]),Vt=a.useCallback(()=>{if(T&&!u&&!k){z("Rx"),U();return}V("Rx")},[T,u,k,U,V]),qt=a.useCallback(()=>{if(T&&!u&&!k){z("Bill"),U();return}V("Bill")},[T,u,k,U,V]),Ut=a.useCallback(()=>{if(T&&!u&&!k){z("Appointment"),U();return}V("Appointment")},[T,u,k,U,V]);return a.useEffect(()=>{k&&I&&(V(I),z(null))},[k,I,V]),e.jsxRuntimeExports.jsx(at.Modal,{isOpen:G,onRequestClose:()=>{ee(),_()},shouldCloseOnOverlayClick:!1,style:{content:{zIndex:1030,padding:"0px",maxWidth:"840px",maxHeight:"624px",margin:"auto",borderRadius:"12px"},overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",zIndex:1030}},children:e.jsxRuntimeExports.jsxs("div",{id:"add-patient-modal",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-16 hfl-w-full hfl-flex-row hfl-items-center hfl-justify-between hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-6",id:"add-patient-header","data-qa":"testid_addPatient",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text xl",children:J?"Patient(s) with Same phone number or Email":"Add New Patient"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-items-center",children:e.jsxRuntimeExports.jsx("span",{className:"hx_close hfl-ml-4 hover:hfl-cursor-pointer",onClick:()=>{ee(),_()}})})]}),J?e.jsxRuntimeExports.jsx(Yt,{conflicts:O,handleAddPatient:Ne,redirectAction:I,manipulateExistingDOM:Lt}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-min-h-[400px] hfl-px-10 hfl-py-5",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:e.jsxRuntimeExports.jsxs("div",{ref:ve,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>be(t=>!t),children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:Me}),!Me.length&&e.jsxRuntimeExports.jsx("div",{className:`${Fe?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:j.name?j.name:void 0,inputProps:{type:"text",value:ke,placeholder:"Enter Name",onChange:t=>{o("name",t.target.value)},onBlur:()=>{const t=!(s.name.length>0);s.name.length>0&&s.name.length<2&&!Et?p(l=>({...l,name:"Enter at least 2 letters "})):p(l=>({...l,name:t?"Enter the Name of the Patient":""})),He(!1),H({name:!1,phone:!1})}},start_icon:"hx_person",width:"16em"}),Fe&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-h-[270px] hfl-w-20 hfl-flex-col hfl-overflow-y-auto hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},children:x.HonorificList.map(t=>e.jsxRuntimeExports.jsx(e.ki,{className:"hfl-text-Primary-700",label:t.label,onSelect:()=>{Ge(t.label),be(!1),je(t.gender),o("honorific",t.label),o("gender",t.gender),L(l=>({...l,gender:t.gender,honorific:t.label}))}}))}),ae.name&&ke.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[16px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t?.org_person_name?.length>13?t?.org_person_name?.substring(0,11)+"...":t?.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone||""})]},t?.person_role_id))]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-end hfl-gap-3",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:`Phone Number ${g&&g.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:j.phone?j.phone:void 0,inputProps:{maxLength:10,value:A,placeholder:"Enter Number",onChange:t=>{o("phone",t.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:t=!1,msg:l=""}=g&&g.phone_number_length||A?h.validateMobileNo(A):{};p(r=>({...r,phone:t?l:""})),H({name:!1,phone:!1})}},width:"21em",start_icon:"hx_phone"}),ae.phone&&A.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-w-[350px] hfl-flex-col hfl-space-y-2 hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White hfl-px-[24px] hfl-py-[10px]",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},ref:ie,children:[e.jsxRuntimeExports.jsx(e.bi,{className:"hfl-text-Primary-600",variant:"Regular",type:"Text md",children:"Existing Patients"}),re&&re?.slice(0,7)?.map(t=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-between hfl-gap-[36px]",onMouseDown:()=>Je(t),children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:[t.org_person_name?.length>13?t.org_person_name?.substring(0,11)+"...":t.org_person_name,`(${t.ageStr||h.calculateAge(t.age)}, ${h.getGender(parseInt(t.org_person_gender.toString()))})`]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:t.org_person_phone})]},t?.person_role_id))]})]})})]}),T&&!u&&qe&&e.jsxRuntimeExports.jsx(Kt,{isOpen:qe,onClose:()=>Re(!1),onSubmit:t=>Bt(t),optHeading:"Verify with a OTP",otpSubHeading:`Please enter the OTP shared on ${A}`,veriftButtonTitle:"Verify OTP",resendOtp:U,otpErrorMsg:"",setOtpErrorMsg:()=>{}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-h-[40px] hfl-space-y-1",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-pb-[1px] hfl-text-Gray-600",children:"Gender*"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.ju,{className:`!hfl-h-[40px] hfl-w-44 ${j.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:_t,onChange:t=>Ce(t),disabled:!1}),!!j.gender&&e.jsxRuntimeExports.jsx("div",{className:"hfl-font-inter hfl-text-1 hfl-font-inter-0 hfl-leading-10 hfl-tracking-1 hfl-text-Error-500",children:j.gender})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.tj,{label:"Age or DOB*",className:"hfl-w-20",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-w-16 hfl-border-0",suffixDropdownClassName:"hfl-ml-[80px]",input1value:s.age,input2value:S,end_icon:"hx_down",errorMsg:j.age?j.age:void 0,inputProps:{type:"number",min:0,maxLength:3,placeholder:"Age",onChange:t=>{o("age",t.target.value.replace(/[^0-9]/g,"")),L(l=>({...l,dob:""}))},onBlur:()=>{p(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=>{o("age",t),p(l=>({...l,age:Z(S)}))},handleSuffixValChange:t=>{Le(t),p(l=>({...l,age:Z(t)}))},onSuffixDropdownClick:t=>{Le(t.label),L(l=>({...l,age_selector:t.value,dob:""})),p(l=>({...l,age:Z(t.value)}))}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"DOB",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.dob&&h.isValidDate(new Date(s?.dob))?new Date(oe.dayjs(new Date(s?.dob)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,dob:oe.dayjs(t).format("YYYY-MM-DD"),age:""})),p(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=>{o("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=>{o("city",t.target.value),ge(!0),St(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:()=>wt(t)}))})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-pt-4",children:e.jsxRuntimeExports.jsx(e.Pi,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.pincode,placeholder:"Enter Pin",onChange:t=>{o("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=>{o("address",t.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),de?e.jsxRuntimeExports.jsx(Wt,{setEditPatient:se,editPatient:u,createAsNew:Y,setCreateAsNew:he}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),Be?e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pb-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Marital Status"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:s.marital_status&&x.MARITAL_STATUS.find(t=>t===s.marital_status)||""},placeholder:"Marital Status",label:"Marital Status",onChange:t=>{o("marital_status",t.label)},options:x.MARITAL_STATUS.map(t=>({label:t,value:t})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"marital-status"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-flex hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"Since",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:s?.married_since&&h.isValidDate(new Date(s?.married_since))?new Date(oe.dayjs(new Date(s?.married_since)).format("DD-MMM-YYYY")):"",dateVar:t=>{L(l=>({...l,married_since:oe.dayjs(t).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:s.blood_group&&x.bloodGroups.find(t=>t.value===s.blood_group)?.label||"Blood group"},onChange:t=>{o("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=>{o("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=>{o("spouse_blood_group",t.value)},options:x.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:e.jsxRuntimeExports.jsx(e.tj,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:s.ref_doc_name,input2value:s.ref_doc_spec,end_icon:"hx_down",inputProps:{placeholder:"Doctor Name"},suffixInputProps:{placeholder:"Speciality"},className:"hfl-w-48",suffixClassName:"hfl-w-[100px]",suffixDropdownClassName:"hfl-ml-[160px]",options:mt,suffixOptions:x.SpecialityList,handleValChange:t=>{o("ref_doc_name",t)},handleSuffixValChange:t=>{o("ref_doc_spec",t.value)},onDropdownClick:t=>{o("ref_doc_name",t.doctor_name),o("refDocId",t.doctor_id),o("ref_doc_spec",t.specialist)},onSuffixDropdownClick:t=>{o("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=>{o("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=>{o("email",t.target.value.trim())},onBlur:t=>{t.target.value&&!st.create$6().email().isValidSync(t.target.value)?p(l=>({...l,email:"Email format is wrong"})):p(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=>{o("throughChannel",t.target.value),xe(!0),Pt(t)},onBlur:t=>{t.stopPropagation(),xe(!1)}},width:"22em"}),ft&&ce&&ce.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:ce.map(t=>{const{title:l,...r}=t;return e.jsxRuntimeExports.jsx(e.ki,{label:l,className:"hfl-text-Primary-700",...r,onSelect:()=>vt({value:t.value})},t.value)})})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s?.careOf,placeholder:"Enter C/O",onChange:t=>{o("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=>{o("occupation",t.target.value),me(!0),Nt(t)},onBlur:t=>{t.stopPropagation(),me(!1)}},width:"22em"}),ct&&pe&&pe.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:pe.map(t=>e.jsxRuntimeExports.jsx(e.ki,{label:t,className:"hfl-text-Primary-700",onSelect:()=>Ct(t)}))})]}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:s.tag,placeholder:"Enter Tag",onChange:t=>{o("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=>{o("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=>{o("aadhar_number",t.target.value)},onBlur:()=>{p(t=>({...t,aadhar_number:s.aadhar_number&&s.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-11 hfl-gap-y-6",children:Ht()})]}),e.jsxRuntimeExports.jsx(lt,{}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-h-[153px] hfl-w-[200px] hfl-items-center hfl-justify-center
2
- hfl-rounded-3xl hfl-border-4
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
- ${Te?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Camera",className:"hfl-mb-2",onClick:Mt,icon:"Left",iconFile:"hx_camera"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("input",{id:"upload-local-file",type:"file",style:{display:"none"},accept:"image/*",onChange:It}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:"Upload",icon:"Left",iconFile:"hx_image-add",onClick:Ft})]})]}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-flex
5
- ${ze?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx("canvas",{ref:Ie,style:{display:"none"}}),e.jsxRuntimeExports.jsx("video",{ref:q,className:"hfl-object-fit hfl-h-full hfl-w-full hfl-rounded-3xl",autoPlay:!0}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-bottom-0 hfl-left-0 hfl-right-0 hfl-flex hfl-justify-around",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Cancel",className:"hfl-mb-2 hfl-bg-Error-600 hover:hfl-bg-Error-700",onClick:tt}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Capture",className:"hfl-mb-2 hfl-bg-Primary-600",onClick:Gt})]})]}),e.jsxRuntimeExports.jsx("div",{className:Te||P||ze?"hfl-hidden":"",onClick:()=>{Ee(!0),K(!0)},"data-qa":"profile-img",children:e.jsxRuntimeExports.jsxs("svg",{width:"76",height:"72",viewBox:"0 0 76 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.4",d:"M75.375 26.0477V57.1667C75.6016 59.1092 75.3857 61.0778 74.7434 62.925C74.1011 64.7722 73.0491 66.4501 71.6663 67.8329C70.2834 69.2158 68.6055 70.2678 66.7583 70.9101C64.9111 71.5524 62.9425 71.7683 61 71.5417H15C13.0575 71.7683 11.0889 71.5524 9.2417 70.9101C7.3945 70.2678 5.71661 69.2158 4.33373 67.8329C2.95086 66.4501 1.89887 64.7722 1.25659 62.925C0.614305 61.0778 0.398381 59.1092 0.624996 57.1667V18.8333C0.398381 16.8908 0.614305 14.9222 1.25659 13.075C1.89887 11.2278 2.95086 9.54994 4.33373 8.16707C5.71661 6.7842 7.3945 5.73221 9.2417 5.08992C11.0889 4.44764 13.0575 4.23172 15 4.45833H48.7333C48.9029 4.46277 49.0695 4.50469 49.221 4.58109C49.3725 4.65748 49.5052 4.76645 49.6096 4.90019C49.7141 5.03393 49.7876 5.18911 49.825 5.35462C49.8624 5.52013 49.8626 5.69187 49.8258 5.8575C48.9214 10.3365 49.831 14.9913 52.355 18.8004C54.879 22.6094 58.8112 25.2613 63.2885 26.1742C66.8321 26.8826 70.5088 26.4602 73.7995 24.9667C73.975 24.8968 74.1649 24.8712 74.3526 24.8921C74.5403 24.9131 74.72 24.9799 74.8757 25.0868C75.0314 25.1936 75.1584 25.3372 75.2455 25.5048C75.3326 25.6724 75.3771 25.8588 75.375 26.0477Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M69.2877 46.2877L52.2217 29.2217C51.4989 28.5016 50.5202 28.0973 49.5 28.0973C48.4798 28.0973 47.5011 28.5016 46.7783 29.2217L27.8417 48.1583C27.4834 48.5095 27.0017 48.7062 26.5 48.7062C25.9983 48.7062 25.5166 48.5095 25.1583 48.1583L21.555 44.555C20.8322 43.835 19.8536 43.4307 18.8333 43.4307C17.8131 43.4307 16.8344 43.835 16.1117 44.555L6.71233 53.9543C6.49661 54.1698 6.37527 54.4621 6.375 54.767V57.1667C6.375 63.2233 8.94333 65.7917 15 65.7917H61C67.0567 65.7917 69.625 63.2233 69.625 57.1667V47.1003C69.6247 46.7954 69.5034 46.5031 69.2877 46.2877Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M22.6667 31.2917C22.0374 31.2939 21.4139 31.1722 20.8317 30.9335C20.2494 30.6948 19.7199 30.3438 19.2734 29.9004C18.3715 29.005 17.8623 27.7881 17.8577 26.5172C17.8532 25.2464 18.3536 24.0258 19.249 23.124C20.1444 22.2221 21.3613 21.7129 22.6322 21.7083H22.6667C23.9375 21.7083 25.1563 22.2132 26.0549 23.1118C26.9535 24.0104 27.4583 25.2292 27.4583 26.5C27.4583 27.7708 26.9535 28.9896 26.0549 29.8882C25.1563 30.7868 23.9375 31.2917 22.6667 31.2917Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M74.5317 7.21833L68.7817 1.46833C68.2421 0.930873 67.5116 0.629108 66.75 0.629108C65.9884 0.629108 65.2579 0.930873 64.7183 1.46833L58.9683 7.21833C58.4605 7.76333 58.184 8.48418 58.1972 9.229C58.2103 9.97382 58.512 10.6845 59.0388 11.2112C59.5655 11.738 60.2762 12.0397 61.021 12.0528C61.7658 12.066 62.4867 11.7895 63.0317 11.2817L63.875 10.4422V18.8333C63.875 19.5958 64.1779 20.3271 64.7171 20.8663C65.2562 21.4054 65.9875 21.7083 66.75 21.7083C67.5125 21.7083 68.2438 21.4054 68.7829 20.8663C69.3221 20.3271 69.625 19.5958 69.625 18.8333V10.4422L70.4683 11.2817C71.0133 11.7895 71.7342 12.066 72.479 12.0528C73.2238 12.0397 73.9345 11.738 74.4612 11.2112C74.988 10.6845 75.2897 9.97382 75.3028 9.229C75.316 8.48418 75.0395 7.76333 74.5317 7.21833Z",fill:"#396CE8"})]})}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-h-full hfl-w-full
6
- ${P?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx("img",{src:P,alt:"ProfilePicturePreview",className:"hfl-h-full hfl-w-full hfl-rounded-3xl hfl-object-cover"}),e.jsxRuntimeExports.jsx("div",{className:`hfl-absolute hfl-right-2 hfl-top-2 hfl-flex hfl-h-[40px]
7
- hfl-w-[40px] hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-rounded-full hfl-bg-White`,onClick:()=>{Ee(!0),tt()},children:e.jsxRuntimeExports.jsx("i",{className:"hx_delete hfl-text-[22px]"})})]})]})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",children:["If you want to add more details,"," "]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-cursor-pointer hfl-text-Primary-700",onClick:()=>{Oe(!0)},children:"Click Here"})]})]}),e.jsxRuntimeExports.jsx("div",{className:`${Be?"":"hfl-flex hfl-w-full"} hfl-sticky hfl-bottom-0 hfl-bg-White`,children:J?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[118px] hfl-w-full hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-1",style:{boxShadow:"-3px -1px 4px rgba(0, 0, 0, 0.25)"},children:[window.location?.href.indexOf("/frontdesk")==-1&&e.jsxRuntimeExports.jsx(e.Ku,{disabled:yt,hierarchy:"Primary",size:"sm",textField:"Add & Create Rx",className:"hfl-bg-Primary-600",onClick:Vt}),e.jsxRuntimeExports.jsx("div",{children:window.location?.href.indexOf("/frontdesk")==-1&&e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:"or"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"Add & Create Bill",className:"hfl-w-[190px] hfl-flex-1 hfl-justify-center hfl-text-Primary-700",onClick:qt}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"Add & Create Appointment",className:"hfl-w-[190px] hfl-flex-1 hfl-justify-center hfl-text-Primary-700",onClick:Ut})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[100]",children:e.jsxRuntimeExports.jsx(e.qh,{toastList:jt})})]})})]})})};exports.PatientAddEdit=Zt;