@kenyaemr/esm-billing-app 5.4.1-pre.2029 → 5.4.1-pre.2036
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/turbo-build.log +73 -73
- package/dist/290.js +1 -1
- package/dist/{970.js → 835.js} +1 -1
- package/dist/835.js.map +1 -0
- package/dist/kenyaemr-esm-billing-app.js +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +29 -29
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/billable-services/bill-manager/modals/delete-billable-service.modal.tsx +79 -0
- package/src/billable-services/bill-manager/modals/delete-billable-service.test.tsx +101 -0
- package/src/billable-services/billable-service.resource.tsx +14 -4
- package/src/billable-services/billables/charge-summary-table.component.tsx +13 -3
- package/src/index.ts +1 -1
- package/dist/970.js.map +0 -1
- package/src/billable-services/bill-manager/modals/serviceItemCard.component.tsx +0 -10
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}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","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","slot":"patient-chart-dashboard-slot","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":"require-billing-modal","component":"requirePaymentModal"},{"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":"billingOverviewLink","name":"billing-overview-link","order":0,"slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","order":0,"slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"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"}],"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":"addCommodityForm","title":"Create Charge Item 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":"bill-deposit-workspace","component":"billDepositWorkspace","title":"Bill Deposit 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":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"}],"version":"5.4.1-pre.
|
|
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}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","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","slot":"patient-chart-dashboard-slot","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":"require-billing-modal","component":"requirePaymentModal"},{"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":"billingOverviewLink","name":"billing-overview-link","order":0,"slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","order":0,"slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"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"}],"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":"addCommodityForm","title":"Create Charge Item 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":"bill-deposit-workspace","component":"billDepositWorkspace","title":"Bill Deposit 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":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"}],"version":"5.4.1-pre.2036"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ModalBody, ModalFooter, Button, InlineLoading, ModalHeader } from '@carbon/react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { type ChargeAble } from '../../billables/charge-summary.resource';
|
|
5
|
+
import { deleteBillableService } from '../../billable-service.resource';
|
|
6
|
+
import { showSnackbar, restBaseUrl } from '@openmrs/esm-framework';
|
|
7
|
+
import { mutate } from 'swr';
|
|
8
|
+
|
|
9
|
+
type DeleteBillableServiceModalProps = {
|
|
10
|
+
closeModal: () => void;
|
|
11
|
+
chargeableItem: ChargeAble;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const DeleteBillableServiceModal: React.FC<DeleteBillableServiceModalProps> = ({ closeModal, chargeableItem }) => {
|
|
15
|
+
const [isDeleting, setIsDeleting] = React.useState(false);
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
|
|
18
|
+
const handleMutation = () => {
|
|
19
|
+
const url = `${restBaseUrl}/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(uuid,display),servicePrices:(uuid,name,paymentMode,price),concept:(uuid,display))`;
|
|
20
|
+
mutate((key) => typeof key === 'string' && key.startsWith(url), undefined, { revalidate: true });
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleDelete = () => {
|
|
24
|
+
setIsDeleting(true);
|
|
25
|
+
const chargeableItemUuid = chargeableItem?.uuid;
|
|
26
|
+
if (chargeableItemUuid) {
|
|
27
|
+
deleteBillableService(chargeableItemUuid)
|
|
28
|
+
.then(() => {
|
|
29
|
+
showSnackbar({
|
|
30
|
+
title: t('deleteChargeableItemSuccess', 'Chargeable item deleted successfully'),
|
|
31
|
+
subtitle: t('deleteChargeableItemSuccessMessage', 'The chargeable item has been deleted successfully.'),
|
|
32
|
+
kind: 'success',
|
|
33
|
+
isLowContrast: true,
|
|
34
|
+
timeoutInMs: 5000,
|
|
35
|
+
});
|
|
36
|
+
handleMutation();
|
|
37
|
+
closeModal();
|
|
38
|
+
})
|
|
39
|
+
.catch((error) => {
|
|
40
|
+
showSnackbar({
|
|
41
|
+
title: t('deleteChargeableItemError', 'Error deleting chargeable item'),
|
|
42
|
+
subtitle: t('deleteChargeableItemErrorMessage', 'An error occurred while deleting the chargeable item.'),
|
|
43
|
+
isLowContrast: true,
|
|
44
|
+
timeoutInMs: 5000,
|
|
45
|
+
kind: 'error',
|
|
46
|
+
});
|
|
47
|
+
})
|
|
48
|
+
.finally(() => {
|
|
49
|
+
setIsDeleting(false);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<ModalHeader closeModal={closeModal} title={t('deleteChargeableItems', 'Delete Chargeable Item')} />
|
|
56
|
+
<ModalBody>
|
|
57
|
+
<p>
|
|
58
|
+
{t('deleteChargeableItemMessage', 'Are you sure you want to delete the chargeable item {{name}}?', {
|
|
59
|
+
name: chargeableItem?.name,
|
|
60
|
+
})}
|
|
61
|
+
</p>
|
|
62
|
+
</ModalBody>
|
|
63
|
+
<ModalFooter>
|
|
64
|
+
<Button kind="secondary" onClick={closeModal}>
|
|
65
|
+
{t('cancel', 'Cancel')}
|
|
66
|
+
</Button>
|
|
67
|
+
<Button kind="danger" onClick={handleDelete} disabled={isDeleting}>
|
|
68
|
+
{isDeleting ? (
|
|
69
|
+
<InlineLoading description={t('deleting', 'Deleting') + '...'} />
|
|
70
|
+
) : (
|
|
71
|
+
<span>{t('delete', 'Delete')}</span>
|
|
72
|
+
)}
|
|
73
|
+
</Button>
|
|
74
|
+
</ModalFooter>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default DeleteBillableServiceModal;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import DeleteBillableServiceModal from './delete-billable-service.modal';
|
|
5
|
+
import { deleteBillableService } from '../../billable-service.resource';
|
|
6
|
+
import { showSnackbar } from '@openmrs/esm-framework';
|
|
7
|
+
import type { ChargeAble } from '../../billables/charge-summary.resource';
|
|
8
|
+
|
|
9
|
+
jest.mock('../../billable-service.resource', () => ({
|
|
10
|
+
deleteBillableService: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
jest.mock('@openmrs/esm-framework', () => ({
|
|
13
|
+
showSnackbar: jest.fn(),
|
|
14
|
+
restBaseUrl: 'http://fake-api',
|
|
15
|
+
}));
|
|
16
|
+
jest.mock('swr', () => ({
|
|
17
|
+
mutate: jest.fn(),
|
|
18
|
+
}));
|
|
19
|
+
jest.mock('react-i18next', () => ({
|
|
20
|
+
useTranslation: () => ({
|
|
21
|
+
t: (key: string, defaultText: string) => defaultText,
|
|
22
|
+
}),
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
describe('<DeleteBillableServiceModal />', () => {
|
|
26
|
+
const fullItem: ChargeAble = {
|
|
27
|
+
uuid: '123',
|
|
28
|
+
name: 'Test Service',
|
|
29
|
+
shortName: 'TS',
|
|
30
|
+
serviceStatus: 'ENABLED',
|
|
31
|
+
stockItem: 'stock',
|
|
32
|
+
serviceType: { uuid: 'st-1', display: 'Service Type' },
|
|
33
|
+
servicePrices: [{ uuid: 'sp-1', name: 'Standard Price', price: 100 }],
|
|
34
|
+
concept: { uuid: 'c-1', display: 'Concept Display' },
|
|
35
|
+
};
|
|
36
|
+
const closeModal = jest.fn();
|
|
37
|
+
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
jest.clearAllMocks();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('renders header, message, and both buttons', () => {
|
|
43
|
+
render(<DeleteBillableServiceModal closeModal={closeModal} chargeableItem={fullItem} />);
|
|
44
|
+
|
|
45
|
+
expect(screen.getByText('Delete Chargeable Item')).toBeInTheDocument();
|
|
46
|
+
expect(screen.getByText(`Are you sure you want to delete the chargeable item {{name}}?`)).toBeInTheDocument();
|
|
47
|
+
|
|
48
|
+
expect(screen.getByRole('button', { name: 'Cancel' })).toBeEnabled();
|
|
49
|
+
expect(screen.getByRole('button', { name: /Delete/ })).toBeEnabled();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('invokes closeModal when cancel is clicked', async () => {
|
|
53
|
+
render(<DeleteBillableServiceModal closeModal={closeModal} chargeableItem={fullItem} />);
|
|
54
|
+
await userEvent.click(screen.getByRole('button', { name: 'Cancel' }));
|
|
55
|
+
expect(closeModal).toHaveBeenCalledTimes(1);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('performs delete flow and shows success snackbar', async () => {
|
|
59
|
+
(deleteBillableService as jest.Mock).mockResolvedValue(undefined);
|
|
60
|
+
|
|
61
|
+
render(<DeleteBillableServiceModal closeModal={closeModal} chargeableItem={fullItem} />);
|
|
62
|
+
|
|
63
|
+
const deleteBtn = screen.getByRole('button', { name: /Delete/ });
|
|
64
|
+
await userEvent.click(deleteBtn);
|
|
65
|
+
|
|
66
|
+
await waitFor(() => {
|
|
67
|
+
expect(deleteBillableService).toHaveBeenCalledWith(fullItem.uuid);
|
|
68
|
+
expect(showSnackbar).toHaveBeenCalledWith(
|
|
69
|
+
expect.objectContaining({
|
|
70
|
+
title: 'Chargeable item deleted successfully',
|
|
71
|
+
kind: 'success',
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(closeModal).toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// button re-enabled
|
|
79
|
+
expect(screen.getByRole('button', { name: /Delete/ })).toBeEnabled();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('shows error snackbar on delete failure', async () => {
|
|
83
|
+
(deleteBillableService as jest.Mock).mockRejectedValue(new Error('failure'));
|
|
84
|
+
|
|
85
|
+
render(<DeleteBillableServiceModal closeModal={closeModal} chargeableItem={fullItem} />);
|
|
86
|
+
|
|
87
|
+
await userEvent.click(screen.getByRole('button', { name: /Delete/ }));
|
|
88
|
+
|
|
89
|
+
await waitFor(() => {
|
|
90
|
+
expect(showSnackbar).toHaveBeenCalledWith(
|
|
91
|
+
expect.objectContaining({
|
|
92
|
+
title: 'Error deleting chargeable item',
|
|
93
|
+
kind: 'error',
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
expect(closeModal).not.toHaveBeenCalled();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
expect(screen.getByRole('button', { name: /Delete/ })).toBeEnabled();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -40,11 +40,21 @@ export const createBillableService = (payload: any, uuid?: string) => {
|
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a billable service by its unique identifier (UUID).
|
|
45
|
+
*
|
|
46
|
+
* @param uuid - The unique identifier of the billable service to be deleted.
|
|
47
|
+
* @returns A promise that resolves with the response of the DELETE request.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* This function sends a DELETE request to the OpenMRS REST API endpoint
|
|
51
|
+
* for billable services. Ensure that the `uuid` provided corresponds to
|
|
52
|
+
* an existing billable service.
|
|
53
|
+
*/
|
|
54
|
+
export const deleteBillableService = (uuid: string) => {
|
|
55
|
+
const url = `/ws/rest/v1/cashier/api/billable-service/${uuid}`;
|
|
45
56
|
return openmrsFetch(url, {
|
|
46
|
-
method: '
|
|
47
|
-
body: payload,
|
|
57
|
+
method: 'DELETE',
|
|
48
58
|
headers: {
|
|
49
59
|
'Content-Type': 'application/json',
|
|
50
60
|
},
|
|
@@ -25,7 +25,7 @@ import React, { useMemo, useState } from 'react';
|
|
|
25
25
|
import { useTranslation } from 'react-i18next';
|
|
26
26
|
import { convertToCurrency } from '../../helpers';
|
|
27
27
|
import styles from './charge-summary-table.scss';
|
|
28
|
-
import { useChargeSummaries } from './charge-summary.resource';
|
|
28
|
+
import { type ChargeAble, useChargeSummaries } from './charge-summary.resource';
|
|
29
29
|
import { downloadExcelTemplateFile, searchTableData } from './form-helper';
|
|
30
30
|
|
|
31
31
|
const defaultPageSize = 10;
|
|
@@ -82,8 +82,12 @@ const ChargeSummaryTable: React.FC = () => {
|
|
|
82
82
|
};
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
const handleDelete = (chargeableItem: ChargeAble) => {
|
|
86
|
+
const dispose = showModal('delete-billableservice-modal', {
|
|
87
|
+
closeModal: () => dispose(),
|
|
88
|
+
chargeableItem,
|
|
89
|
+
});
|
|
90
|
+
};
|
|
87
91
|
|
|
88
92
|
const handleEdit = (service) => {
|
|
89
93
|
Boolean(service?.serviceType?.display)
|
|
@@ -188,6 +192,12 @@ const ChargeSummaryTable: React.FC = () => {
|
|
|
188
192
|
itemText={t('editChargeItem', 'Edit charge item')}
|
|
189
193
|
onClick={() => handleEdit(results[index])}
|
|
190
194
|
/>
|
|
195
|
+
<OverflowMenuItem
|
|
196
|
+
hasDivider
|
|
197
|
+
isDelete
|
|
198
|
+
itemText={t('deleteChargeItem', 'Delete charge item')}
|
|
199
|
+
onClick={() => handleDelete(results[index])}
|
|
200
|
+
/>
|
|
191
201
|
</OverflowMenu>
|
|
192
202
|
</TableCell>
|
|
193
203
|
</TableRow>
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import RefundLineItem from './billable-services/bill-manager/bill-actions/refund
|
|
|
11
11
|
import WaiveBillActionButton from './billable-services/bill-manager/bill-actions/waive-bill-action-button.component';
|
|
12
12
|
import { DeleteBillModal } from './billable-services/bill-manager/modals/delete-bill.modal';
|
|
13
13
|
import { RefundBillModal } from './billable-services/bill-manager/modals/refund-bill.modal';
|
|
14
|
-
import
|
|
14
|
+
import DeleteBillableServiceModal from './billable-services/bill-manager/modals/delete-billable-service.modal';
|
|
15
15
|
import CreateBillItemModal from './billable-services/bill-manager/modals/create-bill-item-modal.component';
|
|
16
16
|
import CancelBillWorkspace from './billable-services/bill-manager/workspaces/cancel-bill/cancel-bill.workspace';
|
|
17
17
|
import { EditBillForm } from './billable-services/bill-manager/workspaces/edit-bill/edit-bill-form.workspace';
|