Skip to content

Commit 0e028c3

Browse files
authored
Merge pull request #61484 from allroundexperts/feat-44725-2
2 parents acd45ca + 73cb4d8 commit 0e028c3

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/components/MoneyRequestConfirmationList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function MoneyRequestConfirmationList({
335335
? ''
336336
: convertToDisplayString(shouldCalculateDistanceAmount ? distanceRequestAmount : iouAmount, isDistanceRequest ? currency : iouCurrencyCode);
337337
const formattedAmountPerAttendee =
338-
isDistanceRequestWithPendingRoute || isScanRequest
338+
isDistanceRequestWithPendingRoute || isScanRequest || isPerDiemRequest
339339
? ''
340340
: convertToDisplayString(
341341
(shouldCalculateDistanceAmount ? distanceRequestAmount : iouAmount) / (iouAttendees?.length && iouAttendees.length > 0 ? iouAttendees.length : 1),

src/components/ReportActionItem/MoneyRequestView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals
170170
const shouldDisplayTransactionAmount = ((isDistanceRequest && hasRoute) || !!transactionAmount) && transactionAmount !== undefined;
171171
const formattedTransactionAmount = shouldDisplayTransactionAmount ? convertToDisplayString(transactionAmount, transactionCurrency) : '';
172172
const formattedPerAttendeeAmount =
173-
shouldDisplayTransactionAmount && !isReceiptBeingScanned && didReceiptScanSucceed
173+
shouldDisplayTransactionAmount && ((hasReceipt && !isReceiptBeingScanned && didReceiptScanSucceed) || !isPerDiemRequest)
174174
? convertToDisplayString(transactionAmount / (transactionAttendees?.length ?? 1), transactionCurrency)
175175
: '';
176176
const formattedOriginalAmount = transactionOriginalAmount && transactionOriginalCurrency && convertToDisplayString(transactionOriginalAmount, transactionOriginalCurrency);
@@ -759,11 +759,10 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals
759759
<OfflineWithFeedback pendingAction={getPendingFieldAction('attendees')}>
760760
<MenuItemWithTopDescription
761761
key="attendees"
762-
shouldShowRightIcon
763762
title={Array.isArray(transactionAttendees) ? transactionAttendees.map((item) => item?.displayName ?? item?.login).join(', ') : ''}
764763
description={`${translate('iou.attendees')} ${
765764
Array.isArray(transactionAttendees) && transactionAttendees.length > 1 && formattedPerAttendeeAmount
766-
? `${formattedPerAttendeeAmount} ${translate('common.perPerson')}`
765+
? `${CONST.DOT_SEPARATOR} ${formattedPerAttendeeAmount} ${translate('common.perPerson')}`
767766
: ''
768767
}`}
769768
style={[styles.moneyRequestMenuItem]}
@@ -774,7 +773,8 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals
774773
}
775774
Navigation.navigate(ROUTES.MONEY_REQUEST_ATTENDEE.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, report.reportID));
776775
}}
777-
interactive
776+
interactive={canEdit}
777+
shouldShowRightIcon={canEdit}
778778
shouldRenderAsHTML
779779
/>
780780
</OfflineWithFeedback>

src/libs/TransactionUtils/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,9 @@ function isMerchantMissing(transaction: OnyxEntry<Transaction>) {
325325

326326
// eslint-disable-next-line @typescript-eslint/no-unused-vars
327327
function shouldShowAttendees(iouType: IOUType, policy: OnyxEntry<Policy>): boolean {
328-
return false;
329-
// To be renabled once feature is complete: https://github.com/Expensify/App/issues/44725
330-
// Keep this disabled for per diem expense
331-
return iouType === CONST.IOU.TYPE.SUBMIT && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM);
328+
return (
329+
(iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.CREATE) && !!policy?.id && (policy?.type === CONST.POLICY.TYPE.CORPORATE || policy?.type === CONST.POLICY.TYPE.TEAM)
330+
);
332331
}
333332

334333
/**

src/pages/iou/request/MoneyRequestAttendeeSelector.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,16 @@ function MoneyRequestAttendeeSelector({attendees = [], onFinish, onAttendeesAdde
112112
maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW,
113113
preferPolicyExpenseChat: isPaidGroupPolicy,
114114
shouldAcceptName: true,
115+
selectedOptions: attendees.map((attendee) => ({
116+
...attendee,
117+
reportID: CONST.DEFAULT_NUMBER_ID.toString(),
118+
selected: true,
119+
login: attendee.email,
120+
...getPersonalDetailByEmail(attendee.email),
121+
})),
115122
});
116123
return newOptions;
117-
}, [areOptionsInitialized, defaultOptions, cleanSearchTerm, isPaidGroupPolicy]);
124+
}, [areOptionsInitialized, defaultOptions, cleanSearchTerm, isPaidGroupPolicy, attendees]);
118125

119126
/**
120127
* Returns the sections needed for the OptionsSelector

0 commit comments

Comments
 (0)