@openmrs/esm-billing-app 1.0.2-pre.966 → 1.0.2-pre.972
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/4300.js +1 -1
- package/dist/8572.js +1 -1
- package/dist/8572.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-billing-app.js.buildmanifest.json +9 -9
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/invoice/printable-invoice/printable-invoice-header.component.tsx +9 -1
- package/src/invoice/printable-invoice/printable-invoice-header.test.tsx +79 -2
- package/src/invoice/printable-invoice/printable-invoice.component.tsx +2 -2
- package/src/types/index.ts +1 -1
- package/translations/en.json +2 -0
|
@@ -550,9 +550,9 @@
|
|
|
550
550
|
"initial": false,
|
|
551
551
|
"entry": false,
|
|
552
552
|
"recorded": false,
|
|
553
|
-
"size":
|
|
553
|
+
"size": 9169,
|
|
554
554
|
"sizes": {
|
|
555
|
-
"javascript":
|
|
555
|
+
"javascript": 9169
|
|
556
556
|
},
|
|
557
557
|
"names": [],
|
|
558
558
|
"idHints": [],
|
|
@@ -564,7 +564,7 @@
|
|
|
564
564
|
"4300.js"
|
|
565
565
|
],
|
|
566
566
|
"auxiliaryFiles": [],
|
|
567
|
-
"hash": "
|
|
567
|
+
"hash": "f5588eb92c4c964e",
|
|
568
568
|
"childrenByOrder": {}
|
|
569
569
|
},
|
|
570
570
|
{
|
|
@@ -1187,9 +1187,9 @@
|
|
|
1187
1187
|
"initial": false,
|
|
1188
1188
|
"entry": false,
|
|
1189
1189
|
"recorded": false,
|
|
1190
|
-
"size":
|
|
1190
|
+
"size": 1109850,
|
|
1191
1191
|
"sizes": {
|
|
1192
|
-
"javascript":
|
|
1192
|
+
"javascript": 1109808,
|
|
1193
1193
|
"consume-shared": 42
|
|
1194
1194
|
},
|
|
1195
1195
|
"names": [],
|
|
@@ -1203,7 +1203,7 @@
|
|
|
1203
1203
|
"auxiliaryFiles": [
|
|
1204
1204
|
"8572.js.map"
|
|
1205
1205
|
],
|
|
1206
|
-
"hash": "
|
|
1206
|
+
"hash": "fe713f2233a8ced0",
|
|
1207
1207
|
"childrenByOrder": {}
|
|
1208
1208
|
},
|
|
1209
1209
|
{
|
|
@@ -1260,10 +1260,10 @@
|
|
|
1260
1260
|
"initial": true,
|
|
1261
1261
|
"entry": true,
|
|
1262
1262
|
"recorded": false,
|
|
1263
|
-
"size":
|
|
1263
|
+
"size": 5391472,
|
|
1264
1264
|
"sizes": {
|
|
1265
1265
|
"consume-shared": 210,
|
|
1266
|
-
"javascript":
|
|
1266
|
+
"javascript": 5368820,
|
|
1267
1267
|
"share-init": 336,
|
|
1268
1268
|
"runtime": 22106
|
|
1269
1269
|
},
|
|
@@ -1280,7 +1280,7 @@
|
|
|
1280
1280
|
"auxiliaryFiles": [
|
|
1281
1281
|
"main.js.map"
|
|
1282
1282
|
],
|
|
1283
|
-
"hash": "
|
|
1283
|
+
"hash": "2a54fba878e10781",
|
|
1284
1284
|
"childrenByOrder": {}
|
|
1285
1285
|
},
|
|
1286
1286
|
{
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.24.0","fhir2":">=1.2"},"pages":[{"component":"billableServicesHome","route":"billable-services"}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing history"}},{"name":"billable-services-app-menu-item","component":"billableServicesAppMenuItem","slot":"app-menu-item-slot","meta":{"name":"Billable Services"}},{"name":"billing-checkin-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"slot":"system-admin-page-card-link-slot","component":"billableServicesCardLink","name":"billable-services-admin-card-link"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"billable-services-left-panel-link","component":"billableServicesLeftPanelLink","slot":"billable-services-left-panel-slot","order":0},{"name":"bill-waiver-left-panel-link","component":"billWaiverLeftPanelLink","slot":"billable-services-left-panel-slot","order":1},{"name":"billing-settings-left-panel-menu","component":"billingSettingsLeftPanelMenu","slot":"billable-services-left-panel-slot","order":2}],"modals":[{"name":"add-cash-point-modal","component":"addCashPointModal"},{"name":"payment-mode-form-modal","component":"paymentModeFormModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"edit-bill-item-modal","component":"editBillLineItemModal"},{"name":"edit-bill-line-item-modal","component":"editBillLineItemModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"workspaces":[{"name":"billing-form-workspace","title":"billingForm","component":"billingFormWorkspace","type":"form"},{"name":"billable-service-form","title":"billableServiceForm","component":"billableServiceFormWorkspace","type":"form","width":"wider"}],"version":"1.0.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.24.0","fhir2":">=1.2"},"pages":[{"component":"billableServicesHome","route":"billable-services"}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing history"}},{"name":"billable-services-app-menu-item","component":"billableServicesAppMenuItem","slot":"app-menu-item-slot","meta":{"name":"Billable Services"}},{"name":"billing-checkin-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"slot":"system-admin-page-card-link-slot","component":"billableServicesCardLink","name":"billable-services-admin-card-link"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"billable-services-left-panel-link","component":"billableServicesLeftPanelLink","slot":"billable-services-left-panel-slot","order":0},{"name":"bill-waiver-left-panel-link","component":"billWaiverLeftPanelLink","slot":"billable-services-left-panel-slot","order":1},{"name":"billing-settings-left-panel-menu","component":"billingSettingsLeftPanelMenu","slot":"billable-services-left-panel-slot","order":2}],"modals":[{"name":"add-cash-point-modal","component":"addCashPointModal"},{"name":"payment-mode-form-modal","component":"paymentModeFormModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"edit-bill-item-modal","component":"editBillLineItemModal"},{"name":"edit-bill-line-item-modal","component":"editBillLineItemModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"workspaces":[{"name":"billing-form-workspace","title":"billingForm","component":"billingFormWorkspace","type":"form"},{"name":"billable-service-form","title":"billableServiceForm","component":"billableServiceFormWorkspace","type":"form","width":"wider"}],"version":"1.0.2-pre.972"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PatientDetails } from '../../types';
|
|
3
|
-
import { type SessionLocation, useConfig, interpolateUrl } from '@openmrs/esm-framework';
|
|
3
|
+
import { type SessionLocation, useConfig, interpolateUrl, formatDate, parseDate } from '@openmrs/esm-framework';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import type { BillingConfig } from '../../config-schema';
|
|
6
6
|
import styles from './printable-invoice-header.scss';
|
|
@@ -45,6 +45,14 @@ const PrintableInvoiceHeader: React.FC<PrintableInvoiceHeaderProps> = ({ patient
|
|
|
45
45
|
<div className={styles.billDetails}>
|
|
46
46
|
<p className={styles.itemHeading}>{t('billedTo', 'Billed to')}</p>
|
|
47
47
|
<p className={styles.itemLabel}>{patientDetails?.name}</p>
|
|
48
|
+
{patientDetails?.gender && (
|
|
49
|
+
<p className={styles.itemLabel}>{`${t('gender', 'Gender')}: ${patientDetails.gender}`}</p>
|
|
50
|
+
)}
|
|
51
|
+
{patientDetails?.birthDate && (
|
|
52
|
+
<p className={styles.itemLabel}>
|
|
53
|
+
{`${t('birthDate', 'Date of birth')}: ${formatDate(parseDate(patientDetails.birthDate), { time: false })}`}
|
|
54
|
+
</p>
|
|
55
|
+
)}
|
|
48
56
|
<p className={styles.itemLabel}>{patientDetails?.county}</p>
|
|
49
57
|
<p className={styles.itemLabel}>
|
|
50
58
|
{patientDetails?.subCounty}
|
|
@@ -18,7 +18,7 @@ const testProps = {
|
|
|
18
18
|
county: 'Nairobi',
|
|
19
19
|
subCounty: 'Westlands',
|
|
20
20
|
city: 'Nairobi',
|
|
21
|
-
|
|
21
|
+
birthDate: '1980-05-15',
|
|
22
22
|
gender: 'Male',
|
|
23
23
|
},
|
|
24
24
|
};
|
|
@@ -44,6 +44,8 @@ describe('PrintableInvoiceHeader', () => {
|
|
|
44
44
|
expect(screen.getByText('Westlands, Nairobi')).toBeInTheDocument();
|
|
45
45
|
expect(screen.getByText('MTRH')).toBeInTheDocument();
|
|
46
46
|
expect(screen.getByText('Kenya')).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText('Gender: Male')).toBeInTheDocument();
|
|
48
|
+
expect(screen.getByText('Date of birth: 15-May-1980')).toBeInTheDocument();
|
|
47
49
|
});
|
|
48
50
|
|
|
49
51
|
test('should display the logo when logo is provided', () => {
|
|
@@ -52,9 +54,84 @@ describe('PrintableInvoiceHeader', () => {
|
|
|
52
54
|
expect(logo).toBeInTheDocument();
|
|
53
55
|
});
|
|
54
56
|
|
|
55
|
-
test('should display the default logo when logo is not provided', () => {
|
|
57
|
+
test('should display the default OpenMRS SVG logo when logo src is not provided', () => {
|
|
58
|
+
mockUseConfig.mockReturnValue({
|
|
59
|
+
logo: { src: '', alt: '' },
|
|
60
|
+
country: 'Kenya',
|
|
61
|
+
} as unknown as BillingConfig);
|
|
62
|
+
|
|
56
63
|
render(<PrintableInvoiceHeader {...testProps} defaultFacility={defaultFacility} />);
|
|
57
64
|
const logo = screen.getByRole('img');
|
|
58
65
|
expect(logo).toBeInTheDocument();
|
|
66
|
+
expect(logo.tagName).toBe('svg');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('should display logo alt text when src is empty but alt is provided', () => {
|
|
70
|
+
mockUseConfig.mockReturnValue({
|
|
71
|
+
logo: { src: '', alt: 'Test Facility Logo' },
|
|
72
|
+
country: 'Kenya',
|
|
73
|
+
} as unknown as BillingConfig);
|
|
74
|
+
|
|
75
|
+
render(<PrintableInvoiceHeader {...testProps} defaultFacility={defaultFacility} />);
|
|
76
|
+
expect(screen.getByText('Test Facility Logo')).toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('should format birthDate correctly', () => {
|
|
80
|
+
const propsWithDifferentDate = {
|
|
81
|
+
patientDetails: {
|
|
82
|
+
name: 'Jane Doe',
|
|
83
|
+
county: 'Mombasa',
|
|
84
|
+
subCounty: 'Nyali',
|
|
85
|
+
city: 'Mombasa',
|
|
86
|
+
birthDate: '1995-12-25',
|
|
87
|
+
gender: 'Female',
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
render(<PrintableInvoiceHeader {...propsWithDifferentDate} defaultFacility={defaultFacility} />);
|
|
91
|
+
expect(screen.getByText('Date of birth: 25-Dec-1995')).toBeInTheDocument();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('should not render birthDate and gender when not provided', () => {
|
|
95
|
+
const propsWithoutBirthDateAndGender = {
|
|
96
|
+
patientDetails: {
|
|
97
|
+
name: 'Jane Doe',
|
|
98
|
+
county: 'Mombasa',
|
|
99
|
+
subCounty: 'Nyali',
|
|
100
|
+
city: 'Mombasa',
|
|
101
|
+
birthDate: '',
|
|
102
|
+
gender: '',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
render(<PrintableInvoiceHeader {...propsWithoutBirthDateAndGender} defaultFacility={defaultFacility} />);
|
|
106
|
+
|
|
107
|
+
expect(screen.queryByText(/Date of birth:/i)).not.toBeInTheDocument();
|
|
108
|
+
expect(screen.queryByText(/Gender:/i)).not.toBeInTheDocument();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test('should render city with comma when provided', () => {
|
|
112
|
+
render(<PrintableInvoiceHeader {...testProps} defaultFacility={defaultFacility} />);
|
|
113
|
+
expect(screen.getByText('Westlands, Nairobi')).toBeInTheDocument();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('should render subCounty without comma when city is not provided', () => {
|
|
117
|
+
const propsWithoutCity = {
|
|
118
|
+
patientDetails: {
|
|
119
|
+
name: 'Jane Doe',
|
|
120
|
+
county: 'Mombasa',
|
|
121
|
+
subCounty: 'Nyali',
|
|
122
|
+
city: '',
|
|
123
|
+
birthDate: '1990-01-01',
|
|
124
|
+
gender: 'Female',
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
render(<PrintableInvoiceHeader {...propsWithoutCity} defaultFacility={defaultFacility} />);
|
|
128
|
+
expect(screen.getByText('Nyali')).toBeInTheDocument();
|
|
129
|
+
expect(screen.queryByText(/Nyali,/)).not.toBeInTheDocument();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('should handle null defaultFacility gracefully', () => {
|
|
133
|
+
render(<PrintableInvoiceHeader {...testProps} defaultFacility={null} />);
|
|
134
|
+
expect(screen.getByText('Invoice')).toBeInTheDocument();
|
|
135
|
+
expect(screen.getByText('John Doe')).toBeInTheDocument();
|
|
59
136
|
});
|
|
60
137
|
});
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
TableHeader,
|
|
10
10
|
TableCell,
|
|
11
11
|
} from '@carbon/react';
|
|
12
|
-
import {
|
|
12
|
+
import { isDesktop, type SessionLocation, useLayoutType } from '@openmrs/esm-framework';
|
|
13
13
|
import { getGender } from '../../helpers';
|
|
14
14
|
import { type MappedBill } from '../../types';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
@@ -56,7 +56,7 @@ const PrintableInvoice: React.FC<PrintableInvoiceProps> = ({ bill, patient, comp
|
|
|
56
56
|
const patientDetails = useMemo(() => {
|
|
57
57
|
return {
|
|
58
58
|
name: `${patient?.name?.[0]?.given?.join(' ')} ${patient?.name?.[0].family}`,
|
|
59
|
-
|
|
59
|
+
birthDate: patient?.birthDate,
|
|
60
60
|
gender: getGender(patient?.gender, t),
|
|
61
61
|
city: patient?.address?.[0].city,
|
|
62
62
|
county: patient?.address?.[0].district,
|
package/src/types/index.ts
CHANGED
package/translations/en.json
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"billWaiver": "Bill waiver",
|
|
56
56
|
"billWaiverError": "Bill waiver failed {{error}}",
|
|
57
57
|
"billWaiverSuccess": "Bill waiver successful",
|
|
58
|
+
"birthDate": "Date of birth",
|
|
58
59
|
"cashPointConfig": "Cash point configuration",
|
|
59
60
|
"cashPointHistory": "Cash point history",
|
|
60
61
|
"cashPointLocation": "Cash point location",
|
|
@@ -100,6 +101,7 @@
|
|
|
100
101
|
"errorSavingPaymentMode": "An error occurred while saving the payment mode.",
|
|
101
102
|
"filterBy": "Filter by:",
|
|
102
103
|
"filterTable": "Filter table",
|
|
104
|
+
"gender": "Gender",
|
|
103
105
|
"grandTotal": "Grand total",
|
|
104
106
|
"home": "Home",
|
|
105
107
|
"identifier": "Identifier",
|