Skip to content

Update MoneyRequestView.js #31084

@cead22

Description

@cead22
  • Design Doc
  • Let's update MoneyRequestView.js
    • The following should only apply to users in the violations beta
    • Let's add a connection to the transactionViolations and policyCategories Onyx collections as shown in the code snippet below, which will go in the withOnyx section of the code at the bottom
    • Let's add the new onyx key for the transaction violation collection
    • Add a new transactionViolation prop
    • Pass the transactionViolation to the MoneyRequestView function
    • For each field that can have a violation, Inside OfflineWithFeedback and below MenuItemWithTopDescription let's add a View that wraps a Text component to show the violation text, as shown in the snippet below
      • The fields are merchant, amount, category, date, tag, comment, billable, receipt, and tax
    • Fields with violations that go into a new page, like a list page for the cate of category and description for instance, should show a RBR circle to the right, in front of the caret >. Screenshots below
withOnyx({
    
    policyCategories: {
        key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report.policyID}`,
    },
    transactionViolation: {
        key: ({report}) => {
            const parentReportAction = ReportActionsUtils.getParentReportAction(report);
            const transactionID = lodashGet(parentReportAction, ['originalMessage', 'IOUTransactionID'], 0);
            return `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`;
        },
    },
...
{Boolean(ViolationUtils.getViolationForField(transactionViolation, 'amount')) && (
    <View>
        <Text style={[styles.ph5, styles.textLabelError]}>{ViolationUtils.getViolationForField(transactionViolation, 'amount')}</Text>
    </View>
)}

image
image

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions