hplx-feature-library 1.0.296 → 1.0.298

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
- "use strict";const e=require("./index-D5vZvm7Z.cjs"),y=require("react"),$e=require("./common-utils-yiZUv58F.cjs"),ae=require("./PrintModal-HGeH3XG0.cjs"),Te=require("./dayjs.min-BawXyS7V.cjs"),Rr=require("./APIAction-BgGlVURt.cjs"),Wt=require("./CommonConstant-BUchL6Rc.cjs"),hl=require("./index.esm-BdlMQ1M7.cjs");;/* empty css */const jl=require("./useMediaQuery-D4SIgdMW.cjs"),Gl={color:"white"},br=n=>e.jsxRuntimeExports.jsx("div",{children:n.isRequired&&e.jsxRuntimeExports.jsx("a",{href:n.goToPage,children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-flex-col hfl-items-center hfl-rounded hfl-px-2 hfl-py-1 ${n.color}
1
+ "use strict";const e=require("./index-D5vZvm7Z.cjs"),y=require("react"),$e=require("./common-utils-yiZUv58F.cjs"),ae=require("./PrintModal-Brkt62Ov.cjs"),Te=require("./dayjs.min-BawXyS7V.cjs"),Rr=require("./APIAction-BgGlVURt.cjs"),Wt=require("./CommonConstant-BUchL6Rc.cjs"),hl=require("./index.esm-BdlMQ1M7.cjs");;/* empty css */const jl=require("./useMediaQuery-D4SIgdMW.cjs"),Gl={color:"white"},br=n=>e.jsxRuntimeExports.jsx("div",{children:n.isRequired&&e.jsxRuntimeExports.jsx("a",{href:n.goToPage,children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-flex-col hfl-items-center hfl-rounded hfl-px-2 hfl-py-1 ${n.color}
2
2
  ${n.disabled?"hfl-cursor-not-allowed ":"hfl-cursor-pointer"} ${n.isSelected?"hfl-bg-White_20 hfl-bg-opacity-10 ":""} `,onClick:n.disabled?()=>{}:n.onClickHandler,title:n.disabled?"Low internet speed. Feature available only in online mode":n.label,"data-qa":n.data_qa,children:[n.src&&e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[22px]",src:n.src,alt:"no-img"}),n.icon&&e.jsxRuntimeExports.jsx("i",{className:n.icon+" hfl-text-5 ",style:Gl}),e.jsxRuntimeExports.jsx("div",{className:"hfl-text-1",children:e.jsxRuntimeExports.jsx(e.bi,{variant:n.isSelected?"Bold":"Regular",type:"Text sm",style:Gl,className:"hover:hfl-underline",children:n.label})})]})})}),Tt=y.createContext({currentWindow:"",isLoading:!1,formattedService:void 0,billPreferences:void 0,doctorListArr:void 0,serviceListArr:void 0,patientDetails:void 0,preferences:void 0,patientIDs:void 0,docPreference:void 0,showPrintModal:{visible:!1,whichPreview:"",printData:"",visitId:"",visit_date:"",details:null,visit_number:0,printDataFrom:"",currentPrintTime:0,printType:"",trackEventHandler:()=>{},appointmentInfo:void 0},ppEventProps:{patient_id:"",patient_registered_date:"",patient_age:"",patient_gender:""},patientCustomFieldData:[],setShowPrintModal:()=>{},setEndConsultationClicked:()=>{},setLoading:()=>{},setLastBillPaymentData:()=>{},getAndSetServiceListArr:async()=>{},getLastBillsPaymentData:async()=>{},showToast:()=>{},variable:{token:"",enc_token:"",envName:$e.E_ENVIRONMENT.DEVELOPMENT}}),ml="data:image/svg+xml,%3csvg%20width='22'%20height='22'%20viewBox='0%200%2022%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3crect%20width='22'%20height='22'%20fill='url(%23pattern0)'/%3e%3cdefs%3e%3cpattern%20id='pattern0'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0_3069_356'%20transform='scale(0.00666667)'/%3e%3c/pattern%3e%3cimage%20id='image0_3069_356'%20width='150'%20height='150'%20xlink:href='data:image/png;base64,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'/%3e%3c/defs%3e%3c/svg%3e",zl={appnt_id:"",patient_role_id:"",appnt_doctor_role_id:"",appnt_service_id:"",appnt_date:"",appnt_time:"",appnt_status:0,appnt_duration:"15",appnt_doctor_name:"",appnt_service_name:"",order_item_id:"",item_quantity:"0",order_unit_item_price:"0",order_item_price:"0",order_item_discount:"0",order_item_service_tax:"0",total_price:"0",appnt_created_on:"",order_item_created_on:""},tn={order_item_id:"",service_id:"",service_name:"",service_category:"",service_category_id:"",item_quantity:"",order_unit_item_price:"",order_item_price:"",order_item_discount:"",order_item_service_tax:"",created_on:"",bill_item_details:{appointment_details:null,doctor_name:"",lab_owner_name:"",lab_owner_id:"0"}},fl=[{order_id:"",order_date:"",order_created_on:"",service_category:"",service_category_id:"",order_id_str:"",order_total:"",order_paid_amount:"",order_item_sum_discount:"",order_discount:"",refund_amount:"",order_service_tax:"",balance_amount:"",net_bill_amount:"",order_item_id:"",service_id:"",service_name:"",item_quantity:"",order_unit_item_price:"",order_item_price:"",order_item_discount:"",order_item_service_tax:"",order_item_service_tax_percent:"",created_on:"",net_amount:""}],Ir=[{label:"5 min",value:5},{label:"10 min",value:10},{label:"15 min",value:15},{label:"20 min",value:20},{label:"30 min",value:30},{label:"45 min",value:45},{label:"1 hour",value:60},{label:"1:30 hours",value:90},{label:"2 hours",value:120},{label:"2:30 hours",value:150},{label:"3 hours",value:180}],rn=10,sn=10,ft=["bill_summary","service_level_bill","consult_details","lab_detail","other_detail","payment_summary","delete_item","deposit","deposit_summary","payment_mode"],Et=["Doctor consultation","Other Services","Internal lab tests"],Ur=["CASH","CARD","M-WALLET","UPI/UPI QR SCAN","CHEQUE","BANK TRANSFER","INSURANCE","PATIENT APP","HBOOK","DEPOSIT","CREDIT","CGHS","RGHS","PMJAY","AYUSHMAN BHARAT"],As=["CASH","CARD","UPI/UPI QR SCAN","M-WALLET","CHEQUE","BANK TRANSFER"],Xr={0:"M",1:"F",2:"O"};var Zr=(n=>(n.CASH="CASH",n.CARD="CARD",n["M-WALLET"]="M-WALLET",n.CHEQUE="CHEQUE",n["BANK TRANSFER"]="BANK_TRANSFER",n.INSURANCE="INSURANCE",n["PATIENT APP"]="PATIENT_APP",n.HBOOK="HBOOK",n.DEPOSIT="DEPOSIT",n["UPI/UPI QR SCAN"]="UPI",n.CREDIT="CREDIT_MODE",n.CGHS="CGHS",n.RGHS="RGHS",n.PMJAY="PMJAY",n["AYUSHMAN BHARAT"]="AYUSHMAN BHARAT",n))(Zr||{}),ur=(n=>(n[n.CASH=0]="CASH",n[n.CARD=1]="CARD",n[n["M-WALLET"]=2]="M-WALLET",n[n.CHEQUE=3]="CHEQUE",n[n["BANK TRANSFER"]=4]="BANK TRANSFER",n[n.INSURANCE=5]="INSURANCE",n[n["PATIENT APP"]=6]="PATIENT APP",n[n.HBOOK=7]="HBOOK",n[n.DEPOSIT=8]="DEPOSIT",n[n["UPI/UPI QR SCAN"]=9]="UPI/UPI QR SCAN",n[n.CREDIT=10]="CREDIT",n[n.CGHS=11]="CGHS",n[n.RGHS=12]="RGHS",n[n.PMJAY=13]="PMJAY",n[n["AYUSHMAN BHARAT"]=14]="AYUSHMAN BHARAT",n))(ur||{}),jr=(n=>(n.deposit_refund="deposit_refund",n.consultation_lab_other_services="consultation_lab_other_services",n))(jr||{});const fr={consultation_lab_other_services:{key:"consultation_lab_other_services",label:"Consultation, Lab and Other Services"},deposit_refund:{key:"deposit_refund",label:"Deposits and Refunds"}};var Xt=(n=>(n.lis_report="lis_report",n.healthplix_report="healthplix_report",n))(Xt||{});const qr={lis_report:{key:"lis_report",label:"LIS Reports"},healthplix_report:{key:"healthplix_report",label:"HealthPlix Reports"}},Rt=["abha","appointment","add_bills","bills","payments","visits","lab","doc","profile"],ln={margin_left:"leftMargin",margin_right:"rightMargin",header_height:"headerHeight",footer_height:"footerHeight",page_height:"pageHeight",pdf_margin_left:"leftMarginPdf",pdf_margin_right:"rightMarginPdf",pdf_header_height:"headerHeightPdf",pdf_footer_height:"footerHeightPdf",patient_img_height:"patientImageHeight",patient_img_width:"patientImageWidth",font_family:"fontFamily",font_size:"fontSize",font_size_compensation:"fontSizeCompen",field_phone_number:"print_phoneNum",field_address:"print_address",field_refer_by:"refer_by",field_channel_through:"channel_through",field_department_name:"department_name",field_doctor_name:"doctor_name",field_visit_number:"visit_number",not_include_sub_header:"notIncludeSubHeader",show_print_preview:"showPrintPreview",default_language:"defaultLanguage",print_sign_img:"print_signImg"},xl=[{value:0,text:"BOOKED",text_color:"hfl-text-Primary-700"},{value:1,text:"REVIEWED",text_color:"hfl-text-Gray-400 group-hover:hfl-text-Gray-500"},{value:2,text:"CANCELLED",text_color:"hfl-text-Error-600"},{value:3,text:"ARRIVED",text_color:"hfl-text-Primary-700"},{value:5,text:"ON-GOING",text_color:"hfl-text-Success-700"}],nn=async({callback:n},d,c)=>{try{const a={branch_id:c.window_var.org_branch_id_for_seg,person_id:c.window_var.person_id_for_seg,person_role_id:c.window_var.doctor_role_id_for_seg,patient_role_id:d};window?.partner_service_enabled==="1"&&(a.partner_service_enabled=!0);const v=await $e.ReArchAPI(c.token,c.envName).post(Rr.GET_PATIENT_DETAILS,{...a}),{data:w}=v||{},{error:l}=w||{};if(l)throw new Error(l);n(w)}catch(a){console.log(a),n(void 0)}},an=async n=>{try{const d=await $e.ReArchAPI(n.token,n.envName).get(ae.GET_SERVICE_LIST+"/"+n.window_var.org_branch_id_for_seg+"?doctor_role_id="+n.window_var.doctor_role_id_for_seg+"&doctor_id="+n.window_var.person_id_for_seg),{data:c}=d||{};return Promise.resolve(c)}catch(d){return console.log(d),Promise.reject(d)}},on=async n=>{try{const d=await $e.ReArchAPI(n.token,n.envName).get(ae.GET_DOCTORS_LIST+"/"+n.window_var.org_branch_id_for_seg+"?doctor_role_id="+n.window_var.doctor_role_id_for_seg+"&doctor_id="+n.window_var.person_id_for_seg),{data:c}=d||{};return Promise.resolve(c)}catch(d){return console.log(d),Promise.reject(d)}},gl=async(n="all",d,c=1,a=20,v)=>{try{const w=await $e.ReArchAPI(v.token,v.envName).get(`${ae.GET_BILLS}?date=${n}&patient_role_id=${d}&page_no=${c}&page_size=${a}&org_branch_id=${v.window_var.org_branch_id_for_seg}`),{data:l}=w||{};return Promise.resolve(l)}catch(w){return console.log(w),Promise.reject(w)}},vl=async(n,d=1,c=10,a)=>{try{const v=await $e.ReArchAPI(a.token,a.envName).get(`${ae.GET_PAYMENT}?patient_role_id=${n}&branch_id=${a.window_var.org_branch_id_for_seg}&page_number=${d}&page_size=${c}`),{data:w}=v||{};return Promise.resolve(w)}catch(v){return console.log(v),Promise.reject(v)}},Rl=async(n,d,c)=>{try{const a=await $e.ReArchAPI(c.token,c.envName).get(`${ae.GET_BILL_ITEM}?order_item_id=${n}&patient_role_id=${d}&org_branch_id=${c.window_var.org_branch_id_for_seg}`),{data:v}=a||{};return Promise.resolve(v)}catch(a){return console.log(a),Promise.reject(a)}},yl=async(n,d,c=!0,a)=>{try{const v=await $e.ReArchAPI(a.token,a.envName).get(`${ae.GET_PAST_DUE}?bill_date=${n}&org_branch_id=${a.window_var.org_branch_id_for_seg}&patient_role_id=${d}&past_due=${c}`),{data:w}=v||{};return Promise.resolve(w)}catch(v){return console.log(v),Promise.reject(v)}},un=async(n,d,c)=>{try{const a=await $e.ReArchAPI(c.token,c.envName).get(`${ae.GET_BILL_SUMMARY}/${n}/${d}?doctor_role_id=${c.window_var.doctor_role_id_for_seg}&doctor_id=${c.window_var.person_id_for_seg}&org_branch_id=${c.window_var.org_branch_id_for_seg}`),{data:v}=a||{};return Promise.resolve(v)}catch(a){return console.log(a),Promise.reject(a)}},cn=async(n,d,c,a)=>{try{const v={billing_person_role_id:+a.window_var.doctor_role_id_for_seg,org_branch_id:+a.window_var.org_branch_id_for_seg,patient_role_id:+d,doctor_id:+a.window_var.person_id_for_seg,billing_person_role:11,bill_details:{appnt_id:+n?.appnt_id||0,discount:+n?.order_item_discount,order_date:c,quantity:+n?.item_quantity,referrer_doctor_role_id:+n?.bill_item_details?.referrer_doctor_role_id||n?.appnt_doctor_role_id||0,service_category:Et.indexOf(n?.service_category)+1,service_id:+n?.service_id,service_name:n?.service_name,service_tax:Math.floor(n?.order_item_service_tax)||0,unit_price:+n?.order_unit_item_price||0,appnt_doctor_role_id:+n?.appnt_doctor_role_id||0,doctor_name:n?.bill_item_details?.doctor_name||"",lab_owner_name:n?.bill_item_details?.lab_owner_name||"",lab_owner_id:+n?.bill_item_details?.lab_owner_id||0}},w=await $e.ReArchAPI(a.token,a.envName).post(ae.GET_BILLS,{...v}),{data:l}=w||{};return Promise.resolve(l)}catch(v){return console.log(v),Promise.reject(v)}},dn=async(n,d,c)=>{try{const a={org_branch_id:+c.window_var.org_branch_id_for_seg,doctor_id:+c.window_var.person_id_for_seg,patient_role_id:+d,order_item_price:+n.order_item_price,order_item_id:+n.order_item_id,service_id:+n.service_id,service_name:n.service_name,item_quantity:+n.item_quantity,order_unit_item_price:+n.order_unit_item_price,order_item_discount:+n.order_item_discount,order_item_service_tax:Math.floor(n.order_item_service_tax)},v=await $e.ReArchAPI(c.token,c.envName).put(ae.PUT_BILL_ITEM,{...a}),{data:w}=v||{};return Promise.resolve(w)}catch(a){return console.log(a),Promise.reject(a)}},pl=async(n,d,c,a,v,w={},l)=>{try{const A={action:n,amount:d,order_id:+c,billing_person_role_id:+l.window_var.doctor_role_id_for_seg,patient_role_id:+v,payment_split:a,org_branch_id:+l.window_var.org_branch_id_for_seg,refund_details:w},S=await $e.ReArchAPI(l.token,l.envName).put(ae.PUT_BILLS,{...A}),{data:p}=S||{};return Promise.resolve(p)}catch(A){return console.log(A),Promise.reject(A)}},Yl=async(n,d,c,a,v,w)=>{try{const l=await $e.ReArchAPI(w.token,w.envName).delete(`${ae.DELETE_BILL_ITEM}?deleting_person_role_id=${w.window_var.doctor_role_id_for_seg}&mode=${v}&order_id=${n}&order_item_id=${d}&org_branch_id=${w.window_var.org_branch_id_for_seg}&patient_role_id=${c}&reason=${a}`),{data:A}=l||{};return Promise.resolve(A)}catch(l){return console.log(l),Promise.reject(l)}},Bs=async(n="all",d,c=1,a=10,v=!1,w)=>{try{const l=await $e.ReArchAPI(w.token,w.envName).get(`${ae.GET_APPOINTMENTS}?appnt_date=${n}&patient_role_id=${d}&doctor_id=${w.window_var.person_id_for_seg}&org_branch_id=${w.window_var.org_branch_id_for_seg}&page_no=${c}&page_size=${a}&skip_appnt_with_bill=${v}`),{data:A}=l||{};return Promise.resolve(A)}catch(l){return console.log(l),Promise.reject(l)}},fn=async(n,d="all",c="0",a)=>{try{const v=await $e.ReArchAPI(a.token,a.envName).get(`${ae.GET_APPOINTMENTS}/services/${n}?appnt_date=${d}&doctor_id=${a.window_var.person_id_for_seg}&org_branch_id=${a.window_var.org_branch_id_for_seg}&patient_role_id=${c}`),{data:w}=v||{};return Promise.resolve(w)}catch(v){return console.log(v),Promise.reject(v)}},pn=async(n,d,c,a,v,w,l)=>{try{const A={doctor_id:+l.window_var.person_id_for_seg,patient_role_id:+v,org_branch_id:+l.window_var.org_branch_id_for_seg,billing_person_role_id:+l.window_var.doctor_role_id_for_seg,appnt_date:n.appnt_date,patient_name:c,patient_phone_number:a,appnt_doctor_name:n.appnt_doctor_name,appnt_doctor_role_id:+n.appnt_doctor_role_id,appnt_duration:+n.appnt_duration,appnt_service_id:+n?.service_id||+n.appnt_service_id,appnt_service_name:n?.service_name||n.appnt_service_name,appnt_status:+n.appnt_status,appnt_time:n.appnt_time,skip_appnt_bill:d,order_date:Te.dayjs().format("YYYY-MM-DD"),item_quantity:+n.item_quantity,order_item_discount:+n.order_item_discount,order_item_price:+n.order_item_price,order_item_service_tax:Math.floor(n.order_item_service_tax),order_unit_item_price:+n.order_unit_item_price,is_partner_appointment:w},S=await $e.ReArchAPI(l.token,l.envName).post(ae.PUT_APPOINTMENTS,{...A}),{data:p}=S||{};return Promise.resolve(p)}catch(A){return console.log(A),Promise.reject(A)}},hn=async(n,d,c,a,v)=>{try{const w={doctor_id:v.window_var.person_id_for_seg,patient_role_id:a,org_branch_id:+v.window_var.org_branch_id_for_seg,billing_person_role_id:v.window_var.doctor_role_id_for_seg,appnt_id:+n.appnt_id,appnt_date:Te.dayjs(n.appnt_date).format("YYYY-MM-DD"),patient_name:c,appnt_doctor_name:n.appnt_doctor_name,appnt_doctor_role_id:+n.appnt_doctor_role_id,appnt_duration:+n.appnt_duration,appnt_service_id:+n.appnt_service_id,appnt_service_name:n.appnt_service_name,appnt_status:+n.appnt_status,appnt_time:n.appnt_time,skip_appnt_bill:d,order_date:Te.dayjs().format("YYYY-MM-DD"),item_quantity:+n.item_quantity,order_item_discount:+n.order_item_discount,order_item_price:+n.order_item_price,order_item_service_tax:Math.floor(n.order_item_service_tax),order_unit_item_price:+n.order_unit_item_price},l=await $e.ReArchAPI(v.token,v.envName).put(ae.PUT_APPOINTMENTS,{...w}),{data:A}=l||{};return Promise.resolve(A)}catch(w){return console.log(w),Promise.reject(w)}},mn=async(n="",d)=>{try{const c=await $e.ReArchAPI(d.token,d.envName).get(`${ae.GET_BRANCH_PREFERENCE}/${d.window_var.org_branch_id_for_seg}?fields_required=${n}`),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},xn=async(n,d,c="",a)=>{try{const v={branch_id:a.window_var.org_branch_id_for_seg,doctor_id:a.window_var.person_id_for_seg,doctor_role_id:a.window_var.doctor_role_id_for_seg,patient_role_id:d,extra:{visit_date:Te.dayjs(n).format("DD-MMM-YYYY")},page_config:{page_number:1,page_size:1},metadata_preference:{patient_history:!0,obstetric_history:!0,menstrual_info:!0,physical_examination:!0,lab_tests_n_imaging:!0,drawing_board:!0},visit_id:c},w=await $e.ReArchAPI(a.token,a.envName).post(ae.GET_VISIT_ALL,{...v}),{data:l}=w||{};return Promise.resolve(l)}catch(v){return console.log(v),Promise.reject(v)}},gn=async(n,d,c,a)=>{try{const v=new URLSearchParams({patient_role_id:c,size:n.toString(),lab_type:"ALL",page:d.toString()}),w=await $e.ReArchAPI(a.enc_token,a.envName).get(`${ae.LAB_ORDERS}?${v.toString()}`),{data:l}=w||{};if(!l||!l.status)throw new Error(l?.message||"Failed to fetch lab orders.");return Promise.resolve({orders:l.orders||[],total:l.total||0})}catch(v){return console.error("Error fetching lab orders:",v),Promise.reject(v)}},vn=async(n,d)=>{try{if(!n||n.length===0)throw new Error("No result IDs provided to fetch lab details.");const c=$e.ReArchAPI(d.enc_token,d.envName),a=n.map(A=>`result_ids=${encodeURIComponent(A)}`).join("&"),v=`${ae.GET_LAB_ORDER_DETAILS}?${a}`,w=await c.get(v),{data:l}=w||{};return Promise.resolve(l.data)}catch(c){return console.error("Error fetching lab report details:",c),Promise.reject(c)}},yn=async(n,d,c,a)=>{try{const v=await $e.ReArchAPI(a.token,a.envName).get(`${ae.GET_PATIENT_POPUP_VISIT}/${c}?doctor_role_id=${a.window_var.doctor_role_id_for_seg}&doctor_id=${a.window_var.person_id_for_seg}&branch_id=${a.window_var.org_branch_id_for_seg}&page_size=${n}&page_number=${d}`),{data:w}=v||{},{error:l}=w||{};if(l)throw new Error(l);return Promise.resolve(w)}catch(v){return console.log(v),Promise.reject(v)}},_n=async(n,d,c)=>{const{patientRoleID:a,patientID:v}=c||{};try{const w=await $e.ReArchAPI(d.token,d.envName).put(Rr.UPDATE_PATIENT_DETAIL+"/"+a,{...n,person_role_id:d.window_var.doctor_role_id_for_seg,person_id:d.window_var.person_id_for_seg,branch_id:d.window_var.org_branch_id_for_seg,patient_role_id:a,patient_id:v}),{data:l}=w||{};return l?.status&&typeof d.window_var.getUpdatedPatientDetails=="function"&&v===d.window_var.patient_person_id&&a===d.window_var.patient_role_id&&d.window_var.getUpdatedPatientDetails(),Promise.resolve(l)}catch(w){return console.log(w),Promise.reject(w)}},bn=async n=>{try{const d=await $e.hplxAPI(n.token,n.envName).post(ae.GET_REFERREDBY_DOCTOR),{data:c}=d||{},{apiError:a}=c||{};if(a)throw new Error(a);return Promise.resolve(c)}catch(d){return console.log(d),Promise.reject(d)}},jn=async(n,d)=>{try{const c=await $e.hplxAPI(n.token,n.envName).post(`${ae.GET_IPD_CASE}?pid=${d}`),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},Rn=n=>{const d=[];if(n.length)for(const c of n)d.push({title:c,value:c});return d},wn=n=>{const d=[];if(n.length)for(const c of n)d.push({doctor_id:c.doctor_id?c.doctor_id:"",doctor_name:c.doctor_name?c.doctor_name:"",label:c.doctor_name?c.doctor_name:"",specialist:c.specialist||""});return d},Cn=async(n,d)=>{try{const c=await $e.hplxAPI(d.token,d.envName).post(Rr.ADD_PATIENT_IMAGE,n),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},En=async(n,d,c,a,v)=>{try{const w={billing_person_id:v.window_var.person_id_for_seg,billing_person_role_id:v.window_var.doctor_role_id_for_seg,patient_role_id:a,org_branch_id:v.window_var.org_branch_id_for_seg,total_amount:n,data:d,payment_split:c},l=await $e.ReArchAPI(v.token,v.envName).post(ae.POST_PAYMENT,{...w}),{data:A}=l||{};return Promise.resolve(A)}catch(w){return console.log(w),Promise.reject(w)}},Pn=async(n="",d)=>{try{const c=await $e.ReArchAPI(d.token,d.envName).get(ae.GET_REFERRAL+"/"+d.window_var.org_branch_id_for_seg+`?type=null&query=${n}&doctor_role_id=`+d.window_var.doctor_role_id_for_seg+"&doctor_id="+d.window_var.person_id_for_seg),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},Sn=async(n,d,c)=>{try{const a={org_branch_id:+c.window_var.org_branch_id_for_seg,patient_role_id:+d,doctor_role_id:+c.window_var.doctor_role_id_for_seg,doctor_id:+c.window_var.person_id_for_seg,referral_name:n,is_lab_referral:!0},v=await $e.ReArchAPI(c.token,c.envName).post(ae.GET_REFERRAL,{...a}),{data:w}=v||{};return Promise.resolve(w)}catch(a){return console.log(a),Promise.reject(a)}},Nn=async(n,d,c,a,v)=>{try{const w=await $e.ReArchAPI(v.token,v.envName).delete(`${ae.DELETE_TRANSACTION}/${n}/${d}?org_branch_id=${v.window_var.org_branch_id_for_seg}&patient_role_id=${a}&order_id=${c}&deleting_person_role_id=${v.window_var.doctor_role_id_for_seg}&doctor_role_id=${v.window_var.doctor_role_id_for_seg}&doctor_id=${v.window_var.person_id_for_seg}`),{data:l}=w||{};return Promise.resolve(l)}catch(w){return console.log(w),Promise.reject(w)}},wl=async(n,d,c,a)=>{try{let v="";c.forEach((A,S)=>{v="fields="+A+(S<c.length-1?"&":"")});const w=await $e.ReArchAPI(a.token,a.envName).get(`${ae.GET_BILLS_PAYMENTS_BILL_ID}/${n}?branch_id=${a.window_var.org_branch_id_for_seg}&patient_role_id=${d}&${v}`),{data:l}=w||{};return Promise.resolve(l)}catch(v){return console.log(v),Promise.reject(v)}},ql=async(n,d,c)=>{const a={patient_role_id:n,patient_id:d,branch_id:c.window_var.org_branch_id_for_seg};try{const v=await $e.ReArchAPI(c.token,c.envName).post(ae.GET_ABHA_INFO,a),{data:w}=v||{};return Promise.resolve(w)}catch(v){return console.log(v),Promise.reject(v)}},An=async(n,d)=>{const c={scope:n?.includes("@")?"abha_address":"abha_number",AbhaAddress:n,branch_id:d.window_var.org_branch_id_for_seg};try{const a=await $e.ReArchAPI(d.token,d.envName).post(ae.GENERATE_OTP_BY_ABHA_ADDRESS,c),{data:v}=a||{};return Promise.resolve(v)}catch(a){return console.log(a),Promise.reject(a)}},Dn=async(n,d,c,a,v)=>{const w={abha_address:n,otp:d,patient_role_id:c,patient_id:a,branch_id:v.window_var.org_branch_id_for_seg};try{const l=await $e.ReArchAPI(v.token,v.envName).post(ae.VERIFY_ABHA_OTP,w),{data:A}=l||{};return Promise.resolve(A)}catch(l){return console.log(l),Promise.reject(l)}},Tn=async(n,d)=>{const c={abha_address:n,doctor_name:d.window_var.doc_name_for_seg,branch_name:d.window_var.current_branch_name||"",doctor_role_id:d.window_var.doctor_role_id_for_seg,description:"Auto initiated",branch_id:d.window_var.org_branch_id_for_seg};try{const a=await $e.ReArchAPI(d.token,d.envName).post(ae.GET_ABHA_CONSENT,c),{data:v}=a||{};return Promise.resolve(v)}catch(a){return console.log(a),Promise.reject(a)}},In=async(n,d)=>{try{const c=await $e.ReArchAPI(d.token,d.envName).get(`${ae.GET_INSURANCE_LIST}/${n}`),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},Bn=async n=>{try{const d={doctor_id:n.window_var.person_id_for_seg},c=await $e.ReArchAPI(n.token,n.envName).post(ae.GET_CUSTOM_TRANSLATIONS,{...d}),{data:a,status:v}=c||{};if(v!==200)throw new Error("error");return Promise.resolve(a)}catch(d){return console.log(d),Promise.reject(d)}},Gn=async(n,d)=>{try{const c={branch_id:d.window_var.org_branch_id_for_seg,doctor_id:d.window_var.person_id_for_seg,...n},a=await $e.ReArchAPI(d.token,d.envName).post(ae.VERIFY_INSURANCE,{...c});return Promise.resolve(a)}catch(c){return Promise.resolve(c)}},Fn=async n=>{try{const d={org_branch_id:n.window_var.org_branch_id_for_seg,doctor_id:n.window_var.person_id_for_seg,doctor_role_id:n.window_var.doctor_role_id_for_seg,master_tests_needed:!1},c=await $e.ReArchAPI(n.token,n.envName).post(ae.GET_ONLINE_TEST_RANGES,{...d}),{data:a,status:v}=c||{};if(v!==200)throw new Error("error");return Promise.resolve(a)}catch(d){return console.log(d),Promise.reject(d)}},Fl=async(n,d,c)=>{try{const a=await $e.ReArchAPI(c.enc_token,c.envName).post(ae.UPDATE_WALLET,{...d,emr_entity_id:n,branch_id:c.window_var.org_branch_id_for_seg,entity_type:"PATIENT_BRANCH"}),{data:v}=a||{};if(v?.status)return Promise.resolve(v)}catch(a){return console.log(a),Promise.reject(a)}},Cl=async(n,d)=>{try{const c=d.window_var.org_branch_id_for_seg;if(!n||!c)throw new Error("Patient ID or Branch ID is missing.");const a=await $e.ReArchAPI(d.enc_token,d.envName).get(`${ae.UPDATE_WALLET}/balance?emr_entity_id=${n}&entity_type=PATIENT_BRANCH&branch_id=${c}`),{data:v}=a;if(v?.status)return Promise.resolve(v);throw new Error(v?.message||"API returned a non-successful status for wallet balance.")}catch(c){console.error("Failed to get wallet balance:",c)}},_l=async(n,d=1,c=10,a)=>{try{const v=await $e.ReArchAPI(a.enc_token,a.envName).get(`${ae.UPDATE_WALLET}/transaction?emr_entity_id=${n}&branch_id=${a.window_var.org_branch_id_for_seg}&page_no=${d}&page_size=${c}&entity_type=PATIENT_BRANCH`),{data:w}=v||{};return Promise.resolve(w)}catch(v){return console.log(v),Promise.reject(v)}},Mn=async(n,d,c,a)=>{try{const v={mode:Number(d),transaction_type:c},w=await $e.ReArchAPI(a.token,a.envName).patch(`${ae.GET_PAYMENT}/${n}`,v),{data:l}=w||{};return Promise.resolve(l)}catch(v){return console.log(v),Promise.reject(v)}};var Ts={exports:{}},Hn=Ts.exports,Ml;function Ln(){return Ml||(Ml=1,function(n,d){(function(c,a){n.exports=a()})(Hn,function(){var c={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},a=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,v=/\d/,w=/\d\d/,l=/\d\d?/,A=/\d*[^-_:/,()\s\d]+/,S={},p=function(N){return(N=+N)+(N>68?1900:2e3)},k=function(N){return function(P){this[N]=+P}},x=[/[+-]\d\d:?(\d\d)?|Z/,function(N){(this.zone||(this.zone={})).offset=function(P){if(!P||P==="Z")return 0;var T=P.match(/([+-]|\d\d)/g),j=60*T[1]+(+T[2]||0);return j===0?0:T[0]==="+"?-j:j}(N)}],L=function(N){var P=S[N];return P&&(P.indexOf?P:P.s.concat(P.f))},V=function(N,P){var T,j=S.meridiem;if(j){for(var Q=1;Q<=24;Q+=1)if(N.indexOf(j(Q,0,P))>-1){T=Q>12;break}}else T=N===(P?"pm":"PM");return T},O={A:[A,function(N){this.afternoon=V(N,!1)}],a:[A,function(N){this.afternoon=V(N,!0)}],Q:[v,function(N){this.month=3*(N-1)+1}],S:[v,function(N){this.milliseconds=100*+N}],SS:[w,function(N){this.milliseconds=10*+N}],SSS:[/\d{3}/,function(N){this.milliseconds=+N}],s:[l,k("seconds")],ss:[l,k("seconds")],m:[l,k("minutes")],mm:[l,k("minutes")],H:[l,k("hours")],h:[l,k("hours")],HH:[l,k("hours")],hh:[l,k("hours")],D:[l,k("day")],DD:[w,k("day")],Do:[A,function(N){var P=S.ordinal,T=N.match(/\d+/);if(this.day=T[0],P)for(var j=1;j<=31;j+=1)P(j).replace(/\[|\]/g,"")===N&&(this.day=j)}],w:[l,k("week")],ww:[w,k("week")],M:[l,k("month")],MM:[w,k("month")],MMM:[A,function(N){var P=L("months"),T=(L("monthsShort")||P.map(function(j){return j.slice(0,3)})).indexOf(N)+1;if(T<1)throw new Error;this.month=T%12||T}],MMMM:[A,function(N){var P=L("months").indexOf(N)+1;if(P<1)throw new Error;this.month=P%12||P}],Y:[/[+-]?\d+/,k("year")],YY:[w,function(N){this.year=p(N)}],YYYY:[/\d{4}/,k("year")],Z:x,ZZ:x};function D(N){var P,T;P=N,T=S&&S.formats;for(var j=(N=P.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(le,W,me){var je=me&&me.toUpperCase();return W||T[me]||c[me]||T[je].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(ye,et,pe){return et||pe.slice(1)})})).match(a),Q=j.length,I=0;I<Q;I+=1){var H=j[I],z=O[H],J=z&&z[0],Y=z&&z[1];j[I]=Y?{regex:J,parser:Y}:H.replace(/^\[|\]$/g,"")}return function(le){for(var W={},me=0,je=0;me<Q;me+=1){var ye=j[me];if(typeof ye=="string")je+=ye.length;else{var et=ye.regex,pe=ye.parser,$=le.slice(je),ue=et.exec($)[0];pe.call(W,ue),le=le.replace(ue,"")}}return function(M){var Ae=M.afternoon;if(Ae!==void 0){var Fe=M.hours;Ae?Fe<12&&(M.hours+=12):Fe===12&&(M.hours=0),delete M.afternoon}}(W),W}}return function(N,P,T){T.p.customParseFormat=!0,N&&N.parseTwoDigitYear&&(p=N.parseTwoDigitYear);var j=P.prototype,Q=j.parse;j.parse=function(I){var H=I.date,z=I.utc,J=I.args;this.$u=z;var Y=J[1];if(typeof Y=="string"){var le=J[2]===!0,W=J[3]===!0,me=le||W,je=J[2];W&&(je=J[2]),S=this.$locale(),!le&&je&&(S=T.Ls[je]),this.$d=function($,ue,M,Ae){try{if(["x","X"].indexOf(ue)>-1)return new Date((ue==="X"?1e3:1)*$);var Fe=D(ue)($),He=Fe.year,mt=Fe.month,pt=Fe.day,nt=Fe.hours,Oe=Fe.minutes,at=Fe.seconds,Pt=Fe.milliseconds,xt=Fe.zone,Nt=Fe.week,Bt=new Date,B=pt||(He||mt?1:Bt.getDate()),De=He||Bt.getFullYear(),qe=0;He&&!mt||(qe=mt>0?mt-1:Bt.getMonth());var re,X=nt||0,Z=Oe||0,ie=at||0,Ie=Pt||0;return xt?new Date(Date.UTC(De,qe,B,X,Z,ie,Ie+60*xt.offset*1e3)):M?new Date(Date.UTC(De,qe,B,X,Z,ie,Ie)):(re=new Date(De,qe,B,X,Z,ie,Ie),Nt&&(re=Ae(re).week(Nt).toDate()),re)}catch{return new Date("")}}(H,Y,z,T),this.init(),je&&je!==!0&&(this.$L=this.locale(je).$L),me&&H!=this.format(Y)&&(this.$d=new Date("")),S={}}else if(Y instanceof Array)for(var ye=Y.length,et=1;et<=ye;et+=1){J[1]=Y[et-1];var pe=T.apply(this,J);if(pe.isValid()){this.$d=pe.$d,this.$L=pe.$L,this.init();break}et===ye&&(this.$d=new Date(""))}else Q.call(this,I)}}})}(Ts)),Ts.exports}var kn=Ln();const Vn=e.getDefaultExportFromCjs(kn);Te.dayjs.extend(Vn);const Ul=(...n)=>{let d=!1;try{const c=/^[a-zA-Z]+$/;for(const a of n){const v=a.toString();if(v.includes(".")||v.includes("-")||c.test(v)){d=!0;break}}}catch{return!1}return d},Zl=async(n,d=!0,c,a,v,w,l,A=!1,S)=>{let p={appnt_id:0,error:"",order_id:"",order_item_id:"",appnt_create_status:!1,appnt_create_message:"",bill_create_status:!1,bill_create_message:""};const k=n.appnt_time_time+" "+n.appnt_time_format;try{if(!n.appnt_doctor_role_id){c("Error","Doctor name is missing","Error",3e3);return}if(!new RegExp(/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/).test(k)){c("Error","Error in time format","Error",3e3);return}if(!n.appnt_service_id){c("Error","Service name is missing","Error",3e3);return}const{item_quantity:L,order_unit_item_price:V,order_item_discount:O,order_item_service_tax:D,order_item_service_tax_percentage:N=0,order_item_price:P}=n;if(!d&&Ul(L,V,O,D,P)){c("Error","Value cannot be in decimal or in negative form","Error",3e3);return}if(n={...n,order_item_service_tax:Math.floor(V*L*.01*N),appnt_time:Te.dayjs(k,"hh:mm A").format("HH:mm:ss")},n.appnt_id.length)try{const T=await hn(n,d,a?.name,v.patientRoleID,S),j=T.appnt_update_status?"Success":"Error";if(T.appnt_update_message&&(p=T),c(j,T.appnt_update_message,j,3e3),A){const Q=T.bill_update_status?"Success":"Error";c(Q,T.bill_update_message,Q,3e3)}}catch(T){console.error("Error while create/update appointnment",T),c("Error",T.data.message,"Error",3e3)}else{const T=await pn(n,d,a.name,a.phone_number,v.patientRoleID,l,S),j=T.appnt_create_status?"Success":"Error";if(T.appnt_create_status&&(p=T),c(j,T.appnt_create_message,j,3e3),A){const Q=T.bill_create_status?"Success":"Error";c(Q,T.bill_create_message,Q,3e3)}}return p}catch{c("Error","Something went wrong while creating/updating appointment","Error",3e3)}},El=async(n,d,c,a,v,w=Et[0],l)=>{let A={};try{if(w===Et[0]&&!n.appnt_doctor_role_id){d("Error","Doctor name is missing","Error",3e3);return}if(w===Et[0]){const D=n.appnt_time_time+" "+n.appnt_time_format;if(!new RegExp(/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/).test(D)){d("Error","Error in time format","Error",3e3);return}}const{item_quantity:S,order_unit_item_price:p,order_item_service_tax_percentage:k=0,order_item_discount:x,order_item_service_tax:L,order_item_price:V}=n;if(Ul(S,p,x,L,V)){d("Error","Value cannot be in decimal or in negative form","Error",3e3);return}n={...n,order_item_service_tax:Math.floor(p*S*.01*k)};try{if(n?.order_item_id?.length){const D=await dn(n,c,l);d(D.status?"Success":"Error",D.message,D.status?"Success":"Error",3e3),D.status&&(A=D)}else{const D=await cn(n,c,a,l);d(D.status?"Success":"Error",D.message,D.status?"Success":"Error",3e3),D.status&&(A=D)}}catch(D){console.error("Error while create/update bill",D)}return A}catch{console.log("error in handleCreateUpdateBill API Call"),d("Error","Something went wrong while create update bill","Error",3e3)}},Kl=async(n,d,c)=>{try{const a=await wl(n,d,["payments"],c),v=Array.isArray(a?.payments)?a.payments:[],w=[...new Set(v.map(l=>ur[l.mode]).filter(l=>typeof l=="string"))];return{lab_owner_name:a?.lab_owner_name??"",paymentModes:w}}catch(a){return console.error("Error in fetching payment modes from bill id:",a),null}},On=async(n,d,c)=>{const a={lab_owner_name:"",paymentsData:new Map([])},v=n.map(l=>wl(l,d,["payments"],c));return(await Promise.all(v)).forEach(l=>{l.service_category_id==3&&(a.lab_owner_name=l.lab_owner_name),Array.isArray(l.payments)&&l.payments.length>0?a.paymentsData.set(l.service_category_id,l.payments.map(A=>A?.mode)):a.paymentsData.set(l.service_category_id,[])}),a},$l=(n="")=>{switch(n){case"0":return"male";case"1":return"female";case"2":return"others";default:return""}},Wn={vitals:"vitals",investigationtable:"Investigations",complaints:"Complaints",diagnosis:"Diagnosis",presc:"RxComponent",nextvisit:"FollowUpVisit",referred:"referTo",dietEX:"Diet",tests:"TestsRequested",quicknotes:"QuickNotes",advice:"Advice",systemic:"SystemicExaminations",pickle:"GeneralExaminations",assessment:"Assessment",glassPrescription:"",pediatrics:"",jointExamination:"",customField:"",customField2:"",customField3:"",patienthistory:"PatientHistory",pastMedication:"pastMedication",menstrualInfo:"menstrualInfo",physicalExamination:"physicalExamination",obstetricHistory:"obstetricHistory",labTestImaging:"labTestImaging",drawingBoard:"drawing_board"},Hl=(n,d)=>{let c={};try{c=JSON.parse(d)}catch(w){return console.error("Failed to parse visit_pad_json:",w),[]}const a=Array.isArray(n)?n:n.split(","),v=[];return a.forEach(w=>{let l="";switch(w){case"nextvisit":l="use_next_visit";break;case"referred":l="use_doc_referral";break;case"dietEX":l="use_dietEx";break;case"tests":l="use_test_prescribed";break;case"assesment":l="use_assessment";break;case"quicknotes":l="use_quick_notes";break;case"presc":l="use_print_prescription_method";break;case"systemic":l="use_systemic_exam";break;case"customField":l="use_custom_field";break;case"customField2":l="use_custom_field2";break;case"customField3":l="use_custom_field3";break;case"customField4":l="use_custom_field4";break;case"customField5":l="use_custom_field5";break;case"customField6":l="use_custom_field6";break;case"investigationtable":l="use_investigation_table";break;case"patienthistory":l="patient_history_include";break;case"menstrualInfo":l="use_menstrual_info";break;case"physicalExamination":l="use_physical_examination";break;case"obstetricHistory":l="obstetric_history_include";break;case"labTestImaging":l="use_lab_test_imaging";break;case"vitals":l="use_vitals";break;case"pastMedication":l="use_past_medication";break;case"drawing_board":l="drawing_board";break;default:l="use_"+w}const A=c?.[l];A&&(w==="presc"||A?.include==="1")&&(w==="obstetricHistory"&&c?.obhGpla?.include==="0"&&c?.obhPregnancyHistory?.include==="0"||v.push(w))}),v.map(w=>Wn[w]||w)},zn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M7.6665%206.00004C8.95517%206.00004%209.99984%204.95537%209.99984%203.66671C9.99984%202.37804%208.95517%201.33337%207.6665%201.33337C6.37784%201.33337%205.33317%202.37804%205.33317%203.66671C5.33317%204.95537%206.37784%206.00004%207.6665%206.00004Z'%20fill='%23039855'/%3e%3cpath%20d='M4.65017%205.75205C4.49106%205.52233%204.4115%205.40747%204.32581%205.36953C4.24888%205.33547%204.1679%205.3313%204.08788%205.35729C3.99875%205.38624%203.92865%205.46803%203.78845%205.6316C3.22585%206.28801%202.84213%207.10277%202.71374%208.00016H2.6665C2.29831%208.00016%201.99984%207.70168%201.99984%207.33349C1.99984%207.08757%202.13265%206.87188%202.33365%206.75561C2.65236%206.57125%202.76127%206.16343%202.57691%205.84472C2.39255%205.52601%201.98473%205.4171%201.66602%205.60147C1.06996%205.94627%200.666504%206.59237%200.666504%207.33349C0.666504%208.43806%201.56193%209.33349%202.6665%209.33349H2.71377C2.85774%2010.339%203.32239%2011.2416%203.9998%2011.9329L3.99979%2013.4823C3.99976%2013.5617%203.99973%2013.6565%204.00655%2013.7401C4.01446%2013.8369%204.03476%2013.9756%204.10879%2014.1209C4.20466%2014.309%204.35764%2014.462%204.54581%2014.5579C4.6911%2014.6319%204.82976%2014.6522%204.92658%2014.6601C5.0101%2014.6669%205.10492%2014.6669%205.18432%2014.6669H6.4819C6.56129%2014.6669%206.65616%2014.6669%206.73968%2014.6601C6.8365%2014.6522%206.97516%2014.6319%207.12045%2014.5579C7.30862%2014.462%207.4616%2014.309%207.55747%2014.1209C7.6315%2013.9756%207.6518%2013.8369%207.65971%2013.7401C7.66653%2013.6565%207.6665%2013.5617%207.66647%2013.4823L7.66646%2013.3335H8.33314L8.33313%2013.482C8.3331%2013.5615%208.33307%2013.6563%208.33989%2013.7398C8.3478%2013.8366%208.3681%2013.9753%208.44213%2014.1206C8.538%2014.3088%208.69099%2014.4618%208.87915%2014.5576C9.02444%2014.6317%209.16311%2014.652%209.25992%2014.6599C9.34344%2014.6667%209.43824%2014.6667%209.51764%2014.6666H10.8153C10.8947%2014.6667%2010.9896%2014.6667%2011.0731%2014.6599C11.1699%2014.652%2011.3085%2014.6317%2011.4538%2014.5576C11.642%2014.4618%2011.795%2014.3088%2011.8909%2014.1206C11.9649%2013.9753%2011.9852%2013.8366%2011.9931%2013.7398C11.9999%2013.6563%2011.9999%2013.5615%2011.9999%2013.482L11.9999%2012.884C12.7373%2012.5338%2013.3676%2011.9963%2013.83%2011.3333L14.1486%2011.3333C14.228%2011.3333%2014.3229%2011.3334%2014.4064%2011.3265C14.5032%2011.3186%2014.6419%2011.2983%2014.7872%2011.2243C14.9753%2011.1284%2015.1283%2010.9754%2015.2242%2010.7873C15.2982%2010.642%2015.3185%2010.5033%2015.3264%2010.4065C15.3333%2010.323%2015.3332%2010.2282%2015.3332%2010.1488V7.84245C15.3332%207.76683%2015.3333%207.67651%2015.327%207.59685C15.3199%207.50472%2015.3015%207.37257%2015.2341%207.23269C15.1358%207.02862%2014.9712%206.86396%2014.7671%206.76567C14.6272%206.6983%2014.4951%206.67993%2014.403%206.67276C14.3435%206.66813%2014.2781%206.66697%2014.2173%206.66669C13.9935%206.19554%2013.6934%205.76825%2013.3332%205.40063L13.3332%204.68824C13.3332%204.58502%2013.3333%204.46819%2013.3243%204.36769C13.3144%204.25673%2013.2886%204.08518%2013.1832%203.91515C13.0519%203.70315%2012.846%203.54789%2012.6061%203.47982C12.4137%203.42523%2012.2416%203.44753%2012.1322%203.4685C12.0331%203.48749%2011.9208%203.51963%2011.8216%203.54801L11.7177%203.57769C11.581%203.61674%2011.5127%203.63626%2011.4646%203.67145C11.4182%203.70542%2011.3899%203.73891%2011.364%203.79026C11.3371%203.84344%2011.3279%203.92456%2011.3094%204.08678C11.101%205.91399%209.54949%207.33337%207.6665%207.33337C6.41617%207.33337%205.31201%206.70755%204.65017%205.75205Z'%20fill='%23039855'/%3e%3c/svg%3e",Yn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cg%20clip-path='url(%23clip0_3744_11287)'%3e%3cpath%20d='M7.99984%200.666626C3.94975%200.666626%200.666504%203.94987%200.666504%207.99996C0.666504%2012.05%203.94975%2015.3333%207.99984%2015.3333C8.47083%2015.3333%208.93145%2015.2889%209.37774%2015.204C8.53209%2014.4484%207.99976%2013.3495%207.99976%2012.1262C7.99976%2012.0103%208.00454%2011.8954%208.01391%2011.7819L5.24834%209.5192C5.2413%209.51353%205.23438%209.50771%205.22758%209.50175C5.15845%209.44136%205.10469%209.36959%205.06681%209.29153C5.02391%209.20345%204.99984%209.10452%204.99984%208.99996L4.99984%208.99919C4.99985%208.97688%205.00098%208.95454%205.00323%208.93228C5.01844%208.7814%205.08397%208.64537%205.18277%208.54122C5.23645%208.48449%205.29814%208.43911%205.36462%208.4054C5.45526%208.35929%205.55791%208.33329%205.66657%208.33329H6.6665C7.21472%208.33329%207.58295%208.12528%207.82444%207.84003C7.94632%207.69607%208.04285%207.52355%208.11027%207.33329H5.6665C5.29831%207.33329%204.99984%207.03482%204.99984%206.66663C4.99984%206.29844%205.29831%205.99996%205.6665%205.99996H8.11027C8.04285%205.8097%207.94632%205.63718%207.82444%205.49322C7.58295%205.20797%207.21472%204.99996%206.6665%204.99996H5.6665C5.29831%204.99996%204.99984%204.70148%204.99984%204.33329C4.99984%203.9651%205.29831%203.66663%205.6665%203.66663H10.3332C10.7014%203.66663%2010.9998%203.9651%2010.9998%204.33329C10.9998%204.70148%2010.7014%204.99996%2010.3332%204.99996H9.10602C9.29303%205.31016%209.41955%205.65102%209.48954%205.99996H10.3332C10.7014%205.99996%2010.9998%206.29844%2010.9998%206.66663C10.9998%207.03482%2010.7014%207.33329%2010.3332%207.33329H9.48954C9.39054%207.82684%209.17845%208.30422%208.84207%208.70155C8.48663%209.12139%208.00773%209.43255%207.42456%209.577L8.39182%2010.3684C9.05188%208.96864%2010.4758%207.99996%2012.126%207.99996C13.3493%207.99996%2014.4483%208.53232%2015.2039%209.37801C15.2888%208.93167%2015.3332%208.471%2015.3332%207.99996C15.3332%203.94987%2012.0499%200.666626%207.99984%200.666626Z'%20fill='%23DC6803'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.126%208.91891C10.3547%208.91891%208.91878%2010.3548%208.91878%2012.1261C8.91878%2013.8974%2010.3547%2015.3333%2012.126%2015.3333C13.8973%2015.3333%2015.3332%2013.8974%2015.3332%2012.1261C15.3332%2010.3548%2013.8973%208.91891%2012.126%208.91891ZM12.126%209.57157C12.4082%209.57157%2012.6369%209.80032%2012.6369%2010.0825V11.6152H14.1697C14.4518%2011.6152%2014.6806%2011.844%2014.6806%2012.1262C14.6806%2012.4083%2014.4518%2012.6371%2014.1697%2012.6371H12.6369V14.1698C12.6369%2014.452%2012.4082%2014.6807%2012.126%2014.6807C11.8438%2014.6807%2011.6151%2014.452%2011.6151%2014.1698V12.6371H10.0823C9.80016%2012.6371%209.57141%2012.4083%209.57141%2012.1262C9.57141%2011.844%209.80016%2011.6152%2010.0823%2011.6152H11.6151V10.0825C11.6151%209.80032%2011.8438%209.57157%2012.126%209.57157Z'%20fill='%23DC6803'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_3744_11287'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",pr=(n="")=>{const d=new Date(n),a=Math.abs(new Date().getTime()-d.getTime()),v=Math.ceil(a/(1e3*60*60*24));return v<=7?`${v-1}d`:v<=30?`${Math.floor(v/7)}w`:v<=365?`${Math.floor(v/30)}m`:`${Math.floor(v/365)}y`},nr=n=>n?n.toLowerCase().replace(/\b\w/g,d=>d.toUpperCase()):"",Xl=n=>{switch(n){case"DEPOSIT":return zn;case"REFUND":return Yn;default:return""}},qn=n=>{const{handleCurrentWindow:d,setShowPatientPopModal:c,patientIDs:a,redirectionPage:v,closePrintModal:w}=n,l=y.useContext(Tt);if(!l)throw new Error("PatientPopupHeader must be used within an AppContext.Provider");const{currentWindow:A,patientDetails:S,docPreference:p,billPreferences:k,setLastBillPaymentData:x,variable:L}=l,{name:V,age:O,gender:D,image_link:N,org_person_bid_str:P,org_person_dob:T,honorific:j}=S||{};window.patientPopupClosehandler=()=>{if(c(!1),w(),x({created_on:"",category_name:""}),window.location.pathname.indexOf("/frontdesk/")!==-1){const I=document.getElementById("appointmentRefreshBtn");I&&I.click()}};const Q=()=>{v==="appointments"?typeof window.redirectVPFromAppnt=="function"&&window.redirectVPFromAppnt(a?.patientRoleID||"",a?.patientID||""):v==="consultations"?typeof window.redirectVPFromConsult=="function"&&window.redirectVPFromConsult(a?.patientRoleID||"",a?.patientID||""):v==="addpatient"||v==="frontDeskDashboard"?window.location.href=`${window.origin}${Wt.EAPP_ROUTES.visitpad}?pid=${a?.patientRoleID}`:window.location.href=`${window.origin}${Wt.EAPP_ROUTES.visitpad}?pid=${a?.patientRoleID}`,c(!1),w()};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[56px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-rounded-t-xl hfl-bg-Blue_gray-600 hfl-py-1 hfl-pl-[11px] hfl-pr-1.5",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-[13px]",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 hfl-px-2 hfl-py-0.5",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-8 hfl-w-8 hfl-flex-col hfl-items-center hfl-justify-center hfl-rounded hfl-bg-White_20",children:e.jsxRuntimeExports.jsx(e.ep,{url:N,name:"",placeholder:!1,text:!1,size:"Text sm",shape:"hplxt-rounded"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-text-White_20",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Bold",type:"Text sm",className:"hfl-text-2 hfl-font-inter-2 hfl-capitalize hfl-leading-10","data-qa":"patient-name",children:[j?`${j}. `:"",V]}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text lg",className:"hfl-flex hfl-items-center hfl-gap-2 hfl-text-1 hfl-capitalize",children:[$l(D)||e.jsxRuntimeExports.jsx("div",{className:"hfl-top-1 hfl-h-3 hfl-w-10 hfl-rounded-3xl hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),O?typeof O=="number"?`${O} Years`:pr(`${O}`):T&&pr(T)||e.jsxRuntimeExports.jsx("div",{className:"hfl-h-3 hfl-w-12 hfl-rounded-3xl hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),P||e.jsxRuntimeExports.jsx("div",{className:"hfl-top-1 hfl-h-3 hfl-w-10 hfl-rounded-3xl hfl-bg-Gray-100"})]})]})]}),L.window_var.role_id==="11"&&e.jsxRuntimeExports.jsx(e.Ku,{onClick:Q,hierarchy:"Primary",size:"md",textField:"Visit Pad",className:"hfl-rounded-md hfl-bg-Warning-50 hfl-p-2.5 hfl-text-Warning-500 hfl-shadow-md hover:hfl-bg-Warning-100","data-qa":"visit-pad"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(br,{disabled:!1,src:ml,onClickHandler:()=>d(Rt[8]),label:"Abha",isRequired:p?.abha?.link_patient_rx??!1,isSelected:A===Rt[8],data_qa:"abha-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[1]?"hx_patient-calendar-filled":"hx_patient-calendar",onClickHandler:()=>d(Rt[1]),label:"Appnt",isRequired:!0,isSelected:A===Rt[1],data_qa:"appoint-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[2]?"hx_patient-add-bil-filled":"hx_patient-add-bil",onClickHandler:()=>{d(Rt[2])},label:"Add Bills",isRequired:!0,isSelected:A===Rt[2],data_qa:"add-bills-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[3]?"hx_patient-all-bills-filled":"hx_patient-all-bills",onClickHandler:()=>{d(Rt[3])},label:"Bills",isRequired:!0,isSelected:A===Rt[3],data_qa:"bill-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[4]?"hx_patient-payments-filled":"hx_patient-payments",onClickHandler:()=>{d(Rt[4])},label:"Payments",isRequired:!0,isSelected:A===Rt[4],data_qa:"payments-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[5]?"hx_patient-visits-filled":"hx_patient-visits",onClickHandler:()=>{d(Rt[5])},label:"Visits",isRequired:!0,isSelected:A===Rt[5],data_qa:"visits-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[6]?"hx_patient-lab-filled":"hx_patient-lab",onClickHandler:()=>d(Rt[6]),label:"Lab",isRequired:L.window_var.permit_lab_tech==="1"||k?.features?.enable_lis_v1===!0,isSelected:A===Rt[6],data_qa:"lab-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[8]?"hx_patient-user-filled":"hx_patient-user",onClickHandler:()=>d(Rt[8]),label:"Profile",isRequired:!0,isSelected:A===Rt[8],data_qa:"profile-tab"}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-cursor-pointer hfl-text-5 hfl-text-White_20",onClick:()=>window.patientPopupClosehandler?.(),"data-qa":"patient-popup-close"})]})]})},Un=()=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[900px] hfl-flex-col hfl-p-3 ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsx("div",{className:" hfl-flex",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:"Select Message Template"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-pr-2",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"lg",icon:"Left",iconFile:"hx_chat-filled hfl-text-Primary-500",textField:"Select SMS Template",className:"hfl-justify-center"})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"lg",icon:"Left",iconFile:"hx_whatsapp-filled hfl-text-Success-500",textField:"Select Whatsapp Template",className:"hfl-justify-center"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"flex hfl-top-0 hfl-pt-3 ",children:e.jsxRuntimeExports.jsx(e.Oh,{className:"hfl-bg-Gray-200",rows:10,suffixPlaceholder:"Load Message Template from right"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-end hfl-pt-[160px] ",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Send Message"})})]}),Zn=n=>{const{patientAbhaDetails:d,savePatientDetailsHandler:c,setPatientAbhaDetails:a,patientData:v}=n,{showToast:w,patientIDs:l,variable:A}=y.useContext(Tt)||{},[S,p]=y.useState(""),[k,x]=y.useState(""),[L,V]=y.useState(),O=async(D=!1)=>{try{if(L?.status&&!D){const N=await Dn(L.abha_address,k,l?.patientRoleID||"",l?.patientID||"",A);if(N.status){const P=await ql(l?.patientRoleID||"",l?.patientID||"",A);a(P),Tn(L.abha_address,A);const T=N.PatientDetails[0].yearOfBirth?v?.org_person_dob.replace(v.org_person_dob.split("-")[0],N.PatientDetails[0].yearOfBirth):v?.org_person_dob;c(N.PatientDetails[0].name,T||"")}else w("Error",N.error,"Error",3e3)}else{const N=await An(S,A);V(N),N.status||w("Error",N.error,"Error",3e3)}}catch(N){console.error("Error while generating OTP",N)}};return d?.patient_details_mongo?.length?e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-[40px] hfl-flex hfl-items-center hfl-justify-between hfl-rounded-lg hfl-bg-Purple-25 hfl-px-3 hfl-py-2 hfl-shadow-lg",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Medium",type:"Text lg",className:"hfl-flex hfl-items-center hfl-gap-3 hfl-text-1 hfl-text-Rose-600",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-h-8 hfl-w-8",src:ml,alt:"profile-tab"}),d.patient_details_mongo[0].abha_address,e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[31px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",className:"hfl-flex hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Blue_gray-700",children:d.patient_details_mongo[0].abha_number})]})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Success-600",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_verified-filled hfl-text-4"}),"Verified by ABHA"]})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-[40px] hfl-flex hfl-h-[72px] hfl-flex-shrink-0 hfl-items-start hfl-gap-[9px] hfl-rounded-lg hfl-bg-Blue_gray-50 hfl-px-[13px] hfl-py-2 hfl-shadow-xs",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-h-8 hfl-w-8",src:ml,alt:"profile-tab"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-gap-1",children:[e.jsxRuntimeExports.jsx(e.Pi,{inputProps:{value:S,onChange:D=>{p(D.target.value)},placeholder:"Enter ABHA Address/ ABHA Number"},className:"",width:"400px",height:"32px"}),L?.status&&e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Gray-400",children:["OTP sent",e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Primary-600",onClick:async()=>{await O(!0)},children:[e.jsxRuntimeExports.jsx("div",{className:"hx_rewind hfl-font-bold hfl-text-3"}),"Resend OTP"]})]})]}),L?.status&&e.jsxRuntimeExports.jsx(e.Pi,{inputProps:{value:k,onChange:D=>{x(D.target.value)},placeholder:"Enter OTP"},className:"",width:"128px",height:"32px"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",className:"hfl-h-[32px]",size:"sm",textField:L?.status?"Submit OTP":"Verify ABHA",onClick:async()=>{await O()}})]})},Kn=y.forwardRef(n=>{const{patientData:d={},setPatientData:c,preferences:a,referredByDocList:v,throughChannelList:w,showImageFromLink:l,validators:A,setValidators:S,billPreferences:p,isAbhaVerified:k,isPartnerServiceEnabled:x,insuranceData:L,partnerConfig:V,verifyInsuranceHandler:O,policyNumberErrorMessage:D,selectedInsuranceDetails:N,setSelectedInsuranceDetails:P,insuranceDivRef:T,patientCustomFieldData:j}=n,[Q,I]=y.useState(!1),[H,z]=y.useState([]),[J,Y]=y.useState([]),[le,W]=y.useState(!1),[me,je]=y.useState(!1),[ye,et]=y.useState([]),pe=p?.permissions?.edit_patient_name,{phone_number:$,age:ue,org_person_dob:M,gender:Ae,honorific:Fe,name:He,patient_preferred_language:mt,blood_group:pt,spouse_name:nt,marital_status:Oe,married_since:at,spouse_blood_group:Pt,org_person_bid_str:xt,ref_doc_name:Nt,ref_doc_spec:Bt,email:B,phone_secondary:De,pincode:qe,address:re,through_channel:X,care_of:Z,tag:ie,image_link:Ie,aadhar_number:Ee}=d,[ht,Jt]=y.useState(Ae),[vt,zt]=y.useState("Years"),[Gt,er]=y.useState(""),[tr,lr]=y.useState(!1),[hr,ar]=y.useState([]),cr=y.useRef(),yt=(G,ve)=>{c(jt=>({...jt,[G]:ve})),G=="gender"&&ve==""?S(jt=>({...jt,gender:"Select Gender"})):S(jt=>({...jt,gender:""}))};y.useEffect(()=>{Fe&&er(Fe)},[Fe]),y.useEffect(()=>{Ie&&l(Ie)},[Ie]);const rr=G=>{const{value:ve}=G.target,jt=_t(ve);z(jt)},dr=G=>{yt("occupation",G.trim()),W(!1)},mr=G=>{yt("city",G.trim()),je(!1)},ir=G=>{const{value:ve}=G.target,jt=ut(ve);Y(jt)},xr=G=>{const{value:ve}=G.target,jt=ct(ve);et(jt)},ut=G=>{if(Wt.OccupationList?.length){let ve=Wt.OccupationList;return G?.length&&(ve=Wt.OccupationList.filter(jt=>jt.toLowerCase().includes(G.toLowerCase()))),ve}else return[]},_t=G=>{if(w?.length){let ve=w;return G?.length&&(ve=w.filter(jt=>jt.title.toLowerCase().includes(G.toLowerCase()))),ve}else return[]},ct=G=>{if(Wt.CityList?.length){let ve=Wt.CityList;return G?.length&&(ve=Wt.CityList.filter(jt=>jt.toLowerCase().includes(G.toLowerCase()))),ve}else return[]},Ct=(G="")=>{const ve=G?.toLowerCase();return M!==""?"":ue!==""&&Number(ue)<0&&M===""?"Invalid Age":ve==="weeks"&&ue!==""&&Number(ue)<5907||ve==="days"&&ue!==""&&Number(ue)<9999||ve==="months"&&ue!==""&&Number(ue)<1358||ve==="years"&&ue!==""&&Number(ue)<114?"":"Invalid Age"};y.useEffect(()=>{if(!M){const G=$e.calculateDOB(d.age,vt);G&&c(ve=>({...ve,org_person_dob:G}))}},[vt,d.age]);const Ht=G=>{Jt(G),yt("gender",G),S(ve=>({...ve,gender:""}))},Ft=G=>{yt("through_channel",G.value.trim()),I(!1)},Lt=G=>{cr.current&&!cr.current.contains(G.target)&&lr(!1)},Vt=(G,ve,jt)=>{c(kt=>{const Zt=kt.custom_fields?.length?kt.custom_fields.map(sr=>sr.id===G?{...sr,value:jt}:sr):[];return Zt.some(sr=>sr.id===G)||Zt.push({id:G,value:jt,title:ve}),{...kt,custom_fields:Zt}})},It=y.useCallback(()=>j?.map(G=>{const{id:ve,type:jt,title:kt}=G||{};if(!ve||!jt||!kt)return null;const Zt=d.custom_fields?.find($t=>$t.id===ve)?.value||"";switch(jt){case"text":return e.jsxRuntimeExports.jsx(e.Pi,{label:kt,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:Zt||"",placeholder:`Enter ${kt}`,onChange:$t=>{Vt(ve,kt,$t.target.value)}},width:"21em"},ve);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:kt,placeholder:`Select ${kt}`,selectDate:Zt?new Date(Zt):null,clearDate:$t=>{Vt(ve,kt,$t)},dateVar:$t=>{Vt(ve,kt,$t)},isborderRequired:!0,width:"22em",openUp:!0,backSpaceClearDate:!0},ve);default:return null}}),[j,d.custom_fields]);return y.useEffect(()=>{const G=Object.keys(V).map(ve=>{if(V[ve]?.verify_insurance?.enable)return{value:ve,label:ve}}).filter(ve=>ve);ar(G??[])},[V]),y.useEffect(()=>(document.addEventListener("mousedown",Lt),()=>{document.removeEventListener("mousedown",Lt)}),[]),e.jsxRuntimeExports.jsx("div",{id:"add-patient-modal hfl-overflow-scroll",children: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 hfl-gap-1",children:[e.jsxRuntimeExports.jsxs("div",{className:pe?"":"hfl-pointer-events-none",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:e.jsxRuntimeExports.jsxs("div",{ref:cr,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>lr(G=>!G),children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:Gt}),!Gt.length&&e.jsxRuntimeExports.jsx("div",{className:`${tr?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:!!A.name&&A.name,inputProps:{type:"text",value:He,disabled:k,placeholder:"Enter Name",onChange:G=>{yt("name",G.target.value)},onBlur:()=>{const G=!(He.length>0);He.length>0&&He.length<2?S(ve=>({...ve,name:"Enter at least 2 letters "})):S(ve=>({...ve,name:G?"Enter the Name of the Patient":""}))}},start_icon:"hx_person",width:"16em"}),tr&&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:Wt.HonorificList.map(G=>e.jsxRuntimeExports.jsx(e.ki,{className:"hfl-text-Primary-700",label:G.label,onSelect:()=>{er(G.label),lr(!1),Jt(G.gender),yt("honorific",G.label),yt("gender",G.gender),c(ve=>({...ve,gender:G.gender,patHonorific:G.label}))}}))})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Pi,{label:`Phone ${a&&a.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:!!A.phone_number&&A.phone_number,inputProps:{maxLength:10,value:$,placeholder:"Enter Number",onChange:G=>{yt("phone_number",G.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:G=!1,msg:ve=""}=a&&a.phone_number_length||$?$e.validateMobileNo($):{};S(jt=>({...jt,phone_number:G?ve:""}))}},width:"21em",start_icon:"hx_phone"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-8",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-[37px] hfl-w-44 ${A.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:ht,onChange:G=>Ht(G),disabled:!1}),!!A.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:A.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:ue==0?"":ue,input2value:vt,end_icon:"hx_down",errorMsg:!!A.age&&A.age,inputProps:{disabled:k,type:"number",min:0,maxLength:3,placeholder:"Age",onChange:G=>{yt("age",G.target.value.replace(/[^0-9]/g,"")),c(ve=>({...ve,org_person_dob:""}))},onBlur:()=>{S(G=>({...G,age:Ct(vt)}))}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{disabled:k,placeholder:"Select format"},suffixOptions:[{label:"Years",value:"years"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Days",value:"days"}],handleValChange:G=>{yt("age",G),S(ve=>({...ve,age:Ct(vt)}))},handleSuffixValChange:G=>{zt(G),S(ve=>({...ve,age:Ct(G)}))},onSuffixDropdownClick:G=>{zt(G.label),c(ve=>({...ve,age_selector:G.value,org_person_dob:""})),S(ve=>({...ve,age:Ct(G.value)}))}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"DOB",disable:k,width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:M&&$e.isValidDate(new Date(M))?new Date(Te.dayjs(new Date(M)).format("DD-MMM-YYYY")):"",dateVar:G=>{c(ve=>({...ve,org_person_dob:Te.dayjs(G).format("YYYY-MM-DD"),age:""})),S(ve=>({...ve,age:""}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:mt?Wt.DefinedLanguages[mt]:"English"},placeholder:"English",label:"Preferred Language",onChange:G=>{yt("patient_preferred_language",G.value)},options:Object.keys(Wt.DefinedLanguages).map(G=>({label:Wt.DefinedLanguages[G],value:G})),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-gap-1 hfl-pb-6 hfl-pt-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[375px] hfl-flex-col",children:[e.jsxRuntimeExports.jsx(e.Pi,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:qe,placeholder:"Enter Pin",onChange:G=>{yt("pincode",G.target.value)}},width:22.5+"em"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-2",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:d?.city,placeholder:"Enter City",onChange:G=>{yt("city",G.target.value),je(!0),xr(G)},onBlur:G=>{G.stopPropagation(),je(!1)}},width:23.5+"em"}),me&&ye&&ye.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:ye.map(G=>e.jsxRuntimeExports.jsx(e.ki,{label:G,className:"hfl-text-Primary-700",onSelect:()=>mr(G)}))})]})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-col",style:{height:"100%",flexGrow:1},children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-h-[120px] hfl-w-[368px]",label:"Address",rows:4,inputProps:{value:re,placeholder:"Enter Address",onChange:G=>{yt("address",G.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pt-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-gap-1 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:Oe&&Wt.MARITAL_STATUS.find(G=>G===Oe)||""},placeholder:"Marital Status",label:"Marital Status",onChange:G=>{yt("marital_status",G.label)},options:Wt.MARITAL_STATUS.map(G=>({label:G,value:G})),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:at&&$e.isValidDate(new Date(at))?new Date(Te.dayjs(new Date(at)).format("DD-MMM-YYYY")):"",dateVar:G=>{c(ve=>({...ve,married_since:Te.dayjs(G).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:pt&&Wt.bloodGroups.find(G=>G.value===pt)?.label||"Blood group"},onChange:G=>{yt("blood_group",G.value)},options:Wt.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),Oe!==Wt.MARITAL_STATUS[0]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pt-6",children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Spouse Name",start_icon:"hx_person",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:nt,placeholder:"Enter Spouse Name",onChange:G=>{yt("spouse_name",G.target.value)}},width:"21em"}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:Pt?Wt.bloodGroups.find(G=>G.value===Pt)?.label||"Spouse Blood group":"Blood group"},onChange:G=>{yt("spouse_blood_group",G.value)},options:Wt.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-pt-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:"Other Details"})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:e.jsxRuntimeExports.jsx(e.Pi,{label:"Existing ID (if any)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:xt,placeholder:"Enter ID",onChange:G=>{yt("org_person_bid_str",G.target.value)}},width:"23em"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pt-6",children:[e.jsxRuntimeExports.jsx(e.tj,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:Nt,input2value:Bt,end_icon:"hx_down",inputProps:{placeholder:"Doctor Name"},suffixInputProps:{placeholder:"Speciality"},className:"hfl-w-48",suffixClassName:"hfl-w-[100px]",suffixDropdownClassName:"hfl-ml-[160px]",options:v,suffixOptions:Wt.SpecialityList,handleValChange:G=>{yt("ref_doc_name",G)},handleSuffixValChange:G=>{yt("ref_doc_spec",G.value)},onDropdownClick:G=>{yt("ref_doc_name",G.doctor_name),yt("ref_doc_id",G.doctor_id),yt("refDocId",G.doctor_id),yt("ref_doc_spec",G.specialist)},onSuffixDropdownClick:G=>{yt("ref_doc_spec",G.value)}}),e.jsxRuntimeExports.jsx(e.Pi,{label:"Email",className:"",classNameParentDiv:"hfl-relative",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:!!A.email&&A.email,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:B,placeholder:"Enter Email",onChange:G=>{yt("email",G.target.value.trim())},onBlur:G=>{G.target.value&&!hl.create$6().email().isValidSync(G.target.value)?S(ve=>({...ve,email:"Email format is wrong"})):S(ve=>({...ve,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 hfl-gap-1",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:X,placeholder:"Enter Channel",onChange:G=>{yt("through_channel",G.target.value),I(!0),rr(G)},onBlur:G=>{G.stopPropagation(),I(!1)}},width:23.5+"em"}),Q&&H&&H.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:H.map(G=>{const{title:ve,...jt}=G||{};return e.jsxRuntimeExports.jsx(e.ki,{label:G.title,className:"hfl-text-Primary-700",...jt,onSelect:()=>Ft({...jt})})})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-[368px]",children:e.jsxRuntimeExports.jsx(e.Pi,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:Z,placeholder:"Enter C/O",onChange:G=>{yt("care_of",G.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:d?.occupation,placeholder:"Enter Occupation",onChange:G=>{yt("occupation",G.target.value),W(!0),ir(G)},onBlur:G=>{G.stopPropagation(),W(!1)}},width:23.5+"em"}),le&&J&&J.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:J.map(G=>e.jsxRuntimeExports.jsx(e.ki,{label:G,className:"hfl-text-Primary-700",onSelect:()=>dr(G)}))})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-[368px]",children:e.jsxRuntimeExports.jsx(e.Pi,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:ie,placeholder:"Enter Tag",onChange:G=>{yt("tag",G.target.value)}},width:"22em"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-pb-2",children:e.jsxRuntimeExports.jsx(e.Pi,{label:"Mobile 2",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:De,maxLength:10,placeholder:"Enter Secondary Number",onChange:G=>{yt("phone_secondary",G.target.value.replace(/[^0-9]/g,""))}},width:23.5+"em"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-[368px]",children:e.jsxRuntimeExports.jsx(e.Pi,{label:"Aadhar Number",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:Ee,maxLength:12,placeholder:"Aadhar Card Number",onChange:G=>{yt("aadhar_number",G.target.value)},onBlur:()=>{S(G=>({...G,aadhar_number:d.aadhar_number&&d.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"})})]}),x&&e.jsxRuntimeExports.jsx("div",{className:"hfl-align-center hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pb-8",children:e.jsxRuntimeExports.jsx(e.Ap,{label:"Partner Company",placeholder:"Select Partner",value:{label:N?.partner_name??""},onChange:G=>{P(ve=>({...ve,partner_name:G.value}))},options:hr,disabled:!!d?.insurance_details?.policy_id,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"opd-insurance"})}),x&&N?.partner_name&&e.jsxRuntimeExports.jsxs("div",{ref:T,className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-items-center hfl-justify-between hfl-pb-8 hfl-pt-2",children:[e.jsxRuntimeExports.jsx(e.Ap,{label:"Insurance Company",placeholder:"Select Provider",value:{label:N?.policy_company??"Select Provider"},onChange:G=>{P(ve=>({...ve,policy_company:G.value}))},options:L,disabled:!!d?.insurance_details?.policy_id,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"opd-insurance"}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-justify-between ${D?"hfl-items-center":"hfl-items-end"}`,children:[e.jsxRuntimeExports.jsx(e.Pi,{label:"Policy Number",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:N?.policy_id??"",placeholder:"Enter Policy Number",onChange:G=>{P(ve=>({...ve,policy_id:G.target.value}))},disabled:!!d?.insurance_details?.policy_id},errorMsg:D,width:d?.insurance_details?.policy_id?16.5+"em":17.5+"em"}),e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-ml-4 hfl-px-4 hfl-py-[1.2rem]",hierarchy:"Primary",size:"md",onClick:()=>O(N),textField:d?.insurance_details?.policy_id?"Verified":"Verify",style:{pointerEvents:d?.insurance_details?.policy_id?"none":"unset"}})]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-36 hfl-gap-y-6",children:It()})]})]})})}),$n=n=>{const{getPatientDetails:d,setPatientAbhaDetails:c,patientAbhaDetails:a,isPartnerServiceEnabled:v,partnerConfig:w}=n,[l,A]=y.useState(""),[S,p]=y.useState(!1),[k,x]=y.useState(!1),[L,V]=y.useState(!1),[O,D]=y.useState([]),[N,P]=y.useState([]),T=y.useRef(null),j=y.useRef(null),[Q,I]=y.useState("profile"),{docPreference:H,patientDetails:z,preferences:J,patientIDs:Y,billPreferences:le,showToast:W,patientCustomFieldData:me,variable:je}=y.useContext(Tt)||{},ye=z?.org_person_bid_str||"",[et,pe]=y.useState([]),[$,ue]=y.useState(""),[M,Ae]=y.useState({partner_name:"",policy_company:"",policy_id:""}),Fe=y.useRef(null),[He,mt]=y.useState({name:"",phone_number:"",age:"",gender:"",email:""}),pt=(ie,Ie,Ee)=>e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[60px] hfl-flex-col hfl-items-center hfl-rounded hfl-px-1 hfl-py-2 hfl-text-center ${Q===ie?"hfl-bg-Primary-50 hfl-text-Primary-600":""} hfl-cursor-pointer`,onClick:()=>I(ie),children:[e.jsxRuntimeExports.jsx("div",{className:Ie}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:Ee})]},ie),[nt,Oe]=y.useState(z),at=async()=>{try{p(!1);const ie=await navigator.mediaDevices.getUserMedia({video:!0});j.current&&(j.current.srcObject=ie,V(!0))}catch(ie){console.error("Error accessing camera:",ie)}},Pt=ie=>{p(!1),V(!1);const Ie=ie.target.files?.[0];if(!Ie)return;const Ee=new FileReader;Ee.onloadend=()=>{const ht=Ee.result;typeof ht=="string"?A(ht):console.error("Failed to read file as a data URL."),ie.target&&(ie.target.value="")},Ee.onerror=()=>{console.error("There was an issue reading the file.")},Ee.readAsDataURL(Ie)},xt=()=>{document.getElementById("upload-local-file")?.click()},Nt=()=>{W?.("Success","Image deleted successfully","Success",3e3),p(!0),A(""),V(!1),B()},Bt=ie=>{A(ie),p(!1),V(!1)},B=()=>{if(j.current&&j.current.srcObject){const ie=j.current.srcObject;ie instanceof MediaStream&&ie.getTracks().forEach(Ie=>Ie.stop())}},De=()=>{const ie=T.current,Ie=j.current;if(ie&&Ie){ie.width=Ie.videoWidth,ie.height=Ie.videoHeight;const Ee=ie.getContext("2d");Ee&&Ee.drawImage(Ie,0,0,ie.width,ie.height);const ht=ie.toDataURL();A(ht),p(!1),V(!1),B()}};y.useEffect(()=>{(async()=>{try{const ie=await bn(je),{total_ref_doc_details:Ie,through_channel:Ee}=ie;Ie.length&&D(wn(Ie)),Ee.length&&P(Rn(Ee))}catch(ie){console.log("ERROR",ie)}})()},[je]),y.useEffect(()=>{Ae({partner_name:nt?.insurance_details?.partner||"",policy_company:nt?.insurance_details?.policy_company||"",policy_id:nt?.insurance_details?.policy_id||""})},[nt?.insurance_details]),y.useEffect(()=>{const ie=async Ie=>{try{const ht=(await In(Ie,je))?.insurance_companies||{},Jt=Object.entries(ht).map(([vt,zt])=>({value:vt,label:zt}));pe(Jt)}catch(Ee){console.error("Failed to fetch insurance list:",Ee),pe([])}};M?.partner_name&&v?ie(M?.partner_name):pe([])},[v,M?.partner_name,je]),y.useEffect(()=>{Fe?.current?.scrollIntoView({behavior:"smooth"})},[M.partner_name]);const qe=async ie=>{if(w&&w[ie?.partner_name]?.verify_insurance?.enable){const Ie=await Gn({...ie,patient_role_id:nt?.patient_id||""},je),{data:Ee}=Ie||{};if(Ee.status_code===200)ue(""),W?.("Insurance Verified Successfully","","Success",3e3);else if(Ee?.error||Ie?.status===500)throw ue("Policy Number is Incorrect"),console.log(Ee?.error),new Error(Ee?.error)}},re=async(ie,Ie)=>{const Ee=new FormData;Ee.append("pid",ie),Ee.append("bidstr",Ie),Ee.append("imgData",l);const ht=await Cn(Ee,je);ht.apiError&&W?.("Error",ht.apiError,"Error",3e3)},X=async ie=>{const Ie=new FormData;Ie.append("pid",ie);const Ee=await Rr.deletePatientImage(Ie,je);Ee.apiError&&W("Error",Ee.apiError,"Error",3e3)},Z=async(ie=nt?.name??"",Ie=nt?.org_person_dob??"")=>{if(!nt||!Y?.patientRoleID){W?.("Error","Patient data not available.","Error",3e3);return}const Ee={...nt,name:ie,org_person_dob:Ie};try{nt.image_link&&!l?await X(Y.patientRoleID):l&&k&&(await re(Y.patientRoleID,ye),x(!1));const ht=await _n(Ee,je,Y);ht.status?(W?.("Success",ht.message,"Success",3e3),d(Y.patientRoleID)):W?.("Error",ht.message,"Error",3e3)}catch(ht){console.error("Error updating patient details:",ht)}};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-flex-row hfl-bg-White ",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-gap-4 hfl-border-r-1 hfl-border-Gray-200 hfl-bg-Gray-50 hfl-px-1 hfl-py-2",children:pt("profile","hx_person-id-filled hfl-text-5","Profile")}),Q==="sms"?e.jsxRuntimeExports.jsx(Un,{}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full xxs:max-md:hfl-w-[915px]",children:[e.jsxRuntimeExports.jsxs("div",{className:" hfl-mt-4 hfl-justify-center hfl-overflow-y-auto",children:[H?.abha?.link_patient_rx&&e.jsxRuntimeExports.jsx(Zn,{patientAbhaDetails:a,patientData:nt,savePatientDetailsHandler:Z,setPatientAbhaDetails:c}),e.jsxRuntimeExports.jsx(Kn,{setPatientData:Oe,patientData:nt,preferences:J,referredByDocList:O,throughChannelList:N,showImageFromLink:Bt,setValidators:mt,validators:He,billPreferences:le,isAbhaVerified:a?.patient_details_mongo?.length,isPartnerServiceEnabled:v,insuranceData:et,partnerConfig:w,verifyInsuranceHandler:qe,policyNumberErrorMessage:$,selectedInsuranceDetails:M,setSelectedInsuranceDetails:Ae,insuranceDivRef:Fe,patientCustomFieldData:me})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-px-4 hfl-py-9",children:[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-[150px] hfl-w-[200px] hfl-items-center hfl-justify-center
3
3
  hfl-rounded-3xl hfl-border-4
4
4
  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
@@ -14,7 +14,7 @@ This usually means you need to need to name your plugin hook by setting the 'plu
14
14
  hfl-z-10 hfl-block hfl-w-max hfl-max-w-xs
15
15
  hfl-translate-x-[-50%] hfl-text-left hfl-opacity-0 hfl-transition hfl-delay-1000
16
16
  group-hover:hfl-visible group-hover:hfl-opacity-100
17
- `,children:[p&&e.jsxRuntimeExports.jsxs("div",{className:"text:hfl-Gray-700 hfl-mb-3 hfl-w-[207px] hfl-rounded-lg hfl-bg-White hfl-p-3 hfl-shadow-lg",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Line Item Discount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Medium",type:"Text sm",children:["₹"," ",["1","2","3"].reduce((I,H)=>I+parseInt(p.bill_summary[H]?.order_item_sum_discount||"0"),0)]})]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Additional Discount"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:["1","2","3"].map(I=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[I==="1"&&"Consultations",I==="2"&&"Lab Services",I==="3"&&"Other Services"]}),"₹ ",p.bill_summary[I]?.order_discount||"0"]},I))})]}),e.jsxRuntimeExports.jsx("div",{className:"text:hfl-Gray-700 hfl-absolute hfl-bottom-2 hfl-left-1/2 hfl-h-3 hfl-w-3 hfl-translate-x-[-50%] hfl-rotate-45 hfl-bg-White"})]})]})]}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",parseInt(p.bill_summary[1]?.order_item_sum_discount||"0")+parseInt(p.bill_summary[2]?.order_item_sum_discount||"0")+parseInt(p.bill_summary[3]?.order_item_sum_discount||"0")+parseInt(p.bill_summary[1]?.order_discount||"0")+parseInt(p.bill_summary[2]?.order_discount||"0")+parseInt(p.bill_summary[3]?.order_discount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-inline-flex hfl-flex-1 hfl-items-center hfl-text-Gray-800 ",children:"Tax Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(p.bill_summary[1]?.order_service_tax||"0")+parseInt(p.bill_summary[2]?.order_service_tax||"0")+parseInt(p.bill_summary[3]?.order_service_tax||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Final Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(p.bill_summary[1]?.net_bill_amount||"0")+parseInt(p.bill_summary[2]?.net_bill_amount||"0")+parseInt(p.bill_summary[3]?.net_bill_amount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Received Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(p.bill_summary[1]?.order_paid_amount||"0")+parseInt(p.bill_summary[2]?.order_paid_amount||"0")+parseInt(p.bill_summary[3]?.order_paid_amount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Refund Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",parseInt(p.bill_summary[1]?.refund_amount||"0")+parseInt(p.bill_summary[2]?.refund_amount||"0")+parseInt(p.bill_summary[3]?.refund_amount||"0")]})]}),D&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px]",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Past Due Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.total_amount]}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>Q()})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Total Balance"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Bold",type:"Text lg",className:"hfl-text-Gray-800",children:["₹"," ",(parseInt(p.bill_summary[1]?.balance_amount||"0")||0)+(parseInt(p.bill_summary[2]?.balance_amount||"0")||0)+(parseInt(p.bill_summary[3]?.balance_amount||"0")||0)+(D&&parseInt(S?.total_amount||"0")||0)]})]}),e.jsxRuntimeExports.jsx(Sl,{isPayDue:D,rightSegment:c,pastDueData:S,showDiscount:w,showRefund:l,summaryData:p,date:d,getBillSummarydata:k,handleRightSegment:a,getPastDueAmount:x,refreshBillsList:L,deleteLastPaymemntMode:P,setDeleteLastPaymentMode:T,walletBalance:V,setRefreshWallet:O})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-px-2 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"to-print",hierarchy:"Tertiary",size:"md",textField:"Print",disabled:!1,icon:"Left",onClick:()=>v([1,2,3],"billPrintPreview",!1),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"to-share",hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>v([1,2,3],"billSharePreview",!0),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},aa=n=>{const{editedTableData:d,handleRightSegment:c,getBillSummarydata:a,order_date:v,editRowId:w,setTableData:l,refreshBillsList:A,handleRevertEdit:S}=n,{patientIDs:p,showToast:k,doctorListArr:x,billPreferences:L,formattedService:V,ppEventProps:O,variable:D}=y.useContext(Tt),[N,P]=y.useState(),T={bill_item_details:{doctor_name:D.window_var.doc_name_for_seg,referrer_doctor_role_id:D.window_var.doctor_role_id_for_seg,lab_owner_name:"",lab_owner_id:"",appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},appnt_doctor_role_id:""}},[j,Q]=y.useState(()=>({...d,...T})),I=(J,Y)=>{let le={};J==="labowner"?le={lab_owner_name:Y.labOwnerName,lab_owner_id:Y.LabOwnerDocRoleID||""}:le={doctor_name:Y.docName,referrer_doctor_role_id:Y.docRoleID},Q(W=>({...W,bill_item_details:{...W.bill_item_details,...le}}))},H=async(J="")=>{try{const Y=await Pn(J,D);P(Y)}catch(Y){console.error("Error in getReferalDoctorList API Call:",Y)}};y.useEffect(()=>{H()},[]);const z=async()=>{if(d?.order_item_id)try{const J=await Rl(d?.order_item_id,p.patientRoleID,D);Q(Y=>{const le=J.data;return{...Y,...tn,...le,service_category:Et[2],service_category_id:"3",order_item_service_tax_percentage:V?.[+le.service_id]?.service_tax||0,bill_item_details:{...Y.bill_item_details,...le.bill_item_details,appnt_doctor_role_id:"",referrer_doctor_role_id:""}}})}catch(J){console.error("Error fetching bill item data:",J)}};return y.useEffect(()=>{d&&Q({...j,...d})},[d]),y.useEffect(()=>{z()},[j.order_item_id]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-max-w-[300px] hfl-truncate",children:j?.service_name}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{c(),S()}})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4",children:[L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:j.bill_item_details.doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",widthSufixDrpdwn:"hfl-w-[250px]",suffixOptions:x?.doctor_list?.map(J=>({label:J.doctor_name,value:J.doctor_name,appnt_doctor_role_id:J.doctor_identifier})),handleSuffixValChange:J=>{I("",{docName:J,docRoleID:""})},onSuffixDropdownClick:J=>{I("",{docName:J.label,docRoleID:J.appnt_doctor_role_id})}})}),L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.tj,{label:"Lab Owner (Referred By)",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hx_down hfl-bg-White_20",input2value:j.bill_item_details.lab_owner_name,inputProps:{disabled:!0},suffixInputProps:{placeholder:"Lab Owner (Referred By)"},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-border-l-0 hfl-w-[270px] hfl-text-ellipsis hfl-bg-White_20",widthSufixDrpdwn:"hfl-w-[305px]",suffixOptions:N?.referrals?.map(J=>({label:J.referralName,value:J.referralName,referralId:J.referralId})),onlySuffixDropdownItemsAllowed:!1,handleSuffixValChange:J=>{H(J),I("labowner",{labOwnerName:J,LabOwnerDocRoleID:""})},onSuffixDropdownClick:J=>{I("labowner",{labOwnerName:J.label,LabOwnerDocRoleID:J.referralId})}})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Update",className:"hfl-flex hfl-h-9 hfl-w-full hfl-shrink-0 hfl-items-center hfl-justify-center hfl-gap-1 hfl-self-stretch hfl-rounded-md hfl-p-3",onClick:async()=>{const J=await El(j,k,p.patientRoleID,Te.dayjs(v).format("YYYY-MM-DD"),O,Et[2],D);j.bill_item_details.lab_owner_name&&Sn(j.bill_item_details.lab_owner_name,p?.patientRoleID||"",D),J&&(l(Y=>Y.map((le,W)=>w==W.toString()?{...le,order_item_id:J.order_item_id||j.order_item_id}:le)),(J.order_item_id||j.order_item_id)&&(a(),c(),A(v)))}})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{c(),S()}})})]})},ia="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='50'%20height='49'%20viewBox='0%200%2050%2049'%20fill='none'%3e%3cg%20opacity='0.3'%20clip-path='url(%23clip0_916_82588)'%3e%3cpath%20d='M48.2399%2011.218V38.5495C48.2399%2039.4022%2047.9011%2040.2201%2047.2981%2040.8231C46.6951%2041.4261%2045.8772%2041.7649%2045.0244%2041.7649H4.83118C3.97839%2041.7649%203.16052%2041.4261%202.55751%2040.8231C1.95449%2040.2201%201.61572%2039.4022%201.61572%2038.5495V11.218L2.41959%2010.4142H47.436L48.2399%2011.218Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M48.2399%208.00245V11.2179H1.61572V8.00245C1.61572%207.14965%201.95449%206.33179%202.55751%205.72877C3.16052%205.12576%203.97839%204.78699%204.83118%204.78699H45.0244C45.8772%204.78699%2046.6951%205.12576%2047.2981%205.72877C47.9011%206.33179%2048.2399%207.14965%2048.2399%208.00245Z'%20fill='%23D0D5DD'/%3e%3cpath%20d='M10.4572%203.17951C10.4572%202.29158%209.73735%201.57178%208.84943%201.57178C7.9615%201.57178%207.2417%202.29158%207.2417%203.17951V6.39497C7.2417%207.28289%207.9615%208.0027%208.84943%208.0027C9.73735%208.0027%2010.4572%207.28289%2010.4572%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M18.4967%203.17951C18.4967%202.29158%2017.7769%201.57178%2016.889%201.57178C16.0011%201.57178%2015.2812%202.29158%2015.2812%203.17951V6.39497C15.2812%207.28289%2016.0011%208.0027%2016.889%208.0027C17.7769%208.0027%2018.4967%207.28289%2018.4967%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M26.5348%203.17951C26.5348%202.29158%2025.815%201.57178%2024.9271%201.57178C24.0391%201.57178%2023.3193%202.29158%2023.3193%203.17951V6.39497C23.3193%207.28289%2024.0391%208.0027%2024.9271%208.0027C25.815%208.0027%2026.5348%207.28289%2026.5348%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M34.5734%203.17951C34.5734%202.29158%2033.8536%201.57178%2032.9656%201.57178C32.0777%201.57178%2031.3579%202.29158%2031.3579%203.17951V6.39497C31.3579%207.28289%2032.0777%208.0027%2032.9656%208.0027C33.8536%208.0027%2034.5734%207.28289%2034.5734%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M42.6124%203.17951C42.6124%202.29158%2041.8926%201.57178%2041.0047%201.57178C40.1168%201.57178%2039.397%202.29158%2039.397%203.17951V6.39497C39.397%207.28289%2040.1168%208.0027%2041.0047%208.0027C41.8926%208.0027%2042.6124%207.28289%2042.6124%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M24.928%2034.5299C29.8115%2034.5299%2033.7705%2030.571%2033.7705%2025.6874C33.7705%2020.8038%2029.8115%2016.8449%2024.928%2016.8449C20.0444%2016.8449%2016.0854%2020.8038%2016.0854%2025.6874C16.0854%2030.571%2020.0444%2034.5299%2024.928%2034.5299Z'%20fill='%23D0D5DD'/%3e%3cpath%20d='M29.7505%2024.0798H26.5351V20.8644C26.5351%2020.6512%2026.4504%2020.4467%2026.2996%2020.2959C26.1489%2020.1452%2025.9444%2020.0605%2025.7312%2020.0605H24.1235C23.9103%2020.0605%2023.7058%2020.1452%2023.5551%2020.2959C23.4043%2020.4467%2023.3196%2020.6512%2023.3196%2020.8644V24.0798H20.1042C19.891%2024.0798%2019.6865%2024.1645%2019.5357%2024.3153C19.385%2024.466%2019.3003%2024.6705%2019.3003%2024.8837V26.4914C19.3003%2026.7046%2019.385%2026.9091%2019.5357%2027.0598C19.6865%2027.2106%2019.891%2027.2953%2020.1042%2027.2953H23.3196V30.5107C23.3196%2030.7239%2023.4043%2030.9284%2023.5551%2031.0791C23.7058%2031.2299%2023.9103%2031.3146%2024.1235%2031.3146H25.7312C25.9444%2031.3146%2026.1489%2031.2299%2026.2996%2031.0791C26.4504%2030.9284%2026.5351%2030.7239%2026.5351%2030.5107V27.2953H29.7505C29.9637%2027.2953%2030.1682%2027.2106%2030.319%2027.0598C30.4697%2026.9091%2030.5544%2026.7046%2030.5544%2026.4914V24.8837C30.5544%2024.6705%2030.4697%2024.466%2030.319%2024.3153C30.1682%2024.1645%2029.9637%2024.0798%2029.7505%2024.0798Z'%20fill='white'/%3e%3cpath%20d='M13.6731%2048.1958C15.8929%2048.1958%2017.6925%2046.3963%2017.6925%2044.1765C17.6925%2041.9567%2015.8929%2040.1572%2013.6731%2040.1572C11.4533%2040.1572%209.65381%2041.9567%209.65381%2044.1765C9.65381%2046.3963%2011.4533%2048.1958%2013.6731%2048.1958Z'%20fill='%2398A2B3'/%3e%3cpath%20d='M45.0241%203.9834H43.4164V3.17954C43.4164%202.53994%2043.1623%201.92655%2042.71%201.47428C42.2578%201.02202%2041.6444%200.767944%2041.0048%200.767944C40.3652%200.767944%2039.7518%201.02202%2039.2995%201.47428C38.8472%201.92655%2038.5932%202.53994%2038.5932%203.17954V3.9834H35.3777V3.17954C35.3777%202.53994%2035.1236%201.92655%2034.6714%201.47428C34.2191%201.02202%2033.6057%200.767944%2032.9661%200.767944C32.3265%200.767944%2031.7131%201.02202%2031.2609%201.47428C30.8086%201.92655%2030.5545%202.53994%2030.5545%203.17954V3.9834H27.3391V3.17954C27.3391%202.53994%2027.085%201.92655%2026.6327%201.47428C26.1805%201.02202%2025.5671%200.767944%2024.9275%200.767944C24.2879%200.767944%2023.6745%201.02202%2023.2222%201.47428C22.7699%201.92655%2022.5159%202.53994%2022.5159%203.17954V3.9834H19.3004V3.17954C19.3004%202.53994%2019.0463%201.92655%2018.5941%201.47428C18.1418%201.02202%2017.5284%200.767944%2016.8888%200.767944C16.2492%200.767944%2015.6358%201.02202%2015.1836%201.47428C14.7313%201.92655%2014.4772%202.53994%2014.4772%203.17954V3.9834H11.2618V3.17954C11.2618%202.53994%2011.0077%201.92655%2010.5554%201.47428C10.1032%201.02202%209.48977%200.767944%208.85017%200.767944C8.21058%200.767944%207.59718%201.02202%207.14492%201.47428C6.69265%201.92655%206.43858%202.53994%206.43858%203.17954V3.9834H4.83085C3.76525%203.98468%202.74366%204.40855%201.99017%205.16205C1.23667%205.91554%200.8128%206.93713%200.811523%208.00273L0.811523%2038.5496C0.8128%2039.6152%201.23667%2040.6368%201.99017%2041.3903C2.74366%2042.1438%203.76525%2042.5676%204.83085%2042.5689H9.13152C8.80047%2043.5017%208.7644%2044.5137%209.02822%2045.4677C9.29203%2046.4217%209.84294%2047.2714%2010.6062%2047.9015C11.3695%2048.5317%2012.3081%2048.9117%2013.2948%2048.9902C14.2814%2049.0686%2015.2683%2048.8416%2016.1216%2048.3399C16.9748%2047.8382%2017.653%2047.0862%2018.0642%2046.1859C18.4754%2045.2856%2018.5996%2044.2805%2018.4201%2043.3072C18.2405%2042.3338%2017.7659%2041.4393%2017.0605%2040.7449C16.3552%2040.0506%2015.4533%2039.59%2014.4772%2039.4258V31.3148C14.4772%2030.6752%2014.2231%2030.0618%2013.7709%2029.6096C13.3186%2029.1573%2012.7052%2028.9032%2012.0656%2028.9032H10.8598C10.54%2028.9032%2010.2333%2028.7762%2010.0072%2028.55C9.78107%2028.3239%209.65404%2028.0172%209.65404%2027.6974C9.65404%2027.3776%209.78107%2027.0709%2010.0072%2026.8448C10.2333%2026.6187%2010.54%2026.4916%2010.8598%2026.4916H15.3221C15.5196%2028.9036%2016.6173%2031.153%2018.397%2032.793C20.1767%2034.4329%2022.5082%2035.3433%2024.9283%2035.3433C27.3483%2035.3433%2029.6799%2034.4329%2031.4596%2032.793C33.2393%2031.153%2034.3369%2028.9036%2034.5345%2026.4916H35.3777C35.5909%2026.4916%2035.7954%2026.5763%2035.9461%2026.7271C36.0969%2026.8778%2036.1816%2027.0823%2036.1816%2027.2955V32.5206C36.1816%2033.2668%2036.478%2033.9824%2037.0056%2034.5101C37.5333%2035.0377%2038.2489%2035.3341%2038.9951%2035.3341C39.7413%2035.3341%2040.4569%2035.0377%2040.9846%2034.5101C41.5122%2033.9824%2041.8086%2033.2668%2041.8086%2032.5206V24.8115C42.9313%2024.6208%2043.9503%2024.0394%2044.6858%2023.1701C45.4213%2022.3007%2045.8258%2021.1994%2045.8279%2020.0607V15.2375C45.8279%2014.8111%2045.6586%2014.4022%2045.3571%2014.1007C45.0555%2013.7992%2044.6466%2013.6298%2044.2202%2013.6298H43.4164C43.2032%2013.6298%2042.9987%2013.7145%2042.8479%2013.8652C42.6972%2014.016%2042.6125%2014.2204%2042.6125%2014.4336C42.6125%2014.6468%2042.6972%2014.8513%2042.8479%2015.0021C42.9987%2015.1528%2043.2032%2015.2375%2043.4164%2015.2375H44.2202V20.0607C44.2202%2020.9135%2043.8814%2021.7314%2043.2784%2022.3344C42.6754%2022.9374%2041.8576%2023.2762%2041.0048%2023.2762C40.152%2023.2762%2039.3341%2022.9374%2038.7311%2022.3344C38.1281%2021.7314%2037.7893%2020.9135%2037.7893%2020.0607V15.2375H38.5932C38.8064%2015.2375%2039.0108%2015.1528%2039.1616%2015.0021C39.3123%2014.8513%2039.397%2014.6468%2039.397%2014.4336C39.397%2014.2204%2039.3123%2014.016%2039.1616%2013.8652C39.0108%2013.7145%2038.8064%2013.6298%2038.5932%2013.6298H37.7893C37.3629%2013.6298%2036.954%2013.7992%2036.6525%2014.1007C36.351%2014.4022%2036.1816%2014.8111%2036.1816%2015.2375V20.0607C36.1837%2021.1994%2036.5882%2022.3007%2037.3237%2023.1701C38.0592%2024.0394%2039.0783%2024.6208%2040.2009%2024.8115V32.5206C40.2009%2032.8404%2040.0739%2033.1471%2039.8477%2033.3732C39.6216%2033.5994%2039.3149%2033.7264%2038.9951%2033.7264C38.6753%2033.7264%2038.3686%2033.5994%2038.1425%2033.3732C37.9163%2033.1471%2037.7893%2032.8404%2037.7893%2032.5206V27.2955C37.7893%2026.6559%2037.5352%2026.0425%2037.083%2025.5902C36.6307%2025.138%2036.0173%2024.8839%2035.3777%2024.8839H34.5328C34.3353%2022.4719%2033.2377%2020.2225%2031.458%2018.5825C29.6782%2016.9426%2027.3467%2016.0322%2024.9267%2016.0322C22.5066%2016.0322%2020.1751%2016.9426%2018.3954%2018.5825C16.6157%2020.2225%2015.518%2022.4719%2015.3205%2024.8839H10.8598C10.1136%2024.8839%209.39801%2025.1803%208.87037%2025.708C8.34273%2026.2356%208.04631%2026.9512%208.04631%2027.6974C8.04631%2028.4436%208.34273%2029.1592%208.87037%2029.6869C9.39801%2030.2145%2010.1136%2030.5109%2010.8598%2030.5109H12.0656C12.2788%2030.5109%2012.4833%2030.5956%2012.634%2030.7464C12.7848%2030.8971%2012.8695%2031.1016%2012.8695%2031.3148V39.4258C11.7956%2039.6088%2010.8152%2040.15%2010.0881%2040.9612H4.83085C4.19125%2040.9612%203.57785%2040.7071%203.12559%2040.2548C2.67333%2039.8026%202.41925%2039.1892%202.41925%2038.5496V12.0221H47.4357V38.5496C47.4357%2039.1892%2047.1816%2039.8026%2046.7293%2040.2548C46.2771%2040.7071%2045.6637%2040.9612%2045.0241%2040.9612H20.1043C19.8911%2040.9612%2019.6866%2041.0459%2019.5359%2041.1966C19.3851%2041.3474%2019.3004%2041.5519%2019.3004%2041.7651C19.3004%2041.9782%2019.3851%2042.1827%2019.5359%2042.3335C19.6866%2042.4842%2019.8911%2042.5689%2020.1043%2042.5689H45.0241C46.0897%2042.5676%2047.1113%2042.1438%2047.8648%2041.3903C48.6183%2040.6368%2049.0421%2039.6152%2049.0434%2038.5496V8.00273C49.0421%206.93713%2048.6183%205.91554%2047.8648%205.16205C47.1113%204.40855%2046.0897%203.98468%2045.0241%203.9834ZM24.9275%2017.6491C26.5174%2017.6491%2028.0715%2018.1206%2029.3935%2019.0039C30.7154%2019.8872%2031.7458%2021.1426%2032.3542%2022.6115C32.9626%2024.0804%2033.1218%2025.6967%2032.8117%2027.256C32.5015%2028.8154%2031.7359%2030.2477%2030.6116%2031.3719C29.4874%2032.4962%2028.0551%2033.2618%2026.4957%2033.5719C24.9364%2033.8821%2023.3201%2033.7229%2021.8512%2033.1145C20.3823%2032.5061%2019.1269%2031.4757%2018.2436%2030.1538C17.3603%2028.8318%2016.8888%2027.2776%2016.8888%2025.6878C16.8912%2023.5565%2017.7388%2021.5132%2019.2459%2020.0062C20.7529%2018.4991%2022.7962%2017.6514%2024.9275%2017.6491ZM13.6734%2040.9612C14.3093%2040.9612%2014.931%2041.1498%2015.4598%2041.5031C15.9886%2041.8564%2016.4007%2042.3586%2016.6441%2042.9461C16.8874%2043.5337%2016.9511%2044.1802%2016.827%2044.804C16.703%2045.4277%2016.3967%2046.0006%2015.947%2046.4503C15.4973%2046.9%2014.9244%2047.2063%2014.3007%2047.3303C13.6769%2047.4544%2013.0304%2047.3907%2012.4429%2047.1473C11.8553%2046.904%2011.3531%2046.4918%2010.9998%2045.9631C10.6465%2045.4343%2010.4579%2044.8126%2010.4579%2044.1766C10.4579%2043.3239%2010.7967%2042.506%2011.3997%2041.903C12.0027%2041.3%2012.8206%2040.9612%2013.6734%2040.9612ZM40.2009%203.17954C40.2009%202.96634%2040.2856%202.76187%2040.4363%202.61112C40.5871%202.46037%2040.7916%202.37567%2041.0048%202.37567C41.218%202.37567%2041.4224%202.46037%2041.5732%202.61112C41.7239%202.76187%2041.8086%202.96634%2041.8086%203.17954V6.395C41.8086%206.6082%2041.7239%206.81266%2041.5732%206.96342C41.4224%207.11417%2041.218%207.19886%2041.0048%207.19886C40.7916%207.19886%2040.5871%207.11417%2040.4363%206.96342C40.2856%206.81266%2040.2009%206.6082%2040.2009%206.395V3.17954ZM32.1622%203.17954C32.1622%202.96634%2032.2469%202.76187%2032.3977%202.61112C32.5484%202.46037%2032.7529%202.37567%2032.9661%202.37567C33.1793%202.37567%2033.3838%202.46037%2033.5345%202.61112C33.6853%202.76187%2033.77%202.96634%2033.77%203.17954V6.395C33.77%206.6082%2033.6853%206.81266%2033.5345%206.96342C33.3838%207.11417%2033.1793%207.19886%2032.9661%207.19886C32.7529%207.19886%2032.5484%207.11417%2032.3977%206.96342C32.2469%206.81266%2032.1622%206.6082%2032.1622%206.395V3.17954ZM24.1236%203.17954C24.1236%202.96634%2024.2083%202.76187%2024.359%202.61112C24.5098%202.46037%2024.7143%202.37567%2024.9275%202.37567C25.1407%202.37567%2025.3451%202.46037%2025.4959%202.61112C25.6466%202.76187%2025.7313%202.96634%2025.7313%203.17954V6.395C25.7313%206.6082%2025.6466%206.81266%2025.4959%206.96342C25.3451%207.11417%2025.1407%207.19886%2024.9275%207.19886C24.7143%207.19886%2024.5098%207.11417%2024.359%206.96342C24.2083%206.81266%2024.1236%206.6082%2024.1236%206.395V3.17954ZM16.085%203.17954C16.085%202.96634%2016.1696%202.76187%2016.3204%202.61112C16.4712%202.46037%2016.6756%202.37567%2016.8888%202.37567C17.102%202.37567%2017.3065%202.46037%2017.4572%202.61112C17.608%202.76187%2017.6927%202.96634%2017.6927%203.17954V6.395C17.6927%206.6082%2017.608%206.81266%2017.4572%206.96342C17.3065%207.11417%2017.102%207.19886%2016.8888%207.19886C16.6756%207.19886%2016.4712%207.11417%2016.3204%206.96342C16.1696%206.81266%2016.085%206.6082%2016.085%206.395V3.17954ZM8.04631%203.17954C8.04631%202.96634%208.131%202.76187%208.28175%202.61112C8.43251%202.46037%208.63697%202.37567%208.85017%202.37567C9.06337%202.37567%209.26783%202.46037%209.41859%202.61112C9.56934%202.76187%209.65404%202.96634%209.65404%203.17954V6.395C9.65404%206.6082%209.56934%206.81266%209.41859%206.96342C9.26783%207.11417%209.06337%207.19886%208.85017%207.19886C8.63697%207.19886%208.43251%207.11417%208.28175%206.96342C8.131%206.81266%208.04631%206.6082%208.04631%206.395V3.17954ZM2.41925%2010.4143V8.00273C2.41925%207.36313%202.67333%206.74973%203.12559%206.29747C3.57785%205.84521%204.19125%205.59113%204.83085%205.59113H6.43858V6.395C6.43858%207.03459%206.69265%207.64799%207.14492%208.10025C7.59718%208.55252%208.21058%208.80659%208.85017%208.80659C9.48977%208.80659%2010.1032%208.55252%2010.5554%208.10025C11.0077%207.64799%2011.2618%207.03459%2011.2618%206.395V5.59113H14.4772V6.395C14.4772%207.03459%2014.7313%207.64799%2015.1836%208.10025C15.6358%208.55252%2016.2492%208.80659%2016.8888%208.80659C17.5284%208.80659%2018.1418%208.55252%2018.5941%208.10025C19.0463%207.64799%2019.3004%207.03459%2019.3004%206.395V5.59113H22.5159V6.395C22.5159%207.03459%2022.7699%207.64799%2023.2222%208.10025C23.6745%208.55252%2024.2879%208.80659%2024.9275%208.80659C25.5671%208.80659%2026.1805%208.55252%2026.6327%208.10025C27.085%207.64799%2027.3391%207.03459%2027.3391%206.395V5.59113H30.5545V6.395C30.5545%207.03459%2030.8086%207.64799%2031.2609%208.10025C31.7131%208.55252%2032.3265%208.80659%2032.9661%208.80659C33.6057%208.80659%2034.2191%208.55252%2034.6714%208.10025C35.1236%207.64799%2035.3777%207.03459%2035.3777%206.395V5.59113H38.5932V6.395C38.5932%207.03459%2038.8472%207.64799%2039.2995%208.10025C39.7518%208.55252%2040.3652%208.80659%2041.0048%208.80659C41.6444%208.80659%2042.2578%208.55252%2042.71%208.10025C43.1623%207.64799%2043.4164%207.03459%2043.4164%206.395V5.59113H45.0241C45.6637%205.59113%2046.2771%205.84521%2046.7293%206.29747C47.1816%206.74973%2047.4357%207.36313%2047.4357%208.00273V10.4143H2.41925Z'%20fill='%2398A2B3'/%3e%3cpath%20d='M22.5154%2028.0995V30.5111C22.5154%2030.9375%2022.6848%2031.3465%2022.9863%2031.648C23.2878%2031.9495%2023.6968%2032.1189%2024.1231%2032.1189H25.7309C26.1573%2032.1189%2026.5662%2031.9495%2026.8677%2031.648C27.1692%2031.3465%2027.3386%2030.9375%2027.3386%2030.5111V28.0995H29.7502C30.1766%2028.0995%2030.5855%2027.9301%2030.887%2027.6286C31.1885%2027.3271%2031.3579%2026.9182%2031.3579%2026.4918V24.8841C31.3579%2024.4577%2031.1885%2024.0487%2030.887%2023.7472C30.5855%2023.4457%2030.1766%2023.2763%2029.7502%2023.2763H27.3386V20.8647C27.3386%2020.4384%2027.1692%2020.0294%2026.8677%2019.7279C26.5662%2019.4264%2026.1573%2019.257%2025.7309%2019.257H24.1231C23.6968%2019.257%2023.2878%2019.4264%2022.9863%2019.7279C22.6848%2020.0294%2022.5154%2020.4384%2022.5154%2020.8647V23.2763H20.1038C19.6774%2023.2763%2019.2685%2023.4457%2018.967%2023.7472C18.6655%2024.0487%2018.4961%2024.4577%2018.4961%2024.8841V26.4918C18.4961%2026.9182%2018.6655%2027.3271%2018.967%2027.6286C19.2685%2027.9301%2019.6774%2028.0995%2020.1038%2028.0995H22.5154ZM20.1038%2024.8841H23.3193C23.5325%2024.8841%2023.7369%2024.7994%2023.8877%2024.6486C24.0385%2024.4979%2024.1231%2024.2934%2024.1231%2024.0802V20.8647H25.7309V24.0802C25.7309%2024.2934%2025.8156%2024.4979%2025.9663%2024.6486C26.1171%2024.7994%2026.3215%2024.8841%2026.5347%2024.8841H29.7502V26.4918H26.5347C26.3215%2026.4918%2026.1171%2026.5765%2025.9663%2026.7272C25.8156%2026.878%2025.7309%2027.0825%2025.7309%2027.2957V30.5111H24.1231V27.2957C24.1231%2027.0825%2024.0385%2026.878%2023.8877%2026.7272C23.7369%2026.5765%2023.5325%2026.4918%2023.3193%2026.4918H20.1038V24.8841Z'%20fill='%2398A2B3'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_916_82588'%3e%3crect%20width='48.2319'%20height='48.2319'%20fill='white'%20transform='translate(0.811523%200.767883)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",oa=n=>{const{showToast:d,patientIDs:c,doctorListArr:a,patientDetails:v,billPreferences:w,formattedService:l,ppEventProps:A,variable:S}=y.useContext(Tt),{bill_date:p,handleRightSegment:k,getBillSummarydata:x,editedTableData:L,setTableData:V,editRowId:O,refreshBillsList:D,handleRevertEdit:N,checkAppointmentForBilling:P}=n,[T,j]=y.useState([]),Q=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),I=a?.doctor_list?.length===1?a?.doctor_list[0]:{doctor_name:"",doctor_identifier:""},H={...zl,appnt_doctor_name:window.role_id=="11"?window.doc_name_for_seg:I?.doctor_name,appnt_doctor_role_id:window.role_id=="11"?window.doctor_role_id_for_seg:I?.doctor_identifier,appnt_duration:+w?.print?.bill?.appnt_minute_slab,appnt_time_time:Q?.split(" ")[0]||"",appnt_time_format:Q?.split(" ")[1]||"",total_price:"",appnt_date:Te.dayjs().format("YYYY-MM-DD"),appnt_service_id:L?.service_id||"",appnt_service_name:L?.service_name||"",...L},[z,J]=y.useState(H),[Y,le]=y.useState(!1),W=async()=>{if(L?.order_item_id)try{const $=await Rl(L.order_item_id,c.patientRoleID,S),{created_on:ue,order_item_service_tax:M,service_id:Ae,bill_item_details:Fe,order_item_id:He,item_quantity:mt,order_unit_item_price:pt,order_item_price:nt,order_item_discount:Oe,service_name:at}=$.data,{appointment_details:Pt,doctor_name:xt}=Fe,{appnt_id:Nt,appnt_date:Bt=Te.dayjs().format("YYYY-MM-DD"),appnt_time:B,appnt_status:De,appnt_duration:qe,doctor_role_id:re}=Pt,X=new Date("1970-01-01T"+B+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"}),Z={appnt_time_time:"",appnt_time_format:""};X&&X!=="Invalid Date"&&(Z.appnt_time_time=X?.split(" ")[0],Z.appnt_time_format=X?.split(" ")[1]),J(ie=>({...ie,appnt_id:Nt,patient_role_id:c.patientRoleID,appnt_doctor_role_id:re,appnt_service_id:Ae,appnt_date:Bt,appnt_time:B,appnt_status:De,appnt_duration:qe,appnt_doctor_name:xt,appnt_service_name:at,appnt_mode:"inperson",order_item_id:He,item_quantity:mt,order_unit_item_price:pt,order_item_price:nt,order_item_discount:Oe,order_item_service_tax:""+Math.floor(+M),order_item_service_tax_percentage:l[+Ae]?.service_tax||0,total_price:"",appnt_created_on:ue,order_item_created_on:ue,...Z}))}catch($){J(H),console.error("Error fetching bill item data:",$)}};y.useEffect(()=>{L&&J({...z,...L})},[L]),y.useEffect(()=>{W()},[z.order_item_id]);const[me,je]=y.useState(!1),ye=($,ue)=>{J(M=>({...M,[$]:ue}))},et=async()=>{try{const $=await fn(L.service_id,Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,S);if($?.appointments?.length)for(const ue of $.appointments){const M=new Date("1970-01-01T"+ue.appnt_time+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});M&&M!=="Invalid Date"&&(ue.appnt_time_time=M?.split(" ")[0],ue.appnt_time_format=M?.split(" ")[1])}j($?.appointments)}catch{console.log("error in getAppointmentsList API Call")}};y.useEffect(()=>{et()},[L?.service_id]);const pe=z.appnt_date&&Te.dayjs(z.appnt_date).format("YYYY-MM-DD")<Te.dayjs().format("YYYY-MM-DD");return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[340px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text md",className:"hfl-truncate hfl-capitalize",title:L?.service_name||"",children:L?.service_name||""}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{k(),N()}})]}),T.length>0&&!me&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-2.5 hfl-px-[13px] hfl-py-3",children:[T.map(($,ue)=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-shrink-0 hfl-flex-col hfl-items-start hfl-gap-[5px] hfl-rounded-md hfl-border-Gray-200 hfl-bg-White_20 hfl-px-3 hfl-py-2 hfl-shadow-md hover:hfl-bg-Gray-100",onClick:()=>{je(!0),J(M=>({...M,...$}))},children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["Consultation with ",$.appnt_doctor_name]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",children:`${$.appnt_time_time} ${$.appnt_time_format}`}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[11px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_inperson hfl-text-3"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:"In-Person"})]})]})]},ue)),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"Create New Appointment",disabled:Te.dayjs(p).format("YYYY-MM-DD")!==Te.dayjs().format("YYYY-MM-DD"),className:"hfl-h-10 hfl-w-full hfl-justify-center hfl-bg-White_20 hfl-text-[13px] hover:hfl-bg-Gray-100",onClick:()=>{je(!0),J(H)}})]}),(Te.dayjs(p).format("YYYY-MM-DD")===Te.dayjs().format("YYYY-MM-DD")&&T.length==0||me)&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-4 hfl-px-3 hfl-py-4",children:[e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:z.appnt_doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:`hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20 ${pe?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-12",widthSufixDrpdwn:"hfl-w-[250px]",suffixOptions:a?.doctor_list?.map($=>({label:$.doctor_name,value:$.doctor_name,appnt_doctor_role_id:$.doctor_identifier})),handleSuffixValChange:$=>{ye("appnt_doctor_name",$),ye("appnt_doctor_role_id","")},onSuffixDropdownClick:$=>{ye("appnt_doctor_name",$.label),ye("appnt_doctor_role_id",$.appnt_doctor_role_id)}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Date & Time of Appointment"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-gap-2",children:[pe?e.jsxRuntimeExports.jsx(e.Pi,{className:"!hfl-h-[40px]",width:"120px",start_icon:"hx_calendar",inputProps:{value:z.appnt_date,disabled:!0}}):e.jsxRuntimeExports.jsx(e.ZC,{placeholder:"Today",width:"120px",height:"!hfl-h-[40px]",selectDate:new Date(Te.dayjs(z.appnt_date).format("DD-MMM-YYYY")),dateVar:$=>{ye("appnt_date",Te.dayjs($).format("YYYY-MM-DD"))},isborderRequired:!0,minDate:new Date}),e.jsxRuntimeExports.jsx(e.tj,{className:` hfl-w-20 ${pe?" hfl-pointer-events-none":""}`,suffixClassName:` hfl-w-10 ${pe?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-[80px]",input1value:z?.appnt_time_time||"",input2value:z?.appnt_time_format||"",end_icon:"hx_down",inputProps:{placeholder:"10:00",onBlur:$=>{ye("appnt_time_time",$.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:$=>{ye("appnt_time_format",$.value)}})]})]}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ir.find($=>$.value==z.appnt_duration)?.label,value:z.appnt_duration},label:"Duration",className:`hfl-text-Gray-800 ${pe?" hfl-pointer-events-none":""}`,onChange:$=>{ye("appnt_duration",$.value)},options:Ir}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Type"}),e.jsxRuntimeExports.jsx(e.ju,{options:[{start_icon:"hx_inperson hfl-text-3",label:"In-Person",value:"inperson"}],disabled:!1,value:"inperson"})]}),window?.partner_service_enabled==="1"&&v?.insurance_details?.policy_id?.length&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-1.5",children:e.jsxRuntimeExports.jsx(e.Oi,{size:"md",disabled:!1,isMarked:Y,text:"Partner Enabled",onClick:()=>le($=>!$),"data-qa":"skip-billing"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"No",className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{k(),je(!1)}}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:z?.appnt_id?.length?"Update":"Create",icon:"No",onClick:async()=>{if(Te.dayjs(p).format("YYYY-MM-DD")<Te.dayjs().format("YYYY-MM-DD"))await El(z,d,c.patientRoleID,Te.dayjs(p).format("YYYY-MM-DD"),A,Et[0],S)&&k();else{const $=await Zl(z,!1,d,v,c,A,Y,!0,S);$&&(V(ue=>ue.map((M,Ae)=>O==Ae.toString()?{...M,order_item_id:$.order_item_id||z.order_item_id}:M)),J(ue=>({...ue,order_item_id:$.order_item_id,appnt_id:$.appnt_id,order_id:$.order_id})),$.order_item_id&&$.appnt_id&&k())}x(),D(p),P()},className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800"})]})]}),Te.dayjs(p).format("YYYY-MM-DD")!==Te.dayjs().format("YYYY-MM-DD")&&T.length==0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-[11px]",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[58px] hfl-pb-4",src:ia,alt:"no-bills"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-1.5 hfl-text-Error-600",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_error-filled hfl-h-5 hfl-w-5 "}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"There is no visit/prescription on this date."})]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Bill cannot be created without a visit"})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-sticky hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{me?je(!1):k(),N()}})})]})},ua=n=>{const{handleRightSegment:d,editedTableData:c,getBillSummarydata:a,order_date:v,setTableData:w,editRowId:l,refreshBillsList:A,handleRevertEdit:S}=n,{patientIDs:p,showToast:k,doctorListArr:x,billPreferences:L,formattedService:V,ppEventProps:O,variable:D}=y.useContext(Tt)||{},N={bill_item_details:{appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},doctor_name:D.window_var.doc_name_for_seg,referrer_doctor_role_id:D.window_var.doctor_role_id_for_seg,lab_owner_name:"",lab_owner_id:"",appnt_doctor_role_id:""}},[P,T]=y.useState({...c,...N}),j=y.useCallback(async()=>{if(c?.order_item_id)try{const I=await Rl(c.order_item_id,p?.patientRoleID||"",D);T({...c,...I.data,service_category:Et[1],service_category_id:"2",order_item_service_tax_percentage:V?.[+I.data.service_id]?.service_tax||0,bill_item_details:{...N.bill_item_details,...I.data.bill_item_details,appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},lab_owner_name:"",lab_owner_id:"0",appnt_doctor_role_id:"",referrer_doctor_role_id:""}})}catch(I){console.error("Error fetching bill item data:",I)}},[N.bill_item_details,c,V,p?.patientRoleID,D]);y.useEffect(()=>{c&&T(I=>({...I,...c}))},[c]),y.useEffect(()=>{j()},[j,P.order_item_id]);const Q=I=>{const H={...P,service_category:Et[1],bill_item_details:{doctor_name:I.docName,appointment_details:null,lab_owner_name:"",lab_owner_id:"",referrer_doctor_role_id:I.docRoleID}};T(H)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",children:P?.service_name}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{d(),S()}})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4",children:[L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:P.bill_item_details.doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",suffixOptions:x?.doctor_list?.map(I=>({label:I.doctor_name,value:I.doctor_name,appnt_doctor_role_id:I.doctor_identifier})),handleSuffixValChange:I=>{Q({docName:I,docRoleID:""})},onSuffixDropdownClick:I=>{Q({docName:I.label,docRoleID:I.appnt_doctor_role_id})}})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Update",className:"hfl-flex hfl-h-9 hfl-w-full hfl-shrink-0 hfl-items-center hfl-justify-center hfl-gap-1 hfl-self-stretch hfl-rounded-md hfl-p-3",onClick:async()=>{const I=await El(P,k,p?.patientRoleID||"",Te.dayjs(v).format("YYYY-MM-DD"),O,Et[1],D);I&&(w(H=>H.map((z,J)=>l==J.toString()?{...z,order_item_id:I?.order_item_id||P.order_item_id}:z)),(I?.order_item_id||P.order_item_id)&&(a(),d(),A(v)))}})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{d(),S()}})})]})};var Is={exports:{}},ca=Is.exports,Wl;function da(){return Wl||(Wl=1,function(n,d){(function(c,a){n.exports=a()})(ca,function(){var c="minute",a=/[+-]\d\d(?::?\d\d)?/g,v=/([+-]|\d\d)/g;return function(w,l,A){var S=l.prototype;A.utc=function(D){var N={date:D,utc:!0,args:arguments};return new l(N)},S.utc=function(D){var N=A(this.toDate(),{locale:this.$L,utc:!0});return D?N.add(this.utcOffset(),c):N},S.local=function(){return A(this.toDate(),{locale:this.$L,utc:!1})};var p=S.parse;S.parse=function(D){D.utc&&(this.$u=!0),this.$utils().u(D.$offset)||(this.$offset=D.$offset),p.call(this,D)};var k=S.init;S.init=function(){if(this.$u){var D=this.$d;this.$y=D.getUTCFullYear(),this.$M=D.getUTCMonth(),this.$D=D.getUTCDate(),this.$W=D.getUTCDay(),this.$H=D.getUTCHours(),this.$m=D.getUTCMinutes(),this.$s=D.getUTCSeconds(),this.$ms=D.getUTCMilliseconds()}else k.call(this)};var x=S.utcOffset;S.utcOffset=function(D,N){var P=this.$utils().u;if(P(D))return this.$u?0:P(this.$offset)?x.call(this):this.$offset;if(typeof D=="string"&&(D=function(I){I===void 0&&(I="");var H=I.match(a);if(!H)return null;var z=(""+H[0]).match(v)||["-",0,0],J=z[0],Y=60*+z[1]+ +z[2];return Y===0?0:J==="+"?Y:-Y}(D),D===null))return this;var T=Math.abs(D)<=16?60*D:D;if(T===0)return this.utc(N);var j=this.clone();if(N)return j.$offset=T,j.$u=!1,j;var Q=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(j=this.local().add(T+Q,c)).$offset=T,j.$x.$localOffset=Q,j};var L=S.format;S.format=function(D){var N=D||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return L.call(this,N)},S.valueOf=function(){var D=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*D},S.isUTC=function(){return!!this.$u},S.toISOString=function(){return this.toDate().toISOString()},S.toString=function(){return this.toDate().toUTCString()};var V=S.toDate;S.toDate=function(D){return D==="s"&&this.$offset?A(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():V.call(this)};var O=S.diff;S.diff=function(D,N,P){if(D&&this.$u===D.$u)return O.call(this,D,N,P);var T=this.local(),j=A(D).local();return O.call(T,j,N,P)}}})}(Is)),Is.exports}var fa=da();const Nl=e.getDefaultExportFromCjs(fa),Al=n=>{Te.dayjs.extend(Nl);const{categorySummaryData:d,serviceDetails:c,walletBalance:a,rightSegment:v,serviceItem:w,bill_date:l,handleRightSegment:A,getBillSummarydata:S,getPastDueAmount:p,refreshBillsList:k,closePrintModal:x,setRefreshWallet:L}=n,V=y.useContext(Tt);if(!V)throw new Error("ServiceLevelBillSummary must be used within an AppContext.Provider");const{patientDetails:O,patientIDs:D,billPreferences:N,setShowPrintModal:P,currentWindow:T,showPrintModal:j,variable:Q}=V,I=()=>{switch(w){case Et[0]:return"Consultation Bill";case Et[1]:return"Other Service Bill";case Et[2]:return"Lab Service Bill";default:return`${w} Bill`}},H=async(z,J,Y)=>{if(j?.visible&&x(),!d)return;const le=await Kl(d.order_id,D?.patientRoleID||"",Q),W=c.map(He=>({serviceName:He.service_name,price:+He.order_unit_item_price,gst:+He.order_item_service_tax,discount:+He.order_item_discount,netPrice:+He.net_amount,itemQty:+He.item_quantity})),me=+d.order_paid_amount,je=+d.refund_amount,ye=+d.balance_amount,et=+d.order_discount,pe=+d.order_item_sum_discount,$=+d.order_service_tax,ue={paymentStatus:me-je===0?"red":ye===0?"green":"yellow",paymentMode:le?.paymentModes?.length?le.paymentModes.join(", "):"",billedAmount:+d.order_total,discountAmount:et+pe,gstAmount:$,cgstAmount:($/2).toFixed(2),sgstAmount:($/2).toFixed(2),finalAmount:+d.net_bill_amount,receivedAmount:me,balanceAmount:ye,refundAmount:je},Ae=[O?.age&&typeof O.age=="number"?`${O.age}y`:O?.org_person_dob?pr(O.org_person_dob):"",O?.gender?Xr[O.gender]:"",O?.blood_group].filter(Boolean).join(", "),Fe={name:`${nr(O?.name??"")}${Ae?` (${Ae})`:""}`,billDate:Te.dayjs(d.order_date).format("DD-MMM-YYYY"),mobileNumber:O?.phone_number??"",email:O?.email??"",billNumber:d.order_id_str,patientId:O?.org_person_bid_str??"",patientIdForEmail:D?.patientRoleID??"",billStatus:ye===0?"PAID":"UNPAID",address:[O?.address,O?.city,O?.pincode].filter(Boolean).join(", "),referredBy:le?.lab_owner_name?nr(le.lab_owner_name):O?.ref_doc_name?nr(O.ref_doc_name):"--"};P({printDataFrom:"patient_popup",visible:!0,whichPreview:z,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:J,preferences:{...N?.print?.bill,...N?.org_details},billSummaryDetails:ue,billServiceDetails:W,billPatientDetails:Fe,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:d?.order_id}},trackEventHandler:()=>{console.log(Y)}})};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_arrow-left hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>A(ft[0])}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex hfl-items-center",children:[I()," : ",e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Primary-600",children:d?.order_id_str})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Gross Bill Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_total??0]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Discount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",+(d?.order_discount||0)+ +(d?.order_item_sum_discount||0)]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Tax Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_service_tax]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Net Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.net_bill_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Collected Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_paid_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Refund Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",d?.refund_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Net Paid Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Success-500",children:["₹ ",+(d?.order_paid_amount||0)-+(d?.refund_amount||0)]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Total Balance Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Warning-500 ",children:["₹ ",d?.balance_amount]})]}),e.jsxRuntimeExports.jsx(Sl,{showDiscount:T!==Rt[4],showRefund:T!==Rt[4],rightSegment:v,summaryData:d,getBillSummarydata:S,handleRightSegment:A,serviceItem:w,getPastDueAmount:p,date:l,refreshBillsList:k,setRefreshWallet:L,walletBalance:a})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-px-1 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Print",icon:"Left",onClick:()=>H("billPrintPreview",!1,"BILL_PRINT"),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>H("billSharePreview",!0,"BILL_SHARE"),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},Dl=({depositAmount:n,handleRightSegment:d,rightSegment:c,setRefreshWallet:a})=>e.jsxRuntimeExports.jsxs("div",{className:" hfl-flex hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-border-b hfl-border-Gray-200 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-px-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-1"}),e.jsxRuntimeExports.jsx("i",{className:"hx_arrow-left hfl-cursor-pointer hfl-text-4 hfl-font-inter-2",onClick:()=>{d()}}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text md",className:"hfl-flex hfl-items-center",children:"Deposit Amount"})]}),e.jsxRuntimeExports.jsx("i",{className:"hx_close hfl-cursor-pointer hfl-text-right hfl-text-4 hfl-font-inter-2",onClick:()=>{d()}})]}),e.jsxRuntimeExports.jsxs("div",{className:`${n>0?"hfl-bg-Success-50":"hfl-bg-Warning-50"} hfl-m-3 hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-rounded-lg hfl-border hfl-border-Gray-200 hfl-px-2 hfl-py-3`,children:[e.jsxRuntimeExports.jsx("span",{className:`hfl-text-5 hfl-font-inter-3 ${n>0?"hfl-text-Success-600":"hfl-text-Gray-800"} `,children:"₹"+n}),e.jsxRuntimeExports.jsx("span",{className:"hfl-mt-[-8px] hfl-text-1 hfl-text-Gray-500",children:"Balance"})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-px-3",children:e.jsxRuntimeExports.jsx(Sl,{rightSegment:c,showDeposit:!0,showPayment:!1,showDiscount:!1,showDepositRefund:!0,showRefund:!1,handleRightSegment:d,walletBalance:n,setRefreshWallet:a})})]}),pa=({closePrintModal:n})=>{if(!y.useContext(Tt))throw new Error("AddBills component must be used within an PatientPopupContext.Provider");const{patientDetails:d,patientIDs:c,billPreferences:a,setShowPrintModal:v,showPrintModal:w,setLoading:l,showToast:A,variable:S}=y.useContext(Tt),[p,k]=y.useState(new Date),[x,L]=y.useState(),[V,O]=y.useState(ft[0]),[D,N]=y.useState([]),[P,T]=y.useState([]),[j,Q]=y.useState(""),[I,H]=y.useState(),[z,J]=y.useState(!1),[Y,le]=y.useState(fl),[W,me]=y.useState("-1"),[je,ye]=y.useState({bill_summary:{},status:!1,message:""}),[et,pe]=y.useState(!1),[$,ue]=y.useState(0),M=B=>{Q(B)},Ae=async B=>{l(!0);try{await pt(B),k(B)}catch(De){console.error(De)}l(!1)},Fe=async()=>{try{const B=await un(c.patientRoleID,Te.dayjs(p).format("YYYY-MM-DD"),S);ye(B)}catch(B){console.error("Error in getBillSummary API Call:",B)}},He=()=>{le(B=>P.length>+W&&+W>=0?[...B.slice(0,+W),{order_id:P[W].order_id,order_date:P[W].order_date,order_created_on:P[W].order_created_on,service_category:P[W].service_category,service_category_id:P[W].service_category_id,order_id_str:P[W].order_id_str,order_total:P[W].order_total,order_paid_amount:P[W].order_paid_amount,order_item_sum_discount:P[W].order_item_sum_discount,order_discount:P[W].order_discount,refund_amount:P[W].refund_amount,order_service_tax:P[W].order_service_tax,balance_amount:P[W].balance_amount,net_bill_amount:P[W].net_bill_amount,order_item_id:P[W].order_item_id,service_id:P[W]?.service_id,service_name:P[W].service_name,item_quantity:P[W].item_quantity,order_unit_item_price:P[W].order_unit_item_price,order_item_price:P[W].order_item_price,order_item_discount:P[W].order_item_discount,order_item_service_tax:""+Math.floor(P[W].order_item_service_tax),order_item_service_tax_percent:P[W].order_item_service_tax_percent,net_amount:P[W].net_amount,created_on:P[W].created_on},...B.slice(+W+1)]:B)},mt=async()=>{try{const B=await Bs(Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,1,10,!0,S);J(B?.total_records>0)}catch{console.log("error in checkAppointmentForBilling API Call")}};y.useEffect(()=>{Fe(),at(),window?.partner_service_enabled!=="1"&&mt()},[p]);const pt=async(B=Te.dayjs().format("YYYY-MM-DD"))=>{l(!0);try{const De=await gl(Te.dayjs(B).format("YYYY-MM-DD"),c.patientRoleID,1,100,S);L(De),le(fl);const qe=De?.bill_list.flatMap(re=>{const{order_items:X,...Z}=re;return X.map(ie=>({...Z,...ie})).filter(ie=>Te.dayjs(ie?.created_on).format("YYYY-MM-DD")===Te.dayjs(new Date).format("YYYY-MM-DD"))});if(T(qe),De?.bill_list?.length){const re=De?.bill_list.reduce((X,Z)=>{const ie=Z.order_items.filter(Ie=>Te.dayjs(Ie?.created_on).isBefore(Te.dayjs(new Date).format("YYYY-MM-DD"))).map(Ie=>({...Ie,service_category:Z.service_category,service_category_id:Z.service_category_id}));return[...X,...ie]},[]);N(re)}else le(fl),N([])}catch{console.log("error in getBillsList API Call")}l(!1)};y.useEffect(()=>{pt()},[]);const nt=async()=>{try{const B=await Cl(c.patientRoleID,S);ue(B?.wallet_balance||0)}catch(B){console.error("Failed to fetch wallet balance:",B)}};y.useEffect(()=>{nt()},[et]);const Oe=y.useCallback(async()=>{try{const B=await yl(Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,!1,S);H(B)}catch(B){console.error("Error in getPastDueAmount API Call:",B)}},[p,yl,c.patientRoleID]);y.useEffect(()=>{Oe()},[Oe]);const at=(B=ft[0])=>{O(B)},Pt=B=>{switch(B?.original?.service_category.toLowerCase()){case Et[0].toLowerCase():at(ft[2]);break;case Et[1].toLowerCase():at(ft[4]);break;case Et[2].toLowerCase():at(ft[3]);break;default:at(ft[0]);break}},xt=(B,De)=>De.reduce((qe,re)=>qe+(parseInt(je.bill_summary[re]?.[B]||"0")||0),0),Nt=(B,De)=>De.map(qe=>je.bill_summary[qe]?.[B]).filter(qe=>qe),Bt=async(B,De,qe)=>{if(w?.visible&&n(),je?.bill_summary&&Object.keys(je?.bill_summary).length>0){const re=await On(Nt("order_id",B),c?.patientRoleID,S),X=[...new Set(B.map(vt=>re.paymentsData.get(vt)).flat())].map(vt=>ur[vt]??void 0)?.filter(vt=>vt),Z=xt("order_service_tax",B??[1,2,3]),ie={billedAmount:xt("order_total",B??[1,2,3]),gstAmount:Z,cgstAmount:(Z/2).toFixed(2),sgstAmount:(Z/2).toFixed(2),discountAmount:xt("order_item_sum_discount",B??[1,2,3])+xt("order_discount",B??[1,2,3]),finalAmount:xt("net_bill_amount",B??[1,2,3]),receivedAmount:xt("order_paid_amount",B??[1,2,3]),balanceAmount:xt("balance_amount",B??[1,2,3]),refundAmount:xt("refund_amount",B??[1,2,3])},Ee=[...Y,...D].filter(vt=>B.includes(parseInt(vt?.service_category_id))).map(vt=>({serviceName:vt.service_name,price:vt.order_unit_item_price,gst:Math.floor(vt.order_item_service_tax),discount:vt.order_item_discount,netPrice:vt.net_amount,itemQty:vt.item_quantity})),Jt=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?pr(d?.org_person_dob):"",Xr[d?.gender]??"",d?.blood_group].filter(vt=>vt).join(", ");v({printDataFrom:"patient_popup",visible:!0,whichPreview:De,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:qe,preferences:{...a?.print?.bill,...a?.org_details,...a?.branch_details},billSummaryDetails:{...ie,paymentStatus:parseInt(ie?.receivedAmount||"0")-parseInt(ie?.refundAmount||"0")===0?"red":parseInt(ie?.balanceAmount||"0")===0?"green":"yellow",paymentMode:X?.join(", ")},billServiceDetails:Ee,billPatientDetails:{name:nr(d?.name)+(Jt?` (${Jt}) `:""),billDate:Te.dayjs(p).format("DD-MMM-YYYY"),mobileNumber:d?.phone_number,email:d?.email,billNumber:Nt("order_id_str",B)?.toString(),patientId:d?.org_person_bid_str,patientIdForEmail:c.patientRoleID,billStatus:parseInt(ie?.balanceAmount||"0")===0?"PAID":"UNPAID",address:[d?.address??"",d?.city??"",d?.pincode??""].filter(vt=>vt).join(", "),referredBy:re?.lab_owner_name?nr(re?.lab_owner_name):d?.ref_doc_name?nr(d?.ref_doc_name):"--"},isWholeBill:B.length===3,payloadDataforEmail:{orderDate:B.length===3?Te.dayjs(p).format("YYYY-MM-DD"):"",orderNumber:B.length===3?"":Nt("order_id",B)?.toString()}},trackEventHandler:vt=>{console.log("Bill Print Event",vt)}})}else A("Error","Please add a service to create bill","Error",3e3)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx(la,{tab:"add_bills",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-h-full hfl-overflow-auto ${V===ft[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-ml-4 hfl-mr-1 hfl-flex hfl-flex-col hfl-gap-1 hfl-self-stretch",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Gray-700",children:"Bill Date :"}),e.jsxRuntimeExports.jsx("div",{"data-qa":"calendar",children:e.jsxRuntimeExports.jsx(e.ZC,{selectDate:new Date(Te.dayjs(p).format("DD-MMM-YYYY")),dateVar:B=>{k(B),Ae(B)},maxDate:new Date})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"Today",className:"hfl-h-10",onClick:()=>Ae(new Date),"data-qa":"today"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:" hfl-text-Success-500",children:$}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>at(ft[7])})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"-hfl-gap-[1px] hfl-flex hfl-h-[590px] hfl-flex-col hfl-items-start",children:[e.jsxRuntimeExports.jsx(Ol,{tableBodyData:P,tableData:Y,isDisabled:!1,addBillButton:!0,handleEditRow:Pt,handleRightSegment:at,setTableData:le,setEditRowId:me,getBillSummarydata:Fe,refreshBillsList:pt}),D&&D?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-py-3 hfl-text-Gray-700",children:["Old Bill"," "]}),e.jsxRuntimeExports.jsx(Ol,{tableBodyData:D,tableData:D,isDisabled:!0,addBillButton:!1,handleEditRow:Pt,handleRightSegment:at,setTableData:le,setEditRowId:me,getBillSummarydata:()=>{},refreshBillsList:()=>{}})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:" mt-2 hfl-sticky hfl-bottom-0 hfl-w-full",children:z&&e.jsxRuntimeExports.jsx(sa,{})})]})}),e.jsxRuntimeExports.jsxs(Pl,{tab:"add_bills",children:[V===ft[0]&&e.jsxRuntimeExports.jsx(na,{summaryData:je,date:p,rightSegment:V,handleRightSegment:at,billSummaryClicked:(B,De,qe)=>Bt(B,De,qe),showDiscount:!1,showRefund:!1,handleServiceItem:M,pastDueData:I,getBillSummarydata:Fe,refreshBillsList:pt,getPastDueAmount:Oe,walletBalance:$,setRefreshWallet:pe}),V===ft[1]&&e.jsxRuntimeExports.jsx(Al,{bill_date:p,rightSegment:V,serviceDetails:x?.bill_list.find(B=>B.service_category.toLowerCase()===j.toLowerCase())?.order_items??[],categorySummaryData:je?.bill_summary[`${Et.indexOf(j)+1}`],serviceItem:j,handleRightSegment:at,getBillSummarydata:Fe,refreshBillsList:pt,getPastDueAmount:Oe,walletBalance:$,setRefreshWallet:pe,closePrintModal:n}),V===ft[2]&&e.jsxRuntimeExports.jsx(oa,{bill_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[W],setTableData:le,editRowId:W,handleRevertEdit:He,refreshBillsList:pt,checkAppointmentForBilling:mt}),V===ft[4]&&e.jsxRuntimeExports.jsx(ua,{order_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[W],setTableData:le,editRowId:W,refreshBillsList:pt,handleRevertEdit:He}),V===ft[3]&&e.jsxRuntimeExports.jsx(aa,{order_date:p,handleRightSegment:at,editedTableData:Y?.[W],getBillSummarydata:Fe,setTableData:le,editRowId:W,refreshBillsList:pt,handleRevertEdit:He}),V===ft[7]&&e.jsxRuntimeExports.jsx(Dl,{depositAmount:$,handleRightSegment:at,rightSegment:V,setRefreshWallet:pe})]})]})},bl=n=>{const{appointments:d,isDisabled:c,handleAppointData:a,leftNav:v,today:w}=n,l=y.useCallback(N=>{a(N)},[a]),A=y.useMemo(()=>[{Header:"Date",accessor:"appnt_date",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[130px] hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:` ${c?"":"hfl-rounded-sm hfl-bg-Success-50 hfl-px-2 hfl-text-Success-600"} `,children:Te.dayjs(N?.original?.appnt_date).format("DD-MMM-YYYY")})})},{Header:"Time",accessor:"appnt_time",Cell:({row:N})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:" ",children:N?.original?.appnt_time&&new Date("1970-01-01T"+N?.original?.appnt_time+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"})})},{Header:"Status",accessor:"appnt_status",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:" hfl-flex hfl-w-[100px] hfl-items-center hfl-justify-center focus:hfl-outline-none",children:e.jsxRuntimeExports.jsx(e.bi,{className:" hfl-flex hfl-w-[100px] hfl-items-center focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:xl.find(P=>P.value==N?.original?.appnt_status)?.text})})},{Header:"Doctor",accessor:"appnt_doctor_name",Cell:({row:N})=>e.jsxRuntimeExports.jsx(e.bi,{className:" hfl-flex hfl-w-[316px] hfl-items-center hfl-capitalize focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:"Dr. "+N.original.appnt_doctor_name})},{Header:"Type",accessor:"order_unit_item_price",Cell:()=>e.jsxRuntimeExports.jsx(e.bi,{className:" hfl-flex hfl-w-[100px] hfl-items-center focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:"In-Person"})},{Header:"Service",accessor:"appnt_service_name",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:" [100px] hfl-flex hfl-items-center hfl-justify-center ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-w-[116px] hfl-items-center hfl-capitalize",children:N.original.appnt_service_name})})},{Header:"Bill",accessor:"total_price",Cell:({row:N})=>N.original.order_item_id!=0||c||v!="today"?e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-text-Error-500 ",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-w-[106px] hfl-items-center",children:N.original.total_price})]}):e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"",icon:"Left",iconFile:"hx_rupee-bill-filled hfl-text-3",onClick:()=>{l(N.original)},children:"Add Bill"})},{Header:"",accessor:"edit",Cell:({row:N})=>e.jsxRuntimeExports.jsx("i",{className:` ${c?"hfl-text-White":""} ${v==="today"&&"hx_edit"} hfl-p-4 hfl-text-Primary-700 `,onClick:()=>{v==="today"&&l(N.original)},"data-qa":"edit-icon"})}],[l,c,v]),S=y.useMemo(()=>d||[],[d]),{getTableProps:p,getTableBodyProps:k,headerGroups:x,rows:L,prepareRow:V}=Jr.useTable({columns:A,data:S}),O=N=>{const P=[];return N?.headers?.length&&N.headers.map(T=>{P.push(e.jsxRuntimeExports.jsx("th",{...T.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:T.render("Header")})}))}),P},D=()=>{const N=[];return L.map((P,T)=>{V(P),N.push(e.jsxRuntimeExports.jsx("tr",{"data-qa":T+1+"",...P.getRowProps(),className:`${P?.original?.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200 ${c?"hfl-bg-Gray-100":""}`,children:P.cells.map(j=>e.jsxRuntimeExports.jsx("td",{"data-qa":T+1+"-"+j.column.id,...j.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`${P?.original?.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:j.render("Cell")})}))}))}),N};return e.jsxRuntimeExports.jsx("div",{className:`${c?" hfl-pointer-events-none":"hfl-cursor-pointer"} ${w?" hfl-h-[500px] hfl-overflow-y-scroll":""} `,children:d&&e.jsxRuntimeExports.jsxs("table",{...p(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:x.map(N=>e.jsxRuntimeExports.jsx("tr",{...N.getHeaderGroupProps(),className:"hfl-h-9 hfl-rounded-lg hfl-bg-Blue_gray-50 hfl-py-2",children:O(N)}))}),e.jsxRuntimeExports.jsx("tbody",{...k(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:D()})]})})},Qr=n=>{const{currentPage:d,totalRecord:c,handleLoadMore:a,isLoading:v=!1,currentTotal:w}=n;return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[!v&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-text-Gray-500",children:`1 — ${w} of ${c} results`}),w!==c?e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-text-Blue-^00 hfl-flex hfl-justify-center",hierarchy:"Link-Colour",size:"lg",textField:"Load more... ",onClick:()=>a(d)}):e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-text-Gray-500",children:"End of List"})]}),v&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.Eu,{size:"xxs",progress:10,spinnerMode:!0})})]})},ha=n=>{const{handleAddNewAppnt:d,handleAppointData:c,sortAppointments:a}=n,[v,w]=y.useState(),[l,A]=y.useState(1),[S,p]=y.useState([]),[k,x]=y.useState([]),[L,V]=y.useState(""),{patientIDs:O,setLoading:D,variable:N}=y.useContext(Tt),P=async T=>{let j=T;if(D(!0),j<=Math.ceil((v?.total_records||0)/10)){if(j=T+1,j!==T){const Q=await Bs("all",O?.patientRoleID||"",j,10,!1,N);p(I=>[...I,...Q.appointments.filter(H=>H.appnt_date>=Te.dayjs(new Date).format("YYYY-MM-DD"))]),x(I=>[...I,...Q.appointments.filter(H=>H.appnt_date<Te.dayjs(new Date).format("YYYY-MM-DD"))])}A(j)}D(!1)};return y.useEffect(()=>{D(!0);const T=async()=>{try{const j=await Bs("all",O?.patientRoleID||"",1,10,!1,N);j&&(w(j),p(j?.appointments?.filter(Q=>Q.appnt_date>=Te.dayjs(new Date).format("YYYY-MM-DD"))),x(j?.appointments?.filter(Q=>Q.appnt_date<Te.dayjs(new Date).format("YYYY-MM-DD")))),V(j?.appointments?.length?"":"No Appointment")}catch{console.log("error in getAppointmentsList API Call")}};D(!1),T()},[O?.patientRoleID,D,N]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-max-h-[550px] hfl-w-full hfl-flex-col hfl-overflow-y-scroll",children:[S.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-justify-between hfl-px-3 hfl-py-2 ",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"",children:"Upcoming Appointments"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"new-appointment",hierarchy:"Primary",size:"md",className:"text",icon:"Left",iconFile:"hx_add-circle",textField:"New Appointment",onClick:d})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 ",children:e.jsxRuntimeExports.jsx(bl,{appointments:a(S),handleAppointData:c})})]}),k.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-w-full hfl-items-center hfl-px-3 hfl-py-2 hfl-pt-4 ",children:"Past Appointments"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 hfl-pb-4 xxs:max-md:hfl-w-[885px] xxs:max-md:hfl-overflow-y","data-qa":"all-appoint-table",children:e.jsxRuntimeExports.jsx(bl,{isDisabled:!0,appointments:k,handleAppointData:c})})]})]}),k.length>0||S.length>0?e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Qr,{currentPage:l,totalRecord:v?.total_records||0,currentTotal:l===Math.ceil((v?.total_records||0)/10)?v?.total_records||0:l*10,handleLoadMore:P})}):e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-w-full hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:L})})]})},ma=()=>{const{showToast:n,patientDetails:d,doctorListArr:c,serviceListArr:a,patientIDs:v,setLoading:w,billPreferences:l,docPreference:A,formattedService:S,ppEventProps:p,getAndSetServiceListArr:k,variable:x}=y.useContext(Tt),[L,V]=y.useState(x.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?.length?!0:l?.billing?.prepaid_consultation!=="1"),[O,D]=y.useState("today"),[N,P]=y.useState(!1),[T,j]=y.useState([]),Q=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),I=y.useMemo(()=>c?.doctor_list?.length===1?c.doctor_list[0]:{doctor_name:"",doctor_identifier:""},[c]),H=y.useMemo(()=>({...zl,deleted:!1,appnt_date:Te.dayjs().format("YYYY-MM-DD"),appnt_doctor_name:x.window_var.role_id=="11"?x.window_var.doc_name_for_seg:I?.doctor_name,appnt_doctor_role_id:x.window_var.role_id=="11"?x.window_var.doctor_role_id_for_seg:I?.doctor_identifier,appnt_duration:l?.print?.bill?.appnt_minute_slab||"",appnt_time_time:Q?.split(" ")[0]||"",appnt_time_format:Q?.split(" ")[1]||"",total_price:"0",order_item_service_tax_percentage:0,order_item_service_tax:"0",item_quantity:"1",order_unit_item_price:"0",order_item_price:"0",order_id:"",order_date:"",order_created_on:"",service_category:"",service_category_id:"",order_id_str:"",order_total:"",order_paid_amount:"",order_item_sum_discount:"",order_discount:"",refund_amount:"",order_service_tax:"",balance_amount:"",net_bill_amount:"",service_id:"",service_name:"",order_item_service_tax_percent:"",created_on:"",net_amount:""}),[l?.print?.bill?.appnt_minute_slab,Q,I?.doctor_identifier,I?.doctor_name,x.window_var.doc_name_for_seg,x.window_var.doctor_role_id_for_seg,x.window_var.role_id]),[z,J]=y.useState(H),[Y,le]=y.useState(!1);y.useEffect(()=>{V(x.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?!0:l?.billing?.prepaid_consultation!=="1")},[N,l,O,d,x.window_var?.partner_service_enabled]),y.useEffect(()=>{le(B=>L&&B)},[L]),y.useEffect(()=>{if(!+z?.order_item_id&&!z?.order_unit_item_price){const B=S?.[z.appnt_service_id];B&&J(De=>({...De,order_unit_item_price:B.price.toString(),item_quantity:"1",order_item_discount:"0",order_item_service_tax_percentage:B?.service_tax||0}))}},[L,N,z.order_item_id,z.order_unit_item_price,z.appnt_service_id,S]);const W=y.useCallback(B=>{const{order_unit_item_price:De=0,item_quantity:qe=0,order_item_discount:re=0,appnt_service_id:X}=B;if(!X)return;let Z=0;const ie=S?.[X]?.service_tax||0;let Ie=0;if(Number(De)>0&&Number(qe)>0){const Ee=Number(De)*Number(qe);Z=Math.floor(Ee*.01*ie),Ie=Ee+Z-Number(re)}J(Ee=>({...Ee,order_item_service_tax:Z.toString(),order_item_price:Ie.toString()}))},[S]),me=y.useMemo(()=>[{...z,order_item_service_tax:Math.floor(+z.order_item_service_tax).toString()}],[z]),je=B=>{xt();const De=new Date(`1970-01-01T${B.appnt_time}Z`).toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});J(qe=>({...qe,...B,appnt_time_time:De?.split(" ")[0]??"",appnt_time_format:De?.split(" ")[1]??"",order_item_service_tax_percentage:S?.[B.appnt_service_id]?.service_tax||0,order_item_price:B.total_price.toString(),deleted:!1}))},ye=(B,De)=>{if(B==="appnt_service_name"){const{appnt_service_name:qe,appnt_service_id:re,order_item_discount:X,order_unit_item_price:Z,item_quantity:ie,order_item_service_tax_percentage:Ie}=De,Ee={...z,appnt_service_name:qe,appnt_service_id:re,order_unit_item_price:Z,item_quantity:ie,order_item_discount:X,order_item_service_tax_percentage:Ie};J(Ee),W(Ee)}else B==="appnt_date"&&De>Te.dayjs().format("YYYY-MM-DD")&&(V(!0),L||n("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),J(qe=>({...qe,[B]:De}))},et=()=>{V(B=>!B)},pe=()=>{le(B=>!B)},$=(B,De)=>{J(qe=>({...qe,[De]:B}))};y.useEffect(()=>{W(z)},[z.order_unit_item_price,z.item_quantity,z.order_item_discount,W,z]);const ue=B=>[...B].sort((De,qe)=>new Date(De.appnt_date).getTime()-new Date(qe.appnt_date).getTime()),M=y.useMemo(()=>[{Header:"Unit Price",accessor:"order_unit_item_price",Cell:({row:B})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),A?.permissions?.edit_service_unit_price?e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:B?.original?.order_unit_item_price,onChange:De=>$(De.target.value,"order_unit_item_price")}):e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:B?.original?.order_unit_item_price})]})},{Header:"Qty",accessor:"item_quantity",Cell:({row:B})=>e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:B?.original?.item_quantity,onChange:De=>$(De.target.value,"item_quantity")})},{Header:"Discount",accessor:"order_item_discount",Cell:({row:B})=>e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:B?.original?.order_item_discount,onChange:De=>$(De.target.value,"order_item_discount")})},{Header:"GST in %",accessor:"order_item_service_tax_percentage",Cell:({row:B})=>{const De=Number(B?.original?.appnt_service_id||"0");return e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:S?.[De]?.service_tax||0,readOnly:!0})}},{Header:"GST In Rs",accessor:"order_item_service_tax",Cell:({row:B})=>e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center",value:B?.original?.order_item_service_tax,readOnly:!0})},{Header:"Net Price",accessor:"order_item_price",Cell:({row:B})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-text-Error-500 ",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),e.jsxRuntimeExports.jsx("input",{type:"number",className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center",value:B?.original?.order_item_price,readOnly:!0})]})}],[A?.permissions?.edit_service_unit_price,S]),Ae=y.useMemo(()=>me,[me]),{getTableProps:Fe,getTableBodyProps:He,headerGroups:mt,rows:pt,prepareRow:nt}=Jr.useTable({columns:M,data:Ae}),Oe=B=>{const De=[];return B?.headers?.length&&B.headers.map(qe=>{De.push(e.jsxRuntimeExports.jsx("th",{...qe.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Indigo-600",children:qe.render("Header")})}))}),De},at=()=>{const B=[];return pt.map((De,qe)=>{nt(De),B.push(e.jsxRuntimeExports.jsx("tr",{id:qe.toString(),...De.getRowProps(),className:`${De?.original?.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200`,children:De.cells.map(re=>e.jsxRuntimeExports.jsx("td",{"data-qa":qe+1+"-"+re.column.id,...re.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`${De?.original?.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:re.render("Cell")})}))}))}),B},Pt=(B,De,qe)=>e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[60px] hfl-flex-col hfl-items-center hfl-rounded hfl-px-1 hfl-py-2 hfl-text-center ${O===B?"hfl-bg-Primary-50 hfl-text-Primary-600":""} hfl-cursor-pointer`,onClick:()=>D(B),"data-qa":B,children:[e.jsxRuntimeExports.jsx("div",{className:De}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:qe})]},B),xt=y.useCallback(()=>{D("today"),J(H),P(!0)},[H]),Nt=y.useCallback(async()=>{w(!0);try{const B=await Bs(O=="today"?Te.dayjs().format("YYYY-MM-DD"):"all",v?.patientRoleID||"",1,O=="today"?100:10,!1,x);j(B?.appointments?.filter(De=>De.appnt_date===Te.dayjs().format("YYYY-MM-DD"))),B.appointments.length===0&&xt(),w(!1)}catch{w(!1),console.log("error in getAppointmentsList API Call")}},[xt,O,v?.patientRoleID,w,x]);y.useEffect(()=>{N||Nt()},[N,Nt]),y.useEffect(()=>{O==="today"&&Nt()},[Nt,O]);const Bt=async()=>{z.appnt_date>Te.dayjs().format("YYYY-MM-DD")&&(V(!0),L||n("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),await Zl(z,L||z.appnt_date>Te.dayjs().format("YYYY-MM-DD"),n,d,v,p,Y,!1,x)&&P(!1)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-4 hfl-border-r-1 hfl-border-Gray-200 hfl-bg-Gray-50 hfl-px-1 hfl-py-2",children:[Pt("today","hx_calendar-add hfl-text-5","Today's Appts"),Pt("all","hx_calendar hfl-text-5","All Appts")]}),O==="today"&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto",children:T.length<=0||N?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 hfl-self-stretch hfl-bg-Gray-100 hfl-p-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-flex-1",children:z.appnt_id.length?"Update Appointment":"New Appointment"}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{P(!1)},"data-qa":"close-new-ppointment"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-item-center hfl-flex hfl-flex-col hfl-gap-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[739px] hfl-flex-wrap hfl-content-start hfl-items-start hfl-gap-6",children:[e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:z.appnt_doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-relative hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[270px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",suffixOptions:c?.doctor_list?.map(B=>({label:B.doctor_name,value:B.doctor_name,appnt_doctor_role_id:B.doctor_identifier})),handleSuffixValChange:B=>{ye("appnt_doctor_name",B),ye("appnt_doctor_role_id","")},onSuffixDropdownClick:B=>{ye("appnt_doctor_name",B.label),ye("appnt_doctor_role_id",B.appnt_doctor_role_id)}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[350px] hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Date & Time of Appointment"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-gap-2 ",children:[e.jsxRuntimeExports.jsx(e.ZC,{placeholder:"Today",height:"!hfl-h-[40px]",selectDate:new Date(Te.dayjs(z.appnt_date).format("DD-MMM-YYYY")),dateVar:B=>{ye("appnt_date",Te.dayjs(B).format("YYYY-MM-DD"))},isborderRequired:!0,minDate:new Date}),e.jsxRuntimeExports.jsx(e.tj,{className:"hfl-w-24",suffixClassName:"hfl-w-10 ",suffixDropdownClassName:"hfl-ml-[96px]",input1value:z?.appnt_time_time||"",input2value:z?.appnt_time_format||"",end_icon:"hx_down",classNamedoubleInput:"hfl-relative",inputProps:{placeholder:"10:00",onBlur:B=>{ye("appnt_time_time",B.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:B=>{ye("appnt_time_format",B.value)}})]})]}),z.appnt_id.length>1&&z.order_item_id.length>1?e.jsxRuntimeExports.jsx(e.tj,{label:"Service",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hfl-bg-White_20",input2value:z.appnt_service_name,inputProps:{disabled:!0},widthSufixDrpdwn:"hfl-w-[350px]",suffixInputProps:{placeholder:"Service Name",disabled:!0},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500 ",classNamedoubleInput:"hfl-relative",suffixClassName:" hfl-border-l-0 hfl-w-[318px] hfl-text-ellipsis hfl-bg-White_20"}):e.jsxRuntimeExports.jsx(e.tj,{label:"Service",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hx_down hfl-bg-White_20",input2value:z.appnt_service_name,inputProps:{disabled:!1},widthSufixDrpdwn:"hfl-w-[350px]",suffixInputProps:{placeholder:"Service Name",onClick:async()=>{a?.service_list?.length||k()}},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500 ",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-border-l-0 hfl-w-[318px] hfl-text-ellipsis hfl-bg-White_20",suffixOptions:a?.service_list?.filter(B=>B.service_category==="Doctor consultation")?.map(B=>({label:B.service_name,value:B.service_name,appnt_service_id:B.service_identifier,order_unit_item_price:B.price,item_quantity:1,order_item_discount:B.order_item_discount||0,order_item_service_tax_percentage:B.service_tax,appnt_service_name:B.service_name})),handleSuffixValChange:B=>{ye("appnt_service_name",{appnt_service_name:B})},onSuffixDropdownClick:B=>{ye("appnt_service_name",B)}}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ir.find(B=>B.value==Number(z.appnt_duration))?.label||"",value:z.appnt_duration},label:"Duration",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:B=>{ye("appnt_duration",B.value)},options:Ir,"data-qa":"time picker"}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:xl.find(B=>B.value==z?.appnt_status)?.text||""},label:"Booking Status",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:B=>{ye("appnt_status",B.value)},options:xl.map(B=>({label:B.text,value:B.value})),"data-qa":"click-status"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[350px] hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Type"}),e.jsxRuntimeExports.jsx(e.ju,{options:[{start_icon:"hx_inperson hfl-text-3",label:"In-Person",value:"inperson"}],disabled:!1,value:"inperson","data-qa":"data-type"})]}),x.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?.length&&e.jsxRuntimeExports.jsx(e.Oi,{size:"md",disabled:!1,isMarked:Y,text:"Partner Enabled",onClick:pe,"data-qa":"skip-billing"}),!+z?.order_item_id&&e.jsxRuntimeExports.jsx(e.Oi,{size:"md",disabled:!1,isMarked:L,text:"Skip Billing",onClick:et,"data-qa":"skip-billing"})]}),!L||+z?.order_item_id?e.jsxRuntimeExports.jsx("div",{className:`${+z?.appnt_id&&+z?.order_item_id?"hfl-pointer-events-none":""}`,children:e.jsxRuntimeExports.jsxs("table",{...Fe(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:mt.map(B=>e.jsxRuntimeExports.jsx("tr",{...B.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50",children:Oe(B)}))}),e.jsxRuntimeExports.jsx("tbody",{...He(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:at()})]})}):"",e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"No",className:"hfl-w-[150px] hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{P(!1)},"data-qa":"cancel"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:z.appnt_id.length?"Update Appointment":"Book Appointment",icon:"No",onClick:Bt,className:"hfl-w-[150px] hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800","data-qa":"book-appointment"})]})]})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-justify-between hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:"Today’s Appointments"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"new-appointment",hierarchy:"Primary",size:"md",className:"text",icon:"Left",iconFile:"hx_add-circle",textField:"New Appointment",onClick:xt})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 ","data-qa":"appointment-table",children:e.jsxRuntimeExports.jsx(bl,{today:!0,leftNav:O,appointments:ue(T),handleAppointData:je})})]})}),O==="all"&&e.jsxRuntimeExports.jsx(ha,{sortAppointments:ue,handleAddNewAppnt:xt,handleAppointData:je})]})},xa=({columns:n,data:d})=>{const{getTableProps:c,getTableBodyProps:a,headerGroups:v,rows:w,prepareRow:l}=Jr.useTable({columns:n,data:d}),A=p=>{const k=[];return p?.headers?.length&&p.headers.map(x=>{k.push(e.jsxRuntimeExports.jsx("th",{...x.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:x.render("Header")})}))}),k},S=()=>{const p=[];return w.map((k,x)=>{l(k),p.push(e.jsxRuntimeExports.jsx("tr",{id:x.toString(),...k.getRowProps(),className:`${k.original.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-border-t-1 hfl-border-Gray-200`,children:k.cells.map((L,V)=>e.jsxRuntimeExports.jsx("td",{"data-qa":x+1+"-"+(V+1),...L.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`hfl-text-[13px] ${k.original.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:L.render("Cell")})}))}))}),p};return e.jsxRuntimeExports.jsx("div",{className:"hfl-max-h-[55vh] hfl-overflow-y-auto xxs:max-md:hfl-overflow-x-auto hfl-overflow-x-hidden","data-qa":"past-visit-table",children:e.jsxRuntimeExports.jsxs("table",{...c(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:v.map(p=>e.jsxRuntimeExports.jsx("tr",{...p.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50 ",children:A(p)}))}),e.jsxRuntimeExports.jsx("tbody",{...a(),className:"hfl-rounded-",children:S()})]})})},ga="data:image/svg+xml,%3csvg%20width='87'%20height='86'%20viewBox='0%200%2087%2086'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='43.5'%20cy='83.42'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M17.179%2014.1224C16.5958%2013.0118%2015.2122%2012.5787%2014.0887%2013.1552C12.9651%2013.7317%2012.5271%2015.0994%2013.1102%2016.21L15.2825%2020.347C15.8657%2021.4576%2017.2493%2021.8906%2018.3729%2021.3141C19.4964%2020.7377%2019.9345%2019.37%2019.3513%2018.2593L17.179%2014.1224ZM14.8903%2014.6818C15.1609%2014.543%2015.4942%2014.6473%2015.6346%2014.9148L17.8069%2019.0517C17.9474%2019.3193%2017.8419%2019.6487%2017.5712%2019.7875C17.3006%2019.9264%2016.9674%2019.8221%2016.8269%2019.5546L14.6546%2015.4176C14.5141%2015.1501%2014.6196%2014.8207%2014.8903%2014.6818ZM22.9352%2024.0112C20.0523%2024.0112%2017.7152%2026.3214%2017.7152%2029.1712V65.3801C17.7152%2068.2299%2020.0523%2070.5401%2022.9352%2070.5401H57.7352C60.6181%2070.5401%2062.9552%2068.2299%2062.9552%2065.3801V59.7953C59.3146%2057.7135%2056.8652%2053.8225%2056.8652%2049.366C56.8652%2044.9095%2059.3146%2041.0186%2062.9552%2038.9368V29.1712C62.9552%2026.3214%2060.6181%2024.0112%2057.7352%2024.0112H54.1652V25.3157C54.1652%2027.6905%2052.2177%2029.6157%2049.8152%2029.6157H32.5952C30.1928%2029.6157%2028.2452%2027.6905%2028.2452%2025.3157V24.0112H22.9352ZM64.6952%2038.1166V29.1712C64.6952%2025.3714%2061.5791%2022.2912%2057.7352%2022.2912H46.2996C45.7087%2020.0557%2043.6519%2018.406%2041.2052%2018.406C38.7586%2018.406%2036.7018%2020.0557%2036.1109%2022.2912H22.9352C19.0913%2022.2912%2015.9752%2025.3714%2015.9752%2029.1712V65.3801C15.9752%2069.1798%2019.0913%2072.2601%2022.9352%2072.2601H57.7352C61.5791%2072.2601%2064.6952%2069.1798%2064.6952%2065.3801V60.6155C66.0461%2061.1262%2067.5126%2061.406%2069.0452%2061.406C75.772%2061.406%2081.2252%2056.0155%2081.2252%2049.366C81.2252%2042.7165%2075.772%2037.326%2069.0452%2037.326C67.5126%2037.326%2066.0461%2037.6058%2064.6952%2038.1166ZM6.33244%2020.881C6.89862%2019.7618%208.27544%2019.3082%209.40766%2019.8679L13.625%2021.9526C14.7572%2022.5123%2015.2161%2023.8733%2014.6499%2024.9925C14.0837%2026.1117%2012.7069%2026.5652%2011.5747%2026.0056L7.35734%2023.9209C6.22512%2023.3612%205.76626%2022.0002%206.33244%2020.881ZM8.62943%2021.4063C8.35671%2021.2715%208.02508%2021.3807%207.8887%2021.6503C7.75233%2021.9199%207.86286%2022.2477%208.13557%2022.3825L12.3529%2024.4672C12.6256%2024.602%2012.9572%2024.4928%2013.0936%2024.2232C13.23%2023.9536%2013.1195%2023.6258%2012.8468%2023.491L8.62943%2021.4063ZM36.2851%2041.3145C36.2851%2040.127%2037.2589%2039.1645%2038.4601%2039.1645H53.2501C54.4513%2039.1645%2055.4251%2040.127%2055.4251%2041.3145C55.4251%2042.5019%2054.4513%2043.4645%2053.2501%2043.4645H38.4601C37.2589%2043.4645%2036.2851%2042.5019%2036.2851%2041.3145ZM38.4601%2049.2325C37.2589%2049.2325%2036.2851%2050.1951%2036.2851%2051.3825C36.2851%2052.5699%2037.2589%2053.5325%2038.4601%2053.5325H53.2501C54.4513%2053.5325%2055.4251%2052.5699%2055.4251%2051.3825C55.4251%2050.1951%2054.4513%2049.2325%2053.2501%2049.2325H38.4601ZM38.0251%2051.3825C38.0251%2051.145%2038.2199%2050.9525%2038.4601%2050.9525H53.2501C53.4903%2050.9525%2053.6851%2051.145%2053.6851%2051.3825C53.6851%2051.62%2053.4903%2051.8125%2053.2501%2051.8125H38.4601C38.2199%2051.8125%2038.0251%2051.62%2038.0251%2051.3825ZM36.2851%2061.9099C36.2851%2060.7225%2037.2589%2059.7599%2038.4601%2059.7599H53.2501C54.4513%2059.7599%2055.4251%2060.7225%2055.4251%2061.9099C55.4251%2063.0974%2054.4513%2064.0599%2053.2501%2064.0599H38.4601C37.2589%2064.0599%2036.2851%2063.0974%2036.2851%2061.9099ZM38.4601%2061.4799C38.2199%2061.4799%2038.0251%2061.6725%2038.0251%2061.9099C38.0251%2062.1474%2038.2199%2062.3399%2038.4601%2062.3399H53.2501C53.4903%2062.3399%2053.6851%2062.1474%2053.6851%2061.9099C53.6851%2061.6725%2053.4903%2061.4799%2053.2501%2061.4799H38.4601ZM26.5647%2040.5435C26.5647%2039.1186%2027.7333%2037.9635%2029.1747%2037.9635H30.5547C31.9962%2037.9635%2033.1647%2039.1186%2033.1647%2040.5435V41.9076C33.1647%2043.3325%2031.9962%2044.4876%2030.5547%2044.4876H29.1747C27.7333%2044.4876%2026.5647%2043.3325%2026.5647%2041.9076V40.5435ZM29.1747%2048.0315C27.7333%2048.0315%2026.5647%2049.1866%2026.5647%2050.6115V51.9757C26.5647%2053.4006%2027.7333%2054.5557%2029.1747%2054.5557H30.5547C31.9962%2054.5557%2033.1647%2053.4006%2033.1647%2051.9757V50.6115C33.1647%2049.1866%2031.9962%2048.0315%2030.5547%2048.0315H29.1747ZM28.3047%2050.6115C28.3047%2050.1366%2028.6942%2049.7515%2029.1747%2049.7515H30.5547C31.0352%2049.7515%2031.4247%2050.1366%2031.4247%2050.6115V51.9757C31.4247%2052.4506%2031.0352%2052.8357%2030.5547%2052.8357H29.1747C28.6942%2052.8357%2028.3047%2052.4506%2028.3047%2051.9757V50.6115ZM26.5647%2061.139C26.5647%2059.7141%2027.7333%2058.559%2029.1747%2058.559H30.5547C31.9962%2058.559%2033.1647%2059.7141%2033.1647%2061.139V62.5031C33.1647%2063.928%2031.9962%2065.0831%2030.5547%2065.0831H29.1747C27.7333%2065.0831%2026.5647%2063.928%2026.5647%2062.5031V61.139ZM29.1747%2060.279C28.6942%2060.279%2028.3047%2060.664%2028.3047%2061.139V62.5031C28.3047%2062.9781%2028.6942%2063.3631%2029.1747%2063.3631H30.5547C31.0352%2063.3631%2031.4247%2062.9781%2031.4247%2062.5031V61.139C31.4247%2060.664%2031.0352%2060.279%2030.5547%2060.279H29.1747ZM58.6052%2049.366C58.6052%2043.6665%2063.2793%2039.046%2069.0452%2039.046C74.811%2039.046%2079.4852%2043.6665%2079.4852%2049.366C79.4852%2055.0656%2074.811%2059.686%2069.0452%2059.686C63.2793%2059.686%2058.6052%2055.0656%2058.6052%2049.366ZM66.8702%2043.776C66.8702%2042.5886%2067.844%2041.626%2069.0452%2041.626C70.2464%2041.626%2071.2202%2042.5886%2071.2202%2043.776V48.936C71.2202%2050.1235%2070.2464%2051.086%2069.0452%2051.086C67.844%2051.086%2066.8702%2050.1235%2066.8702%2048.936V43.776ZM69.0452%2043.346C68.8049%2043.346%2068.6102%2043.5386%2068.6102%2043.776V48.936C68.6102%2049.1735%2068.8049%2049.366%2069.0452%2049.366C69.2854%2049.366%2069.4802%2049.1735%2069.4802%2048.936V43.776C69.4802%2043.5386%2069.2854%2043.346%2069.0452%2043.346ZM69.0452%2057.106C67.844%2057.106%2066.8702%2056.1435%2066.8702%2054.956C66.8702%2053.7686%2067.844%2052.806%2069.0452%2052.806C70.2464%2052.806%2071.2202%2053.7686%2071.2202%2054.956C71.2202%2056.1435%2070.2464%2057.106%2069.0452%2057.106ZM68.6102%2054.956C68.6102%2055.1935%2068.8049%2055.386%2069.0452%2055.386C69.2854%2055.386%2069.4802%2055.1935%2069.4802%2054.956C69.4802%2054.7186%2069.2854%2054.526%2069.0452%2054.526C68.8049%2054.526%2068.6102%2054.7186%2068.6102%2054.956Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",va=({closePrintModal:n,setLatestMetaData:d,setInvestigationDropdown:c,setCustomTranslations:a,getVisitpadPreferenceHandler:v,updateVPPrefUsingDocPref:w})=>{const{patientIDs:l,setShowPrintModal:A,setEndConsultationClicked:S,preferences:p,variable:k}=y.useContext(Tt),[x,L]=y.useReducer((Y,le)=>({...Y,...le}),{currentPage:1,totalRecord:0,pastVisits:[],isVisitLoading:!1}),{pastVisits:V,currentPage:O,isVisitLoading:D,totalRecord:N}=x,P=y.useCallback(async Y=>{if(l?.patientRoleID)try{L({isVisitLoading:!0});const le=await yn(rn,Y,l.patientRoleID,k),W=le?.visits??[];L({currentPage:Y,pastVisits:Y===1?W:[...V,...W],isVisitLoading:!1,totalRecord:+le.total_visit_count})}catch(le){console.error("Failed to fetch visits:",le),L({isVisitLoading:!1})}},[l?.patientRoleID]),T=y.useCallback(async(Y,le,W=!0)=>{if(l?.patientRoleID){n(),L({isVisitLoading:!0});try{const je=(await xn(Y.original.visit_date,l.patientRoleID,Y.original.visit_id,k))?.visits?.[0];if(!je)throw new Error("Visit details not found.");let ye=null;const{doctor_id:et="",doctor_role_id:pe=""}=je;k.window_var.doctor_role_id_for_seg!==pe?ye=await v({doc_id:et,doc_rid:pe}):p&&await w(p,p.printDefaultPrefIndex,pe,!1),d(je.latest_visit_metadata||{}),A({printDataFrom:"patient_popup",visible:!0,whichPreview:"offlinePrint",printData:"",visitId:je.visit_id,visit_date:je.visit_date,visit_number:N-Y.index,currentPrintTime:0,printType:"visit",details:je,visitpadPref:ye,appointmentInfo:{appnt_id:Y.original.appnt_id||"",appnt_type:Y.original.appnt_type||""},trackEventHandler:()=>{}}),S(W)}catch(me){console.error("Failed to prepare print data:",me)}finally{L({isVisitLoading:!1})}}},[n,v,k,l.patientRoleID,p,S,d,A,w,N]),j=y.useCallback(async()=>{try{const Y=await Bn(k),le={};Y.transalation_records.forEach(W=>{le[W.language]=W}),a(le)}catch(Y){console.error("Failed to get custom translations:",Y)}},[a,k]),Q=y.useCallback(async()=>{try{const Y=await Fn(k);if(Y?.test_ranges){const le=Y.test_ranges.map(W=>({test_id:W.test_id,test_names:W.test_names,test_range_rule:W.test_range_rule,test_range_text:W.test_range_text,test_units:W.test_units,value:W.test_names}));c(le)}}catch(Y){console.error("Failed to get investigation test names:",Y)}},[c,k]);y.useEffect(()=>{P(1),j(),Q()},[j,Q]);const I=y.useMemo(()=>({visit_date:"100px",doctor_name:"350px",appnt_type:"100px",service_name:"150px",view:"250px"}),[]),H=y.useMemo(()=>[{Header:"Date",accessor:"visit_date",Cell:({row:Y})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.visit_date}]`,children:Y.original.visit_date?Te.dayjs(Y.original.visit_date).format("DD-MMM-YYYY"):"N/A"})},{Header:"Doctor",accessor:"doctor_name",Cell:({row:Y})=>e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.doctor_name}]`,children:["Dr. ",Y.original.doctor_name||"N/A"]})},{Header:"Type",accessor:"appnt_type",Cell:({row:Y})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.appnt_type}]`,children:Y.original.appnt_type||"N/A"})},{Header:"Service",accessor:"service_name",Cell:({row:Y})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.service_name}]`,children:Y.original.service_name||"N/A"})},{Header:"Prescription",id:"view",Cell:({row:Y})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-2 hfl-my-1 hfl-flex hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Print",iconFile:"hx_print",icon:"Left",onClick:()=>T(Y,"VISIT_PRINT",!1),className:"hfl-w-[74px]","data-qa":"to-print"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Share",iconFile:"hx_share",icon:"Left",onClick:()=>T(Y,"VISIT_SHARE",!0),className:"hfl-w-[74px]","data-qa":"to-share"})]})}],[I,T]),z=y.useMemo(()=>V,[V]),J=async()=>{if(!l?.patientRoleID)return;let Y="../ipdv2/viewPatientsCase";if(k.window_var?.enable_ipd_v2!=="1"){Y="../ipd/viewPatientsCase.php";try{const le=await jn(k,l.patientRoleID),{status:W=0,case_id:me=0}=le,je=new Date().toISOString().slice(0,10);Y=W&&me?`../ipd/viewPatientRecords.php?pid=${l.patientRoleID}&case_id=${me}`:`../ipd/viewAddPatientsCase.php?pid=${l.patientRoleID}&date=${je}`}catch(le){console.error("Failed to get IPD Case by PID:",le)}}window.open(Y,"_blank")};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-[12%] hfl-h-[69vh] hfl-overflow-auto hfl-py-[20px]",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text md",className:"hfl-text-Gray-600",children:"Past Visits"}),k.window_var.ipd_module==="1"&&e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"sm",textField:"Go to IPD","data-qa":"go-to-ipd",className:"hfl-justify-center hfl-bg-Primary-600 hfl-text-White hover:hfl-bg-Primary-700",onClick:()=>{J()}})]}),z?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(xa,{columns:H,data:z,columnWidth:I}),e.jsxRuntimeExports.jsx(Qr,{currentPage:O,totalRecord:N,handleLoadMore:()=>P(O+1),isLoading:D,currentTotal:z.length})]}),z.length===0&&!D&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[calc(100%_-_80px)] hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:ga,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"There are no visits for the patient"})]})]})},ya=({fontBaseUrl:n})=>(ae.Font.register({family:"notoKannada",src:`${n}/fonts/NotoSansKannada.ttf`}),ae.Font.register({family:"notoKannadaBold",src:`${n}/fonts/NotoSansKannada-Bold.ttf`}),ae.Font.register({family:"notoHindi",src:`${n}/fonts/NotoSansHindi.ttf`}),ae.Font.register({family:"notoHindiBold",src:`${n}/fonts/NotoSansHindi-Bold.ttf`}),ae.Font.register({family:"notoUrdu",src:`${n}/fonts/Jameel-Nastaleeq.ttf`}),ae.Font.register({family:"notoUrduBold",src:`${n}/fonts/Jameel-Nastaleeq.ttf`}),ae.Font.register({family:"notoArabic",src:`${n}/fonts/NotoSansArabic.ttf`}),ae.Font.register({family:"notoArabicBold",src:`${n}/fonts/NotoSansArabic-Bold.ttf`}),ae.Font.register({family:"notoGujarati",src:`${n}/fonts/NotoSerifGujarati-Regular.ttf`}),ae.Font.register({family:"notoGujaratiBold",src:`${n}/fonts/NotoSerifGujarati-Bold.ttf`}),ae.Font.register({family:"notoMalayalam",src:`${n}/fonts/AnekMalayalam-Regular.ttf`}),ae.Font.register({family:"notoMalayalamBold",src:`${n}/fonts/AnekMalayalam-Bold.ttf`}),ae.Font.register({family:"notoOriya",src:`${n}/fonts/NotoSansOriya.ttf`}),ae.Font.register({family:"notoOriyaBold",src:`${n}/fonts/NotoSansOriya-Bold.ttf`}),ae.Font.register({family:"notoPunjabi",src:`${n}/fonts/MuktaMaheePunjabi-Regular.ttf`}),ae.Font.register({family:"notoPunjabiBold",src:`${n}/fonts/MuktaMaheePunjabi-Bold.ttf`}),ae.Font.register({family:"notoTamil",src:`${n}/fonts/NotoSansTamil.ttf`}),ae.Font.register({family:"notoTamilBold",src:`${n}/fonts/NotoSansTamil-Bold.ttf`}),ae.Font.register({family:"notoTelugu",src:`${n}/fonts/Noto-Sans-Telugu-Regular.ttf`}),ae.Font.register({family:"notoTeluguBold",src:`${n}/fonts/Noto-Sans-Telugu-Bold.ttf`}),ae.Font.register({family:"notoBengali",src:`${n}/fonts/NotoSerifBengali-Regular.ttf`}),ae.Font.register({family:"notoBengaliBold",src:`${n}/fonts/NotoSerifBengali-Bold.ttf`}),ae.Font.register({family:"Verdana",src:`${n}/fonts/Verdana.ttf`}),ae.Font.register({family:"Verdana-Bold",src:`${n}/fonts/Verdana-Bold.ttf`}),ae.Font.register({family:"Verdana-Italic",src:`${n}/fonts/Verdana-Italic.ttf`}),ae.Font.register({family:"Verdana-BoldItalic",src:`${n}/fonts/Verdana-Bold-Italic.ttf`}),ae.Font.register({family:"Arial",src:`${n}/fonts/Arial.ttf`}),ae.Font.register({family:"Arial-Bold",src:`${n}/fonts/Arial-Bold.ttf`}),ae.Font.register({family:"Arial-Italic",src:`${n}/fonts/Arial-Italic.ttf`}),ae.Font.register({family:"Arial-BoldItalic",src:`${n}/fonts/Arial-Bold-Italic.ttf`}),ae.Font.register({family:"Rupee",src:`${n}/fonts/IndianRupee.ttf`}),e.jsxRuntimeExports.jsx(ae.PDFViewer,{style:{display:"none"},children:e.jsxRuntimeExports.jsx(ae.Document,{children:e.jsxRuntimeExports.jsxs(ae.Page,{children:[e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoKannada"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoHindi"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoUrdu"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoArabic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoGujarati"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoMalayalam"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoOriya"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoPunjabi"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTamil"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTelugu"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoBengali"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoKannadaBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoHindiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoUrduBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoArabicBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoGujaratiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoMalayalamBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoOriyaBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoPunjabiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTamilBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTeluguBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoBengaliBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana-Bold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana-Italic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana-BoldItalic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial-Bold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial-Italic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial-BoldItalic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Rupee"},children:"load font"})]})})})),_a=n=>{const{billsData:d,handleRowClick:c,handleRightSegment:a,getRowIndices:v,getRefundAmt:w,closePrintModal:l}=n,{patientIDs:A,patientDetails:S,billPreferences:p,setShowPrintModal:k,showPrintModal:x,variable:L}=y.useContext(Tt)||{},V=({label:j,className:Q})=>e.jsxRuntimeExports.jsx("th",{className:Q,children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:[" ",j]})}),O=j=>{switch(j){case Et[0]:return"hx_service-appointment-filled hfl-text-Primary-500";case Et[1]:return"hx_service-other-filled hfl-text-Pink-500";case Et[2]:return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}},D=j=>{switch(j){case Et[0]:return"Consultation";case Et[1]:return"Other";case Et[2]:return"Lab";default:return"Other"}},N=async(j,Q,I)=>{if(x?.visible&&l(),j?.order_id){const H=await Kl(j?.order_id,A?.patientRoleID||"",L),z={finalAmount:j.net_bill_amount,billedAmount:j.order_total,gstAmount:j.order_service_tax,cgstAmount:(+j.order_service_tax/2).toFixed(2),sgstAmount:(+j.order_service_tax/2).toFixed(2),discountAmount:j.order_item_sum_discount,receivedAmount:j.order_paid_amount,refundAmount:j.refund_amount,balanceAmount:j.balance_amount,paymentMode:H?.paymentModes.length?H?.paymentModes.join(", "):"",paymentStatus:parseInt(j?.order_paid_amount||"0")-parseInt(j?.refund_amount||"0")===0?"red":parseInt(j?.balance_amount||"0")===0?"green":"yellow"},Y=[S?.age&&typeof S?.age=="number"?`${S?.age}y`:S?.org_person_dob?pr(S?.org_person_dob):"",Xr[S?.gender]??"",S?.blood_group].filter(le=>le).join(", ");k({printDataFrom:"patient_popup",visible:!0,whichPreview:Q,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{preferences:{...p?.print?.bill,...p?.org_details,...p?.branch_details},billSummaryDetails:z,billServiceDetails:j?.order_items?.map(le=>({serviceName:le.service_name,price:le.order_unit_item_price,gst:Math.floor(+le.order_item_service_tax),discount:le.order_item_discount,netPrice:le.net_amount,itemQty:le.item_quantity})),billPatientDetails:{name:nr(S?.name)+(Y?` (${Y}) `:""),billDate:Te.dayjs(j?.order_date).format("DD-MMM-YYYY"),mobileNumber:S?.phone_number,email:S?.email,billNumber:j.order_id_str,patientId:S?.org_person_bid_str,patientIdForEmail:A?.patientRoleID,billStatus:parseInt(j?.balance_amount||"0")===0?"PAID":"UNPAID",address:[S?.address??"",S?.city??"",S?.pincode??""].filter(le=>le).join(", "),referredBy:H?.lab_owner_name?nr(H?.lab_owner_name):S?.ref_doc_name?nr(S?.ref_doc_name):"--"},showPrintPreviewForBill:I,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:j?.order_id}},trackEventHandler:()=>{}})}},P={table:"hfl-table-fixed hfl-rounded-lg hfl-shadow-md hfl-border-Gray-200 hfl-border-1 hfl-pb-8 ",th:"hfl-bg-Blue_gray-50",td:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-truncate hfl-text-Gray-500",td_without_truncate:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-text-Gray-500"},T=[{label:"Date",className:"focus:hfl-outline-none hfl-items-start hfl-w-[120px] hfl-border-Gray-200 hfl-border-1"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Department",className:"focus:hfl-outline-none hfl-items-start hfl-w-[106px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Paid",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Due",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Billed",className:"focus:hfl-outline-none hfl-items-start hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Discount",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Refund",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Service",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Price",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"GST",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"",className:"focus:hfl-outline-none hfl-items-center hfl-w-[36px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"}];return e.jsxRuntimeExports.jsx("div",{"data-qa":"bills-table",children:d.length>0&&e.jsxRuntimeExports.jsxs("table",{className:`${P.table} `,children:[e.jsxRuntimeExports.jsx("thead",{className:`${P.th}`,children:e.jsxRuntimeExports.jsx("tr",{children:T.map((j,Q)=>e.jsxRuntimeExports.jsx(V,{label:j.label,className:j.className},Q))})}),e.jsxRuntimeExports.jsx("tbody",{children:d.length>0&&d.map((j,Q)=>e.jsxRuntimeExports.jsx(y.Fragment,{children:j.order_items.map((I,H)=>e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[H===0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td}`,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`${Te.dayjs(j.order_date).format("DD-MMM-YY")===Te.dayjs(new Date).format("DD-MMM-YY")?"hfl-w-[80px] hfl-bg-Success-25 hfl-px-1 hfl-text-Success-500":""}`,children:Te.dayjs(j.order_date).format("DD-MMM-YY")})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:j.order_id_str})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:` hfl-flex ${O(j.service_category)}`}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-truncate",children:[" ",D(j.service_category)]})]})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",parseInt(j.order_paid_amount)-parseInt(j.refund_amount)]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm","data-qa":Q+1+"-due-amount",children:["₹ ",j.balance_amount]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[84px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:`${j.order_paid_amount===void 0||j.refund_amount===void 0||j.balance_amount===void 0||parseInt(j.order_paid_amount)-parseInt(j.refund_amount)===0?"hfl-text-Error-500":parseInt(j.balance_amount)===0?"hfl-text-Success-500":"hfl-text-Warning-500"} hfl-cursor-pointer`,onClick:()=>{c(j)},"data-qa":Q+1+"-total-bill",children:["₹ ",j.net_bill_amount]}),e.jsxRuntimeExports.jsx("i",{className:" hx_print-filled hfl-cursor-pointer hfl-text-2 hfl-text-Gray-500",onClick:()=>N(j,"billPrintPreview",!1),"data-qa":Q+1+"-print-bill"})]})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[84px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",parseInt(j.order_discount)+parseInt(j.order_item_sum_discount)]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",j.refund_amount]})})})]}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-w-8 hfl-max-w-[96px]`,title:I.service_name,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-truncate",children:I.service_name})}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-max-w-[64px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",I.order_item_price]})})}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-max-w-[46px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",I.order_item_service_tax]})})}),e.jsxRuntimeExports.jsx("td",{"data-qa":Q+1+"-"+(H+1)+"-delete-bill",className:`${P.td_without_truncate} hfl-max-w-[36px] hfl-cursor-pointer`,onClick:()=>{v(Q,H),a(ft[6]),parseInt(j.order_paid_amount)-parseInt(j.refund_amount)<=parseInt(j.net_bill_amount)-parseInt(j.order_items[H].net_amount)?w(0):w(parseInt(j.order_paid_amount)-parseInt(j.refund_amount))},children:e.jsxRuntimeExports.jsx("i",{className:"hx_delete hfl-text-Gray-500"})})]},`${Q}-${H}`))},Q))})]})})},ba=n=>{const{refundAmt:d,handleRightSegment:c,bills:a,billsListIndex:v,orderItemsIndex:w,getBillsList:l}=n,{patientIDs:A,showToast:S,variable:p}=y.useContext(Tt)||{},[k,x]=y.useState("");return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full hfl-bg-Error-25",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Medium",type:"Text lg",className:"hfl-flex",children:["Bill :",e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",className:"hfl-flex hfl-text-Blue-600",children:a?.bill_list[v].order_id_str})]}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>c("")})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-2.5 hfl-px-[13px] hfl-py-3",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-shrink-0 hfl-flex-col hfl-items-start hfl-gap-[5px] hfl-rounded-md hfl-border-Gray-200 hfl-bg-White_20 hfl-px-3 hfl-py-2 hfl-shadow-md",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",children:["Service: ",a?.bill_list[v].order_items[w].service_name]}),d>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["Refund of",e.jsxRuntimeExports.jsx("div",{className:"hfl-inline hfl-font-inter-2 hfl-text-Error-600",children:" ₹ "+d+" "}),"will be given to delete this item"]})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full",children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-w-[100%]",rows:4,inputProps:{value:k,placeholder:"Enter Reason",onChange:L=>{x(L.target.value)}},isDynamicHeight:!0})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"Left",iconFile:"hx_close",className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{c("")}}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:"Delete",icon:"Left",iconFile:"hx_delete",onClick:async()=>{try{if(a?.bill_list?.[v].order_id){const L=await Yl(a?.bill_list?.[v].order_id,a?.bill_list?.[v].order_items[w].order_item_id,A?.patientRoleID||"",k,"0",p);L?(await l(),S?.("Success",L?.message,"Success",3e3),c("")):S?.("Error","Something went wrong please try again","Error",3e3)}}catch(L){console.error("Error in deleting bill item",L)}},className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>c("")})})]})},ja="data:image/svg+xml,%3csvg%20width='87'%20height='86'%20viewBox='0%200%2087%2086'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='43.5'%20cy='83.42'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.6751%2018.92C34.2431%2016.9347%2036.0897%2015.48%2038.2799%2015.48H55.9277C54.4566%2016.3563%2053.188%2017.5313%2052.2081%2018.92H33.6751ZM51.1971%2020.64H25.6649C22.782%2020.64%2020.445%2022.9502%2020.445%2025.8V57.62H47.4149H47.8499C48.3304%2057.62%2048.7199%2058.005%2048.7199%2058.48V62.995C48.7199%2066.676%2051.7387%2069.66%2055.4624%2069.66C59.1862%2069.66%2062.2049%2066.676%2062.2049%2062.995V37.84C55.4781%2037.84%2050.0249%2032.4495%2050.0249%2025.8C50.0249%2023.9534%2050.4455%2022.2039%2051.1971%2020.64ZM63.9449%2037.7181V61.8486C66.4138%2061.4392%2068.2949%2059.3168%2068.2949%2056.76V36.2293C66.9805%2036.9809%2065.5108%2037.4967%2063.9449%2037.7181ZM70.0349%2035.0228V56.76C70.0349%2060.2756%2067.3674%2063.1753%2063.924%2063.5893C63.6156%2067.9429%2059.9451%2071.38%2055.4624%2071.38C55.3865%2071.38%2055.3108%2071.379%2055.2354%2071.377L55.2449%2071.38H23.925C19.1201%2071.38%2015.225%2067.5296%2015.225%2062.78V61.06C15.225%2059.1601%2016.783%2057.62%2018.705%2057.62V25.8C18.705%2022.0003%2021.821%2018.92%2025.6649%2018.92H31.8855C32.49%2015.9759%2035.1232%2013.76%2038.2799%2013.76H61.3349V13.7902C61.6223%2013.7702%2061.9124%2013.76%2062.2049%2013.76C68.9318%2013.76%2074.3849%2019.1505%2074.3849%2025.8C74.3849%2029.5023%2072.6945%2032.8142%2070.0349%2035.0228ZM10.44%2066.005C10.44%2065.6488%2010.7321%2065.36%2011.0925%2065.36C11.4528%2065.36%2011.745%2065.6488%2011.745%2066.005V66.22C11.745%2070.9696%2015.6401%2074.82%2020.445%2074.82H22.4459C22.7823%2074.82%2023.055%2075.0895%2023.055%2075.422C23.055%2075.7545%2022.7823%2076.024%2022.4459%2076.024H20.445C14.6698%2076.024%2010.44%2071.9104%2010.44%2066.22V66.005ZM11.0925%2063.64C9.77111%2063.64%208.69995%2064.6988%208.69995%2066.005V66.22C8.69995%2072.8786%2013.7274%2077.744%2020.445%2077.744H22.4459C23.7433%2077.744%2024.795%2076.7044%2024.795%2075.422C24.795%2074.1396%2023.7433%2073.1%2022.4459%2073.1H20.445C16.601%2073.1%2013.485%2070.0197%2013.485%2066.22V66.005C13.485%2064.6988%2012.4138%2063.64%2011.0925%2063.64ZM24.795%2043.43C24.795%2042.2426%2025.7687%2041.28%2026.9699%2041.28H40.0199C41.2212%2041.28%2042.195%2042.2426%2042.195%2043.43C42.195%2044.6174%2041.2212%2045.58%2040.0199%2045.58H26.9699C25.7687%2045.58%2024.795%2044.6174%2024.795%2043.43ZM26.9699%2043C26.7297%2043%2026.535%2043.1925%2026.535%2043.43C26.535%2043.6675%2026.7297%2043.86%2026.9699%2043.86H40.0199C40.2602%2043.86%2040.4549%2043.6675%2040.4549%2043.43C40.4549%2043.1925%2040.2602%2043%2040.0199%2043H26.9699ZM32.15%2037.9752C32.2163%2038.0407%2032.3208%2038.0735%2032.4635%2038.0735C32.5859%2038.0735%2032.6751%2038.0407%2032.7312%2037.9752C32.7923%2037.9097%2032.8229%2037.8064%2032.8229%2037.6653V37.0531C33.297%2037.0027%2033.7277%2036.8691%2034.1152%2036.6525C34.5026%2036.4307%2034.8135%2036.1082%2035.048%2035.685C35.2876%2035.2566%2035.4074%2034.7275%2035.4074%2034.0977C35.4074%2033.5534%2035.2825%2033.105%2035.0327%2032.7522C34.783%2032.3944%2034.4924%2032.1198%2034.161%2031.9283C33.8297%2031.7368%2033.3837%2031.5202%2032.8229%2031.2783V29.2375C33.0778%2029.2476%2033.2919%2029.2753%2033.4652%2029.3206C33.6436%2029.366%2033.8246%2029.4239%2034.0081%2029.4945C34.1356%2029.5449%2034.2197%2029.5701%2034.2604%2029.5701C34.3624%2029.5701%2034.4695%2029.4995%2034.5816%2029.3584C34.6988%2029.2173%2034.7983%2029.0535%2034.8798%2028.8671C34.9614%2028.6756%2035.0022%2028.5194%2035.0022%2028.3985C35.0022%2028.2624%2034.9079%2028.1264%2034.7192%2027.9903C34.5357%2027.8543%2034.2757%2027.7384%2033.9393%2027.6426C33.6079%2027.5469%2033.2358%2027.4914%2032.8229%2027.4763V27.0606C32.8229%2026.9145%2032.7923%2026.8112%2032.7312%2026.7507C32.67%2026.6902%2032.5655%2026.66%2032.4176%2026.66C32.2953%2026.66%2032.2035%2026.6927%2032.1424%2026.7583C32.0812%2026.8187%2032.0506%2026.9195%2032.0506%2027.0606V27.4839C31.5561%2027.5393%2031.1024%2027.6728%2030.6895%2027.8845C30.2817%2028.0961%2029.9529%2028.3985%2029.7031%2028.7915C29.4585%2029.1795%2029.3361%2029.6557%2029.3361%2030.2201C29.3361%2030.8147%2029.4661%2031.2985%2029.7261%2031.6713C29.9912%2032.0392%2030.2996%2032.3189%2030.6513%2032.5103C31.0081%2032.6968%2031.4746%2032.8958%2032.0506%2033.1075V35.3221C31.7346%2035.3221%2031.444%2035.2793%2031.1789%2035.1936C30.9189%2035.108%2030.6513%2034.9971%2030.376%2034.8611C30.1823%2034.7603%2030.0549%2034.7099%2029.9937%2034.7099C29.902%2034.7099%2029.7873%2034.7804%2029.6496%2034.9215C29.512%2035.0576%2029.3922%2035.2214%2029.2902%2035.4128C29.1934%2035.6043%2029.1449%2035.7656%2029.1449%2035.8966C29.1449%2036.0528%2029.2596%2036.2191%2029.489%2036.3955C29.7235%2036.5718%2030.06%2036.7255%2030.4984%2036.8565C30.9419%2036.9825%2031.4593%2037.0556%2032.0506%2037.0757V37.6653C32.0506%2037.8064%2032.0837%2037.9097%2032.15%2037.9752ZM31.5001%2029.6154C31.602%2029.4793%2031.7855%2029.3786%2032.0506%2029.3131V30.9306C31.8212%2030.7996%2031.6453%2030.6635%2031.523%2030.5224C31.4058%2030.3813%2031.3471%2030.2151%2031.3471%2030.0236C31.3471%2029.8825%2031.3981%2029.7464%2031.5001%2029.6154ZM33.2511%2034.8611C33.1441%2034.9971%2033.0013%2035.1004%2032.8229%2035.171V33.4703C33.2154%2033.692%2033.4117%2033.9843%2033.4117%2034.3471C33.4117%2034.5537%2033.3582%2034.725%2033.2511%2034.8611ZM24.795%2050.31C24.795%2049.1226%2025.7687%2048.16%2026.9699%2048.16H53.07C54.2712%2048.16%2055.2449%2049.1226%2055.2449%2050.31C55.2449%2051.4974%2054.2712%2052.46%2053.07%2052.46H26.9699C25.7687%2052.46%2024.795%2051.4974%2024.795%2050.31ZM26.9699%2049.88C26.7297%2049.88%2026.535%2050.0725%2026.535%2050.31C26.535%2050.5475%2026.7297%2050.74%2026.9699%2050.74H53.07C53.3102%2050.74%2053.5049%2050.5475%2053.5049%2050.31C53.5049%2050.0725%2053.3102%2049.88%2053.07%2049.88H26.9699ZM51.7649%2025.8C51.7649%2020.1004%2056.4391%2015.48%2062.2049%2015.48C67.9708%2015.48%2072.6449%2020.1004%2072.6449%2025.8C72.6449%2031.4996%2067.9708%2036.12%2062.2049%2036.12C56.4391%2036.12%2051.7649%2031.4996%2051.7649%2025.8ZM60.0299%2020.21C60.0299%2019.0226%2061.0037%2018.06%2062.2049%2018.06C63.4062%2018.06%2064.3799%2019.0226%2064.3799%2020.21V25.37C64.3799%2026.5574%2063.4062%2027.52%2062.2049%2027.52C61.0037%2027.52%2060.0299%2026.5574%2060.0299%2025.37V20.21ZM62.2049%2019.78C61.9647%2019.78%2061.7699%2019.9725%2061.7699%2020.21V25.37C61.7699%2025.6075%2061.9647%2025.8%2062.2049%2025.8C62.4452%2025.8%2062.6399%2025.6075%2062.6399%2025.37V20.21C62.6399%2019.9725%2062.4452%2019.78%2062.2049%2019.78ZM62.2049%2033.54C61.0037%2033.54%2060.0299%2032.5774%2060.0299%2031.39C60.0299%2030.2026%2061.0037%2029.24%2062.2049%2029.24C63.4062%2029.24%2064.3799%2030.2026%2064.3799%2031.39C64.3799%2032.5774%2063.4062%2033.54%2062.2049%2033.54ZM61.7699%2031.39C61.7699%2031.6275%2061.9647%2031.82%2062.2049%2031.82C62.4452%2031.82%2062.6399%2031.6275%2062.6399%2031.39C62.6399%2031.1525%2062.4452%2030.96%2062.2049%2030.96C61.9647%2030.96%2061.7699%2031.1525%2061.7699%2031.39Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",Ra=n=>{const{closePrintModal:d,handleCurrentWindow:c,billIdToOpen:a,onBillHandled:v}=n,[w,l]=y.useState(),[A,S]=y.useState(""),[p,k]=y.useState(""),[x,L]=y.useState(),[V,O]=y.useState(),[D,N]=y.useState(1),[P,T]=y.useState([]),[j,Q]=y.useState(-1),[I,H]=y.useState(-1),[z,J]=y.useState(0),[Y,le]=y.useState(0),[W,me]=y.useState(!1),je=y.useContext(Tt);if(!je)throw new Error("Bills component must be used within an AppContext.Provider");const{patientIDs:ye,setLoading:et,variable:pe}=je,$=Oe=>J(Oe),ue=(Oe=ft[0])=>S(Oe),M=Oe=>k(Oe),Ae=Oe=>{L(Oe),M(Oe?.service_category??""),S(ft[1])},Fe=(Oe,at)=>{Q(Oe),H(at)},He=y.useCallback(async()=>{if(ye?.patientRoleID)try{const Oe=await yl(Te.dayjs().format("YYYY-MM-DD"),ye.patientRoleID,!1,pe);O(Oe)}catch(Oe){console.error("Error in getPastDueAmount API Call:",Oe)}},[]);y.useEffect(()=>{He()},[He]);const mt=async()=>{const Oe=await Cl(ye.patientRoleID,pe);le(Oe?.wallet_balance||0)},pt=async()=>{et(!0);try{et(!0);const Oe=await gl("all",ye.patientRoleID,1,10,pe);Oe&&(l(Oe),T(Oe?.bill_list)),et(!1)}catch{console.log("error in getBillsList API Call")}et(!1)},nt=async Oe=>{let at=Oe;if(et(!0),at<=Math.ceil(w.total_pages)){if(at=Oe+1,at!==Oe){const Pt=await gl("all",ye.patientRoleID,Oe,10,pe);if(Pt?.bill_list){const xt=[...P,...Pt.bill_list];T(xt)}}N(at)}et(!1)};return y.useEffect(()=>{pt()},[]),y.useEffect(()=>{mt()},[W]),y.useEffect(()=>{if(a&&P.length){const Oe=P.find(at=>at.order_id_str===a);Oe&&(Ae(Oe),v?.())}},[a,P]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-flex-row hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[938px] hfl-flex-col hfl-px-4 hfl-py-2 xxs:max-md:hfl-w-[750px] ${A===ft[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-max-h-[470px] hfl-w-full hfl-flex-col hfl-overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-self-stretch",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Gray-700",children:"Bills"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Blue_gray-600",children:"Total Due Amount :"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Error-500",children:["₹ ",V?.total_amount||0]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[30px] hfl-w-[2px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:" hfl-text-Success-500",children:Y}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>ue(ft[7])})]})]})]})]}),w?.bill_list?.length>0?e.jsxRuntimeExports.jsx(_a,{billsData:P,handleRowClick:Ae,handleRightSegment:ue,getRowIndices:Fe,getRefundAmt:$,closePrintModal:d}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:ja,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"No Past Bills Available"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Gray-500",children:["To create a new bill go to"," ",e.jsxRuntimeExports.jsx("p",{className:"hfl-inline hfl-cursor-pointer hfl-text-Blue-600 hfl-underline",onClick:()=>c(Rt[2]),children:"Add Bills"})]})]})]})}),w?.bill_list?.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Qr,{currentPage:D,totalRecord:w?.total_records,currentTotal:D===Math.ceil(w?.total_records/20)?w?.total_records:D*20,handleLoadMore:nt})})]}),e.jsxRuntimeExports.jsxs(Pl,{children:[A===ft[1]&&e.jsxRuntimeExports.jsx(Al,{rightSegment:A,serviceDetails:x?.order_items??[],categorySummaryData:x,serviceItem:p,handleRightSegment:ue,getPastDueAmount:He,getBillSummarydata:pt,closePrintModal:d,setRefreshWallet:me,walletBalance:Y,bill_date:"",refreshBillsList:pt}),A===ft[6]&&e.jsxRuntimeExports.jsx(ba,{refundAmt:z,bills:w,billsListIndex:j,orderItemsIndex:I,handleRightSegment:ue,getBillsList:pt}),A===ft[7]&&e.jsxRuntimeExports.jsx(Dl,{depositAmount:Y,handleRightSegment:ue,rightSegment:A,setRefreshWallet:me})]})]})},wa=({childModalRef:n,children:d,hideBackDrop:c=!1,backdropClasses:a="",modalClasses:v="",closeOnClickOutside:w,clickOutsideHandler:l,position:A="hfl-inset-0"})=>(y.useEffect(()=>{if(!w)return;const S=p=>{n.current&&!n.current.contains(p.target)&&l()};return document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[l,n,w]),e.jsxRuntimeExports.jsx("div",{className:`hfl-fixed ${A} hfl-z-50 hfl-flex hfl-items-center hfl-justify-center ${a} ${c?"":"hfl-bg-Gray-750 hfl-backdrop-blur-sm"}`,children:e.jsxRuntimeExports.jsx("div",{ref:n,className:`hfl-rounded-lg hfl-shadow-md hfl-bg-White ${v??""}`,children:d})})),Ca=({reference:n,closeModalHandler:d,payment_id:c,currentMode:a,transactionType:v,refreshPaymentData:w})=>{const{showToast:l,variable:A}=y.useContext(Tt)||{},[S,p]=y.useState({paymentMethod:a}),k=async()=>{const x=await Mn(c,S.paymentMethod,v,A);x.status?(l("Update Success",x.message,"Success",3e3),w?.()):l("Update Failed",x.message,"Error",3e3),d({show:!1,payment_id:"",mode:"",payment_type:""})};return e.jsxRuntimeExports.jsxs("div",{ref:n,className:"hfl-flex hfl-w-[400px] hfl-flex-col hfl-rounded-lg hfl-border-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-rounded-t-lg hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-5 hfl-text-White hfl-shadow-sm",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Bold",type:"Text md",className:"hfl-text-White",children:"Please make required changes"})," "]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-bg-White hfl-p-6",children:e.jsxRuntimeExports.jsx(e.Ap,{className:"hfl-w-[200px] hfl-text-0 hfl-text-Gray-800 ",value:{label:ur[S.paymentMethod]},options:Ur.map(x=>({label:x,value:x,className:"hfl-text-1 hfl-text-Gray-800"})),onChange:x=>{p(L=>({...L,paymentMethod:ur[x.value]}))},label:"Payment Method",labelClassName:"after:hfl-content-['*'] after:hfl-text-Error-600 after:hfl-ml-1 hfl-font-inter-2 hfl-font-inter",dropdownInputTextClassName:"hfl-text-1 hfl-text-Gray-600"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-end hfl-gap-[10px] hfl-rounded-b-lg hfl-border-t-1 hfl-border-Gray-100 hfl-bg-Gray-50 hfl-px-7 hfl-py-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{textField:"Cancel",size:"sm",hierarchy:"Primary",onClick:()=>d({show:!1,payment_id:"",mode:"",payment_type:""}),className:"hfl-border-1 hfl-border-Blue-300 hfl-bg-Blue-50 hfl-text-Blue-600 hover:hfl-bg-Blue-600 hover:hfl-text-White"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"sm",textField:"Save",className:"hfl-bg-Blue-600",onClick:k})]})]})},Ea=({styles:n,data:d,handleDeleteRow:c,handleRightSegment:a,handleRowClick:v,getType:w,getTypeColor:l,refreshPaymentData:A})=>{const[S,p]=y.useState({show:!1,payment_id:"",mode:"",payment_type:""}),k=y.useRef(null),x=V=>{switch(V){case"1":return"Consultation";case"2":return"Other";case"3":return"Lab";default:return"Other"}},L=V=>{switch(V){case"1":return"hx_service-appointment-filled hfl-text-Primary-500";case"2":return"hx_service-other-filled hfl-text-Pink-500";case"3":return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d.length>0&&d.map((V,O)=>e.jsxRuntimeExports.jsx(y.Fragment,{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[e.jsxRuntimeExports.jsx("td",{className:`${n.td} `,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:Te.dayjs.utc(new Date(V.created_on)).format("YYYY-MM-DD / HH:mm")})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 ",children:V.order_id_str})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hfl-text-Primary-600 hover:hfl-underline",onClick:()=>{v(V)},"data-qa":O+1+"-bill-amount",children:"₹"+V.paid_amount})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f_rupee hfl-flex "}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:` -hfl-ml-1 hfl-px-1 ${l(V.payment_refund)}`,children:w(V.payment_refund)})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",onClick:()=>{},className:"-hfl-ml-1",children:ur[V.paid_mode]}),e.jsxRuntimeExports.jsx("span",{className:"hx_edit hfl-cursor-pointer hfl-text-Blue-600",onClick:()=>{p({show:!0,payment_id:V.order_payment_id,mode:V.paid_mode,payment_type:w(V.payment_refund).toLowerCase()})}})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center ",children:[e.jsxRuntimeExports.jsx("i",{className:`hfl-flex hfl-text-3 hfl-text-Error-500 ${L(V.service_category_id)}`}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-0 ",children:[" ",x(V?.service_category_id)]})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[50px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:V.order_total})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,title:V.details,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-truncate",children:V.details})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("i",{className:" hx_delete hfl-flex hfl-cursor-pointer hfl-text-2",onClick:D=>{D.stopPropagation(),a(),c(V,O)},"data-qa":O+1+"-delete-transaction"})})]},`${O}`)},O)),S.show&&e.jsxRuntimeExports.jsx(wa,{childModalRef:k,backdropClasses:"",clickOutsideHandler:()=>{},closeOnClickOutside:!1,hideBackDrop:!1,modalClasses:"hfl-rounded-xlg hfl-mx-2 xsm:hfl-mx-6 md:hfl-mx-12 ",children:e.jsxRuntimeExports.jsx(Ca,{reference:k,closeModalHandler:p,payment_id:S.payment_id,currentMode:S.mode,transactionType:S.payment_type,refreshPaymentData:A})})]})},Pa=({styles:n,data:d,handleRowClick:c,closePrintModal:a,patient_entity_id:v})=>{const{patientDetails:w,patientIDs:l,billPreferences:A,setShowPrintModal:S,showPrintModal:p}=y.useContext(Tt),k=async(x,L,V,O)=>{p?.visible&&a();const N=[w?.age&&typeof w?.age=="number"?`${w?.age}y`:w?.org_person_dob?pr(w?.org_person_dob):"",Xr[w?.gender]??"",w?.blood_group].filter(T=>T).join(", "),P={name:nr(w?.name)+(N?` (${N}) `:""),billDate:Te.dayjs(x?.transaction_time).format("DD-MMM-YYYY"),mobileNumber:w?.phone_number,email:w?.email,billNumber:x?.bill_number,patientId:w?.org_person_bid_str,patientIdForEmail:l?.patientRoleID,billStatus:"PAID",address:[w?.address??"",w?.city??"",w?.pincode??""].filter(T=>T).join(", ")};S({printDataFrom:"patient_popup",visible:!0,whichPreview:L,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill_deposit_refund",details:{showPrintPreviewForBill:V,preferences:{...A?.print?.bill,...A?.org_details},depositRefundBillDetails:x,billPatientDetails:P,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:x?.bill_number,patient_user_id:v}},trackEventHandler:()=>{console.log(O)}})};return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d.length>0&&d.map((x,L)=>e.jsxRuntimeExports.jsx(y.Fragment,{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[e.jsxRuntimeExports.jsx("td",{className:`${n.td} `,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:Te.dayjs.utc(new Date(x.transaction_time)).format("YYYY-MM-DD / HH:mm")})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-text-Primary-600",children:x.bill_number})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[105px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:x.bill_amount})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[115px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hover:hfl-underline",onClick:()=>{c(x)},"data-qa":L+1+"-bill-amount",children:"₹"+x.paid_amount}),e.jsxRuntimeExports.jsx("i",{className:" hx_print-filled hfl-cursor-pointer hfl-text-2 hfl-text-Gray-500",onClick:()=>k(x,"billPrintPreview",!1,x?.type==="DEPOSIT"?"DEPOSIT_BILL_PRINT":"REFUND_BILL_PRINT"),"data-qa":L+1+"-print-bill"})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:x.mode})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center ",children:[e.jsxRuntimeExports.jsx("img",{src:Xl(x.type)}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-0 ",children:[" ",x.type]})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[160px]`,title:x.details,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-truncate",children:x.details})})})]},`${L}`)},L))})},Sa=n=>{const{data:d,setTableData:c,handleRightSegment:a,handleRowClick:v,activeTab:w,closePrintModal:l,patient_entity_id:A,refreshPaymentData:S}=n,{patientIDs:p,showToast:k,variable:x}=y.useContext(Tt)||{};Te.dayjs.extend(Nl);const L=async(T,j)=>{let Q="";T.payment_refund==="P"?Q="payment":T.payment_refund==="R"&&(Q="refund");try{const I=await Nn(T.order_payment_id,Q,T.order_id,p?.patientRoleID||"",x);I.status&&(k("Success",I?.message,"Success",3e3),c(H=>{try{const z=[...H];return z.splice(j,1),z}catch(z){return console.error(`Error: ${z}`),H}}),S())}catch(I){console.error("Error deleting payment:",I)}},V=T=>{switch(T){case"P":return"Payment";case"R":return"Refund";case"D":return"Deposit";default:return""}},O=T=>{switch(T){case"DEPOSIT":case"P":return"hfl-bg-Success-50 hfl-text-Success-500";case"REFUND":case"R":return"hfl-bg-Error-50 hfl-text-Error-500";case"D":return"hfl-bg-Primary-50 hfl-text-Primary-500";default:return""}},D=y.useMemo(()=>w===fr[jr.consultation_lab_other_services].key?[{label:"Date/Time",className:"focus:hfl-outline-none hfl-items-start hfl-w-[162px] hfl-border-Gray-200 hfl-border-1"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[100px] hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Type",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Mode",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Category",className:"focus:hfl-outline-none hfl-items-start hfl-w-[136px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Bill Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[110px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Details",className:"focus:hfl-outline-none hfl-items-start hfl-w-[120px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:" ",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"}]:[{label:"Date/Time",className:"focus:hfl-outline-none hfl-items-start hfl-w-[162px] hfl-border-Gray-200 hfl-border-1 hfl-px-2 hfl-text-left"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[100px] hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Bill Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[105px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Total Paid",className:"focus:hfl-outline-none hfl-items-start hfl-w-[115px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Mode",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Category",className:"focus:hfl-outline-none hfl-items-start hfl-w-[136px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Details",className:"focus:hfl-outline-none hfl-items-start hfl-w-[160px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"}],[w]),N=({label:T,className:j})=>e.jsxRuntimeExports.jsx("th",{className:j,children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:[" ",T]})}),P={table:"hfl-table-fixed hfl-rounded-lg hfl-shadow-md hfl-border-Gray-200 hfl-border-1 hfl-pb-8 ",th:"hfl-bg-Blue_gray-50",td:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-truncate hfl-text-Gray-500"};return e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsxs("table",{className:`${P.table}`,children:[e.jsxRuntimeExports.jsx("thead",{className:`${P.th}`,children:e.jsxRuntimeExports.jsx("tr",{children:D.map((T,j)=>e.jsxRuntimeExports.jsx(N,{label:T.label,className:T.className},j))})}),e.jsxRuntimeExports.jsx("tbody",{children:w===fr[jr.consultation_lab_other_services].key?e.jsxRuntimeExports.jsx(Ea,{styles:P,data:d,handleDeleteRow:L,handleRightSegment:a,handleRowClick:v,getTypeColor:O,getType:V,refreshPaymentData:S}):e.jsxRuntimeExports.jsx(Pa,{styles:P,data:d,handleRowClick:v,closePrintModal:l,patient_entity_id:A})})]})})},Na="data:image/svg+xml,%3csvg%20width='88'%20height='87'%20viewBox='0%200%2088%2087'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='44'%20cy='83.92'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.6799%2017.3857C12.6799%2016.1344%2013.7061%2015.12%2014.972%2015.12C16.2379%2015.12%2017.2641%2016.1344%2017.2641%2017.3857V22.0468C17.2641%2023.2981%2016.2379%2024.3125%2014.972%2024.3125C13.7061%2024.3125%2012.6799%2023.2981%2012.6799%2022.0468V17.3857ZM14.972%2016.84C14.6671%2016.84%2014.4199%2017.0843%2014.4199%2017.3857V22.0468C14.4199%2022.3482%2014.6671%2022.5925%2014.972%2022.5925C15.2769%2022.5925%2015.5241%2022.3482%2015.5241%2022.0468V17.3857C15.5241%2017.0843%2015.2769%2016.84%2014.972%2016.84ZM23.1199%2026.3C23.1199%2023.9252%2025.0675%2022%2027.4699%2022H56.4199C55.1757%2023.464%2054.2776%2025.225%2053.8502%2027.16H23.1199V26.3ZM53.6005%2028.88H19.6399C17.2375%2028.88%2015.2899%2030.8052%2015.2899%2033.18V37.48L56.4199%2037.48C54.6412%2035.3872%2053.5699%2032.6872%2053.5699%2029.74C53.5699%2029.4508%2053.5802%2029.1641%2053.6005%2028.88ZM67.4899%2041.6581V58.98H69.2299C71.6324%2058.98%2073.5799%2057.0548%2073.5799%2054.68V38.9628C71.8823%2040.3727%2069.7897%2041.3329%2067.4899%2041.6581ZM75.3199%2037.1886V54.68C75.3199%2058.0047%2072.5933%2060.7%2069.2299%2060.7H67.4899V61.56C67.4899%2064.8848%2064.7633%2067.58%2061.3999%2067.58H19.6399C16.2765%2067.58%2013.5499%2064.8848%2013.5499%2061.56V33.18C13.5499%2029.8552%2016.2765%2027.16%2019.6399%2027.16H21.3799V26.3C21.3799%2022.9752%2024.1065%2020.28%2027.4699%2020.28H57.9199V20.5172C60.0371%2018.759%2062.7684%2017.7%2065.7499%2017.7C72.4768%2017.7%2077.9299%2023.0905%2077.9299%2029.74C77.9299%2032.5522%2076.9545%2035.1393%2075.3199%2037.1886ZM15.2899%2042.64L65.7499%2042.64V58.98V60.7V61.56C65.7499%2063.9348%2063.8024%2065.86%2061.3999%2065.86H19.6399C17.2375%2065.86%2015.2899%2063.9348%2015.2899%2061.56V42.64ZM73.262%2063.28C71.9961%2063.28%2070.9699%2064.2944%2070.9699%2065.5457V70.2068C70.9699%2071.4581%2071.9961%2072.4725%2073.262%2072.4725C74.5279%2072.4725%2075.5541%2071.4581%2075.5541%2070.2068V65.5457C75.5541%2064.2944%2074.5279%2063.28%2073.262%2063.28ZM72.7099%2065.5457C72.7099%2065.2443%2072.9571%2065%2073.262%2065C73.5669%2065%2073.8141%2065.2443%2073.8141%2065.5457V70.2068C73.8141%2070.5082%2073.5669%2070.7525%2073.262%2070.7525C72.9571%2070.7525%2072.7099%2070.5082%2072.7099%2070.2068V65.5457ZM55.3099%2029.74C55.3099%2024.0404%2059.9841%2019.42%2065.7499%2019.42C71.5158%2019.42%2076.1899%2024.0404%2076.1899%2029.74C76.1899%2035.4396%2071.5158%2040.06%2065.7499%2040.06C59.9841%2040.06%2055.3099%2035.4396%2055.3099%2029.74ZM63.5749%2024.15C63.5749%2022.9626%2064.5487%2022%2065.7499%2022C66.9511%2022%2067.9249%2022.9626%2067.9249%2024.15V29.31C67.9249%2030.4974%2066.9511%2031.46%2065.7499%2031.46C64.5487%2031.46%2063.5749%2030.4974%2063.5749%2029.31V24.15ZM65.7499%2023.72C65.5097%2023.72%2065.3149%2023.9125%2065.3149%2024.15V29.31C65.3149%2029.5475%2065.5097%2029.74%2065.7499%2029.74C65.9902%2029.74%2066.1849%2029.5475%2066.1849%2029.31V24.15C66.1849%2023.9125%2065.9902%2023.72%2065.7499%2023.72ZM65.7499%2037.48C64.5487%2037.48%2063.5749%2036.5174%2063.5749%2035.33C63.5749%2034.1426%2064.5487%2033.18%2065.7499%2033.18C66.9511%2033.18%2067.9249%2034.1426%2067.9249%2035.33C67.9249%2036.5174%2066.9511%2037.48%2065.7499%2037.48ZM65.3149%2035.33C65.3149%2035.5675%2065.5097%2035.76%2065.7499%2035.76C65.9902%2035.76%2066.1849%2035.5675%2066.1849%2035.33C66.1849%2035.0925%2065.9902%2034.9%2065.7499%2034.9C65.5097%2034.9%2065.3149%2035.0925%2065.3149%2035.33ZM35.7349%2050.38C34.5337%2050.38%2033.5599%2051.3426%2033.5599%2052.53C33.5599%2053.7174%2034.5337%2054.68%2035.7349%2054.68H59.2249C60.4262%2054.68%2061.3999%2053.7174%2061.3999%2052.53C61.3999%2051.3426%2060.4262%2050.38%2059.2249%2050.38H35.7349ZM35.2999%2052.53C35.2999%2052.2925%2035.4947%2052.1%2035.7349%2052.1H59.2249C59.4652%2052.1%2059.6599%2052.2925%2059.6599%2052.53C59.6599%2052.7675%2059.4652%2052.96%2059.2249%2052.96H35.7349C35.4947%2052.96%2035.2999%2052.7675%2035.2999%2052.53ZM24.4249%2056.4C26.5871%2056.4%2028.3399%2054.6673%2028.3399%2052.53C28.3399%2050.3927%2026.5871%2048.66%2024.4249%2048.66C22.2627%2048.66%2020.5099%2050.3927%2020.5099%2052.53C20.5099%2054.6673%2022.2627%2056.4%2024.4249%2056.4Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",Aa=({walletBalance:n,handleRightSegment:d,headerText:c})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-2 hfl-flex hfl-w-full hfl-flex-row hfl-items-center hfl-justify-between hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:c}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",className:" hfl-text-Success-500",children:n}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>d(ft[7])})]})]})]}),Da=n=>{Te.dayjs.extend(Nl);const{patientDetails:d,patientIDs:c,billPreferences:a,setShowPrintModal:v,showPrintModal:w}=y.useContext(Tt)||{},{handleRightSegment:l,closePrintModal:A,summaryData:S,patient_entity_id:p}=n,k=async(x,L)=>{w?.visible&&A();const O=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?pr(d?.org_person_dob):"",Xr[d?.gender]??"",d?.blood_group].filter(N=>N).join(", "),D={name:nr(d?.name)+(O?` (${O}) `:""),billDate:Te.dayjs(S?.transaction_time).format("DD-MMM-YYYY"),mobileNumber:d?.phone_number,email:d?.email,billNumber:S?.bill_number,patientId:d?.org_person_bid_str,patientIdForEmail:c?.patientRoleID,billStatus:"PAID",address:[d?.address??"",d?.city??"",d?.pincode??""].filter(N=>N).join(", ")};v?.({printDataFrom:"patient_popup",visible:!0,whichPreview:x,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill_deposit_refund",details:{showPrintPreviewForBill:L,preferences:{...a?.print?.bill,...a?.org_details},depositRefundBillDetails:S,billPatientDetails:D,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:S?.bill_number,patient_user_id:p}},trackEventHandler:()=>{}})};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_arrow-left hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>l(ft[0])}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex hfl-items-center",children:"Bills Summary"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-between hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[60%] hfl-gap-2",children:[e.jsxRuntimeExports.jsx("img",{src:Xl(S.type),alt:""}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:S.type==="DEPOSIT"?"Deposit":"Refund(Deposit)"})]}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.bill_amount]})]}),S.type==="DEPOSIT"&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Total Billed Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.bill_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Paid Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.paid_amount]})]})]}),S.type==="REFUND"&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Deposit Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.opening_balance]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Total Balance"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",S.type==="DEPOSIT"?parseInt(S?.bill_amount)-parseInt(S?.paid_amount):S?.closing_balance]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-bottom-1 hfl-flex hfl-w-full hfl-items-start hfl-gap-2 hfl-px-1 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Print",icon:"Left",onClick:()=>k("billPrintPreview",!1),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>k("billSharePreview",!0),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},Ta=({closePrintModal:n})=>{const[d,c]=y.useState(fr[jr.consultation_lab_other_services].key),[a,v]=y.useState(null),[w,l]=y.useState(ft[5]),[A,S]=y.useState(""),[p,k]=y.useState(),[x,L]=y.useState([]),[V,O]=y.useState(1),[D,N]=y.useState(),{setLoading:P,patientIDs:T,variable:j}=y.useContext(Tt),[Q,I]=y.useState(0),[H,z]=y.useState(!1),J=y.useCallback(async()=>{try{if(P(!0),T?.patientRoleID){const $=await vl(T.patientRoleID,1,10,j);$&&(v($),L($.data))}P(!1)}catch{v(null),L([]),P(!1),console.log("error in getPaymentsList API Call")}},[T.patientRoleID,P,j]),Y=y.useCallback(async()=>{try{P(!0);const $=await _l(T?.patientRoleID||"",1,10,j);$&&(v($),L($?.wallet_transactions||[])),P(!1)}catch{v(null),L([]),P(!1),console.log("error in getDepositRefundList API Call")}},[T?.patientRoleID,P,j]),le=($=ft[5])=>{l($)},W=$=>{S($)},me=async $=>{if(k($),d===fr[jr.consultation_lab_other_services].key){if(W(Et[parseInt($?.service_category_id)-1]),l(ft[1]),$?.order_id){const ue=await ye($.order_id);N(ue)}}else l(ft[8])},je=async $=>{let ue=$;if(P(!0),ue<=Math.ceil(a?.total_records||0)){if(ue=$+1,ue!==$){let M,Ae;d==fr[jr.deposit_refund].key?(M=await _l(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.wallet_transactions]):(M=await vl(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.data]),L(Ae)}O(ue)}P(!1)},ye=async $=>{try{return await wl($,T?.patientRoleID||"",["order_items"],j)}catch{console.log("Error in Loading Bill Details from Bill Id")}},et=y.useCallback(async()=>{const $=await Cl(T?.patientRoleID||"",j);I($?.wallet_balance||0)},[T?.patientRoleID,j]),pe=$=>{c($),le(),n()};return y.useEffect(()=>{d==fr[jr.deposit_refund].key?Y():J()},[d,Y,J]),y.useEffect(()=>{et(),d==fr[jr.deposit_refund].key&&Y()},[d,et,Y,H]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[938px] hfl-flex-col hfl-justify-start hfl-px-4 hfl-py-2 xxs:max-md:hfl-w-[750px] ${w===ft[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:Object.values(fr).map(($,ue)=>e.jsxRuntimeExports.jsx(e.bi,{variant:`${d===$.key?"Semibold":"Regular"}`,type:"Text md",className:`hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-gap-0.5 hfl-px-[13px] hfl-py-2 ${d===$.key?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>pe($.key),children:$.label},ue))}),e.jsxRuntimeExports.jsx(Aa,{walletBalance:Q,handleRightSegment:le,headerText:fr[d].label}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-max-h-[470px] hfl-w-full hfl-flex-col hfl-overflow-y-scroll"}),x?.length?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto ",children:e.jsxRuntimeExports.jsx(Sa,{data:x,setTableData:L,handleRowClick:me,handleRightSegment:le,activeTab:d,closePrintModal:n,patient_entity_id:a?.entity_id||"",refreshPaymentData:J})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Qr,{currentPage:V,totalRecord:a?.total_records||0,currentTotal:V===Math.ceil((a?.total_records||0)/10)?a?.total_records||0:V*10,handleLoadMore:je})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:Na,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"No Active or Past Payments for the Patient"})]})]}),e.jsxRuntimeExports.jsxs(Pl,{children:[w===ft[1]&&e.jsxRuntimeExports.jsx(Al,{rightSegment:w,categorySummaryData:{...p,order_date:D?.order_date??""},serviceItem:A,handleRightSegment:le,serviceDetails:D?.order_items??[],getBillSummarydata:J,closePrintModal:n,setRefreshWallet:z,walletBalance:Q,getPastDueAmount:()=>{},refreshBillsList:()=>{},bill_date:""}),w===ft[7]&&e.jsxRuntimeExports.jsx(Dl,{depositAmount:Q,handleRightSegment:le,rightSegment:w,setRefreshWallet:z}),w===ft[8]&&e.jsxRuntimeExports.jsx(Da,{summaryData:{...p,order_date:D?.order_date??""},handleRightSegment:le,closePrintModal:n,patient_entity_id:a?.entity_id||""})]})]})},Tl=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-inset-0 hfl-z-[100] hfl-flex hfl-h-full hfl-w-full hfl-items-center hfl-justify-center hfl-overflow-y-auto hfl-outline-none focus:hfl-outline-none",children:e.jsxRuntimeExports.jsx(e.Eu,{progress:10,spinnerMode:!0})}),Jl=({columns:n,data:d})=>{const{getTableProps:c,getTableBodyProps:a,headerGroups:v,rows:w,prepareRow:l}=Jr.useTable({columns:n,data:d}),A=p=>{const k=[];return p?.headers?.length&&p.headers.map(x=>{k.push(e.jsxRuntimeExports.jsx("th",{...x.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:x.render("Header")})}))}),k},S=()=>{const p=[];return w.map((k,x)=>{l(k),p.push(e.jsxRuntimeExports.jsx("tr",{id:x.toString(),...k.getRowProps(),className:"hfl-bg-White hfl-group hfl-border-t-1 hfl-border-Gray-200",children:k.cells.map((L,V)=>e.jsxRuntimeExports.jsx("td",{"data-qa":x+1+"-"+(V+1),...L.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-[13px] hfl-text-Gray-500",children:L.render("Cell")})}))}))}),p};return e.jsxRuntimeExports.jsx("div",{className:"hfl-overflow-y-auto","data-qa":"lab-report-table",children:e.jsxRuntimeExports.jsxs("table",{...c(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:v.map(p=>e.jsxRuntimeExports.jsx("tr",{...p.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50 ",children:A(p)}))}),e.jsxRuntimeExports.jsx("tbody",{...a(),className:"hfl-rounded-",children:S()})]})})},Ia=n=>{const{visits:d=[],setPdfUrl:c,pdfUrl:a}=n,[v,w]=y.useState([]);return y.useEffect(()=>{w(Ba(d))},[]),e.jsxRuntimeExports.jsx("div",{children:v&&v.length&&v.map((l,A)=>l.reports.length>0&&l.reports.map((S,p)=>{const k=l.date||"No date available";S.label=`${new Date(k).toLocaleDateString()}${l.reports.length>1?` - ${p+1}`:""}`;const{lab_number:x,label:L,message:V=""}=S;return e.jsxRuntimeExports.jsx("div",{className:"hfl-relative hfl-mb-2 hfl-flex hfl-items-center hfl-justify-center",title:`${L} ${V?`(${V})`:""}
17
+ `,children:[p&&e.jsxRuntimeExports.jsxs("div",{className:"text:hfl-Gray-700 hfl-mb-3 hfl-w-[207px] hfl-rounded-lg hfl-bg-White hfl-p-3 hfl-shadow-lg",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Line Item Discount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Medium",type:"Text sm",children:["₹"," ",["1","2","3"].reduce((I,H)=>I+parseInt(p.bill_summary[H]?.order_item_sum_discount||"0"),0)]})]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Additional Discount"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:["1","2","3"].map(I=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[I==="1"&&"Consultations",I==="2"&&"Lab Services",I==="3"&&"Other Services"]}),"₹ ",p.bill_summary[I]?.order_discount||"0"]},I))})]}),e.jsxRuntimeExports.jsx("div",{className:"text:hfl-Gray-700 hfl-absolute hfl-bottom-2 hfl-left-1/2 hfl-h-3 hfl-w-3 hfl-translate-x-[-50%] hfl-rotate-45 hfl-bg-White"})]})]})]}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",parseInt(p.bill_summary[1]?.order_item_sum_discount||"0")+parseInt(p.bill_summary[2]?.order_item_sum_discount||"0")+parseInt(p.bill_summary[3]?.order_item_sum_discount||"0")+parseInt(p.bill_summary[1]?.order_discount||"0")+parseInt(p.bill_summary[2]?.order_discount||"0")+parseInt(p.bill_summary[3]?.order_discount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-inline-flex hfl-flex-1 hfl-items-center hfl-text-Gray-800 ",children:"Tax Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(p.bill_summary[1]?.order_service_tax||"0")+parseInt(p.bill_summary[2]?.order_service_tax||"0")+parseInt(p.bill_summary[3]?.order_service_tax||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Final Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(p.bill_summary[1]?.net_bill_amount||"0")+parseInt(p.bill_summary[2]?.net_bill_amount||"0")+parseInt(p.bill_summary[3]?.net_bill_amount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Received Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(p.bill_summary[1]?.order_paid_amount||"0")+parseInt(p.bill_summary[2]?.order_paid_amount||"0")+parseInt(p.bill_summary[3]?.order_paid_amount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Refund Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",parseInt(p.bill_summary[1]?.refund_amount||"0")+parseInt(p.bill_summary[2]?.refund_amount||"0")+parseInt(p.bill_summary[3]?.refund_amount||"0")]})]}),D&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px]",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Past Due Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.total_amount]}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>Q()})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Total Balance"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Bold",type:"Text lg",className:"hfl-text-Gray-800",children:["₹"," ",(parseInt(p.bill_summary[1]?.balance_amount||"0")||0)+(parseInt(p.bill_summary[2]?.balance_amount||"0")||0)+(parseInt(p.bill_summary[3]?.balance_amount||"0")||0)+(D&&parseInt(S?.total_amount||"0")||0)]})]}),e.jsxRuntimeExports.jsx(Sl,{isPayDue:D,rightSegment:c,pastDueData:S,showDiscount:w,showRefund:l,summaryData:p,date:d,getBillSummarydata:k,handleRightSegment:a,getPastDueAmount:x,refreshBillsList:L,deleteLastPaymemntMode:P,setDeleteLastPaymentMode:T,walletBalance:V,setRefreshWallet:O})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-px-2 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"to-print",hierarchy:"Tertiary",size:"md",textField:"Print",disabled:!1,icon:"Left",onClick:()=>v([1,2,3],"billPrintPreview",!1),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"to-share",hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>v([1,2,3],"billSharePreview",!0),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},aa=n=>{const{editedTableData:d,handleRightSegment:c,getBillSummarydata:a,order_date:v,editRowId:w,setTableData:l,refreshBillsList:A,handleRevertEdit:S}=n,{patientIDs:p,showToast:k,doctorListArr:x,billPreferences:L,formattedService:V,ppEventProps:O,variable:D}=y.useContext(Tt),[N,P]=y.useState(),T={bill_item_details:{doctor_name:D.window_var.doc_name_for_seg,referrer_doctor_role_id:D.window_var.doctor_role_id_for_seg,lab_owner_name:"",lab_owner_id:"",appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},appnt_doctor_role_id:""}},[j,Q]=y.useState(()=>({...d,...T})),I=(J,Y)=>{let le={};J==="labowner"?le={lab_owner_name:Y.labOwnerName,lab_owner_id:Y.LabOwnerDocRoleID||""}:le={doctor_name:Y.docName,referrer_doctor_role_id:Y.docRoleID},Q(W=>({...W,bill_item_details:{...W.bill_item_details,...le}}))},H=async(J="")=>{try{const Y=await Pn(J,D);P(Y)}catch(Y){console.error("Error in getReferalDoctorList API Call:",Y)}};y.useEffect(()=>{H()},[]);const z=async()=>{if(d?.order_item_id)try{const J=await Rl(d?.order_item_id,p.patientRoleID,D);Q(Y=>{const le=J.data;return{...Y,...tn,...le,service_category:Et[2],service_category_id:"3",order_item_service_tax_percentage:V?.[+le.service_id]?.service_tax||0,bill_item_details:{...Y.bill_item_details,...le.bill_item_details,appnt_doctor_role_id:"",referrer_doctor_role_id:""}}})}catch(J){console.error("Error fetching bill item data:",J)}};return y.useEffect(()=>{d&&Q({...j,...d})},[d]),y.useEffect(()=>{z()},[j.order_item_id]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text md",className:"hfl-max-w-[300px] hfl-truncate",children:j?.service_name}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{c(),S()}})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4",children:[L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:j.bill_item_details.doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",widthSufixDrpdwn:"hfl-w-[250px]",suffixOptions:x?.doctor_list?.map(J=>({label:J.doctor_name,value:J.doctor_name,appnt_doctor_role_id:J.doctor_identifier})),handleSuffixValChange:J=>{I("",{docName:J,docRoleID:""})},onSuffixDropdownClick:J=>{I("",{docName:J.label,docRoleID:J.appnt_doctor_role_id})}})}),L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.tj,{label:"Lab Owner (Referred By)",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hx_down hfl-bg-White_20",input2value:j.bill_item_details.lab_owner_name,inputProps:{disabled:!0},suffixInputProps:{placeholder:"Lab Owner (Referred By)"},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-border-l-0 hfl-w-[270px] hfl-text-ellipsis hfl-bg-White_20",widthSufixDrpdwn:"hfl-w-[305px]",suffixOptions:N?.referrals?.map(J=>({label:J.referralName,value:J.referralName,referralId:J.referralId})),onlySuffixDropdownItemsAllowed:!1,handleSuffixValChange:J=>{H(J),I("labowner",{labOwnerName:J,LabOwnerDocRoleID:""})},onSuffixDropdownClick:J=>{I("labowner",{labOwnerName:J.label,LabOwnerDocRoleID:J.referralId})}})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Update",className:"hfl-flex hfl-h-9 hfl-w-full hfl-shrink-0 hfl-items-center hfl-justify-center hfl-gap-1 hfl-self-stretch hfl-rounded-md hfl-p-3",onClick:async()=>{const J=await El(j,k,p.patientRoleID,Te.dayjs(v).format("YYYY-MM-DD"),O,Et[2],D);j.bill_item_details.lab_owner_name&&Sn(j.bill_item_details.lab_owner_name,p?.patientRoleID||"",D),J&&(l(Y=>Y.map((le,W)=>w==W.toString()?{...le,order_item_id:J.order_item_id||j.order_item_id}:le)),(J.order_item_id||j.order_item_id)&&(a(),c(),A(v)))}})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{c(),S()}})})]})},ia="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='50'%20height='49'%20viewBox='0%200%2050%2049'%20fill='none'%3e%3cg%20opacity='0.3'%20clip-path='url(%23clip0_916_82588)'%3e%3cpath%20d='M48.2399%2011.218V38.5495C48.2399%2039.4022%2047.9011%2040.2201%2047.2981%2040.8231C46.6951%2041.4261%2045.8772%2041.7649%2045.0244%2041.7649H4.83118C3.97839%2041.7649%203.16052%2041.4261%202.55751%2040.8231C1.95449%2040.2201%201.61572%2039.4022%201.61572%2038.5495V11.218L2.41959%2010.4142H47.436L48.2399%2011.218Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M48.2399%208.00245V11.2179H1.61572V8.00245C1.61572%207.14965%201.95449%206.33179%202.55751%205.72877C3.16052%205.12576%203.97839%204.78699%204.83118%204.78699H45.0244C45.8772%204.78699%2046.6951%205.12576%2047.2981%205.72877C47.9011%206.33179%2048.2399%207.14965%2048.2399%208.00245Z'%20fill='%23D0D5DD'/%3e%3cpath%20d='M10.4572%203.17951C10.4572%202.29158%209.73735%201.57178%208.84943%201.57178C7.9615%201.57178%207.2417%202.29158%207.2417%203.17951V6.39497C7.2417%207.28289%207.9615%208.0027%208.84943%208.0027C9.73735%208.0027%2010.4572%207.28289%2010.4572%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M18.4967%203.17951C18.4967%202.29158%2017.7769%201.57178%2016.889%201.57178C16.0011%201.57178%2015.2812%202.29158%2015.2812%203.17951V6.39497C15.2812%207.28289%2016.0011%208.0027%2016.889%208.0027C17.7769%208.0027%2018.4967%207.28289%2018.4967%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M26.5348%203.17951C26.5348%202.29158%2025.815%201.57178%2024.9271%201.57178C24.0391%201.57178%2023.3193%202.29158%2023.3193%203.17951V6.39497C23.3193%207.28289%2024.0391%208.0027%2024.9271%208.0027C25.815%208.0027%2026.5348%207.28289%2026.5348%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M34.5734%203.17951C34.5734%202.29158%2033.8536%201.57178%2032.9656%201.57178C32.0777%201.57178%2031.3579%202.29158%2031.3579%203.17951V6.39497C31.3579%207.28289%2032.0777%208.0027%2032.9656%208.0027C33.8536%208.0027%2034.5734%207.28289%2034.5734%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M42.6124%203.17951C42.6124%202.29158%2041.8926%201.57178%2041.0047%201.57178C40.1168%201.57178%2039.397%202.29158%2039.397%203.17951V6.39497C39.397%207.28289%2040.1168%208.0027%2041.0047%208.0027C41.8926%208.0027%2042.6124%207.28289%2042.6124%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M24.928%2034.5299C29.8115%2034.5299%2033.7705%2030.571%2033.7705%2025.6874C33.7705%2020.8038%2029.8115%2016.8449%2024.928%2016.8449C20.0444%2016.8449%2016.0854%2020.8038%2016.0854%2025.6874C16.0854%2030.571%2020.0444%2034.5299%2024.928%2034.5299Z'%20fill='%23D0D5DD'/%3e%3cpath%20d='M29.7505%2024.0798H26.5351V20.8644C26.5351%2020.6512%2026.4504%2020.4467%2026.2996%2020.2959C26.1489%2020.1452%2025.9444%2020.0605%2025.7312%2020.0605H24.1235C23.9103%2020.0605%2023.7058%2020.1452%2023.5551%2020.2959C23.4043%2020.4467%2023.3196%2020.6512%2023.3196%2020.8644V24.0798H20.1042C19.891%2024.0798%2019.6865%2024.1645%2019.5357%2024.3153C19.385%2024.466%2019.3003%2024.6705%2019.3003%2024.8837V26.4914C19.3003%2026.7046%2019.385%2026.9091%2019.5357%2027.0598C19.6865%2027.2106%2019.891%2027.2953%2020.1042%2027.2953H23.3196V30.5107C23.3196%2030.7239%2023.4043%2030.9284%2023.5551%2031.0791C23.7058%2031.2299%2023.9103%2031.3146%2024.1235%2031.3146H25.7312C25.9444%2031.3146%2026.1489%2031.2299%2026.2996%2031.0791C26.4504%2030.9284%2026.5351%2030.7239%2026.5351%2030.5107V27.2953H29.7505C29.9637%2027.2953%2030.1682%2027.2106%2030.319%2027.0598C30.4697%2026.9091%2030.5544%2026.7046%2030.5544%2026.4914V24.8837C30.5544%2024.6705%2030.4697%2024.466%2030.319%2024.3153C30.1682%2024.1645%2029.9637%2024.0798%2029.7505%2024.0798Z'%20fill='white'/%3e%3cpath%20d='M13.6731%2048.1958C15.8929%2048.1958%2017.6925%2046.3963%2017.6925%2044.1765C17.6925%2041.9567%2015.8929%2040.1572%2013.6731%2040.1572C11.4533%2040.1572%209.65381%2041.9567%209.65381%2044.1765C9.65381%2046.3963%2011.4533%2048.1958%2013.6731%2048.1958Z'%20fill='%2398A2B3'/%3e%3cpath%20d='M45.0241%203.9834H43.4164V3.17954C43.4164%202.53994%2043.1623%201.92655%2042.71%201.47428C42.2578%201.02202%2041.6444%200.767944%2041.0048%200.767944C40.3652%200.767944%2039.7518%201.02202%2039.2995%201.47428C38.8472%201.92655%2038.5932%202.53994%2038.5932%203.17954V3.9834H35.3777V3.17954C35.3777%202.53994%2035.1236%201.92655%2034.6714%201.47428C34.2191%201.02202%2033.6057%200.767944%2032.9661%200.767944C32.3265%200.767944%2031.7131%201.02202%2031.2609%201.47428C30.8086%201.92655%2030.5545%202.53994%2030.5545%203.17954V3.9834H27.3391V3.17954C27.3391%202.53994%2027.085%201.92655%2026.6327%201.47428C26.1805%201.02202%2025.5671%200.767944%2024.9275%200.767944C24.2879%200.767944%2023.6745%201.02202%2023.2222%201.47428C22.7699%201.92655%2022.5159%202.53994%2022.5159%203.17954V3.9834H19.3004V3.17954C19.3004%202.53994%2019.0463%201.92655%2018.5941%201.47428C18.1418%201.02202%2017.5284%200.767944%2016.8888%200.767944C16.2492%200.767944%2015.6358%201.02202%2015.1836%201.47428C14.7313%201.92655%2014.4772%202.53994%2014.4772%203.17954V3.9834H11.2618V3.17954C11.2618%202.53994%2011.0077%201.92655%2010.5554%201.47428C10.1032%201.02202%209.48977%200.767944%208.85017%200.767944C8.21058%200.767944%207.59718%201.02202%207.14492%201.47428C6.69265%201.92655%206.43858%202.53994%206.43858%203.17954V3.9834H4.83085C3.76525%203.98468%202.74366%204.40855%201.99017%205.16205C1.23667%205.91554%200.8128%206.93713%200.811523%208.00273L0.811523%2038.5496C0.8128%2039.6152%201.23667%2040.6368%201.99017%2041.3903C2.74366%2042.1438%203.76525%2042.5676%204.83085%2042.5689H9.13152C8.80047%2043.5017%208.7644%2044.5137%209.02822%2045.4677C9.29203%2046.4217%209.84294%2047.2714%2010.6062%2047.9015C11.3695%2048.5317%2012.3081%2048.9117%2013.2948%2048.9902C14.2814%2049.0686%2015.2683%2048.8416%2016.1216%2048.3399C16.9748%2047.8382%2017.653%2047.0862%2018.0642%2046.1859C18.4754%2045.2856%2018.5996%2044.2805%2018.4201%2043.3072C18.2405%2042.3338%2017.7659%2041.4393%2017.0605%2040.7449C16.3552%2040.0506%2015.4533%2039.59%2014.4772%2039.4258V31.3148C14.4772%2030.6752%2014.2231%2030.0618%2013.7709%2029.6096C13.3186%2029.1573%2012.7052%2028.9032%2012.0656%2028.9032H10.8598C10.54%2028.9032%2010.2333%2028.7762%2010.0072%2028.55C9.78107%2028.3239%209.65404%2028.0172%209.65404%2027.6974C9.65404%2027.3776%209.78107%2027.0709%2010.0072%2026.8448C10.2333%2026.6187%2010.54%2026.4916%2010.8598%2026.4916H15.3221C15.5196%2028.9036%2016.6173%2031.153%2018.397%2032.793C20.1767%2034.4329%2022.5082%2035.3433%2024.9283%2035.3433C27.3483%2035.3433%2029.6799%2034.4329%2031.4596%2032.793C33.2393%2031.153%2034.3369%2028.9036%2034.5345%2026.4916H35.3777C35.5909%2026.4916%2035.7954%2026.5763%2035.9461%2026.7271C36.0969%2026.8778%2036.1816%2027.0823%2036.1816%2027.2955V32.5206C36.1816%2033.2668%2036.478%2033.9824%2037.0056%2034.5101C37.5333%2035.0377%2038.2489%2035.3341%2038.9951%2035.3341C39.7413%2035.3341%2040.4569%2035.0377%2040.9846%2034.5101C41.5122%2033.9824%2041.8086%2033.2668%2041.8086%2032.5206V24.8115C42.9313%2024.6208%2043.9503%2024.0394%2044.6858%2023.1701C45.4213%2022.3007%2045.8258%2021.1994%2045.8279%2020.0607V15.2375C45.8279%2014.8111%2045.6586%2014.4022%2045.3571%2014.1007C45.0555%2013.7992%2044.6466%2013.6298%2044.2202%2013.6298H43.4164C43.2032%2013.6298%2042.9987%2013.7145%2042.8479%2013.8652C42.6972%2014.016%2042.6125%2014.2204%2042.6125%2014.4336C42.6125%2014.6468%2042.6972%2014.8513%2042.8479%2015.0021C42.9987%2015.1528%2043.2032%2015.2375%2043.4164%2015.2375H44.2202V20.0607C44.2202%2020.9135%2043.8814%2021.7314%2043.2784%2022.3344C42.6754%2022.9374%2041.8576%2023.2762%2041.0048%2023.2762C40.152%2023.2762%2039.3341%2022.9374%2038.7311%2022.3344C38.1281%2021.7314%2037.7893%2020.9135%2037.7893%2020.0607V15.2375H38.5932C38.8064%2015.2375%2039.0108%2015.1528%2039.1616%2015.0021C39.3123%2014.8513%2039.397%2014.6468%2039.397%2014.4336C39.397%2014.2204%2039.3123%2014.016%2039.1616%2013.8652C39.0108%2013.7145%2038.8064%2013.6298%2038.5932%2013.6298H37.7893C37.3629%2013.6298%2036.954%2013.7992%2036.6525%2014.1007C36.351%2014.4022%2036.1816%2014.8111%2036.1816%2015.2375V20.0607C36.1837%2021.1994%2036.5882%2022.3007%2037.3237%2023.1701C38.0592%2024.0394%2039.0783%2024.6208%2040.2009%2024.8115V32.5206C40.2009%2032.8404%2040.0739%2033.1471%2039.8477%2033.3732C39.6216%2033.5994%2039.3149%2033.7264%2038.9951%2033.7264C38.6753%2033.7264%2038.3686%2033.5994%2038.1425%2033.3732C37.9163%2033.1471%2037.7893%2032.8404%2037.7893%2032.5206V27.2955C37.7893%2026.6559%2037.5352%2026.0425%2037.083%2025.5902C36.6307%2025.138%2036.0173%2024.8839%2035.3777%2024.8839H34.5328C34.3353%2022.4719%2033.2377%2020.2225%2031.458%2018.5825C29.6782%2016.9426%2027.3467%2016.0322%2024.9267%2016.0322C22.5066%2016.0322%2020.1751%2016.9426%2018.3954%2018.5825C16.6157%2020.2225%2015.518%2022.4719%2015.3205%2024.8839H10.8598C10.1136%2024.8839%209.39801%2025.1803%208.87037%2025.708C8.34273%2026.2356%208.04631%2026.9512%208.04631%2027.6974C8.04631%2028.4436%208.34273%2029.1592%208.87037%2029.6869C9.39801%2030.2145%2010.1136%2030.5109%2010.8598%2030.5109H12.0656C12.2788%2030.5109%2012.4833%2030.5956%2012.634%2030.7464C12.7848%2030.8971%2012.8695%2031.1016%2012.8695%2031.3148V39.4258C11.7956%2039.6088%2010.8152%2040.15%2010.0881%2040.9612H4.83085C4.19125%2040.9612%203.57785%2040.7071%203.12559%2040.2548C2.67333%2039.8026%202.41925%2039.1892%202.41925%2038.5496V12.0221H47.4357V38.5496C47.4357%2039.1892%2047.1816%2039.8026%2046.7293%2040.2548C46.2771%2040.7071%2045.6637%2040.9612%2045.0241%2040.9612H20.1043C19.8911%2040.9612%2019.6866%2041.0459%2019.5359%2041.1966C19.3851%2041.3474%2019.3004%2041.5519%2019.3004%2041.7651C19.3004%2041.9782%2019.3851%2042.1827%2019.5359%2042.3335C19.6866%2042.4842%2019.8911%2042.5689%2020.1043%2042.5689H45.0241C46.0897%2042.5676%2047.1113%2042.1438%2047.8648%2041.3903C48.6183%2040.6368%2049.0421%2039.6152%2049.0434%2038.5496V8.00273C49.0421%206.93713%2048.6183%205.91554%2047.8648%205.16205C47.1113%204.40855%2046.0897%203.98468%2045.0241%203.9834ZM24.9275%2017.6491C26.5174%2017.6491%2028.0715%2018.1206%2029.3935%2019.0039C30.7154%2019.8872%2031.7458%2021.1426%2032.3542%2022.6115C32.9626%2024.0804%2033.1218%2025.6967%2032.8117%2027.256C32.5015%2028.8154%2031.7359%2030.2477%2030.6116%2031.3719C29.4874%2032.4962%2028.0551%2033.2618%2026.4957%2033.5719C24.9364%2033.8821%2023.3201%2033.7229%2021.8512%2033.1145C20.3823%2032.5061%2019.1269%2031.4757%2018.2436%2030.1538C17.3603%2028.8318%2016.8888%2027.2776%2016.8888%2025.6878C16.8912%2023.5565%2017.7388%2021.5132%2019.2459%2020.0062C20.7529%2018.4991%2022.7962%2017.6514%2024.9275%2017.6491ZM13.6734%2040.9612C14.3093%2040.9612%2014.931%2041.1498%2015.4598%2041.5031C15.9886%2041.8564%2016.4007%2042.3586%2016.6441%2042.9461C16.8874%2043.5337%2016.9511%2044.1802%2016.827%2044.804C16.703%2045.4277%2016.3967%2046.0006%2015.947%2046.4503C15.4973%2046.9%2014.9244%2047.2063%2014.3007%2047.3303C13.6769%2047.4544%2013.0304%2047.3907%2012.4429%2047.1473C11.8553%2046.904%2011.3531%2046.4918%2010.9998%2045.9631C10.6465%2045.4343%2010.4579%2044.8126%2010.4579%2044.1766C10.4579%2043.3239%2010.7967%2042.506%2011.3997%2041.903C12.0027%2041.3%2012.8206%2040.9612%2013.6734%2040.9612ZM40.2009%203.17954C40.2009%202.96634%2040.2856%202.76187%2040.4363%202.61112C40.5871%202.46037%2040.7916%202.37567%2041.0048%202.37567C41.218%202.37567%2041.4224%202.46037%2041.5732%202.61112C41.7239%202.76187%2041.8086%202.96634%2041.8086%203.17954V6.395C41.8086%206.6082%2041.7239%206.81266%2041.5732%206.96342C41.4224%207.11417%2041.218%207.19886%2041.0048%207.19886C40.7916%207.19886%2040.5871%207.11417%2040.4363%206.96342C40.2856%206.81266%2040.2009%206.6082%2040.2009%206.395V3.17954ZM32.1622%203.17954C32.1622%202.96634%2032.2469%202.76187%2032.3977%202.61112C32.5484%202.46037%2032.7529%202.37567%2032.9661%202.37567C33.1793%202.37567%2033.3838%202.46037%2033.5345%202.61112C33.6853%202.76187%2033.77%202.96634%2033.77%203.17954V6.395C33.77%206.6082%2033.6853%206.81266%2033.5345%206.96342C33.3838%207.11417%2033.1793%207.19886%2032.9661%207.19886C32.7529%207.19886%2032.5484%207.11417%2032.3977%206.96342C32.2469%206.81266%2032.1622%206.6082%2032.1622%206.395V3.17954ZM24.1236%203.17954C24.1236%202.96634%2024.2083%202.76187%2024.359%202.61112C24.5098%202.46037%2024.7143%202.37567%2024.9275%202.37567C25.1407%202.37567%2025.3451%202.46037%2025.4959%202.61112C25.6466%202.76187%2025.7313%202.96634%2025.7313%203.17954V6.395C25.7313%206.6082%2025.6466%206.81266%2025.4959%206.96342C25.3451%207.11417%2025.1407%207.19886%2024.9275%207.19886C24.7143%207.19886%2024.5098%207.11417%2024.359%206.96342C24.2083%206.81266%2024.1236%206.6082%2024.1236%206.395V3.17954ZM16.085%203.17954C16.085%202.96634%2016.1696%202.76187%2016.3204%202.61112C16.4712%202.46037%2016.6756%202.37567%2016.8888%202.37567C17.102%202.37567%2017.3065%202.46037%2017.4572%202.61112C17.608%202.76187%2017.6927%202.96634%2017.6927%203.17954V6.395C17.6927%206.6082%2017.608%206.81266%2017.4572%206.96342C17.3065%207.11417%2017.102%207.19886%2016.8888%207.19886C16.6756%207.19886%2016.4712%207.11417%2016.3204%206.96342C16.1696%206.81266%2016.085%206.6082%2016.085%206.395V3.17954ZM8.04631%203.17954C8.04631%202.96634%208.131%202.76187%208.28175%202.61112C8.43251%202.46037%208.63697%202.37567%208.85017%202.37567C9.06337%202.37567%209.26783%202.46037%209.41859%202.61112C9.56934%202.76187%209.65404%202.96634%209.65404%203.17954V6.395C9.65404%206.6082%209.56934%206.81266%209.41859%206.96342C9.26783%207.11417%209.06337%207.19886%208.85017%207.19886C8.63697%207.19886%208.43251%207.11417%208.28175%206.96342C8.131%206.81266%208.04631%206.6082%208.04631%206.395V3.17954ZM2.41925%2010.4143V8.00273C2.41925%207.36313%202.67333%206.74973%203.12559%206.29747C3.57785%205.84521%204.19125%205.59113%204.83085%205.59113H6.43858V6.395C6.43858%207.03459%206.69265%207.64799%207.14492%208.10025C7.59718%208.55252%208.21058%208.80659%208.85017%208.80659C9.48977%208.80659%2010.1032%208.55252%2010.5554%208.10025C11.0077%207.64799%2011.2618%207.03459%2011.2618%206.395V5.59113H14.4772V6.395C14.4772%207.03459%2014.7313%207.64799%2015.1836%208.10025C15.6358%208.55252%2016.2492%208.80659%2016.8888%208.80659C17.5284%208.80659%2018.1418%208.55252%2018.5941%208.10025C19.0463%207.64799%2019.3004%207.03459%2019.3004%206.395V5.59113H22.5159V6.395C22.5159%207.03459%2022.7699%207.64799%2023.2222%208.10025C23.6745%208.55252%2024.2879%208.80659%2024.9275%208.80659C25.5671%208.80659%2026.1805%208.55252%2026.6327%208.10025C27.085%207.64799%2027.3391%207.03459%2027.3391%206.395V5.59113H30.5545V6.395C30.5545%207.03459%2030.8086%207.64799%2031.2609%208.10025C31.7131%208.55252%2032.3265%208.80659%2032.9661%208.80659C33.6057%208.80659%2034.2191%208.55252%2034.6714%208.10025C35.1236%207.64799%2035.3777%207.03459%2035.3777%206.395V5.59113H38.5932V6.395C38.5932%207.03459%2038.8472%207.64799%2039.2995%208.10025C39.7518%208.55252%2040.3652%208.80659%2041.0048%208.80659C41.6444%208.80659%2042.2578%208.55252%2042.71%208.10025C43.1623%207.64799%2043.4164%207.03459%2043.4164%206.395V5.59113H45.0241C45.6637%205.59113%2046.2771%205.84521%2046.7293%206.29747C47.1816%206.74973%2047.4357%207.36313%2047.4357%208.00273V10.4143H2.41925Z'%20fill='%2398A2B3'/%3e%3cpath%20d='M22.5154%2028.0995V30.5111C22.5154%2030.9375%2022.6848%2031.3465%2022.9863%2031.648C23.2878%2031.9495%2023.6968%2032.1189%2024.1231%2032.1189H25.7309C26.1573%2032.1189%2026.5662%2031.9495%2026.8677%2031.648C27.1692%2031.3465%2027.3386%2030.9375%2027.3386%2030.5111V28.0995H29.7502C30.1766%2028.0995%2030.5855%2027.9301%2030.887%2027.6286C31.1885%2027.3271%2031.3579%2026.9182%2031.3579%2026.4918V24.8841C31.3579%2024.4577%2031.1885%2024.0487%2030.887%2023.7472C30.5855%2023.4457%2030.1766%2023.2763%2029.7502%2023.2763H27.3386V20.8647C27.3386%2020.4384%2027.1692%2020.0294%2026.8677%2019.7279C26.5662%2019.4264%2026.1573%2019.257%2025.7309%2019.257H24.1231C23.6968%2019.257%2023.2878%2019.4264%2022.9863%2019.7279C22.6848%2020.0294%2022.5154%2020.4384%2022.5154%2020.8647V23.2763H20.1038C19.6774%2023.2763%2019.2685%2023.4457%2018.967%2023.7472C18.6655%2024.0487%2018.4961%2024.4577%2018.4961%2024.8841V26.4918C18.4961%2026.9182%2018.6655%2027.3271%2018.967%2027.6286C19.2685%2027.9301%2019.6774%2028.0995%2020.1038%2028.0995H22.5154ZM20.1038%2024.8841H23.3193C23.5325%2024.8841%2023.7369%2024.7994%2023.8877%2024.6486C24.0385%2024.4979%2024.1231%2024.2934%2024.1231%2024.0802V20.8647H25.7309V24.0802C25.7309%2024.2934%2025.8156%2024.4979%2025.9663%2024.6486C26.1171%2024.7994%2026.3215%2024.8841%2026.5347%2024.8841H29.7502V26.4918H26.5347C26.3215%2026.4918%2026.1171%2026.5765%2025.9663%2026.7272C25.8156%2026.878%2025.7309%2027.0825%2025.7309%2027.2957V30.5111H24.1231V27.2957C24.1231%2027.0825%2024.0385%2026.878%2023.8877%2026.7272C23.7369%2026.5765%2023.5325%2026.4918%2023.3193%2026.4918H20.1038V24.8841Z'%20fill='%2398A2B3'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_916_82588'%3e%3crect%20width='48.2319'%20height='48.2319'%20fill='white'%20transform='translate(0.811523%200.767883)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",oa=n=>{const{showToast:d,patientIDs:c,doctorListArr:a,patientDetails:v,billPreferences:w,formattedService:l,ppEventProps:A,variable:S}=y.useContext(Tt),{bill_date:p,handleRightSegment:k,getBillSummarydata:x,editedTableData:L,setTableData:V,editRowId:O,refreshBillsList:D,handleRevertEdit:N,checkAppointmentForBilling:P}=n,[T,j]=y.useState([]),Q=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),I=a?.doctor_list?.length===1?a?.doctor_list[0]:{doctor_name:"",doctor_identifier:""},H={...zl,appnt_doctor_name:window.role_id=="11"?window.doc_name_for_seg:I?.doctor_name,appnt_doctor_role_id:window.role_id=="11"?window.doctor_role_id_for_seg:I?.doctor_identifier,appnt_duration:+w?.print?.bill?.appnt_minute_slab,appnt_time_time:Q?.split(" ")[0]||"",appnt_time_format:Q?.split(" ")[1]||"",total_price:"",appnt_date:Te.dayjs().format("YYYY-MM-DD"),appnt_service_id:L?.service_id||"",appnt_service_name:L?.service_name||"",...L},[z,J]=y.useState(H),[Y,le]=y.useState(!1),W=async()=>{if(L?.order_item_id)try{const $=await Rl(L.order_item_id,c.patientRoleID,S),{created_on:ue,order_item_service_tax:M,service_id:Ae,bill_item_details:Fe,order_item_id:He,item_quantity:mt,order_unit_item_price:pt,order_item_price:nt,order_item_discount:Oe,service_name:at}=$.data,{appointment_details:Pt,doctor_name:xt}=Fe,{appnt_id:Nt,appnt_date:Bt=Te.dayjs().format("YYYY-MM-DD"),appnt_time:B,appnt_status:De,appnt_duration:qe,doctor_role_id:re}=Pt,X=new Date("1970-01-01T"+B+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"}),Z={appnt_time_time:"",appnt_time_format:""};X&&X!=="Invalid Date"&&(Z.appnt_time_time=X?.split(" ")[0],Z.appnt_time_format=X?.split(" ")[1]),J(ie=>({...ie,appnt_id:Nt,patient_role_id:c.patientRoleID,appnt_doctor_role_id:re,appnt_service_id:Ae,appnt_date:Bt,appnt_time:B,appnt_status:De,appnt_duration:qe,appnt_doctor_name:xt,appnt_service_name:at,appnt_mode:"inperson",order_item_id:He,item_quantity:mt,order_unit_item_price:pt,order_item_price:nt,order_item_discount:Oe,order_item_service_tax:""+Math.floor(+M),order_item_service_tax_percentage:l[+Ae]?.service_tax||0,total_price:"",appnt_created_on:ue,order_item_created_on:ue,...Z}))}catch($){J(H),console.error("Error fetching bill item data:",$)}};y.useEffect(()=>{L&&J({...z,...L})},[L]),y.useEffect(()=>{W()},[z.order_item_id]);const[me,je]=y.useState(!1),ye=($,ue)=>{J(M=>({...M,[$]:ue}))},et=async()=>{try{const $=await fn(L.service_id,Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,S);if($?.appointments?.length)for(const ue of $.appointments){const M=new Date("1970-01-01T"+ue.appnt_time+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});M&&M!=="Invalid Date"&&(ue.appnt_time_time=M?.split(" ")[0],ue.appnt_time_format=M?.split(" ")[1])}j($?.appointments)}catch{console.log("error in getAppointmentsList API Call")}};y.useEffect(()=>{et()},[L?.service_id]);const pe=z.appnt_date&&Te.dayjs(z.appnt_date).format("YYYY-MM-DD")<Te.dayjs().format("YYYY-MM-DD");return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[340px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text md",className:"hfl-truncate hfl-capitalize",title:L?.service_name||"",children:L?.service_name||""}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{k(),N()}})]}),T.length>0&&!me&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-2.5 hfl-px-[13px] hfl-py-3",children:[T.map(($,ue)=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-shrink-0 hfl-flex-col hfl-items-start hfl-gap-[5px] hfl-rounded-md hfl-border-Gray-200 hfl-bg-White_20 hfl-px-3 hfl-py-2 hfl-shadow-md hover:hfl-bg-Gray-100",onClick:()=>{je(!0),J(M=>({...M,...$}))},children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["Consultation with ",$.appnt_doctor_name]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",children:`${$.appnt_time_time} ${$.appnt_time_format}`}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[11px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_inperson hfl-text-3"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:"In-Person"})]})]})]},ue)),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"Create New Appointment",disabled:Te.dayjs(p).format("YYYY-MM-DD")!==Te.dayjs().format("YYYY-MM-DD"),className:"hfl-h-10 hfl-w-full hfl-justify-center hfl-bg-White_20 hfl-text-[13px] hover:hfl-bg-Gray-100",onClick:()=>{je(!0),J(H)}})]}),(Te.dayjs(p).format("YYYY-MM-DD")===Te.dayjs().format("YYYY-MM-DD")&&T.length==0||me)&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-4 hfl-px-3 hfl-py-4",children:[e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:z.appnt_doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:`hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20 ${pe?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-12",widthSufixDrpdwn:"hfl-w-[250px]",suffixOptions:a?.doctor_list?.map($=>({label:$.doctor_name,value:$.doctor_name,appnt_doctor_role_id:$.doctor_identifier})),handleSuffixValChange:$=>{ye("appnt_doctor_name",$),ye("appnt_doctor_role_id","")},onSuffixDropdownClick:$=>{ye("appnt_doctor_name",$.label),ye("appnt_doctor_role_id",$.appnt_doctor_role_id)}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Date & Time of Appointment"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-gap-2",children:[pe?e.jsxRuntimeExports.jsx(e.Pi,{className:"!hfl-h-[40px]",width:"120px",start_icon:"hx_calendar",inputProps:{value:z.appnt_date,disabled:!0}}):e.jsxRuntimeExports.jsx(e.ZC,{placeholder:"Today",width:"120px",height:"!hfl-h-[40px]",selectDate:new Date(Te.dayjs(z.appnt_date).format("DD-MMM-YYYY")),dateVar:$=>{ye("appnt_date",Te.dayjs($).format("YYYY-MM-DD"))},isborderRequired:!0,minDate:new Date}),e.jsxRuntimeExports.jsx(e.tj,{className:` hfl-w-20 ${pe?" hfl-pointer-events-none":""}`,suffixClassName:` hfl-w-10 ${pe?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-[80px]",input1value:z?.appnt_time_time||"",input2value:z?.appnt_time_format||"",end_icon:"hx_down",inputProps:{placeholder:"10:00",onBlur:$=>{ye("appnt_time_time",$.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:$=>{ye("appnt_time_format",$.value)}})]})]}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ir.find($=>$.value==z.appnt_duration)?.label,value:z.appnt_duration},label:"Duration",className:`hfl-text-Gray-800 ${pe?" hfl-pointer-events-none":""}`,onChange:$=>{ye("appnt_duration",$.value)},options:Ir}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Type"}),e.jsxRuntimeExports.jsx(e.ju,{options:[{start_icon:"hx_inperson hfl-text-3",label:"In-Person",value:"inperson"}],disabled:!1,value:"inperson"})]}),window?.partner_service_enabled==="1"&&v?.insurance_details?.policy_id?.length&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-1.5",children:e.jsxRuntimeExports.jsx(e.Oi,{size:"md",disabled:!1,isMarked:Y,text:"Partner Enabled",onClick:()=>le($=>!$),"data-qa":"skip-billing"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"No",className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{k(),je(!1)}}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:z?.appnt_id?.length?"Update":"Create",icon:"No",onClick:async()=>{if(Te.dayjs(p).format("YYYY-MM-DD")<Te.dayjs().format("YYYY-MM-DD"))await El(z,d,c.patientRoleID,Te.dayjs(p).format("YYYY-MM-DD"),A,Et[0],S)&&k();else{const $=await Zl(z,!1,d,v,c,A,Y,!0,S);$&&(V(ue=>ue.map((M,Ae)=>O==Ae.toString()?{...M,order_item_id:$.order_item_id||z.order_item_id}:M)),J(ue=>({...ue,order_item_id:$.order_item_id,appnt_id:$.appnt_id,order_id:$.order_id})),$.order_item_id&&$.appnt_id&&k())}x(),D(p),P()},className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800"})]})]}),Te.dayjs(p).format("YYYY-MM-DD")!==Te.dayjs().format("YYYY-MM-DD")&&T.length==0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-[11px]",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[58px] hfl-pb-4",src:ia,alt:"no-bills"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-1.5 hfl-text-Error-600",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_error-filled hfl-h-5 hfl-w-5 "}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"There is no visit/prescription on this date."})]}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Bill cannot be created without a visit"})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-sticky hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{me?je(!1):k(),N()}})})]})},ua=n=>{const{handleRightSegment:d,editedTableData:c,getBillSummarydata:a,order_date:v,setTableData:w,editRowId:l,refreshBillsList:A,handleRevertEdit:S}=n,{patientIDs:p,showToast:k,doctorListArr:x,billPreferences:L,formattedService:V,ppEventProps:O,variable:D}=y.useContext(Tt)||{},N={bill_item_details:{appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},doctor_name:D.window_var.doc_name_for_seg,referrer_doctor_role_id:D.window_var.doctor_role_id_for_seg,lab_owner_name:"",lab_owner_id:"",appnt_doctor_role_id:""}},[P,T]=y.useState({...c,...N}),j=y.useCallback(async()=>{if(c?.order_item_id)try{const I=await Rl(c.order_item_id,p?.patientRoleID||"",D);T({...c,...I.data,service_category:Et[1],service_category_id:"2",order_item_service_tax_percentage:V?.[+I.data.service_id]?.service_tax||0,bill_item_details:{...N.bill_item_details,...I.data.bill_item_details,appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},lab_owner_name:"",lab_owner_id:"0",appnt_doctor_role_id:"",referrer_doctor_role_id:""}})}catch(I){console.error("Error fetching bill item data:",I)}},[N.bill_item_details,c,V,p?.patientRoleID,D]);y.useEffect(()=>{c&&T(I=>({...I,...c}))},[c]),y.useEffect(()=>{j()},[j,P.order_item_id]);const Q=I=>{const H={...P,service_category:Et[1],bill_item_details:{doctor_name:I.docName,appointment_details:null,lab_owner_name:"",lab_owner_id:"",referrer_doctor_role_id:I.docRoleID}};T(H)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",children:P?.service_name}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{d(),S()}})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4",children:[L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:P.bill_item_details.doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",suffixOptions:x?.doctor_list?.map(I=>({label:I.doctor_name,value:I.doctor_name,appnt_doctor_role_id:I.doctor_identifier})),handleSuffixValChange:I=>{Q({docName:I,docRoleID:""})},onSuffixDropdownClick:I=>{Q({docName:I.label,docRoleID:I.appnt_doctor_role_id})}})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Update",className:"hfl-flex hfl-h-9 hfl-w-full hfl-shrink-0 hfl-items-center hfl-justify-center hfl-gap-1 hfl-self-stretch hfl-rounded-md hfl-p-3",onClick:async()=>{const I=await El(P,k,p?.patientRoleID||"",Te.dayjs(v).format("YYYY-MM-DD"),O,Et[1],D);I&&(w(H=>H.map((z,J)=>l==J.toString()?{...z,order_item_id:I?.order_item_id||P.order_item_id}:z)),(I?.order_item_id||P.order_item_id)&&(a(),d(),A(v)))}})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{d(),S()}})})]})};var Is={exports:{}},ca=Is.exports,Wl;function da(){return Wl||(Wl=1,function(n,d){(function(c,a){n.exports=a()})(ca,function(){var c="minute",a=/[+-]\d\d(?::?\d\d)?/g,v=/([+-]|\d\d)/g;return function(w,l,A){var S=l.prototype;A.utc=function(D){var N={date:D,utc:!0,args:arguments};return new l(N)},S.utc=function(D){var N=A(this.toDate(),{locale:this.$L,utc:!0});return D?N.add(this.utcOffset(),c):N},S.local=function(){return A(this.toDate(),{locale:this.$L,utc:!1})};var p=S.parse;S.parse=function(D){D.utc&&(this.$u=!0),this.$utils().u(D.$offset)||(this.$offset=D.$offset),p.call(this,D)};var k=S.init;S.init=function(){if(this.$u){var D=this.$d;this.$y=D.getUTCFullYear(),this.$M=D.getUTCMonth(),this.$D=D.getUTCDate(),this.$W=D.getUTCDay(),this.$H=D.getUTCHours(),this.$m=D.getUTCMinutes(),this.$s=D.getUTCSeconds(),this.$ms=D.getUTCMilliseconds()}else k.call(this)};var x=S.utcOffset;S.utcOffset=function(D,N){var P=this.$utils().u;if(P(D))return this.$u?0:P(this.$offset)?x.call(this):this.$offset;if(typeof D=="string"&&(D=function(I){I===void 0&&(I="");var H=I.match(a);if(!H)return null;var z=(""+H[0]).match(v)||["-",0,0],J=z[0],Y=60*+z[1]+ +z[2];return Y===0?0:J==="+"?Y:-Y}(D),D===null))return this;var T=Math.abs(D)<=16?60*D:D;if(T===0)return this.utc(N);var j=this.clone();if(N)return j.$offset=T,j.$u=!1,j;var Q=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(j=this.local().add(T+Q,c)).$offset=T,j.$x.$localOffset=Q,j};var L=S.format;S.format=function(D){var N=D||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return L.call(this,N)},S.valueOf=function(){var D=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*D},S.isUTC=function(){return!!this.$u},S.toISOString=function(){return this.toDate().toISOString()},S.toString=function(){return this.toDate().toUTCString()};var V=S.toDate;S.toDate=function(D){return D==="s"&&this.$offset?A(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():V.call(this)};var O=S.diff;S.diff=function(D,N,P){if(D&&this.$u===D.$u)return O.call(this,D,N,P);var T=this.local(),j=A(D).local();return O.call(T,j,N,P)}}})}(Is)),Is.exports}var fa=da();const Nl=e.getDefaultExportFromCjs(fa),Al=n=>{Te.dayjs.extend(Nl);const{categorySummaryData:d,serviceDetails:c,walletBalance:a,rightSegment:v,serviceItem:w,bill_date:l,handleRightSegment:A,getBillSummarydata:S,getPastDueAmount:p,refreshBillsList:k,closePrintModal:x,setRefreshWallet:L}=n,V=y.useContext(Tt);if(!V)throw new Error("ServiceLevelBillSummary must be used within an AppContext.Provider");const{patientDetails:O,patientIDs:D,billPreferences:N,setShowPrintModal:P,currentWindow:T,showPrintModal:j,variable:Q}=V,I=()=>{switch(w){case Et[0]:return"Consultation Bill";case Et[1]:return"Other Service Bill";case Et[2]:return"Lab Service Bill";default:return`${w} Bill`}},H=async(z,J,Y)=>{if(j?.visible&&x(),!d)return;const le=await Kl(d.order_id,D?.patientRoleID||"",Q),W=c.map(He=>({serviceName:He.service_name,price:+He.order_unit_item_price,gst:+He.order_item_service_tax,discount:+He.order_item_discount,netPrice:+He.net_amount,itemQty:+He.item_quantity})),me=+d.order_paid_amount,je=+d.refund_amount,ye=+d.balance_amount,et=+d.order_discount,pe=+d.order_item_sum_discount,$=+d.order_service_tax,ue={paymentStatus:me-je===0?"red":ye===0?"green":"yellow",paymentMode:le?.paymentModes?.length?le.paymentModes.join(", "):"",billedAmount:+d.order_total,discountAmount:et+pe,gstAmount:$,cgstAmount:($/2).toFixed(2),sgstAmount:($/2).toFixed(2),finalAmount:+d.net_bill_amount,receivedAmount:me,balanceAmount:ye,refundAmount:je},Ae=[O?.age&&typeof O.age=="number"?`${O.age}y`:O?.org_person_dob?pr(O.org_person_dob):"",O?.gender?Xr[O.gender]:"",O?.blood_group].filter(Boolean).join(", "),Fe={name:`${nr(O?.name??"")}${Ae?` (${Ae})`:""}`,billDate:Te.dayjs(d.order_date).format("DD-MMM-YYYY"),mobileNumber:O?.phone_number??"",email:O?.email??"",billNumber:d.order_id_str,patientId:O?.org_person_bid_str??"",patientIdForEmail:D?.patientRoleID??"",billStatus:ye===0?"PAID":"UNPAID",address:[O?.address,O?.city,O?.pincode].filter(Boolean).join(", "),referredBy:le?.lab_owner_name?nr(le.lab_owner_name):O?.ref_doc_name?nr(O.ref_doc_name):"--"};P({printDataFrom:"patient_popup",visible:!0,whichPreview:z,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:J,preferences:{...N?.print?.bill,...N?.org_details},billSummaryDetails:ue,billServiceDetails:W,billPatientDetails:Fe,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:d?.order_id}},trackEventHandler:()=>{console.log(Y)}})};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_arrow-left hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>A(ft[0])}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex hfl-items-center",children:[I()," : ",e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Primary-600",children:d?.order_id_str})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Gross Bill Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_total??0]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Discount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",+(d?.order_discount||0)+ +(d?.order_item_sum_discount||0)]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Tax Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_service_tax]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Net Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.net_bill_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Collected Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_paid_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Refund Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",d?.refund_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Net Paid Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Success-500",children:["₹ ",+(d?.order_paid_amount||0)-+(d?.refund_amount||0)]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Total Balance Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Warning-500 ",children:["₹ ",d?.balance_amount]})]}),e.jsxRuntimeExports.jsx(Sl,{showDiscount:T!==Rt[4],showRefund:T!==Rt[4],rightSegment:v,summaryData:d,getBillSummarydata:S,handleRightSegment:A,serviceItem:w,getPastDueAmount:p,date:l,refreshBillsList:k,setRefreshWallet:L,walletBalance:a})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-px-1 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Print",icon:"Left",onClick:()=>H("billPrintPreview",!1,"BILL_PRINT"),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>H("billSharePreview",!0,"BILL_SHARE"),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},Dl=({depositAmount:n,handleRightSegment:d,rightSegment:c,setRefreshWallet:a})=>e.jsxRuntimeExports.jsxs("div",{className:" hfl-flex hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-border-b hfl-border-Gray-200 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-px-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-1"}),e.jsxRuntimeExports.jsx("i",{className:"hx_arrow-left hfl-cursor-pointer hfl-text-4 hfl-font-inter-2",onClick:()=>{d()}}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text md",className:"hfl-flex hfl-items-center",children:"Deposit Amount"})]}),e.jsxRuntimeExports.jsx("i",{className:"hx_close hfl-cursor-pointer hfl-text-right hfl-text-4 hfl-font-inter-2",onClick:()=>{d()}})]}),e.jsxRuntimeExports.jsxs("div",{className:`${n>0?"hfl-bg-Success-50":"hfl-bg-Warning-50"} hfl-m-3 hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-rounded-lg hfl-border hfl-border-Gray-200 hfl-px-2 hfl-py-3`,children:[e.jsxRuntimeExports.jsx("span",{className:`hfl-text-5 hfl-font-inter-3 ${n>0?"hfl-text-Success-600":"hfl-text-Gray-800"} `,children:"₹"+n}),e.jsxRuntimeExports.jsx("span",{className:"hfl-mt-[-8px] hfl-text-1 hfl-text-Gray-500",children:"Balance"})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-px-3",children:e.jsxRuntimeExports.jsx(Sl,{rightSegment:c,showDeposit:!0,showPayment:!1,showDiscount:!1,showDepositRefund:!0,showRefund:!1,handleRightSegment:d,walletBalance:n,setRefreshWallet:a})})]}),pa=({closePrintModal:n})=>{if(!y.useContext(Tt))throw new Error("AddBills component must be used within an PatientPopupContext.Provider");const{patientDetails:d,patientIDs:c,billPreferences:a,setShowPrintModal:v,showPrintModal:w,setLoading:l,showToast:A,variable:S}=y.useContext(Tt),[p,k]=y.useState(new Date),[x,L]=y.useState(),[V,O]=y.useState(ft[0]),[D,N]=y.useState([]),[P,T]=y.useState([]),[j,Q]=y.useState(""),[I,H]=y.useState(),[z,J]=y.useState(!1),[Y,le]=y.useState(fl),[W,me]=y.useState("-1"),[je,ye]=y.useState({bill_summary:{},status:!1,message:""}),[et,pe]=y.useState(!1),[$,ue]=y.useState(0),M=B=>{Q(B)},Ae=async B=>{l(!0);try{await pt(B),k(B)}catch(De){console.error(De)}l(!1)},Fe=async()=>{try{const B=await un(c.patientRoleID,Te.dayjs(p).format("YYYY-MM-DD"),S);ye(B)}catch(B){console.error("Error in getBillSummary API Call:",B)}},He=()=>{le(B=>P.length>+W&&+W>=0?[...B.slice(0,+W),{order_id:P[W].order_id,order_date:P[W].order_date,order_created_on:P[W].order_created_on,service_category:P[W].service_category,service_category_id:P[W].service_category_id,order_id_str:P[W].order_id_str,order_total:P[W].order_total,order_paid_amount:P[W].order_paid_amount,order_item_sum_discount:P[W].order_item_sum_discount,order_discount:P[W].order_discount,refund_amount:P[W].refund_amount,order_service_tax:P[W].order_service_tax,balance_amount:P[W].balance_amount,net_bill_amount:P[W].net_bill_amount,order_item_id:P[W].order_item_id,service_id:P[W]?.service_id,service_name:P[W].service_name,item_quantity:P[W].item_quantity,order_unit_item_price:P[W].order_unit_item_price,order_item_price:P[W].order_item_price,order_item_discount:P[W].order_item_discount,order_item_service_tax:""+Math.floor(P[W].order_item_service_tax),order_item_service_tax_percent:P[W].order_item_service_tax_percent,net_amount:P[W].net_amount,created_on:P[W].created_on},...B.slice(+W+1)]:B)},mt=async()=>{try{const B=await Bs(Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,1,10,!0,S);J(B?.total_records>0)}catch{console.log("error in checkAppointmentForBilling API Call")}};y.useEffect(()=>{Fe(),at(),window?.partner_service_enabled!=="1"&&mt()},[p]);const pt=async(B=Te.dayjs().format("YYYY-MM-DD"))=>{l(!0);try{const De=await gl(Te.dayjs(B).format("YYYY-MM-DD"),c.patientRoleID,1,100,S);L(De),le(fl);const qe=De?.bill_list.flatMap(re=>{const{order_items:X,...Z}=re;return X.map(ie=>({...Z,...ie})).filter(ie=>Te.dayjs(ie?.created_on).format("YYYY-MM-DD")===Te.dayjs(new Date).format("YYYY-MM-DD"))});if(T(qe),De?.bill_list?.length){const re=De?.bill_list.reduce((X,Z)=>{const ie=Z.order_items.filter(Ie=>Te.dayjs(Ie?.created_on).isBefore(Te.dayjs(new Date).format("YYYY-MM-DD"))).map(Ie=>({...Ie,service_category:Z.service_category,service_category_id:Z.service_category_id}));return[...X,...ie]},[]);N(re)}else le(fl),N([])}catch{console.log("error in getBillsList API Call")}l(!1)};y.useEffect(()=>{pt()},[]);const nt=async()=>{try{const B=await Cl(c.patientRoleID,S);ue(B?.wallet_balance||0)}catch(B){console.error("Failed to fetch wallet balance:",B)}};y.useEffect(()=>{nt()},[et]);const Oe=y.useCallback(async()=>{try{const B=await yl(Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,!1,S);H(B)}catch(B){console.error("Error in getPastDueAmount API Call:",B)}},[p,yl,c.patientRoleID]);y.useEffect(()=>{Oe()},[Oe]);const at=(B=ft[0])=>{O(B)},Pt=B=>{switch(B?.original?.service_category.toLowerCase()){case Et[0].toLowerCase():at(ft[2]);break;case Et[1].toLowerCase():at(ft[4]);break;case Et[2].toLowerCase():at(ft[3]);break;default:at(ft[0]);break}},xt=(B,De)=>De.reduce((qe,re)=>qe+(parseInt(je.bill_summary[re]?.[B]||"0")||0),0),Nt=(B,De)=>De.map(qe=>je.bill_summary[qe]?.[B]).filter(qe=>qe),Bt=async(B,De,qe)=>{if(w?.visible&&n(),je?.bill_summary&&Object.keys(je?.bill_summary).length>0){const re=await On(Nt("order_id",B),c?.patientRoleID,S),X=[...new Set(B.map(vt=>re.paymentsData.get(vt)).flat())].map(vt=>ur[vt]??void 0)?.filter(vt=>vt),Z=xt("order_service_tax",B??[1,2,3]),ie={billedAmount:xt("order_total",B??[1,2,3]),gstAmount:Z,cgstAmount:(Z/2).toFixed(2),sgstAmount:(Z/2).toFixed(2),discountAmount:xt("order_item_sum_discount",B??[1,2,3])+xt("order_discount",B??[1,2,3]),finalAmount:xt("net_bill_amount",B??[1,2,3]),receivedAmount:xt("order_paid_amount",B??[1,2,3]),balanceAmount:xt("balance_amount",B??[1,2,3]),refundAmount:xt("refund_amount",B??[1,2,3])},Ee=[...Y,...D].filter(vt=>B.includes(parseInt(vt?.service_category_id))).map(vt=>({serviceName:vt.service_name,price:vt.order_unit_item_price,gst:Math.floor(vt.order_item_service_tax),discount:vt.order_item_discount,netPrice:vt.net_amount,itemQty:vt.item_quantity})),Jt=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?pr(d?.org_person_dob):"",Xr[d?.gender]??"",d?.blood_group].filter(vt=>vt).join(", ");v({printDataFrom:"patient_popup",visible:!0,whichPreview:De,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:qe,preferences:{...a?.print?.bill,...a?.org_details,...a?.branch_details},billSummaryDetails:{...ie,paymentStatus:parseInt(ie?.receivedAmount||"0")-parseInt(ie?.refundAmount||"0")===0?"red":parseInt(ie?.balanceAmount||"0")===0?"green":"yellow",paymentMode:X?.join(", ")},billServiceDetails:Ee,billPatientDetails:{name:nr(d?.name)+(Jt?` (${Jt}) `:""),billDate:Te.dayjs(p).format("DD-MMM-YYYY"),mobileNumber:d?.phone_number,email:d?.email,billNumber:Nt("order_id_str",B)?.toString(),patientId:d?.org_person_bid_str,patientIdForEmail:c.patientRoleID,billStatus:parseInt(ie?.balanceAmount||"0")===0?"PAID":"UNPAID",address:[d?.address??"",d?.city??"",d?.pincode??""].filter(vt=>vt).join(", "),referredBy:re?.lab_owner_name?nr(re?.lab_owner_name):d?.ref_doc_name?nr(d?.ref_doc_name):"--"},isWholeBill:B.length===3,payloadDataforEmail:{orderDate:B.length===3?Te.dayjs(p).format("YYYY-MM-DD"):"",orderNumber:B.length===3?"":Nt("order_id",B)?.toString()}},trackEventHandler:vt=>{console.log("Bill Print Event",vt)}})}else A("Error","Please add a service to create bill","Error",3e3)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx(la,{tab:"add_bills",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-h-full hfl-overflow-auto ${V===ft[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-ml-4 hfl-mr-1 hfl-flex hfl-flex-col hfl-gap-1 hfl-self-stretch",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Gray-700",children:"Bill Date :"}),e.jsxRuntimeExports.jsx("div",{"data-qa":"calendar",children:e.jsxRuntimeExports.jsx(e.ZC,{selectDate:new Date(Te.dayjs(p).format("DD-MMM-YYYY")),dateVar:B=>{k(B),Ae(B)},maxDate:new Date})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"Today",className:"hfl-h-10",onClick:()=>Ae(new Date),"data-qa":"today"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:" hfl-text-Success-500",children:$}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>at(ft[7])})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"-hfl-gap-[1px] hfl-flex hfl-h-[590px] hfl-flex-col hfl-items-start",children:[e.jsxRuntimeExports.jsx(Ol,{tableBodyData:P,tableData:Y,isDisabled:!1,addBillButton:!0,handleEditRow:Pt,handleRightSegment:at,setTableData:le,setEditRowId:me,getBillSummarydata:Fe,refreshBillsList:pt}),D&&D?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-py-3 hfl-text-Gray-700",children:["Old Bill"," "]}),e.jsxRuntimeExports.jsx(Ol,{tableBodyData:D,tableData:D,isDisabled:!0,addBillButton:!1,handleEditRow:Pt,handleRightSegment:at,setTableData:le,setEditRowId:me,getBillSummarydata:()=>{},refreshBillsList:()=>{}})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:" mt-2 hfl-sticky hfl-bottom-0 hfl-w-full",children:z&&e.jsxRuntimeExports.jsx(sa,{})})]})}),e.jsxRuntimeExports.jsxs(Pl,{tab:"add_bills",children:[V===ft[0]&&e.jsxRuntimeExports.jsx(na,{summaryData:je,date:p,rightSegment:V,handleRightSegment:at,billSummaryClicked:(B,De,qe)=>Bt(B,De,qe),showDiscount:!1,showRefund:!1,handleServiceItem:M,pastDueData:I,getBillSummarydata:Fe,refreshBillsList:pt,getPastDueAmount:Oe,walletBalance:$,setRefreshWallet:pe}),V===ft[1]&&e.jsxRuntimeExports.jsx(Al,{bill_date:p,rightSegment:V,serviceDetails:x?.bill_list.find(B=>B.service_category.toLowerCase()===j.toLowerCase())?.order_items??[],categorySummaryData:je?.bill_summary[`${Et.indexOf(j)+1}`],serviceItem:j,handleRightSegment:at,getBillSummarydata:Fe,refreshBillsList:pt,getPastDueAmount:Oe,walletBalance:$,setRefreshWallet:pe,closePrintModal:n}),V===ft[2]&&e.jsxRuntimeExports.jsx(oa,{bill_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[W],setTableData:le,editRowId:W,handleRevertEdit:He,refreshBillsList:pt,checkAppointmentForBilling:mt}),V===ft[4]&&e.jsxRuntimeExports.jsx(ua,{order_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[W],setTableData:le,editRowId:W,refreshBillsList:pt,handleRevertEdit:He}),V===ft[3]&&e.jsxRuntimeExports.jsx(aa,{order_date:p,handleRightSegment:at,editedTableData:Y?.[W],getBillSummarydata:Fe,setTableData:le,editRowId:W,refreshBillsList:pt,handleRevertEdit:He}),V===ft[7]&&e.jsxRuntimeExports.jsx(Dl,{depositAmount:$,handleRightSegment:at,rightSegment:V,setRefreshWallet:pe})]})]})},bl=n=>{const{appointments:d,isDisabled:c,handleAppointData:a,leftNav:v,today:w}=n,l=y.useCallback(N=>{a(N)},[a]),A=y.useMemo(()=>[{Header:"Date",accessor:"appnt_date",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[130px] hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:` ${c?"":"hfl-rounded-sm hfl-bg-Success-50 hfl-px-2 hfl-text-Success-600"} `,children:Te.dayjs(N?.original?.appnt_date).format("DD-MMM-YYYY")})})},{Header:"Time",accessor:"appnt_time",Cell:({row:N})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:" ",children:N?.original?.appnt_time&&new Date("1970-01-01T"+N?.original?.appnt_time+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"})})},{Header:"Status",accessor:"appnt_status",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:" hfl-flex hfl-w-[100px] hfl-items-center hfl-justify-center focus:hfl-outline-none",children:e.jsxRuntimeExports.jsx(e.bi,{className:" hfl-flex hfl-w-[100px] hfl-items-center focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:xl.find(P=>P.value==N?.original?.appnt_status)?.text})})},{Header:"Doctor",accessor:"appnt_doctor_name",Cell:({row:N})=>e.jsxRuntimeExports.jsx(e.bi,{className:" hfl-flex hfl-w-[316px] hfl-items-center hfl-capitalize focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:"Dr. "+N.original.appnt_doctor_name})},{Header:"Type",accessor:"order_unit_item_price",Cell:()=>e.jsxRuntimeExports.jsx(e.bi,{className:" hfl-flex hfl-w-[100px] hfl-items-center focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:"In-Person"})},{Header:"Service",accessor:"appnt_service_name",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:" [100px] hfl-flex hfl-items-center hfl-justify-center ",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-w-[116px] hfl-items-center hfl-capitalize",children:N.original.appnt_service_name})})},{Header:"Bill",accessor:"total_price",Cell:({row:N})=>N.original.order_item_id!=0||c||v!="today"?e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-text-Error-500 ",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-w-[106px] hfl-items-center",children:N.original.total_price})]}):e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"",icon:"Left",iconFile:"hx_rupee-bill-filled hfl-text-3",onClick:()=>{l(N.original)},children:"Add Bill"})},{Header:"",accessor:"edit",Cell:({row:N})=>e.jsxRuntimeExports.jsx("i",{className:` ${c?"hfl-text-White":""} ${v==="today"&&"hx_edit"} hfl-p-4 hfl-text-Primary-700 `,onClick:()=>{v==="today"&&l(N.original)},"data-qa":"edit-icon"})}],[l,c,v]),S=y.useMemo(()=>d||[],[d]),{getTableProps:p,getTableBodyProps:k,headerGroups:x,rows:L,prepareRow:V}=Jr.useTable({columns:A,data:S}),O=N=>{const P=[];return N?.headers?.length&&N.headers.map(T=>{P.push(e.jsxRuntimeExports.jsx("th",{...T.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:T.render("Header")})}))}),P},D=()=>{const N=[];return L.map((P,T)=>{V(P),N.push(e.jsxRuntimeExports.jsx("tr",{"data-qa":T+1+"",...P.getRowProps(),className:`${P?.original?.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200 ${c?"hfl-bg-Gray-100":""}`,children:P.cells.map(j=>e.jsxRuntimeExports.jsx("td",{"data-qa":T+1+"-"+j.column.id,...j.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`${P?.original?.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:j.render("Cell")})}))}))}),N};return e.jsxRuntimeExports.jsx("div",{className:`${c?" hfl-pointer-events-none":"hfl-cursor-pointer"} ${w?" hfl-h-[500px] hfl-overflow-y-scroll":""} `,children:d&&e.jsxRuntimeExports.jsxs("table",{...p(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:x.map(N=>e.jsxRuntimeExports.jsx("tr",{...N.getHeaderGroupProps(),className:"hfl-h-9 hfl-rounded-lg hfl-bg-Blue_gray-50 hfl-py-2",children:O(N)}))}),e.jsxRuntimeExports.jsx("tbody",{...k(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:D()})]})})},Qr=n=>{const{currentPage:d,totalRecord:c,handleLoadMore:a,isLoading:v=!1,currentTotal:w}=n;return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[!v&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-text-Gray-500",children:`1 — ${w} of ${c} results`}),w!==c?e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-text-Blue-^00 hfl-flex hfl-justify-center",hierarchy:"Link-Colour",size:"lg",textField:"Load more... ",onClick:()=>a(d)}):e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",className:"hfl-text-Gray-500",children:"End of List"})]}),v&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.Eu,{size:"xxs",progress:10,spinnerMode:!0})})]})},ha=n=>{const{handleAddNewAppnt:d,handleAppointData:c,sortAppointments:a}=n,[v,w]=y.useState(),[l,A]=y.useState(1),[S,p]=y.useState([]),[k,x]=y.useState([]),[L,V]=y.useState(""),{patientIDs:O,setLoading:D,variable:N}=y.useContext(Tt),P=async T=>{let j=T;if(D(!0),j<=Math.ceil((v?.total_records||0)/10)){if(j=T+1,j!==T){const Q=await Bs("all",O?.patientRoleID||"",j,10,!1,N);p(I=>[...I,...Q.appointments.filter(H=>H.appnt_date>=Te.dayjs(new Date).format("YYYY-MM-DD"))]),x(I=>[...I,...Q.appointments.filter(H=>H.appnt_date<Te.dayjs(new Date).format("YYYY-MM-DD"))])}A(j)}D(!1)};return y.useEffect(()=>{D(!0);const T=async()=>{try{const j=await Bs("all",O?.patientRoleID||"",1,10,!1,N);j&&(w(j),p(j?.appointments?.filter(Q=>Q.appnt_date>=Te.dayjs(new Date).format("YYYY-MM-DD"))),x(j?.appointments?.filter(Q=>Q.appnt_date<Te.dayjs(new Date).format("YYYY-MM-DD")))),V(j?.appointments?.length?"":"No Appointment")}catch{console.log("error in getAppointmentsList API Call")}};D(!1),T()},[O?.patientRoleID,D,N]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-max-h-[550px] hfl-w-full hfl-flex-col hfl-overflow-y-scroll",children:[S.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-justify-between hfl-px-3 hfl-py-2 ",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"",children:"Upcoming Appointments"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"new-appointment",hierarchy:"Primary",size:"md",className:"text",icon:"Left",iconFile:"hx_add-circle",textField:"New Appointment",onClick:d})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 ",children:e.jsxRuntimeExports.jsx(bl,{appointments:a(S),handleAppointData:c})})]}),k.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-w-full hfl-items-center hfl-px-3 hfl-py-2 hfl-pt-4 ",children:"Past Appointments"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 hfl-pb-4 xxs:max-md:hfl-w-[885px] xxs:max-md:hfl-overflow-y","data-qa":"all-appoint-table",children:e.jsxRuntimeExports.jsx(bl,{isDisabled:!0,appointments:k,handleAppointData:c})})]})]}),k.length>0||S.length>0?e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Qr,{currentPage:l,totalRecord:v?.total_records||0,currentTotal:l===Math.ceil((v?.total_records||0)/10)?v?.total_records||0:l*10,handleLoadMore:P})}):e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-w-full hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:L})})]})},ma=()=>{const{showToast:n,patientDetails:d,doctorListArr:c,serviceListArr:a,patientIDs:v,setLoading:w,billPreferences:l,docPreference:A,formattedService:S,ppEventProps:p,getAndSetServiceListArr:k,variable:x}=y.useContext(Tt),[L,V]=y.useState(x.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?.length?!0:l?.billing?.prepaid_consultation!=="1"),[O,D]=y.useState("today"),[N,P]=y.useState(!1),[T,j]=y.useState([]),Q=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),I=y.useMemo(()=>c?.doctor_list?.length===1?c.doctor_list[0]:{doctor_name:"",doctor_identifier:""},[c]),H=y.useMemo(()=>({...zl,deleted:!1,appnt_date:Te.dayjs().format("YYYY-MM-DD"),appnt_doctor_name:x.window_var.role_id=="11"?x.window_var.doc_name_for_seg:I?.doctor_name,appnt_doctor_role_id:x.window_var.role_id=="11"?x.window_var.doctor_role_id_for_seg:I?.doctor_identifier,appnt_duration:l?.print?.bill?.appnt_minute_slab||"",appnt_time_time:Q?.split(" ")[0]||"",appnt_time_format:Q?.split(" ")[1]||"",total_price:"0",order_item_service_tax_percentage:0,order_item_service_tax:"0",item_quantity:"1",order_unit_item_price:"0",order_item_price:"0",order_id:"",order_date:"",order_created_on:"",service_category:"",service_category_id:"",order_id_str:"",order_total:"",order_paid_amount:"",order_item_sum_discount:"",order_discount:"",refund_amount:"",order_service_tax:"",balance_amount:"",net_bill_amount:"",service_id:"",service_name:"",order_item_service_tax_percent:"",created_on:"",net_amount:""}),[l?.print?.bill?.appnt_minute_slab,Q,I?.doctor_identifier,I?.doctor_name,x.window_var.doc_name_for_seg,x.window_var.doctor_role_id_for_seg,x.window_var.role_id]),[z,J]=y.useState(H),[Y,le]=y.useState(!1);y.useEffect(()=>{V(x.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?!0:l?.billing?.prepaid_consultation!=="1")},[N,l,O,d,x.window_var?.partner_service_enabled]),y.useEffect(()=>{le(B=>L&&B)},[L]),y.useEffect(()=>{if(!+z?.order_item_id&&!z?.order_unit_item_price){const B=S?.[z.appnt_service_id];B&&J(De=>({...De,order_unit_item_price:B.price.toString(),item_quantity:"1",order_item_discount:"0",order_item_service_tax_percentage:B?.service_tax||0}))}},[L,N,z.order_item_id,z.order_unit_item_price,z.appnt_service_id,S]);const W=y.useCallback(B=>{const{order_unit_item_price:De=0,item_quantity:qe=0,order_item_discount:re=0,appnt_service_id:X}=B;if(!X)return;let Z=0;const ie=S?.[X]?.service_tax||0;let Ie=0;if(Number(De)>0&&Number(qe)>0){const Ee=Number(De)*Number(qe);Z=Math.floor(Ee*.01*ie),Ie=Ee+Z-Number(re)}J(Ee=>({...Ee,order_item_service_tax:Z.toString(),order_item_price:Ie.toString()}))},[S]),me=y.useMemo(()=>[{...z,order_item_service_tax:Math.floor(+z.order_item_service_tax).toString()}],[z]),je=B=>{xt();const De=new Date(`1970-01-01T${B.appnt_time}Z`).toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});J(qe=>({...qe,...B,appnt_time_time:De?.split(" ")[0]??"",appnt_time_format:De?.split(" ")[1]??"",order_item_service_tax_percentage:S?.[B.appnt_service_id]?.service_tax||0,order_item_price:B.total_price.toString(),deleted:!1}))},ye=(B,De)=>{if(B==="appnt_service_name"){const{appnt_service_name:qe,appnt_service_id:re,order_item_discount:X,order_unit_item_price:Z,item_quantity:ie,order_item_service_tax_percentage:Ie}=De,Ee={...z,appnt_service_name:qe,appnt_service_id:re,order_unit_item_price:Z,item_quantity:ie,order_item_discount:X,order_item_service_tax_percentage:Ie};J(Ee),W(Ee)}else B==="appnt_date"&&De>Te.dayjs().format("YYYY-MM-DD")&&(V(!0),L||n("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),J(qe=>({...qe,[B]:De}))},et=()=>{V(B=>!B)},pe=()=>{le(B=>!B)},$=(B,De)=>{J(qe=>({...qe,[De]:B}))};y.useEffect(()=>{W(z)},[z.order_unit_item_price,z.item_quantity,z.order_item_discount,W,z]);const ue=B=>[...B].sort((De,qe)=>new Date(De.appnt_date).getTime()-new Date(qe.appnt_date).getTime()),M=y.useMemo(()=>[{Header:"Unit Price",accessor:"order_unit_item_price",Cell:({row:B})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),A?.permissions?.edit_service_unit_price?e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:B?.original?.order_unit_item_price,onChange:De=>$(De.target.value,"order_unit_item_price")}):e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:B?.original?.order_unit_item_price})]})},{Header:"Qty",accessor:"item_quantity",Cell:({row:B})=>e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:B?.original?.item_quantity,onChange:De=>$(De.target.value,"item_quantity")})},{Header:"Discount",accessor:"order_item_discount",Cell:({row:B})=>e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:B?.original?.order_item_discount,onChange:De=>$(De.target.value,"order_item_discount")})},{Header:"GST in %",accessor:"order_item_service_tax_percentage",Cell:({row:B})=>{const De=Number(B?.original?.appnt_service_id||"0");return e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:S?.[De]?.service_tax||0,readOnly:!0})}},{Header:"GST In Rs",accessor:"order_item_service_tax",Cell:({row:B})=>e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center",value:B?.original?.order_item_service_tax,readOnly:!0})},{Header:"Net Price",accessor:"order_item_price",Cell:({row:B})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-text-Error-500 ",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),e.jsxRuntimeExports.jsx("input",{type:"number",className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center",value:B?.original?.order_item_price,readOnly:!0})]})}],[A?.permissions?.edit_service_unit_price,S]),Ae=y.useMemo(()=>me,[me]),{getTableProps:Fe,getTableBodyProps:He,headerGroups:mt,rows:pt,prepareRow:nt}=Jr.useTable({columns:M,data:Ae}),Oe=B=>{const De=[];return B?.headers?.length&&B.headers.map(qe=>{De.push(e.jsxRuntimeExports.jsx("th",{...qe.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Indigo-600",children:qe.render("Header")})}))}),De},at=()=>{const B=[];return pt.map((De,qe)=>{nt(De),B.push(e.jsxRuntimeExports.jsx("tr",{id:qe.toString(),...De.getRowProps(),className:`${De?.original?.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200`,children:De.cells.map(re=>e.jsxRuntimeExports.jsx("td",{"data-qa":qe+1+"-"+re.column.id,...re.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`${De?.original?.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:re.render("Cell")})}))}))}),B},Pt=(B,De,qe)=>e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[60px] hfl-flex-col hfl-items-center hfl-rounded hfl-px-1 hfl-py-2 hfl-text-center ${O===B?"hfl-bg-Primary-50 hfl-text-Primary-600":""} hfl-cursor-pointer`,onClick:()=>D(B),"data-qa":B,children:[e.jsxRuntimeExports.jsx("div",{className:De}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:qe})]},B),xt=y.useCallback(()=>{D("today"),J(H),P(!0)},[H]),Nt=y.useCallback(async()=>{w(!0);try{const B=await Bs(O=="today"?Te.dayjs().format("YYYY-MM-DD"):"all",v?.patientRoleID||"",1,O=="today"?100:10,!1,x);j(B?.appointments?.filter(De=>De.appnt_date===Te.dayjs().format("YYYY-MM-DD"))),B.appointments.length===0&&xt(),w(!1)}catch{w(!1),console.log("error in getAppointmentsList API Call")}},[xt,O,v?.patientRoleID,w,x]);y.useEffect(()=>{N||Nt()},[N,Nt]),y.useEffect(()=>{O==="today"&&Nt()},[Nt,O]);const Bt=async()=>{z.appnt_date>Te.dayjs().format("YYYY-MM-DD")&&(V(!0),L||n("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),await Zl(z,L||z.appnt_date>Te.dayjs().format("YYYY-MM-DD"),n,d,v,p,Y,!1,x)&&P(!1)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-4 hfl-border-r-1 hfl-border-Gray-200 hfl-bg-Gray-50 hfl-px-1 hfl-py-2",children:[Pt("today","hx_calendar-add hfl-text-5","Today's Appts"),Pt("all","hx_calendar hfl-text-5","All Appts")]}),O==="today"&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto",children:T.length<=0||N?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 hfl-self-stretch hfl-bg-Gray-100 hfl-p-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-flex-1",children:z.appnt_id.length?"Update Appointment":"New Appointment"}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{P(!1)},"data-qa":"close-new-ppointment"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-item-center hfl-flex hfl-flex-col hfl-gap-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[739px] hfl-flex-wrap hfl-content-start hfl-items-start hfl-gap-6",children:[e.jsxRuntimeExports.jsx(e.tj,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:z.appnt_doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-relative hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[270px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",suffixOptions:c?.doctor_list?.map(B=>({label:B.doctor_name,value:B.doctor_name,appnt_doctor_role_id:B.doctor_identifier})),handleSuffixValChange:B=>{ye("appnt_doctor_name",B),ye("appnt_doctor_role_id","")},onSuffixDropdownClick:B=>{ye("appnt_doctor_name",B.label),ye("appnt_doctor_role_id",B.appnt_doctor_role_id)}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[350px] hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Date & Time of Appointment"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-gap-2 ",children:[e.jsxRuntimeExports.jsx(e.ZC,{placeholder:"Today",height:"!hfl-h-[40px]",selectDate:new Date(Te.dayjs(z.appnt_date).format("DD-MMM-YYYY")),dateVar:B=>{ye("appnt_date",Te.dayjs(B).format("YYYY-MM-DD"))},isborderRequired:!0,minDate:new Date}),e.jsxRuntimeExports.jsx(e.tj,{className:"hfl-w-24",suffixClassName:"hfl-w-10 ",suffixDropdownClassName:"hfl-ml-[96px]",input1value:z?.appnt_time_time||"",input2value:z?.appnt_time_format||"",end_icon:"hx_down",classNamedoubleInput:"hfl-relative",inputProps:{placeholder:"10:00",onBlur:B=>{ye("appnt_time_time",B.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:B=>{ye("appnt_time_format",B.value)}})]})]}),z.appnt_id.length>1&&z.order_item_id.length>1?e.jsxRuntimeExports.jsx(e.tj,{label:"Service",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hfl-bg-White_20",input2value:z.appnt_service_name,inputProps:{disabled:!0},widthSufixDrpdwn:"hfl-w-[350px]",suffixInputProps:{placeholder:"Service Name",disabled:!0},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500 ",classNamedoubleInput:"hfl-relative",suffixClassName:" hfl-border-l-0 hfl-w-[318px] hfl-text-ellipsis hfl-bg-White_20"}):e.jsxRuntimeExports.jsx(e.tj,{label:"Service",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hx_down hfl-bg-White_20",input2value:z.appnt_service_name,inputProps:{disabled:!1},widthSufixDrpdwn:"hfl-w-[350px]",suffixInputProps:{placeholder:"Service Name",onClick:async()=>{a?.service_list?.length||k()}},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500 ",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-border-l-0 hfl-w-[318px] hfl-text-ellipsis hfl-bg-White_20",suffixOptions:a?.service_list?.filter(B=>B.service_category==="Doctor consultation")?.map(B=>({label:B.service_name,value:B.service_name,appnt_service_id:B.service_identifier,order_unit_item_price:B.price,item_quantity:1,order_item_discount:B.order_item_discount||0,order_item_service_tax_percentage:B.service_tax,appnt_service_name:B.service_name})),handleSuffixValChange:B=>{ye("appnt_service_name",{appnt_service_name:B})},onSuffixDropdownClick:B=>{ye("appnt_service_name",B)}}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ir.find(B=>B.value==Number(z.appnt_duration))?.label||"",value:z.appnt_duration},label:"Duration",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:B=>{ye("appnt_duration",B.value)},options:Ir,"data-qa":"time picker"}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:xl.find(B=>B.value==z?.appnt_status)?.text||""},label:"Booking Status",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:B=>{ye("appnt_status",B.value)},options:xl.map(B=>({label:B.text,value:B.value})),"data-qa":"click-status"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[350px] hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text sm",children:"Type"}),e.jsxRuntimeExports.jsx(e.ju,{options:[{start_icon:"hx_inperson hfl-text-3",label:"In-Person",value:"inperson"}],disabled:!1,value:"inperson","data-qa":"data-type"})]}),x.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?.length&&e.jsxRuntimeExports.jsx(e.Oi,{size:"md",disabled:!1,isMarked:Y,text:"Partner Enabled",onClick:pe,"data-qa":"skip-billing"}),!+z?.order_item_id&&e.jsxRuntimeExports.jsx(e.Oi,{size:"md",disabled:!1,isMarked:L,text:"Skip Billing",onClick:et,"data-qa":"skip-billing"})]}),!L||+z?.order_item_id?e.jsxRuntimeExports.jsx("div",{className:`${+z?.appnt_id&&+z?.order_item_id?"hfl-pointer-events-none":""}`,children:e.jsxRuntimeExports.jsxs("table",{...Fe(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:mt.map(B=>e.jsxRuntimeExports.jsx("tr",{...B.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50",children:Oe(B)}))}),e.jsxRuntimeExports.jsx("tbody",{...He(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:at()})]})}):"",e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"No",className:"hfl-w-[150px] hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{P(!1)},"data-qa":"cancel"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:z.appnt_id.length?"Update Appointment":"Book Appointment",icon:"No",onClick:Bt,className:"hfl-w-[150px] hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800","data-qa":"book-appointment"})]})]})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-justify-between hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:"Today’s Appointments"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"new-appointment",hierarchy:"Primary",size:"md",className:"text",icon:"Left",iconFile:"hx_add-circle",textField:"New Appointment",onClick:xt})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 ","data-qa":"appointment-table",children:e.jsxRuntimeExports.jsx(bl,{today:!0,leftNav:O,appointments:ue(T),handleAppointData:je})})]})}),O==="all"&&e.jsxRuntimeExports.jsx(ha,{sortAppointments:ue,handleAddNewAppnt:xt,handleAppointData:je})]})},xa=({columns:n,data:d})=>{const{getTableProps:c,getTableBodyProps:a,headerGroups:v,rows:w,prepareRow:l}=Jr.useTable({columns:n,data:d}),A=p=>{const k=[];return p?.headers?.length&&p.headers.map(x=>{k.push(e.jsxRuntimeExports.jsx("th",{...x.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:x.render("Header")})}))}),k},S=()=>{const p=[];return w.map((k,x)=>{l(k),p.push(e.jsxRuntimeExports.jsx("tr",{id:x.toString(),...k.getRowProps(),className:`${k.original.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-border-t-1 hfl-border-Gray-200`,children:k.cells.map((L,V)=>e.jsxRuntimeExports.jsx("td",{"data-qa":x+1+"-"+(V+1),...L.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`hfl-text-[13px] ${k.original.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:L.render("Cell")})}))}))}),p};return e.jsxRuntimeExports.jsx("div",{className:"hfl-max-h-[55vh] hfl-overflow-y-auto xxs:max-md:hfl-overflow-x-auto hfl-overflow-x-hidden","data-qa":"past-visit-table",children:e.jsxRuntimeExports.jsxs("table",{...c(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:v.map(p=>e.jsxRuntimeExports.jsx("tr",{...p.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50 ",children:A(p)}))}),e.jsxRuntimeExports.jsx("tbody",{...a(),className:"hfl-rounded-",children:S()})]})})},ga="data:image/svg+xml,%3csvg%20width='87'%20height='86'%20viewBox='0%200%2087%2086'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='43.5'%20cy='83.42'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M17.179%2014.1224C16.5958%2013.0118%2015.2122%2012.5787%2014.0887%2013.1552C12.9651%2013.7317%2012.5271%2015.0994%2013.1102%2016.21L15.2825%2020.347C15.8657%2021.4576%2017.2493%2021.8906%2018.3729%2021.3141C19.4964%2020.7377%2019.9345%2019.37%2019.3513%2018.2593L17.179%2014.1224ZM14.8903%2014.6818C15.1609%2014.543%2015.4942%2014.6473%2015.6346%2014.9148L17.8069%2019.0517C17.9474%2019.3193%2017.8419%2019.6487%2017.5712%2019.7875C17.3006%2019.9264%2016.9674%2019.8221%2016.8269%2019.5546L14.6546%2015.4176C14.5141%2015.1501%2014.6196%2014.8207%2014.8903%2014.6818ZM22.9352%2024.0112C20.0523%2024.0112%2017.7152%2026.3214%2017.7152%2029.1712V65.3801C17.7152%2068.2299%2020.0523%2070.5401%2022.9352%2070.5401H57.7352C60.6181%2070.5401%2062.9552%2068.2299%2062.9552%2065.3801V59.7953C59.3146%2057.7135%2056.8652%2053.8225%2056.8652%2049.366C56.8652%2044.9095%2059.3146%2041.0186%2062.9552%2038.9368V29.1712C62.9552%2026.3214%2060.6181%2024.0112%2057.7352%2024.0112H54.1652V25.3157C54.1652%2027.6905%2052.2177%2029.6157%2049.8152%2029.6157H32.5952C30.1928%2029.6157%2028.2452%2027.6905%2028.2452%2025.3157V24.0112H22.9352ZM64.6952%2038.1166V29.1712C64.6952%2025.3714%2061.5791%2022.2912%2057.7352%2022.2912H46.2996C45.7087%2020.0557%2043.6519%2018.406%2041.2052%2018.406C38.7586%2018.406%2036.7018%2020.0557%2036.1109%2022.2912H22.9352C19.0913%2022.2912%2015.9752%2025.3714%2015.9752%2029.1712V65.3801C15.9752%2069.1798%2019.0913%2072.2601%2022.9352%2072.2601H57.7352C61.5791%2072.2601%2064.6952%2069.1798%2064.6952%2065.3801V60.6155C66.0461%2061.1262%2067.5126%2061.406%2069.0452%2061.406C75.772%2061.406%2081.2252%2056.0155%2081.2252%2049.366C81.2252%2042.7165%2075.772%2037.326%2069.0452%2037.326C67.5126%2037.326%2066.0461%2037.6058%2064.6952%2038.1166ZM6.33244%2020.881C6.89862%2019.7618%208.27544%2019.3082%209.40766%2019.8679L13.625%2021.9526C14.7572%2022.5123%2015.2161%2023.8733%2014.6499%2024.9925C14.0837%2026.1117%2012.7069%2026.5652%2011.5747%2026.0056L7.35734%2023.9209C6.22512%2023.3612%205.76626%2022.0002%206.33244%2020.881ZM8.62943%2021.4063C8.35671%2021.2715%208.02508%2021.3807%207.8887%2021.6503C7.75233%2021.9199%207.86286%2022.2477%208.13557%2022.3825L12.3529%2024.4672C12.6256%2024.602%2012.9572%2024.4928%2013.0936%2024.2232C13.23%2023.9536%2013.1195%2023.6258%2012.8468%2023.491L8.62943%2021.4063ZM36.2851%2041.3145C36.2851%2040.127%2037.2589%2039.1645%2038.4601%2039.1645H53.2501C54.4513%2039.1645%2055.4251%2040.127%2055.4251%2041.3145C55.4251%2042.5019%2054.4513%2043.4645%2053.2501%2043.4645H38.4601C37.2589%2043.4645%2036.2851%2042.5019%2036.2851%2041.3145ZM38.4601%2049.2325C37.2589%2049.2325%2036.2851%2050.1951%2036.2851%2051.3825C36.2851%2052.5699%2037.2589%2053.5325%2038.4601%2053.5325H53.2501C54.4513%2053.5325%2055.4251%2052.5699%2055.4251%2051.3825C55.4251%2050.1951%2054.4513%2049.2325%2053.2501%2049.2325H38.4601ZM38.0251%2051.3825C38.0251%2051.145%2038.2199%2050.9525%2038.4601%2050.9525H53.2501C53.4903%2050.9525%2053.6851%2051.145%2053.6851%2051.3825C53.6851%2051.62%2053.4903%2051.8125%2053.2501%2051.8125H38.4601C38.2199%2051.8125%2038.0251%2051.62%2038.0251%2051.3825ZM36.2851%2061.9099C36.2851%2060.7225%2037.2589%2059.7599%2038.4601%2059.7599H53.2501C54.4513%2059.7599%2055.4251%2060.7225%2055.4251%2061.9099C55.4251%2063.0974%2054.4513%2064.0599%2053.2501%2064.0599H38.4601C37.2589%2064.0599%2036.2851%2063.0974%2036.2851%2061.9099ZM38.4601%2061.4799C38.2199%2061.4799%2038.0251%2061.6725%2038.0251%2061.9099C38.0251%2062.1474%2038.2199%2062.3399%2038.4601%2062.3399H53.2501C53.4903%2062.3399%2053.6851%2062.1474%2053.6851%2061.9099C53.6851%2061.6725%2053.4903%2061.4799%2053.2501%2061.4799H38.4601ZM26.5647%2040.5435C26.5647%2039.1186%2027.7333%2037.9635%2029.1747%2037.9635H30.5547C31.9962%2037.9635%2033.1647%2039.1186%2033.1647%2040.5435V41.9076C33.1647%2043.3325%2031.9962%2044.4876%2030.5547%2044.4876H29.1747C27.7333%2044.4876%2026.5647%2043.3325%2026.5647%2041.9076V40.5435ZM29.1747%2048.0315C27.7333%2048.0315%2026.5647%2049.1866%2026.5647%2050.6115V51.9757C26.5647%2053.4006%2027.7333%2054.5557%2029.1747%2054.5557H30.5547C31.9962%2054.5557%2033.1647%2053.4006%2033.1647%2051.9757V50.6115C33.1647%2049.1866%2031.9962%2048.0315%2030.5547%2048.0315H29.1747ZM28.3047%2050.6115C28.3047%2050.1366%2028.6942%2049.7515%2029.1747%2049.7515H30.5547C31.0352%2049.7515%2031.4247%2050.1366%2031.4247%2050.6115V51.9757C31.4247%2052.4506%2031.0352%2052.8357%2030.5547%2052.8357H29.1747C28.6942%2052.8357%2028.3047%2052.4506%2028.3047%2051.9757V50.6115ZM26.5647%2061.139C26.5647%2059.7141%2027.7333%2058.559%2029.1747%2058.559H30.5547C31.9962%2058.559%2033.1647%2059.7141%2033.1647%2061.139V62.5031C33.1647%2063.928%2031.9962%2065.0831%2030.5547%2065.0831H29.1747C27.7333%2065.0831%2026.5647%2063.928%2026.5647%2062.5031V61.139ZM29.1747%2060.279C28.6942%2060.279%2028.3047%2060.664%2028.3047%2061.139V62.5031C28.3047%2062.9781%2028.6942%2063.3631%2029.1747%2063.3631H30.5547C31.0352%2063.3631%2031.4247%2062.9781%2031.4247%2062.5031V61.139C31.4247%2060.664%2031.0352%2060.279%2030.5547%2060.279H29.1747ZM58.6052%2049.366C58.6052%2043.6665%2063.2793%2039.046%2069.0452%2039.046C74.811%2039.046%2079.4852%2043.6665%2079.4852%2049.366C79.4852%2055.0656%2074.811%2059.686%2069.0452%2059.686C63.2793%2059.686%2058.6052%2055.0656%2058.6052%2049.366ZM66.8702%2043.776C66.8702%2042.5886%2067.844%2041.626%2069.0452%2041.626C70.2464%2041.626%2071.2202%2042.5886%2071.2202%2043.776V48.936C71.2202%2050.1235%2070.2464%2051.086%2069.0452%2051.086C67.844%2051.086%2066.8702%2050.1235%2066.8702%2048.936V43.776ZM69.0452%2043.346C68.8049%2043.346%2068.6102%2043.5386%2068.6102%2043.776V48.936C68.6102%2049.1735%2068.8049%2049.366%2069.0452%2049.366C69.2854%2049.366%2069.4802%2049.1735%2069.4802%2048.936V43.776C69.4802%2043.5386%2069.2854%2043.346%2069.0452%2043.346ZM69.0452%2057.106C67.844%2057.106%2066.8702%2056.1435%2066.8702%2054.956C66.8702%2053.7686%2067.844%2052.806%2069.0452%2052.806C70.2464%2052.806%2071.2202%2053.7686%2071.2202%2054.956C71.2202%2056.1435%2070.2464%2057.106%2069.0452%2057.106ZM68.6102%2054.956C68.6102%2055.1935%2068.8049%2055.386%2069.0452%2055.386C69.2854%2055.386%2069.4802%2055.1935%2069.4802%2054.956C69.4802%2054.7186%2069.2854%2054.526%2069.0452%2054.526C68.8049%2054.526%2068.6102%2054.7186%2068.6102%2054.956Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",va=({closePrintModal:n,setLatestMetaData:d,setInvestigationDropdown:c,setCustomTranslations:a,getVisitpadPreferenceHandler:v,updateVPPrefUsingDocPref:w})=>{const{patientIDs:l,setShowPrintModal:A,setEndConsultationClicked:S,preferences:p,variable:k}=y.useContext(Tt),[x,L]=y.useReducer((Y,le)=>({...Y,...le}),{currentPage:1,totalRecord:0,pastVisits:[],isVisitLoading:!1}),{pastVisits:V,currentPage:O,isVisitLoading:D,totalRecord:N}=x,P=y.useCallback(async Y=>{if(l?.patientRoleID)try{L({isVisitLoading:!0});const le=await yn(rn,Y,l.patientRoleID,k),W=le?.visits??[];L({currentPage:Y,pastVisits:Y===1?W:[...V,...W],isVisitLoading:!1,totalRecord:+le.total_visit_count})}catch(le){console.error("Failed to fetch visits:",le),L({isVisitLoading:!1})}},[l?.patientRoleID]),T=y.useCallback(async(Y,le,W=!0)=>{if(l?.patientRoleID){n(),L({isVisitLoading:!0});try{const je=(await xn(Y.original.visit_date,l.patientRoleID,Y.original.visit_id,k))?.visits?.[0];if(!je)throw new Error("Visit details not found.");let ye=null;const{doctor_id:et="",doctor_role_id:pe=""}=je;k.window_var.doctor_role_id_for_seg!==pe?ye=await v({doc_id:et,doc_rid:pe}):p&&await w(p,p.printDefaultPrefIndex,pe,!1),d(je.latest_visit_metadata||{}),A({printDataFrom:"patient_popup",visible:!0,whichPreview:"offlinePrint",printData:"",visitId:je.visit_id,visit_date:je.visit_date,visit_number:N-Y.index,currentPrintTime:0,printType:"visit",details:je,visitpadPref:ye,appointmentInfo:{appnt_id:Y.original.appnt_id||"",appnt_type:Y.original.appnt_type||""},trackEventHandler:()=>{}}),S(W)}catch(me){console.error("Failed to prepare print data:",me)}finally{L({isVisitLoading:!1})}}},[n,v,k,l.patientRoleID,p,S,d,A,w,N]),j=y.useCallback(async()=>{try{const Y=await Bn(k),le={};Y.transalation_records.forEach(W=>{le[W.language]=W}),a(le)}catch(Y){console.error("Failed to get custom translations:",Y)}},[a,k]),Q=y.useCallback(async()=>{try{const Y=await Fn(k);if(Y?.test_ranges){const le=Y.test_ranges.map(W=>({test_id:W.test_id,test_names:W.test_names,test_range_rule:W.test_range_rule,test_range_text:W.test_range_text,test_units:W.test_units,value:W.test_names}));c(le)}}catch(Y){console.error("Failed to get investigation test names:",Y)}},[c,k]);y.useEffect(()=>{P(1),j(),Q()},[j,Q]);const I=y.useMemo(()=>({visit_date:"100px",doctor_name:"350px",appnt_type:"100px",service_name:"150px",view:"250px"}),[]),H=y.useMemo(()=>[{Header:"Date",accessor:"visit_date",Cell:({row:Y})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.visit_date}]`,children:Y.original.visit_date?Te.dayjs(Y.original.visit_date).format("DD-MMM-YYYY"):"N/A"})},{Header:"Doctor",accessor:"doctor_name",Cell:({row:Y})=>e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.doctor_name}]`,children:["Dr. ",Y.original.doctor_name||"N/A"]})},{Header:"Type",accessor:"appnt_type",Cell:({row:Y})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.appnt_type}]`,children:Y.original.appnt_type||"N/A"})},{Header:"Service",accessor:"service_name",Cell:({row:Y})=>e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${I.service_name}]`,children:Y.original.service_name||"N/A"})},{Header:"Prescription",id:"view",Cell:({row:Y})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-2 hfl-my-1 hfl-flex hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Print",iconFile:"hx_print",icon:"Left",onClick:()=>T(Y,"VISIT_PRINT",!1),className:"hfl-w-[74px]","data-qa":"to-print"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Share",iconFile:"hx_share",icon:"Left",onClick:()=>T(Y,"VISIT_SHARE",!0),className:"hfl-w-[74px]","data-qa":"to-share"})]})}],[I,T]),z=y.useMemo(()=>V,[V]),J=async()=>{if(!l?.patientRoleID)return;let Y="../ipdv2/viewPatientsCase";if(k.window_var?.enable_ipd_v2!=="1"){Y="../ipd/viewPatientsCase.php";try{const le=await jn(k,l.patientRoleID),{status:W=0,case_id:me=0}=le,je=new Date().toISOString().slice(0,10);Y=W&&me?`../ipd/viewPatientRecords.php?pid=${l.patientRoleID}&case_id=${me}`:`../ipd/viewAddPatientsCase.php?pid=${l.patientRoleID}&date=${je}`}catch(le){console.error("Failed to get IPD Case by PID:",le)}}window.open(Y,"_blank")};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-[12%] hfl-h-[69vh] hfl-overflow-auto hfl-py-[20px]",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text md",className:"hfl-text-Gray-600",children:"Past Visits"}),k.window_var.ipd_module==="1"&&e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"sm",textField:"Go to IPD","data-qa":"go-to-ipd",className:"hfl-justify-center hfl-bg-Primary-600 hfl-text-White hover:hfl-bg-Primary-700",onClick:()=>{J()}})]}),z?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(xa,{columns:H,data:z,columnWidth:I}),e.jsxRuntimeExports.jsx(Qr,{currentPage:O,totalRecord:N,handleLoadMore:()=>P(O+1),isLoading:D,currentTotal:z.length})]}),z.length===0&&!D&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[calc(100%_-_80px)] hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:ga,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"There are no visits for the patient"})]})]})},ya=({fontBaseUrl:n})=>(ae.Font.register({family:"notoKannada",src:`${n}/fonts/NotoSansKannada.ttf`}),ae.Font.register({family:"notoKannadaBold",src:`${n}/fonts/NotoSansKannada-Bold.ttf`}),ae.Font.register({family:"notoHindi",src:`${n}/fonts/NotoSansHindi.ttf`}),ae.Font.register({family:"notoHindiBold",src:`${n}/fonts/NotoSansHindi-Bold.ttf`}),ae.Font.register({family:"notoUrdu",src:`${n}/fonts/Jameel-Nastaleeq.ttf`}),ae.Font.register({family:"notoUrduBold",src:`${n}/fonts/Jameel-Nastaleeq.ttf`}),ae.Font.register({family:"notoArabic",src:`${n}/fonts/NotoSansArabic.ttf`}),ae.Font.register({family:"notoArabicBold",src:`${n}/fonts/NotoSansArabic-Bold.ttf`}),ae.Font.register({family:"notoGujarati",src:`${n}/fonts/NotoSerifGujarati-Regular.ttf`}),ae.Font.register({family:"notoGujaratiBold",src:`${n}/fonts/NotoSerifGujarati-Bold.ttf`}),ae.Font.register({family:"notoMalayalam",src:`${n}/fonts/AnekMalayalam-Regular.ttf`}),ae.Font.register({family:"notoMalayalamBold",src:`${n}/fonts/AnekMalayalam-Bold.ttf`}),ae.Font.register({family:"notoOriya",src:`${n}/fonts/NotoSansOriya.ttf`}),ae.Font.register({family:"notoOriyaBold",src:`${n}/fonts/NotoSansOriya-Bold.ttf`}),ae.Font.register({family:"notoPunjabi",src:`${n}/fonts/MuktaMaheePunjabi-Regular.ttf`}),ae.Font.register({family:"notoPunjabiBold",src:`${n}/fonts/MuktaMaheePunjabi-Bold.ttf`}),ae.Font.register({family:"notoTamil",src:`${n}/fonts/NotoSansTamil.ttf`}),ae.Font.register({family:"notoTamilBold",src:`${n}/fonts/NotoSansTamil-Bold.ttf`}),ae.Font.register({family:"notoTelugu",src:`${n}/fonts/Noto-Sans-Telugu-Regular.ttf`}),ae.Font.register({family:"notoTeluguBold",src:`${n}/fonts/Noto-Sans-Telugu-Bold.ttf`}),ae.Font.register({family:"notoBengali",src:`${n}/fonts/NotoSerifBengali-Regular.ttf`}),ae.Font.register({family:"notoBengaliBold",src:`${n}/fonts/NotoSerifBengali-Bold.ttf`}),ae.Font.register({family:"Verdana",src:`${n}/fonts/Verdana.ttf`}),ae.Font.register({family:"Verdana-Bold",src:`${n}/fonts/Verdana-Bold.ttf`}),ae.Font.register({family:"Verdana-Italic",src:`${n}/fonts/Verdana-Italic.ttf`}),ae.Font.register({family:"Verdana-BoldItalic",src:`${n}/fonts/Verdana-Bold-Italic.ttf`}),ae.Font.register({family:"Arial",src:`${n}/fonts/Arial.ttf`}),ae.Font.register({family:"Arial-Bold",src:`${n}/fonts/Arial-Bold.ttf`}),ae.Font.register({family:"Arial-Italic",src:`${n}/fonts/Arial-Italic.ttf`}),ae.Font.register({family:"Arial-BoldItalic",src:`${n}/fonts/Arial-Bold-Italic.ttf`}),ae.Font.register({family:"Rupee",src:`${n}/fonts/Roboto-Regular.ttf`}),e.jsxRuntimeExports.jsx(ae.PDFViewer,{style:{display:"none"},children:e.jsxRuntimeExports.jsx(ae.Document,{children:e.jsxRuntimeExports.jsxs(ae.Page,{children:[e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoKannada"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoHindi"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoUrdu"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoArabic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoGujarati"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoMalayalam"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoOriya"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoPunjabi"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTamil"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTelugu"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoBengali"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoKannadaBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoHindiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoUrduBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoArabicBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoGujaratiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoMalayalamBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoOriyaBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoPunjabiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTamilBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoTeluguBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"notoBengaliBold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana-Bold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana-Italic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Verdana-BoldItalic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial-Bold"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial-Italic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Arial-BoldItalic"},children:"load font"}),e.jsxRuntimeExports.jsx(ae.Text,{style:{fontFamily:"Rupee"},children:"load font"})]})})})),_a=n=>{const{billsData:d,handleRowClick:c,handleRightSegment:a,getRowIndices:v,getRefundAmt:w,closePrintModal:l}=n,{patientIDs:A,patientDetails:S,billPreferences:p,setShowPrintModal:k,showPrintModal:x,variable:L}=y.useContext(Tt)||{},V=({label:j,className:Q})=>e.jsxRuntimeExports.jsx("th",{className:Q,children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:[" ",j]})}),O=j=>{switch(j){case Et[0]:return"hx_service-appointment-filled hfl-text-Primary-500";case Et[1]:return"hx_service-other-filled hfl-text-Pink-500";case Et[2]:return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}},D=j=>{switch(j){case Et[0]:return"Consultation";case Et[1]:return"Other";case Et[2]:return"Lab";default:return"Other"}},N=async(j,Q,I)=>{if(x?.visible&&l(),j?.order_id){const H=await Kl(j?.order_id,A?.patientRoleID||"",L),z={finalAmount:j.net_bill_amount,billedAmount:j.order_total,gstAmount:j.order_service_tax,cgstAmount:(+j.order_service_tax/2).toFixed(2),sgstAmount:(+j.order_service_tax/2).toFixed(2),discountAmount:j.order_item_sum_discount,receivedAmount:j.order_paid_amount,refundAmount:j.refund_amount,balanceAmount:j.balance_amount,paymentMode:H?.paymentModes.length?H?.paymentModes.join(", "):"",paymentStatus:parseInt(j?.order_paid_amount||"0")-parseInt(j?.refund_amount||"0")===0?"red":parseInt(j?.balance_amount||"0")===0?"green":"yellow"},Y=[S?.age&&typeof S?.age=="number"?`${S?.age}y`:S?.org_person_dob?pr(S?.org_person_dob):"",Xr[S?.gender]??"",S?.blood_group].filter(le=>le).join(", ");k({printDataFrom:"patient_popup",visible:!0,whichPreview:Q,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{preferences:{...p?.print?.bill,...p?.org_details,...p?.branch_details},billSummaryDetails:z,billServiceDetails:j?.order_items?.map(le=>({serviceName:le.service_name,price:le.order_unit_item_price,gst:Math.floor(+le.order_item_service_tax),discount:le.order_item_discount,netPrice:le.net_amount,itemQty:le.item_quantity})),billPatientDetails:{name:nr(S?.name)+(Y?` (${Y}) `:""),billDate:Te.dayjs(j?.order_date).format("DD-MMM-YYYY"),mobileNumber:S?.phone_number,email:S?.email,billNumber:j.order_id_str,patientId:S?.org_person_bid_str,patientIdForEmail:A?.patientRoleID,billStatus:parseInt(j?.balance_amount||"0")===0?"PAID":"UNPAID",address:[S?.address??"",S?.city??"",S?.pincode??""].filter(le=>le).join(", "),referredBy:H?.lab_owner_name?nr(H?.lab_owner_name):S?.ref_doc_name?nr(S?.ref_doc_name):"--"},showPrintPreviewForBill:I,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:j?.order_id}},trackEventHandler:()=>{}})}},P={table:"hfl-table-fixed hfl-rounded-lg hfl-shadow-md hfl-border-Gray-200 hfl-border-1 hfl-pb-8 ",th:"hfl-bg-Blue_gray-50",td:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-truncate hfl-text-Gray-500",td_without_truncate:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-text-Gray-500"},T=[{label:"Date",className:"focus:hfl-outline-none hfl-items-start hfl-w-[120px] hfl-border-Gray-200 hfl-border-1"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Department",className:"focus:hfl-outline-none hfl-items-start hfl-w-[106px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Paid",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Due",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Billed",className:"focus:hfl-outline-none hfl-items-start hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Discount",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Refund",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Service",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Price",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"GST",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"",className:"focus:hfl-outline-none hfl-items-center hfl-w-[36px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"}];return e.jsxRuntimeExports.jsx("div",{"data-qa":"bills-table",children:d.length>0&&e.jsxRuntimeExports.jsxs("table",{className:`${P.table} `,children:[e.jsxRuntimeExports.jsx("thead",{className:`${P.th}`,children:e.jsxRuntimeExports.jsx("tr",{children:T.map((j,Q)=>e.jsxRuntimeExports.jsx(V,{label:j.label,className:j.className},Q))})}),e.jsxRuntimeExports.jsx("tbody",{children:d.length>0&&d.map((j,Q)=>e.jsxRuntimeExports.jsx(y.Fragment,{children:j.order_items.map((I,H)=>e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[H===0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td}`,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:`${Te.dayjs(j.order_date).format("DD-MMM-YY")===Te.dayjs(new Date).format("DD-MMM-YY")?"hfl-w-[80px] hfl-bg-Success-25 hfl-px-1 hfl-text-Success-500":""}`,children:Te.dayjs(j.order_date).format("DD-MMM-YY")})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:j.order_id_str})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:` hfl-flex ${O(j.service_category)}`}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-truncate",children:[" ",D(j.service_category)]})]})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",parseInt(j.order_paid_amount)-parseInt(j.refund_amount)]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm","data-qa":Q+1+"-due-amount",children:["₹ ",j.balance_amount]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[84px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:`${j.order_paid_amount===void 0||j.refund_amount===void 0||j.balance_amount===void 0||parseInt(j.order_paid_amount)-parseInt(j.refund_amount)===0?"hfl-text-Error-500":parseInt(j.balance_amount)===0?"hfl-text-Success-500":"hfl-text-Warning-500"} hfl-cursor-pointer`,onClick:()=>{c(j)},"data-qa":Q+1+"-total-bill",children:["₹ ",j.net_bill_amount]}),e.jsxRuntimeExports.jsx("i",{className:" hx_print-filled hfl-cursor-pointer hfl-text-2 hfl-text-Gray-500",onClick:()=>N(j,"billPrintPreview",!1),"data-qa":Q+1+"-print-bill"})]})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[84px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",parseInt(j.order_discount)+parseInt(j.order_item_sum_discount)]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",j.refund_amount]})})})]}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-w-8 hfl-max-w-[96px]`,title:I.service_name,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-truncate",children:I.service_name})}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-max-w-[64px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",I.order_item_price]})})}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-max-w-[46px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["₹ ",I.order_item_service_tax]})})}),e.jsxRuntimeExports.jsx("td",{"data-qa":Q+1+"-"+(H+1)+"-delete-bill",className:`${P.td_without_truncate} hfl-max-w-[36px] hfl-cursor-pointer`,onClick:()=>{v(Q,H),a(ft[6]),parseInt(j.order_paid_amount)-parseInt(j.refund_amount)<=parseInt(j.net_bill_amount)-parseInt(j.order_items[H].net_amount)?w(0):w(parseInt(j.order_paid_amount)-parseInt(j.refund_amount))},children:e.jsxRuntimeExports.jsx("i",{className:"hx_delete hfl-text-Gray-500"})})]},`${Q}-${H}`))},Q))})]})})},ba=n=>{const{refundAmt:d,handleRightSegment:c,bills:a,billsListIndex:v,orderItemsIndex:w,getBillsList:l}=n,{patientIDs:A,showToast:S,variable:p}=y.useContext(Tt)||{},[k,x]=y.useState("");return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full hfl-bg-Error-25",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Medium",type:"Text lg",className:"hfl-flex",children:["Bill :",e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",className:"hfl-flex hfl-text-Blue-600",children:a?.bill_list[v].order_id_str})]}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>c("")})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-2.5 hfl-px-[13px] hfl-py-3",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-shrink-0 hfl-flex-col hfl-items-start hfl-gap-[5px] hfl-rounded-md hfl-border-Gray-200 hfl-bg-White_20 hfl-px-3 hfl-py-2 hfl-shadow-md",children:[e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",children:["Service: ",a?.bill_list[v].order_items[w].service_name]}),d>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",children:["Refund of",e.jsxRuntimeExports.jsx("div",{className:"hfl-inline hfl-font-inter-2 hfl-text-Error-600",children:" ₹ "+d+" "}),"will be given to delete this item"]})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full",children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-w-[100%]",rows:4,inputProps:{value:k,placeholder:"Enter Reason",onChange:L=>{x(L.target.value)}},isDynamicHeight:!0})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"Left",iconFile:"hx_close",className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{c("")}}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:"Delete",icon:"Left",iconFile:"hx_delete",onClick:async()=>{try{if(a?.bill_list?.[v].order_id){const L=await Yl(a?.bill_list?.[v].order_id,a?.bill_list?.[v].order_items[w].order_item_id,A?.patientRoleID||"",k,"0",p);L?(await l(),S?.("Success",L?.message,"Success",3e3),c("")):S?.("Error","Something went wrong please try again","Error",3e3)}}catch(L){console.error("Error in deleting bill item",L)}},className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>c("")})})]})},ja="data:image/svg+xml,%3csvg%20width='87'%20height='86'%20viewBox='0%200%2087%2086'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='43.5'%20cy='83.42'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.6751%2018.92C34.2431%2016.9347%2036.0897%2015.48%2038.2799%2015.48H55.9277C54.4566%2016.3563%2053.188%2017.5313%2052.2081%2018.92H33.6751ZM51.1971%2020.64H25.6649C22.782%2020.64%2020.445%2022.9502%2020.445%2025.8V57.62H47.4149H47.8499C48.3304%2057.62%2048.7199%2058.005%2048.7199%2058.48V62.995C48.7199%2066.676%2051.7387%2069.66%2055.4624%2069.66C59.1862%2069.66%2062.2049%2066.676%2062.2049%2062.995V37.84C55.4781%2037.84%2050.0249%2032.4495%2050.0249%2025.8C50.0249%2023.9534%2050.4455%2022.2039%2051.1971%2020.64ZM63.9449%2037.7181V61.8486C66.4138%2061.4392%2068.2949%2059.3168%2068.2949%2056.76V36.2293C66.9805%2036.9809%2065.5108%2037.4967%2063.9449%2037.7181ZM70.0349%2035.0228V56.76C70.0349%2060.2756%2067.3674%2063.1753%2063.924%2063.5893C63.6156%2067.9429%2059.9451%2071.38%2055.4624%2071.38C55.3865%2071.38%2055.3108%2071.379%2055.2354%2071.377L55.2449%2071.38H23.925C19.1201%2071.38%2015.225%2067.5296%2015.225%2062.78V61.06C15.225%2059.1601%2016.783%2057.62%2018.705%2057.62V25.8C18.705%2022.0003%2021.821%2018.92%2025.6649%2018.92H31.8855C32.49%2015.9759%2035.1232%2013.76%2038.2799%2013.76H61.3349V13.7902C61.6223%2013.7702%2061.9124%2013.76%2062.2049%2013.76C68.9318%2013.76%2074.3849%2019.1505%2074.3849%2025.8C74.3849%2029.5023%2072.6945%2032.8142%2070.0349%2035.0228ZM10.44%2066.005C10.44%2065.6488%2010.7321%2065.36%2011.0925%2065.36C11.4528%2065.36%2011.745%2065.6488%2011.745%2066.005V66.22C11.745%2070.9696%2015.6401%2074.82%2020.445%2074.82H22.4459C22.7823%2074.82%2023.055%2075.0895%2023.055%2075.422C23.055%2075.7545%2022.7823%2076.024%2022.4459%2076.024H20.445C14.6698%2076.024%2010.44%2071.9104%2010.44%2066.22V66.005ZM11.0925%2063.64C9.77111%2063.64%208.69995%2064.6988%208.69995%2066.005V66.22C8.69995%2072.8786%2013.7274%2077.744%2020.445%2077.744H22.4459C23.7433%2077.744%2024.795%2076.7044%2024.795%2075.422C24.795%2074.1396%2023.7433%2073.1%2022.4459%2073.1H20.445C16.601%2073.1%2013.485%2070.0197%2013.485%2066.22V66.005C13.485%2064.6988%2012.4138%2063.64%2011.0925%2063.64ZM24.795%2043.43C24.795%2042.2426%2025.7687%2041.28%2026.9699%2041.28H40.0199C41.2212%2041.28%2042.195%2042.2426%2042.195%2043.43C42.195%2044.6174%2041.2212%2045.58%2040.0199%2045.58H26.9699C25.7687%2045.58%2024.795%2044.6174%2024.795%2043.43ZM26.9699%2043C26.7297%2043%2026.535%2043.1925%2026.535%2043.43C26.535%2043.6675%2026.7297%2043.86%2026.9699%2043.86H40.0199C40.2602%2043.86%2040.4549%2043.6675%2040.4549%2043.43C40.4549%2043.1925%2040.2602%2043%2040.0199%2043H26.9699ZM32.15%2037.9752C32.2163%2038.0407%2032.3208%2038.0735%2032.4635%2038.0735C32.5859%2038.0735%2032.6751%2038.0407%2032.7312%2037.9752C32.7923%2037.9097%2032.8229%2037.8064%2032.8229%2037.6653V37.0531C33.297%2037.0027%2033.7277%2036.8691%2034.1152%2036.6525C34.5026%2036.4307%2034.8135%2036.1082%2035.048%2035.685C35.2876%2035.2566%2035.4074%2034.7275%2035.4074%2034.0977C35.4074%2033.5534%2035.2825%2033.105%2035.0327%2032.7522C34.783%2032.3944%2034.4924%2032.1198%2034.161%2031.9283C33.8297%2031.7368%2033.3837%2031.5202%2032.8229%2031.2783V29.2375C33.0778%2029.2476%2033.2919%2029.2753%2033.4652%2029.3206C33.6436%2029.366%2033.8246%2029.4239%2034.0081%2029.4945C34.1356%2029.5449%2034.2197%2029.5701%2034.2604%2029.5701C34.3624%2029.5701%2034.4695%2029.4995%2034.5816%2029.3584C34.6988%2029.2173%2034.7983%2029.0535%2034.8798%2028.8671C34.9614%2028.6756%2035.0022%2028.5194%2035.0022%2028.3985C35.0022%2028.2624%2034.9079%2028.1264%2034.7192%2027.9903C34.5357%2027.8543%2034.2757%2027.7384%2033.9393%2027.6426C33.6079%2027.5469%2033.2358%2027.4914%2032.8229%2027.4763V27.0606C32.8229%2026.9145%2032.7923%2026.8112%2032.7312%2026.7507C32.67%2026.6902%2032.5655%2026.66%2032.4176%2026.66C32.2953%2026.66%2032.2035%2026.6927%2032.1424%2026.7583C32.0812%2026.8187%2032.0506%2026.9195%2032.0506%2027.0606V27.4839C31.5561%2027.5393%2031.1024%2027.6728%2030.6895%2027.8845C30.2817%2028.0961%2029.9529%2028.3985%2029.7031%2028.7915C29.4585%2029.1795%2029.3361%2029.6557%2029.3361%2030.2201C29.3361%2030.8147%2029.4661%2031.2985%2029.7261%2031.6713C29.9912%2032.0392%2030.2996%2032.3189%2030.6513%2032.5103C31.0081%2032.6968%2031.4746%2032.8958%2032.0506%2033.1075V35.3221C31.7346%2035.3221%2031.444%2035.2793%2031.1789%2035.1936C30.9189%2035.108%2030.6513%2034.9971%2030.376%2034.8611C30.1823%2034.7603%2030.0549%2034.7099%2029.9937%2034.7099C29.902%2034.7099%2029.7873%2034.7804%2029.6496%2034.9215C29.512%2035.0576%2029.3922%2035.2214%2029.2902%2035.4128C29.1934%2035.6043%2029.1449%2035.7656%2029.1449%2035.8966C29.1449%2036.0528%2029.2596%2036.2191%2029.489%2036.3955C29.7235%2036.5718%2030.06%2036.7255%2030.4984%2036.8565C30.9419%2036.9825%2031.4593%2037.0556%2032.0506%2037.0757V37.6653C32.0506%2037.8064%2032.0837%2037.9097%2032.15%2037.9752ZM31.5001%2029.6154C31.602%2029.4793%2031.7855%2029.3786%2032.0506%2029.3131V30.9306C31.8212%2030.7996%2031.6453%2030.6635%2031.523%2030.5224C31.4058%2030.3813%2031.3471%2030.2151%2031.3471%2030.0236C31.3471%2029.8825%2031.3981%2029.7464%2031.5001%2029.6154ZM33.2511%2034.8611C33.1441%2034.9971%2033.0013%2035.1004%2032.8229%2035.171V33.4703C33.2154%2033.692%2033.4117%2033.9843%2033.4117%2034.3471C33.4117%2034.5537%2033.3582%2034.725%2033.2511%2034.8611ZM24.795%2050.31C24.795%2049.1226%2025.7687%2048.16%2026.9699%2048.16H53.07C54.2712%2048.16%2055.2449%2049.1226%2055.2449%2050.31C55.2449%2051.4974%2054.2712%2052.46%2053.07%2052.46H26.9699C25.7687%2052.46%2024.795%2051.4974%2024.795%2050.31ZM26.9699%2049.88C26.7297%2049.88%2026.535%2050.0725%2026.535%2050.31C26.535%2050.5475%2026.7297%2050.74%2026.9699%2050.74H53.07C53.3102%2050.74%2053.5049%2050.5475%2053.5049%2050.31C53.5049%2050.0725%2053.3102%2049.88%2053.07%2049.88H26.9699ZM51.7649%2025.8C51.7649%2020.1004%2056.4391%2015.48%2062.2049%2015.48C67.9708%2015.48%2072.6449%2020.1004%2072.6449%2025.8C72.6449%2031.4996%2067.9708%2036.12%2062.2049%2036.12C56.4391%2036.12%2051.7649%2031.4996%2051.7649%2025.8ZM60.0299%2020.21C60.0299%2019.0226%2061.0037%2018.06%2062.2049%2018.06C63.4062%2018.06%2064.3799%2019.0226%2064.3799%2020.21V25.37C64.3799%2026.5574%2063.4062%2027.52%2062.2049%2027.52C61.0037%2027.52%2060.0299%2026.5574%2060.0299%2025.37V20.21ZM62.2049%2019.78C61.9647%2019.78%2061.7699%2019.9725%2061.7699%2020.21V25.37C61.7699%2025.6075%2061.9647%2025.8%2062.2049%2025.8C62.4452%2025.8%2062.6399%2025.6075%2062.6399%2025.37V20.21C62.6399%2019.9725%2062.4452%2019.78%2062.2049%2019.78ZM62.2049%2033.54C61.0037%2033.54%2060.0299%2032.5774%2060.0299%2031.39C60.0299%2030.2026%2061.0037%2029.24%2062.2049%2029.24C63.4062%2029.24%2064.3799%2030.2026%2064.3799%2031.39C64.3799%2032.5774%2063.4062%2033.54%2062.2049%2033.54ZM61.7699%2031.39C61.7699%2031.6275%2061.9647%2031.82%2062.2049%2031.82C62.4452%2031.82%2062.6399%2031.6275%2062.6399%2031.39C62.6399%2031.1525%2062.4452%2030.96%2062.2049%2030.96C61.9647%2030.96%2061.7699%2031.1525%2061.7699%2031.39Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",Ra=n=>{const{closePrintModal:d,handleCurrentWindow:c,billIdToOpen:a,onBillHandled:v}=n,[w,l]=y.useState(),[A,S]=y.useState(""),[p,k]=y.useState(""),[x,L]=y.useState(),[V,O]=y.useState(),[D,N]=y.useState(1),[P,T]=y.useState([]),[j,Q]=y.useState(-1),[I,H]=y.useState(-1),[z,J]=y.useState(0),[Y,le]=y.useState(0),[W,me]=y.useState(!1),je=y.useContext(Tt);if(!je)throw new Error("Bills component must be used within an AppContext.Provider");const{patientIDs:ye,setLoading:et,variable:pe}=je,$=Oe=>J(Oe),ue=(Oe=ft[0])=>S(Oe),M=Oe=>k(Oe),Ae=Oe=>{L(Oe),M(Oe?.service_category??""),S(ft[1])},Fe=(Oe,at)=>{Q(Oe),H(at)},He=y.useCallback(async()=>{if(ye?.patientRoleID)try{const Oe=await yl(Te.dayjs().format("YYYY-MM-DD"),ye.patientRoleID,!1,pe);O(Oe)}catch(Oe){console.error("Error in getPastDueAmount API Call:",Oe)}},[]);y.useEffect(()=>{He()},[He]);const mt=async()=>{const Oe=await Cl(ye.patientRoleID,pe);le(Oe?.wallet_balance||0)},pt=async()=>{et(!0);try{et(!0);const Oe=await gl("all",ye.patientRoleID,1,10,pe);Oe&&(l(Oe),T(Oe?.bill_list)),et(!1)}catch{console.log("error in getBillsList API Call")}et(!1)},nt=async Oe=>{let at=Oe;if(et(!0),at<=Math.ceil(w.total_pages)){if(at=Oe+1,at!==Oe){const Pt=await gl("all",ye.patientRoleID,Oe,10,pe);if(Pt?.bill_list){const xt=[...P,...Pt.bill_list];T(xt)}}N(at)}et(!1)};return y.useEffect(()=>{pt()},[]),y.useEffect(()=>{mt()},[W]),y.useEffect(()=>{if(a&&P.length){const Oe=P.find(at=>at.order_id_str===a);Oe&&(Ae(Oe),v?.())}},[a,P]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-flex-row hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[938px] hfl-flex-col hfl-px-4 hfl-py-2 xxs:max-md:hfl-w-[750px] ${A===ft[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-max-h-[470px] hfl-w-full hfl-flex-col hfl-overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-self-stretch",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Gray-700",children:"Bills"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Blue_gray-600",children:"Total Due Amount :"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text lg",className:"hfl-text-Error-500",children:["₹ ",V?.total_amount||0]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[30px] hfl-w-[2px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",className:" hfl-text-Success-500",children:Y}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>ue(ft[7])})]})]})]})]}),w?.bill_list?.length>0?e.jsxRuntimeExports.jsx(_a,{billsData:P,handleRowClick:Ae,handleRightSegment:ue,getRowIndices:Fe,getRefundAmt:$,closePrintModal:d}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:ja,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"No Past Bills Available"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text md",className:"hfl-text-Gray-500",children:["To create a new bill go to"," ",e.jsxRuntimeExports.jsx("p",{className:"hfl-inline hfl-cursor-pointer hfl-text-Blue-600 hfl-underline",onClick:()=>c(Rt[2]),children:"Add Bills"})]})]})]})}),w?.bill_list?.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Qr,{currentPage:D,totalRecord:w?.total_records,currentTotal:D===Math.ceil(w?.total_records/20)?w?.total_records:D*20,handleLoadMore:nt})})]}),e.jsxRuntimeExports.jsxs(Pl,{children:[A===ft[1]&&e.jsxRuntimeExports.jsx(Al,{rightSegment:A,serviceDetails:x?.order_items??[],categorySummaryData:x,serviceItem:p,handleRightSegment:ue,getPastDueAmount:He,getBillSummarydata:pt,closePrintModal:d,setRefreshWallet:me,walletBalance:Y,bill_date:"",refreshBillsList:pt}),A===ft[6]&&e.jsxRuntimeExports.jsx(ba,{refundAmt:z,bills:w,billsListIndex:j,orderItemsIndex:I,handleRightSegment:ue,getBillsList:pt}),A===ft[7]&&e.jsxRuntimeExports.jsx(Dl,{depositAmount:Y,handleRightSegment:ue,rightSegment:A,setRefreshWallet:me})]})]})},wa=({childModalRef:n,children:d,hideBackDrop:c=!1,backdropClasses:a="",modalClasses:v="",closeOnClickOutside:w,clickOutsideHandler:l,position:A="hfl-inset-0"})=>(y.useEffect(()=>{if(!w)return;const S=p=>{n.current&&!n.current.contains(p.target)&&l()};return document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[l,n,w]),e.jsxRuntimeExports.jsx("div",{className:`hfl-fixed ${A} hfl-z-50 hfl-flex hfl-items-center hfl-justify-center ${a} ${c?"":"hfl-bg-Gray-750 hfl-backdrop-blur-sm"}`,children:e.jsxRuntimeExports.jsx("div",{ref:n,className:`hfl-rounded-lg hfl-shadow-md hfl-bg-White ${v??""}`,children:d})})),Ca=({reference:n,closeModalHandler:d,payment_id:c,currentMode:a,transactionType:v,refreshPaymentData:w})=>{const{showToast:l,variable:A}=y.useContext(Tt)||{},[S,p]=y.useState({paymentMethod:a}),k=async()=>{const x=await Mn(c,S.paymentMethod,v,A);x.status?(l("Update Success",x.message,"Success",3e3),w?.()):l("Update Failed",x.message,"Error",3e3),d({show:!1,payment_id:"",mode:"",payment_type:""})};return e.jsxRuntimeExports.jsxs("div",{ref:n,className:"hfl-flex hfl-w-[400px] hfl-flex-col hfl-rounded-lg hfl-border-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-rounded-t-lg hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-5 hfl-text-White hfl-shadow-sm",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Bold",type:"Text md",className:"hfl-text-White",children:"Please make required changes"})," "]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-bg-White hfl-p-6",children:e.jsxRuntimeExports.jsx(e.Ap,{className:"hfl-w-[200px] hfl-text-0 hfl-text-Gray-800 ",value:{label:ur[S.paymentMethod]},options:Ur.map(x=>({label:x,value:x,className:"hfl-text-1 hfl-text-Gray-800"})),onChange:x=>{p(L=>({...L,paymentMethod:ur[x.value]}))},label:"Payment Method",labelClassName:"after:hfl-content-['*'] after:hfl-text-Error-600 after:hfl-ml-1 hfl-font-inter-2 hfl-font-inter",dropdownInputTextClassName:"hfl-text-1 hfl-text-Gray-600"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-end hfl-gap-[10px] hfl-rounded-b-lg hfl-border-t-1 hfl-border-Gray-100 hfl-bg-Gray-50 hfl-px-7 hfl-py-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{textField:"Cancel",size:"sm",hierarchy:"Primary",onClick:()=>d({show:!1,payment_id:"",mode:"",payment_type:""}),className:"hfl-border-1 hfl-border-Blue-300 hfl-bg-Blue-50 hfl-text-Blue-600 hover:hfl-bg-Blue-600 hover:hfl-text-White"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"sm",textField:"Save",className:"hfl-bg-Blue-600",onClick:k})]})]})},Ea=({styles:n,data:d,handleDeleteRow:c,handleRightSegment:a,handleRowClick:v,getType:w,getTypeColor:l,refreshPaymentData:A})=>{const[S,p]=y.useState({show:!1,payment_id:"",mode:"",payment_type:""}),k=y.useRef(null),x=V=>{switch(V){case"1":return"Consultation";case"2":return"Other";case"3":return"Lab";default:return"Other"}},L=V=>{switch(V){case"1":return"hx_service-appointment-filled hfl-text-Primary-500";case"2":return"hx_service-other-filled hfl-text-Pink-500";case"3":return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d.length>0&&d.map((V,O)=>e.jsxRuntimeExports.jsx(y.Fragment,{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[e.jsxRuntimeExports.jsx("td",{className:`${n.td} `,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:Te.dayjs.utc(new Date(V.created_on)).format("YYYY-MM-DD / HH:mm")})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 ",children:V.order_id_str})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hfl-text-Primary-600 hover:hfl-underline",onClick:()=>{v(V)},"data-qa":O+1+"-bill-amount",children:"₹"+V.paid_amount})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f_rupee hfl-flex "}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:` -hfl-ml-1 hfl-px-1 ${l(V.payment_refund)}`,children:w(V.payment_refund)})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",onClick:()=>{},className:"-hfl-ml-1",children:ur[V.paid_mode]}),e.jsxRuntimeExports.jsx("span",{className:"hx_edit hfl-cursor-pointer hfl-text-Blue-600",onClick:()=>{p({show:!0,payment_id:V.order_payment_id,mode:V.paid_mode,payment_type:w(V.payment_refund).toLowerCase()})}})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center ",children:[e.jsxRuntimeExports.jsx("i",{className:`hfl-flex hfl-text-3 hfl-text-Error-500 ${L(V.service_category_id)}`}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-0 ",children:[" ",x(V?.service_category_id)]})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[50px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:V.order_total})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,title:V.details,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-truncate",children:V.details})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("i",{className:" hx_delete hfl-flex hfl-cursor-pointer hfl-text-2",onClick:D=>{D.stopPropagation(),a(),c(V,O)},"data-qa":O+1+"-delete-transaction"})})]},`${O}`)},O)),S.show&&e.jsxRuntimeExports.jsx(wa,{childModalRef:k,backdropClasses:"",clickOutsideHandler:()=>{},closeOnClickOutside:!1,hideBackDrop:!1,modalClasses:"hfl-rounded-xlg hfl-mx-2 xsm:hfl-mx-6 md:hfl-mx-12 ",children:e.jsxRuntimeExports.jsx(Ca,{reference:k,closeModalHandler:p,payment_id:S.payment_id,currentMode:S.mode,transactionType:S.payment_type,refreshPaymentData:A})})]})},Pa=({styles:n,data:d,handleRowClick:c,closePrintModal:a,patient_entity_id:v})=>{const{patientDetails:w,patientIDs:l,billPreferences:A,setShowPrintModal:S,showPrintModal:p}=y.useContext(Tt),k=async(x,L,V,O)=>{p?.visible&&a();const N=[w?.age&&typeof w?.age=="number"?`${w?.age}y`:w?.org_person_dob?pr(w?.org_person_dob):"",Xr[w?.gender]??"",w?.blood_group].filter(T=>T).join(", "),P={name:nr(w?.name)+(N?` (${N}) `:""),billDate:Te.dayjs(x?.transaction_time).format("DD-MMM-YYYY"),mobileNumber:w?.phone_number,email:w?.email,billNumber:x?.bill_number,patientId:w?.org_person_bid_str,patientIdForEmail:l?.patientRoleID,billStatus:"PAID",address:[w?.address??"",w?.city??"",w?.pincode??""].filter(T=>T).join(", ")};S({printDataFrom:"patient_popup",visible:!0,whichPreview:L,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill_deposit_refund",details:{showPrintPreviewForBill:V,preferences:{...A?.print?.bill,...A?.org_details},depositRefundBillDetails:x,billPatientDetails:P,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:x?.bill_number,patient_user_id:v}},trackEventHandler:()=>{console.log(O)}})};return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d.length>0&&d.map((x,L)=>e.jsxRuntimeExports.jsx(y.Fragment,{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[e.jsxRuntimeExports.jsx("td",{className:`${n.td} `,children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",children:Te.dayjs.utc(new Date(x.transaction_time)).format("YYYY-MM-DD / HH:mm")})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-text-Primary-600",children:x.bill_number})})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[105px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:x.bill_amount})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[115px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hover:hfl-underline",onClick:()=>{c(x)},"data-qa":L+1+"-bill-amount",children:"₹"+x.paid_amount}),e.jsxRuntimeExports.jsx("i",{className:" hx_print-filled hfl-cursor-pointer hfl-text-2 hfl-text-Gray-500",onClick:()=>k(x,"billPrintPreview",!1,x?.type==="DEPOSIT"?"DEPOSIT_BILL_PRINT":"REFUND_BILL_PRINT"),"data-qa":L+1+"-print-bill"})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:x.mode})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center ",children:[e.jsxRuntimeExports.jsx("img",{src:Xl(x.type)}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-0 ",children:[" ",x.type]})]})}),e.jsxRuntimeExports.jsx("td",{className:`${n.td} hfl-max-w-[160px]`,title:x.details,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-truncate",children:x.details})})})]},`${L}`)},L))})},Sa=n=>{const{data:d,setTableData:c,handleRightSegment:a,handleRowClick:v,activeTab:w,closePrintModal:l,patient_entity_id:A,refreshPaymentData:S}=n,{patientIDs:p,showToast:k,variable:x}=y.useContext(Tt)||{};Te.dayjs.extend(Nl);const L=async(T,j)=>{let Q="";T.payment_refund==="P"?Q="payment":T.payment_refund==="R"&&(Q="refund");try{const I=await Nn(T.order_payment_id,Q,T.order_id,p?.patientRoleID||"",x);I.status&&(k("Success",I?.message,"Success",3e3),c(H=>{try{const z=[...H];return z.splice(j,1),z}catch(z){return console.error(`Error: ${z}`),H}}),S())}catch(I){console.error("Error deleting payment:",I)}},V=T=>{switch(T){case"P":return"Payment";case"R":return"Refund";case"D":return"Deposit";default:return""}},O=T=>{switch(T){case"DEPOSIT":case"P":return"hfl-bg-Success-50 hfl-text-Success-500";case"REFUND":case"R":return"hfl-bg-Error-50 hfl-text-Error-500";case"D":return"hfl-bg-Primary-50 hfl-text-Primary-500";default:return""}},D=y.useMemo(()=>w===fr[jr.consultation_lab_other_services].key?[{label:"Date/Time",className:"focus:hfl-outline-none hfl-items-start hfl-w-[162px] hfl-border-Gray-200 hfl-border-1"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[100px] hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Type",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Mode",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Category",className:"focus:hfl-outline-none hfl-items-start hfl-w-[136px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Bill Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[110px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Details",className:"focus:hfl-outline-none hfl-items-start hfl-w-[120px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:" ",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"}]:[{label:"Date/Time",className:"focus:hfl-outline-none hfl-items-start hfl-w-[162px] hfl-border-Gray-200 hfl-border-1 hfl-px-2 hfl-text-left"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[100px] hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Bill Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[105px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Total Paid",className:"focus:hfl-outline-none hfl-items-start hfl-w-[115px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Mode",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Category",className:"focus:hfl-outline-none hfl-items-start hfl-w-[136px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Details",className:"focus:hfl-outline-none hfl-items-start hfl-w-[160px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"}],[w]),N=({label:T,className:j})=>e.jsxRuntimeExports.jsx("th",{className:j,children:e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:[" ",T]})}),P={table:"hfl-table-fixed hfl-rounded-lg hfl-shadow-md hfl-border-Gray-200 hfl-border-1 hfl-pb-8 ",th:"hfl-bg-Blue_gray-50",td:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-truncate hfl-text-Gray-500"};return e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsxs("table",{className:`${P.table}`,children:[e.jsxRuntimeExports.jsx("thead",{className:`${P.th}`,children:e.jsxRuntimeExports.jsx("tr",{children:D.map((T,j)=>e.jsxRuntimeExports.jsx(N,{label:T.label,className:T.className},j))})}),e.jsxRuntimeExports.jsx("tbody",{children:w===fr[jr.consultation_lab_other_services].key?e.jsxRuntimeExports.jsx(Ea,{styles:P,data:d,handleDeleteRow:L,handleRightSegment:a,handleRowClick:v,getTypeColor:O,getType:V,refreshPaymentData:S}):e.jsxRuntimeExports.jsx(Pa,{styles:P,data:d,handleRowClick:v,closePrintModal:l,patient_entity_id:A})})]})})},Na="data:image/svg+xml,%3csvg%20width='88'%20height='87'%20viewBox='0%200%2088%2087'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='44'%20cy='83.92'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.6799%2017.3857C12.6799%2016.1344%2013.7061%2015.12%2014.972%2015.12C16.2379%2015.12%2017.2641%2016.1344%2017.2641%2017.3857V22.0468C17.2641%2023.2981%2016.2379%2024.3125%2014.972%2024.3125C13.7061%2024.3125%2012.6799%2023.2981%2012.6799%2022.0468V17.3857ZM14.972%2016.84C14.6671%2016.84%2014.4199%2017.0843%2014.4199%2017.3857V22.0468C14.4199%2022.3482%2014.6671%2022.5925%2014.972%2022.5925C15.2769%2022.5925%2015.5241%2022.3482%2015.5241%2022.0468V17.3857C15.5241%2017.0843%2015.2769%2016.84%2014.972%2016.84ZM23.1199%2026.3C23.1199%2023.9252%2025.0675%2022%2027.4699%2022H56.4199C55.1757%2023.464%2054.2776%2025.225%2053.8502%2027.16H23.1199V26.3ZM53.6005%2028.88H19.6399C17.2375%2028.88%2015.2899%2030.8052%2015.2899%2033.18V37.48L56.4199%2037.48C54.6412%2035.3872%2053.5699%2032.6872%2053.5699%2029.74C53.5699%2029.4508%2053.5802%2029.1641%2053.6005%2028.88ZM67.4899%2041.6581V58.98H69.2299C71.6324%2058.98%2073.5799%2057.0548%2073.5799%2054.68V38.9628C71.8823%2040.3727%2069.7897%2041.3329%2067.4899%2041.6581ZM75.3199%2037.1886V54.68C75.3199%2058.0047%2072.5933%2060.7%2069.2299%2060.7H67.4899V61.56C67.4899%2064.8848%2064.7633%2067.58%2061.3999%2067.58H19.6399C16.2765%2067.58%2013.5499%2064.8848%2013.5499%2061.56V33.18C13.5499%2029.8552%2016.2765%2027.16%2019.6399%2027.16H21.3799V26.3C21.3799%2022.9752%2024.1065%2020.28%2027.4699%2020.28H57.9199V20.5172C60.0371%2018.759%2062.7684%2017.7%2065.7499%2017.7C72.4768%2017.7%2077.9299%2023.0905%2077.9299%2029.74C77.9299%2032.5522%2076.9545%2035.1393%2075.3199%2037.1886ZM15.2899%2042.64L65.7499%2042.64V58.98V60.7V61.56C65.7499%2063.9348%2063.8024%2065.86%2061.3999%2065.86H19.6399C17.2375%2065.86%2015.2899%2063.9348%2015.2899%2061.56V42.64ZM73.262%2063.28C71.9961%2063.28%2070.9699%2064.2944%2070.9699%2065.5457V70.2068C70.9699%2071.4581%2071.9961%2072.4725%2073.262%2072.4725C74.5279%2072.4725%2075.5541%2071.4581%2075.5541%2070.2068V65.5457C75.5541%2064.2944%2074.5279%2063.28%2073.262%2063.28ZM72.7099%2065.5457C72.7099%2065.2443%2072.9571%2065%2073.262%2065C73.5669%2065%2073.8141%2065.2443%2073.8141%2065.5457V70.2068C73.8141%2070.5082%2073.5669%2070.7525%2073.262%2070.7525C72.9571%2070.7525%2072.7099%2070.5082%2072.7099%2070.2068V65.5457ZM55.3099%2029.74C55.3099%2024.0404%2059.9841%2019.42%2065.7499%2019.42C71.5158%2019.42%2076.1899%2024.0404%2076.1899%2029.74C76.1899%2035.4396%2071.5158%2040.06%2065.7499%2040.06C59.9841%2040.06%2055.3099%2035.4396%2055.3099%2029.74ZM63.5749%2024.15C63.5749%2022.9626%2064.5487%2022%2065.7499%2022C66.9511%2022%2067.9249%2022.9626%2067.9249%2024.15V29.31C67.9249%2030.4974%2066.9511%2031.46%2065.7499%2031.46C64.5487%2031.46%2063.5749%2030.4974%2063.5749%2029.31V24.15ZM65.7499%2023.72C65.5097%2023.72%2065.3149%2023.9125%2065.3149%2024.15V29.31C65.3149%2029.5475%2065.5097%2029.74%2065.7499%2029.74C65.9902%2029.74%2066.1849%2029.5475%2066.1849%2029.31V24.15C66.1849%2023.9125%2065.9902%2023.72%2065.7499%2023.72ZM65.7499%2037.48C64.5487%2037.48%2063.5749%2036.5174%2063.5749%2035.33C63.5749%2034.1426%2064.5487%2033.18%2065.7499%2033.18C66.9511%2033.18%2067.9249%2034.1426%2067.9249%2035.33C67.9249%2036.5174%2066.9511%2037.48%2065.7499%2037.48ZM65.3149%2035.33C65.3149%2035.5675%2065.5097%2035.76%2065.7499%2035.76C65.9902%2035.76%2066.1849%2035.5675%2066.1849%2035.33C66.1849%2035.0925%2065.9902%2034.9%2065.7499%2034.9C65.5097%2034.9%2065.3149%2035.0925%2065.3149%2035.33ZM35.7349%2050.38C34.5337%2050.38%2033.5599%2051.3426%2033.5599%2052.53C33.5599%2053.7174%2034.5337%2054.68%2035.7349%2054.68H59.2249C60.4262%2054.68%2061.3999%2053.7174%2061.3999%2052.53C61.3999%2051.3426%2060.4262%2050.38%2059.2249%2050.38H35.7349ZM35.2999%2052.53C35.2999%2052.2925%2035.4947%2052.1%2035.7349%2052.1H59.2249C59.4652%2052.1%2059.6599%2052.2925%2059.6599%2052.53C59.6599%2052.7675%2059.4652%2052.96%2059.2249%2052.96H35.7349C35.4947%2052.96%2035.2999%2052.7675%2035.2999%2052.53ZM24.4249%2056.4C26.5871%2056.4%2028.3399%2054.6673%2028.3399%2052.53C28.3399%2050.3927%2026.5871%2048.66%2024.4249%2048.66C22.2627%2048.66%2020.5099%2050.3927%2020.5099%2052.53C20.5099%2054.6673%2022.2627%2056.4%2024.4249%2056.4Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",Aa=({walletBalance:n,handleRightSegment:d,headerText:c})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-2 hfl-flex hfl-w-full hfl-flex-row hfl-items-center hfl-justify-between hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text lg",children:c}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Medium",type:"Text lg",className:" hfl-text-Success-500",children:n}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>d(ft[7])})]})]})]}),Da=n=>{Te.dayjs.extend(Nl);const{patientDetails:d,patientIDs:c,billPreferences:a,setShowPrintModal:v,showPrintModal:w}=y.useContext(Tt)||{},{handleRightSegment:l,closePrintModal:A,summaryData:S,patient_entity_id:p}=n,k=async(x,L)=>{w?.visible&&A();const O=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?pr(d?.org_person_dob):"",Xr[d?.gender]??"",d?.blood_group].filter(N=>N).join(", "),D={name:nr(d?.name)+(O?` (${O}) `:""),billDate:Te.dayjs(S?.transaction_time).format("DD-MMM-YYYY"),mobileNumber:d?.phone_number,email:d?.email,billNumber:S?.bill_number,patientId:d?.org_person_bid_str,patientIdForEmail:c?.patientRoleID,billStatus:"PAID",address:[d?.address??"",d?.city??"",d?.pincode??""].filter(N=>N).join(", ")};v?.({printDataFrom:"patient_popup",visible:!0,whichPreview:x,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill_deposit_refund",details:{showPrintPreviewForBill:L,preferences:{...a?.print?.bill,...a?.org_details},depositRefundBillDetails:S,billPatientDetails:D,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:S?.bill_number,patient_user_id:p}},trackEventHandler:()=>{}})};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_arrow-left hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>l(ft[0])}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-flex hfl-items-center",children:"Bills Summary"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-between hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[60%] hfl-gap-2",children:[e.jsxRuntimeExports.jsx("img",{src:Xl(S.type),alt:""}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:S.type==="DEPOSIT"?"Deposit":"Refund(Deposit)"})]}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.bill_amount]})]}),S.type==="DEPOSIT"&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Total Billed Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.bill_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Paid Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.paid_amount]})]})]}),S.type==="REFUND"&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Deposit Amount"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.opening_balance]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Total Balance"}),e.jsxRuntimeExports.jsxs(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",S.type==="DEPOSIT"?parseInt(S?.bill_amount)-parseInt(S?.paid_amount):S?.closing_balance]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-bottom-1 hfl-flex hfl-w-full hfl-items-start hfl-gap-2 hfl-px-1 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Print",icon:"Left",onClick:()=>k("billPrintPreview",!1),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>k("billSharePreview",!0),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},Ta=({closePrintModal:n})=>{const[d,c]=y.useState(fr[jr.consultation_lab_other_services].key),[a,v]=y.useState(null),[w,l]=y.useState(ft[5]),[A,S]=y.useState(""),[p,k]=y.useState(),[x,L]=y.useState([]),[V,O]=y.useState(1),[D,N]=y.useState(),{setLoading:P,patientIDs:T,variable:j}=y.useContext(Tt),[Q,I]=y.useState(0),[H,z]=y.useState(!1),J=y.useCallback(async()=>{try{if(P(!0),T?.patientRoleID){const $=await vl(T.patientRoleID,1,10,j);$&&(v($),L($.data))}P(!1)}catch{v(null),L([]),P(!1),console.log("error in getPaymentsList API Call")}},[T.patientRoleID,P,j]),Y=y.useCallback(async()=>{try{P(!0);const $=await _l(T?.patientRoleID||"",1,10,j);$&&(v($),L($?.wallet_transactions||[])),P(!1)}catch{v(null),L([]),P(!1),console.log("error in getDepositRefundList API Call")}},[T?.patientRoleID,P,j]),le=($=ft[5])=>{l($)},W=$=>{S($)},me=async $=>{if(k($),d===fr[jr.consultation_lab_other_services].key){if(W(Et[parseInt($?.service_category_id)-1]),l(ft[1]),$?.order_id){const ue=await ye($.order_id);N(ue)}}else l(ft[8])},je=async $=>{let ue=$;if(P(!0),ue<=Math.ceil(a?.total_records||0)){if(ue=$+1,ue!==$){let M,Ae;d==fr[jr.deposit_refund].key?(M=await _l(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.wallet_transactions]):(M=await vl(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.data]),L(Ae)}O(ue)}P(!1)},ye=async $=>{try{return await wl($,T?.patientRoleID||"",["order_items"],j)}catch{console.log("Error in Loading Bill Details from Bill Id")}},et=y.useCallback(async()=>{const $=await Cl(T?.patientRoleID||"",j);I($?.wallet_balance||0)},[T?.patientRoleID,j]),pe=$=>{c($),le(),n()};return y.useEffect(()=>{d==fr[jr.deposit_refund].key?Y():J()},[d,Y,J]),y.useEffect(()=>{et(),d==fr[jr.deposit_refund].key&&Y()},[d,et,Y,H]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[938px] hfl-flex-col hfl-justify-start hfl-px-4 hfl-py-2 xxs:max-md:hfl-w-[750px] ${w===ft[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:Object.values(fr).map(($,ue)=>e.jsxRuntimeExports.jsx(e.bi,{variant:`${d===$.key?"Semibold":"Regular"}`,type:"Text md",className:`hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-gap-0.5 hfl-px-[13px] hfl-py-2 ${d===$.key?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>pe($.key),children:$.label},ue))}),e.jsxRuntimeExports.jsx(Aa,{walletBalance:Q,handleRightSegment:le,headerText:fr[d].label}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-max-h-[470px] hfl-w-full hfl-flex-col hfl-overflow-y-scroll"}),x?.length?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto ",children:e.jsxRuntimeExports.jsx(Sa,{data:x,setTableData:L,handleRowClick:me,handleRightSegment:le,activeTab:d,closePrintModal:n,patient_entity_id:a?.entity_id||"",refreshPaymentData:J})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Qr,{currentPage:V,totalRecord:a?.total_records||0,currentTotal:V===Math.ceil((a?.total_records||0)/10)?a?.total_records||0:V*10,handleLoadMore:je})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:Na,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"No Active or Past Payments for the Patient"})]})]}),e.jsxRuntimeExports.jsxs(Pl,{children:[w===ft[1]&&e.jsxRuntimeExports.jsx(Al,{rightSegment:w,categorySummaryData:{...p,order_date:D?.order_date??""},serviceItem:A,handleRightSegment:le,serviceDetails:D?.order_items??[],getBillSummarydata:J,closePrintModal:n,setRefreshWallet:z,walletBalance:Q,getPastDueAmount:()=>{},refreshBillsList:()=>{},bill_date:""}),w===ft[7]&&e.jsxRuntimeExports.jsx(Dl,{depositAmount:Q,handleRightSegment:le,rightSegment:w,setRefreshWallet:z}),w===ft[8]&&e.jsxRuntimeExports.jsx(Da,{summaryData:{...p,order_date:D?.order_date??""},handleRightSegment:le,closePrintModal:n,patient_entity_id:a?.entity_id||""})]})]})},Tl=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-inset-0 hfl-z-[100] hfl-flex hfl-h-full hfl-w-full hfl-items-center hfl-justify-center hfl-overflow-y-auto hfl-outline-none focus:hfl-outline-none",children:e.jsxRuntimeExports.jsx(e.Eu,{progress:10,spinnerMode:!0})}),Jl=({columns:n,data:d})=>{const{getTableProps:c,getTableBodyProps:a,headerGroups:v,rows:w,prepareRow:l}=Jr.useTable({columns:n,data:d}),A=p=>{const k=[];return p?.headers?.length&&p.headers.map(x=>{k.push(e.jsxRuntimeExports.jsx("th",{...x.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:x.render("Header")})}))}),k},S=()=>{const p=[];return w.map((k,x)=>{l(k),p.push(e.jsxRuntimeExports.jsx("tr",{id:x.toString(),...k.getRowProps(),className:"hfl-bg-White hfl-group hfl-border-t-1 hfl-border-Gray-200",children:k.cells.map((L,V)=>e.jsxRuntimeExports.jsx("td",{"data-qa":x+1+"-"+(V+1),...L.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bi,{variant:"Regular",type:"Text sm",className:"hfl-text-[13px] hfl-text-Gray-500",children:L.render("Cell")})}))}))}),p};return e.jsxRuntimeExports.jsx("div",{className:"hfl-overflow-y-auto","data-qa":"lab-report-table",children:e.jsxRuntimeExports.jsxs("table",{...c(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:v.map(p=>e.jsxRuntimeExports.jsx("tr",{...p.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50 ",children:A(p)}))}),e.jsxRuntimeExports.jsx("tbody",{...a(),className:"hfl-rounded-",children:S()})]})})},Ia=n=>{const{visits:d=[],setPdfUrl:c,pdfUrl:a}=n,[v,w]=y.useState([]);return y.useEffect(()=>{w(Ba(d))},[]),e.jsxRuntimeExports.jsx("div",{children:v&&v.length&&v.map((l,A)=>l.reports.length>0&&l.reports.map((S,p)=>{const k=l.date||"No date available";S.label=`${new Date(k).toLocaleDateString()}${l.reports.length>1?` - ${p+1}`:""}`;const{lab_number:x,label:L,message:V=""}=S;return e.jsxRuntimeExports.jsx("div",{className:"hfl-relative hfl-mb-2 hfl-flex hfl-items-center hfl-justify-center",title:`${L} ${V?`(${V})`:""}
18
18
  ${x}`,children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:`${L} ${V?`(${V})`:""}
19
19
  ${x}`,textFieldClassName:"hfl-w-full hfl-line-clamp-2",onClick:()=>c(S),className:`
20
20
  hfl-w-full