diff --git a/packages/fhir-group-management/src/components/CommodityAddEdit/Default/tests/index.test.tsx b/packages/fhir-group-management/src/components/CommodityAddEdit/Default/tests/index.test.tsx
index 0122a0054..cd13af01c 100644
--- a/packages/fhir-group-management/src/components/CommodityAddEdit/Default/tests/index.test.tsx
+++ b/packages/fhir-group-management/src/components/CommodityAddEdit/Default/tests/index.test.tsx
@@ -16,6 +16,7 @@ import { groupResourceType, listResourceType, unitOfMeasure } from '../../../../
import userEvent from '@testing-library/user-event';
import * as notifications from '@opensrp/notifications';
import flushPromises from 'flush-promises';
+import { fillSearchableSelect } from './test-utils';
jest.mock('@opensrp/notifications', () => ({
__esModule: true,
@@ -473,50 +474,3 @@ test('#1116 adding new group but list does not exist', async () => {
await flushPromises();
});
-
-export interface SearchableSelectValues {
- selectId: string;
- searchOptionText: string;
- fullOptionText: string;
- beforeFilterOptions: string[];
- afterFilterOptions: string[];
-}
-
-/**
- * @param searchableSelectOptions options
- */
-export function fillSearchableSelect(searchableSelectOptions: SearchableSelectValues) {
- const { selectId, fullOptionText, searchOptionText, beforeFilterOptions, afterFilterOptions } =
- searchableSelectOptions;
-
- // simulate value selection for type
- const selectComponent = document.querySelector(`input#${selectId}`)!;
- fireEvent.mouseDown(selectComponent);
-
- const optionTexts = [
- ...document.querySelectorAll(
- `#${selectId}_list+div.rc-virtual-list .ant-select-item-option-content`
- ),
- ].map((option) => {
- return option.textContent;
- });
-
- expect(optionTexts).toHaveLength(beforeFilterOptions.length);
- expect(optionTexts).toEqual(beforeFilterOptions);
-
- // filter searching through members works
- userEvent.type(selectComponent, searchOptionText);
-
- // options after search
- const afterFilterOptionTexts = [
- ...document.querySelectorAll(
- `#${selectId}_list+div.rc-virtual-list .ant-select-item-option-content`
- ),
- ].map((option) => {
- return option.textContent;
- });
-
- expect(afterFilterOptionTexts).toEqual(afterFilterOptions);
-
- fireEvent.click(document.querySelector(`[title="${fullOptionText}"]`)!);
-}
diff --git a/packages/fhir-group-management/src/components/CommodityAddEdit/Default/tests/test-utils.ts b/packages/fhir-group-management/src/components/CommodityAddEdit/Default/tests/test-utils.ts
new file mode 100644
index 000000000..411275062
--- /dev/null
+++ b/packages/fhir-group-management/src/components/CommodityAddEdit/Default/tests/test-utils.ts
@@ -0,0 +1,50 @@
+/* eslint-disable @typescript-eslint/no-non-null-assertion */
+import { fireEvent } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+
+export interface SearchableSelectValues {
+ selectId: string;
+ searchOptionText: string;
+ fullOptionText: string;
+ beforeFilterOptions: string[];
+ afterFilterOptions: string[];
+}
+
+/**
+ * @param searchableSelectOptions options
+ */
+export function fillSearchableSelect(searchableSelectOptions: SearchableSelectValues) {
+ const { selectId, fullOptionText, searchOptionText, beforeFilterOptions, afterFilterOptions } =
+ searchableSelectOptions;
+
+ // simulate value selection for type
+ const selectComponent = document.querySelector(`input#${selectId}`)!;
+ fireEvent.mouseDown(selectComponent);
+
+ const optionTexts = [
+ ...document.querySelectorAll(
+ `#${selectId}_list+div.rc-virtual-list .ant-select-item-option-content`
+ ),
+ ].map((option) => {
+ return option.textContent;
+ });
+
+ expect(optionTexts).toHaveLength(beforeFilterOptions.length);
+ expect(optionTexts).toEqual(beforeFilterOptions);
+
+ // filter searching through members works
+ userEvent.type(selectComponent, searchOptionText);
+
+ // options after search
+ const afterFilterOptionTexts = [
+ ...document.querySelectorAll(
+ `#${selectId}_list+div.rc-virtual-list .ant-select-item-option-content`
+ ),
+ ].map((option) => {
+ return option.textContent;
+ });
+
+ expect(afterFilterOptionTexts).toEqual(afterFilterOptions);
+
+ fireEvent.click(document.querySelector(`[title="${fullOptionText}"]`)!);
+}
diff --git a/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/__snapshots__/index.test.tsx.snap b/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/__snapshots__/index.test.tsx.snap
index d225727f1..0d1af58e0 100644
--- a/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/__snapshots__/index.test.tsx.snap
+++ b/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/__snapshots__/index.test.tsx.snap
@@ -11,15 +11,6 @@ exports[`renders correctly: active radio button 1`] = `
/>
`;
-exports[`renders correctly: active radio button 2`] = `
-
-`;
-
exports[`renders correctly: attractive item no radio button 1`] = `
`;
-
-exports[`renders correctly: disabled radio button 2`] = `
-
-`;
diff --git a/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/index.test.tsx b/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/index.test.tsx
index b6af08b51..f82b0ca7a 100644
--- a/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/index.test.tsx
+++ b/packages/fhir-group-management/src/components/CommodityAddEdit/Eusm/tests/index.test.tsx
@@ -24,9 +24,9 @@ import {
import { binaryResourceType, groupResourceType, listResourceType } from '../../../../constants';
import userEvent from '@testing-library/user-event';
import * as notifications from '@opensrp/notifications';
-import { fillSearchableSelect } from '../../Default/tests/index.test';
import { photoUploadCharacteristicCode } from '../../../../helpers/utils';
import { cloneDeep } from 'lodash';
+import { fillSearchableSelect } from '../../Default/tests/test-utils';
jest.mock('@opensrp/notifications', () => ({
__esModule: true,
diff --git a/packages/fhir-group-management/src/components/LocationInventory/form.tsx b/packages/fhir-group-management/src/components/LocationInventory/form.tsx
index 0070d306a..e856edae8 100644
--- a/packages/fhir-group-management/src/components/LocationInventory/form.tsx
+++ b/packages/fhir-group-management/src/components/LocationInventory/form.tsx
@@ -10,7 +10,6 @@ import {
import { useTranslation } from '../../mls';
import { useQueryClient, useMutation } from 'react-query';
import { supplyMgSnomedCode, snomedCodeSystem } from '../../helpers/utils';
-import { Rule } from 'rc-field-form/lib/interface';
import {
sendSuccessNotification,
sendErrorNotification,
@@ -33,6 +32,7 @@ import {
name,
type,
actual,
+ unicefDonorValueSetId,
} from '../../constants';
import {
getLocationInventoryPayload,
@@ -149,12 +149,7 @@ const AddLocationInventoryForm = (props: LocationInventoryFormProps) => {
}
};
- const validationRules = validationRulesFactory(t);
- let serialNumebrRule: Rule[] = [{ required: false }];
- if (attractiveProduct) {
- serialNumebrRule = validationRules[serialNumber];
- }
-
+ const validationRules = validationRulesFactory(t, attractiveProduct);
const productQueryFilters = getProductQueryFilters(commodityListId);
return (
@@ -167,25 +162,25 @@ const AddLocationInventoryForm = (props: LocationInventoryFormProps) => {
}}
initialValues={initialValues}
>
-
+
baseUrl={fhirBaseURL}
resourceType={groupResourceType}
transformOption={processProductOptions}
extraQueryParams={productQueryFilters}
- showSearch={true}
+ showSearch={false}
placeholder={t('Select product')}
getFullOptionOnChange={productChangeHandler}
disabled={editMode}
/>
-
-
+
+
{
{
-
+
-
+
{/* start hidden fields */}
@@ -272,7 +267,7 @@ const AddLocationInventoryForm = (props: LocationInventoryFormProps) => {