Skip to content

Commit

Permalink
Merge pull request #34533 from infinitered/violations/cdanwards/add-r…
Browse files Browse the repository at this point in the history
…eceipt-component

Adds Receipt Component to Money Request confirmation page
  • Loading branch information
Julesssss authored Jan 23, 2024
2 parents c060897 + a2ff790 commit 0bdbfbb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Image from './Image';
import MenuItemWithTopDescription from './MenuItemWithTopDescription';
import optionPropTypes from './optionPropTypes';
import OptionsSelector from './OptionsSelector';
import ReceiptEmptyState from './ReceiptEmptyState';
import SettlementButton from './SettlementButton';
import ShowMoreButton from './ShowMoreButton';
import Switch from './Switch';
Expand Down Expand Up @@ -604,7 +605,7 @@ function MoneyRequestConfirmationList(props) {
<ConfirmedRoute transaction={props.transaction} />
</View>
)}
{(receiptImage || receiptThumbnail) && (
{receiptImage || receiptThumbnail ? (
<Image
style={styles.moneyRequestImage}
source={{uri: receiptThumbnail || receiptImage}}
Expand All @@ -613,6 +614,25 @@ function MoneyRequestConfirmationList(props) {
// So if we have a thumbnail, it means we're retrieving the image from the server
isAuthTokenRequired={!_.isEmpty(receiptThumbnail)}
/>
) : (
// The empty receipt component should only show for IOU Requests of a paid policy ("Team" or "Corporate")
PolicyUtils.isPaidGroupPolicy(props.policy) &&
!props.isDistanceRequest &&
props.iouType === CONST.IOU.TYPE.REQUEST && (
<ReceiptEmptyState
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(
CONST.IOU.ACTION.CREATE,
props.iouType,
transaction.transactionID,
props.reportID,
Navigation.getActiveRouteWithoutParams(),
),
)
}
/>
)
)}
{props.shouldShowSmartScanFields && (
<MenuItemWithTopDescription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Image from './Image';
import MenuItemWithTopDescription from './MenuItemWithTopDescription';
import optionPropTypes from './optionPropTypes';
import OptionsSelector from './OptionsSelector';
import ReceiptEmptyState from './ReceiptEmptyState';
import SettlementButton from './SettlementButton';
import Switch from './Switch';
import tagPropTypes from './tagPropTypes';
Expand Down Expand Up @@ -638,7 +639,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
<ConfirmedRoute transaction={transaction} />
</View>
)}
{(receiptImage || receiptThumbnail) && (
{receiptImage || receiptThumbnail ? (
<Image
style={styles.moneyRequestImage}
source={{uri: receiptThumbnail || receiptImage}}
Expand All @@ -647,6 +648,19 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
// So if we have a thumbnail, it means we're retrieving the image from the server
isAuthTokenRequired={!_.isEmpty(receiptThumbnail)}
/>
) : (
// The empty receipt component should only show for IOU Requests of a paid policy ("Team" or "Corporate")
PolicyUtils.isPaidGroupPolicy(policy) &&
!isDistanceRequest &&
iouType === CONST.IOU.TYPE.REQUEST && (
<ReceiptEmptyState
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(CONST.IOU.ACTION.CREATE, iouType, transaction.transactionID, reportID, Navigation.getActiveRouteWithoutParams()),
)
}
/>
)
)}
{shouldShowSmartScanFields && (
<MenuItemWithTopDescription
Expand Down

0 comments on commit 0bdbfbb

Please sign in to comment.