@kenyaemr/esm-billing-app 5.4.2-pre.2354 → 5.4.2-pre.2358
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 +4 -4
- package/dist/{985.js → 452.js} +1 -1
- package/dist/452.js.map +1 -0
- package/dist/kenyaemr-esm-billing-app.js +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +27 -27
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/billable-services/billiable-item/order-actions/components/medication-order-button.component.tsx +10 -9
- package/src/billable-services/billiable-item/order-actions/hooks/useModalHandler.ts +39 -2
- package/src/invoice/invoice-actions.component.tsx +257 -0
- package/src/invoice/invoice.component.tsx +14 -257
- package/dist/985.js.map +0 -1
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":"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-group-nav-slot"},{"component":"billDepositDashboardLink","name":"bill-deposit-dashboard-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-group-nav-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-group-nav-slot"},{"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":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","type":"other-form"},{"name":"payment-workspace","component":"paymentWorkspace","title":"Payment Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"},{"name":"delete-deposit-modal","component":"deleteDepositModal"},{"name":"reverse-transaction-modal","component":"reverseTransactionModal"},{"name":"print-preview-modal","component":"printPreviewModal"},{"name":"bill-action-modal","component":"billActionModal"}],"version":"5.4.2-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":"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-group-nav-slot"},{"component":"billDepositDashboardLink","name":"bill-deposit-dashboard-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-group-nav-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-group-nav-slot"},{"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":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","type":"other-form"},{"name":"payment-workspace","component":"paymentWorkspace","title":"Payment Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"},{"name":"delete-deposit-modal","component":"deleteDepositModal"},{"name":"reverse-transaction-modal","component":"reverseTransactionModal"},{"name":"print-preview-modal","component":"printPreviewModal"},{"name":"bill-action-modal","component":"billActionModal"}],"version":"5.4.2-pre.2358"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { Edit } from '@carbon/react/icons';
|
|
3
|
-
import { launchWorkspace
|
|
3
|
+
import { launchWorkspace } from '@openmrs/esm-framework';
|
|
4
4
|
import { BaseOrderButton } from './base-order-button.component';
|
|
5
5
|
import { useMedicationOrderAction, useOrderByUuid } from '../hooks/useMedicationOrderAction';
|
|
6
|
-
import { launchPrescriptionEditWorkspace } from '../hooks/useModalHandler';
|
|
6
|
+
import { launchPrescriptionEditWorkspace, navigateAndLaunchWorkspace } from '../hooks/useModalHandler';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { useVisitOrOfflineVisit } from '@openmrs/esm-patient-common-lib/src';
|
|
9
9
|
import { Button } from '@carbon/react';
|
|
@@ -46,12 +46,13 @@ const ModifyButton: React.FC<ModifyButtonProps> = ({ currentVisit, isLoading, or
|
|
|
46
46
|
kind="danger--tertiary"
|
|
47
47
|
size="lg"
|
|
48
48
|
onClick={() =>
|
|
49
|
-
navigateAndLaunchWorkspace(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
navigateAndLaunchWorkspace(
|
|
50
|
+
`\${openmrsSpaBase}/patient/${patientUuid}/chart`,
|
|
51
|
+
`patient/${patientUuid}`,
|
|
52
|
+
'start-visit-workspace-form',
|
|
53
|
+
{ patientUuid },
|
|
54
|
+
patientUuid,
|
|
55
|
+
)
|
|
55
56
|
}>
|
|
56
57
|
{t('activeVisitRequired', 'Start visit to modify')}
|
|
57
58
|
</Button>
|
|
@@ -75,7 +76,7 @@ export const MedicationOrderButton: React.FC<MedicationOrderButtonProps> = ({
|
|
|
75
76
|
} = useMedicationOrderAction(medicationRequestBundle);
|
|
76
77
|
const { data: order, isLoading: isOrderLoading } = useOrderByUuid(medicationRequestBundle?.request?.id);
|
|
77
78
|
const isLoading = isMedicationOrderLoading && isOrderLoading;
|
|
78
|
-
const { currentVisit } = useVisitOrOfflineVisit(patientUuid);
|
|
79
|
+
const { activeVisit: currentVisit } = useVisitOrOfflineVisit(patientUuid);
|
|
79
80
|
const buttonText = actionText ?? defaultButtonText;
|
|
80
81
|
|
|
81
82
|
const launchModal = useCallback(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { launchWorkspace } from '@openmrs/esm-framework';
|
|
1
|
+
import { launchWorkspace, navigate, getGlobalStore } from '@openmrs/esm-framework';
|
|
2
2
|
import { getPatientChartStore, Order } from '@openmrs/esm-patient-common-lib';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { mutate } from 'swr';
|
|
@@ -19,6 +19,10 @@ export function useModalHandler(mutateUrl?: string) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export const getWorkspaceStore = () => {
|
|
23
|
+
return getGlobalStore('workspace');
|
|
24
|
+
};
|
|
25
|
+
|
|
22
26
|
export const launchPrescriptionEditWorkspace = (order: Order, patientUuid: string) => {
|
|
23
27
|
const newItem = {
|
|
24
28
|
uuid: order.uuid,
|
|
@@ -67,5 +71,38 @@ export const launchPrescriptionEditWorkspace = (order: Order, patientUuid: strin
|
|
|
67
71
|
patientUuid,
|
|
68
72
|
});
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
const targetUrl = `\${openmrsSpaBase}/patient/${patientUuid}/chart/Medications`;
|
|
75
|
+
const workspaceName = 'add-drug-order';
|
|
76
|
+
const additionalProps = {
|
|
77
|
+
patientUuid,
|
|
78
|
+
order: newItem,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
navigateAndLaunchWorkspace(targetUrl, `patient/${patientUuid}`, workspaceName, additionalProps, patientUuid);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const navigateAndLaunchWorkspace = (
|
|
85
|
+
targetUrl: string,
|
|
86
|
+
contextKey: string,
|
|
87
|
+
workspaceName: string,
|
|
88
|
+
additionalProps: any,
|
|
89
|
+
patientUuid: string,
|
|
90
|
+
) => {
|
|
91
|
+
const workspaceStore = getWorkspaceStore();
|
|
92
|
+
|
|
93
|
+
// Set up a one-time event listener for when navigation completes
|
|
94
|
+
const handleRoutingComplete = (event: Event) => {
|
|
95
|
+
// Remove the listener after it fires once
|
|
96
|
+
window.removeEventListener('single-spa:routing-event', handleRoutingComplete);
|
|
97
|
+
|
|
98
|
+
// Now that navigation is complete, change context and launch workspace
|
|
99
|
+
workspaceStore.setState({ context: `patient/${patientUuid}`, openWorkspaces: [], prompt: null });
|
|
100
|
+
launchWorkspace(workspaceName, additionalProps);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Add the event listener before navigating
|
|
104
|
+
window.addEventListener('single-spa:routing-event', handleRoutingComplete);
|
|
105
|
+
|
|
106
|
+
// Navigate to the target URL
|
|
107
|
+
navigate({ to: targetUrl });
|
|
71
108
|
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { Button, Popover, PopoverContent } from '@carbon/react';
|
|
2
|
+
import { Close, Printer, Wallet, FolderOpen, BaggageClaim } from '@carbon/react/icons';
|
|
3
|
+
import {
|
|
4
|
+
launchWorkspace,
|
|
5
|
+
restBaseUrl,
|
|
6
|
+
showModal,
|
|
7
|
+
UserHasAccess,
|
|
8
|
+
useFeatureFlag,
|
|
9
|
+
useVisit,
|
|
10
|
+
useVisitContextStore,
|
|
11
|
+
defaultVisitCustomRepresentation,
|
|
12
|
+
navigate,
|
|
13
|
+
showSnackbar,
|
|
14
|
+
showToast,
|
|
15
|
+
updateVisit,
|
|
16
|
+
} from '@openmrs/esm-framework';
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { useParams } from 'react-router-dom';
|
|
20
|
+
import { mutate } from 'swr';
|
|
21
|
+
import { convertToCurrency } from '../helpers';
|
|
22
|
+
import { MappedBill, LineItem } from '../types';
|
|
23
|
+
import { spaBasePath } from '../constants';
|
|
24
|
+
import { useCheckShareGnum } from './invoice.resource';
|
|
25
|
+
import styles from './invoice.scss';
|
|
26
|
+
import startCase from 'lodash-es/startCase';
|
|
27
|
+
|
|
28
|
+
interface InvoiceActionsProps {
|
|
29
|
+
readonly bill: MappedBill;
|
|
30
|
+
readonly selectedLineItems?: LineItem[];
|
|
31
|
+
readonly activeVisit?: any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function InvoiceActions({ bill, selectedLineItems = [], activeVisit }: InvoiceActionsProps) {
|
|
35
|
+
const { t } = useTranslation();
|
|
36
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
37
|
+
const { billUuid, patientUuid } = useParams();
|
|
38
|
+
const { checkSHARegNum } = useCheckShareGnum();
|
|
39
|
+
const { patientUuid: visitStorePatientUuid, manuallySetVisitUuid } = useVisitContextStore();
|
|
40
|
+
const isProcessClaimsFormEnabled = useFeatureFlag('healthInformationExchange');
|
|
41
|
+
|
|
42
|
+
const isInsurancePayment = (payments) => {
|
|
43
|
+
return payments?.some((payment) => payment.instanceType.name === 'Insurance');
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const isShaFacilityStatusValid =
|
|
47
|
+
checkSHARegNum?.registrationNumber && checkSHARegNum.registrationNumber.trim() !== '';
|
|
48
|
+
|
|
49
|
+
const launchBillCloseOrReopenModal = (action: 'close' | 'reopen') => {
|
|
50
|
+
const dispose = showModal('bill-action-modal', {
|
|
51
|
+
closeModal: () => dispose(),
|
|
52
|
+
bill: bill,
|
|
53
|
+
action,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const shouldCloseBill = bill.balance === 0 && !bill.closed;
|
|
58
|
+
|
|
59
|
+
const handlePrint = (documentType: string, documentTitle: string) => {
|
|
60
|
+
const dispose = showModal('print-preview-modal', {
|
|
61
|
+
onClose: () => dispose(),
|
|
62
|
+
title: documentTitle,
|
|
63
|
+
documentUrl: `/openmrs${restBaseUrl}/cashier/print?documentType=${documentType}&billId=${bill?.id}`,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleBillPayment = () => {
|
|
68
|
+
const dispose = showModal('initiate-payment-modal', {
|
|
69
|
+
closeModal: () => dispose(),
|
|
70
|
+
bill: bill,
|
|
71
|
+
selectedLineItems,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const mutateClaimForm = async () => {
|
|
76
|
+
const activeVisitUrlSuffix = `?patient=${patientUuid}&v=${defaultVisitCustomRepresentation}&includeInactive=false`;
|
|
77
|
+
const retrospectiveVisitUuid = patientUuid && visitStorePatientUuid == patientUuid ? manuallySetVisitUuid : null;
|
|
78
|
+
const retrospectiveVisitUrlSuffix = `/${retrospectiveVisitUuid}?v=${defaultVisitCustomRepresentation}`;
|
|
79
|
+
const activeVisitUrl = `${restBaseUrl}/visit${activeVisitUrlSuffix}`;
|
|
80
|
+
const retroVisitUrl = `${restBaseUrl}/visit${retrospectiveVisitUrlSuffix}`;
|
|
81
|
+
await mutate((key) => typeof key === 'string' && (key.startsWith(activeVisitUrl) || key.startsWith(retroVisitUrl)));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const handleEndVisit = async () => {
|
|
85
|
+
if (activeVisit) {
|
|
86
|
+
const endVisitPayload = {
|
|
87
|
+
stopDatetime: new Date(),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const abortController = new AbortController();
|
|
91
|
+
try {
|
|
92
|
+
await updateVisit(activeVisit.uuid, endVisitPayload, abortController);
|
|
93
|
+
await mutateClaimForm();
|
|
94
|
+
showSnackbar({
|
|
95
|
+
isLowContrast: true,
|
|
96
|
+
kind: 'success',
|
|
97
|
+
subtitle: t('visitEndSuccessssfully', 'visit ended successfully'),
|
|
98
|
+
title: t('visitEnded', 'Visit ended'),
|
|
99
|
+
});
|
|
100
|
+
} catch (error) {
|
|
101
|
+
showSnackbar({
|
|
102
|
+
title: t('errorEndingVisit', 'Error ending visit'),
|
|
103
|
+
kind: 'error',
|
|
104
|
+
isLowContrast: false,
|
|
105
|
+
subtitle: error?.message,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const handleViewClaims = async () => {
|
|
112
|
+
if (!isShaFacilityStatusValid) {
|
|
113
|
+
showToast({
|
|
114
|
+
critical: true,
|
|
115
|
+
kind: 'warning',
|
|
116
|
+
title: t('shaFacilityLicenseNumberRequired', 'Facility license number Required'),
|
|
117
|
+
description: t(
|
|
118
|
+
'shaFacilityLicenseNumbernRequiredDescription',
|
|
119
|
+
'Facility license number is required to process claims. Please update facility license number details.',
|
|
120
|
+
),
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (activeVisit) {
|
|
126
|
+
await handleEndVisit();
|
|
127
|
+
navigate({ to: `${spaBasePath}/billing/patient/${patientUuid}/${billUuid}/claims` });
|
|
128
|
+
} else {
|
|
129
|
+
navigate({ to: `${spaBasePath}/billing/patient/${patientUuid}/${billUuid}/claims` });
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<div className="invoiceSummaryActions">
|
|
135
|
+
<Popover isTabTip align="bottom-right" onKeyDown={() => {}} onRequestClose={() => setIsOpen(false)} open={isOpen}>
|
|
136
|
+
<button
|
|
137
|
+
className={styles.printButton}
|
|
138
|
+
aria-expanded
|
|
139
|
+
aria-label="Settings"
|
|
140
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
141
|
+
type="button">
|
|
142
|
+
<span className={styles.printButtonContent}>
|
|
143
|
+
<span className={styles.printButtonText}>{t('print', 'Print')}</span>
|
|
144
|
+
<Printer />
|
|
145
|
+
</span>
|
|
146
|
+
</button>
|
|
147
|
+
<PopoverContent>
|
|
148
|
+
<div className={styles.popoverContent}>
|
|
149
|
+
<Button
|
|
150
|
+
kind="ghost"
|
|
151
|
+
size="sm"
|
|
152
|
+
onClick={() =>
|
|
153
|
+
handlePrint(
|
|
154
|
+
'invoice',
|
|
155
|
+
`${t('invoice', 'Invoice')} ${bill?.receiptNumber} - ${startCase(bill?.patientName)}`,
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
renderIcon={Printer}>
|
|
159
|
+
{t('printInvoice', 'Print Invoice')}
|
|
160
|
+
</Button>
|
|
161
|
+
<Button
|
|
162
|
+
kind="ghost"
|
|
163
|
+
size="sm"
|
|
164
|
+
onClick={() => {
|
|
165
|
+
const dispose = showModal('print-preview-modal', {
|
|
166
|
+
onClose: () => dispose(),
|
|
167
|
+
title: `${t('receipt', 'Receipt')} ${bill?.receiptNumber} - ${startCase(bill?.patientName)}`,
|
|
168
|
+
documentUrl: `/openmrs${restBaseUrl}/cashier/receipt?billId=${bill.id}`,
|
|
169
|
+
});
|
|
170
|
+
}}
|
|
171
|
+
renderIcon={Printer}>
|
|
172
|
+
{t('printReceipt', 'Print Receipt')}
|
|
173
|
+
</Button>
|
|
174
|
+
<Button
|
|
175
|
+
kind="ghost"
|
|
176
|
+
size="sm"
|
|
177
|
+
onClick={() =>
|
|
178
|
+
handlePrint(
|
|
179
|
+
'billstatement',
|
|
180
|
+
`${t('billStatement', 'Bill Statement')} ${bill?.receiptNumber} - ${startCase(bill?.patientName)}`,
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
renderIcon={Printer}>
|
|
184
|
+
{t('printBillStatement', 'Print Bill Statement')}
|
|
185
|
+
</Button>
|
|
186
|
+
</div>
|
|
187
|
+
</PopoverContent>
|
|
188
|
+
</Popover>
|
|
189
|
+
{shouldCloseBill && (
|
|
190
|
+
<UserHasAccess privilege="Close Cashier Bills">
|
|
191
|
+
<Button
|
|
192
|
+
kind="danger--ghost"
|
|
193
|
+
size="sm"
|
|
194
|
+
renderIcon={Close}
|
|
195
|
+
iconDescription="Add"
|
|
196
|
+
tooltipPosition="right"
|
|
197
|
+
onClick={() => launchBillCloseOrReopenModal('close')}>
|
|
198
|
+
{t('closeBill', 'Close Bill')}
|
|
199
|
+
</Button>
|
|
200
|
+
</UserHasAccess>
|
|
201
|
+
)}
|
|
202
|
+
{bill?.closed && (
|
|
203
|
+
<UserHasAccess privilege="Reopen Cashier Bills">
|
|
204
|
+
<Button
|
|
205
|
+
kind="ghost"
|
|
206
|
+
size="sm"
|
|
207
|
+
renderIcon={FolderOpen}
|
|
208
|
+
iconDescription="Add"
|
|
209
|
+
tooltipPosition="right"
|
|
210
|
+
onClick={() => launchBillCloseOrReopenModal('reopen')}>
|
|
211
|
+
{t('reopen', 'Reopen')}
|
|
212
|
+
</Button>
|
|
213
|
+
</UserHasAccess>
|
|
214
|
+
)}
|
|
215
|
+
<Button
|
|
216
|
+
kind="ghost"
|
|
217
|
+
size="sm"
|
|
218
|
+
renderIcon={Wallet}
|
|
219
|
+
iconDescription="Add"
|
|
220
|
+
tooltipPosition="right"
|
|
221
|
+
onClick={() =>
|
|
222
|
+
launchWorkspace('payment-workspace', {
|
|
223
|
+
bill,
|
|
224
|
+
workspaceTitle: t('additionalPayment', 'Additional Payment (Balance {{billBalance}})', {
|
|
225
|
+
billBalance: convertToCurrency(bill.balance),
|
|
226
|
+
}),
|
|
227
|
+
})
|
|
228
|
+
}>
|
|
229
|
+
{t('additionalPayment', 'Additional Payment')}
|
|
230
|
+
</Button>
|
|
231
|
+
{bill?.balance !== 0 && (
|
|
232
|
+
<Button
|
|
233
|
+
onClick={handleBillPayment}
|
|
234
|
+
disabled={bill?.balance === 0}
|
|
235
|
+
size="sm"
|
|
236
|
+
renderIcon={Wallet}
|
|
237
|
+
iconDescription="Add"
|
|
238
|
+
tooltipPosition="left">
|
|
239
|
+
{t('mpesaPayment', 'MPESA Payment')}
|
|
240
|
+
</Button>
|
|
241
|
+
)}
|
|
242
|
+
|
|
243
|
+
{isProcessClaimsFormEnabled && isInsurancePayment(bill?.payments) && (
|
|
244
|
+
<Button
|
|
245
|
+
onClick={handleViewClaims}
|
|
246
|
+
disabled={bill?.status !== 'PAID'}
|
|
247
|
+
kind="danger"
|
|
248
|
+
size="sm"
|
|
249
|
+
renderIcon={BaggageClaim}
|
|
250
|
+
iconDescription="Add"
|
|
251
|
+
tooltipPosition="bottom">
|
|
252
|
+
{activeVisit ? t('endVisitAndClaim', 'End visit and Process claims') : t('claim', 'Process claims')}
|
|
253
|
+
</Button>
|
|
254
|
+
)}
|
|
255
|
+
</div>
|
|
256
|
+
);
|
|
257
|
+
}
|