@kenyaemr/esm-billing-app 5.4.2-pre.2911 → 5.4.2

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},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","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","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":"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":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slots":["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"},{"name":"patient-info-sha-status","component":"patientBannerShaStatus","slot":"patient-banner-tags-slot"},{"name":"payments-points-dashboard-link","component":"paymentPointDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"cashier-points","title":"Payment Point","slot":"payment-point-dashboard-slot"}},{"name":"payment-points-dashboard","component":"paymentPoints","slot":"payment-point-dashboard-slot"},{"name":"payment-mode-dashboard-link","component":"paymentModeLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-modes","title":"Payment Mode","slot":"payment-mode-dashboard-slot"}},{"name":"payment-mode-dashboard","component":"paymentModeDashboard","slot":"payment-mode-dashboard-slot"},{"name":"bill-deposit-dashboard-link","component":"billDepositDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"bill-deposit","title":"Bill Deposit","slot":"billing-deposit-dashboard-slot"}},{"name":"bill-deposit-dashboard","component":"billDepositDashboard","slot":"billing-deposit-dashboard-slot"},{"name":"billable-exemptions-dashboard-link","component":"billableExemptionsLink","slot":"billing-admin-dashboard-slot","meta":{"name":"billable-exemptions","title":"Billable Exemptions","slot":"billing-exemptions-dashboard-slot"}},{"name":"billable-exemptions-dashboard","component":"billableExemptions","slot":"billing-exemptions-dashboard-slot"},{"name":"clinical-charges-dashboard-link","component":"clinicalChargesLink","slot":"billing-admin-dashboard-slot","meta":{"name":"clinical-charges","title":"Clinical Charges","slot":"clinical-charges-dashboard-slot"}},{"name":"clinical-charges-dashboard","component":"clinicalCharges","slot":"clinical-charges-dashboard-slot"},{"name":"payment-history-dashboard-link","component":"paymentHistoryLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-history","title":"Payment History","slot":"payment-history-dashboard-slot"}},{"name":"payment-history-dashboard","component":"paymentHistoryDashboard","slot":"payment-history-dashboard-slot"},{"name":"patient-billing-dashboard-link","component":"patientBillingLink","slot":"billing-admin-dashboard-slot","meta":{"name":"patient-billing","title":"Patient Billing","slot":"patient-billing-dashboard-slot"}},{"name":"patient-billing-dashboard","component":"patientBilling","slot":"patient-billing-dashboard-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":"commodityForm","title":"Charge Commodity 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":"claim-summary-modal","component":"claimSummaryModal"},{"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"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"version":"5.4.2-pre.2911"}
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},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","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","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"visit-form-bottom-slot","component":"billingCheckInForm","order":1},{"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":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slots":["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"},{"name":"patient-info-sha-status","component":"patientBannerShaStatus","slot":"patient-banner-tags-slot"},{"name":"payments-points-dashboard-link","component":"paymentPointDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"cashier-points","title":"Payment Point","slot":"payment-point-dashboard-slot"}},{"name":"payment-points-dashboard","component":"paymentPoints","slot":"payment-point-dashboard-slot"},{"name":"payment-mode-dashboard-link","component":"paymentModeLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-modes","title":"Payment Mode","slot":"payment-mode-dashboard-slot"}},{"name":"payment-mode-dashboard","component":"paymentModeDashboard","slot":"payment-mode-dashboard-slot"},{"name":"bill-deposit-dashboard-link","component":"billDepositDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"bill-deposit","title":"Bill Deposit","slot":"billing-deposit-dashboard-slot"}},{"name":"bill-deposit-dashboard","component":"billDepositDashboard","slot":"billing-deposit-dashboard-slot"},{"name":"billable-exemptions-dashboard-link","component":"billableExemptionsLink","slot":"billing-admin-dashboard-slot","meta":{"name":"billable-exemptions","title":"Billable Exemptions","slot":"billing-exemptions-dashboard-slot"}},{"name":"billable-exemptions-dashboard","component":"billableExemptions","slot":"billing-exemptions-dashboard-slot"},{"name":"clinical-charges-dashboard-link","component":"clinicalChargesLink","slot":"billing-admin-dashboard-slot","meta":{"name":"clinical-charges","title":"Clinical Charges","slot":"clinical-charges-dashboard-slot"}},{"name":"clinical-charges-dashboard","component":"clinicalCharges","slot":"clinical-charges-dashboard-slot"},{"name":"payment-history-dashboard-link","component":"paymentHistoryLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-history","title":"Payment History","slot":"payment-history-dashboard-slot"}},{"name":"payment-history-dashboard","component":"paymentHistoryDashboard","slot":"payment-history-dashboard-slot"},{"name":"patient-billing-dashboard-link","component":"patientBillingLink","slot":"billing-admin-dashboard-slot","meta":{"name":"patient-billing","title":"Patient Billing","slot":"patient-billing-dashboard-slot"}},{"name":"patient-billing-dashboard","component":"patientBilling","slot":"patient-billing-dashboard-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":"commodityForm","title":"Charge Commodity 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":"claim-summary-modal","component":"claimSummaryModal"},{"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"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"version":"5.4.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.4.2-pre.2911",
3
+ "version": "5.4.2",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "keywords": [
6
6
  "openmrs"
@@ -47,6 +47,5 @@
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
50
- },
51
- "stableVersion": "5.4.1"
50
+ }
52
51
  }
