From cd2ed42d23c41e9c052fdf5ecf7db5210cc83f2a Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Fri, 6 Oct 2023 20:05:06 +0500 Subject: [PATCH] UIOR-1142: add localizations for inactive status (#1509) --- src/components/POLine/Vendor/VendorForm.js | 11 ++++++++--- translations/ui-orders/en.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/POLine/Vendor/VendorForm.js b/src/components/POLine/Vendor/VendorForm.js index 30862f141..a6ca1c083 100644 --- a/src/components/POLine/Vendor/VendorForm.js +++ b/src/components/POLine/Vendor/VendorForm.js @@ -1,7 +1,10 @@ import React, { useCallback, useMemo, useRef } from 'react'; import PropTypes from 'prop-types'; import { useForm } from 'react-final-form'; -import { FormattedMessage } from 'react-intl'; +import { + FormattedMessage, + useIntl, +} from 'react-intl'; import { Col, @@ -27,6 +30,7 @@ const VendorForm = ({ hiddenFields = {}, integrationConfigs = [], }) => { + const { formatMessage } = useIntl(); const { change, getState } = useForm(); const { vendorDetail } = getState().values; const currentAccountNumber = vendorDetail?.vendorAccount; @@ -34,15 +38,16 @@ const VendorForm = ({ const initialAccountNumber = useRef(currentAccountNumber); const activeAccountOptions = useMemo(() => { + const message = ` - ${formatMessage({ id: 'ui-orders.inactive' })}`; const activeAccounts = accounts.filter(({ accountStatus, accountNo }) => { return accountStatus === ACTIVE || accountNo === initialAccountNumber.current; }); return activeAccounts.map(({ name, accountNo, accountStatus }) => ({ - label: `${name} (${accountNo}) ${accountStatus === INACTIVE ? ' - Inactive' : ''}`, + label: `${name} (${accountNo}) ${accountStatus === INACTIVE ? message : ''}`, value: accountNo, })); - }, [accounts, initialAccountNumber]); + }, [accounts, formatMessage]); const onAccountChange = useCallback( ({ target: { value } }) => { diff --git a/translations/ui-orders/en.json b/translations/ui-orders/en.json index 7bd6123ee..d768b6ca8 100644 --- a/translations/ui-orders/en.json +++ b/translations/ui-orders/en.json @@ -1,6 +1,6 @@ { "appMenu.ordersAppSearch": "Orders app Search", - + "inactive": "Inactive", "breakInstanceConnection.modal.heading": "Remove instance connection", "breakInstanceConnection.modal.message": "Making this change will remove the link between the POL and selected inventory instance. Are you sure you would like to proceed with making this change and unlink this POL from the inventory instance \"{titleOrPackage}\"?",