From 259d4bce633c044223ca856127799bb4790b04f9 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 2 Oct 2023 17:54:44 +0200 Subject: [PATCH] show category on a split bill --- src/components/MoneyRequestConfirmationList.js | 3 ++- src/pages/iou/SplitBillDetailsPage.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index c36ae3a85f0f..39e79d594f1d 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -197,7 +197,8 @@ function MoneyRequestConfirmationList(props) { const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(ReportUtils.getReport(props.reportID))), [props.reportID]); // A flag for showing the categories field - const shouldShowCategories = isPolicyExpenseChat && Permissions.canUseCategories(props.betas) && OptionsListUtils.hasEnabledOptions(_.values(props.policyCategories)); + const shouldShowCategories = + isPolicyExpenseChat && Permissions.canUseCategories(props.betas) && (props.iouCategory || OptionsListUtils.hasEnabledOptions(_.values(props.policyCategories))); // Fetches the first tag list of the policy const policyTag = PolicyUtils.getTag(props.policyTags); diff --git a/src/pages/iou/SplitBillDetailsPage.js b/src/pages/iou/SplitBillDetailsPage.js index 23da92bcc9e7..6f7e37883c85 100644 --- a/src/pages/iou/SplitBillDetailsPage.js +++ b/src/pages/iou/SplitBillDetailsPage.js @@ -1,5 +1,6 @@ import React from 'react'; import _ from 'underscore'; +import lodashGet from 'lodash/get'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; @@ -69,7 +70,7 @@ function SplitBillDetailsPage(props) { } const payeePersonalDetails = props.personalDetails[reportAction.actorAccountID]; const participantsExcludingPayee = _.filter(participants, (participant) => participant.accountID !== reportAction.actorAccountID); - const {amount: splitAmount, currency: splitCurrency, comment: splitComment} = ReportUtils.getTransactionDetails(transaction); + const {amount: splitAmount, currency: splitCurrency, comment: splitComment, category: splitCategory} = ReportUtils.getTransactionDetails(transaction); return ( @@ -87,9 +88,11 @@ function SplitBillDetailsPage(props) { iouAmount={splitAmount} iouComment={splitComment} iouCurrencyCode={splitCurrency} + iouCategory={splitCategory} iouType={CONST.IOU.MONEY_REQUEST_TYPE.SPLIT} isReadOnly shouldShowFooter={false} + reportID={lodashGet(props.report, 'reportID', '')} /> )}