@@ -114,6 +114,9 @@ type MoneyRequestConfirmationListProps = {
114
114
/** Whether the expense is a distance expense */
115
115
isDistanceRequest ?: boolean ;
116
116
117
+ /** Whether the expense is a per diem expense */
118
+ isPerDiemRequest ?: boolean ;
119
+
117
120
/** Whether we're editing a split expense */
118
121
isEditingSplitBill ?: boolean ;
119
122
@@ -151,6 +154,7 @@ function MoneyRequestConfirmationList({
151
154
iouType = CONST . IOU . TYPE . SUBMIT ,
152
155
iouAmount,
153
156
isDistanceRequest = false ,
157
+ isPerDiemRequest = false ,
154
158
isPolicyExpenseChat = false ,
155
159
iouCategory = '' ,
156
160
shouldShowSmartScanFields = true ,
@@ -231,11 +235,11 @@ function MoneyRequestConfirmationList({
231
235
// A flag for showing the categories field
232
236
const shouldShowCategories = ( isPolicyExpenseChat || isTypeInvoice ) && ( ! ! iouCategory || OptionsListUtils . hasEnabledOptions ( Object . values ( policyCategories ?? { } ) ) ) ;
233
237
234
- const shouldShowMerchant = shouldShowSmartScanFields && ! isDistanceRequest && ! isTypeSend ;
238
+ const shouldShowMerchant = shouldShowSmartScanFields && ! isDistanceRequest && ! isTypeSend && ! isPerDiemRequest ;
235
239
236
240
const policyTagLists = useMemo ( ( ) => PolicyUtils . getTagLists ( policyTags ) , [ policyTags ] ) ;
237
241
238
- const shouldShowTax = isTaxTrackingEnabled ( isPolicyExpenseChat , policy , isDistanceRequest ) ;
242
+ const shouldShowTax = isTaxTrackingEnabled ( isPolicyExpenseChat , policy , isDistanceRequest ) && ! isPerDiemRequest ;
239
243
240
244
const previousTransactionAmount = usePrevious ( transaction ?. amount ) ;
241
245
const previousTransactionCurrency = usePrevious ( transaction ?. currency ) ;
@@ -428,7 +432,7 @@ function MoneyRequestConfirmationList({
428
432
text = translate ( 'iou.trackExpense' ) ;
429
433
} else if ( isTypeSplit && iouAmount === 0 ) {
430
434
text = translate ( 'iou.splitExpense' ) ;
431
- } else if ( ( receiptPath && isTypeRequest ) || isDistanceRequestWithPendingRoute ) {
435
+ } else if ( ( receiptPath && isTypeRequest ) || isDistanceRequestWithPendingRoute || isPerDiemRequest ) {
432
436
text = translate ( 'iou.submitExpense' ) ;
433
437
if ( iouAmount !== 0 ) {
434
438
text = translate ( 'iou.submitAmount' , { amount : formattedAmount } ) ;
@@ -443,7 +447,20 @@ function MoneyRequestConfirmationList({
443
447
value : iouType ,
444
448
} ,
445
449
] ;
446
- } , [ isTypeTrackExpense , isTypeSplit , iouAmount , receiptPath , isTypeRequest , policy , isDistanceRequestWithPendingRoute , iouType , translate , formattedAmount , isTypeInvoice ] ) ;
450
+ } , [
451
+ isTypeInvoice ,
452
+ isTypeTrackExpense ,
453
+ isTypeSplit ,
454
+ iouAmount ,
455
+ receiptPath ,
456
+ isTypeRequest ,
457
+ isDistanceRequestWithPendingRoute ,
458
+ isPerDiemRequest ,
459
+ iouType ,
460
+ policy ,
461
+ translate ,
462
+ formattedAmount ,
463
+ ] ) ;
447
464
448
465
const onSplitShareChange = useCallback (
449
466
( accountID : number , value : number ) => {
@@ -762,6 +779,11 @@ function MoneyRequestConfirmationList({
762
779
return ;
763
780
}
764
781
782
+ if ( isPerDiemRequest && ( transaction . comment ?. customUnit ?. subRates ?? [ ] ) . length === 0 ) {
783
+ setFormError ( 'iou.error.invalidSubrateLength' ) ;
784
+ return ;
785
+ }
786
+
765
787
if ( iouType !== CONST . IOU . TYPE . PAY ) {
766
788
// validate the amount for distance expenses
767
789
const decimals = CurrencyUtils . getCurrencyDecimals ( iouCurrencyCode ) ;
@@ -809,6 +831,7 @@ function MoneyRequestConfirmationList({
809
831
onSendMoney ,
810
832
iouCurrencyCode ,
811
833
isDistanceRequest ,
834
+ isPerDiemRequest ,
812
835
isDistanceRequestWithPendingRoute ,
813
836
iouAmount ,
814
837
onConfirm ,
@@ -916,6 +939,7 @@ function MoneyRequestConfirmationList({
916
939
iouType = { iouType }
917
940
isCategoryRequired = { isCategoryRequired }
918
941
isDistanceRequest = { isDistanceRequest }
942
+ isPerDiemRequest = { isPerDiemRequest }
919
943
isEditingSplitBill = { isEditingSplitBill }
920
944
isMerchantEmpty = { isMerchantEmpty }
921
945
isMerchantRequired = { isMerchantRequired }
@@ -937,6 +961,7 @@ function MoneyRequestConfirmationList({
937
961
shouldShowCategories = { shouldShowCategories }
938
962
shouldShowMerchant = { shouldShowMerchant }
939
963
shouldShowSmartScanFields = { shouldShowSmartScanFields }
964
+ shouldShowAmountField = { ! isPerDiemRequest }
940
965
shouldShowTax = { shouldShowTax }
941
966
transaction = { transaction }
942
967
transactionID = { transactionID }
0 commit comments