diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 1b4967a9c54c..da3c19f48d1b 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -699,7 +699,13 @@ function MoneyRequestConfirmationList(props) { title={props.iouCategory} description={translate('common.category')} numberOfLinesTitle={2} - onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_CATEGORY.getRoute(props.iouType, props.reportID))} + onPress={() => { + if (props.isEditingSplitBill) { + Navigation.navigate(ROUTES.EDIT_SPLIT_BILL.getRoute(props.reportID, props.reportActionID, CONST.EDIT_REQUEST_FIELD.CATEGORY)); + return; + } + Navigation.navigate(ROUTES.MONEY_REQUEST_CATEGORY.getRoute(props.iouType, props.reportID)); + }} style={[styles.moneyRequestMenuItem]} titleStyle={styles.flex1} disabled={didConfirm} @@ -713,7 +719,13 @@ function MoneyRequestConfirmationList(props) { title={props.iouTag} description={policyTagListName} numberOfLinesTitle={2} - onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_TAG.getRoute(props.iouType, props.reportID))} + onPress={() => { + if (props.isEditingSplitBill) { + Navigation.navigate(ROUTES.EDIT_SPLIT_BILL.getRoute(props.reportID, props.reportActionID, CONST.EDIT_REQUEST_FIELD.TAG)); + return; + } + Navigation.navigate(ROUTES.MONEY_REQUEST_TAG.getRoute(props.iouType, props.reportID)); + }} style={[styles.moneyRequestMenuItem]} disabled={didConfirm} interactive={!props.isReadOnly} diff --git a/src/pages/EditSplitBillPage.js b/src/pages/EditSplitBillPage.js index c4e47e2d4c35..3e5a5e7f5d53 100644 --- a/src/pages/EditSplitBillPage.js +++ b/src/pages/EditSplitBillPage.js @@ -13,9 +13,12 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import EditRequestAmountPage from './EditRequestAmountPage'; +import EditRequestCategoryPage from './EditRequestCategoryPage'; import EditRequestCreatedPage from './EditRequestCreatedPage'; import EditRequestDescriptionPage from './EditRequestDescriptionPage'; import EditRequestMerchantPage from './EditRequestMerchantPage'; +import EditRequestTagPage from './EditRequestTagPage'; +import reportPropTypes from './reportPropTypes'; const propTypes = { /** Route from navigation */ @@ -38,13 +41,16 @@ const propTypes = { /** The draft transaction that holds data to be persisted on the current transaction */ draftTransaction: transactionPropTypes, + + /** The report currently being used */ + report: reportPropTypes.isRequired, }; const defaultProps = { draftTransaction: undefined, }; -function EditSplitBillPage({route, transaction, draftTransaction}) { +function EditSplitBillPage({route, transaction, draftTransaction, report}) { const fieldToEdit = lodashGet(route, ['params', 'field'], ''); const reportID = lodashGet(route, ['params', 'reportID'], ''); const reportActionID = lodashGet(route, ['params', 'reportActionID'], ''); @@ -55,6 +61,8 @@ function EditSplitBillPage({route, transaction, draftTransaction}) { comment: transactionDescription, merchant: transactionMerchant, created: transactionCreated, + category: transactionCategory, + tag: transactionTag, } = draftTransaction ? ReportUtils.getTransactionDetails(draftTransaction) : ReportUtils.getTransactionDetails(transaction); const defaultCurrency = lodashGet(route, 'params.currency', '') || transactionCurrency; @@ -130,6 +138,30 @@ function EditSplitBillPage({route, transaction, draftTransaction}) { ); } + if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.CATEGORY) { + return ( + { + setDraftSplitTransaction({category: transactionChanges.category.trim()}); + }} + /> + ); + } + + if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.TAG) { + return ( + { + setDraftSplitTransaction({tag: transactionChanges.tag.trim()}); + }} + /> + ); + } + return ; } @@ -142,6 +174,9 @@ export default compose( key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${route.params.reportID}`, canEvict: false, }, + report: { + key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID}`, + }, }), // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file withOnyx({