hplx-feature-library 1.0.311 → 1.0.312
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.
|
@@ -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(Nl,{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:W})]}),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"})]})]})},ia=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:W,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(O=>({...O,bill_item_details:{...O.bill_item_details,...le}}))},H=async(J="")=>{try{const Y=await Sn(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 wl(d?.order_item_id,p.patientRoleID,D);Q(Y=>{const le=J.data;return{...Y,...rn,...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 Pl(j,k,p.patientRoleID,Te.dayjs(v).format("YYYY-MM-DD"),W,Et[2],D);j.bill_item_details.lab_owner_name&&Nn(j.bill_item_details.lab_owner_name,p?.patientRoleID||"",D),J&&(l(Y=>Y.map((le,O)=>w==O.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()}})})]})},oa="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",ua=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:W,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={...Yl,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),O=async()=>{if(L?.order_item_id)try{const $=await wl(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(()=>{O()},[z.order_item_id]);const[me,je]=y.useState(!1),ye=($,ue)=>{J(M=>({...M,[$]:ue}))},Qe=async()=>{try{const $=await pn(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(()=>{Qe()},[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 Pl(z,d,c.patientRoleID,Te.dayjs(p).format("YYYY-MM-DD"),A,Et[0],S)&&k();else{const $=await Kl(z,!1,d,v,c,A,Y,!0,S);$&&(V(ue=>ue.map((M,Ae)=>W==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:oa,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()}})})]})},ca=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:W,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 wl(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 Pl(P,k,p?.patientRoleID||"",Te.dayjs(v).format("YYYY-MM-DD"),W,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:{}},da=Is.exports,zl;function fa(){return zl||(zl=1,function(n,d){(function(c,a){n.exports=a()})(da,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 W=S.diff;S.diff=function(D,N,P){if(D&&this.$u===D.$u)return W.call(this,D,N,P);var T=this.local(),j=A(D).local();return W.call(T,j,N,P)}}})}(Is)),Is.exports}var pa=fa();const Al=e.getDefaultExportFromCjs(pa),Dl=n=>{Te.dayjs.extend(Al);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:W,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 $l(d.order_id,D?.patientRoleID||"",Q),O=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,Qe=+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:Qe+pe,gstAmount:$,cgstAmount:($/2).toFixed(2),sgstAmount:($/2).toFixed(2),finalAmount:+d.net_bill_amount,receivedAmount:me,balanceAmount:ye,refundAmount:je},Ae=[W?.age&&typeof W.age=="number"?`${W.age}y`:W?.org_person_dob?pr(W.org_person_dob):"",W?.gender?Xr[W.gender]:"",W?.blood_group].filter(Boolean).join(", "),Fe={name:`${nr(W?.name??"")}${Ae?` (${Ae})`:""}`,billDate:Te.dayjs(d.order_date).format("DD-MMM-YYYY"),mobileNumber:W?.phone_number??"",email:W?.email??"",billNumber:d.order_id_str,patientId:W?.org_person_bid_str??"",patientIdForEmail:D?.patientRoleID??"",billStatus:ye===0?"PAID":"UNPAID",address:[W?.address,W?.city,W?.pincode].filter(Boolean).join(", "),referredBy:le?.lab_owner_name?nr(le.lab_owner_name):W?.ref_doc_name?nr(W.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:O,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(Nl,{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"})]})]})},Tl=({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(Nl,{rightSegment:c,showDeposit:!0,showPayment:!1,showDiscount:!1,showDepositRefund:!0,showRefund:!1,handleRightSegment:d,walletBalance:n,setRefreshWallet:a})})]}),ha=({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,W]=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),[O,me]=y.useState("-1"),[je,ye]=y.useState({bill_summary:{},status:!1,message:""}),[Qe,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 cn(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>+O&&+O>=0?[...B.slice(0,+O),{order_id:P[O].order_id,order_date:P[O].order_date,order_created_on:P[O].order_created_on,service_category:P[O].service_category,service_category_id:P[O].service_category_id,order_id_str:P[O].order_id_str,order_total:P[O].order_total,order_paid_amount:P[O].order_paid_amount,order_item_sum_discount:P[O].order_item_sum_discount,order_discount:P[O].order_discount,refund_amount:P[O].refund_amount,order_service_tax:P[O].order_service_tax,balance_amount:P[O].balance_amount,net_bill_amount:P[O].net_bill_amount,order_item_id:P[O].order_item_id,service_id:P[O]?.service_id,service_name:P[O].service_name,item_quantity:P[O].item_quantity,order_unit_item_price:P[O].order_unit_item_price,order_item_price:P[O].order_item_price,order_item_discount:P[O].order_item_discount,order_item_service_tax:""+Math.floor(P[O].order_item_service_tax),order_item_service_tax_percent:P[O].order_item_service_tax_percent,net_amount:P[O].net_amount,created_on:P[O].created_on},...B.slice(+O+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 vl(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 El(c.patientRoleID,S);ue(B?.wallet_balance||0)}catch(B){console.error("Failed to fetch wallet balance:",B)}};y.useEffect(()=>{nt()},[Qe]);const Oe=y.useCallback(async()=>{try{const B=await _l(Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,!1,S);H(B)}catch(B){console.error("Error in getPastDueAmount API Call:",B)}},[p,_l,c.patientRoleID]);y.useEffect(()=>{Oe()},[Oe]);const at=(B=ft[0])=>{W(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 Wn(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(na,{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(Wl,{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(Wl,{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(la,{})})]})}),e.jsxRuntimeExports.jsxs(Sl,{tab:"add_bills",children:[V===ft[0]&&e.jsxRuntimeExports.jsx(aa,{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(Dl,{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(ua,{bill_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[O],setTableData:le,editRowId:O,handleRevertEdit:He,refreshBillsList:pt,checkAppointmentForBilling:mt}),V===ft[4]&&e.jsxRuntimeExports.jsx(ca,{order_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[O],setTableData:le,editRowId:O,refreshBillsList:pt,handleRevertEdit:He}),V===ft[3]&&e.jsxRuntimeExports.jsx(ia,{order_date:p,handleRightSegment:at,editedTableData:Y?.[O],getBillSummarydata:Fe,setTableData:le,editRowId:O,refreshBillsList:pt,handleRevertEdit:He}),V===ft[7]&&e.jsxRuntimeExports.jsx(Tl,{depositAmount:$,handleRightSegment:at,rightSegment:V,setRefreshWallet:pe})]})]})},jl=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:gl.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}),W=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:W(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})})]})},ma=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:W,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",W?.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",W?.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()},[W?.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(jl,{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(jl,{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})})]})},xa=()=>{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"),[W,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(()=>({...Yl,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,W,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 O=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),O(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}))},Qe=()=>{V(B=>!B)},pe=()=>{le(B=>!B)},$=(B,De)=>{J(qe=>({...qe,[De]:B}))};y.useEffect(()=>{O(z)},[z.order_unit_item_price,z.item_quantity,z.order_item_discount,O,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 ${W===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(W=="today"?Te.dayjs().format("YYYY-MM-DD"):"all",v?.patientRoleID||"",1,W=="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,W,v?.patientRoleID,w,x]);y.useEffect(()=>{N||Nt()},[N,Nt]),y.useEffect(()=>{W==="today"&&Nt()},[Nt,W]);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 Kl(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")]}),W==="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:gl.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:gl.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:Qe,"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(jl,{today:!0,leftNav:W,appointments:ue(T),handleAppointData:je})})]})}),W==="all"&&e.jsxRuntimeExports.jsx(ma,{sortAppointments:ue,handleAddNewAppnt:xt,handleAppointData:je})]})},ga=({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()})]})})},va="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",ya=({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:W,isVisitLoading:D,totalRecord:N}=x,P=y.useCallback(async Y=>{if(l?.patientRoleID)try{L({isVisitLoading:!0});const le=await _n(sn,Y,l.patientRoleID,k),O=le?.visits??[];L({currentPage:Y,pastVisits:Y===1?O:[...V,...O],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,O=!0)=>{if(l?.patientRoleID){n(),L({isVisitLoading:!0});try{const je=(await gn(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:Qe="",doctor_role_id:pe=""}=je;k.window_var.doctor_role_id_for_seg!==pe?ye=await v({doc_id:Qe,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(O)}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 Gn(k),le={};Y.transalation_records.forEach(O=>{le[O.language]=O}),a(le)}catch(Y){console.error("Failed to get custom translations:",Y)}},[a,k]),Q=y.useCallback(async()=>{try{const Y=await Mn(k);if(Y?.test_ranges){const le=Y.test_ranges.map(O=>({test_id:O.test_id,test_names:O.test_names,test_range_rule:O.test_range_rule,test_range_text:O.test_range_text,test_units:O.test_units,value:O.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 Rn(k,l.patientRoleID),{status:O=0,case_id:me=0}=le,je=new Date().toISOString().slice(0,10);Y=O&&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(ga,{columns:H,data:z,columnWidth:I}),e.jsxRuntimeExports.jsx(Qr,{currentPage:W,totalRecord:N,handleLoadMore:()=>P(W+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:va,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"})]})]})},_a=({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"})]})})})),ba=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]})}),W=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 $l(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 ${W(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))})]})})},ja=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 ql(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("")})})]})},Ra="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",wa=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,W]=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),[O,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:Qe,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 _l(Te.dayjs().format("YYYY-MM-DD"),ye.patientRoleID,!1,pe);W(Oe)}catch(Oe){console.error("Error in getPastDueAmount API Call:",Oe)}},[]);y.useEffect(()=>{He()},[He]);const mt=async()=>{const Oe=await El(ye.patientRoleID,pe);le(Oe?.wallet_balance||0)},pt=async()=>{Qe(!0);try{Qe(!0);const Oe=await vl("all",ye.patientRoleID,1,10,pe);Oe&&(l(Oe),T(Oe?.bill_list)),Qe(!1)}catch{console.log("error in getBillsList API Call")}Qe(!1)},nt=async Oe=>{let at=Oe;if(Qe(!0),at<=Math.ceil(w.total_pages)){if(at=Oe+1,at!==Oe){const Pt=await vl("all",ye.patientRoleID,Oe,10,pe);if(Pt?.bill_list){const xt=[...P,...Pt.bill_list];T(xt)}}N(at)}Qe(!1)};return y.useEffect(()=>{pt()},[]),y.useEffect(()=>{mt()},[O]),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(ba,{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:Ra,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(Sl,{children:[A===ft[1]&&e.jsxRuntimeExports.jsx(Dl,{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(ja,{refundAmt:z,bills:w,billsListIndex:j,orderItemsIndex:I,handleRightSegment:ue,getBillsList:pt}),A===ft[7]&&e.jsxRuntimeExports.jsx(Tl,{depositAmount:Y,handleRightSegment:ue,rightSegment:A,setRefreshWallet:me})]})]})},Ca=({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})})),Ea=({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 Hn(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})]})]})},Pa=({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,W)=>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":W+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,W)},"data-qa":W+1+"-delete-transaction"})})]},`${W}`)},W)),S.show&&e.jsxRuntimeExports.jsx(Ca,{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(Ea,{reference:k,closeModalHandler:p,payment_id:S.payment_id,currentMode:S.mode,transactionType:S.payment_type,refreshPaymentData:A})})]})},Sa=({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,W)=>{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(W)}})};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:Jl(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))})},Na=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(Al);const L=async(T,j)=>{let Q="";T.payment_refund==="P"?Q="payment":T.payment_refund==="R"&&(Q="refund");try{const I=await An(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""}},W=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(Pa,{styles:P,data:d,handleDeleteRow:L,handleRightSegment:a,handleRowClick:v,getTypeColor:W,getType:V,refreshPaymentData:S}):e.jsxRuntimeExports.jsx(Sa,{styles:P,data:d,handleRowClick:v,closePrintModal:l,patient_entity_id:A})})]})})},Aa="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",Da=({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])})]})]})]}),Ta=n=>{Te.dayjs.extend(Al);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 W=[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)+(W?` (${W}) `:""),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:Jl(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"})]})]})},Ia=({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,W]=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 yl(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 bl(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($)},O=$=>{S($)},me=async $=>{if(k($),d===fr[jr.consultation_lab_other_services].key){if(O(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 bl(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.wallet_transactions]):(M=await yl(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.data]),L(Ae)}W(ue)}P(!1)},ye=async $=>{try{return await Cl($,T?.patientRoleID||"",["order_items"],j)}catch{console.log("Error in Loading Bill Details from Bill Id")}},Qe=y.useCallback(async()=>{const $=await El(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(()=>{Qe(),d==fr[jr.deposit_refund].key&&Y()},[d,Qe,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(Da,{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(Na,{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:Aa,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(Sl,{children:[w===ft[1]&&e.jsxRuntimeExports.jsx(Dl,{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(Tl,{depositAmount:Q,handleRightSegment:le,rightSegment:w,setRefreshWallet:z}),w===ft[8]&&e.jsxRuntimeExports.jsx(Ta,{summaryData:{...p,order_date:D?.order_date??""},handleRightSegment:le,closePrintModal:n,patient_entity_id:a?.entity_id||""})]})]})},Il=()=>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})}),Ql=({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()})]})})},Ba=n=>{const{visits:d=[],setPdfUrl:c,pdfUrl:a}=n,[v,w]=y.useState([]);return y.useEffect(()=>{w(Ga(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(Nl,{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:W})]}),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"})]})]})},ia=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:W,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(O=>({...O,bill_item_details:{...O.bill_item_details,...le}}))},H=async(J="")=>{try{const Y=await Sn(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 wl(d?.order_item_id,p.patientRoleID,D);Q(Y=>{const le=J.data;return{...Y,...rn,...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 Pl(j,k,p.patientRoleID,Te.dayjs(v).format("YYYY-MM-DD"),W,Et[2],D);j.bill_item_details.lab_owner_name&&Nn(j.bill_item_details.lab_owner_name,p?.patientRoleID||"",D),J&&(l(Y=>Y.map((le,O)=>w==O.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()}})})]})},oa="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",ua=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:W,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={...Yl,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),O=async()=>{if(L?.order_item_id)try{const $=await wl(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(()=>{O()},[z.order_item_id]);const[me,je]=y.useState(!1),ye=($,ue)=>{J(M=>({...M,[$]:ue}))},Qe=async()=>{try{const $=await pn(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(()=>{Qe()},[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 Pl(z,d,c.patientRoleID,Te.dayjs(p).format("YYYY-MM-DD"),A,Et[0],S)&&k();else{const $=await Kl(z,!1,d,v,c,A,Y,!0,S);$&&(V(ue=>ue.map((M,Ae)=>W==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:oa,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()}})})]})},ca=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:W,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 wl(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 Pl(P,k,p?.patientRoleID||"",Te.dayjs(v).format("YYYY-MM-DD"),W,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:{}},da=Is.exports,zl;function fa(){return zl||(zl=1,function(n,d){(function(c,a){n.exports=a()})(da,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 W=S.diff;S.diff=function(D,N,P){if(D&&this.$u===D.$u)return W.call(this,D,N,P);var T=this.local(),j=A(D).local();return W.call(T,j,N,P)}}})}(Is)),Is.exports}var pa=fa();const Al=e.getDefaultExportFromCjs(pa),Dl=n=>{Te.dayjs.extend(Al);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:W,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 $l(d.order_id,D?.patientRoleID||"",Q),O=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,Qe=+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:Qe+pe,gstAmount:$,cgstAmount:($/2).toFixed(2),sgstAmount:($/2).toFixed(2),finalAmount:+d.net_bill_amount,receivedAmount:me,balanceAmount:ye,refundAmount:je},Ae=[W?.age&&typeof W.age=="number"?`${W.age}y`:W?.org_person_dob?pr(W.org_person_dob):"",W?.gender?Xr[W.gender]:"",W?.blood_group].filter(Boolean).join(", "),Fe={name:`${nr(W?.name??"")}${Ae?` (${Ae})`:""}`,billDate:Te.dayjs(d.order_date).format("DD-MMM-YYYY"),mobileNumber:W?.phone_number??"",email:W?.email??"",billNumber:d.order_id_str,patientId:W?.org_person_bid_str??"",patientIdForEmail:D?.patientRoleID??"",billStatus:ye===0?"PAID":"UNPAID",address:[W?.address,W?.city,W?.pincode].filter(Boolean).join(", "),referredBy:le?.lab_owner_name?nr(le.lab_owner_name):W?.ref_doc_name?nr(W.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:O,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(Nl,{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"})]})]})},Tl=({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(Nl,{rightSegment:c,showDeposit:!0,showPayment:!1,showDiscount:!1,showDepositRefund:!0,showRefund:!1,handleRightSegment:d,walletBalance:n,setRefreshWallet:a})})]}),ha=({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,W]=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),[O,me]=y.useState("-1"),[je,ye]=y.useState({bill_summary:{},status:!1,message:""}),[Qe,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 cn(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>+O&&+O>=0?[...B.slice(0,+O),{order_id:P[O].order_id,order_date:P[O].order_date,order_created_on:P[O].order_created_on,service_category:P[O].service_category,service_category_id:P[O].service_category_id,order_id_str:P[O].order_id_str,order_total:P[O].order_total,order_paid_amount:P[O].order_paid_amount,order_item_sum_discount:P[O].order_item_sum_discount,order_discount:P[O].order_discount,refund_amount:P[O].refund_amount,order_service_tax:P[O].order_service_tax,balance_amount:P[O].balance_amount,net_bill_amount:P[O].net_bill_amount,order_item_id:P[O].order_item_id,service_id:P[O]?.service_id,service_name:P[O].service_name,item_quantity:P[O].item_quantity,order_unit_item_price:P[O].order_unit_item_price,order_item_price:P[O].order_item_price,order_item_discount:P[O].order_item_discount,order_item_service_tax:""+Math.floor(P[O].order_item_service_tax),order_item_service_tax_percent:P[O].order_item_service_tax_percent,net_amount:P[O].net_amount,created_on:P[O].created_on},...B.slice(+O+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 vl(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 El(c.patientRoleID,S);ue(B?.wallet_balance||0)}catch(B){console.error("Failed to fetch wallet balance:",B)}};y.useEffect(()=>{nt()},[Qe]);const Oe=y.useCallback(async()=>{try{const B=await _l(Te.dayjs(p).format("YYYY-MM-DD"),c.patientRoleID,!1,S);H(B)}catch(B){console.error("Error in getPastDueAmount API Call:",B)}},[p,_l,c.patientRoleID]);y.useEffect(()=>{Oe()},[Oe]);const at=(B=ft[0])=>{W(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 Wn(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:Nt("order_id",B)?.join("_")}},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(na,{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(Wl,{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(Wl,{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(la,{})})]})}),e.jsxRuntimeExports.jsxs(Sl,{tab:"add_bills",children:[V===ft[0]&&e.jsxRuntimeExports.jsx(aa,{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(Dl,{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(ua,{bill_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[O],setTableData:le,editRowId:O,handleRevertEdit:He,refreshBillsList:pt,checkAppointmentForBilling:mt}),V===ft[4]&&e.jsxRuntimeExports.jsx(ca,{order_date:p,handleRightSegment:at,getBillSummarydata:Fe,editedTableData:Y?.[O],setTableData:le,editRowId:O,refreshBillsList:pt,handleRevertEdit:He}),V===ft[3]&&e.jsxRuntimeExports.jsx(ia,{order_date:p,handleRightSegment:at,editedTableData:Y?.[O],getBillSummarydata:Fe,setTableData:le,editRowId:O,refreshBillsList:pt,handleRevertEdit:He}),V===ft[7]&&e.jsxRuntimeExports.jsx(Tl,{depositAmount:$,handleRightSegment:at,rightSegment:V,setRefreshWallet:pe})]})]})},jl=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:gl.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}),W=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:W(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})})]})},ma=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:W,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",W?.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",W?.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()},[W?.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(jl,{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(jl,{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})})]})},xa=()=>{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"),[W,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(()=>({...Yl,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,W,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 O=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),O(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}))},Qe=()=>{V(B=>!B)},pe=()=>{le(B=>!B)},$=(B,De)=>{J(qe=>({...qe,[De]:B}))};y.useEffect(()=>{O(z)},[z.order_unit_item_price,z.item_quantity,z.order_item_discount,O,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 ${W===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(W=="today"?Te.dayjs().format("YYYY-MM-DD"):"all",v?.patientRoleID||"",1,W=="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,W,v?.patientRoleID,w,x]);y.useEffect(()=>{N||Nt()},[N,Nt]),y.useEffect(()=>{W==="today"&&Nt()},[Nt,W]);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 Kl(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")]}),W==="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:gl.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:gl.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:Qe,"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(jl,{today:!0,leftNav:W,appointments:ue(T),handleAppointData:je})})]})}),W==="all"&&e.jsxRuntimeExports.jsx(ma,{sortAppointments:ue,handleAddNewAppnt:xt,handleAppointData:je})]})},ga=({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()})]})})},va="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",ya=({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:W,isVisitLoading:D,totalRecord:N}=x,P=y.useCallback(async Y=>{if(l?.patientRoleID)try{L({isVisitLoading:!0});const le=await _n(sn,Y,l.patientRoleID,k),O=le?.visits??[];L({currentPage:Y,pastVisits:Y===1?O:[...V,...O],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,O=!0)=>{if(l?.patientRoleID){n(),L({isVisitLoading:!0});try{const je=(await gn(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:Qe="",doctor_role_id:pe=""}=je;k.window_var.doctor_role_id_for_seg!==pe?ye=await v({doc_id:Qe,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(O)}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 Gn(k),le={};Y.transalation_records.forEach(O=>{le[O.language]=O}),a(le)}catch(Y){console.error("Failed to get custom translations:",Y)}},[a,k]),Q=y.useCallback(async()=>{try{const Y=await Mn(k);if(Y?.test_ranges){const le=Y.test_ranges.map(O=>({test_id:O.test_id,test_names:O.test_names,test_range_rule:O.test_range_rule,test_range_text:O.test_range_text,test_units:O.test_units,value:O.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 Rn(k,l.patientRoleID),{status:O=0,case_id:me=0}=le,je=new Date().toISOString().slice(0,10);Y=O&&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(ga,{columns:H,data:z,columnWidth:I}),e.jsxRuntimeExports.jsx(Qr,{currentPage:W,totalRecord:N,handleLoadMore:()=>P(W+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:va,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"})]})]})},_a=({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"})]})})})),ba=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]})}),W=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 $l(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 ${W(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))})]})})},ja=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 ql(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("")})})]})},Ra="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",wa=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,W]=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),[O,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:Qe,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 _l(Te.dayjs().format("YYYY-MM-DD"),ye.patientRoleID,!1,pe);W(Oe)}catch(Oe){console.error("Error in getPastDueAmount API Call:",Oe)}},[]);y.useEffect(()=>{He()},[He]);const mt=async()=>{const Oe=await El(ye.patientRoleID,pe);le(Oe?.wallet_balance||0)},pt=async()=>{Qe(!0);try{Qe(!0);const Oe=await vl("all",ye.patientRoleID,1,10,pe);Oe&&(l(Oe),T(Oe?.bill_list)),Qe(!1)}catch{console.log("error in getBillsList API Call")}Qe(!1)},nt=async Oe=>{let at=Oe;if(Qe(!0),at<=Math.ceil(w.total_pages)){if(at=Oe+1,at!==Oe){const Pt=await vl("all",ye.patientRoleID,Oe,10,pe);if(Pt?.bill_list){const xt=[...P,...Pt.bill_list];T(xt)}}N(at)}Qe(!1)};return y.useEffect(()=>{pt()},[]),y.useEffect(()=>{mt()},[O]),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(ba,{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:Ra,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(Sl,{children:[A===ft[1]&&e.jsxRuntimeExports.jsx(Dl,{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(ja,{refundAmt:z,bills:w,billsListIndex:j,orderItemsIndex:I,handleRightSegment:ue,getBillsList:pt}),A===ft[7]&&e.jsxRuntimeExports.jsx(Tl,{depositAmount:Y,handleRightSegment:ue,rightSegment:A,setRefreshWallet:me})]})]})},Ca=({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})})),Ea=({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 Hn(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})]})]})},Pa=({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,W)=>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":W+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,W)},"data-qa":W+1+"-delete-transaction"})})]},`${W}`)},W)),S.show&&e.jsxRuntimeExports.jsx(Ca,{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(Ea,{reference:k,closeModalHandler:p,payment_id:S.payment_id,currentMode:S.mode,transactionType:S.payment_type,refreshPaymentData:A})})]})},Sa=({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,W)=>{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(W)}})};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:Jl(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))})},Na=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(Al);const L=async(T,j)=>{let Q="";T.payment_refund==="P"?Q="payment":T.payment_refund==="R"&&(Q="refund");try{const I=await An(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""}},W=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(Pa,{styles:P,data:d,handleDeleteRow:L,handleRightSegment:a,handleRowClick:v,getTypeColor:W,getType:V,refreshPaymentData:S}):e.jsxRuntimeExports.jsx(Sa,{styles:P,data:d,handleRowClick:v,closePrintModal:l,patient_entity_id:A})})]})})},Aa="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",Da=({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])})]})]})]}),Ta=n=>{Te.dayjs.extend(Al);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 W=[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)+(W?` (${W}) `:""),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:Jl(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"})]})]})},Ia=({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,W]=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 yl(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 bl(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($)},O=$=>{S($)},me=async $=>{if(k($),d===fr[jr.consultation_lab_other_services].key){if(O(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 bl(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.wallet_transactions]):(M=await yl(T?.patientRoleID||"",ue,10,j),Ae=[...x,...M.data]),L(Ae)}W(ue)}P(!1)},ye=async $=>{try{return await Cl($,T?.patientRoleID||"",["order_items"],j)}catch{console.log("Error in Loading Bill Details from Bill Id")}},Qe=y.useCallback(async()=>{const $=await El(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(()=>{Qe(),d==fr[jr.deposit_refund].key&&Y()},[d,Qe,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(Da,{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(Na,{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:Aa,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(Sl,{children:[w===ft[1]&&e.jsxRuntimeExports.jsx(Dl,{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(Tl,{depositAmount:Q,handleRightSegment:le,rightSegment:w,setRefreshWallet:z}),w===ft[8]&&e.jsxRuntimeExports.jsx(Ta,{summaryData:{...p,order_date:D?.order_date??""},handleRightSegment:le,closePrintModal:n,patient_entity_id:a?.entity_id||""})]})]})},Il=()=>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})}),Ql=({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()})]})})},Ba=n=>{const{visits:d=[],setPdfUrl:c,pdfUrl:a}=n,[v,w]=y.useState([]);return y.useEffect(()=>{w(Ga(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
|
|
@@ -10269,7 +10269,7 @@ const Ja = /* @__PURE__ */ vn(Ws), Qa = (n) => {
|
|
|
10269
10269
|
isWholeBill: G.length === 3,
|
|
10270
10270
|
payloadDataforEmail: {
|
|
10271
10271
|
orderDate: G.length === 3 ? Te(h).format("YYYY-MM-DD") : "",
|
|
10272
|
-
orderNumber:
|
|
10272
|
+
orderNumber: Bt("order_id", G)?.join("_")
|
|
10273
10273
|
}
|
|
10274
10274
|
},
|
|
10275
10275
|
trackEventHandler: (_t) => {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as r } from "./PediatricsCalculatorTable-CXALqwAy.js";
|
|
2
|
-
import { P as e } from "./PatientPopupContainer-
|
|
2
|
+
import { P as e } from "./PatientPopupContainer-DvWxsoA-.js";
|
|
3
3
|
import { A as i } from "./Attachments-KDvUuiBM.js";
|
|
4
4
|
import { P } from "./PatientAddEdit-B7fjeZlX.js";
|
|
5
5
|
import { S as m } from "./SearchPatients-D1PQUJ9C.js";
|