From 8ffba3602deceb50a28e93ddadfa14b48515bbb6 Mon Sep 17 00:00:00 2001 From: jwnasambu Date: Tue, 12 Nov 2024 16:08:32 +0300 Subject: [PATCH] Change the visitQueueNumberAttributeUuid not configured string in the service queues app --- ...-attribute-queue-number-cell.component.tsx | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/esm-service-queues-app/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx b/packages/esm-service-queues-app/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx index 9c8d8b4ff..f64a8791f 100644 --- a/packages/esm-service-queues-app/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx +++ b/packages/esm-service-queues-app/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx @@ -1,31 +1,25 @@ import React from 'react'; import { type VisitAttributeQueueNumberColumnConfig } from '../../config-schema'; -import { type QueueTableColumnFunction, type QueueEntry, type QueueTableCellComponentProps } from '../../types'; -import { InlineNotification } from '@carbon/react'; -import { useTranslation } from 'react-i18next'; +import { type QueueTableColumnFunction, type QueueEntry } from '../../types'; export const queueTableVisitAttributeQueueNumberColumn: QueueTableColumnFunction = ( key, header, { visitQueueNumberAttributeUuid }: VisitAttributeQueueNumberColumnConfig, ) => { + if (!visitQueueNumberAttributeUuid) { + console.error( + 'No visit queue number attribute is configured, but the queue is configured to display the queue number.', + ); + return null; + } + function getVisitQueueNumber(queueEntry: QueueEntry) { return queueEntry.visit?.attributes?.find((e) => e?.attributeType?.uuid === visitQueueNumberAttributeUuid)?.value; } - const QueueTableVisitAttributeQueueNumberCell = ({ queueEntry }: QueueTableCellComponentProps) => { - const { t } = useTranslation(); - return ( - <> - {visitQueueNumberAttributeUuid ? ( - {getVisitQueueNumber(queueEntry)} - ) : ( - - {t('visitQueueNumberAttributeUuid not configured', 'visitQueueNumberAttributeUuid not configured')} - - )} - - ); + const QueueTableVisitAttributeQueueNumberCell = ({ queueEntry }: { queueEntry: QueueEntry }) => { + return {getVisitQueueNumber(queueEntry)}; }; return {