diff --git a/packages/esm-patient-labs-app/src/lab-orders/add-lab-order/lab-order-form.component.tsx b/packages/esm-patient-labs-app/src/lab-orders/add-lab-order/lab-order-form.component.tsx index 02007aee87..29e819c66a 100644 --- a/packages/esm-patient-labs-app/src/lab-orders/add-lab-order/lab-order-form.component.tsx +++ b/packages/esm-patient-labs-app/src/lab-orders/add-lab-order/lab-order-form.component.tsx @@ -73,10 +73,9 @@ export function LabOrderForm({ initialOrder, closeWorkspace }: LabOrderFormProps }, }); const config = useConfig(); - const selectedLabTest = - config && config.labTestsWithOrderReasons - ? config.labTestsWithOrderReasons.find((p) => p.labTestUuid === defaultValues?.testType?.conceptUuid) - : null; + const orderReasons = + (config.labTestsWithOrderReasons?.find((c) => c.labTestUuid === defaultValues?.testType?.conceptUuid) || {}) + .orderReasons || []; const handleFormSubmission = useCallback( (data: LabOrderBasketItem) => { @@ -194,7 +193,7 @@ export function LabOrderForm({ initialOrder, closeWorkspace }: LabOrderFormProps - {selectedLabTest && ( + {orderReasons.length > 0 && ( @@ -208,7 +207,7 @@ export function LabOrderForm({ initialOrder, closeWorkspace }: LabOrderFormProps titleText={t('orderReason', 'Order reason')} selectedItem={''} itemToString={(item) => item?.label} - items={selectedLabTest.orderReasons} + items={orderReasons} onBlur={onBlur} onChange={({ selectedItem }) => onChange(selectedItem?.concept || '')} /> diff --git a/packages/esm-patient-labs-app/translations/en.json b/packages/esm-patient-labs-app/translations/en.json index 9c5441e7ea..21eab6b7dc 100644 --- a/packages/esm-patient-labs-app/translations/en.json +++ b/packages/esm-patient-labs-app/translations/en.json @@ -24,6 +24,7 @@ "onDate": "on", "orderActionNew": "New", "ordered": "Ordered", + "orderReason": "Order reason", "other": "Other", "panel": "Panel", "pleaseRequiredFields": "Please fill all required fields",