@kenyaemr/esm-billing-app 5.4.1-pre.2009 → 5.4.1-pre.2014
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +60 -60
- package/dist/300.js +1 -1
- package/dist/970.js +1 -1
- package/dist/970.js.map +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +9 -9
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/billing-form/social-health-authority/sha-number-validity.component.tsx +34 -27
- package/src/billing-form/social-health-authority/sha-number-validity.scss +15 -0
- package/src/claims/dashboard/form/claims-explanation-and-justification-form-input.component.tsx +101 -29
- package/src/claims/dashboard/form/claims-form.component.tsx +150 -47
- package/src/claims/dashboard/form/claims-form.scss +3 -1
- package/translations/en.json +2 -0
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"},{"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.
|
|
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.2014"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ const SHANumberValidity: React.FC<SHANumberValidityProps> = ({ paymentMethod, pa
|
|
|
27
27
|
const { data, isLoading: isLoadingHIEEligibility, error } = useSHAEligibility(patientUuid, shaIdentificationNumber);
|
|
28
28
|
|
|
29
29
|
const isRegisteredOnSHA = data?.status === 1;
|
|
30
|
+
const hasCrNumber = !!data?.memberCrNumber && data.memberCrNumber.length > 0;
|
|
30
31
|
|
|
31
32
|
const isActive = isRegisteredOnSHA
|
|
32
33
|
? isWithinInterval(new Date(), {
|
|
@@ -75,7 +76,7 @@ const SHANumberValidity: React.FC<SHANumberValidityProps> = ({ paymentMethod, pa
|
|
|
75
76
|
);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
if (!
|
|
79
|
+
if (!hasCrNumber) {
|
|
79
80
|
return (
|
|
80
81
|
<InlineNotification
|
|
81
82
|
title={t('hieVerificationFailure', 'HIE verification failure')}
|
|
@@ -85,33 +86,39 @@ const SHANumberValidity: React.FC<SHANumberValidityProps> = ({ paymentMethod, pa
|
|
|
85
86
|
);
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
<div className={styles.
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)}
|
|
105
|
-
</div>
|
|
106
|
-
<div className={isActive ? styles.hieCardItemActive : styles.hieCardItemInActive}>
|
|
107
|
-
<CheckboxCheckedFilled />
|
|
108
|
-
<span className={isActive ? styles.activeSubscription : styles.inActiveSubscription}>
|
|
109
|
-
{isActive ? t('active', 'Active') : t('inactive', 'Inactive')}
|
|
110
|
-
</span>
|
|
111
|
-
</div>
|
|
89
|
+
const renderInsurerCard = (insurerValue: string, cardClass: string) => (
|
|
90
|
+
<Form className={styles.formContainer}>
|
|
91
|
+
<div className={cardClass}>
|
|
92
|
+
<div className={isActive ? styles.hieCardItemActive : styles.hieCardItemInActive}>
|
|
93
|
+
<span className={styles.hieInsurerTitle}>{t('insurer', 'Insurer:')}</span>{' '}
|
|
94
|
+
<span className={styles.hieInsurerValue}>{insurerValue}</span>
|
|
95
|
+
{isActive && (
|
|
96
|
+
<Tooltip
|
|
97
|
+
className={styles.tooltip}
|
|
98
|
+
align="bottom"
|
|
99
|
+
label={`Active from ${formatDate(new Date(data?.coverageStartDate))}`}>
|
|
100
|
+
<button className="sb-tooltip-trigger" type="button">
|
|
101
|
+
<Information />
|
|
102
|
+
</button>
|
|
103
|
+
</Tooltip>
|
|
104
|
+
)}
|
|
112
105
|
</div>
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
<div className={isActive ? styles.hieCardItemActive : styles.hieCardItemInActive}>
|
|
107
|
+
<CheckboxCheckedFilled />
|
|
108
|
+
<span className={isActive ? styles.activeSubscription : styles.inActiveSubscription}>
|
|
109
|
+
{isActive ? t('active', 'Active') : t('inactive', 'Inactive')}
|
|
110
|
+
</span>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</Form>
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (hasCrNumber) {
|
|
117
|
+
if (isRegisteredOnSHA) {
|
|
118
|
+
return renderInsurerCard('PHC | SHIF | ECCIF', styles.hieCard);
|
|
119
|
+
} else {
|
|
120
|
+
return renderInsurerCard('PHC', styles.hieCardPHC);
|
|
121
|
+
}
|
|
115
122
|
}
|
|
116
123
|
};
|
|
117
124
|
|
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.hieCard {
|
|
11
|
+
height: layout.$layout-03;
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: 4fr 1fr 1fr;
|
|
14
|
+
grid-row: auto;
|
|
15
|
+
align-items: center;
|
|
16
|
+
column-gap: layout.$spacing-03;
|
|
17
|
+
border-bottom: 1px solid colors.$cool-gray-20;
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
background-color: colors.$cool-gray-10;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.hieCardPHC {
|
|
11
26
|
height: layout.$layout-03;
|
|
12
27
|
display: grid;
|
|
13
28
|
grid-template-columns: 1fr 1fr 1fr;
|
package/src/claims/dashboard/form/claims-explanation-and-justification-form-input.component.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Column, InlineLoading, InlineNotification, Layer, TextArea } from '@carbon/react';
|
|
2
2
|
import { usePatient } from '@openmrs/esm-framework';
|
|
3
|
-
import React, { useEffect, useMemo } from 'react';
|
|
3
|
+
import React, { useEffect, useMemo, useCallback } from 'react';
|
|
4
4
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { InterventionsFilter, useInterventions } from '../../../hooks/useInterventions';
|
|
@@ -9,50 +9,110 @@ import styles from './claims-form.scss';
|
|
|
9
9
|
|
|
10
10
|
type ClaimExplanationAndJusificationInputProps = {
|
|
11
11
|
patientUuid: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
validationEnabled?: boolean;
|
|
14
|
+
onInteraction?: () => void;
|
|
12
15
|
};
|
|
13
|
-
const ClaimExplanationAndJusificationInput: React.FC<ClaimExplanationAndJusificationInputProps> = ({ patientUuid }) => {
|
|
14
|
-
const { error: patientError, isLoading: isPatientLoading, patient } = usePatient(patientUuid);
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const ClaimExplanationAndJusificationInput: React.FC<ClaimExplanationAndJusificationInputProps> = ({
|
|
18
|
+
patientUuid,
|
|
19
|
+
disabled = false,
|
|
20
|
+
validationEnabled = false,
|
|
21
|
+
onInteraction = () => {},
|
|
22
|
+
}) => {
|
|
23
|
+
const { error: patientError, isLoading: isPatientLoading, patient } = usePatient(patientUuid);
|
|
22
24
|
const { t } = useTranslation();
|
|
25
|
+
const form = useFormContext();
|
|
26
|
+
const { setValue, watch, trigger } = form;
|
|
27
|
+
|
|
28
|
+
const packages = watch('packages');
|
|
29
|
+
const interventions = watch('interventions');
|
|
30
|
+
const currentExplanation = watch('claimExplanation');
|
|
31
|
+
const currentJustification = watch('claimJustification');
|
|
32
|
+
|
|
23
33
|
const { isLoading: packagesLoading, error: packageError, packages: shaPackages } = usePackages();
|
|
24
|
-
|
|
25
|
-
const packagesObservable = form.watch('packages');
|
|
26
|
-
const interventionsObservable = form.watch('interventions');
|
|
34
|
+
|
|
27
35
|
const filters = useMemo<InterventionsFilter>(
|
|
28
36
|
() => ({
|
|
29
|
-
package_code:
|
|
37
|
+
package_code: packages?.join(','),
|
|
30
38
|
applicable_gender: patient?.gender === 'male' ? 'MALE' : 'FEMALE',
|
|
31
39
|
}),
|
|
32
|
-
[
|
|
40
|
+
[packages, patient?.gender],
|
|
33
41
|
);
|
|
42
|
+
|
|
34
43
|
const { error: interventionsError, isLoading: isLoadingInterventions, allInterventions } = useInterventions(filters);
|
|
44
|
+
|
|
35
45
|
const packagesSelected = useMemo(
|
|
36
46
|
() =>
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
packages
|
|
48
|
+
?.map((packageCode) => shaPackages.find((pkg) => pkg.uuid === packageCode))
|
|
39
49
|
?.map((p) => p?.packageName ?? '')
|
|
40
50
|
.filter(Boolean) ?? [],
|
|
41
|
-
[
|
|
51
|
+
[packages, shaPackages],
|
|
42
52
|
);
|
|
53
|
+
|
|
43
54
|
const interventionSelected = useMemo(
|
|
44
55
|
() =>
|
|
45
|
-
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
interventions
|
|
57
|
+
?.map(
|
|
58
|
+
(interventionCode) =>
|
|
59
|
+
allInterventions.find((intervention) => intervention.interventionCode === interventionCode)
|
|
60
|
+
?.interventionName,
|
|
61
|
+
)
|
|
62
|
+
.filter(Boolean) ?? [],
|
|
63
|
+
[interventions, allInterventions],
|
|
50
64
|
);
|
|
51
65
|
|
|
66
|
+
const hasPackagesAndInterventions = packagesSelected.length > 0 && interventionSelected.length > 0;
|
|
67
|
+
|
|
68
|
+
const updateFormFields = useCallback(() => {
|
|
69
|
+
if (!packagesLoading && !isLoadingInterventions && hasPackagesAndInterventions) {
|
|
70
|
+
const newExplanation = packagesSelected.join(', ');
|
|
71
|
+
const newJustification = interventionSelected.join(', ');
|
|
72
|
+
|
|
73
|
+
if (newExplanation !== currentExplanation) {
|
|
74
|
+
setValue('claimExplanation', newExplanation, {
|
|
75
|
+
shouldValidate: validationEnabled,
|
|
76
|
+
shouldDirty: true,
|
|
77
|
+
shouldTouch: false,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (newJustification !== currentJustification) {
|
|
82
|
+
setValue('claimJustification', newJustification, {
|
|
83
|
+
shouldValidate: validationEnabled,
|
|
84
|
+
shouldDirty: true,
|
|
85
|
+
shouldTouch: false,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (validationEnabled) {
|
|
90
|
+
trigger(['claimExplanation', 'claimJustification']);
|
|
91
|
+
}
|
|
92
|
+
onInteraction();
|
|
93
|
+
}
|
|
94
|
+
}, [
|
|
95
|
+
packagesLoading,
|
|
96
|
+
isLoadingInterventions,
|
|
97
|
+
hasPackagesAndInterventions,
|
|
98
|
+
packagesSelected,
|
|
99
|
+
interventionSelected,
|
|
100
|
+
currentExplanation,
|
|
101
|
+
currentJustification,
|
|
102
|
+
setValue,
|
|
103
|
+
validationEnabled,
|
|
104
|
+
trigger,
|
|
105
|
+
onInteraction,
|
|
106
|
+
]);
|
|
107
|
+
|
|
52
108
|
useEffect(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, [
|
|
109
|
+
const timer = setTimeout(updateFormFields, 300);
|
|
110
|
+
return () => clearTimeout(timer);
|
|
111
|
+
}, [updateFormFields]);
|
|
112
|
+
|
|
113
|
+
const shouldShowError = (fieldName: string) => {
|
|
114
|
+
return validationEnabled && form.formState.errors[fieldName] && form.formState.touchedFields[fieldName];
|
|
115
|
+
};
|
|
56
116
|
|
|
57
117
|
if (packagesLoading || isPatientLoading || isLoadingInterventions) {
|
|
58
118
|
return (
|
|
@@ -68,11 +128,13 @@ const ClaimExplanationAndJusificationInput: React.FC<ClaimExplanationAndJusifica
|
|
|
68
128
|
lowContrast={true}
|
|
69
129
|
statusIconDescription="notification"
|
|
70
130
|
title={t('errorLoadingpackages', 'Error loading packages')}
|
|
71
|
-
subtitle={packageError?.message ??
|
|
131
|
+
subtitle={packageError?.message ?? patientError?.message ?? interventionsError?.message}
|
|
72
132
|
/>
|
|
73
133
|
);
|
|
74
134
|
}
|
|
75
135
|
|
|
136
|
+
const textAreaDisabled = disabled && !hasPackagesAndInterventions;
|
|
137
|
+
|
|
76
138
|
return (
|
|
77
139
|
<>
|
|
78
140
|
<Column>
|
|
@@ -87,8 +149,13 @@ const ClaimExplanationAndJusificationInput: React.FC<ClaimExplanationAndJusifica
|
|
|
87
149
|
rows={3}
|
|
88
150
|
placeholder="Claim Explanation"
|
|
89
151
|
id="claimExplanation"
|
|
90
|
-
invalid={
|
|
152
|
+
invalid={shouldShowError('claimExplanation')}
|
|
91
153
|
invalidText={error?.message}
|
|
154
|
+
disabled={textAreaDisabled}
|
|
155
|
+
onChange={(e) => {
|
|
156
|
+
field.onChange(e);
|
|
157
|
+
onInteraction();
|
|
158
|
+
}}
|
|
92
159
|
/>
|
|
93
160
|
)}
|
|
94
161
|
/>
|
|
@@ -106,8 +173,13 @@ const ClaimExplanationAndJusificationInput: React.FC<ClaimExplanationAndJusifica
|
|
|
106
173
|
rows={3}
|
|
107
174
|
placeholder="Claim Justification"
|
|
108
175
|
id="claimJustification"
|
|
109
|
-
invalid={
|
|
176
|
+
invalid={shouldShowError('claimJustification')}
|
|
110
177
|
invalidText={error?.message}
|
|
178
|
+
disabled={textAreaDisabled}
|
|
179
|
+
onChange={(e) => {
|
|
180
|
+
field.onChange(e);
|
|
181
|
+
onInteraction();
|
|
182
|
+
}}
|
|
111
183
|
/>
|
|
112
184
|
)}
|
|
113
185
|
/>
|
|
@@ -117,4 +189,4 @@ const ClaimExplanationAndJusificationInput: React.FC<ClaimExplanationAndJusifica
|
|
|
117
189
|
);
|
|
118
190
|
};
|
|
119
191
|
|
|
120
|
-
export default ClaimExplanationAndJusificationInput;
|
|
192
|
+
export default React.memo(ClaimExplanationAndJusificationInput);
|