-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD issue #34615] Display waypoint error in confirm page and detail page #30621
Closed
Closed
Changes from 15 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
3c33874
display waypoint error in confirm page and detail page
dukenv0307 3015ad8
get string error for distance request
dukenv0307 d1bc1d4
display red dot in LHN if distance request has error
dukenv0307 afe1cef
Merge branch 'main' into fix/29783
dukenv0307 bc084f7
rename function
dukenv0307 38fed63
Merge branch 'main' into fix/29783
dukenv0307 b0b2b57
update funtion to be more performant
dukenv0307 377f773
Merge branch 'main' into fix/29783
dukenv0307 51c2423
remove un-use function
dukenv0307 fa86169
Merge branch 'main' into fix/29783
dukenv0307 c361a34
fix translation
dukenv0307 5eea454
edit the error
dukenv0307 79d2392
Merge branch 'main' into fix/29783
dukenv0307 8b087ce
Merge branch 'main' into fix/29783
dukenv0307 21ae159
fix lint
dukenv0307 2217f53
merge main
dukenv0307 5e93b9e
refactor condition
dukenv0307 a984951
Merge branch 'main' into fix/29783
dukenv0307 c620254
fix lint
dukenv0307 ed4d5cf
fix lint
dukenv0307 e667003
Merge branch 'main' into fix/29783
dukenv0307 b4a3c8b
not restore when transaction is loading
dukenv0307 f67234c
merge main
dukenv0307 14251ff
merge main
dukenv0307 25b0a31
Merge branch 'main' into fix/29783
dukenv0307 9f0aee5
fix offline edit
dukenv0307 c869bd9
merge main
dukenv0307 0379ab3
fix ts
dukenv0307 1784122
fix ts
dukenv0307 6ed18c5
not check offline in submit function
dukenv0307 ca91b67
merge main
dukenv0307 015b990
Merge branch 'main' into fix/29783
dukenv0307 6adbf81
merge main and copy logic to new confirm page
dukenv0307 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,7 @@ function MoneyRequestConfirmationList(props) { | |
const shouldShowBillable = canUseTags && !lodashGet(props.policy, 'disabledFields.defaultBillable', true); | ||
|
||
const hasRoute = TransactionUtils.hasRoute(transaction); | ||
const hasRouteError = TransactionUtils.hasRouteError(transaction); | ||
const isDistanceRequestWithoutRoute = props.isDistanceRequest && !hasRoute; | ||
const formattedAmount = isDistanceRequestWithoutRoute | ||
? translate('common.tbd') | ||
|
@@ -264,12 +265,16 @@ function MoneyRequestConfirmationList(props) { | |
const [didConfirmSplit, setDidConfirmSplit] = useState(false); | ||
|
||
const shouldDisplayFieldError = useMemo(() => { | ||
if (!props.isEditingSplitBill) { | ||
if (!props.isEditingSplitBill && !props.isDistanceRequest) { | ||
return false; | ||
} | ||
|
||
return (props.hasSmartScanFailed && TransactionUtils.hasMissingSmartscanFields(transaction)) || (didConfirmSplit && TransactionUtils.areRequiredFieldsEmpty(transaction)); | ||
}, [props.isEditingSplitBill, props.hasSmartScanFailed, transaction, didConfirmSplit]); | ||
return ( | ||
(props.hasSmartScanFailed && TransactionUtils.hasMissingSmartscanFields(transaction)) || | ||
(didConfirmSplit && TransactionUtils.areRequiredFieldsEmpty(transaction)) || | ||
(props.isDistanceRequest && hasRouteError) | ||
); | ||
}, [props.isEditingSplitBill, props.hasSmartScanFailed, transaction, didConfirmSplit, hasRouteError, props.isDistanceRequest]); | ||
|
||
useEffect(() => { | ||
if (shouldDisplayFieldError && props.hasSmartScanFailed) { | ||
|
@@ -280,9 +285,14 @@ function MoneyRequestConfirmationList(props) { | |
setFormError('iou.error.genericSmartscanFailureMessage'); | ||
return; | ||
} | ||
|
||
if (shouldDisplayFieldError && hasRouteError) { | ||
setFormError('bankAccount.error.address'); | ||
return; | ||
} | ||
// reset the form error whenever the screen gains or loses focus | ||
setFormError(''); | ||
}, [isFocused, transaction, shouldDisplayFieldError, props.hasSmartScanFailed, didConfirmSplit]); | ||
}, [isFocused, transaction, shouldDisplayFieldError, props.hasSmartScanFailed, didConfirmSplit, hasRouteError]); | ||
|
||
useEffect(() => { | ||
if (!shouldCalculateDistanceAmount) { | ||
|
@@ -540,13 +550,25 @@ function MoneyRequestConfirmationList(props) { | |
<FormHelpMessage | ||
style={[styles.ph1, styles.mb2]} | ||
isError | ||
message={translate(formError)} | ||
message={props.isDistanceRequest ? formError : translate(formError)} | ||
/> | ||
)} | ||
{button} | ||
</> | ||
); | ||
}, [confirm, props.bankAccountRoute, props.iouCurrencyCode, props.iouType, props.isReadOnly, props.policyID, selectedParticipants, splitOrRequestOptions, translate, formError]); | ||
}, [ | ||
confirm, | ||
props.bankAccountRoute, | ||
props.iouCurrencyCode, | ||
props.iouType, | ||
props.isReadOnly, | ||
props.policyID, | ||
selectedParticipants, | ||
splitOrRequestOptions, | ||
translate, | ||
formError, | ||
props.isDistanceRequest, | ||
]); | ||
|
||
const {image: receiptImage, thumbnail: receiptThumbnail} = | ||
props.receiptPath && props.receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction, props.receiptPath, props.receiptFilename) : {}; | ||
|
@@ -672,6 +694,7 @@ function MoneyRequestConfirmationList(props) { | |
titleStyle={styles.flex1} | ||
onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_DISTANCE.getRoute(props.iouType, props.reportID))} | ||
disabled={didConfirm || !isTypeRequest} | ||
brickRoadIndicator={shouldDisplayFieldError && hasRouteError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If hasRouteError, it's already shouldDisplayFieldError, isn't it? |
||
interactive={!props.isReadOnly} | ||
/> | ||
)} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But not a blocker since this will be handled in #30073