@openmrs/esm-billing-app 1.0.2-pre.112 → 1.0.2-pre.1124
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/.eslintrc +16 -2
- package/README.md +54 -9
- package/__mocks__/bills.mock.ts +12 -0
- package/__mocks__/react-i18next.js +6 -5
- package/dist/1119.js +1 -1
- package/dist/1146.js +1 -2
- package/dist/1146.js.map +1 -1
- package/dist/1197.js +1 -1
- package/dist/1537.js +1 -0
- package/dist/1537.js.map +1 -0
- package/dist/1856.js +1 -0
- package/dist/1856.js.map +1 -0
- package/dist/2146.js +1 -1
- package/dist/2177.js +1 -1
- package/dist/2177.js.map +1 -1
- package/dist/2524.js +1 -0
- package/dist/2524.js.map +1 -0
- package/dist/2690.js +1 -1
- package/dist/3099.js +1 -1
- package/dist/3584.js +1 -1
- package/dist/3717.js +2 -0
- package/dist/3717.js.map +1 -0
- package/dist/4055.js +1 -1
- package/dist/4132.js +1 -1
- package/dist/4300.js +1 -1
- package/dist/4335.js +1 -1
- package/dist/439.js +1 -0
- package/dist/4618.js +1 -1
- package/dist/4652.js +1 -1
- package/dist/4724.js +1 -0
- package/dist/4724.js.map +1 -0
- package/dist/4739.js +1 -1
- package/dist/4739.js.map +1 -1
- package/dist/4944.js +1 -1
- package/dist/5173.js +1 -1
- package/dist/5241.js +1 -1
- package/dist/5442.js +1 -1
- package/dist/5661.js +1 -1
- package/dist/6022.js +1 -1
- package/dist/6468.js +1 -1
- package/dist/6540.js +1 -1
- package/dist/6540.js.map +1 -1
- package/dist/6589.js +1 -0
- package/dist/6679.js +1 -1
- package/dist/6840.js +1 -1
- package/dist/6859.js +1 -1
- package/dist/7097.js +1 -1
- package/dist/7159.js +1 -1
- package/dist/723.js +1 -1
- package/dist/7255.js +1 -1
- package/dist/7255.js.map +1 -1
- package/dist/7617.js +1 -1
- package/dist/795.js +1 -1
- package/dist/8163.js +1 -1
- package/dist/8349.js +1 -1
- package/dist/8371.js +1 -0
- package/dist/8572.js +1 -0
- package/dist/8572.js.map +1 -0
- package/dist/8618.js +1 -1
- package/dist/8708.js +2 -0
- package/dist/{6557.js.LICENSE.txt → 8708.js.LICENSE.txt} +22 -0
- package/dist/8708.js.map +1 -0
- package/dist/890.js +1 -1
- package/dist/9214.js +1 -1
- package/dist/9538.js +1 -1
- package/dist/9569.js +1 -1
- package/dist/961.js +1 -1
- package/dist/961.js.map +1 -1
- package/dist/986.js +1 -1
- package/dist/9879.js +1 -1
- package/dist/9895.js +1 -1
- package/dist/9900.js +1 -1
- package/dist/9913.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-billing-app.js +1 -1
- package/dist/openmrs-esm-billing-app.js.buildmanifest.json +321 -249
- package/dist/openmrs-esm-billing-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/e2e/README.md +19 -18
- package/e2e/commands/billing-operations.ts +96 -0
- package/e2e/commands/index.ts +3 -0
- package/e2e/commands/patient-operations.ts +82 -0
- package/e2e/commands/types.ts +73 -0
- package/e2e/core/test.ts +12 -1
- package/e2e/fixtures/api.ts +2 -3
- package/e2e/pages/billing-dashboard-page.ts +84 -0
- package/e2e/pages/billing-form-page.ts +114 -0
- package/e2e/pages/index.ts +4 -1
- package/e2e/pages/invoice-page.ts +113 -0
- package/e2e/pages/payment-page.ts +104 -0
- package/e2e/specs/billing-dashboard.spec.ts +203 -0
- package/e2e/specs/billing-patient-chart.spec.ts +738 -0
- package/e2e/support/github/Dockerfile +1 -1
- package/e2e/support/github/run-e2e-docker-env.sh +29 -32
- package/example.env +15 -1
- package/package.json +19 -16
- package/playwright.config.ts +4 -2
- package/src/bill-history/bill-history.component.tsx +15 -17
- package/src/bill-history/bill-history.scss +4 -94
- package/src/bill-history/bill-history.test.tsx +37 -77
- package/src/bill-item-actions/bill-item-actions.scss +21 -5
- package/src/bill-item-actions/edit-bill-item.modal.tsx +227 -0
- package/src/bill-item-actions/edit-bill-item.test.tsx +233 -40
- package/src/billable-services/bill-waiver/bill-selection.component.tsx +5 -5
- package/src/billable-services/bill-waiver/bill-waiver-form.component.tsx +37 -39
- package/src/billable-services/bill-waiver/patient-bills.component.tsx +7 -7
- package/src/billable-services/bill-waiver/utils.ts +13 -3
- package/src/billable-services/{create-edit/add-billable-service.scss → billable-service-form/billable-service-form.scss} +32 -64
- package/src/billable-services/billable-service-form/billable-service-form.test.tsx +1099 -0
- package/src/billable-services/billable-service-form/billable-service-form.workspace.tsx +516 -0
- package/src/billable-services/billable-service.resource.ts +71 -27
- package/src/billable-services/billable-services-home.component.tsx +13 -42
- package/src/billable-services/billable-services-left-panel-link.component.tsx +50 -0
- package/src/billable-services/billable-services-left-panel-menu.component.tsx +48 -0
- package/src/billable-services/billable-services-menu-item/item.component.tsx +5 -4
- package/src/billable-services/billable-services.component.tsx +156 -152
- package/src/billable-services/billable-services.scss +29 -0
- package/src/billable-services/billable-services.test.tsx +6 -49
- package/src/billable-services/cash-point/add-cash-point.modal.tsx +170 -0
- package/src/billable-services/cash-point/cash-point-configuration.component.tsx +19 -193
- package/src/billable-services/cash-point/cash-point-configuration.scss +1 -5
- package/src/billable-services/dashboard/dashboard.component.tsx +0 -2
- package/src/billable-services/payment-modes/delete-payment-mode.modal.tsx +77 -0
- package/src/billable-services/payment-modes/payment-mode-form.modal.tsx +131 -0
- package/src/billable-services/payment-modes/payment-modes-config.component.tsx +139 -0
- package/src/billable-services/{payyment-modes → payment-modes}/payment-modes-config.scss +5 -4
- package/src/billable-services-admin-card-link.component.test.tsx +2 -2
- package/src/billable-services-admin-card-link.component.tsx +1 -1
- package/src/billing-dashboard/billing-dashboard.scss +1 -1
- package/src/billing-form/billing-checkin-form.component.tsx +29 -29
- package/src/billing-form/billing-checkin-form.scss +0 -7
- package/src/billing-form/billing-checkin-form.test.tsx +100 -27
- package/src/billing-form/billing-form.component.tsx +226 -284
- package/src/billing-form/billing-form.scss +143 -0
- package/src/billing-form/visit-attributes/visit-attributes-form.component.tsx +47 -41
- package/src/billing-form/visit-attributes/visit-attributes-form.scss +16 -3
- package/src/billing.resource.test.ts +503 -0
- package/src/billing.resource.ts +68 -76
- package/src/bills-table/bills-table.component.tsx +17 -24
- package/src/bills-table/bills-table.test.tsx +98 -54
- package/src/config-schema.ts +84 -31
- package/src/dashboard.meta.ts +5 -3
- package/src/helpers/functions.ts +5 -4
- package/src/index.ts +75 -13
- package/src/invoice/invoice-table.component.tsx +36 -70
- package/src/invoice/invoice-table.scss +8 -5
- package/src/invoice/invoice-table.test.tsx +273 -62
- package/src/invoice/invoice.component.tsx +44 -38
- package/src/invoice/invoice.scss +11 -4
- package/src/invoice/invoice.test.tsx +324 -120
- package/src/invoice/payments/invoice-breakdown/invoice-breakdown.scss +9 -9
- package/src/invoice/payments/payment-form/payment-form.component.tsx +45 -36
- package/src/invoice/payments/payment-form/payment-form.scss +5 -6
- package/src/invoice/payments/payment-form/payment-form.test.tsx +217 -67
- package/src/invoice/payments/payment-history/payment-history.component.tsx +6 -4
- package/src/invoice/payments/payment-history/payment-history.test.tsx +9 -14
- package/src/invoice/payments/payments.component.tsx +56 -68
- package/src/invoice/payments/payments.scss +4 -3
- package/src/invoice/payments/payments.test.tsx +282 -0
- package/src/invoice/payments/utils.ts +15 -27
- package/src/invoice/printable-invoice/print-receipt.component.tsx +3 -3
- package/src/invoice/printable-invoice/print-receipt.test.tsx +14 -25
- package/src/invoice/printable-invoice/printable-footer.component.tsx +2 -2
- package/src/invoice/printable-invoice/printable-footer.test.tsx +4 -13
- package/src/invoice/printable-invoice/printable-invoice-header.component.tsx +20 -11
- package/src/invoice/printable-invoice/printable-invoice-header.test.tsx +95 -16
- package/src/invoice/printable-invoice/printable-invoice.component.tsx +21 -35
- package/src/left-panel-link.component.tsx +9 -8
- package/src/left-panel-link.test.tsx +1 -4
- package/src/metrics-cards/metrics-cards.component.tsx +16 -6
- package/src/metrics-cards/metrics-cards.scss +4 -0
- package/src/metrics-cards/metrics-cards.test.tsx +18 -5
- package/src/modal/require-payment-modal.test.tsx +27 -22
- package/src/modal/{require-payment-modal.component.tsx → require-payment.modal.tsx} +18 -19
- package/src/routes.json +44 -20
- package/src/types/index.ts +87 -24
- package/translations/am.json +140 -80
- package/translations/ar.json +141 -81
- package/translations/ar_SY.json +141 -81
- package/translations/bn.json +143 -83
- package/translations/cs.json +230 -0
- package/translations/de.json +141 -81
- package/translations/en.json +142 -81
- package/translations/en_US.json +141 -81
- package/translations/es.json +140 -80
- package/translations/es_MX.json +141 -81
- package/translations/fr.json +224 -164
- package/translations/he.json +140 -80
- package/translations/hi.json +141 -81
- package/translations/hi_IN.json +141 -81
- package/translations/id.json +141 -81
- package/translations/it.json +166 -106
- package/translations/ka.json +141 -81
- package/translations/km.json +140 -80
- package/translations/ku.json +141 -81
- package/translations/ky.json +141 -81
- package/translations/lg.json +141 -81
- package/translations/ne.json +141 -81
- package/translations/pl.json +141 -81
- package/translations/pt.json +141 -81
- package/translations/pt_BR.json +141 -81
- package/translations/qu.json +141 -81
- package/translations/ro_RO.json +225 -165
- package/translations/ru_RU.json +141 -81
- package/translations/si.json +141 -81
- package/translations/sq.json +230 -0
- package/translations/sw.json +141 -81
- package/translations/sw_KE.json +141 -81
- package/translations/tr.json +141 -81
- package/translations/tr_TR.json +141 -81
- package/translations/uk.json +141 -81
- package/translations/uz.json +141 -81
- package/translations/uz@Latn.json +141 -81
- package/translations/uz_UZ.json +141 -81
- package/translations/vi.json +141 -81
- package/translations/zh.json +141 -81
- package/translations/zh_CN.json +171 -111
- package/translations/zh_TW.json +230 -0
- package/dist/1146.js.LICENSE.txt +0 -21
- package/dist/2352.js +0 -1
- package/dist/2352.js.map +0 -1
- package/dist/246.js +0 -1
- package/dist/246.js.map +0 -1
- package/dist/4689.js +0 -2
- package/dist/4689.js.map +0 -1
- package/dist/6557.js +0 -2
- package/dist/6557.js.map +0 -1
- package/dist/8638.js +0 -1
- package/dist/8638.js.map +0 -1
- package/dist/9968.js +0 -1
- package/dist/9968.js.map +0 -1
- package/e2e/pages/home-page.ts +0 -9
- package/e2e/specs/sample-test.spec.ts +0 -11
- package/src/bill-item-actions/edit-bill-item.component.tsx +0 -221
- package/src/billable-services/create-edit/add-billable-service.component.tsx +0 -401
- package/src/billable-services/create-edit/add-billable-service.test.tsx +0 -154
- package/src/billable-services/dashboard/service-metrics.component.tsx +0 -41
- package/src/billable-services/payyment-modes/payment-modes-config.component.tsx +0 -280
- package/src/invoice/payments/payments.component.test.tsx +0 -121
- /package/dist/{4689.js.LICENSE.txt → 3717.js.LICENSE.txt} +0 -0
|
@@ -4,15 +4,15 @@ import { Printer } from '@carbon/react/icons';
|
|
|
4
4
|
import { useParams } from 'react-router-dom';
|
|
5
5
|
import { useReactToPrint } from 'react-to-print';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { ExtensionSlot, useConfig, usePatient } from '@openmrs/esm-framework';
|
|
8
|
-
import { ErrorState } from '@openmrs/esm-patient-common-lib';
|
|
9
|
-
import { convertToCurrency } from '../helpers';
|
|
10
|
-
import { type LineItem } from '../types';
|
|
11
|
-
import { useBill } from '../billing.resource';
|
|
7
|
+
import { ExtensionSlot, showSnackbar, useConfig, usePatient } from '@openmrs/esm-framework';
|
|
12
8
|
import InvoiceTable from './invoice-table.component';
|
|
13
9
|
import Payments from './payments/payments.component';
|
|
14
10
|
import PrintReceipt from './printable-invoice/print-receipt.component';
|
|
15
11
|
import PrintableInvoice from './printable-invoice/printable-invoice.component';
|
|
12
|
+
import { ErrorState } from '@openmrs/esm-patient-common-lib';
|
|
13
|
+
import { convertToCurrency } from '../helpers';
|
|
14
|
+
import { useBill, useDefaultFacility } from '../billing.resource';
|
|
15
|
+
import type { BillingConfig } from '../config-schema';
|
|
16
16
|
import styles from './invoice.scss';
|
|
17
17
|
|
|
18
18
|
interface InvoiceDetailsProps {
|
|
@@ -22,25 +22,20 @@ interface InvoiceDetailsProps {
|
|
|
22
22
|
|
|
23
23
|
const Invoice: React.FC = () => {
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
+
const { data } = useDefaultFacility();
|
|
25
26
|
const { billUuid, patientUuid } = useParams();
|
|
26
27
|
const { patient, isLoading: isLoadingPatient } = usePatient(patientUuid);
|
|
27
28
|
const { bill, isLoading: isLoadingBill, error, mutate } = useBill(billUuid);
|
|
28
29
|
const [isPrinting, setIsPrinting] = useState(false);
|
|
29
|
-
const [selectedLineItems, setSelectedLineItems] = useState<LineItem[]>([]);
|
|
30
30
|
const componentRef = useRef<HTMLDivElement>(null);
|
|
31
31
|
const onBeforeGetContentResolve = useRef<(() => void) | null>(null);
|
|
32
|
-
const { defaultCurrency } = useConfig();
|
|
33
|
-
const handleSelectItem = (lineItems: LineItem[]) => {
|
|
34
|
-
setSelectedLineItems(lineItems);
|
|
35
|
-
};
|
|
32
|
+
const { defaultCurrency } = useConfig<BillingConfig>();
|
|
36
33
|
|
|
37
34
|
const handleAfterPrint = useCallback(() => {
|
|
38
35
|
onBeforeGetContentResolve.current = null;
|
|
39
36
|
setIsPrinting(false);
|
|
40
37
|
}, []);
|
|
41
38
|
|
|
42
|
-
const reactToPrintContent = useCallback(() => componentRef.current, []);
|
|
43
|
-
|
|
44
39
|
const handleOnBeforeGetContent = useCallback(() => {
|
|
45
40
|
return new Promise<void>((resolve) => {
|
|
46
41
|
if (patient && bill) {
|
|
@@ -51,11 +46,17 @@ const Invoice: React.FC = () => {
|
|
|
51
46
|
}, [bill, patient]);
|
|
52
47
|
|
|
53
48
|
const handlePrint = useReactToPrint({
|
|
54
|
-
|
|
49
|
+
contentRef: componentRef,
|
|
55
50
|
documentTitle: `Invoice ${bill?.receiptNumber} - ${patient?.name?.[0]?.given?.join(' ')} ${patient?.name?.[0].family}`,
|
|
56
|
-
|
|
51
|
+
onBeforePrint: handleOnBeforeGetContent,
|
|
57
52
|
onAfterPrint: handleAfterPrint,
|
|
58
|
-
|
|
53
|
+
preserveAfterPrint: false,
|
|
54
|
+
onPrintError: (_, error) =>
|
|
55
|
+
showSnackbar({
|
|
56
|
+
title: t('errorPrintingInvoice', 'Error printing invoice'),
|
|
57
|
+
kind: 'error',
|
|
58
|
+
subtitle: error.message,
|
|
59
|
+
}),
|
|
59
60
|
});
|
|
60
61
|
|
|
61
62
|
useEffect(() => {
|
|
@@ -64,27 +65,28 @@ const Invoice: React.FC = () => {
|
|
|
64
65
|
}
|
|
65
66
|
}, [isPrinting]);
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
// Do not remove this comment. Adds the translation keys for the invoice details
|
|
69
|
+
/**
|
|
70
|
+
* t('totalAmount', 'Total amount')
|
|
71
|
+
* t('amountTendered', 'Amount tendered')
|
|
72
|
+
* t('invoiceNumber', 'Invoice #')
|
|
73
|
+
* t('dateAndTime', 'Date and time')
|
|
74
|
+
* t('invoiceStatus', 'Invoice status')
|
|
75
|
+
*/
|
|
72
76
|
const invoiceDetails = {
|
|
73
|
-
'Total
|
|
74
|
-
'Amount
|
|
75
|
-
'Invoice
|
|
76
|
-
'Date
|
|
77
|
-
'Invoice
|
|
77
|
+
[t('totalAmount', 'Total amount')]: convertToCurrency(bill?.totalAmount, defaultCurrency),
|
|
78
|
+
[t('amountTendered', 'Amount tendered')]: convertToCurrency(bill?.tenderedAmount, defaultCurrency),
|
|
79
|
+
[t('invoiceNumber', 'Invoice number')]: bill?.receiptNumber,
|
|
80
|
+
[t('dateAndTime', 'Date and time')]: bill?.dateCreated,
|
|
81
|
+
[t('invoiceStatus', 'Invoice status')]: bill?.status,
|
|
78
82
|
};
|
|
79
83
|
|
|
80
|
-
if (isLoadingPatient
|
|
84
|
+
if (isLoadingPatient || isLoadingBill) {
|
|
81
85
|
return (
|
|
82
86
|
<div className={styles.invoiceContainer}>
|
|
83
87
|
<InlineLoading
|
|
84
88
|
className={styles.loader}
|
|
85
|
-
|
|
86
|
-
iconDescription="Loading"
|
|
87
|
-
description="Loading patient header..."
|
|
89
|
+
description={`${t('loadingBillInfo', 'Loading bill information')}...`}
|
|
88
90
|
/>
|
|
89
91
|
</div>
|
|
90
92
|
);
|
|
@@ -109,31 +111,35 @@ const Invoice: React.FC = () => {
|
|
|
109
111
|
</section>
|
|
110
112
|
<div>
|
|
111
113
|
<Button
|
|
112
|
-
disabled={isPrinting}
|
|
114
|
+
disabled={isPrinting || isLoadingPatient || isLoadingBill}
|
|
113
115
|
onClick={handlePrint}
|
|
114
116
|
renderIcon={(props) => <Printer size={24} {...props} />}
|
|
115
|
-
iconDescription=
|
|
116
|
-
size="md">
|
|
117
|
+
iconDescription={t('printBill', 'Print bill')}>
|
|
117
118
|
{t('printBill', 'Print bill')}
|
|
118
119
|
</Button>
|
|
119
120
|
{(bill?.status === 'PAID' || bill?.tenderedAmount > 0) && <PrintReceipt billId={bill?.id} />}
|
|
120
121
|
</div>
|
|
121
122
|
</div>
|
|
122
123
|
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<div className={styles.printContainer} ref={componentRef}>
|
|
127
|
-
{isPrinting && <PrintableInvoice bill={bill} patient={patient} isLoading={isLoadingPatient} />}
|
|
124
|
+
<div className={styles.invoiceContent}>
|
|
125
|
+
<InvoiceTable bill={bill} isLoadingBill={isLoadingBill} />
|
|
126
|
+
<Payments bill={bill} mutate={mutate} />
|
|
128
127
|
</div>
|
|
128
|
+
|
|
129
|
+
{bill && patient && (
|
|
130
|
+
<div className={styles.printContainer}>
|
|
131
|
+
<PrintableInvoice bill={bill} patient={patient} defaultFacility={data} componentRef={componentRef} />
|
|
132
|
+
</div>
|
|
133
|
+
)}
|
|
129
134
|
</div>
|
|
130
135
|
);
|
|
131
136
|
};
|
|
132
137
|
|
|
133
138
|
function InvoiceDetails({ label, value }: InvoiceDetailsProps) {
|
|
139
|
+
const { t } = useTranslation();
|
|
134
140
|
return (
|
|
135
141
|
<div>
|
|
136
|
-
<h1 className={styles.label}>{label}</h1>
|
|
142
|
+
<h1 className={styles.label}>{t(label)}</h1>
|
|
137
143
|
<span className={styles.value}>{value}</span>
|
|
138
144
|
</div>
|
|
139
145
|
);
|
package/src/invoice/invoice.scss
CHANGED
|
@@ -73,21 +73,28 @@
|
|
|
73
73
|
flex-direction: row;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
.invoiceContent {
|
|
77
|
+
margin: layout.$spacing-05;
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
.billDetail {
|
|
77
81
|
font-weight: bold;
|
|
78
82
|
color: colors.$cool-gray-90;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
.printContainer {
|
|
86
|
+
background-color: colors.$white;
|
|
87
|
+
display: none;
|
|
88
|
+
|
|
89
|
+
@media print {
|
|
90
|
+
display: block !important;
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
@media print {
|
|
89
95
|
html,
|
|
90
96
|
body {
|
|
97
|
+
display: block !important;
|
|
91
98
|
background-color: colors.$white !important;
|
|
92
99
|
}
|
|
93
100
|
}
|