Skip to content

Commit

Permalink
Merge pull request #37388 from dukenv0307/fix/37095-disabled-tags-are…
Browse files Browse the repository at this point in the history
…-showing-as-required

Fix/37095: Tag list show required
  • Loading branch information
MonilBhavsar authored Apr 5, 2024
2 parents 514e8c7 + 025be6b commit 4b59e6a
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions src/components/MoneyTemporaryForRefactorRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
const isMerchantRequired = isPolicyExpenseChat && !isScanRequest && shouldShowMerchant;

const isCategoryRequired = canUseViolations && lodashGet(policy, 'requiresCategory', false);
const isTagRequired = canUseViolations && lodashGet(policy, 'requiresTag', false);

useEffect(() => {
if ((!isMerchantRequired && isMerchantEmpty) || !merchantError) {
Expand Down Expand Up @@ -534,7 +533,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
if (updatedTagsString !== TransactionUtils.getTag(transaction) && updatedTagsString) {
IOU.setMoneyRequestTag(transaction.transactionID, updatedTagsString);
}
}, [policyTagLists, transaction, policyTags, isTagRequired, canUseViolations]);
}, [policyTagLists, transaction, policyTags, canUseViolations]);

/**
* @param {Object} option
Expand Down Expand Up @@ -829,28 +828,38 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
shouldShow: shouldShowCategories,
isSupplementary: !isCategoryRequired,
},
..._.map(policyTagLists, ({name}, index) => ({
item: (
<MenuItemWithTopDescription
key={name}
shouldShowRightIcon={!isReadOnly}
title={TransactionUtils.getTagForDisplay(transaction, index)}
description={name}
numberOfLinesTitle={2}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAG.getRoute(CONST.IOU.ACTION.CREATE, iouType, index, transaction.transactionID, reportID, Navigation.getActiveRouteWithoutParams()),
)
}
style={[styles.moneyRequestMenuItem]}
disabled={didConfirm}
interactive={!isReadOnly}
rightLabel={isTagRequired ? translate('common.required') : ''}
/>
),
shouldShow: shouldShowTags,
isSupplementary: !isTagRequired,
})),
..._.map(policyTagLists, ({name, required}, index) => {
const isTagRequired = isUndefined(required) ? false : canUseViolations && required;
return {
item: (
<MenuItemWithTopDescription
key={name}
shouldShowRightIcon={!isReadOnly}
title={TransactionUtils.getTagForDisplay(transaction, index)}
description={name}
numberOfLinesTitle={2}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAG.getRoute(
CONST.IOU.ACTION.CREATE,
iouType,
index,
transaction.transactionID,
reportID,
Navigation.getActiveRouteWithoutParams(),
),
)
}
style={[styles.moneyRequestMenuItem]}
disabled={didConfirm}
interactive={!isReadOnly}
rightLabel={isTagRequired ? translate('common.required') : ''}
/>
),
shouldShow: shouldShowTags,
isSupplementary: !isTagRequired,
};
}),
{
item: (
<MenuItemWithTopDescription
Expand Down

0 comments on commit 4b59e6a

Please sign in to comment.