Repository navigation
update empty receipt in wide RHP to allow picking the receipt #81467
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
Changes from all commits
8f9724d
06c93af
04402a6
42782cc
87eb7cb
6122bc7
c3301f0
6f16fcd
3c348d8
5284b4b
bf334b2
c72fea0
b9543f6
33098d1
7944cb4
e5f0f51
3480b22
ed5cb10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ import { | |
| } from '@libs/TransactionUtils'; | ||
| import ViolationsUtils, {filterReceiptViolations} from '@libs/Violations/ViolationsUtils'; | ||
| import Navigation from '@navigation/Navigation'; | ||
| import {cleanUpMoneyRequest} from '@userActions/IOU'; | ||
| import {cleanUpMoneyRequest, replaceReceipt} from '@userActions/IOU'; | ||
| import {navigateToConciergeChatAndDeleteReport} from '@userActions/Report'; | ||
| import {clearAllRelatedReportActionErrors} from '@userActions/ReportActions'; | ||
| import {clearError, getLastModifiedExpense, revert} from '@userActions/Transaction'; | ||
|
|
@@ -55,6 +55,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; | |
| import ROUTES from '@src/ROUTES'; | ||
| import type * as OnyxTypes from '@src/types/onyx'; | ||
| import type {TransactionPendingFieldsKey} from '@src/types/onyx/Transaction'; | ||
| import type {FileObject} from '@src/types/utils/Attachment'; | ||
| import {isEmptyObject} from '@src/types/utils/EmptyObject'; | ||
| import ReportActionItemImage from './ReportActionItemImage'; | ||
|
|
||
|
|
@@ -123,6 +124,7 @@ function MoneyRequestReceiptView({report, readonly = false, updatedTransaction, | |
| const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${moneyRequestReport?.policyID}`); | ||
| const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); | ||
| const transactionViolations = useTransactionViolations(transaction?.transactionID); | ||
| const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${moneyRequestReport?.policyID}`); | ||
|
|
||
| const isDistanceRequest = isDistanceRequestTransactionUtils(transaction); | ||
| const hasReceipt = hasReceiptTransactionUtils(updatedTransaction ?? transaction); | ||
|
|
@@ -327,6 +329,20 @@ function MoneyRequestReceiptView({report, readonly = false, updatedTransaction, | |
| </View> | ||
| ); | ||
|
|
||
| const setReceiptFile = (files: FileObject[]) => { | ||
| if (files.length === 0) { | ||
| return; | ||
| } | ||
|
|
||
| const file = files.at(0); | ||
|
|
||
| if (!file || !linkedTransactionID) { | ||
| return; | ||
| } | ||
| const source = URL.createObjectURL(file as Blob); | ||
|
nkdengineer marked this conversation as resolved.
Resolved
nkdengineer marked this conversation as resolved.
Resolved
|
||
| replaceReceipt({transactionID: linkedTransactionID, file: file as File, source, transactionPolicy: policy, transactionPolicyCategories: policyCategories}); | ||
|
Comment on lines
+342
to
+343
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.
Useful? React with 👍 / 👎.
Contributor
Author
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. It's incorrect, the wide-RHP is only available on web. |
||
| }; | ||
|
|
||
| // For empty receipt should be fullHeight | ||
| // For the rest, expand to match the content | ||
| return ( | ||
|
|
@@ -359,6 +375,7 @@ function MoneyRequestReceiptView({report, readonly = false, updatedTransaction, | |
| isInMoneyRequestView | ||
| style={receiptStyle} | ||
| isDisplayedInWideRHP={isDisplayedInWideRHP} | ||
| setReceiptFile={setReceiptFile} | ||
| /> | ||
| </OfflineWithFeedback> | ||
| )} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.