@kenyaemr/esm-billing-app 5.4.1-pre.1969 → 5.4.1-pre.1978

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","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.1969"}
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.1978"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.4.1-pre.1969",
3
+ "version": "5.4.1-pre.1978",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "browser": "dist/kenyaemr-esm-billing-app.js",
6
6
  "main": "src/index.ts",
@@ -17,7 +17,7 @@ import {
17
17
  Button,
18
18
  } from '@carbon/react';
19
19
  import { Add } from '@carbon/react/icons';
20
- import { isDesktop, useLayoutType, usePagination } from '@openmrs/esm-framework';
20
+ import { isDesktop, launchWorkspace, useLayoutType, usePagination } from '@openmrs/esm-framework';
21
21
  import {
22
22
  ErrorState,
23
23
  usePaginationInfo,
@@ -47,6 +47,10 @@ const BillHistory: React.FC<BillHistoryProps> = ({ patientUuid }) => {
47
47
  launchPatientWorkspace({ workspaceTitle: t('billingForm', 'Billing Form') });
48
48
  };
49
49
 
50
+ const handleLaunchBillDepositForm = () => {
51
+ launchWorkspace('bill-deposit-workspace', { workspaceTitle: t('billDepositForm', 'Bill Deposit Form') });
52
+ };
53
+
50
54
  const headerData = [
51
55
  {
52
56
  header: t('visitTime', 'Visit time'),
@@ -106,9 +110,14 @@ const BillHistory: React.FC<BillHistoryProps> = ({ patientUuid }) => {
106
110
  return (
107
111
  <div>
108
112
  <CardHeader title={t('patientBilling', 'Patient billing')}>
109
- <Button renderIcon={Add} onClick={handleLaunchBillForm} kind="ghost">
110
- {t('addBill', 'Add bill item(s)')}
111
- </Button>
113
+ <div>
114
+ <Button renderIcon={Add} onClick={handleLaunchBillForm} kind="ghost">
115
+ {t('addBill', 'Add bill item(s)')}
116
+ </Button>
117
+ <Button renderIcon={Add} onClick={handleLaunchBillDepositForm} kind="ghost">
118
+ {t('addDeposit', 'Add deposit')}
119
+ </Button>
120
+ </div>
112
121
  </CardHeader>
113
122
  <div className={styles.billHistoryContainer}>
114
123
  <DataTable isSortable rows={rowData} headers={headerData} size={responsiveSize} useZebraStyles>
@@ -39,9 +39,10 @@ export const MedicationOrderButton: React.FC<MedicationOrderButtonProps> = ({
39
39
  const buttonText = actionText ?? defaultButtonText;
40
40
  const launchModal = useCallback(() => {
41
41
  if (shouldShowBillModal) {
42
- launchWorkspace('create-bill-workspace', {
42
+ const dispose = showModal('create-bill-item-modal', {
43
43
  patientUuid,
44
44
  medicationRequestBundle,
45
+ closeModal: () => dispose(),
45
46
  });
46
47
  return;
47
48
  }
@@ -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,235 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { useForm, Controller } from 'react-hook-form';
4
+ import { zodResolver } from '@hookform/resolvers/zod';
5
+ import z, { isDirty, isValid } from 'zod';
6
+ import classNames from 'classnames';
7
+ import {
8
+ type DefaultWorkspaceProps,
9
+ ResponsiveWrapper,
10
+ restBaseUrl,
11
+ showSnackbar,
12
+ useConfig,
13
+ useLayoutType,
14
+ } from '@openmrs/esm-framework';
15
+ import { Button, ButtonSet, InlineLoading, NumberInput, DropdownSkeleton, Dropdown } from '@carbon/react';
16
+ import styles from './bill-deposit.scss';
17
+ import { BillingConfig } from '../../config-schema';
18
+ import { processBillItems, usePaymentModes } from '../../billing.resource';
19
+ import { BillingService, PaymentMethod } from '../../types';
20
+ import { mutate } from 'swr';
21
+ import useBillableServices from '../../hooks/useBillableServices';
22
+
23
+ type BillDepositWorkspaceProps = DefaultWorkspaceProps & {
24
+ patientUuid: string;
25
+ patient: fhir.Patient;
26
+ };
27
+
28
+ const BillDepositWorkspace: React.FC<BillDepositWorkspaceProps> = ({
29
+ patientUuid,
30
+ patient,
31
+ closeWorkspace,
32
+ closeWorkspaceWithSavedChanges,
33
+ promptBeforeClosing,
34
+ }) => {
35
+ const { t } = useTranslation();
36
+ const { cashPointUuid, cashierUuid } = useConfig<BillingConfig>();
37
+ const { paymentModes, isLoading: isPaymentModesLoading } = usePaymentModes();
38
+ const { billableServices, isLoading: isBillableServicesLoading } = useBillableServices();
39
+ const isTablet = useLayoutType() === 'tablet';
40
+ const defaultPaymentStatus = 'PAID';
41
+ const billDepositFormSchema = z.object({
42
+ amount: z
43
+ .number()
44
+ .min(0, { message: t('amountToBeDepositedInvalidText', 'Amount to be deposited is must be greater than 0') }),
45
+ paymentMode: z.object({
46
+ uuid: z.string(),
47
+ name: z.string(),
48
+ description: z.string().optional(),
49
+ retired: z.boolean().optional(),
50
+ retireReason: z.null().optional(),
51
+ auditInfo: z.any().optional(),
52
+ attributeTypes: z.array(z.any()).optional(),
53
+ sortOrder: z.null().optional(),
54
+ resourceVersion: z.string().optional(),
55
+ }) as z.ZodType<PaymentMethod>,
56
+ billableService: z.object({
57
+ uuid: z.string(),
58
+ name: z.string(),
59
+ shortName: z.string(),
60
+ serviceStatus: z.string(),
61
+ serviceType: z.object({
62
+ display: z.string(),
63
+ }),
64
+ servicePrices: z.array(
65
+ z.object({
66
+ uuid: z.string(),
67
+ name: z.string(),
68
+ paymentMode: z.object({
69
+ uuid: z.string(),
70
+ name: z.string(),
71
+ }),
72
+ price: z.number(),
73
+ }),
74
+ ),
75
+ description: z.string().optional(),
76
+ retired: z.boolean().optional(),
77
+ retireReason: z.null().optional(),
78
+ }) as z.ZodType<BillingService>,
79
+ });
80
+ const {
81
+ control,
82
+ handleSubmit,
83
+ formState: { isSubmitting, errors },
84
+ watch,
85
+ } = useForm<z.infer<typeof billDepositFormSchema>>({
86
+ resolver: zodResolver(billDepositFormSchema),
87
+ });
88
+
89
+ const handleCreateBill = async (formData: z.infer<typeof billDepositFormSchema>) => {
90
+ const billableService = formData.billableService;
91
+ const servicePrice = billableService?.servicePrices.find((price) => price.uuid === formData.paymentMode.uuid);
92
+ // if the service price is greater than the amount, then the payment status is paid, otherwise it is pending
93
+ const paymentStatus = Number(formData.amount) >= Number(servicePrice?.price) ? 'PAID' : 'PENDING';
94
+ const createBillPayload = {
95
+ cashPoint: cashPointUuid,
96
+ cashier: cashierUuid,
97
+ patient: patientUuid,
98
+ status: paymentStatus,
99
+ lineItems: [
100
+ {
101
+ billableService: billableService.uuid,
102
+ lineItemOrder: 0,
103
+ quantity: 1,
104
+ price: servicePrice?.price,
105
+ paymentStatus: paymentStatus,
106
+ priceUuid: '',
107
+ priceName: billableService.name,
108
+ },
109
+ ],
110
+ payments: [
111
+ {
112
+ amount: servicePrice?.price,
113
+ amountTendered: formData.amount,
114
+ attributes: [],
115
+ instanceType: servicePrice.paymentMode.uuid,
116
+ },
117
+ ],
118
+ };
119
+ const response = await processBillItems(createBillPayload);
120
+ if (response.ok) {
121
+ showSnackbar({
122
+ title: t('success', 'Success'),
123
+ kind: 'success',
124
+ subtitle: t('billDepositSuccess', 'Bill deposit successful'),
125
+ isLowContrast: true,
126
+ });
127
+ mutate((key) => typeof key === 'string' && key.startsWith(`${restBaseUrl}/cashier/bill`), undefined, {
128
+ revalidate: true,
129
+ });
130
+ closeWorkspaceWithSavedChanges();
131
+ } else {
132
+ showSnackbar({
133
+ title: t('error', 'Error'),
134
+ kind: 'error',
135
+ subtitle: t('billDepositError', 'Bill deposit failed'),
136
+ isLowContrast: true,
137
+ });
138
+ }
139
+ };
140
+
141
+ useEffect(() => {
142
+ if (isDirty) {
143
+ promptBeforeClosing(() => true);
144
+ }
145
+ }, [isDirty, promptBeforeClosing]);
146
+
147
+ const billableService = Array.from(watch('billableService')?.servicePrices ?? []);
148
+
149
+ return (
150
+ <form className={styles.form} onSubmit={handleSubmit(handleCreateBill)}>
151
+ <div className={styles.formContainer}>
152
+ <ResponsiveWrapper>
153
+ {isBillableServicesLoading ? (
154
+ <DropdownSkeleton />
155
+ ) : (
156
+ <Controller
157
+ control={control}
158
+ name="billableService"
159
+ render={({ field }) => (
160
+ <Dropdown
161
+ {...field}
162
+ onChange={({ selectedItem }) => field.onChange(selectedItem)}
163
+ id="billable-service"
164
+ invalidText={t('invalidBillableService', 'Invalid billable service')}
165
+ itemToString={(item) => item.name}
166
+ items={billableServices ?? []}
167
+ label={t('selectBillableService', 'Select billable service')}
168
+ titleText={t('service', 'Service')}
169
+ />
170
+ )}
171
+ />
172
+ )}
173
+ </ResponsiveWrapper>
174
+ <ResponsiveWrapper>
175
+ {isPaymentModesLoading ? (
176
+ <DropdownSkeleton />
177
+ ) : (
178
+ <Controller
179
+ control={control}
180
+ name="paymentMode"
181
+ render={({ field }) => (
182
+ <Dropdown
183
+ {...field}
184
+ id="payment-mode"
185
+ invalidText={t('invalidPaymentMode', 'Invalid payment mode')}
186
+ itemToString={(item) => `${item.name} - ${item.price}`}
187
+ items={billableService ?? []}
188
+ onChange={({ selectedItem }) => field.onChange(selectedItem)}
189
+ label={t('paymentMode', 'Payment mode')}
190
+ titleText={t('paymentMode', 'Payment mode')}
191
+ type="default"
192
+ warnText={t('pleaseSelectPaymentMode', 'Please select a payment mode')}
193
+ invalid={!!errors.paymentMode}
194
+ />
195
+ )}
196
+ />
197
+ )}
198
+ </ResponsiveWrapper>
199
+ <ResponsiveWrapper>
200
+ <Controller
201
+ control={control}
202
+ name="amount"
203
+ render={({ field }) => (
204
+ <NumberInput
205
+ {...field}
206
+ onChange={(e) => field.onChange(Number(e.target.value))}
207
+ helperText={t(
208
+ 'amountToBeDepositedHelperText',
209
+ 'Amount to be deposited for the patient before receiving services',
210
+ )}
211
+ label={t('amountToBeDeposited', 'Amount to be deposited')}
212
+ invalidText={t('amountToBeDepositedInvalidText', 'Amount to be deposited is invalid')}
213
+ invalid={!!errors.amount}
214
+ />
215
+ )}
216
+ />
217
+ </ResponsiveWrapper>
218
+ </div>
219
+ <ButtonSet className={classNames({ [styles.tablet]: isTablet, [styles.desktop]: !isTablet })}>
220
+ <Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
221
+ {t('cancel', 'Cancel')}
222
+ </Button>
223
+ <Button className={styles.button} disabled={!isValid || !isDirty || isSubmitting} kind="primary" type="submit">
224
+ {isSubmitting ? (
225
+ <InlineLoading className={styles.spinner} description={t('postingDeposit', 'Posting deposit...')} />
226
+ ) : (
227
+ <span>{t('postDeposit', 'Post deposit')}</span>
228
+ )}
229
+ </Button>
230
+ </ButtonSet>
231
+ </form>
232
+ );
233
+ };
234
+
235
+ export default BillDepositWorkspace;
package/src/index.ts CHANGED
@@ -43,6 +43,7 @@ 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
45
  import CreateBillWorkspace from './billable-services/bill-manager/workspaces/create-bill/create-bill.workspace';
46
+ import BillDepositWorkspace from './billing-form/bill-deposit/bill-deposit.workspace';
46
47
 
47
48
  const moduleName = '@kenyaemr/esm-billing-app';
48
49
 
@@ -165,6 +166,7 @@ export const billingForm = getSyncLifecycle(BillingForm, options);
165
166
  export const requirePaymentModal = getSyncLifecycle(RequirePaymentModal, options);
166
167
  export const visitAttributeTags = getSyncLifecycle(VisitAttributeTags, options);
167
168
  export const initiatePaymentDialog = getSyncLifecycle(InitiatePaymentDialog, options);
169
+ export const billDepositWorkspace = getSyncLifecycle(BillDepositWorkspace, options);
168
170
 
169
171
  export const labOrder = getSyncLifecycle(LabOrder, options);
170
172
  export const priceInfoOrder = getSyncLifecycle(PriceInfoOrder, options);
package/src/routes.json CHANGED
@@ -283,6 +283,12 @@
283
283
  "component": "cancelBillWorkspace",
284
284
  "title": "Cancel Bill Workspace",
285
285
  "type": "other-form"
286
+ },
287
+ {
288
+ "name": "bill-deposit-workspace",
289
+ "component": "billDepositWorkspace",
290
+ "title": "Bill Deposit Workspace",
291
+ "type": "other-form"
286
292
  }
287
293
  ],
288
294
  "modals": [
@@ -4,6 +4,7 @@
4
4
  "active": "Active",
5
5
  "addBill": "Add bill item(s)",
6
6
  "addCommodityChargeItem": "Add charge item",
7
+ "addDeposit": "Add deposit",
7
8
  "addPaymentOptions": "Add payment option",
8
9
  "addSchema": "Add Schema",
9
10
  "addServiceChargeItem": "Add charge service",
@@ -27,6 +28,7 @@
27
28
  "billAmount": "Bill Amount",
28
29
  "billCreationDate": "Bill creation date",
29
30
  "billDate": "Date",
31
+ "billDepositForm": "Bill Deposit Form",
30
32
  "billedItems": "Billed Items",
31
33
  "billedTo": "Billed to",
32
34
  "billErrorService": "Bill service error",