@kenyaemr/esm-billing-app 5.4.2-pre.2841 → 5.4.2-pre.2850

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.2841"}
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.2850"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.4.2-pre.2841",
3
+ "version": "5.4.2-pre.2850",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "keywords": [
6
6
  "openmrs"
@@ -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>
@@ -1,54 +1,252 @@
1
1
  @use '@carbon/layout';
2
2
  @use '@carbon/type';
3
3
  @use '@carbon/colors';
4
- .container {
4
+
5
+ .invoiceContainer {
5
6
  padding: layout.$spacing-05;
7
+ background-color: colors.$white;
8
+ max-width: 1000px;
9
+ margin: 0 auto;
6
10
  }
7
11
 
8
- .section {
9
- margin-top: layout.$spacing-06;
10
- background-color: colors.$white;
11
- padding: layout.$spacing-05;
12
+ .invoiceHeader {
13
+ display: flex;
14
+ justify-content: space-between;
15
+ align-items: flex-start;
16
+ padding-bottom: layout.$spacing-05;
17
+ border-bottom: 2px solid colors.$gray-20;
12
18
  margin-bottom: layout.$spacing-06;
13
19
  }
14
20
 
15
- .grid {
21
+ .invoiceTitle {
22
+ display: flex;
23
+ align-items: center;
24
+ gap: layout.$spacing-04;
25
+
26
+ h3 {
27
+ @include type.type-style('heading-03');
28
+ font-weight: 600;
29
+ color: colors.$gray-100;
30
+ margin: 0;
31
+ letter-spacing: 0.5px;
32
+ }
33
+ }
34
+
35
+ .claimNumber {
36
+ display: flex;
37
+ flex-direction: column;
38
+ align-items: flex-end;
39
+ gap: layout.$spacing-02;
40
+ }
41
+
42
+ .claimNumberLabel {
43
+ @include type.type-style('label-01');
44
+ color: colors.$gray-70;
45
+ text-transform: uppercase;
46
+ font-weight: 600;
47
+ }
48
+
49
+ .claimNumberValue {
50
+ @include type.type-style('heading-compact-02');
51
+ color: colors.$blue-60;
52
+ font-weight: 600;
53
+ }
54
+
55
+ .infoGrid {
16
56
  display: grid;
17
57
  grid-template-columns: repeat(2, 1fr);
58
+ gap: layout.$spacing-06;
59
+ margin-bottom: layout.$spacing-06;
60
+ }
61
+
62
+ .infoBlock {
63
+ padding: layout.$spacing-04;
64
+ border-radius: 4px;
65
+ }
66
+
67
+ .blockTitle {
68
+ @include type.type-style('label-02');
69
+ color: colors.$gray-100;
70
+ text-transform: uppercase;
71
+ margin: 0 0 layout.$spacing-04 0;
72
+ letter-spacing: 0.5px;
73
+ font-weight: 600;
74
+ }
75
+
76
+ .infoContent {
77
+ display: flex;
78
+ flex-direction: column;
79
+ gap: layout.$spacing-02;
80
+ }
81
+
82
+ .primaryInfo {
83
+ @include type.type-style('body-short-02');
84
+ font-weight: 600;
85
+ color: colors.$gray-70;
86
+ margin: 0;
87
+ padding-bottom: layout.$spacing-02;
88
+ }
89
+
90
+ .secondaryInfo {
91
+ @include type.type-style('body-short-01');
92
+ color: colors.$gray-70;
93
+ margin: 0;
94
+ padding-bottom: layout.$spacing-02;
95
+ }
96
+
97
+ .visitSection {
98
+ margin-bottom: layout.$spacing-06;
99
+ }
100
+
101
+ .sectionTitle {
102
+ @include type.type-style('label-02');
103
+ font-weight: 600;
104
+ color: colors.$gray-70;
105
+ text-transform: uppercase;
106
+ margin: 0 0 layout.$spacing-04 0;
107
+ padding-bottom: layout.$spacing-03;
108
+ border-bottom: 1px solid colors.$gray-20;
109
+ letter-spacing: 0.5px;
110
+ }
111
+
112
+ .visitGrid {
113
+ display: grid;
114
+ grid-template-columns: repeat(3, 1fr);
18
115
  gap: layout.$spacing-05;
19
- margin-bottom: layout.$spacing-05;
116
+ margin-top: layout.$spacing-04;
20
117
  }
21
118
 
22
- .field {
119
+ .visitField {
23
120
  display: flex;
24
121
  flex-direction: column;
25
122
  gap: layout.$spacing-02;
26
123
  }
27
124
 
28
- .label {
125
+ .visitLabel {
29
126
  @include type.type-style('label-01');
127
+ color: colors.$gray-70;
30
128
  font-weight: 600;
31
- text-transform: uppercase;
32
129
  }
33
130
 
34
- .value {
131
+ .visitValue {
35
132
  @include type.type-style('body-short-01');
133
+ color: colors.$gray-100;
134
+ }
135
+
136
+ .diagnosesSection {
137
+ margin-bottom: layout.$spacing-06;
138
+ }
139
+
140
+ .diagnosesList {
141
+ list-style: none;
142
+ padding: 0;
143
+ margin: layout.$spacing-04 0 0 0;
36
144
  }
37
145
 
38
- .totalContainer {
146
+ .diagnosisItem {
147
+ @include type.type-style('body-short-01');
148
+ padding: layout.$spacing-03;
149
+ margin-bottom: layout.$spacing-02;
150
+ color: colors.$gray-100;
151
+ }
152
+
153
+ .lineItemsSection {
154
+ margin-bottom: layout.$spacing-06;
155
+
156
+ :global(.cds--data-table) {
157
+ margin-top: layout.$spacing-04;
158
+ }
159
+
160
+ :global(.cds--table-header-label) {
161
+ @include type.type-style('label-01');
162
+ font-weight: 600;
163
+ text-transform: uppercase;
164
+ }
165
+
166
+ :global(.cds--data-table td) {
167
+ @include type.type-style('body-short-01');
168
+ }
169
+ }
170
+
171
+ .noItems {
172
+ @include type.type-style('body-short-01');
173
+ color: colors.$gray-70;
174
+ font-style: italic;
175
+ margin-top: layout.$spacing-04;
176
+ text-align: center;
177
+ padding: layout.$spacing-05;
178
+ background-color: colors.$gray-10;
179
+ border-radius: 4px;
180
+ }
181
+
182
+ .financialSummary {
183
+ margin-top: layout.$spacing-06;
184
+ padding: layout.$spacing-05;
185
+ background-color: colors.$gray-10;
186
+ border-radius: 4px;
187
+ border: 1px solid colors.$gray-20;
188
+ }
189
+
190
+ .summaryRow {
39
191
  display: flex;
40
192
  justify-content: space-between;
41
- padding: layout.$spacing-05;
42
- border-radius: layout.$spacing-02;
193
+ align-items: center;
194
+ padding: layout.$spacing-03 0;
195
+ border-bottom: 1px solid colors.$gray-20;
196
+ }
197
+
198
+ .summaryLabel {
199
+ @include type.type-style('body-short-01');
200
+ color: colors.$gray-70;
201
+ }
202
+
203
+ .summaryValue {
204
+ @include type.type-style('body-short-01');
205
+ font-weight: 600;
206
+ color: colors.$gray-100;
207
+ }
208
+
209
+ .totalRow {
210
+ display: flex;
211
+ justify-content: space-between;
212
+ align-items: center;
213
+ padding-top: layout.$spacing-04;
43
214
  margin-top: layout.$spacing-03;
215
+ border-top: 2px solid colors.$gray-70;
44
216
  }
45
217
 
46
218
  .totalLabel {
47
- @include type.type-style('body-short-01');
219
+ @include type.type-style('heading-compact-01');
48
220
  font-weight: 600;
221
+ color: colors.$gray-100;
222
+ text-transform: uppercase;
49
223
  }
50
224
 
51
225
  .totalValue {
52
- @include type.type-style('heading-compact-01');
226
+ @include type.type-style('heading-03');
227
+ font-weight: 700;
228
+ color: colors.$blue-60;
229
+ }
230
+
231
+ .billReference {
232
+ margin-top: layout.$spacing-05;
233
+ padding: layout.$spacing-03;
234
+ background-color: colors.$blue-10;
235
+ border-radius: 4px;
236
+ border-left: 3px solid colors.$blue-60;
237
+ display: flex;
238
+ align-items: center;
239
+ gap: layout.$spacing-02;
240
+ }
241
+
242
+ .referenceLabel {
243
+ @include type.type-style('label-01');
244
+ font-weight: 600;
245
+ color: colors.$gray-70;
246
+ }
247
+
248
+ .referenceValue {
249
+ @include type.type-style('code-01');
250
+ color: colors.$blue-60;
53
251
  font-weight: 600;
54
252
  }