diff --git a/packages/fhir-group-management/src/components/LocationInventory/form.tsx b/packages/fhir-group-management/src/components/LocationInventory/form.tsx index a40b5b377..42429566c 100644 --- a/packages/fhir-group-management/src/components/LocationInventory/form.tsx +++ b/packages/fhir-group-management/src/components/LocationInventory/form.tsx @@ -218,14 +218,16 @@ const AddLocationInventoryForm = (props: LocationInventoryFormProps) => { /> - - - + {attractiveProduct ? ( + + + + ) : null} { const { fhirBaseURL, listId, commodityListId } = props; const { t } = useTranslation(); const { inventoryId, servicePointId } = useParams(); - const pageTitle = inventoryId ? t('Edit locations Inventory') : t('Add locations Inventory'); + const pageTitle = inventoryId + ? t('Edit Service Point Inventory') + : t('Add Service Point Inventory'); const inventoryResource = useQuery( [fhirBaseURL, inventoryId], diff --git a/packages/fhir-group-management/src/components/LocationInventory/tests/form.test.tsx b/packages/fhir-group-management/src/components/LocationInventory/tests/form.test.tsx index e926bf81b..9ae6f8b83 100644 --- a/packages/fhir-group-management/src/components/LocationInventory/tests/form.test.tsx +++ b/packages/fhir-group-management/src/components/LocationInventory/tests/form.test.tsx @@ -137,7 +137,6 @@ test('form validation works', async () => { 'Delivery date is required', 'Accountability end date is required', 'UNICEF section is required', - 'PO number is required', ]); }); @@ -320,6 +319,9 @@ test('#1384 - correctly updates location inventory', async () => { expect(preFetchScope.isDone()).toBeTruthy(); }); + // serial number is initially not shown on the form + expect(screen.queryByText('Serial number')).not.toBeInTheDocument(); + // simulate value selection for product const productSelectComponent = document.querySelector(`input#${product}`)!; fireEvent.mouseDown(productSelectComponent); diff --git a/packages/fhir-group-management/src/components/LocationInventory/tests/index.test.tsx b/packages/fhir-group-management/src/components/LocationInventory/tests/index.test.tsx index 9f21aad64..518ef673c 100644 --- a/packages/fhir-group-management/src/components/LocationInventory/tests/index.test.tsx +++ b/packages/fhir-group-management/src/components/LocationInventory/tests/index.test.tsx @@ -122,14 +122,14 @@ test('renders correctly', async () => { await waitForElementToBeRemoved(document.querySelector('.ant-spin')); - screen.getByText('Add locations Inventory'); + screen.getByText('Add Service Point Inventory'); // form items screen.getByText('Product name'); screen.getByText('Quantity'); screen.getByText('Delivery date'); screen.getByText('Accountability end date'); screen.getByText('UNICEF section'); - screen.getByText('Serial number'); + expect(screen.queryByAltText('Serial number')).not.toBeInTheDocument(); screen.getByText('Donor'); screen.getByText('PO number'); screen.getByText('Expiry date'); @@ -160,5 +160,5 @@ test('renders correctly on edit', async () => { await waitForElementToBeRemoved(document.querySelector('.ant-spin')); - screen.getByText('Edit locations Inventory'); + screen.getByText('Edit Service Point Inventory'); }); diff --git a/packages/fhir-group-management/src/components/LocationInventory/utils.tsx b/packages/fhir-group-management/src/components/LocationInventory/utils.tsx index be0504fa2..18b06cc19 100644 --- a/packages/fhir-group-management/src/components/LocationInventory/utils.tsx +++ b/packages/fhir-group-management/src/components/LocationInventory/utils.tsx @@ -582,10 +582,7 @@ export const validationRulesFactory = (t: TFunction, isAttractiveProduct: boolea { required: true, message: t('Accountability end date is required') }, ] as Rule[], [serialNumber]: [{ type: 'string', message: t('Must be a valid string') }] as Rule[], - [PONumber]: [ - { type: 'string', message: t('Must be a valid string') }, - { required: true, message: t('PO number is required') }, - ] as Rule[], + [PONumber]: [{ type: 'string', message: t('Must be a valid string') }] as Rule[], }; if (isAttractiveProduct) { rules[serialNumber].push({ required: true, message: t('Serial number is required') });