@@ -1,13 +1,12 @@
1
1
  import { FilterableMultiSelect, InlineLoading, InlineNotification } from '@carbon/react';
2
2
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { showSnackbar, useConfig, useFeatureFlag } from '@openmrs/esm-framework';
3
+ import { showSnackbar, useConfig, useFeatureFlag, type Visit } from '@openmrs/esm-framework';
4
4
  import React, { useCallback, useEffect, useState } from 'react';
5
5
  import { FormProvider, useForm } from 'react-hook-form';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { createPatientBill, useBillableItems, useCashPoint } from '../billing.resource';
8
8
  import { BillingConfig } from '../config-schema';
9
9
  import { EXEMPTED_PAYMENT_STATUS, PENDING_PAYMENT_STATUS, SHA_INSURANCE_SCHEME } from '../constants';
10
- import { BillingService } from '../types';
11
10
  import styles from './billing-checkin-form.scss';
12
11
  import { visitAttributesFormSchema, VisitAttributesFormValue } from './check-in-form.utils';
13
12
  import { hasPatientBeenExempted } from './helper';
@@ -15,12 +14,16 @@ import SHANumberValidity from './social-health-authority/sha-number-validity.com
15
14
  import VisitAttributesForm from './visit-attributes/visit-attributes-form.component';
16
15
  import SHABenefitPackangesAndInterventions from '../benefits-package/forms/packages-and-interventions-form.component';
17
16
 
17
+ interface VisitFormCallbacks {
18
+ onVisitCreatedOrUpdated: (visit: Visit) => Promise<any>;
19
+ }
20
+
18
21
  type BillingCheckInFormProps = {
19
22
  patientUuid: string;
20
- setExtraVisitInfo: (state) => void;
23
+ setVisitFormCallbacks: (callbacks: VisitFormCallbacks) => void;
21
24
  };
22
25
 
