-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[VIP][Travel] View trip details and authenticate to travelDot #43081
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 11 commits
03af563
5b0fd92
b2d1aa3
d2f6dad
2851353
c4f4512
a408b66
fb7fdec
68ba31d
09af194
69cf344
d0bc4fe
8f8029d
b0bd79d
a6bc038
61e22e0
750856b
8ad2e06
407b93a
53e65c9
05a9cc6
c095083
5ee49dd
25400ac
0f17458
17fba2d
deb01aa
57da999
9956900
997fb34
e15858e
a6d48f2
f0d4fd8
dae0dd4
938b60e
6895d38
2e9d622
bcde944
d80564d
e48fc99
9033b4e
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import React, {useCallback, useMemo} from 'react'; | ||
import {View} from 'react-native'; | ||
import {Linking, View} from 'react-native'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import type {OnyxEntry} from 'react-native-onyx'; | ||
import ConfirmedRoute from '@components/ConfirmedRoute'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import MenuItem from '@components/MenuItem'; | ||
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||
import OfflineWithFeedback from '@components/OfflineWithFeedback'; | ||
import {useSession} from '@components/OnyxProvider'; | ||
|
@@ -12,6 +13,7 @@ import ReceiptEmptyState from '@components/ReceiptEmptyState'; | |
import Switch from '@components/Switch'; | ||
import Text from '@components/Text'; | ||
import ViolationMessages from '@components/ViolationMessages'; | ||
import useEnvironment from '@hooks/useEnvironment'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useNetwork from '@hooks/useNetwork'; | ||
import usePermissions from '@hooks/usePermissions'; | ||
|
@@ -99,6 +101,8 @@ function MoneyRequestView({ | |
const session = useSession(); | ||
const {isOffline} = useNetwork(); | ||
const {translate, toLocaleDigit} = useLocalize(); | ||
const {isProduction} = useEnvironment(); | ||
|
||
const parentReportAction = parentReportActions?.[report.parentReportActionID ?? ''] ?? null; | ||
const isTrackExpense = ReportUtils.isTrackExpenseReport(report); | ||
const {canUseViolations, canUseP2PDistanceRequests} = usePermissions(isTrackExpense ? CONST.IOU.TYPE.TRACK : undefined); | ||
|
@@ -171,6 +175,15 @@ function MoneyRequestView({ | |
const shouldShowBillable = isPolicyExpenseChat && (!!transactionBillable || !(policy?.disabledFields?.defaultBillable ?? true)); | ||
|
||
const shouldShowTax = isTaxTrackingEnabled(isPolicyExpenseChat, policy, isDistanceRequest); | ||
const shouldShowViewTripDetails = TransactionUtils.hasReservationList(transaction); | ||
const tripID = ReportUtils.getTripIDFromTransactionParentReport(parentReport); | ||
|
||
const navigateToTripID = () => { | ||
if (!tripID) { | ||
return; | ||
} | ||
Linking.openURL(CONST.TRIP_ID_URL(tripID, isProduction)); | ||
}; | ||
|
||
const {getViolationsForField} = useViolations(transactionViolations ?? []); | ||
const hasViolations = useCallback( | ||
|
@@ -549,6 +562,15 @@ function MoneyRequestView({ | |
/> | ||
</OfflineWithFeedback> | ||
)} | ||
{shouldShowViewTripDetails && tripID && ( | ||
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. if we need tripID to Show the Trip Details, should we include 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. yeah that makes sense |
||
<MenuItem | ||
title="View trip details" | ||
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. Let's add this to translate 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. nice catch |
||
icon={Expensicons.Suitcase} | ||
iconRight={Expensicons.NewWindow} | ||
shouldShowRightIcon | ||
onPress={navigateToTripID} | ||
/> | ||
)} | ||
{shouldShowBillable && ( | ||
<View style={[styles.flexRow, styles.optionRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.ml5, styles.mr8]}> | ||
<View> | ||
|
Uh oh!
There was an error while loading. Please reload this page.