@openmrs/esm-billing-app 1.1.2-pre.8 → 1.2.0
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/.turbo/cache/31f1dfc7f71601df-meta.json +1 -0
- package/.turbo/cache/31f1dfc7f71601df.tar.zst +0 -0
- package/.turbo/turbo-build.log +13 -42
- package/__mocks__/bills.mock.ts +3 -2
- package/dist/1480.js +1 -0
- package/dist/1480.js.map +1 -0
- package/dist/1564.js +1 -0
- package/dist/1564.js.map +1 -0
- package/dist/1578.js +1 -0
- package/dist/1578.js.map +1 -0
- package/dist/1646.js +1 -0
- package/dist/1646.js.map +1 -0
- package/dist/1869.js +1 -0
- package/dist/1869.js.map +1 -0
- package/dist/1877.js +1 -0
- package/dist/1877.js.map +1 -0
- package/dist/1899.js +1 -0
- package/dist/1899.js.map +1 -0
- package/dist/196.js +2 -0
- package/dist/196.js.map +1 -0
- package/dist/2250.js +43 -0
- package/dist/2250.js.map +1 -0
- package/dist/2269.js +1 -0
- package/dist/2269.js.map +1 -0
- package/dist/2317.js +1 -0
- package/dist/2317.js.map +1 -0
- package/dist/2416.js +1 -0
- package/dist/2416.js.map +1 -0
- package/dist/2489.js +1 -0
- package/dist/2489.js.map +1 -0
- package/dist/282.js +1 -0
- package/dist/282.js.map +1 -0
- package/dist/2881.js +1 -0
- package/dist/2881.js.map +1 -0
- package/dist/2997.js +1 -0
- package/dist/2997.js.map +1 -0
- package/dist/3378.js +1 -0
- package/dist/3378.js.map +1 -0
- package/dist/3379.js +1 -0
- package/dist/3379.js.map +1 -0
- package/dist/3784.js +1 -0
- package/dist/3784.js.map +1 -0
- package/dist/3963.js +1 -0
- package/dist/3963.js.map +1 -0
- package/dist/4106.js +1 -0
- package/dist/4106.js.map +1 -0
- package/dist/4111.js +1 -0
- package/dist/4111.js.map +1 -0
- package/dist/434.js +1 -0
- package/dist/434.js.map +1 -0
- package/dist/4348.js +1 -0
- package/dist/4348.js.map +1 -0
- package/dist/4383.js +1 -0
- package/dist/4383.js.map +1 -0
- package/dist/4658.js +1 -0
- package/dist/4658.js.map +1 -0
- package/dist/4870.js +1 -0
- package/dist/4870.js.map +1 -0
- package/dist/4928.js +1 -0
- package/dist/4928.js.map +1 -0
- package/dist/5098.js +1 -0
- package/dist/5098.js.map +1 -0
- package/dist/5117.js +1 -0
- package/dist/5117.js.map +1 -0
- package/dist/5132.js +1 -0
- package/dist/5132.js.map +1 -0
- package/dist/5145.js +1 -0
- package/dist/5145.js.map +1 -0
- package/dist/5390.js +1 -0
- package/dist/5390.js.map +1 -0
- package/dist/5503.js +1 -0
- package/dist/5503.js.map +1 -0
- package/dist/556.js +1 -0
- package/dist/556.js.map +1 -0
- package/dist/5644.js +1 -0
- package/dist/5644.js.map +1 -0
- package/dist/5898.js +1 -0
- package/dist/5898.js.map +1 -0
- package/dist/5940.js +1 -0
- package/dist/5940.js.map +1 -0
- package/dist/6047.js +1 -0
- package/dist/6047.js.map +1 -0
- package/dist/6237.js +1 -0
- package/dist/6237.js.map +1 -0
- package/dist/6362.js +1 -0
- package/dist/6362.js.map +1 -0
- package/dist/6371.js +1 -0
- package/dist/6371.js.map +1 -0
- package/dist/6377.js +1 -0
- package/dist/6377.js.map +1 -0
- package/dist/6444.js +1 -0
- package/dist/6444.js.map +1 -0
- package/dist/6508.js +1 -0
- package/dist/6508.js.map +1 -0
- package/dist/6594.js +1 -0
- package/dist/6594.js.map +1 -0
- package/dist/6724.js +1 -0
- package/dist/6724.js.map +1 -0
- package/dist/6904.js +1 -0
- package/dist/6904.js.map +1 -0
- package/dist/7045.js +1 -0
- package/dist/7045.js.map +1 -0
- package/dist/7175.js +1 -0
- package/dist/7175.js.map +1 -0
- package/dist/7182.js +1 -0
- package/dist/7182.js.map +1 -0
- package/dist/7247.js +1 -0
- package/dist/7247.js.map +1 -0
- package/dist/7742.js +1 -0
- package/dist/7742.js.map +1 -0
- package/dist/7912.js +1 -0
- package/dist/7912.js.map +1 -0
- package/dist/8358.js +1 -0
- package/dist/8358.js.map +1 -0
- package/dist/8359.js +1 -0
- package/dist/8359.js.map +1 -0
- package/dist/8695.js +1 -0
- package/dist/8695.js.map +1 -0
- package/dist/903.js +1 -0
- package/dist/903.js.map +1 -0
- package/dist/9072.js +1 -0
- package/dist/9072.js.map +1 -0
- package/dist/9414.js +1 -0
- package/dist/9414.js.map +1 -0
- package/dist/9655.js +11 -0
- package/dist/9655.js.map +1 -0
- package/dist/9806.js +1 -0
- package/dist/9806.js.map +1 -0
- package/dist/990.js +1 -0
- package/dist/990.js.map +1 -0
- package/dist/main.js +17 -2
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-billing-app.js +6 -1
- package/dist/openmrs-esm-billing-app.js.buildmanifest.json +643 -436
- package/dist/openmrs-esm-billing-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/e2e/commands/billing-operations.ts +21 -0
- package/e2e/commands/types.ts +9 -1
- package/e2e/pages/discounts-page.ts +75 -0
- package/e2e/pages/index.ts +1 -0
- package/e2e/pages/invoice-page.ts +7 -7
- package/e2e/specs/bill-discounts.spec.ts +255 -0
- package/e2e/specs/billing-dashboard.spec.ts +3 -3
- package/e2e/specs/billing-patient-chart.spec.ts +2 -2
- package/package.json +13 -22
- package/rspack.config.js +1 -0
- package/src/bill-history/bill-action-menu.component.tsx +20 -2
- package/src/bill-history/bill-history.test.tsx +23 -22
- package/src/bill-item-actions/edit-bill-item.modal.tsx +1 -1
- package/src/bill-item-actions/edit-bill-item.test.tsx +29 -27
- package/src/billable-services/billable-service-form/billable-service-form.test.tsx +74 -73
- package/src/billable-services/billable-services-home.component.tsx +4 -2
- package/src/billable-services/billable-services.test.tsx +8 -7
- package/src/billable-services/dashboard/dashboard.test.tsx +3 -2
- package/src/billable-services-admin-card-link.test.tsx +2 -1
- package/src/billing-dashboard/billing-dashboard.test.tsx +19 -3
- package/src/billing-form/billing-checkin-form.component.tsx +7 -3
- package/src/billing-form/billing-checkin-form.test.tsx +22 -21
- package/src/billing-form/billing-form.resource.test.ts +7 -6
- package/src/billing-form/billing-form.test.tsx +77 -40
- package/src/billing-form/billing-form.workspace.tsx +25 -6
- package/src/billing-form/visit-attributes/visit-attributes-form.component.tsx +6 -2
- package/src/billing.resource.test.ts +43 -41
- package/src/billing.resource.ts +65 -16
- package/src/bills-table/bills-table.component.tsx +15 -4
- package/src/bills-table/bills-table.test.tsx +72 -71
- package/src/config-schema.ts +0 -7
- package/src/discounts/admin/discount-requests-left-panel-link.component.tsx +43 -0
- package/src/discounts/admin/discount-requests.component.tsx +316 -0
- package/src/discounts/admin/discount-requests.scss +133 -0
- package/src/discounts/admin/discount-requests.test.tsx +104 -0
- package/src/discounts/admin/review-bill-discounts/bill-line-items-table/bill-line-items-table.component.tsx +42 -0
- package/src/discounts/admin/review-bill-discounts/bill-line-items-table/bill-line-items-table.scss +76 -0
- package/src/discounts/admin/review-bill-discounts/bill-payments-table/bill-payments-table.component.tsx +50 -0
- package/src/discounts/admin/review-bill-discounts/bill-payments-table/bill-payments-table.scss +63 -0
- package/src/discounts/admin/review-bill-discounts/bill-receipt-rail/bill-receipt-rail.component.tsx +73 -0
- package/src/discounts/admin/review-bill-discounts/bill-receipt-rail/bill-receipt-rail.scss +54 -0
- package/src/discounts/admin/review-bill-discounts/bill-totals-summary/bill-totals-summary.component.tsx +95 -0
- package/src/discounts/admin/review-bill-discounts/bill-totals-summary/bill-totals-summary.scss +128 -0
- package/src/discounts/admin/review-bill-discounts/discount-card/discount-card.component.tsx +158 -0
- package/src/discounts/admin/review-bill-discounts/discount-card/discount-card.scss +164 -0
- package/src/discounts/admin/review-bill-discounts/discount-review-stack/discount-review-stack.component.tsx +86 -0
- package/src/discounts/admin/review-bill-discounts/discount-review-stack/discount-review-stack.scss +40 -0
- package/src/discounts/admin/review-bill-discounts/review-bill-discounts.modal.scss +14 -0
- package/src/discounts/admin/review-bill-discounts/review-bill-discounts.modal.test.tsx +153 -0
- package/src/discounts/admin/review-bill-discounts/review-bill-discounts.modal.tsx +167 -0
- package/src/discounts/admin/review-bill-discounts/review-bill-discounts.utils.ts +42 -0
- package/src/discounts/discounts-table.component.tsx +109 -0
- package/src/discounts/discounts-table.scss +37 -0
- package/src/discounts/discounts-table.test.tsx +67 -0
- package/src/discounts/discounts.resource.ts +71 -0
- package/src/discounts/request-discount.modal.scss +88 -0
- package/src/discounts/request-discount.modal.test.tsx +161 -0
- package/src/discounts/request-discount.modal.tsx +253 -0
- package/src/index.ts +52 -21
- package/src/invoice/invoice-table.component.tsx +116 -18
- package/src/invoice/invoice-table.test.tsx +165 -13
- package/src/invoice/invoice.component.tsx +111 -7
- package/src/invoice/invoice.test.tsx +366 -66
- package/src/invoice/line-item-action-menu.component.tsx +31 -1
- package/src/invoice/payments/payment-form/payment-form.test.tsx +20 -19
- package/src/invoice/payments/payment-history/payment-history.test.tsx +13 -10
- package/src/invoice/payments/payments.component.tsx +20 -6
- package/src/invoice/payments/payments.test.tsx +88 -23
- package/src/invoice/printable-invoice/print-receipt.test.tsx +10 -28
- package/src/invoice/printable-invoice/printable-footer.test.tsx +5 -4
- package/src/invoice/printable-invoice/printable-invoice-header.component.tsx +3 -3
- package/src/invoice/printable-invoice/printable-invoice-header.test.tsx +26 -11
- package/src/invoice/printable-invoice/printable-invoice.component.tsx +38 -15
- package/src/left-panel-link.test.tsx +3 -3
- package/src/metrics-cards/metrics-cards.test.tsx +11 -10
- package/src/modal/delete-bill-confirmation.modal.test.tsx +134 -0
- package/src/modal/delete-bill-confirmation.modal.tsx +98 -0
- package/src/modal/delete-line-item-confirmation.modal.test.tsx +11 -9
- package/src/modal/finalize-bill-confirmation.modal.test.tsx +10 -8
- package/src/modal/require-payment-modal.test.tsx +12 -11
- package/src/payment-status-tag/payment-status-tag.component.tsx +50 -0
- package/src/payment-status-tag/payment-status-tag.scss +6 -0
- package/src/payment-status-tag/payment-status-tag.test.tsx +113 -0
- package/src/refunds/admin/refund-requests-left-panel-link.component.tsx +43 -0
- package/src/refunds/admin/refund-requests.component.tsx +324 -0
- package/src/refunds/admin/refund-requests.scss +133 -0
- package/src/refunds/admin/refund-requests.test.tsx +99 -0
- package/src/refunds/admin/review-bill-refunds/bill-line-items-table/bill-line-items-table.component.tsx +42 -0
- package/src/refunds/admin/review-bill-refunds/bill-line-items-table/bill-line-items-table.scss +76 -0
- package/src/refunds/admin/review-bill-refunds/bill-payments-table/bill-payments-table.component.tsx +50 -0
- package/src/refunds/admin/review-bill-refunds/bill-payments-table/bill-payments-table.scss +63 -0
- package/src/refunds/admin/review-bill-refunds/bill-receipt-rail/bill-receipt-rail.component.tsx +84 -0
- package/src/refunds/admin/review-bill-refunds/bill-receipt-rail/bill-receipt-rail.scss +54 -0
- package/src/refunds/admin/review-bill-refunds/bill-totals-summary/bill-totals-summary.component.tsx +83 -0
- package/src/refunds/admin/review-bill-refunds/bill-totals-summary/bill-totals-summary.scss +65 -0
- package/src/refunds/admin/review-bill-refunds/refund-card/refund-card.component.tsx +170 -0
- package/src/refunds/admin/review-bill-refunds/refund-card/refund-card.scss +155 -0
- package/src/refunds/admin/review-bill-refunds/refund-review-stack/refund-review-stack.component.tsx +86 -0
- package/src/refunds/admin/review-bill-refunds/refund-review-stack/refund-review-stack.scss +40 -0
- package/src/refunds/admin/review-bill-refunds/review-bill-refunds.modal.scss +14 -0
- package/src/refunds/admin/review-bill-refunds/review-bill-refunds.modal.test.tsx +313 -0
- package/src/refunds/admin/review-bill-refunds/review-bill-refunds.modal.tsx +188 -0
- package/src/refunds/admin/review-bill-refunds/review-bill-refunds.utils.ts +66 -0
- package/src/refunds/refunds-table.component.tsx +137 -0
- package/src/refunds/refunds-table.scss +37 -0
- package/src/refunds/refunds-table.test.tsx +105 -0
- package/src/refunds/refunds.resource.test.ts +44 -0
- package/src/refunds/refunds.resource.ts +42 -0
- package/src/refunds/refunds.types.test.ts +15 -0
- package/src/refunds/request-refund.modal.scss +84 -0
- package/src/refunds/request-refund.modal.test.tsx +204 -0
- package/src/refunds/request-refund.modal.tsx +218 -0
- package/src/routes.json +36 -2
- package/src/types/index.ts +116 -1
- package/src/visit-bills/visit-bills-panel.component.tsx +151 -0
- package/src/visit-bills/visit-bills-panel.scss +31 -0
- package/src/visit-bills/visit-bills-panel.test.tsx +113 -0
- package/tools/empty-module.ts +1 -0
- package/tools/setup-tests.ts +9 -9
- package/translations/am.json +154 -16
- package/translations/ar.json +154 -16
- package/translations/ar_SY.json +154 -16
- package/translations/bn.json +154 -16
- package/translations/cs.json +154 -16
- package/translations/de.json +154 -16
- package/translations/en.json +154 -16
- package/translations/en_US.json +154 -16
- package/translations/es.json +154 -16
- package/translations/es_MX.json +154 -16
- package/translations/fr.json +154 -16
- package/translations/he.json +154 -16
- package/translations/hi.json +154 -16
- package/translations/hi_IN.json +154 -16
- package/translations/id.json +154 -16
- package/translations/it.json +154 -16
- package/translations/ka.json +154 -16
- package/translations/km.json +154 -16
- package/translations/ku.json +154 -16
- package/translations/ky.json +154 -16
- package/translations/lg.json +154 -16
- package/translations/ne.json +154 -16
- package/translations/pl.json +154 -16
- package/translations/pt.json +154 -16
- package/translations/pt_BR.json +154 -16
- package/translations/qu.json +154 -16
- package/translations/ro_RO.json +154 -16
- package/translations/ru_RU.json +154 -16
- package/translations/si.json +154 -16
- package/translations/sq.json +154 -16
- package/translations/sw.json +154 -16
- package/translations/sw_KE.json +154 -16
- package/translations/tr.json +154 -16
- package/translations/tr_TR.json +154 -16
- package/translations/uk.json +154 -16
- package/translations/uz.json +154 -16
- package/translations/uz@Latn.json +154 -16
- package/translations/uz_UZ.json +154 -16
- package/translations/vi.json +154 -16
- package/translations/zh.json +154 -16
- package/translations/zh_CN.json +179 -41
- package/translations/zh_TW.json +154 -16
- package/tsconfig.json +3 -3
- package/vitest.config.js +28 -0
- package/.turbo/cache/6c998b0f30a031ab-meta.json +0 -1
- package/.turbo/cache/6c998b0f30a031ab.tar.zst +0 -0
- package/dist/1119.js +0 -1
- package/dist/1197.js +0 -1
- package/dist/1435.js +0 -1
- package/dist/1435.js.map +0 -1
- package/dist/1807.js +0 -1
- package/dist/1807.js.map +0 -1
- package/dist/2146.js +0 -1
- package/dist/2177.js +0 -2
- package/dist/2177.js.LICENSE.txt +0 -9
- package/dist/2177.js.map +0 -1
- package/dist/2690.js +0 -1
- package/dist/2704.js +0 -1
- package/dist/2704.js.map +0 -1
- package/dist/3002.js +0 -1
- package/dist/3002.js.map +0 -1
- package/dist/3041.js +0 -1
- package/dist/3041.js.map +0 -1
- package/dist/3099.js +0 -1
- package/dist/3184.js +0 -2
- package/dist/3184.js.LICENSE.txt +0 -14
- package/dist/3184.js.map +0 -1
- package/dist/3584.js +0 -1
- package/dist/4055.js +0 -1
- package/dist/4132.js +0 -1
- package/dist/4225.js +0 -1
- package/dist/4225.js.map +0 -1
- package/dist/4300.js +0 -1
- package/dist/4335.js +0 -1
- package/dist/439.js +0 -1
- package/dist/4618.js +0 -1
- package/dist/4652.js +0 -1
- package/dist/4944.js +0 -1
- package/dist/5173.js +0 -1
- package/dist/5241.js +0 -1
- package/dist/5422.js +0 -1
- package/dist/5422.js.map +0 -1
- package/dist/5442.js +0 -1
- package/dist/5661.js +0 -1
- package/dist/6022.js +0 -1
- package/dist/6404.js +0 -1
- package/dist/6404.js.map +0 -1
- package/dist/6468.js +0 -1
- package/dist/6540.js +0 -2
- package/dist/6540.js.LICENSE.txt +0 -9
- package/dist/6540.js.map +0 -1
- package/dist/6589.js +0 -1
- package/dist/6606.js +0 -1
- package/dist/6606.js.map +0 -1
- package/dist/6679.js +0 -1
- package/dist/6792.js +0 -1
- package/dist/6792.js.map +0 -1
- package/dist/6840.js +0 -1
- package/dist/6859.js +0 -1
- package/dist/7097.js +0 -1
- package/dist/7159.js +0 -1
- package/dist/723.js +0 -1
- package/dist/7255.js +0 -1
- package/dist/7255.js.map +0 -1
- package/dist/7617.js +0 -1
- package/dist/795.js +0 -1
- package/dist/8163.js +0 -1
- package/dist/8341.js +0 -2
- package/dist/8341.js.LICENSE.txt +0 -52
- package/dist/8341.js.map +0 -1
- package/dist/8349.js +0 -1
- package/dist/8371.js +0 -1
- package/dist/8421.js +0 -1
- package/dist/8421.js.map +0 -1
- package/dist/8618.js +0 -1
- package/dist/890.js +0 -1
- package/dist/9214.js +0 -1
- package/dist/9538.js +0 -1
- package/dist/9569.js +0 -1
- package/dist/961.js +0 -2
- package/dist/961.js.LICENSE.txt +0 -19
- package/dist/961.js.map +0 -1
- package/dist/986.js +0 -1
- package/dist/9879.js +0 -1
- package/dist/9895.js +0 -1
- package/dist/9900.js +0 -1
- package/dist/9913.js +0 -1
- package/dist/main.js.LICENSE.txt +0 -62
- package/src/billable-services/bill-waiver/bill-selection.component.tsx +0 -76
- package/src/billable-services/bill-waiver/bill-waiver-form.component.tsx +0 -107
- package/src/billable-services/bill-waiver/bill-waiver-form.scss +0 -34
- package/src/billable-services/bill-waiver/bill-waiver.component.tsx +0 -34
- package/src/billable-services/bill-waiver/bill-waiver.scss +0 -10
- package/src/billable-services/bill-waiver/patient-bills.component.tsx +0 -134
- package/webpack.config.js +0 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
5
|
import { usePaginatedBills } from '../billing.resource';
|
|
5
|
-
import { BillStatus } from '../types';
|
|
6
|
+
import { BillLineItemStatus, BillStatus, type MappedBill } from '../types';
|
|
6
7
|
import BillsTable from './bills-table.component';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
usePaginatedBills:
|
|
9
|
+
vi.mock('../billing.resource', () => ({
|
|
10
|
+
usePaginatedBills: vi.fn(() => ({
|
|
10
11
|
bills: mockBillsData,
|
|
11
12
|
isLoading: false,
|
|
12
13
|
isValidating: false,
|
|
13
14
|
error: null,
|
|
14
|
-
mutate:
|
|
15
|
+
mutate: vi.fn(),
|
|
15
16
|
})),
|
|
16
17
|
}));
|
|
17
18
|
|
|
18
|
-
const mockBills =
|
|
19
|
+
const mockBills = vi.mocked(usePaginatedBills);
|
|
19
20
|
|
|
20
21
|
const mockBillsData = [
|
|
21
22
|
{
|
|
@@ -23,7 +24,6 @@ const mockBillsData = [
|
|
|
23
24
|
id: 1,
|
|
24
25
|
patientName: 'John Doe',
|
|
25
26
|
identifier: '12345678',
|
|
26
|
-
visitType: 'Checkup',
|
|
27
27
|
patientUuid: 'uuid1',
|
|
28
28
|
dateCreated: '2024-01-01',
|
|
29
29
|
lineItems: [
|
|
@@ -40,7 +40,7 @@ const mockBillsData = [
|
|
|
40
40
|
priceUuid: 'price-1',
|
|
41
41
|
lineItemOrder: 1,
|
|
42
42
|
resourceVersion: '1.0',
|
|
43
|
-
|
|
43
|
+
status: BillLineItemStatus.PENDING,
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
46
|
status: BillStatus.PENDING,
|
|
@@ -52,6 +52,7 @@ const mockBillsData = [
|
|
|
52
52
|
billingService: 'Service 1',
|
|
53
53
|
payments: [],
|
|
54
54
|
totalAmount: 100,
|
|
55
|
+
netAmount: 100,
|
|
55
56
|
tenderedAmount: 0,
|
|
56
57
|
},
|
|
57
58
|
{
|
|
@@ -59,7 +60,6 @@ const mockBillsData = [
|
|
|
59
60
|
id: 2,
|
|
60
61
|
patientName: 'Mary Smith',
|
|
61
62
|
identifier: '98765432',
|
|
62
|
-
visitType: 'Wake up',
|
|
63
63
|
patientUuid: 'uuid2',
|
|
64
64
|
dateCreated: '2024-01-02',
|
|
65
65
|
lineItems: [
|
|
@@ -76,7 +76,7 @@ const mockBillsData = [
|
|
|
76
76
|
priceUuid: 'price-1',
|
|
77
77
|
lineItemOrder: 1,
|
|
78
78
|
resourceVersion: '1.0',
|
|
79
|
-
|
|
79
|
+
status: BillLineItemStatus.PENDING,
|
|
80
80
|
},
|
|
81
81
|
],
|
|
82
82
|
status: BillStatus.PENDING,
|
|
@@ -88,9 +88,10 @@ const mockBillsData = [
|
|
|
88
88
|
billingService: 'Service 2',
|
|
89
89
|
payments: [],
|
|
90
90
|
totalAmount: 200,
|
|
91
|
+
netAmount: 200,
|
|
91
92
|
tenderedAmount: 200,
|
|
92
93
|
},
|
|
93
|
-
];
|
|
94
|
+
] satisfies MappedBill[];
|
|
94
95
|
|
|
95
96
|
describe('BillsTable', () => {
|
|
96
97
|
beforeEach(() => {
|
|
@@ -99,14 +100,14 @@ describe('BillsTable', () => {
|
|
|
99
100
|
isLoading: false,
|
|
100
101
|
isValidating: false,
|
|
101
102
|
error: null,
|
|
102
|
-
mutate:
|
|
103
|
+
mutate: vi.fn(),
|
|
103
104
|
currentPage: 1,
|
|
104
105
|
totalCount: 10,
|
|
105
|
-
goTo:
|
|
106
|
+
goTo: vi.fn(),
|
|
106
107
|
}));
|
|
107
108
|
});
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
it('renders data table with pending bills', () => {
|
|
110
111
|
render(<BillsTable />);
|
|
111
112
|
|
|
112
113
|
expect(screen.getByText(/bill date/i)).toBeInTheDocument();
|
|
@@ -116,16 +117,16 @@ describe('BillsTable', () => {
|
|
|
116
117
|
expect(screen.getByText(/12345678/i)).toBeInTheDocument();
|
|
117
118
|
});
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
it('displays empty state when there are no bills with default filter', () => {
|
|
120
121
|
mockBills.mockImplementationOnce(() => ({
|
|
121
122
|
bills: [],
|
|
122
123
|
isLoading: false,
|
|
123
124
|
isValidating: false,
|
|
124
125
|
error: null,
|
|
125
|
-
mutate:
|
|
126
|
+
mutate: vi.fn(),
|
|
126
127
|
currentPage: 1,
|
|
127
128
|
totalCount: 0,
|
|
128
|
-
goTo:
|
|
129
|
+
goTo: vi.fn(),
|
|
129
130
|
}));
|
|
130
131
|
|
|
131
132
|
render(<BillsTable />);
|
|
@@ -136,35 +137,35 @@ describe('BillsTable', () => {
|
|
|
136
137
|
expect(screen.getByRole('searchbox')).toBeInTheDocument();
|
|
137
138
|
});
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
it('should show the loading spinner while retrieving data', () => {
|
|
140
141
|
mockBills.mockImplementationOnce(() => ({
|
|
141
142
|
bills: undefined,
|
|
142
143
|
isLoading: true,
|
|
143
144
|
isValidating: false,
|
|
144
145
|
error: null,
|
|
145
|
-
mutate:
|
|
146
|
+
mutate: vi.fn(),
|
|
146
147
|
currentPage: 1,
|
|
147
148
|
totalCount: 0,
|
|
148
|
-
goTo:
|
|
149
|
+
goTo: vi.fn(),
|
|
149
150
|
}));
|
|
150
151
|
|
|
151
152
|
render(<BillsTable />);
|
|
152
153
|
|
|
153
|
-
expect(screen.
|
|
154
|
+
expect(screen.getByTestId('bills-table-skeleton')).toBeInTheDocument();
|
|
154
155
|
expect(screen.getByText(/filter by/i)).toBeInTheDocument();
|
|
155
|
-
expect(screen.getByText(/pending
|
|
156
|
+
expect(screen.getByText(/pending confirmation/i)).toBeInTheDocument();
|
|
156
157
|
});
|
|
157
158
|
|
|
158
|
-
|
|
159
|
+
it('should display an error state if there is a problem loading bill data', () => {
|
|
159
160
|
mockBills.mockImplementationOnce(() => ({
|
|
160
161
|
bills: undefined,
|
|
161
162
|
isLoading: false,
|
|
162
163
|
isValidating: false,
|
|
163
164
|
error: new Error('Error in fetching data'),
|
|
164
|
-
mutate:
|
|
165
|
+
mutate: vi.fn(),
|
|
165
166
|
currentPage: 1,
|
|
166
167
|
totalCount: 0,
|
|
167
|
-
goTo:
|
|
168
|
+
goTo: vi.fn(),
|
|
168
169
|
}));
|
|
169
170
|
|
|
170
171
|
render(<BillsTable />);
|
|
@@ -172,19 +173,19 @@ describe('BillsTable', () => {
|
|
|
172
173
|
expect(screen.getByText(/error state/i)).toBeInTheDocument();
|
|
173
174
|
expect(screen.queryByRole('table')).not.toBeInTheDocument();
|
|
174
175
|
expect(screen.getByText(/filter by/i)).toBeInTheDocument();
|
|
175
|
-
expect(screen.getByText(/pending
|
|
176
|
+
expect(screen.getByText(/pending confirmation/i)).toBeInTheDocument();
|
|
176
177
|
});
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
it('should pass search term to backend API', async () => {
|
|
179
180
|
const user = userEvent.setup();
|
|
180
|
-
const mockGoTo =
|
|
181
|
+
const mockGoTo = vi.fn();
|
|
181
182
|
|
|
182
183
|
mockBills.mockImplementation((_pageSize, _status, patientName) => ({
|
|
183
184
|
bills: patientName === 'John' ? [mockBillsData[0]] : mockBillsData,
|
|
184
185
|
isLoading: false,
|
|
185
186
|
isValidating: false,
|
|
186
187
|
error: null,
|
|
187
|
-
mutate:
|
|
188
|
+
mutate: vi.fn(),
|
|
188
189
|
currentPage: 1,
|
|
189
190
|
totalCount: patientName === 'John' ? 1 : 2,
|
|
190
191
|
goTo: mockGoTo,
|
|
@@ -201,13 +202,13 @@ describe('BillsTable', () => {
|
|
|
201
202
|
await user.type(searchInput, 'John');
|
|
202
203
|
|
|
203
204
|
await waitFor(() => {
|
|
204
|
-
expect(mockBills).toHaveBeenCalledWith(10, '
|
|
205
|
+
expect(mockBills).toHaveBeenCalledWith(10, 'PENDING', 'John');
|
|
205
206
|
});
|
|
206
207
|
|
|
207
208
|
expect(mockGoTo).toHaveBeenCalledWith(1);
|
|
208
209
|
});
|
|
209
210
|
|
|
210
|
-
|
|
211
|
+
it('should render invoice number as a link to the invoice page', () => {
|
|
211
212
|
render(<BillsTable />);
|
|
212
213
|
|
|
213
214
|
const invoiceNumberLink = screen.getByRole('link', { name: 'RCP-001' });
|
|
@@ -216,7 +217,7 @@ describe('BillsTable', () => {
|
|
|
216
217
|
expect(invoiceNumberLink).toHaveAttribute('href', '/openmrs/spa/home/billing/patient/uuid1/1');
|
|
217
218
|
});
|
|
218
219
|
|
|
219
|
-
|
|
220
|
+
it('should filter bills by payment status', async () => {
|
|
220
221
|
const user = userEvent.setup();
|
|
221
222
|
|
|
222
223
|
// First call: initial render with PENDING filter (default)
|
|
@@ -225,10 +226,10 @@ describe('BillsTable', () => {
|
|
|
225
226
|
isLoading: false,
|
|
226
227
|
isValidating: false,
|
|
227
228
|
error: null,
|
|
228
|
-
mutate:
|
|
229
|
+
mutate: vi.fn(),
|
|
229
230
|
currentPage: 1,
|
|
230
231
|
totalCount: 2,
|
|
231
|
-
goTo:
|
|
232
|
+
goTo: vi.fn(),
|
|
232
233
|
}));
|
|
233
234
|
|
|
234
235
|
// Second call: after filter changes to PAID, return empty bills
|
|
@@ -237,15 +238,15 @@ describe('BillsTable', () => {
|
|
|
237
238
|
isLoading: false,
|
|
238
239
|
isValidating: false,
|
|
239
240
|
error: null,
|
|
240
|
-
mutate:
|
|
241
|
+
mutate: vi.fn(),
|
|
241
242
|
currentPage: 1,
|
|
242
243
|
totalCount: 0,
|
|
243
|
-
goTo:
|
|
244
|
+
goTo: vi.fn(),
|
|
244
245
|
}));
|
|
245
246
|
|
|
246
247
|
render(<BillsTable />);
|
|
247
248
|
|
|
248
|
-
const filterDropdown = screen.getByText('Pending
|
|
249
|
+
const filterDropdown = screen.getByText('Pending confirmation');
|
|
249
250
|
await user.click(filterDropdown);
|
|
250
251
|
|
|
251
252
|
const paidBillsOption = screen.getAllByText('Paid bills')[0];
|
|
@@ -258,16 +259,16 @@ describe('BillsTable', () => {
|
|
|
258
259
|
expect(screen.getByText(/check the filters above/i)).toBeInTheDocument();
|
|
259
260
|
});
|
|
260
261
|
|
|
261
|
-
|
|
262
|
+
it('should show loading state during background updates', () => {
|
|
262
263
|
mockBills.mockImplementationOnce(() => ({
|
|
263
264
|
bills: mockBillsData,
|
|
264
265
|
isLoading: false,
|
|
265
266
|
isValidating: true,
|
|
266
267
|
error: null,
|
|
267
|
-
mutate:
|
|
268
|
+
mutate: vi.fn(),
|
|
268
269
|
currentPage: 1,
|
|
269
270
|
totalCount: 0,
|
|
270
|
-
goTo:
|
|
271
|
+
goTo: vi.fn(),
|
|
271
272
|
}));
|
|
272
273
|
|
|
273
274
|
render(<BillsTable />);
|
|
@@ -276,16 +277,16 @@ describe('BillsTable', () => {
|
|
|
276
277
|
expect(loadingIndicator).toBeInTheDocument();
|
|
277
278
|
});
|
|
278
279
|
|
|
279
|
-
|
|
280
|
+
it('should show search box and empty state message when search returns no results', () => {
|
|
280
281
|
mockBills.mockImplementationOnce(() => ({
|
|
281
282
|
bills: [],
|
|
282
283
|
isLoading: false,
|
|
283
284
|
isValidating: false,
|
|
284
285
|
error: null,
|
|
285
|
-
mutate:
|
|
286
|
+
mutate: vi.fn(),
|
|
286
287
|
currentPage: 1,
|
|
287
288
|
totalCount: 0,
|
|
288
|
-
goTo:
|
|
289
|
+
goTo: vi.fn(),
|
|
289
290
|
}));
|
|
290
291
|
|
|
291
292
|
render(<BillsTable />);
|
|
@@ -297,16 +298,16 @@ describe('BillsTable', () => {
|
|
|
297
298
|
expect(screen.queryByText(/next page/i)).not.toBeInTheDocument();
|
|
298
299
|
});
|
|
299
300
|
|
|
300
|
-
|
|
301
|
+
it('should reset to page 1 when page size changes', async () => {
|
|
301
302
|
const user = userEvent.setup();
|
|
302
|
-
const mockGoTo =
|
|
303
|
+
const mockGoTo = vi.fn();
|
|
303
304
|
|
|
304
305
|
mockBills.mockImplementation(() => ({
|
|
305
306
|
bills: mockBillsData,
|
|
306
307
|
isLoading: false,
|
|
307
308
|
isValidating: false,
|
|
308
309
|
error: null,
|
|
309
|
-
mutate:
|
|
310
|
+
mutate: vi.fn(),
|
|
310
311
|
currentPage: 3,
|
|
311
312
|
totalCount: 100,
|
|
312
313
|
goTo: mockGoTo,
|
|
@@ -326,60 +327,60 @@ describe('BillsTable', () => {
|
|
|
326
327
|
});
|
|
327
328
|
});
|
|
328
329
|
|
|
329
|
-
|
|
330
|
+
it('should default to "Pending confirmation" filter showing PENDING bills', () => {
|
|
330
331
|
render(<BillsTable />);
|
|
331
332
|
|
|
332
|
-
expect(screen.getByText('Pending
|
|
333
|
-
expect(mockBills).toHaveBeenCalledWith(expect.any(Number), '
|
|
333
|
+
expect(screen.getByText('Pending confirmation')).toBeInTheDocument();
|
|
334
|
+
expect(mockBills).toHaveBeenCalledWith(expect.any(Number), 'PENDING', undefined);
|
|
334
335
|
});
|
|
335
336
|
|
|
336
|
-
|
|
337
|
+
it('should show "Pending payment" option in filter dropdown', async () => {
|
|
337
338
|
const user = userEvent.setup();
|
|
338
339
|
render(<BillsTable />);
|
|
339
340
|
|
|
340
|
-
const filterDropdown = screen.getByText('Pending
|
|
341
|
+
const filterDropdown = screen.getByText('Pending confirmation');
|
|
341
342
|
await user.click(filterDropdown);
|
|
342
343
|
|
|
343
|
-
expect(screen.getByRole('option', { name: /pending
|
|
344
|
+
expect(screen.getByRole('option', { name: /pending payment/i })).toBeInTheDocument();
|
|
344
345
|
});
|
|
345
346
|
|
|
346
|
-
|
|
347
|
+
it('should filter by POSTED status when "Pending payment" is selected', async () => {
|
|
347
348
|
const user = userEvent.setup();
|
|
348
|
-
const mockGoTo =
|
|
349
|
+
const mockGoTo = vi.fn();
|
|
349
350
|
|
|
350
351
|
mockBills.mockImplementation((_pageSize, status) => ({
|
|
351
|
-
bills: status === '
|
|
352
|
+
bills: status === 'POSTED' ? [mockBillsData[1]] : mockBillsData,
|
|
352
353
|
isLoading: false,
|
|
353
354
|
isValidating: false,
|
|
354
355
|
error: null,
|
|
355
|
-
mutate:
|
|
356
|
+
mutate: vi.fn(),
|
|
356
357
|
currentPage: 1,
|
|
357
|
-
totalCount: status === '
|
|
358
|
+
totalCount: status === 'POSTED' ? 1 : 2,
|
|
358
359
|
goTo: mockGoTo,
|
|
359
360
|
}));
|
|
360
361
|
|
|
361
362
|
render(<BillsTable />);
|
|
362
363
|
|
|
363
|
-
const filterDropdown = screen.getByText('Pending
|
|
364
|
+
const filterDropdown = screen.getByText('Pending confirmation');
|
|
364
365
|
await user.click(filterDropdown);
|
|
365
366
|
|
|
366
|
-
await user.click(screen.getByRole('option', { name: /pending
|
|
367
|
+
await user.click(screen.getByRole('option', { name: /pending payment/i }));
|
|
367
368
|
|
|
368
369
|
await waitFor(() => {
|
|
369
|
-
expect(mockBills).toHaveBeenCalledWith(expect.any(Number), '
|
|
370
|
+
expect(mockBills).toHaveBeenCalledWith(expect.any(Number), 'POSTED', undefined);
|
|
370
371
|
});
|
|
371
372
|
});
|
|
372
373
|
|
|
373
|
-
|
|
374
|
+
it('should filter by PENDING status when "Pending confirmation" is selected', async () => {
|
|
374
375
|
const user = userEvent.setup();
|
|
375
|
-
const mockGoTo =
|
|
376
|
+
const mockGoTo = vi.fn();
|
|
376
377
|
|
|
377
378
|
mockBills.mockImplementation((_pageSize, status) => ({
|
|
378
|
-
bills: status === '
|
|
379
|
+
bills: status === 'PENDING' ? [mockBillsData[0]] : mockBillsData,
|
|
379
380
|
isLoading: false,
|
|
380
381
|
isValidating: false,
|
|
381
382
|
error: null,
|
|
382
|
-
mutate:
|
|
383
|
+
mutate: vi.fn(),
|
|
383
384
|
currentPage: 1,
|
|
384
385
|
totalCount: 1,
|
|
385
386
|
goTo: mockGoTo,
|
|
@@ -387,31 +388,31 @@ describe('BillsTable', () => {
|
|
|
387
388
|
|
|
388
389
|
render(<BillsTable />);
|
|
389
390
|
|
|
390
|
-
// Navigate away from the default
|
|
391
|
-
const filterDropdown = screen.getByText('Pending
|
|
391
|
+
// Navigate away from the default PENDING filter first, then select it again
|
|
392
|
+
const filterDropdown = screen.getByText('Pending confirmation');
|
|
392
393
|
await user.click(filterDropdown);
|
|
393
394
|
await user.click(screen.getByRole('option', { name: /all bills/i }));
|
|
394
395
|
|
|
395
396
|
mockBills.mockClear();
|
|
396
397
|
|
|
397
398
|
await user.click(screen.getByText('All bills'));
|
|
398
|
-
await user.click(screen.getByRole('option', { name: /pending
|
|
399
|
+
await user.click(screen.getByRole('option', { name: /pending confirmation/i }));
|
|
399
400
|
|
|
400
401
|
await waitFor(() => {
|
|
401
|
-
expect(mockBills).toHaveBeenCalledWith(expect.any(Number), '
|
|
402
|
+
expect(mockBills).toHaveBeenCalledWith(expect.any(Number), 'PENDING', undefined);
|
|
402
403
|
});
|
|
403
404
|
});
|
|
404
405
|
|
|
405
|
-
|
|
406
|
+
it('should keep data visible during subsequent loads', () => {
|
|
406
407
|
mockBills.mockImplementationOnce(() => ({
|
|
407
408
|
bills: mockBillsData,
|
|
408
409
|
isLoading: true,
|
|
409
410
|
isValidating: true,
|
|
410
411
|
error: null,
|
|
411
|
-
mutate:
|
|
412
|
+
mutate: vi.fn(),
|
|
412
413
|
currentPage: 2,
|
|
413
414
|
totalCount: 50,
|
|
414
|
-
goTo:
|
|
415
|
+
goTo: vi.fn(),
|
|
415
416
|
}));
|
|
416
417
|
|
|
417
418
|
render(<BillsTable />);
|
|
@@ -424,6 +425,6 @@ describe('BillsTable', () => {
|
|
|
424
425
|
expect(screen.getByTitle('loading')).toBeInTheDocument();
|
|
425
426
|
|
|
426
427
|
// Should NOT show skeleton
|
|
427
|
-
expect(screen.
|
|
428
|
+
expect(screen.queryByTestId('bills-table-skeleton')).not.toBeInTheDocument();
|
|
428
429
|
});
|
|
429
430
|
});
|
package/src/config-schema.ts
CHANGED
|
@@ -95,12 +95,6 @@ export const configSchema = {
|
|
|
95
95
|
_description: 'The default page size',
|
|
96
96
|
_default: 10,
|
|
97
97
|
},
|
|
98
|
-
waiverPaymentModeUuid: {
|
|
99
|
-
_type: Type.String,
|
|
100
|
-
_description:
|
|
101
|
-
'Payment Mode UUID used for bill waivers. This UUID identifies the payment mode (e.g. waiver) used when posting a waiver payment to a bill.',
|
|
102
|
-
_default: 'eb6173cb-9678-4614-bbe1-0ccf7ed9d1d4',
|
|
103
|
-
},
|
|
104
98
|
};
|
|
105
99
|
|
|
106
100
|
/**
|
|
@@ -141,5 +135,4 @@ export interface BillingConfig {
|
|
|
141
135
|
};
|
|
142
136
|
defaultCurrency: string;
|
|
143
137
|
pageSize: number;
|
|
144
|
-
waiverPaymentModeUuid: string;
|
|
145
138
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { BrowserRouter, useLocation } from 'react-router-dom';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { SideNavLink } from '@carbon/react';
|
|
5
|
+
import { navigate } from '@openmrs/esm-framework';
|
|
6
|
+
|
|
7
|
+
export interface LinkConfig {
|
|
8
|
+
name: string;
|
|
9
|
+
title: string;
|
|
10
|
+
path: string;
|
|
11
|
+
icon?: React.ComponentType;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function DiscountRequestsLinkExtension({ config }: { config: LinkConfig }) {
|
|
15
|
+
const { title, path, icon: Icon } = config;
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const location = useLocation();
|
|
18
|
+
const spaBasePath = `${window.spaBase}/billable-services`;
|
|
19
|
+
|
|
20
|
+
const isActive = useMemo(() => {
|
|
21
|
+
const currentPath = location.pathname.replace(spaBasePath, '');
|
|
22
|
+
if (path === '' || path === '/') {
|
|
23
|
+
return currentPath === '' || currentPath === '/';
|
|
24
|
+
}
|
|
25
|
+
return currentPath.startsWith(`/${path}`);
|
|
26
|
+
}, [location.pathname, path, spaBasePath]);
|
|
27
|
+
|
|
28
|
+
const handleNavigation = () => {
|
|
29
|
+
navigate({ to: `${spaBasePath}/${path}` });
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<SideNavLink onClick={handleNavigation} renderIcon={Icon} isActive={isActive}>
|
|
34
|
+
{t(title)}
|
|
35
|
+
</SideNavLink>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const createDiscountRequestsLeftPanelLink = (config: LinkConfig) => () => (
|
|
40
|
+
<BrowserRouter>
|
|
41
|
+
<DiscountRequestsLinkExtension config={config} />
|
|
42
|
+
</BrowserRouter>
|
|
43
|
+
);
|