23
- const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, setExtraVisitInfo }) => {
26
+ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, setVisitFormCallbacks }) => {
24
27
  const { t } = useTranslation();
25
28
  const hieFeatureFlags = useFeatureFlag('healthInformationExchange');
26
29
  const {
@@ -29,6 +32,8 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
29
32
  const { cashPoints, isLoading: isLoadingCashPoints, error: cashError } = useCashPoint();
30
33
  const { lineItems, isLoading: isLoadingLineItems, error: lineError } = useBillableItems();
31
34
  const [attributes, setAttributes] = useState([]);
35
+ const [selectedBillingServices, setSelectedBillingServices] = useState([]);
36
+
32
37
  const formMethods = useForm<VisitAttributesFormValue>({
33
38
  mode: 'all',
34
39
  defaultValues: {
@@ -42,67 +47,92 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
42
47
  },
43
48
  resolver: zodResolver(visitAttributesFormSchema),
44
49
  });
50
+
45
51
  const isPatientExemptedValue = formMethods.watch('isPatientExempted');
46
52
  const paymentMethod = formMethods.watch('paymentMethods');
47
53
  const isInsuranceSchemeSha = formMethods.watch('insuranceScheme') === SHA_INSURANCE_SCHEME;
48
54
 
49
- const handleCreateBill = useCallback((createBillPayload) => {
50
- createPatientBill(createBillPayload).then(
51
- () => {
52
- showSnackbar({ title: 'Patient Bill', subtitle: 'Patient has been billed successfully', kind: 'success' });
53
- },
54
- (error) => {
55
- const errorMessage = JSON.stringify(error?.responseBody?.error?.message?.replace(/\[/g, '').replace(/\]/g, ''));
56
- showSnackbar({
57
- title: 'Patient Bill Error',
58
- subtitle: `An error has occurred while creating patient bill, Contact system administrator quoting this error ${errorMessage}`,
59
- kind: 'error',
60
- isLowContrast: true,
61
- });
62
- },
63
- );
64
- }, []);
55
+ const handleCreateBill = useCallback(
56
+ (billPayload) => {
57
+ return createPatientBill(billPayload).then(
58
+ () => {
59
+ showSnackbar({
60
+ title: t('patientBill', 'Patient Bill'),
61
+ subtitle: t('patientBilledSuccessfully', 'Patient has been billed successfully'),
62
+ kind: 'success',
63
+ });
64
+ },
65
+ (error) => {
66
+ const errorMessage = JSON.stringify(
67
+ error?.responseBody?.error?.message?.replace(/\[/g, '').replace(/\]/g, '') || '',
68
+ );
69
+ showSnackbar({
70
+ title: t('patientBillError', 'Patient Bill Error'),
71
+ subtitle: t(
72
+ 'errorCreatingBill',
73
+ 'An error has occurred while creating patient bill, Contact system administrator quoting this error {{errorMessage}}',
74
+ { errorMessage },
75
+ ),
76
+ kind: 'error',
77
+ isLowContrast: true,
78
+ });
79
+ // Re-throw to propagate error up the promise chain
80
+ throw error;
81
+ },
82
+ );
83
+ },
84
+ [t],
85
+ );
65
86
 
66
- const handleBillingService = (selectedItems) => {
67
- const cashPointUuid = cashPoints?.[0]?.uuid ?? '';
68
- const billStatus = hasPatientBeenExempted(attributes, isPatientExempted)
69
- ? EXEMPTED_PAYMENT_STATUS
70
- : PENDING_PAYMENT_STATUS;
87
+ const createBillPayload = useCallback(
88
+ (selectedItems) => {
89
+ const cashPointUuid = cashPoints?.[0]?.uuid ?? '';
90
+ const billStatus = hasPatientBeenExempted(attributes, isPatientExempted)
91
+ ? EXEMPTED_PAYMENT_STATUS
92
+ : PENDING_PAYMENT_STATUS;
93
+
94
+ const lineItemsData = selectedItems.map((item, index) => {
95
+ const priceForPaymentMode =
96
+ item.servicePrices.find((p) => p.paymentMode?.uuid === paymentMethod) || item?.servicePrices[0];
97
+ return {
98
+ billableService: item?.uuid ?? '',
99
+ quantity: 1,
100
+ price: priceForPaymentMode ? priceForPaymentMode.price : '0.000',
101
+ priceName: 'Default',
102
+ priceUuid: priceForPaymentMode ? priceForPaymentMode.uuid : '',
103
+ lineItemOrder: index,
104
+ paymentStatus: billStatus,
105
+ };
106
+ });
71
107
 
72
- const lineItems = selectedItems.map((item, index) => {
73
- const priceForPaymentMode =
74
- item.servicePrices.find((p) => p.paymentMode?.uuid === paymentMethod) || item?.servicePrices[0];
75
108
  return {
76
- billableService: item?.uuid ?? '',
77
- quantity: 1,
78
- price: priceForPaymentMode ? priceForPaymentMode.price : '0.000',
79
- priceName: 'Default',
80
- priceUuid: priceForPaymentMode ? priceForPaymentMode.uuid : '',
81
- lineItemOrder: index,
82
- paymentStatus: billStatus,
109
+ lineItems: lineItemsData,
110
+ cashPoint: cashPointUuid,
111
+ patient: patientUuid,
112
+ status: billStatus,
113
+ payments: [],
83
114
  };
84
- });
85
-
86
- const billPayload = {
87
- lineItems: lineItems,
88
- cashPoint: cashPointUuid,
89
- patient: patientUuid,
90
- status: billStatus,
91
- payments: [],
92
- };
115
+ },
116
+ [cashPoints, attributes, isPatientExempted, paymentMethod, patientUuid],
117
+ );
93
118
 
94
- setExtraVisitInfo({
95
- handleCreateExtraVisitInfo: () => handleCreateBill(billPayload),
96
- attributes,
97
- });
98
- };
119
+ const handleBillingService = useCallback((selectedItems) => {
120
+ setSelectedBillingServices(selectedItems);
121
+ }, []);
99
122
 
100
123
  useEffect(() => {
101
- setExtraVisitInfo({
102
- handleCreateExtraVisitInfo: () => {},
103
- attributes,
124
+ const onVisitCreatedOrUpdated = async (visit: Visit) => {
125
+ if (selectedBillingServices.length > 0) {
126
+ const billPayload = createBillPayload(selectedBillingServices);
127
+ await handleCreateBill(billPayload);
128
+ }
129
+ return visit;
130
+ };
131
+
132
+ setVisitFormCallbacks({
133
+ onVisitCreatedOrUpdated,
104
134
  });
105
- }, [attributes, setExtraVisitInfo]);
135
+ }, [selectedBillingServices, createBillPayload, handleCreateBill, setVisitFormCallbacks]);
106
136
 
107
137
  if (isLoadingLineItems || isLoadingCashPoints) {
108
138
  return (
@@ -132,7 +162,7 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
132
162
  {hieFeatureFlags && isInsuranceSchemeSha && <SHABenefitPackangesAndInterventions patientUuid={patientUuid} />}
133
163
  {paymentMethod && (
134
164
  <section className={styles.sectionContainer}>
135
- <div className={styles.sectionTitle}>{t('ChargeableService', 'Chargeable service')}</div>
165
+ <div className={styles.sectionTitle}>{t('chargeableService', 'Chargeable service')}</div>
136
166
  <div className={styles.sectionField}>
137
167
  <FilterableMultiSelect
138
168
  key={isPatientExemptedValue}
@@ -12,3 +12,6 @@
12
12
  .sectionField {
13
13
  flex-basis: 70%;
14
14
  }
15
+ .sectionContainer{
16
+ margin-top: layout.$spacing-05;
17
+ }
@@ -5,7 +5,7 @@
5
5
  .sectionTitle {
6
6
  @include type.type-style('heading-compact-02');
7
7
  color: colors.$gray-70;
8
- margin: 0 0 layout.$spacing-03 0;
8
+ margin: layout.$spacing-08 0 layout.$spacing-03 0;
9
9
  flex-basis: 30%;
10
10
  }
11
11
 
package/src/routes.json CHANGED
@@ -88,8 +88,9 @@
88
88
  },
89
89
  {
90
90
  "name": "billing-check-in-form",
91
- "slot": "extra-visit-attribute-slot",
92
- "component": "billingCheckInForm"
91
+ "slot": "visit-form-bottom-slot",
92
+ "component": "billingCheckInForm",
93
+ "order": 1
93
94
  },
94
95
 
95
96
  {