@kenyaemr/esm-billing-app 5.4.2-pre.2157 → 5.4.2-pre.2161

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":{"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-group-nav-slot"},{"component":"billDepositDashboardLink","name":"bill-deposit-dashboard-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-group-nav-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-group-nav-slot"},{"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":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","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":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"},{"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"}],"version":"5.4.2-pre.2157"}
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":{"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-group-nav-slot"},{"component":"billDepositDashboardLink","name":"bill-deposit-dashboard-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-group-nav-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-group-nav-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-group-nav-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-group-nav-slot"},{"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":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","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":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"},{"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"}],"version":"5.4.2-pre.2161"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-billing-app",
3
- "version": "5.4.2-pre.2157",
3
+ "version": "5.4.2-pre.2161",
4
4
  "description": "Billing app for KenyaEMR",
5
5
  "browser": "dist/kenyaemr-esm-billing-app.js",
6
6
  "main": "src/index.ts",
@@ -1,18 +1,63 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { Edit } from '@carbon/react/icons';
3
- import { launchWorkspace } from '@openmrs/esm-framework';
3
+ import { launchWorkspace, navigateAndLaunchWorkspace } from '@openmrs/esm-framework';
4
4
  import { BaseOrderButton } from './base-order-button.component';
5
5
  import { useMedicationOrderAction, useOrderByUuid } from '../hooks/useMedicationOrderAction';
6
6
  import { launchPrescriptionEditWorkspace } from '../hooks/useModalHandler';
7
7
  import { useTranslation } from 'react-i18next';
8
+ import { useVisitOrOfflineVisit } from '@openmrs/esm-patient-common-lib/src';
9
+ import { Button } from '@carbon/react';
10
+
8
11
  export interface MedicationOrderButtonProps {
9
12
  medicationRequestBundle?: {
10
13
  request: fhir.MedicationRequest;
14
+ dispenses: Array<fhir.MedicationDispense>;
11
15
  };
12
16
  actionText?: string;
13
17
  closeable?: boolean;
14
18
  }
15
19
 
