From e1f75e3b43b162cbe6083b145741c744d5f34963 Mon Sep 17 00:00:00 2001 From: Samuel Muli Date: Wed, 31 Jul 2024 16:51:38 +0300 Subject: [PATCH] Changed position of add patient to queue button --- packages/esm-service-queues-app/package.json | 2 +- .../metrics-header.component.tsx | 25 +++++++++-- .../default-queue-table.component.tsx | 45 +++++++++++++++++-- 3 files changed, 64 insertions(+), 8 deletions(-) diff --git a/packages/esm-service-queues-app/package.json b/packages/esm-service-queues-app/package.json index 0e78a52..6d6eefe 100644 --- a/packages/esm-service-queues-app/package.json +++ b/packages/esm-service-queues-app/package.json @@ -1,6 +1,6 @@ { "name": "@sjthc/esm-service-queues-app", - "version": "1.1.0", + "version": "1.1.1", "description": "Outpatient front-end module for the OpenMRS SPA", "browser": "dist/sjthc-esm-service-queues-app.js", "main": "src/index.ts", diff --git a/packages/esm-service-queues-app/src/patient-queue-metrics/metrics-header.component.tsx b/packages/esm-service-queues-app/src/patient-queue-metrics/metrics-header.component.tsx index 1400b36..7e215b3 100644 --- a/packages/esm-service-queues-app/src/patient-queue-metrics/metrics-header.component.tsx +++ b/packages/esm-service-queues-app/src/patient-queue-metrics/metrics-header.component.tsx @@ -7,7 +7,9 @@ import { showModal, useLayoutType, useSession, + ExtensionSlot } from '@openmrs/esm-framework'; +import { Add } from '@carbon/react/icons'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { spaBasePath } from '../constants'; @@ -26,8 +28,25 @@ const MetricsHeader = () => { }; return (
- {metricsTitle} - {metricsTitle} */} +
+ , + size: 'sm', + }, + selectPatientAction: (selectedPatientUuid) => { + launchWorkspace('service-queues-patient-search', { viewState: { selectedPatientUuid } }); + }, + }} + /> +
+ {/* { }); }} /> - +
*/}
); }; diff --git a/packages/esm-service-queues-app/src/queue-table/default-queue-table.component.tsx b/packages/esm-service-queues-app/src/queue-table/default-queue-table.component.tsx index 9564962..b03ae53 100644 --- a/packages/esm-service-queues-app/src/queue-table/default-queue-table.component.tsx +++ b/packages/esm-service-queues-app/src/queue-table/default-queue-table.component.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useMemo, useState } from 'react'; -import { DataTableSkeleton, Dropdown, TableToolbarSearch } from '@carbon/react'; +import { DataTableSkeleton, Dropdown, TableToolbarSearch, ComboButton, MenuItem } from '@carbon/react'; import { Add } from '@carbon/react/icons'; -import { ExtensionSlot, isDesktop, launchWorkspace, showSnackbar, showToast, useLayoutType } from '@openmrs/esm-framework'; +import { ExtensionSlot, isDesktop, launchWorkspace, showSnackbar, showToast, useLayoutType, UserHasAccess, showModal, useSession, navigate } from '@openmrs/esm-framework'; import { useTranslation } from 'react-i18next'; import ClearQueueEntries from '../clear-queue-entries-dialog/clear-queue-entries.component'; import { @@ -17,6 +17,7 @@ import QueueTableExpandedRow from './queue-table-expanded-row.component'; import QueueTable from './queue-table.component'; import styles from './queue-table.scss'; import { useColumns } from './cells/columns.resource'; +import { spaBasePath } from '../constants'; /* Component with default values / sub-components passed into the more generic QueueTable. @@ -32,6 +33,10 @@ function DefaultQueueTable() { }); const { t } = useTranslation(); + const queueScreenText = t('queueScreen', 'Queue screen'); + const currentUserSession = useSession(); + const providerUuid = currentUserSession?.currentProvider?.uuid; + useEffect(() => { if (error?.message) { @@ -80,18 +85,23 @@ function DefaultQueueTable() { return ; } + const navigateToQueueScreen = () => { + navigate({ to: `${spaBasePath}/service-queues/screen` }); + }; + return (

{t('patientsCurrentlyInQueue', 'Patients currently in queue')}

-
+ {/*
, @@ -102,7 +112,34 @@ function DefaultQueueTable() { }, }} /> -
+
*/} + + + launchWorkspace('service-queues-service-form')} + /> + launchWorkspace('service-queues-room-form')} + /> + + { + const dispose = showModal('add-provider-to-room-modal', { + closeModal: () => dispose(), + providerUuid, + }); + }} + /> +