@kenyaemr/esm-billing-app 5.4.1-pre.1964 → 5.4.1-pre.1966

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":"order-action-button","component":"orderActionButton","slot":"prescription-action-button-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":"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"},{"name":"create-bill-item-modal","component":"createBillItemModal"}],"version":"5.4.1-pre.1964"}
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"}],"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.1966"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.4.1-pre.1964",
3
+ "version": "5.4.1-pre.1966",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "browser": "dist/kenyaemr-esm-billing-app.js",
6
6
  "main": "src/index.ts",
@@ -0,0 +1,40 @@
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+
5
+ .form {
6
+ display: flex;
7
+ flex-direction: column;
8
+ justify-content: space-between;
9
+ height: 100%;
10
+ }
11
+
12
+ .formContainer {
13
+ display: flex;
14
+ flex-direction: column;
15
+ margin: layout.$spacing-05;
16
+ row-gap: layout.$spacing-03;
17
+ }
18
+
19
+ .formField {
20
+ margin-bottom: layout.$spacing-05;
21
+ @include type.type-style('label-02');
22
+ color: colors.$gray-70;
23
+ }
24
+
25
+ .button {
26
+ height: layout.$spacing-10;
27
+ display: flex;
28
+ align-content: flex-start;
29
+ align-items: baseline;
30
+ min-width: 50%;
31
+ }
32
+
33
+ .tablet {
34
+ padding: layout.$spacing-06 layout.$spacing-05;
35
+ background-color: colors.$white-0;
36
+ }
37
+
38
+ .desktop {
39
+ padding: 0;
40
+ }
@@ -0,0 +1,158 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Dropdown, Button, ButtonSet, Form, InlineLoading, InlineNotification } from '@carbon/react';
3
+ import { type Order } from '@openmrs/esm-patient-common-lib';
4
+ import { useBillableItem } from '../../../billiable-item/useBillableItem';
5
+ import styles from './create-bill.style.scss';
6
+ import { Controller, useForm } from 'react-hook-form';
7
+ import {
8
+ type DefaultWorkspaceProps,
9
+ ResponsiveWrapper,
10
+ restBaseUrl,
11
+ useConfig,
12
+ useLayoutType,
13
+ } from '@openmrs/esm-framework';
14
+ import { useTranslation } from 'react-i18next';
15
+ import classNames from 'classnames';
16
+ import { convertToCurrency } from '../../../../helpers';
17
+ import { BillingConfig } from '../../../../config-schema';
18
+ import { z } from 'zod';
19
+ import { processBillItems } from '../../../../billing.resource';
20
+ import { mutate } from 'swr';
21
+
22
+ type CreateBillWorkspaceProps = DefaultWorkspaceProps & {
23
+ patientUuid: string;
24
+ order: Order;
25
+ };
26
+
27
+ const createBillFormSchema = z.object({
28
+ id: z.string().min(1),
29
+ text: z.string().min(1),
30
+ unitPrice: z.string().min(1),
31
+ });
32
+
33
+ type CreateBillFormSchema = z.infer<typeof createBillFormSchema>;
34
+
35
+ const CreateBillWorkspace: React.FC<CreateBillWorkspaceProps> = ({
36
+ patientUuid,
37
+ order,
38
+ closeWorkspace,
39
+ closeWorkspaceWithSavedChanges,
40
+ promptBeforeClosing,
41
+ }) => {
42
+ const { t } = useTranslation();
43
+ const defaultPaymentStatus = 'PENDING';
44
+ const isTablet = useLayoutType() === 'tablet';
45
+ const { cashPointUuid, cashierUuid } = useConfig<BillingConfig>();
46
+ const { billableItem, isLoading } = useBillableItem(order.concept.uuid);
47
+
48
+ const comboBoxItems =
49
+ billableItem?.servicePrices?.map((item) => ({
50
+ id: item.uuid,
51
+ text: `${item.paymentMode.name} - ${convertToCurrency(item.price)}`,
52
+ unitPrice: item.price,
53
+ })) ?? [];
54
+
55
+ const createBillForm = useForm<CreateBillFormSchema>({
56
+ defaultValues: {
57
+ id: '',
58
+ text: '',
59
+ unitPrice: '0',
60
+ },
61
+ });
62
+
63
+ const {
64
+ handleSubmit,
65
+ formState: { isValid, isDirty, isSubmitting, errors },
66
+ } = createBillForm;
67
+
68
+ const handleCreateBill = async (formData: CreateBillFormSchema) => {
69
+ const unitPrice = parseFloat(formData.unitPrice);
70
+ const createBillPayload = {
71
+ cashPoint: cashPointUuid,
72
+ cashier: cashierUuid,
73
+ patient: patientUuid,
74
+ status: 'PENDING',
75
+ lineItems: [
76
+ {
77
+ billableService: billableItem?.uuid,
78
+ lineItemOrder: 0,
79
+ quantity: 1,
80
+ price: unitPrice,
81
+ paymentStatus: defaultPaymentStatus,
82
+ priceUuid: '',
83
+ priceName: formData.text,
84
+ order: order.uuid,
85
+ },
86
+ ],
87
+ payments: [],
88
+ };
89
+ await processBillItems(createBillPayload);
90
+ mutate((key) => typeof key === 'string' && key.startsWith(`${restBaseUrl}/cashier/bill`), undefined, {
91
+ revalidate: true,
92
+ });
93
+ closeWorkspaceWithSavedChanges();
94
+ };
95
+
96
+ useEffect(() => {
97
+ if (isDirty) {
98
+ promptBeforeClosing(() => true);
99
+ }
100
+ }, [isDirty, promptBeforeClosing]);
101
+
102
+ return (
103
+ <Form className={styles.form} onSubmit={handleSubmit(handleCreateBill)}>
104
+ <div className={styles.formContainer}>
105
+ <ResponsiveWrapper>
106
+ <InlineNotification
107
+ aria-label="closes notification"
108
+ kind="info"
109
+ lowContrast
110
+ statusIconDescription="notification"
111
+ subtitle={t('createBillForOrder', 'Create bill for order {{order}} by selecting the correct unit price', {
112
+ order: order.concept.display,
113
+ })}
114
+ title={t('orderBillCreation', 'Order Bill Creation {{orderNumber}}', { orderNumber: order.orderNumber })}
115
+ />
116
+ </ResponsiveWrapper>
117
+ <ResponsiveWrapper>
118
+ <Controller
119
+ control={createBillForm.control}
120
+ name="unitPrice"
121
+ render={({ field }) => (
122
+ <Dropdown
123
+ {...field}
124
+ onChange={({ selectedItem }) => {
125
+ field.onChange(selectedItem?.unitPrice?.toString() || '');
126
+ createBillForm.setValue('id', selectedItem?.id || '');
127
+ createBillForm.setValue('text', selectedItem?.text || '');
128
+ }}
129
+ id="unit-price"
130
+ itemToString={(item) => item?.text || ''}
131
+ items={comboBoxItems}
132
+ label={t('selectUnitPrice', 'Select Unit Price')}
133
+ titleText={t('unitPrice', 'Unit Price')}
134
+ type="default"
135
+ invalid={!!errors.unitPrice}
136
+ invalidText={errors.unitPrice?.message}
137
+ />
138
+ )}
139
+ />
140
+ </ResponsiveWrapper>
141
+ </div>
142
+ <ButtonSet className={classNames({ [styles.tablet]: isTablet, [styles.desktop]: !isTablet })}>
143
+ <Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
144
+ {t('cancel', 'Cancel')}
145
+ </Button>
146
+ <Button className={styles.button} disabled={!isValid || !isDirty || isSubmitting} kind="primary" type="submit">
147
+ {isSubmitting ? (
148
+ <InlineLoading className={styles.spinner} description={t('creatingBill', 'Creating bill...')} />
149
+ ) : (
150
+ <span>{t('saveAndClose', 'Save & close')}</span>
151
+ )}
152
+ </Button>
153
+ </ButtonSet>
154
+ </Form>
155
+ );
156
+ };
157
+
158
+ export default CreateBillWorkspace;
@@ -1,39 +1,52 @@
1
1
  import React, { useCallback } from 'react';