20
+ interface ModifyButtonProps {
21
+ currentVisit: boolean;
22
+ isLoading: boolean;
23
+ order: any;
24
+ patientUuid: string;
25
+ }
26
+
27
+ const ModifyButton: React.FC<ModifyButtonProps> = ({ currentVisit, isLoading, order, patientUuid }) => {
28
+ const { t } = useTranslation();
29
+
30
+ if (currentVisit) {
31
+ return (
32
+ <BaseOrderButton
33
+ size="lg"
34
+ kind="tertiary"
35
+ Icon={Edit}
36
+ isLoading={isLoading}
37
+ isDisabled={false}
38
+ buttonText={t('modify', 'Modify')}
39
+ onClick={() => launchPrescriptionEditWorkspace(order, patientUuid)}
40
+ />
41
+ );
42
+ }
43
+
44
+ return (
45
+ <Button
46
+ kind="danger--tertiary"
47
+ size="lg"
48
+ onClick={() =>
49
+ navigateAndLaunchWorkspace({
50
+ targetUrl: `\${openmrsSpaBase}/patient/${patientUuid}/chart`,
51
+ contextKey: `patient/${patientUuid}`,
52
+ workspaceName: 'start-visit-workspace-form',
53
+ additionalProps: { patientUuid },
54
+ })
55
+ }>
56
+ {t('activeVisitRequired', 'Start visit to modify')}
57
+ </Button>
58
+ );
59
+ };
60
+
16
61
  export const MedicationOrderButton: React.FC<MedicationOrderButtonProps> = ({
17
62
  medicationRequestBundle,
18
63
  actionText,
@@ -30,8 +75,9 @@ export const MedicationOrderButton: React.FC<MedicationOrderButtonProps> = ({
30
75
  } = useMedicationOrderAction(medicationRequestBundle);
31
76
  const { data: order, isLoading: isOrderLoading } = useOrderByUuid(medicationRequestBundle?.request?.id);
32
77
  const isLoading = isMedicationOrderLoading && isOrderLoading;
33
-
78
+ const { currentVisit } = useVisitOrOfflineVisit(patientUuid);
34
79
  const buttonText = actionText ?? defaultButtonText;
80
+
35
81
  const launchModal = useCallback(() => {
36
82
  if (shouldShowBillModal) {
37
83
  launchWorkspace('create-bill-workspace', {
@@ -45,7 +91,7 @@ export const MedicationOrderButton: React.FC<MedicationOrderButtonProps> = ({
45
91
  if (dispenseFormProps) {
46
92
  launchWorkspace('dispense-workspace', dispenseFormProps);
47
93
  }
48
- }, [shouldShowBillModal, medicationRequestBundle, dispenseFormProps, patientUuid, order]);
94
+ }, [shouldShowBillModal, medicationRequestBundle, dispenseFormProps, order]);
49
95
 
50
96
  if (!closeable) {
51
97
  return null;
@@ -54,15 +100,7 @@ export const MedicationOrderButton: React.FC<MedicationOrderButtonProps> = ({
54
100
  return (
55
101
  <div>
56
102
  {shouldAllowModify && (
57
- <BaseOrderButton
58
- size="lg"
59
- kind="tertiary"
60
- Icon={Edit}
61
- isLoading={isLoading}
62
- isDisabled={false}
63
- buttonText={t('modify', 'Modify')}
64
- onClick={() => launchPrescriptionEditWorkspace(order, patientUuid)}
65
- />
103
+ <ModifyButton currentVisit={!!currentVisit} isLoading={isLoading} order={order} patientUuid={patientUuid} />
66
104
  )}
67
105
  <BaseOrderButton
68
106
  size="lg"
@@ -7,6 +7,7 @@ import { createMedicationDispenseProps } from '../../test-order/dispense.resourc
7
7
 
8
8
  interface MedicationRequest {
9
9
  request: fhir.MedicationRequest;
10
+ dispenses: Array<fhir.MedicationDispense>;
10
11
  }
11
12
 
12
13
  export function useMedicationOrderAction(medicationRequestBundle?: MedicationRequest) {
@@ -35,14 +36,31 @@ export function useMedicationOrderAction(medicationRequestBundle?: MedicationReq
35
36
  const shouldShowBillModal =
36
37
  stockItemQuantity > 0 && itemHasBill.length < 1 && billableItem.length > 0 && !billableItemServiceStatus;
37
38
  const isDisabled = hasPendingPayment || (stockItemQuantity < 1 && !!drugUuid);
39
+ const isANonBillableItem = billableItem.length === 0;
40
+ const hasBeenDispensed = medicationRequestBundle?.dispenses?.length > 0;
41
+
42
+ /**
43
+ * Determines if modification of the medication order is allowed based on several conditions:
44
+ * 1. No pending payments exist
45
+ * 2. Stock item is available (quantity > 0)
46
+ * 3. Item hasn't been billed yet (no existing bills)
47
+ * 4. Item exists in billable items list
48
+ * 5. Special case: Non-billable items that haven't been dispensed can be modified
49
+ */
50
+ const shouldAllowModify = (() => {
51
+ // Special case: Non-billable items that haven't been dispensed can always be modified
52
+ if (!hasBeenDispensed && isANonBillableItem) {
53
+ return true;
54
+ }
55
+
56
+ // For all other cases, check the standard conditions
57
+ const hasNoPendingPayments = !hasPendingPayment;
58
+ const hasAvailableStock = stockItemQuantity > 0;
59
+ const hasNoExistingBills = itemHasBill.length < 1;
60
+ const isBillableItem = billableItem.length > 0;
38
61
 
39
- // Modification is allowed only when:
40
- // 1. There are no pending payments
41
- // 2. Stock item is available (quantity > 0)
42
- // 3. Item hasn't been billed yet (no existing bills)
43
- // 4. Item exists in billable items list
44
- const shouldAllowModify =
45
- !hasPendingPayment && stockItemQuantity > 0 && itemHasBill.length < 1 && billableItem.length > 0;
62
+ return hasNoPendingPayments && hasAvailableStock && hasNoExistingBills && isBillableItem;
63
+ })();
46
64
 
47
65
  const getButtonText = () => {
48
66
  if (hasPendingPayment) {
@@ -8,6 +8,7 @@ import {
8
8
  setCurrentVisit,
9
9
  showModal,
10
10
  showSnackbar,
11
+ showToast,
11
12
  updateVisit,
12
13
  useFeatureFlag,
13
14
  usePatient,
@@ -24,7 +25,7 @@ import { convertToCurrency } from '../helpers';
24
25
  import { usePaymentsReconciler } from '../hooks/use-payments-reconciler';
25
26
  import { LineItem } from '../types';
26
27
  import InvoiceTable from './invoice-table.component';
27
- import { removeQueuedPatient, useVisitQueueEntry } from './invoice.resource';
28
+ import { removeQueuedPatient, useShaFacilityStatus, useVisitQueueEntry } from './invoice.resource';
28
29
  import styles from './invoice.scss';
29
30
  import Payments from './payments/payments.component';
30
31
  import ReceiptPrintButton from './print-bill-receipt/receipt-print-button.component';
@@ -38,6 +39,7 @@ interface InvoiceDetailsProps {
38
39
  const Invoice: React.FC = () => {
39
40
  const { t } = useTranslation();
40
41
  const { data: facilityInfo } = useDefaultFacility();
42
+ const { shaFacilityStatus } = useShaFacilityStatus();
41
43
  const { billUuid, patientUuid } = useParams();
42
44
  const [isPrinting, setIsPrinting] = useState(false);
43
45
  const { patient, isLoading: isLoadingPatient, error: patientError } = usePatient(patientUuid);
@@ -57,9 +59,15 @@ const Invoice: React.FC = () => {
57
59
  const [selectedLineItems, setSelectedLineItems] = useState([]);
58
60
  const componentRef = useRef<HTMLDivElement>(null);
59
61
  const isProcessClaimsFormEnabled = useFeatureFlag('healthInformationExchange');
62
+
63
+ const isShaFacilityStatusValid =
64
+ shaFacilityStatus &&
65
+ shaFacilityStatus.shaFacilityId &&
66
+ shaFacilityStatus.operationalStatus &&
67
+ shaFacilityStatus?.registrationNumber;
68
+
60
69
  const handleSelectItem = (lineItems: Array<LineItem>) => {
61
70
  const paidLineItems = bill?.lineItems?.filter((item) => item.paymentStatus === 'PAID') ?? [];
62
- // remove duplicates
63
71
  const uniqueLineItems = [...new Set([...lineItems, ...paidLineItems])];
64
72
  setSelectedLineItems(uniqueLineItems);
65
73
  };
@@ -165,6 +173,19 @@ const Invoice: React.FC = () => {
165
173
  };
166
174
 
167
175
  const handleViewClaims = async () => {
176
+ if (!isShaFacilityStatusValid) {
177
+ showToast({
178
+ critical: true,
179
+ kind: 'warning',
180
+ title: t('shaFacilityLicenseNumberRequired', 'Facility license number Required'),
181
+ description: t(
182
+ 'shaFacilityLicenseNumbernRequiredDescription',
183
+ 'Facility license number is required to process claims. Please update facility license number details.',
184
+ ),
185
+ });
186
+ return;
187
+ }
188
+
168
189
  if (currentVisit) {
169
190
  await handleEndVisit();
170
191
  navigate({ to: `${spaBasePath}/billing/patient/${patientUuid}/${billUuid}/claims` });
@@ -204,6 +225,7 @@ const Invoice: React.FC = () => {
204
225
  tooltipPosition="left">
205
226
  {t('mpesaPayment', 'MPESA Payment')}
206
227
  </Button>
228
+
207
229
  {isProcessClaimsFormEnabled && isInsurancePayment(bill?.payments) && (
208
230
  <Button
209
231
  onClick={handleViewClaims}
@@ -1,5 +1,15 @@
1
- import { Concept, openmrsFetch, restBaseUrl, toDateObjectStrict, toOmrsIsoString, Visit } from '@openmrs/esm-framework';
1
+ import {
2
+ Concept,
3
+ FetchResponse,
4
+ openmrsFetch,
5
+ restBaseUrl,
6
+ toDateObjectStrict,
7
+ toOmrsIsoString,
8
+ useSession,
9
+ Visit,
10
+ } from '@openmrs/esm-framework';
2
11
  import useSWR from 'swr';
12
+ import { type ShaFacilityStatusResponse } from '../types';
3
13
 
4
14
  export interface VisitQueueEntry {
5
15
  queueEntry: VisitQueueEntry;
@@ -79,3 +89,23 @@ export function removeQueuedPatient(
79
89
  signal: abortController.signal,
80
90
  });
81
91
  }
92
+
93
+ export const useShaFacilityStatus = () => {
94
+ const { authenticated } = useSession();
95
+
96
+ const url = `${restBaseUrl}/kenyaemr/sha-facility-status?synchronize=true`;
97
+
98
+ const { data, isLoading, error, mutate } = useSWR<FetchResponse<ShaFacilityStatusResponse>>(
99
+ authenticated ? url : null,
100
+ openmrsFetch,
101
+ );
102
+
103
+ const shaFacilityStatus = data?.data;
104
+
105
+ return {
106
+ shaFacilityStatus,
107
+ isLoading,
108
+ error,
109
+ mutate,
110
+ };
111
+ };
@@ -614,3 +614,15 @@ export interface ProgressTracker {
614
614
  success?: number;
615
615
  failed?: number;
616
616
  }
617
+ export interface ShaFacilityStatusResponse {
618
+ operationalStatus: string;
619
+ approved: string;
620
+ kephLevel: string;
621
+ shaFacilityId: string;
622
+ shaFacilityExpiryDate: string;
623
+ registrationNumber: string;
624
+ mflCode: string;
625
+ shaFacilityLicenseNumber: string;
626
+ facilityRegistryCode: string;
627
+ source: string;
628
+ }
@@ -2,6 +2,7 @@
2
2
  "action": "Action",
3
3
  "actions": "Actions",
4
4
  "active": "Active",
5
+ "activeVisitRequired": "Start visit to modify",
5
6
  "addBill": "Add bill item(s)",
6
7
  "addCommodityChargeItem": "Add charge item",
7
8
  "addDeposit": "Add deposit",
@@ -274,6 +275,8 @@
274
275
  "serviceConcept": "Service Concept",
275
276
  "serviceType": "Service Type",
276
277
  "shaBenefits": "SHA benefits",
278
+ "shaFacilityLicenseNumbernRequiredDescription": "Facility license number is required to process claims. Please update facility license number details.",
279
+ "shaFacilityLicenseNumberRequired": "Facility license number Required",
277
280
  "shaNo": "SHA NUMBER: ",
278
281
  "SHIF": "Social Health Insurance Fund",
279
282
  "shortName": "Short Name",