diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js index 202689085d97..758c708e4d91 100644 --- a/src/components/ReportActionItem/IOUPreview.js +++ b/src/components/ReportActionItem/IOUPreview.js @@ -26,6 +26,8 @@ import {showContextMenuForReport} from '../ShowContextMenuContext'; import * as OptionsListUtils from '../../libs/OptionsListUtils'; import Button from '../Button'; import * as CurrencyUtils from '../../libs/CurrencyUtils'; +import * as StyleUtils from '../../styles/StyleUtils'; +import getButtonState from '../../libs/getButtonState'; const propTypes = { /** Additional logic for displaying the pay button */ @@ -142,7 +144,7 @@ const IOUPreview = (props) => { const managerEmail = props.iouReport.managerEmail || ''; const ownerEmail = props.iouReport.ownerEmail || ''; - // When displaying within a IOUDetailsModal we cannot guarentee that participants are included in the originalMessage data + // When displaying within a IOUDetailsModal we cannot guarantee that participants are included in the originalMessage data // Because an IOUPreview of type split can never be rendered within the IOUDetailsModal, manually building the email array is only needed for non-billSplit ious const participantEmails = props.isBillSplit ? props.action.originalMessage.participants : [managerEmail, ownerEmail]; const participantAvatars = OptionsListUtils.getAvatarsForLogins(participantEmails, props.personalDetails); @@ -154,6 +156,19 @@ const IOUPreview = (props) => { const requestAmount = props.isBillSplit ? props.action.originalMessage.amount : props.iouReport.total; const requestCurrency = props.isBillSplit ? lodashGet(props.action, 'originalMessage.currency', CONST.CURRENCY.USD) : props.iouReport.currency; + const getSettledMessage = () => { + switch (lodashGet(props.action, 'originalMessage.paymentType', '')) { + case CONST.IOU.PAYMENT_TYPE.PAYPAL_ME: + return props.translate('iou.settledPaypalMe'); + case CONST.IOU.PAYMENT_TYPE.ELSEWHERE: + return props.translate('iou.settledElsewhere'); + case CONST.IOU.PAYMENT_TYPE.EXPENSIFY: + return props.translate('iou.settledExpensify'); + default: + return ''; + } + }; + const showContextMenu = (event) => { // Use action and shouldHidePayButton props to check if we are in IOUDetailsModal, // if it's true, do nothing when user long press, otherwise show context menu. @@ -177,10 +192,30 @@ const IOUPreview = (props) => { needsOffscreenAlphaCompositing > - {props.isBillSplit ? props.translate('iou.split') : props.translate('iou.cash')} - {CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency)} + {props.isBillSplit ? props.translate('iou.split') : props.translate('iou.cash')} + {Boolean(getSettledMessage()) && ( + <> + + {getSettledMessage()} + + )} + + + + + + {CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency)} {!props.iouReport.hasOutstandingIOU && !props.isBillSplit && ( { )} - - - + {props.isBillSplit && ( + + + + )} {!isCurrentUserManager && props.shouldShowPendingConversionMessage && ( {props.translate('iou.pendingConversionMessage')} )} - {Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''))} + {Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''))} {isCurrentUserManager && !props.shouldHidePayButton && props.iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && (