@kenyaemr/esm-billing-app 5.4.2-pre.2843 → 5.4.2-pre.2852

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"order-action-button","component":"orderActionButton","slots":["prescription-action-button-slot","imaging-orders-action","procedure-orders-action","tests-ordered-actions-slot"],"order":0},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"patient-info-sha-status","component":"patientBannerShaStatus","slot":"patient-banner-tags-slot"},{"name":"payments-points-dashboard-link","component":"paymentPointDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"cashier-points","title":"Payment Point","slot":"payment-point-dashboard-slot"}},{"name":"payment-points-dashboard","component":"paymentPoints","slot":"payment-point-dashboard-slot"},{"name":"payment-mode-dashboard-link","component":"paymentModeLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-modes","title":"Payment Mode","slot":"payment-mode-dashboard-slot"}},{"name":"payment-mode-dashboard","component":"paymentModeDashboard","slot":"payment-mode-dashboard-slot"},{"name":"bill-deposit-dashboard-link","component":"billDepositDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"bill-deposit","title":"Bill Deposit","slot":"billing-deposit-dashboard-slot"}},{"name":"bill-deposit-dashboard","component":"billDepositDashboard","slot":"billing-deposit-dashboard-slot"},{"name":"billable-exemptions-dashboard-link","component":"billableExemptionsLink","slot":"billing-admin-dashboard-slot","meta":{"name":"billable-exemptions","title":"Billable Exemptions","slot":"billing-exemptions-dashboard-slot"}},{"name":"billable-exemptions-dashboard","component":"billableExemptions","slot":"billing-exemptions-dashboard-slot"},{"name":"clinical-charges-dashboard-link","component":"clinicalChargesLink","slot":"billing-admin-dashboard-slot","meta":{"name":"clinical-charges","title":"Clinical Charges","slot":"clinical-charges-dashboard-slot"}},{"name":"clinical-charges-dashboard","component":"clinicalCharges","slot":"clinical-charges-dashboard-slot"},{"name":"payment-history-dashboard-link","component":"paymentHistoryLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-history","title":"Payment History","slot":"payment-history-dashboard-slot"}},{"name":"payment-history-dashboard","component":"paymentHistoryDashboard","slot":"payment-history-dashboard-slot"},{"name":"patient-billing-dashboard-link","component":"patientBillingLink","slot":"billing-admin-dashboard-slot","meta":{"name":"patient-billing","title":"Patient Billing","slot":"patient-billing-dashboard-slot"}},{"name":"patient-billing-dashboard","component":"patientBilling","slot":"patient-billing-dashboard-slot"}],"workspaces":[{"name":"create-bill-workspace","component":"createBillWorkspace","title":"Create Bill Workspace","type":"other-form"},{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"commodityForm","title":"Charge Commodity Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"},{"name":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","type":"other-form"},{"name":"payment-workspace","component":"paymentWorkspace","title":"Payment Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"claim-summary-modal","component":"claimSummaryModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"},{"name":"delete-deposit-modal","component":"deleteDepositModal"},{"name":"reverse-transaction-modal","component":"reverseTransactionModal"},{"name":"print-preview-modal","component":"printPreviewModal"},{"name":"bill-action-modal","component":"billActionModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"version":"5.4.2-pre.2843"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"order-action-button","component":"orderActionButton","slots":["prescription-action-button-slot","imaging-orders-action","procedure-orders-action","tests-ordered-actions-slot"],"order":0},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"patient-info-sha-status","component":"patientBannerShaStatus","slot":"patient-banner-tags-slot"},{"name":"payments-points-dashboard-link","component":"paymentPointDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"cashier-points","title":"Payment Point","slot":"payment-point-dashboard-slot"}},{"name":"payment-points-dashboard","component":"paymentPoints","slot":"payment-point-dashboard-slot"},{"name":"payment-mode-dashboard-link","component":"paymentModeLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-modes","title":"Payment Mode","slot":"payment-mode-dashboard-slot"}},{"name":"payment-mode-dashboard","component":"paymentModeDashboard","slot":"payment-mode-dashboard-slot"},{"name":"bill-deposit-dashboard-link","component":"billDepositDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"bill-deposit","title":"Bill Deposit","slot":"billing-deposit-dashboard-slot"}},{"name":"bill-deposit-dashboard","component":"billDepositDashboard","slot":"billing-deposit-dashboard-slot"},{"name":"billable-exemptions-dashboard-link","component":"billableExemptionsLink","slot":"billing-admin-dashboard-slot","meta":{"name":"billable-exemptions","title":"Billable Exemptions","slot":"billing-exemptions-dashboard-slot"}},{"name":"billable-exemptions-dashboard","component":"billableExemptions","slot":"billing-exemptions-dashboard-slot"},{"name":"clinical-charges-dashboard-link","component":"clinicalChargesLink","slot":"billing-admin-dashboard-slot","meta":{"name":"clinical-charges","title":"Clinical Charges","slot":"clinical-charges-dashboard-slot"}},{"name":"clinical-charges-dashboard","component":"clinicalCharges","slot":"clinical-charges-dashboard-slot"},{"name":"payment-history-dashboard-link","component":"paymentHistoryLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-history","title":"Payment History","slot":"payment-history-dashboard-slot"}},{"name":"payment-history-dashboard","component":"paymentHistoryDashboard","slot":"payment-history-dashboard-slot"},{"name":"patient-billing-dashboard-link","component":"patientBillingLink","slot":"billing-admin-dashboard-slot","meta":{"name":"patient-billing","title":"Patient Billing","slot":"patient-billing-dashboard-slot"}},{"name":"patient-billing-dashboard","component":"patientBilling","slot":"patient-billing-dashboard-slot"}],"workspaces":[{"name":"create-bill-workspace","component":"createBillWorkspace","title":"Create Bill Workspace","type":"other-form"},{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"commodityForm","title":"Charge Commodity Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"},{"name":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","type":"other-form"},{"name":"payment-workspace","component":"paymentWorkspace","title":"Payment Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"claim-summary-modal","component":"claimSummaryModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"},{"name":"delete-deposit-modal","component":"deleteDepositModal"},{"name":"reverse-transaction-modal","component":"reverseTransactionModal"},{"name":"print-preview-modal","component":"printPreviewModal"},{"name":"bill-action-modal","component":"billActionModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"version":"5.4.2-pre.2852"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.4.2-pre.2843",
3
+ "version": "5.4.2-pre.2852",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "keywords": [
6
6
  "openmrs"
@@ -7,13 +7,13 @@ import { checkPaymentMethodExclusion, usePatientBills } from '../../../prompt-pa
7
7
 
8
8
  export const useTestOrderBillStatus = (orderUuid: string, patientUuid: string) => {
9
9
  const config = useConfig<BillingConfig>();
10
- const { currentVisit } = useVisit(patientUuid);
10
+ const { currentVisit, activeVisit } = useVisit(patientUuid);
11
11
  const { isEmergencyPatient, isLoading: isLoadingQueue } = usePatientQueue(patientUuid);
12
12
  const { isLoading, hasPendingPayment } = useOrderPendingPaymentStatus(patientUuid, orderUuid);
13
13
 
14
14
  // We want to check if the payment method is in the excluded list this includes insurances, where patient do not need to pay immediately
15
15
  const isExcludedPaymentMethod = checkPaymentMethodExclusion(
16
- currentVisit,
16
+ activeVisit,
17
17
  config?.paymentMethodsUuidsThatShouldNotShowPrompt,
18
18
  );
19
19
 
@@ -1,13 +1,38 @@
1
- import { Button, ModalBody, ModalFooter, ModalHeader, Tag } from '@carbon/react';
1
+ import {
2
+ Button,
3
+ ModalBody,
4
+ ModalFooter,
5
+ ModalHeader,
6
+ DataTable,
7
+ Table,
8
+ TableHead,
9
+ TableRow,
10
+ TableHeader,
11
+ TableBody,
12
+ TableCell,
13
+ } from '@carbon/react';
2
14
  import { formatDate, parseDate } from '@openmrs/esm-framework';
3
15
  import React from 'react';
4
16
  import { useTranslation } from 'react-i18next';
5
17
  import { FacilityClaim } from '../../../../types';
6
18
  import { useFacilityClaims } from '../use-facility-claims';
7
- import { statusColors } from '../../../utils';
8
- import { CardHeader } from '@openmrs/esm-patient-common-lib';
9
19
  import styles from './claim-summary.scss';
10
20
  import upperCase from 'lodash-es/upperCase';
21
+ import Capitalize from 'lodash-es/capitalize';
22
+ import { useCurrencyFormatting } from '../../../../helpers/currency';
23
+
24
+ type ProvidedItem = {
25
+ uuid: string;
26
+ originUuid: string;
27
+ price: number;
28
+ dateOfServed: string | null;
29
+ status: string;
30
+ numberOfConsumptions: number;
31
+ item: {
32
+ uuid: string;
33
+ display: string;
34
+ };
35
+ };
11
36
 
12
37
  type ExtendedClaim = FacilityClaim & {
13
38
  id: string;
@@ -25,18 +50,43 @@ type ExtendedClaim = FacilityClaim & {
25
50
  birthdate: string;
26
51
  };
27
52
  };
53
+ visit?: {
54
+ uuid: string;
55
+ display: string;
56
+ startDatetime: string;
57
+ stopDatetime: string;
58
+ encounters: Array<{
59
+ diagnoses: Array<{
60
+ uuid: string;
61
+ diagnosis: {
62
+ coded?: {
63
+ display: string;
64
+ name?: {
65
+ display: string;
66
+ };
67
+ };
68
+ display?: string;
69
+ };
70
+ }>;
71
+ }>;
72
+ };
73
+ bill: {
74
+ uuid: string;
75
+ providedItems?: Array<ProvidedItem>;
76
+ };
28
77
  };
29
78
 
30
79
  export const ClaimSummaryModal = ({ closeModal, claimId }: { closeModal: () => void; claimId: string }) => {
31
80
  const { t } = useTranslation();
32
81
  const { claims } = useFacilityClaims();
82
+ const { format: formatCurrency } = useCurrencyFormatting();
33
83
 
34
84
  const claim = claims.find((claim) => claim.id === claimId) as ExtendedClaim | undefined;
35
85
 
36
86
  if (!claim) {
37
87
  return (
38
88
  <React.Fragment>
39
- <ModalHeader closeModal={closeModal}>{t('claimSummary', 'Claim Summary')}</ModalHeader>
89
+ <ModalHeader closeModal={closeModal}>{t('claimInvoice', 'Claim Invoice')}</ModalHeader>
40
90
  <ModalBody>
41
91
  <p>{t('claimNotFound', 'Claim not found')}</p>
42
92
  </ModalBody>
@@ -49,96 +99,177 @@ export const ClaimSummaryModal = ({ closeModal, claimId }: { closeModal: () => v
49
99
  );
50
100
  }
51
101
 
102
+ const diagnoses =
103
+ claim.visit?.encounters?.flatMap((encounter) => {
104
+ if (!encounter.diagnoses || encounter.diagnoses.length === 0) {
105
+ return [];
106
+ }
107
+
108
+ return encounter.diagnoses
109
+ .map((d) => {
110
+ let displayName = '';
111
+
112
+ if (d.diagnosis?.coded?.display) {
113
+ displayName = d.diagnosis.coded.display;
114
+ } else if (d.diagnosis?.coded?.name?.display) {
115
+ displayName = d.diagnosis.coded.name.display;
116
+ } else if (d.diagnosis?.display) {
117
+ displayName = d.diagnosis.display;
118
+ } else if (typeof d.diagnosis === 'string') {
119
+ displayName = d.diagnosis;
120
+ }
121
+
122
+ return {
123
+ uuid: d.uuid,
124
+ display: displayName,
125
+ };
126
+ })
127
+ .filter((d) => d.display);
128
+ }) || [];
129
+
130
+ const lineItemsHeaders = [
131
+ { key: 'item', header: t('item', 'Item') },
132
+ { key: 'quantity', header: t('quantity', 'Quantity') },
133
+ { key: 'unitPrice', header: t('unitPrice', 'Unit Price') },
134
+ { key: 'total', header: t('total', 'Total') },
135
+ ];
136
+
137
+ const providedItems = claim.bill?.providedItems || [];
138
+
139
+ const lineItemsRows =
140
+ providedItems.length > 0
141
+ ? providedItems.map((item, index) => ({
142
+ id: `${index}`,
143
+ item: item.item?.display || '-',
144
+ quantity: item.numberOfConsumptions || 1,
145
+ unitPrice: formatCurrency(item.price || 0),
146
+ total: formatCurrency((item.price || 0) * (item.numberOfConsumptions || 1)),
147
+ }))
148
+ : [];
149
+
150
+ const calculatedTotal = providedItems.reduce((sum, item) => {
151
+ return sum + (item.price || 0) * (item.numberOfConsumptions || 1);
152
+ }, 0);
153
+
154
+ const displayTotal = calculatedTotal > 0 ? calculatedTotal : claim.claimedTotal || 0;
155
+
52
156
  return (
53
157
  <React.Fragment>
54
- <ModalHeader closeModal={closeModal}>{t('claimSummary', 'Claim Summary')}</ModalHeader>
55
158
  <ModalBody>
56
- <div className={styles.container}>
57
- <CardHeader title={t('patientInformation', 'Patient Information')}>
58
- <div />
59
- </CardHeader>
60
- <div className={styles.section}>
61
- <div className={styles.grid}>
62
- <div className={styles.field}>
63
- <span className={styles.label}>{t('patientName', 'Patient Name')}</span>
64
- <span className={styles.value}>{upperCase(claim.patient?.person?.display) || '-'}</span>
65
- </div>
66
- <div className={styles.field}>
67
- <span className={styles.label}>{t('gender', 'Gender')}</span>
68
- <span className={styles.value}>{claim.patient?.person?.gender || '-'}</span>
69
- </div>
70
- <div className={styles.field}>
71
- <span className={styles.label}>{t('age', 'Age')}</span>
72
- <span className={styles.value}>
73
- {claim.patient?.person?.age ? `${claim.patient.person.age} years` : '-'}
74
- </span>
75
- </div>
76
- <div className={styles.field}>
77
- <span className={styles.label}>{t('birthdate', 'Birthdate')}</span>
78
- <span className={styles.value}>
159
+ <div className={styles.invoiceContainer}>
160
+ <div className={styles.invoiceHeader}>
161
+ <div className={styles.invoiceTitle}>
162
+ <h3>{t('claimSummary', 'CLAIM SUMMARY')}</h3>
163
+ </div>
164
+ <div className={styles.claimNumber}>
165
+ <span className={styles.claimNumberLabel}>{t('claimNo', 'Claim No.')}</span>
166
+ <span className={styles.claimNumberValue}>{claim.claimCode || 'N/A'}</span>
167
+ </div>
168
+ </div>
169
+
170
+ <div className={styles.infoGrid}>
171
+ <div className={styles.infoBlock}>
172
+ <h4 className={styles.blockTitle}>{t('billTo', 'BILL TO')}</h4>
173
+ <div className={styles.infoContent}>
174
+ <p className={styles.primaryInfo}>
175
+ {upperCase(claim.patient?.person?.display || claim.patientName) || '-'}
176
+ </p>
177
+ <p className={styles.secondaryInfo}>
178
+ {claim.patient?.person?.gender} • {claim.patient?.person?.age} years
179
+ </p>
180
+ <p className={styles.secondaryInfo}>
181
+ {t('dob', 'DOB')}:{' '}
79
182
  {claim.patient?.person?.birthdate
80
183
  ? formatDate(parseDate(claim.patient.person.birthdate), { time: false, noToday: true })
81
184
  : '-'}
82
- </span>
185
+ </p>
186
+ </div>
187
+ </div>
188
+
189
+ <div className={styles.infoBlock}>
190
+ <h4 className={styles.blockTitle}>{t('provider', 'PROVIDER')}</h4>
191
+ <div className={styles.infoContent}>
192
+ <p className={styles.primaryInfo}>{claim.providerName || '-'}</p>
83
193
  </div>
84
194
  </div>
85
195
  </div>
86
196
 
87
- <CardHeader title={t('claimInformation', 'Claim Information')}>
88
- <div />
89
- </CardHeader>
90
- <div className={styles.section}>
91
- <div className={styles.grid}>
92
- <div className={styles.field}>
93
- <span className={styles.label}>{t('claimNumber', 'Claim Number')}</span>
94
- <span className={styles.value}>{t('CO-01878', 'CO-01878')}</span>
197
+ <div className={styles.visitSection}>
198
+ <h4 className={styles.sectionTitle}>{t('visitInformation', 'VISIT INFORMATION')}</h4>
199
+ <div className={styles.visitGrid}>
200
+ <div className={styles.visitField}>
201
+ <span className={styles.visitLabel}>{t('visitType', 'Visit Type')}</span>
202
+ <div className={styles.visitValueContainer}>
203
+ <span className={styles.visitValue}>{claim.visitType?.display || claim.use || '-'}</span>
204
+ </div>
95
205
  </div>
96
- <div className={styles.field}>
97
- <span className={styles.label}>{t('dateFrom', 'Date From')}</span>
98
- <span className={styles.value}>
206
+ <div className={styles.visitField}>
207
+ <span className={styles.visitLabel}>{t('dateFrom', 'Service From')}</span>
208
+ <span className={styles.visitValue}>
99
209
  {claim.dateFrom ? formatDate(parseDate(claim.dateFrom), { time: false, noToday: true }) : '-'}
100
210
  </span>
101
211
  </div>
102
- <div className={styles.field}>
103
- <span className={styles.label}>{t('dateTo', 'Date To')}</span>
104
- <span className={styles.value}>
212
+ <div className={styles.visitField}>
213
+ <span className={styles.visitLabel}>{t('dateTo', 'Service To')}</span>
214
+ <span className={styles.visitValue}>
105
215
  {claim.dateTo ? formatDate(parseDate(claim.dateTo), { time: false, noToday: true }) : '-'}
106
216
  </span>
107
217
  </div>
108
- <div className={styles.field}>
109
- <span className={styles.label}>{t('visitType', 'Visit Type')}</span>
110
- <span className={styles.value}>{claim.visitType?.display || claim.use || '-'}</span>
111
- </div>
112
218
  </div>
113
219
  </div>
114
220
 
115
- <CardHeader title={t('providerInformation', 'Provider Information')}>
116
- <div />
117
- </CardHeader>
118
- <div className={styles.section}>
119
- <div className={styles.grid}>
120
- <div className={styles.field}>
121
- <span className={styles.label}>{t('providerName', 'Provider Name')}</span>
122
- <span className={styles.value}>{claim.providerName || '-'}</span>
123
- </div>
221
+ {diagnoses.length > 0 && (
222
+ <div className={styles.diagnosesSection}>
223
+ <h4 className={styles.sectionTitle}>{t('diagnoses', 'DIAGNOSES')}</h4>
224
+ <ul className={styles.diagnosesList}>
225
+ {diagnoses.map((diagnosis) => (
226
+ <li key={diagnosis.uuid} className={styles.diagnosisItem}>
227
+ {Capitalize(diagnosis.display)}
228
+ </li>
229
+ ))}
230
+ </ul>
124
231
  </div>
232
+ )}
233
+
234
+ <div className={styles.lineItemsSection}>
235
+ <h4 className={styles.sectionTitle}>{t('servicesProvided', 'SERVICES PROVIDED')}</h4>
236
+ {providedItems.length === 0 ? (
237
+ <p className={styles.noItems}>{t('noLineItems', 'No line items available')}</p>
238
+ ) : lineItemsRows.length > 0 ? (
239
+ <DataTable rows={lineItemsRows} headers={lineItemsHeaders}>
240
+ {({ rows, headers, getTableProps, getHeaderProps, getRowProps }) => (
241
+ <Table {...getTableProps()} size="md" useZebraStyles={false}>
242
+ <TableHead>
243
+ <TableRow>
244
+ {headers.map((header) => (
245
+ <TableHeader {...getHeaderProps({ header })} key={header.key}>
246
+ {header.header}
247
+ </TableHeader>
248
+ ))}
249
+ </TableRow>
250
+ </TableHead>
251
+ <TableBody>
252
+ {rows.map((row) => (
253
+ <TableRow {...getRowProps({ row })} key={row.id}>
254
+ {row.cells.map((cell) => (
255
+ <TableCell key={cell.id}>{cell.value}</TableCell>
256
+ ))}
257
+ </TableRow>
258
+ ))}
259
+ </TableBody>
260
+ </Table>
261
+ )}
262
+ </DataTable>
263
+ ) : (
264
+ <p className={styles.noItems}>{t('noLineItems', 'No line items available')}</p>
265
+ )}
125
266
  </div>
126
267
 
127
- <CardHeader title={t('financialSummary', 'Financial Summary')}>
128
- <div />
129
- </CardHeader>
130
- <div className={styles.section}>
131
- <div className={styles.totalContainer}>
132
- <span className={styles.totalLabel}>{t('claimedAmount', 'Claimed Amount')}</span>
133
- <span className={styles.totalValue}>
134
- {claim.claimedTotal ? `KES ${claim.claimedTotal.toLocaleString()}` : 'KES 0'}
135
- </span>
136
- </div>
137
- <div className={styles.totalContainer}>
138
- <span className={styles.totalLabel}>{t('approvedAmount', 'Approved Amount')}</span>
139
- <span className={styles.totalValue}>
140
- {claim.approvedTotal ? `KES ${claim.approvedTotal.toLocaleString()}` : 'KES 0'}
141
- </span>
268
+ <div className={styles.financialSummary}>
269
+ <h4 className={styles.sectionTitle}>{t('total', 'TOTAL')}</h4>
270
+ <div className={styles.summaryRow}>
271
+ <span className={styles.summaryLabel}>{t('claimedAmount', 'Claimed Amount')}</span>
272
+ <span className={styles.summaryValue}>{formatCurrency(displayTotal)}</span>
142
273
  </div>
143
274
  </div>
144
275
  </div>