diff --git a/e2e/specs/drug-orders.spec.ts b/e2e/specs/drug-orders.spec.ts
index 299d72d3e7..8f9b3518de 100644
--- a/e2e/specs/drug-orders.spec.ts
+++ b/e2e/specs/drug-orders.spec.ts
@@ -145,6 +145,8 @@ test('Record, edit and discontinue a drug order', async ({ page }) => {
await test.step('And I change the route to `Inhalation`', async () => {
await form.getByPlaceholder(/route/i).click();
+ await form.getByPlaceholder(/route/i).clear();
+ await form.getByPlaceholder(/route/i).fill('Inhalation');
await form.getByText('Inhalation', { exact: true }).click();
});
diff --git a/packages/esm-patient-medications-app/src/add-drug-order/drug-order-form.component.tsx b/packages/esm-patient-medications-app/src/add-drug-order/drug-order-form.component.tsx
index 5297f0a988..2dbc5d41a0 100644
--- a/packages/esm-patient-medications-app/src/add-drug-order/drug-order-form.component.tsx
+++ b/packages/esm-patient-medications-app/src/add-drug-order/drug-order-form.component.tsx
@@ -338,7 +338,11 @@ export function DrugOrderForm({ initialOrderBasketItem, onSave, onCancel, prompt
return orderConfigObject?.orderFrequencies ?? [];
}, [orderConfigObject]);
- const filterItems = useCallback((menu) => {
+ const filterItemsByName = useCallback((menu) => {
+ return menu?.item?.value?.toLowerCase().includes(menu?.inputValue?.toLowerCase());
+ }, []);
+
+ const filterItemsBySynonymNames = useCallback((menu) => {
if (menu?.inputValue?.length) {
return menu.item?.names?.some((abbr: string) => abbr.toLowerCase().includes(menu.inputValue.toLowerCase()));
}
@@ -482,6 +486,7 @@ export function DrugOrderForm({ initialOrderBasketItem, onSave, onCancel, prompt
getValues={getValues}
size={isTablet ? 'lg' : 'md'}
id="dosingUnits"
+ shouldFilterItem={filterItemsByName}
items={drugDosingUnits}
placeholder={t('editDosageUnitsPlaceholder', 'Unit')}
titleText={t('editDosageUnitsTitle', 'Dose unit')}
@@ -496,14 +501,15 @@ export function DrugOrderForm({ initialOrderBasketItem, onSave, onCancel, prompt
item?.value}
+ name="route"
placeholder={t('editRouteComboBoxTitle', 'Route')}
+ shouldFilterItem={filterItemsByName}
+ size={isTablet ? 'lg' : 'md'}
titleText={t('editRouteComboBoxTitle', 'Route')}
- itemToString={(item) => item?.value}
+ type="comboBox"
/>
@@ -516,7 +522,7 @@ export function DrugOrderForm({ initialOrderBasketItem, onSave, onCancel, prompt
size={isTablet ? 'lg' : 'md'}
id="editFrequency"
items={orderFrequencies}
- shouldFilterItem={filterItems}
+ shouldFilterItem={filterItemsBySynonymNames}
placeholder={t('editFrequencyComboBoxTitle', 'Frequency')}
titleText={t('editFrequencyComboBoxTitle', 'Frequency')}
itemToString={(item) => item?.value}
@@ -647,6 +653,7 @@ export function DrugOrderForm({ initialOrderBasketItem, onSave, onCancel, prompt
items={durationUnits}
itemToString={(item) => item?.value}
placeholder={t('durationUnitPlaceholder', 'Duration Unit')}
+ shouldFilterItem={filterItemsByName}
/>
@@ -674,14 +681,15 @@ export function DrugOrderForm({ initialOrderBasketItem, onSave, onCancel, prompt
item?.value}
+ name="quantityUnits"
placeholder={t('editDispensingUnit', 'Quantity unit')}
+ shouldFilterItem={filterItemsByName}
+ size="lg"
titleText={t('editDispensingUnit', 'Quantity unit')}
- itemToString={(item) => item?.value}
+ type="comboBox"
/>