| 1 | {"ast":null,"code":"import apiClient from './api';\nconst ENDPOINT = '/billing';\nexport const billingService = {\n getAllBillings: () => apiClient.get(ENDPOINT),\n getBillingById: id => apiClient.get(`${ENDPOINT}/${id}`),\n getBillingHistoryForPatient: patientId => apiClient.get(`${ENDPOINT}/patient/${patientId}`),\n getBillingDetail: id => apiClient.get(`${ENDPOINT}/${id}/detail`),\n generateBillingRecord: billing => apiClient.post(ENDPOINT, billing),\n updatePaymentStatus: (id, paymentData) => apiClient.patch(`${ENDPOINT}/${id}/payment-status`, paymentData),\n downloadInvoicePDF: async billId => {\n try {\n const response = await apiClient.get(`${ENDPOINT}/${billId}/invoice-pdf`, {\n responseType: 'blob'\n });\n // Create a blob URL and download\n const url = window.URL.createObjectURL(new Blob([response.data]));\n const link = document.createElement('a');\n link.href = url;\n link.setAttribute('download', `invoice-${billId}.pdf`);\n document.body.appendChild(link);\n link.click();\n link.parentNode.removeChild(link);\n window.URL.revokeObjectURL(url);\n } catch (error) {\n throw error;\n }\n }\n};","map":{"version":3,"names":["apiClient","ENDPOINT","billingService","getAllBillings","get","getBillingById","id","getBillingHistoryForPatient","patientId","getBillingDetail","generateBillingRecord","billing","post","updatePaymentStatus","paymentData","patch","downloadInvoicePDF","billId","response","responseType","url","window","URL","createObjectURL","Blob","data","link","document","createElement","href","setAttribute","body","appendChild","click","parentNode","removeChild","revokeObjectURL","error"],"sources":["C:/Users/User/Downloads/medora5/frontend/src/services/billingService.js"],"sourcesContent":["import apiClient from './api';\n\nconst ENDPOINT = '/billing';\n\nexport const billingService = {\n getAllBillings: () => apiClient.get(ENDPOINT),\n\n getBillingById: (id) => apiClient.get(`${ENDPOINT}/${id}`),\n\n getBillingHistoryForPatient: (patientId) => apiClient.get(`${ENDPOINT}/patient/${patientId}`),\n\n getBillingDetail: (id) => apiClient.get(`${ENDPOINT}/${id}/detail`),\n\n generateBillingRecord: (billing) => apiClient.post(ENDPOINT, billing),\n\n updatePaymentStatus: (id, paymentData) => apiClient.patch(`${ENDPOINT}/${id}/payment-status`, paymentData),\n\n downloadInvoicePDF: async (billId) => {\n try {\n const response = await apiClient.get(`${ENDPOINT}/${billId}/invoice-pdf`, {\n responseType: 'blob'\n });\n // Create a blob URL and download\n const url = window.URL.createObjectURL(new Blob([response.data]));\n const link = document.createElement('a');\n link.href = url;\n link.setAttribute('download', `invoice-${billId}.pdf`);\n document.body.appendChild(link);\n link.click();\n link.parentNode.removeChild(link);\n window.URL.revokeObjectURL(url);\n } catch (error) {\n throw error;\n }\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,OAAO;AAE7B,MAAMC,QAAQ,GAAG,UAAU;AAE3B,OAAO,MAAMC,cAAc,GAAG;EAC5BC,cAAc,EAAEA,CAAA,KAAMH,SAAS,CAACI,GAAG,CAACH,QAAQ,CAAC;EAE7CI,cAAc,EAAGC,EAAE,IAAKN,SAAS,CAACI,GAAG,CAAC,GAAGH,QAAQ,IAAIK,EAAE,EAAE,CAAC;EAE1DC,2BAA2B,EAAGC,SAAS,IAAKR,SAAS,CAACI,GAAG,CAAC,GAAGH,QAAQ,YAAYO,SAAS,EAAE,CAAC;EAE7FC,gBAAgB,EAAGH,EAAE,IAAKN,SAAS,CAACI,GAAG,CAAC,GAAGH,QAAQ,IAAIK,EAAE,SAAS,CAAC;EAEnEI,qBAAqB,EAAGC,OAAO,IAAKX,SAAS,CAACY,IAAI,CAACX,QAAQ,EAAEU,OAAO,CAAC;EAErEE,mBAAmB,EAAEA,CAACP,EAAE,EAAEQ,WAAW,KAAKd,SAAS,CAACe,KAAK,CAAC,GAAGd,QAAQ,IAAIK,EAAE,iBAAiB,EAAEQ,WAAW,CAAC;EAE1GE,kBAAkB,EAAE,MAAOC,MAAM,IAAK;IACpC,IAAI;MACF,MAAMC,QAAQ,GAAG,MAAMlB,SAAS,CAACI,GAAG,CAAC,GAAGH,QAAQ,IAAIgB,MAAM,cAAc,EAAE;QACxEE,YAAY,EAAE;MAChB,CAAC,CAAC;MACF;MACA,MAA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