From b8fde24fadb827fd5e21cc7bcce597ff6ddb3859 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sun, 23 Jun 2024 18:53:30 +0530 Subject: [PATCH 1/4] fix: QBO - Confirmation page still shows tag field when all subtags are disabled. Signed-off-by: Krishna Gupta --- src/components/MoneyRequestConfirmationList.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 8db2901a6116..af4735579c78 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -1015,8 +1015,10 @@ function MoneyRequestConfirmationList({ shouldShow: shouldShowCategories, isSupplementary: action === CONST.IOU.ACTION.CATEGORIZE ? false : !isCategoryRequired, }, - ...policyTagLists.map(({name, required}, index) => { + ...policyTagLists.map(({name, required, tags}, index) => { const isTagRequired = required ?? false; + const isMultilevelTags = PolicyUtils.isMultiLevelTags(policyTags); + const shouldShow = isMultilevelTags ? shouldShowTags && OptionsListUtils.hasEnabledOptions(tags) : shouldShowTags; return { item: ( ), - shouldShow: shouldShowTags, + shouldShow, isSupplementary: !isTagRequired, }; }), From b4bfefadb2c51832a61c361c163c807769df9e55 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sun, 23 Jun 2024 19:01:56 +0530 Subject: [PATCH 2/4] minor update. Signed-off-by: Krishna Gupta --- src/components/MoneyRequestConfirmationList.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index af4735579c78..0ca1f6b41426 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -300,6 +300,7 @@ function MoneyRequestConfirmationList({ // A flag for showing the tags field // TODO: remove the !isTypeInvoice from this condition after BE supports tags for invoices: https://github.com/Expensify/App/issues/41281 const shouldShowTags = useMemo(() => isPolicyExpenseChat && OptionsListUtils.hasEnabledTags(policyTagLists) && !isTypeInvoice, [isPolicyExpenseChat, policyTagLists, isTypeInvoice]); + const isMultilevelTags = PolicyUtils.isMultiLevelTags(policyTags); const shouldShowTax = isTaxTrackingEnabled(isPolicyExpenseChat, policy, isDistanceRequest) && !isTypeInvoice; From 7d553fd8450a09430fc464fb5677b02ac4b3ca9e Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sun, 23 Jun 2024 19:03:28 +0530 Subject: [PATCH 3/4] minor update. Signed-off-by: Krishna Gupta --- src/components/MoneyRequestConfirmationList.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 0ca1f6b41426..58dd431ba30c 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -1018,7 +1018,6 @@ function MoneyRequestConfirmationList({ }, ...policyTagLists.map(({name, required, tags}, index) => { const isTagRequired = required ?? false; - const isMultilevelTags = PolicyUtils.isMultiLevelTags(policyTags); const shouldShow = isMultilevelTags ? shouldShowTags && OptionsListUtils.hasEnabledOptions(tags) : shouldShowTags; return { item: ( From 3a7dc0c940dc67b09cf490d32dd18869f6876c01 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Thu, 27 Jun 2024 18:30:22 +0530 Subject: [PATCH 4/4] add changes to MoneyRequestConfirmationListFooter. Signed-off-by: Krishna Gupta --- src/components/MoneyRequestConfirmationList.tsx | 1 + src/components/MoneyRequestConfirmationListFooter.tsx | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 8bfcbbeb779e..7e6682492eb2 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -814,6 +814,7 @@ function MoneyRequestConfirmationList({ isTypeInvoice={isTypeInvoice} onToggleBillable={onToggleBillable} policy={policy} + policyTags={policyTags} policyTagLists={policyTagLists} rate={rate} receiptFilename={receiptFilename} diff --git a/src/components/MoneyRequestConfirmationListFooter.tsx b/src/components/MoneyRequestConfirmationListFooter.tsx index cda43938a18f..8dfff6466ab9 100644 --- a/src/components/MoneyRequestConfirmationListFooter.tsx +++ b/src/components/MoneyRequestConfirmationListFooter.tsx @@ -117,6 +117,9 @@ type MoneyRequestConfirmationListFooterProps = { /** The policy */ policy: OnyxEntry; + /** The policy tag lists */ + policyTags: OnyxEntry; + /** The policy tag lists */ policyTagLists: Array>; @@ -193,6 +196,7 @@ function MoneyRequestConfirmationListFooter({ isTypeInvoice, onToggleBillable, policy, + policyTags, policyTagLists, rate, receiptFilename, @@ -226,6 +230,7 @@ function MoneyRequestConfirmationListFooter({ // A flag for showing the tags field // TODO: remove the !isTypeInvoice from this condition after BE supports tags for invoices: https://github.com/Expensify/App/issues/41281 const shouldShowTags = useMemo(() => isPolicyExpenseChat && OptionsListUtils.hasEnabledTags(policyTagLists) && !isTypeInvoice, [isPolicyExpenseChat, isTypeInvoice, policyTagLists]); + const isMultilevelTags = useMemo(() => PolicyUtils.isMultiLevelTags(policyTags), [policyTags]); const senderWorkspace = useMemo(() => { const senderWorkspaceParticipant = selectedParticipants.find((participant) => participant.isSender); @@ -437,8 +442,9 @@ function MoneyRequestConfirmationListFooter({ shouldShow: shouldShowCategories, isSupplementary: action === CONST.IOU.ACTION.CATEGORIZE ? false : !isCategoryRequired, }, - ...policyTagLists.map(({name, required}, index) => { + ...policyTagLists.map(({name, required, tags}, index) => { const isTagRequired = required ?? false; + const shouldShow = shouldShowTags && (!isMultilevelTags || OptionsListUtils.hasEnabledOptions(tags)); return { item: ( ), - shouldShow: shouldShowTags, + shouldShow, isSupplementary: !isTagRequired, }; }),