Skip to content

Commit

Permalink
UIOR-1142: add localizations for inactive status (#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam authored Oct 6, 2023
1 parent a8fafa3 commit cd2ed42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/components/POLine/Vendor/VendorForm.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -27,22 +30,24 @@ const VendorForm = ({
hiddenFields = {},
integrationConfigs = [],
}) => {
const { formatMessage } = useIntl();
const { change, getState } = useForm();
const { vendorDetail } = getState().values;
const currentAccountNumber = vendorDetail?.vendorAccount;
const isPostPendingOrder = !isWorkflowStatusIsPending(order);
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 } }) => {
Expand Down
2 changes: 1 addition & 1 deletion translations/ui-orders/en.json
Original file line number Diff line number Diff line change
@@ -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 \"<b>{titleOrPackage}</b>\"?",

Expand Down

0 comments on commit cd2ed42

Please sign in to comment.