2
- import { showModal } from '@openmrs/esm-framework';
2
+ import { launchWorkspace, showModal } from '@openmrs/esm-framework';
3
3
  import { Order } from '@openmrs/esm-patient-common-lib';
4
4
  import { BaseOrderButton } from './base-order-button.component';
5
5
  import { useLabOrderAction } from '../hooks/useLabOrderAction';
6
6
  import { useModalHandler } from '../hooks/useModalHandler';
7
7
  import styles from '../styles/order-action.scss';
8
8
 
9
- export interface LabOrderButtonProps {
9
+ export interface GenericOrderButtonProps {
10
10
  order?: Order;
11
11
  modalName?: string;
12
12
  additionalProps?: Record<string, unknown>;
13
13
  actionText?: string;
14
14
  }
15
15
 
16
- export const LabOrderButton: React.FC<LabOrderButtonProps> = ({
16
+ export const GenericOrderButton: React.FC<GenericOrderButtonProps> = ({
17
17
  order,
18
- modalName = 'pickup-lab-request-modal',
18
+ modalName,
19
19
  additionalProps,
20
20
  actionText,
21
21
  }) => {
22
- const { isLoading, isDisabled, buttonText: defaultButtonText, isInProgress } = useLabOrderAction(order);
22
+ const {
23
+ isLoading,
24
+ isDisabled,
25
+ buttonText: defaultButtonText,
26
+ isInProgress,
27
+ shouldShowBillModal,
28
+ } = useLabOrderAction(order);
23
29
 
24
30
  const { handleModalClose } = useModalHandler(additionalProps?.mutateUrl as string);
25
- const buttonText = actionText ?? defaultButtonText;
31
+ const buttonText = defaultButtonText ?? actionText;
26
32
 
27
33
  const launchModal = useCallback(() => {
28
- const dispose = showModal(modalName, {
29
- closeModal: () => {
30
- handleModalClose();
31
- dispose();
32
- },
33
- order,
34
- ...(additionalProps && { additionalProps }),
35
- });
36
- }, [modalName, order, additionalProps, handleModalClose]);
34
+ if (shouldShowBillModal) {
35
+ launchWorkspace('create-bill-workspace', {
36
+ order,
37
+ patientUuid: order?.patient?.uuid,
38
+ });
39
+ } else {
40
+ const dispose = showModal(modalName, {
41
+ closeModal: () => {
42
+ handleModalClose();
43
+ dispose();
44
+ },
45
+ order,
46
+ ...(additionalProps && { additionalProps }),
47
+ });
48
+ }
49
+ }, [modalName, order, additionalProps, handleModalClose, shouldShowBillModal]);
37
50
 
38
51
  if (isInProgress) {
39
52
  return null;
@@ -37,14 +37,10 @@ export const MedicationOrderButton: React.FC<MedicationOrderButtonProps> = ({
37
37
 
38
38
  const { handleModalClose } = useModalHandler(additionalProps?.mutateUrl as string);
39
39
  const buttonText = actionText ?? defaultButtonText;
40
-
41
40
  const launchModal = useCallback(() => {
42
41
  if (shouldShowBillModal) {
43
- const disposeBill = showModal(modalName ?? 'create-bill-item-modal', {
44
- closeModal: () => {
45
- handleModalClose();
46
- disposeBill();
47
- },
42
+ launchWorkspace('create-bill-workspace', {
43
+ patientUuid,
48
44
  medicationRequestBundle,
49
45
  });
50
46
  return;
@@ -1,8 +1,17 @@
1
1
  import React from 'react';
2
- import { LabOrderButton } from './lab-order-button.component';
2
+ import { GenericOrderButton } from './generic-button.component';
3
3
  import { MedicationOrderButton } from './medication-order-button.component';
4
+ const ORDER_TYPE = {
5
+ MEDICATION: 'Medication',
6
+ LAB: 'Test Order',
7
+ // For Procedure and Imaging Order types we use concept classes to differentiate them,
8
+ // we can use the concept class to determine which button to show
9
+ PROCEDURE: '8d490bf4-c2cc-11de-8d13-0010c6dffd0f',
10
+ IMAGING: '8caa332c-efe4-4025-8b18-3398328e1323',
11
+ };
4
12
 
5
13
  const OrderActionButton: React.FC<Record<string, any>> = (props) => {
14
+ const conceptClass = props?.order?.concept?.conceptClass?.uuid;
6
15
  if (Object.hasOwn(props, 'medicationRequestBundle')) {
7
16
  const { medicationRequestBundle, modalName, additionalProps, actionText, closeable } = props;
8
17
  return (
@@ -16,10 +25,40 @@ const OrderActionButton: React.FC<Record<string, any>> = (props) => {
16
25
  );
17
26
  }
18
27
 
19
- if (props.orderType === 'lab') {
28
+ if (props.order?.orderType?.name === ORDER_TYPE.LAB) {
29
+ const { order, modalName, additionalProps, actionText } = props;
30
+ return (
31
+ <GenericOrderButton
32
+ order={order}
33
+ modalName={modalName}
34
+ additionalProps={additionalProps}
35
+ actionText={actionText}
36
+ />
37
+ );
38
+ }
39
+
40
+ if (conceptClass === ORDER_TYPE.PROCEDURE) {
41
+ const { order, modalName, additionalProps, actionText } = props;
42
+
43
+ return (
44
+ <GenericOrderButton
45
+ order={order}
46
+ modalName={modalName}
47
+ additionalProps={additionalProps}
48
+ actionText={actionText}
49
+ />
50
+ );
51
+ }
52
+
53
+ if (conceptClass === ORDER_TYPE.IMAGING) {
20
54
  const { order, modalName, additionalProps, actionText } = props;
21
55
  return (
22
- <LabOrderButton order={order} modalName={modalName} additionalProps={additionalProps} actionText={actionText} />
56
+ <GenericOrderButton
57
+ order={order}
58
+ modalName={modalName}
59
+ additionalProps={additionalProps}
60
+ actionText={actionText}
61
+ />
23
62
  );
24
63
  }
25
64
 
@@ -10,18 +10,31 @@ export function useLabOrderAction(order?: Order) {
10
10
  const { t } = useTranslation();
11
11
  const orderUuid = order?.uuid;
12
12
  const patientUuid = order?.patient?.uuid;
13
+ const conceptClass = order?.concept?.conceptClass?.['display'];
13
14
 
14
- const { isLoading, hasPendingPayment } = useBillStatus(orderUuid, patientUuid);
15
-
15
+ const { isLoading, hasPendingPayment, itemHasBill } = useBillStatus(orderUuid, patientUuid);
16
+ const shouldShowBillModal = itemHasBill.length < 1;
16
17
  const isInProgress = order?.fulfillerStatus === FulfillerStatus.IN_PROGRESS;
17
- const buttonText = hasPendingPayment ? t('unsettledBill', 'Unsettled bill') : t('pickLabRequest', 'Pick Lab Request');
18
+
19
+ const getButtonText = () => {
20
+ if (hasPendingPayment) {
21
+ return t('unsettledBill', 'Unsettled bill');
22
+ }
23
+
24
+ if (shouldShowBillModal) {
25
+ return t('bill', 'Bill');
26
+ }
27
+
28
+ return t('pickLabRequest', 'Pick {{orderType}} Request', { orderType: conceptClass ?? 'Lab' });
29
+ };
18
30
 
19
31
  return {
20
32
  isLoading,
21
33
  isDisabled: hasPendingPayment,
22
- buttonText,
34
+ buttonText: getButtonText(),
23
35
  isInProgress,
24
36
  orderUuid,
25
37
  patientUuid,
38
+ shouldShowBillModal,
26
39
  };
27
40
  }
package/src/index.ts CHANGED
@@ -42,6 +42,7 @@ import { ClockOut } from './payment-points/payment-point/clock-out.modal';
42
42
  import RequirePaymentModal from './prompt-payment/prompt-payment-modal.component';
43
43
  import rootComponent from './root.component';
44
44
  import OrderActionButton from './billable-services/billiable-item/order-actions/components/order-action-button.component';
45
+ import CreateBillWorkspace from './billable-services/bill-manager/workspaces/create-bill/create-bill.workspace';
45
46
 
46
47
  const moduleName = '@kenyaemr/esm-billing-app';
47
48
 
@@ -158,6 +159,7 @@ export const billingPatientSummary = getSyncLifecycle(BillHistory, options);
158
159
  export const billingCheckInForm = getSyncLifecycle(BillingCheckInForm, options);
159
160
  export const deleteBillableServiceModal = getSyncLifecycle(DeleteBillableServiceModal, options);
160
161
  export const createBillItemModal = getSyncLifecycle(CreateBillItemModal, options);
162
+ export const createBillWorkspace = getSyncLifecycle(CreateBillWorkspace, options);
161
163
 
162
164
  export const billingForm = getSyncLifecycle(BillingForm, options);
163
165
  export const requirePaymentModal = getSyncLifecycle(RequirePaymentModal, options);
package/src/routes.json CHANGED
@@ -137,7 +137,12 @@
137
137
  {
138
138
  "name": "order-action-button",
139
139
  "component": "orderActionButton",
140
- "slot": "prescription-action-button-slot",
140
+ "slots": [
141
+ "prescription-action-button-slot",
142
+ "imaging-orders-action",
143
+ "procedure-orders-action",
144
+ "tests-ordered-actions-slot"
145
+ ],
141
146
  "order": 0
142
147
  },
143
148
  {
@@ -230,6 +235,12 @@
230
235
  }
231
236
  ],
232
237
  "workspaces": [
238
+ {
239
+ "name": "create-bill-workspace",
240
+ "component": "createBillWorkspace",
241
+ "title": "Create Bill Workspace",
242
+ "type": "other-form"
243
+ },
233
244
  {
234
245
  "name": "waive-bill-form",
235
246
  "component": "waiveBillForm",