@kenyaemr/esm-billing-app 5.3.10-pre.1666 → 5.3.10-pre.1678

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","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","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":"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"}],"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"}],"version":"5.3.10-pre.1666"}
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":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","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","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":"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"}],"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"}],"version":"5.3.10-pre.1678"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.3.10-pre.1666",
3
+ "version": "5.3.10-pre.1678",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "browser": "dist/kenyaemr-esm-billing-app.js",
6
6
  "main": "src/index.ts",
@@ -56,7 +56,7 @@ const TestOrderAction: React.FC<TestOrderProps> = (props) => {
56
56
  order,
57
57
  ...(additionalProps && { additionalProps }),
58
58
  });
59
- }, [order, additionalProps, modalName, handleModalClose]);
59
+ }, [isDispenseOrder, modalName, order, additionalProps, dispenseFormProps, handleModalClose]);
60
60
 
61
61
  if (isLoading) {
62
62
  return (
@@ -80,6 +80,7 @@ const TestOrderAction: React.FC<TestOrderProps> = (props) => {
80
80
  <Button
81
81
  kind="primary"
82
82
  className={!isDispenseOrder ? styles.actionButton : ''}
83
+ size={!isDispenseOrder ? 'md' : ''}
83
84
  disabled={hasPendingPayment}
84
85
  onClick={launchModal}>
85
86
  {buttonText}
@@ -1,22 +1,42 @@
1
- import { FetchResponse, openmrsFetch, useConfig } from '@openmrs/esm-framework';
1
+ import { FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
2
  import useSWR from 'swr';
3
- import { BillingConfig } from '../config-schema';
4
3
  import { SHAIntervension } from '../types';
5
- import { interventions } from './benefits.mock';
6
4
 
7
5
  export const useInterventions = (code: string) => {
8
- const { hieBaseUrl } = useConfig<BillingConfig>();
9
-
10
- const url = `${hieBaseUrl}/master/benefit-master/code?searchKey=${code}`;
11
- const { isLoading, error, data } = useSWR<Array<SHAIntervension>>(url, async (key) => {
12
- await new Promise((resolve, reject) => {
13
- setTimeout(resolve, 2000);
6
+ const fetcher = (url: string) => {
7
+ return openmrsFetch(url, {
8
+ method: 'POST',
9
+ body: {
10
+ searchKeyAndValues: {
11
+ // scheme_code: 'UHC',
12
+ package_code: code,
13
+ },
14
+ },
14
15
  });
15
- return interventions?.filter((inter) => inter.interventionCode.includes(code));
16
- });
16
+ };
17
+ const url = `${restBaseUrl}/insuranceclaims/claims/interventions/query?code=${code}`;
18
+ const { isLoading, error, data } = useSWR<
19
+ FetchResponse<{
20
+ status: string;
21
+ data: Array<{
22
+ interventionName: string;
23
+ interventionCode: string;
24
+ interventionPackage: string;
25
+ interventionSubPackage: string;
26
+ interventionDescription?: string;
27
+ }>;
28
+ }>
29
+ >(url, fetcher);
17
30
  return {
18
31
  isLoading,
19
- interventions: data ?? [],
32
+ interventions: (data?.data?.data ?? []).map(
33
+ ({ interventionCode, interventionName, interventionPackage, interventionSubPackage, interventionDescription }) =>
34
+ ({
35
+ interventionCode,
36
+ subCategoryBenefitsPackage: interventionSubPackage,
37
+ interventionName,
38
+ } as SHAIntervension),
39
+ ),
20
40
  error,
21
41
  };
22
42
  };
@@ -1,35 +1,27 @@
1
- import { FetchResponse, openmrsFetch, useConfig } from '@openmrs/esm-framework';
1
+ import { FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
2
  import useSWR from 'swr';
3
- import { BillingConfig } from '../config-schema';
4
3
  import { Package } from '../types';
5
- import { category } from './benefits.mock';
6
4
 
7
5
  /**
8
6
  * Hook that return a list of sha benefits category/packages
9
7
  * @returns
10
8
  */
11
9
  const usePackages = () => {
12
- const { hieBaseUrl } = useConfig<BillingConfig>();
13
- const url = `${hieBaseUrl}/master/category/all-`;
10
+ const url = `${restBaseUrl}/insuranceclaims/claims/benefit-package`;
14
11
 
15
- const { data, isLoading, error } = useSWR<Array<{ id: number; code: string; categoryName: string }>>(
12
+ const { data, isLoading, error } = useSWR<FetchResponse<Array<{ code: string; name: string; description: string }>>>(
16
13
  url,
17
- async () => {
18
- await new Promise((resolve, reject) => {
19
- setTimeout(resolve, 2000);
20
- });
21
- return category;
22
- },
14
+ openmrsFetch,
23
15
  );
24
16
 
25
17
  return {
26
18
  isLoading,
27
- packages: (data ?? []).map(
19
+ packages: (data?.data ?? []).map(
28
20
  (category) =>
29
21
  ({
30
- uuid: `${category.id}`,
22
+ uuid: `${category.code}`,
31
23
  packageCode: category.code,
32
- packageName: category.categoryName,
24
+ packageName: category.name,
33
25
  } as Package),
34
26
  ),
35
27
  error,
@@ -23,7 +23,7 @@ import { LineItem } from '../types';
23
23
  import InvoiceTable from './invoice-table.component';
24
24
  import styles from './invoice.scss';
25
25
  import Payments from './payments/payments.component';
26
- import PrintPaidBillReceiptAction from './print-bill-receipt/print-receipt-action.component';
26
+ import ReceiptPrintButton from './print-bill-receipt/receipt-print-button.component';
27
27
  import PrintableInvoice from './printable-invoice/printable-invoice.component';
28
28
 
29
29
  interface InvoiceDetailsProps {
@@ -130,7 +130,7 @@ const Invoice: React.FC = () => {
130
130
  </section>
131
131
  </div>
132
132
  <div className={styles.actionArea}>
133
- <PrintPaidBillReceiptAction bill={bill} />
133
+ <ReceiptPrintButton bill={bill} />
134
134
  <Button
135
135
  onClick={handlePrint}
136
136
  kind="tertiary"
@@ -0,0 +1,55 @@
1
+ import { Button } from '@carbon/react';
2
+ import { Printer } from '@carbon/react/icons';
3
+ import { showModal } from '@openmrs/esm-framework';
4
+ import React from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { MappedBill, PaymentStatus } from '../../types';
7
+
8
+ interface ReceiptPrintButtonProps {
9
+ bill: MappedBill;
10
+ }
11
+
12
+ const ReceiptPrintButton: React.FC<ReceiptPrintButtonProps> = ({ bill }) => {
13
+ const { t } = useTranslation();
14
+
15
+ const isPrintingDisabled = shouldDisablePrinting(bill);
16
+
17
+ const handlePrintClick = () => {
18
+ const dispose = showModal('paid-bill-receipt-print-preview-modal', {
19
+ onClose: () => dispose(),
20
+ bill,
21
+ });
22
+ };
23
+
24
+ return (
25
+ <Button
26
+ kind="secondary"
27
+ size="sm"
28
+ disabled={isPrintingDisabled}
29
+ onClick={handlePrintClick}
30
+ renderIcon={Printer}
31
+ iconDescription={t('printReceipt', 'Print receipt')}>
32
+ {t('printReceipt', 'Print receipt')}
33
+ </Button>
34
+ );
35
+ };
36
+
37
+ /**
38
+ * Determines if receipt printing should be disabled based on bill status
39
+ * @param bill - The bill to check
40
+ * @returns true if printing should be disabled, false otherwise
41
+ */
42
+ function shouldDisablePrinting(bill: MappedBill): boolean {
43
+ const hasPayments = bill.payments.length > 0;
44
+ const hasExemptedItems = bill.lineItems.some((item) => item.paymentStatus === PaymentStatus.EXEMPTED);
45
+
46
+ // If there are exempted items, we need special handling
47
+ if (hasExemptedItems) {
48
+ return !hasExemptedItems;
49
+ }
50
+
51
+ // For regular bills, disable if there are no payments
52
+ return !hasPayments;
53
+ }
54
+
55
+ export default ReceiptPrintButton;
@@ -234,7 +234,6 @@
234
234
  "printingInvoice": "Printing invoice...",
235
235
  "printInvoice": "Print invoice",
236
236
  "printReceipt": "Print receipt",
237
- "printRecept": "Print receipt",
238
237
  "proceedToCare": "Proceed to care",
239
238
  "processClaim": "Process Claim",
240
239
  "processing": "Processing...",