From e3273ddde570c64dfbb281b9e53dd4c150bf1c69 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 4 Nov 2024 21:23:40 +0300 Subject: [PATCH 01/14] include workspaces as participants for submit a tracked expense --- src/pages/home/report/ReportActionItem.tsx | 20 ++++++++----------- .../MoneyRequestParticipantsSelector.tsx | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index a0e2f65a89a0b..a869439ca6636 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -421,18 +421,14 @@ function ReportActionItem({ if (ReportActionsUtils.isActionableTrackExpense(action)) { const transactionID = ReportActionsUtils.getOriginalMessage(action)?.transactionID; return [ - ...(!TransactionUtils.isDistanceRequest(TransactionUtils.getTransaction(transactionID ?? '-1')) || canUseP2PDistanceRequests - ? [ - { - text: 'actionableMentionTrackExpense.submit', - key: `${action.reportActionID}-actionableMentionTrackExpense-submit`, - onPress: () => { - ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(transactionID ?? '0', reportID, CONST.IOU.ACTION.SUBMIT, action.reportActionID); - }, - isMediumSized: true, - } as ActionableItem, - ] - : []), + { + text: 'actionableMentionTrackExpense.submit', + key: `${action.reportActionID}-actionableMentionTrackExpense-submit`, + onPress: () => { + ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(transactionID ?? '0', reportID, CONST.IOU.ACTION.SUBMIT, action.reportActionID); + }, + isMediumSized: true, + } as ActionableItem, { text: 'actionableMentionTrackExpense.categorize', key: `${action.reportActionID}-actionableMentionTrackExpense-categorize`, diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 5dcf4dbd2ea65..6d1729b5c9132 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -123,7 +123,7 @@ function MoneyRequestParticipantsSelector({ // If we are using this component in the "Submit expense" or the combined submit/track flow then we pass the includeOwnedWorkspaceChats argument so that the current user // sees the option to submit an expense from their admin on their own Workspace Chat. - includeOwnedWorkspaceChats: (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.CREATE || iouType === CONST.IOU.TYPE.SPLIT) && action !== CONST.IOU.ACTION.SUBMIT, + includeOwnedWorkspaceChats: iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.CREATE || iouType === CONST.IOU.TYPE.SPLIT, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing includeP2P: (canUseP2PDistanceRequests || iouRequestType !== CONST.IOU.REQUEST_TYPE.DISTANCE) && !isCategorizeOrShareAction, From 4fc8e4b8d1cbcf0c008b05d430f0051fed7ba3ba Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 5 Nov 2024 19:52:35 +0300 Subject: [PATCH 02/14] remove unnecessary import --- src/pages/home/report/ReportActionItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index a869439ca6636..2e1159f8d5cde 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -53,7 +53,6 @@ import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import SelectionScraper from '@libs/SelectionScraper'; import shouldRenderAddPaymentCard from '@libs/shouldRenderAppPaymentCard'; -import * as TransactionUtils from '@libs/TransactionUtils'; import {ReactionListContext} from '@pages/home/ReportScreenContext'; import * as BankAccounts from '@userActions/BankAccounts'; import * as EmojiPickerAction from '@userActions/EmojiPickerAction'; From d6f58b03a3b62bc0eddacc0f8c3717b94a6ba2ea Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 5 Nov 2024 19:53:21 +0300 Subject: [PATCH 03/14] remove unnecessary code --- src/pages/home/report/ReportActionItem.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 2e1159f8d5cde..01a024a368ee1 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -33,7 +33,6 @@ import {ShowContextMenuContext} from '@components/ShowContextMenuContext'; import Text from '@components/Text'; import UnreadActionIndicator from '@components/UnreadActionIndicator'; import useLocalize from '@hooks/useLocalize'; -import usePermissions from '@hooks/usePermissions'; import usePrevious from '@hooks/usePrevious'; import useReportScrollManager from '@hooks/useReportScrollManager'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; @@ -197,7 +196,6 @@ function ReportActionItem({ const downloadedPreviews = useRef([]); const prevDraftMessage = usePrevious(draftMessage); const [isUserValidated] = useOnyx(ONYXKEYS.USER, {selector: (user) => !!user?.validated}); - const {canUseP2PDistanceRequests} = usePermissions(); // The app would crash due to subscribing to the entire report collection if parentReportID is an empty string. So we should have a fallback ID here. // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || -1}`); @@ -500,7 +498,7 @@ function ReportActionItem({ onPress: () => Report.resolveActionableMentionWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.NOTHING), }, ]; - }, [action, isActionableWhisper, reportID, canUseP2PDistanceRequests]); + }, [action, isActionableWhisper, reportID]); /** * Get the content of ReportActionItem From 63868b7ac34520af313943980672e3bab0c643d6 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 21 Jan 2025 17:18:13 +0300 Subject: [PATCH 04/14] implemented add tracked expense to policy --- .../AddTrackedExpenseToPolicyParams.ts | 24 ++++++ src/libs/API/parameters/index.ts | 1 + src/libs/API/types.ts | 2 + src/libs/actions/IOU.ts | 80 +++++++++++++++++-- 4 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts diff --git a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts new file mode 100644 index 0000000000000..3065c36738d4f --- /dev/null +++ b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts @@ -0,0 +1,24 @@ +import type {Receipt} from '@src/types/onyx/Transaction'; + +type AddTrackedExpenseToPolicyParams = { + amount: number; + currency: string; + created: string; + comment?: string; + merchant?: string; + receipt: Receipt | undefined; + category: string | undefined; + tag: string | undefined; + taxCode: string; + taxAmount: number; + billable: boolean | undefined; + linkedTrackedExpenseReportID: string; + policyID: string | undefined; + chatReportID: string; + transactionID: string; + actionableWhisperReportActionID: string; + moneyRequestReportID: string; + reportPreviewReportActionID: string; +}; + +export default AddTrackedExpenseToPolicyParams; diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index 4d02027b720a7..15f9affb65a32 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -235,6 +235,7 @@ export type {default as RenamePolicyTaxParams} from './RenamePolicyTaxParams'; export type {default as UpdatePolicyTaxCodeParams} from './UpdatePolicyTaxCodeParams'; export type {default as CompleteGuidedSetupParams} from './CompleteGuidedSetupParams'; export type {default as DismissTrackExpenseActionableWhisperParams} from './DismissTrackExpenseActionableWhisperParams'; +export type {default as AddTrackedExpenseToPolicyParams} from './AddTrackedExpenseToPolicyParams'; export type {default as ConvertTrackedExpenseToRequestParams} from './ConvertTrackedExpenseToRequestParams'; export type {default as ShareTrackedExpenseParams} from './ShareTrackedExpenseParams'; export type {default as CategorizeTrackedExpenseParams} from './CategorizeTrackedExpenseParams'; diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index 72251fd817dc8..7da05a9fc19c8 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -299,6 +299,7 @@ const WRITE_COMMANDS = { SET_POLICY_DISTANCE_RATES_ENABLED: 'SetPolicyDistanceRatesEnabled', DELETE_POLICY_DISTANCE_RATES: 'DeletePolicyDistanceRates', DISMISS_TRACK_EXPENSE_ACTIONABLE_WHISPER: 'DismissActionableWhisper', + ADD_TRACKED_EXPENSE_TO_POLICY: 'AddTrackedExpenseToPolicy', CONVERT_TRACKED_EXPENSE_TO_REQUEST: 'ConvertTrackedExpenseToRequest', CATEGORIZE_TRACKED_EXPENSE: 'CategorizeTrackedExpense', SHARE_TRACKED_EXPENSE: 'ShareTrackedExpense', @@ -758,6 +759,7 @@ type WriteCommandParameters = { [WRITE_COMMANDS.DISMISS_TRACK_EXPENSE_ACTIONABLE_WHISPER]: Parameters.DismissTrackExpenseActionableWhisperParams; [WRITE_COMMANDS.UPDATE_BILLING_CARD_CURRENCY]: Parameters.UpdateBillingCurrencyParams; [WRITE_COMMANDS.CONVERT_TRACKED_EXPENSE_TO_REQUEST]: Parameters.ConvertTrackedExpenseToRequestParams; + [WRITE_COMMANDS.ADD_TRACKED_EXPENSE_TO_POLICY]: Parameters.AddTrackedExpenseToPolicyParams; [WRITE_COMMANDS.CATEGORIZE_TRACKED_EXPENSE]: Parameters.CategorizeTrackedExpenseParams; [WRITE_COMMANDS.SHARE_TRACKED_EXPENSE]: Parameters.ShareTrackedExpenseParams; [WRITE_COMMANDS.LEAVE_POLICY]: Parameters.LeavePolicyParams; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 26ebf5e37a8ee..93813acca9d9d 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -120,7 +120,7 @@ import { isOptimisticPersonalDetail, isPayAtEndExpenseReport as isPayAtEndExpenseReportReportUtils, isPayer as isPayerReportUtils, - isPolicyExpenseChat as isPolicyExpenseChatReportUtils, + isPolicyExpenseChat as isPolicyExpenseChatReportUtil, isReportApproved, isSelfDM, isSettled, @@ -4052,6 +4052,34 @@ const getConvertTrackedExpenseInformation = ( return {optimisticData, successData, failureData, modifiedExpenseReportActionID: modifiedExpenseReportAction.reportActionID}; }; +type ConvertTrackedWorkspaceParams = { + receipt: Receipt | undefined; + category: string | undefined; + tag: string | undefined; + taxCode: string; + taxAmount: number; + billable: boolean | undefined; + linkedTrackedExpenseReportID: string; + policyID: string | undefined; +}; + +type AddTrackedExpenseToPolicyParam = { + amount: number; + currency: string; + comment: string; + created: string; + merchant: string; + chatReportID: string; + transactionID: string; + actionableWhisperReportActionID: string; + moneyRequestReportID: string; + reportPreviewReportActionID: string; +} & ConvertTrackedWorkspaceParams; + +function addTrackedExpenseToPolicy(parameters: AddTrackedExpenseToPolicyParam, onyxData: OnyxData) { + API.write(WRITE_COMMANDS.ADD_TRACKED_EXPENSE_TO_POLICY, parameters, onyxData); +} + function convertTrackedExpenseToRequest( payerAccountID: number, payerEmail: string, @@ -4073,6 +4101,7 @@ function convertTrackedExpenseToRequest( merchant: string, created: string, attendees?: Attendee[], + workspaceParams?: ConvertTrackedWorkspaceParams, ) { const {optimisticData, successData, failureData} = onyxData; @@ -4095,6 +4124,29 @@ function convertTrackedExpenseToRequest( successData?.push(...moveTransactionSuccessData); failureData?.push(...moveTransactionFailureData); + if (workspaceParams) { + const params = { + amount, + currency, + comment, + created, + merchant, + chatReportID, + transactionID, + actionableWhisperReportActionID, + moneyRequestReportID, + moneyRequestCreatedReportActionID, + moneyRequestPreviewReportActionID, + transactionThreadReportID, + modifiedExpenseReportActionID, + reportPreviewReportActionID, + ...workspaceParams, + }; + + addTrackedExpenseToPolicy(params, {optimisticData, successData, failureData}); + return; + } + const parameters = { attendees, amount, @@ -4299,7 +4351,18 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { if (!linkedTrackedExpenseReportAction || !actionableWhisperReportActionID || !linkedTrackedExpenseReportID) { return; } - + const workspaceParams = isPolicyExpenseChatReportUtil(chatReport) + ? { + receipt, + category, + tag, + taxCode, + taxAmount, + billable, + linkedTrackedExpenseReportID, + policyID: chatReport.policyID, + } + : undefined; convertTrackedExpenseToRequest( payerAccountID, payerEmail, @@ -4321,6 +4384,7 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { merchant, created, attendees, + workspaceParams, ); break; } @@ -4972,7 +5036,7 @@ function createSplitsAndOnyxData( const hasMultipleParticipants = participants.length > 1; participants.forEach((participant) => { // In a case when a participant is a workspace, even when a current user is not an owner of the workspace - const isPolicyExpenseChat = isPolicyExpenseChatReportUtils(participant); + const isPolicyExpenseChat = isPolicyExpenseChatReportUtil(participant); const splitAmount = splitShares?.[participant.accountID ?? -1]?.amount ?? calculateIOUAmount(participants.length, amount, currency, false); const splitTaxAmount = calculateIOUAmount(participants.length, taxAmount, currency, false); @@ -5598,7 +5662,7 @@ function startSplitBill({ }); participants.forEach((participant) => { - const isPolicyExpenseChat = isPolicyExpenseChatReportUtils(participant); + const isPolicyExpenseChat = isPolicyExpenseChatReportUtil(participant); if (!isPolicyExpenseChat) { return; } @@ -7169,7 +7233,7 @@ function getReportFromHoldRequestsOnyxData( const newParentReportActionID = rand64(); const coefficient = isExpenseReport(iouReport) ? -1 : 1; - const isPolicyExpenseChat = isPolicyExpenseChatReportUtils(chatReport); + const isPolicyExpenseChat = isPolicyExpenseChatReportUtil(chatReport); const holdAmount = ((iouReport?.total ?? 0) - (iouReport?.unheldTotal ?? 0)) * coefficient; const holdNonReimbursableAmount = ((iouReport?.nonReimbursableTotal ?? 0) - (iouReport?.unheldNonReimbursableTotal ?? 0)) * coefficient; const optimisticExpenseReport = isPolicyExpenseChat @@ -7735,7 +7799,7 @@ function canIOUBePaid( invoiceReceiverPolicy?: SearchPolicy, shouldCheckApprovedState = true, ) { - const isPolicyExpenseChat = isPolicyExpenseChatReportUtils(chatReport); + const isPolicyExpenseChat = isPolicyExpenseChatReportUtil(chatReport); const reportNameValuePairs = chatReportRNVP ?? getReportNameValuePairs(chatReport?.reportID); const isChatReportArchived = isArchivedReport(chatReport, reportNameValuePairs); const iouSettled = isSettled(iouReport); @@ -8645,8 +8709,8 @@ function setMoneyRequestParticipantsFromReport(transactionID: string, report: On const shouldAddAsReport = !isEmptyObject(chatReport) && isSelfDM(chatReport); let participants: Participant[] = []; - if (isPolicyExpenseChatReportUtils(chatReport) || shouldAddAsReport) { - participants = [{accountID: 0, reportID: chatReport?.reportID, isPolicyExpenseChat: isPolicyExpenseChatReportUtils(chatReport), selected: true}]; + if (isPolicyExpenseChatReportUtil(chatReport) || shouldAddAsReport) { + participants = [{accountID: 0, reportID: chatReport?.reportID, isPolicyExpenseChat: isPolicyExpenseChatReportUtil(chatReport), selected: true}]; } else if (isInvoiceRoom(chatReport)) { participants = [ {reportID: chatReport?.reportID, selected: true}, From 91a037344765308f86c053a3cf8bde743ac63e63 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 21 Jan 2025 19:01:22 +0300 Subject: [PATCH 05/14] fix lint --- .../MoneyRequestParticipantsSelector.tsx | 59 +++++++++++-------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 4573f76835e5e..aeeba457dedc5 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -7,7 +7,7 @@ import {useOnyx} from 'react-native-onyx'; import Button from '@components/Button'; import EmptySelectionListContent from '@components/EmptySelectionListContent'; import FormHelpMessage from '@components/FormHelpMessage'; -import * as Expensicons from '@components/Icon/Expensicons'; +import {Coins} from '@components/Icon/Expensicons'; import MenuItem from '@components/MenuItem'; import {usePersonalDetails} from '@components/OnyxProvider'; import {useOptionsList} from '@components/OptionListContextProvider'; @@ -21,14 +21,25 @@ import useNetwork from '@hooks/useNetwork'; import usePolicy from '@hooks/usePolicy'; import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionStatus'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; +import {getInvoicePrimaryWorkspace} from '@libs/actions/Policy/Policy'; +import {searchInServer} from '@libs/actions/Report'; +import {canUseTouchScreen} from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; -import * as OptionsListUtils from '@libs/OptionsListUtils'; -import * as PolicyUtils from '@libs/PolicyUtils'; -import * as ReportUtils from '@libs/ReportUtils'; -import * as SubscriptionUtils from '@libs/SubscriptionUtils'; -import * as Policy from '@userActions/Policy/Policy'; -import * as Report from '@userActions/Report'; +import type {Section} from '@libs/OptionsListUtils'; +import { + filterAndOrderOptions, + formatSectionsFromSearchTerm, + getHeaderMessage, + getParticipantsOption, + getPersonalDetailSearchTerms, + getPolicyExpenseReportOption, + getValidOptions, + isCurrentUser, + orderOptions, +} from '@libs/OptionsListUtils'; +import {isPaidGroupPolicy as isPaidGroupPolicyUtil} from '@libs/PolicyUtils'; +import {isInvoiceRoom} from '@libs/ReportUtils'; +import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; import type {IOUAction, IOUType} from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -86,12 +97,12 @@ function MoneyRequestParticipantsSelector({ const cleanSearchTerm = useMemo(() => debouncedSearchTerm.trim().toLowerCase(), [debouncedSearchTerm]); const offlineMessage: string = isOffline ? `${translate('common.youAppearToBeOffline')} ${translate('search.resultsAreLimited')}` : ''; - const isPaidGroupPolicy = useMemo(() => PolicyUtils.isPaidGroupPolicy(policy), [policy]); + const isPaidGroupPolicy = useMemo(() => isPaidGroupPolicyUtil(policy), [policy]); const isIOUSplit = iouType === CONST.IOU.TYPE.SPLIT; const isCategorizeOrShareAction = [CONST.IOU.ACTION.CATEGORIZE, CONST.IOU.ACTION.SHARE].some((option) => option === action); useEffect(() => { - Report.searchInServer(debouncedSearchTerm.trim()); + searchInServer(debouncedSearchTerm.trim()); }, [debouncedSearchTerm]); const defaultOptions = useMemo(() => { @@ -105,7 +116,7 @@ function MoneyRequestParticipantsSelector({ }; } - const optionList = OptionsListUtils.getValidOptions( + const optionList = getValidOptions( { reports: options.reports, personalDetails: options.personalDetails, @@ -125,7 +136,7 @@ function MoneyRequestParticipantsSelector({ }, ); - const orderedOptions = OptionsListUtils.orderOptions(optionList); + const orderedOptions = orderOptions(optionList); return { ...optionList, @@ -144,7 +155,7 @@ function MoneyRequestParticipantsSelector({ }; } - const newOptions = OptionsListUtils.filterAndOrderOptions(defaultOptions, debouncedSearchTerm, { + const newOptions = filterAndOrderOptions(defaultOptions, debouncedSearchTerm, { canInviteUser: !isCategorizeOrShareAction, selectedOptions: participants as Participant[], excludeLogins: CONST.EXPENSIFY_EMAILS, @@ -160,14 +171,14 @@ function MoneyRequestParticipantsSelector({ * @returns {Array} */ const [sections, header] = useMemo(() => { - const newSections: OptionsListUtils.Section[] = []; + const newSections: Section[] = []; if (!areOptionsInitialized || !didScreenTransitionEnd) { return [newSections, '']; } - const formatResults = OptionsListUtils.formatSectionsFromSearchTerm( + const formatResults = formatSectionsFromSearchTerm( debouncedSearchTerm, - participants.map((participant) => ({...participant, reportID: participant.reportID ?? '-1'})), + participants.map((participant) => ({...participant, reportID: participant.reportID ?? `${CONST.DEFAULT_NUMBER_ID}`})), chatOptions.recentReports, chatOptions.personalDetails, personalDetails, @@ -190,23 +201,23 @@ function MoneyRequestParticipantsSelector({ if ( chatOptions.userToInvite && - !OptionsListUtils.isCurrentUser({...chatOptions.userToInvite, accountID: chatOptions.userToInvite?.accountID ?? -1, status: chatOptions.userToInvite?.status ?? undefined}) + !isCurrentUser({...chatOptions.userToInvite, accountID: chatOptions.userToInvite?.accountID ?? CONST.DEFAULT_NUMBER_ID, status: chatOptions.userToInvite?.status ?? undefined}) ) { newSections.push({ title: undefined, data: [chatOptions.userToInvite].map((participant) => { const isPolicyExpenseChat = participant?.isPolicyExpenseChat ?? false; - return isPolicyExpenseChat ? OptionsListUtils.getPolicyExpenseReportOption(participant) : OptionsListUtils.getParticipantsOption(participant, personalDetails); + return isPolicyExpenseChat ? getPolicyExpenseReportOption(participant) : getParticipantsOption(participant, personalDetails); }), shouldShow: true, }); } - const headerMessage = OptionsListUtils.getHeaderMessage( + const headerMessage = getHeaderMessage( (chatOptions.personalDetails ?? []).length + (chatOptions.recentReports ?? []).length !== 0, !!chatOptions?.userToInvite, debouncedSearchTerm.trim(), - participants.some((participant) => OptionsListUtils.getPersonalDetailSearchTerms(participant).join(' ').toLowerCase().includes(cleanSearchTerm)), + participants.some((participant) => getPersonalDetailSearchTerms(participant).join(' ').toLowerCase().includes(cleanSearchTerm)), ); return [newSections, headerMessage]; @@ -239,7 +250,7 @@ function MoneyRequestParticipantsSelector({ ]; if (iouType === CONST.IOU.TYPE.INVOICE) { - const policyID = option.item && ReportUtils.isInvoiceRoom(option.item) ? option.policyID : Policy.getInvoicePrimaryWorkspace(currentUserLogin)?.id; + const policyID = option.item && isInvoiceRoom(option.item) ? option.policyID : getInvoicePrimaryWorkspace(currentUserLogin)?.id; newParticipants.push({ policyID, isSender: true, @@ -352,7 +363,7 @@ function MoneyRequestParticipantsSelector({ ); @@ -416,7 +427,7 @@ function MoneyRequestParticipantsSelector({ const onSelectRow = useCallback( (option: Participant) => { - if (option.isPolicyExpenseChat && option.policyID && SubscriptionUtils.shouldRestrictUserBillableActions(option.policyID)) { + if (option.isPolicyExpenseChat && option.policyID && shouldRestrictUserBillableActions(option.policyID)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(option.policyID)); return; } @@ -440,7 +451,7 @@ function MoneyRequestParticipantsSelector({ textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')} textInputHint={offlineMessage} onChangeText={setSearchTerm} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} + shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()} onSelectRow={onSelectRow} shouldSingleExecuteRowSelect headerContent={headerContent} From d8bc6efaa5edb3e2ffa03d1b306a1aa0b6ec33f0 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 23 Jan 2025 01:16:40 +0300 Subject: [PATCH 06/14] fix params --- src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts | 5 ----- src/libs/actions/IOU.ts | 7 ------- 2 files changed, 12 deletions(-) diff --git a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts index 3065c36738d4f..4501b36b01e30 100644 --- a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts +++ b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts @@ -1,20 +1,15 @@ -import type {Receipt} from '@src/types/onyx/Transaction'; - type AddTrackedExpenseToPolicyParams = { amount: number; currency: string; created: string; comment?: string; merchant?: string; - receipt: Receipt | undefined; category: string | undefined; tag: string | undefined; taxCode: string; taxAmount: number; billable: boolean | undefined; - linkedTrackedExpenseReportID: string; policyID: string | undefined; - chatReportID: string; transactionID: string; actionableWhisperReportActionID: string; moneyRequestReportID: string; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 6794a089a9a00..8ef2eec7b71df 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -4072,13 +4072,11 @@ const getConvertTrackedExpenseInformation = ( }; type ConvertTrackedWorkspaceParams = { - receipt: Receipt | undefined; category: string | undefined; tag: string | undefined; taxCode: string; taxAmount: number; billable: boolean | undefined; - linkedTrackedExpenseReportID: string; policyID: string | undefined; }; @@ -4088,7 +4086,6 @@ type AddTrackedExpenseToPolicyParam = { comment: string; created: string; merchant: string; - chatReportID: string; transactionID: string; actionableWhisperReportActionID: string; moneyRequestReportID: string; @@ -4150,13 +4147,11 @@ function convertTrackedExpenseToRequest( comment, created, merchant, - chatReportID, transactionID, actionableWhisperReportActionID, moneyRequestReportID, moneyRequestCreatedReportActionID, moneyRequestPreviewReportActionID, - transactionThreadReportID, modifiedExpenseReportActionID, reportPreviewReportActionID, ...workspaceParams, @@ -4349,13 +4344,11 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { } const workspaceParams = isPolicyExpenseChatReportUtil(chatReport) ? { - receipt, category, tag, taxCode, taxAmount, billable, - linkedTrackedExpenseReportID, policyID: chatReport.policyID, } : undefined; From 0bea712827fe312545d04837f667cfaf10205bc0 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 23 Jan 2025 01:22:29 +0300 Subject: [PATCH 07/14] fix type --- src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts | 3 +++ src/libs/actions/IOU.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts index 4501b36b01e30..e59af3d8714cb 100644 --- a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts +++ b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts @@ -14,6 +14,9 @@ type AddTrackedExpenseToPolicyParams = { actionableWhisperReportActionID: string; moneyRequestReportID: string; reportPreviewReportActionID: string; + modifiedExpenseReportActionID: string; + moneyRequestCreatedReportActionID: string | undefined; + moneyRequestPreviewReportActionID: string; }; export default AddTrackedExpenseToPolicyParams; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 8ef2eec7b71df..9cab8ffd0f838 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -4090,6 +4090,9 @@ type AddTrackedExpenseToPolicyParam = { actionableWhisperReportActionID: string; moneyRequestReportID: string; reportPreviewReportActionID: string; + modifiedExpenseReportActionID: string; + moneyRequestCreatedReportActionID: string | undefined; + moneyRequestPreviewReportActionID: string; } & ConvertTrackedWorkspaceParams; function addTrackedExpenseToPolicy(parameters: AddTrackedExpenseToPolicyParam, onyxData: OnyxData) { From 145364736f89302d55344881eaabee825617c52a Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 23 Jan 2025 01:36:09 +0300 Subject: [PATCH 08/14] make policyID mandatory --- .../AddTrackedExpenseToPolicyParams.ts | 2 +- src/libs/actions/IOU.ts | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts index e59af3d8714cb..b0b4568748a8d 100644 --- a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts +++ b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts @@ -9,7 +9,7 @@ type AddTrackedExpenseToPolicyParams = { taxCode: string; taxAmount: number; billable: boolean | undefined; - policyID: string | undefined; + policyID: string; transactionID: string; actionableWhisperReportActionID: string; moneyRequestReportID: string; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 9cab8ffd0f838..281e3eeb85db3 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -4077,7 +4077,7 @@ type ConvertTrackedWorkspaceParams = { taxCode: string; taxAmount: number; billable: boolean | undefined; - policyID: string | undefined; + policyID: string; }; type AddTrackedExpenseToPolicyParam = { @@ -4345,16 +4345,17 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { if (!linkedTrackedExpenseReportAction || !actionableWhisperReportActionID || !linkedTrackedExpenseReportID) { return; } - const workspaceParams = isPolicyExpenseChatReportUtil(chatReport) - ? { - category, - tag, - taxCode, - taxAmount, - billable, - policyID: chatReport.policyID, - } - : undefined; + const workspaceParams = + isPolicyExpenseChatReportUtil(chatReport) && chatReport.policyID + ? { + category, + tag, + taxCode, + taxAmount, + billable, + policyID: chatReport.policyID, + } + : undefined; convertTrackedExpenseToRequest( payerAccountID, payerEmail, From 8184b859b9b77b86680381e61956a06d71026779 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 23 Jan 2025 14:40:28 +0300 Subject: [PATCH 09/14] add receipt param --- .../parameters/AddTrackedExpenseToPolicyParams.ts | 3 +++ src/libs/actions/IOU.ts | 12 ++---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts index b0b4568748a8d..f5dd44246c2e3 100644 --- a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts +++ b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts @@ -1,3 +1,5 @@ +import type {Receipt} from '@src/types/onyx/Transaction'; + type AddTrackedExpenseToPolicyParams = { amount: number; currency: string; @@ -17,6 +19,7 @@ type AddTrackedExpenseToPolicyParams = { modifiedExpenseReportActionID: string; moneyRequestCreatedReportActionID: string | undefined; moneyRequestPreviewReportActionID: string; + receipt: Receipt | undefined; }; export default AddTrackedExpenseToPolicyParams; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 281e3eeb85db3..0886540911c56 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -4078,6 +4078,7 @@ type ConvertTrackedWorkspaceParams = { taxAmount: number; billable: boolean | undefined; policyID: string; + receipt: Receipt | undefined; }; type AddTrackedExpenseToPolicyParam = { @@ -4346,16 +4347,7 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { return; } const workspaceParams = - isPolicyExpenseChatReportUtil(chatReport) && chatReport.policyID - ? { - category, - tag, - taxCode, - taxAmount, - billable, - policyID: chatReport.policyID, - } - : undefined; + isPolicyExpenseChatReportUtil(chatReport) && chatReport.policyID ? {receipt, category, tag, taxCode, taxAmount, billable, policyID: chatReport.policyID} : undefined; convertTrackedExpenseToRequest( payerAccountID, payerEmail, From f8d39530362aa69bd8ce8524262ec7e08f3271ff Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Fri, 24 Jan 2025 16:22:47 +0300 Subject: [PATCH 10/14] fix receipt param --- src/libs/actions/IOU.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index c3da4ea905268..6680970d37756 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -4347,7 +4347,9 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { return; } const workspaceParams = - isPolicyExpenseChatReportUtil(chatReport) && chatReport.policyID ? {receipt, category, tag, taxCode, taxAmount, billable, policyID: chatReport.policyID} : undefined; + isPolicyExpenseChatReportUtil(chatReport) && chatReport.policyID + ? {receipt: receipt instanceof Blob ? receipt : undefined, category, tag, taxCode, taxAmount, billable, policyID: chatReport.policyID} + : undefined; convertTrackedExpenseToRequest( payerAccountID, payerEmail, From 59247907025f66ff8b1800fb1976f484ec984910 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 27 Jan 2025 17:36:14 +0300 Subject: [PATCH 11/14] added distance request params --- .../AddTrackedExpenseToPolicyParams.ts | 4 +++- src/libs/actions/IOU.ts | 20 +++++++++++++++++-- .../step/IOURequestStepConfirmation.tsx | 16 ++++++++++++++- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts index f5dd44246c2e3..e0b5c5fecf785 100644 --- a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts +++ b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts @@ -11,6 +11,9 @@ type AddTrackedExpenseToPolicyParams = { taxCode: string; taxAmount: number; billable: boolean | undefined; + receipt: Receipt | undefined; + waypoints?: string; + customUnitRateID?: string; policyID: string; transactionID: string; actionableWhisperReportActionID: string; @@ -19,7 +22,6 @@ type AddTrackedExpenseToPolicyParams = { modifiedExpenseReportActionID: string; moneyRequestCreatedReportActionID: string | undefined; moneyRequestPreviewReportActionID: string; - receipt: Receipt | undefined; }; export default AddTrackedExpenseToPolicyParams; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index c6646b2c68831..8806810311daf 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -365,6 +365,8 @@ type RequestMoneyInformation = { action?: IOUAction; reimbursible?: boolean; transactionParams: RequestMoneyTransactionParams; + validWaypoints?: WaypointCollection; + customUnitRateID?: string; }; type MoneyRequestInformationParams = { @@ -4133,6 +4135,8 @@ type ConvertTrackedWorkspaceParams = { billable: boolean | undefined; policyID: string; receipt: Receipt | undefined; + waypoints?: string; + customUnitRateID?: string; }; type AddTrackedExpenseToPolicyParam = { @@ -4346,7 +4350,7 @@ function shareTrackedExpense(trackedExpenseParams: TrackedExpenseParams) { * Submit expense to another user */ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { - const {report, participantParams, policyParams = {}, transactionParams, gpsPoints, action, reimbursible} = requestMoneyInformation; + const {report, participantParams, policyParams = {}, transactionParams, gpsPoints, action, reimbursible, validWaypoints, customUnitRateID} = requestMoneyInformation; const {payeeAccountID} = participantParams; const { amount, @@ -4366,6 +4370,8 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { linkedTrackedExpenseReportID, } = transactionParams; + const sanitizedWaypoints = validWaypoints ? JSON.stringify(sanitizeRecentWaypoints(validWaypoints)) : undefined; + // If the report is iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function const isMoneyRequestReport = isMoneyRequestReportReportUtils(report); const currentChatReport = isMoneyRequestReport ? getReportOrDraftReport(report?.chatReportID) : report; @@ -4405,7 +4411,17 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { } const workspaceParams = isPolicyExpenseChatReportUtil(chatReport) && chatReport.policyID - ? {receipt: receipt instanceof Blob ? receipt : undefined, category, tag, taxCode, taxAmount, billable, policyID: chatReport.policyID} + ? { + receipt: receipt instanceof Blob ? receipt : undefined, + category, + tag, + taxCode, + taxAmount, + billable, + policyID: chatReport.policyID, + waypoints: sanitizedWaypoints, + customUnitRateID, + } : undefined; convertTrackedExpenseToRequest( payerAccountID, diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index a54c882259c83..2982c859407e9 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -278,9 +278,23 @@ function IOURequestStepConfirmation({ linkedTrackedExpenseReportAction: transaction.linkedTrackedExpenseReportAction, linkedTrackedExpenseReportID: transaction.linkedTrackedExpenseReportID, }, + validWaypoints: Object.keys(transaction?.comment?.waypoints ?? {}).length ? getValidWaypoints(transaction.comment?.waypoints, true) : undefined, + customUnitRateID, }); }, - [report, transaction, transactionTaxCode, transactionTaxAmount, currentUserPersonalDetails.login, currentUserPersonalDetails.accountID, policy, policyTags, policyCategories, action], + [ + report, + transaction, + transactionTaxCode, + transactionTaxAmount, + currentUserPersonalDetails.login, + currentUserPersonalDetails.accountID, + policy, + policyTags, + policyCategories, + action, + customUnitRateID, + ], ); const submitPerDiemExpense = useCallback( From 3a153e844f48273ee79293e718c8dc74d5250edc Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 27 Jan 2025 21:06:55 +0300 Subject: [PATCH 12/14] fix distance request bug --- src/libs/actions/IOU.ts | 21 ++++++++++++------- .../step/IOURequestStepConfirmation.tsx | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 8806810311daf..93980a9494d35 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -319,6 +319,8 @@ type RequestMoneyTransactionParams = { actionableWhisperReportActionID?: string; linkedTrackedExpenseReportAction?: OnyxTypes.ReportAction; linkedTrackedExpenseReportID?: string; + waypoints?: WaypointCollection; + customUnitRateID?: string; }; type PerDiemExpenseTransactionParams = { @@ -365,8 +367,6 @@ type RequestMoneyInformation = { action?: IOUAction; reimbursible?: boolean; transactionParams: RequestMoneyTransactionParams; - validWaypoints?: WaypointCollection; - customUnitRateID?: string; }; type MoneyRequestInformationParams = { @@ -4350,7 +4350,7 @@ function shareTrackedExpense(trackedExpenseParams: TrackedExpenseParams) { * Submit expense to another user */ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { - const {report, participantParams, policyParams = {}, transactionParams, gpsPoints, action, reimbursible, validWaypoints, customUnitRateID} = requestMoneyInformation; + const {report, participantParams, policyParams = {}, transactionParams, gpsPoints, action, reimbursible} = requestMoneyInformation; const {payeeAccountID} = participantParams; const { amount, @@ -4368,15 +4368,22 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { actionableWhisperReportActionID, linkedTrackedExpenseReportAction, linkedTrackedExpenseReportID, + waypoints, + customUnitRateID, } = transactionParams; - const sanitizedWaypoints = validWaypoints ? JSON.stringify(sanitizeRecentWaypoints(validWaypoints)) : undefined; + const sanitizedWaypoints = waypoints ? JSON.stringify(sanitizeRecentWaypoints(waypoints)) : undefined; // If the report is iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function const isMoneyRequestReport = isMoneyRequestReportReportUtils(report); const currentChatReport = isMoneyRequestReport ? getReportOrDraftReport(report?.chatReportID) : report; const moneyRequestReportID = isMoneyRequestReport ? report?.reportID : ''; const isMovingTransactionFromTrackExpense = isMovingTransactionFromTrackExpenseIOUUtils(action); + const existingTransactionID = + isMovingTransactionFromTrackExpense && linkedTrackedExpenseReportAction && isMoneyRequestAction(linkedTrackedExpenseReportAction) + ? getOriginalMessage(linkedTrackedExpenseReportAction)?.IOUTransactionID + : undefined; + const existingTransaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${existingTransactionID}`]; const { payerAccountID, @@ -4397,10 +4404,8 @@ function requestMoney(requestMoneyInformation: RequestMoneyInformation) { policyParams, transactionParams, moneyRequestReportID, - existingTransactionID: - isMovingTransactionFromTrackExpense && linkedTrackedExpenseReportAction && isMoneyRequestAction(linkedTrackedExpenseReportAction) - ? getOriginalMessage(linkedTrackedExpenseReportAction)?.IOUTransactionID - : undefined, + existingTransactionID, + existingTransaction: isDistanceRequestTransactionUtils(existingTransaction) ? existingTransaction : undefined, }); const activeReportID = isMoneyRequestReport ? report?.reportID : chatReport.reportID; diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 2982c859407e9..54234a9e24ba8 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -277,9 +277,9 @@ function IOURequestStepConfirmation({ actionableWhisperReportActionID: transaction.actionableWhisperReportActionID, linkedTrackedExpenseReportAction: transaction.linkedTrackedExpenseReportAction, linkedTrackedExpenseReportID: transaction.linkedTrackedExpenseReportID, + waypoints: Object.keys(transaction?.comment?.waypoints ?? {}).length ? getValidWaypoints(transaction.comment?.waypoints, true) : undefined, + customUnitRateID, }, - validWaypoints: Object.keys(transaction?.comment?.waypoints ?? {}).length ? getValidWaypoints(transaction.comment?.waypoints, true) : undefined, - customUnitRateID, }); }, [ From 2e044507e8bee9c7c01a919f98717e4210935f3d Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Wed, 29 Jan 2025 18:27:56 +0300 Subject: [PATCH 13/14] minor fix --- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 54234a9e24ba8..ead1d2a1fc3aa 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -277,7 +277,7 @@ function IOURequestStepConfirmation({ actionableWhisperReportActionID: transaction.actionableWhisperReportActionID, linkedTrackedExpenseReportAction: transaction.linkedTrackedExpenseReportAction, linkedTrackedExpenseReportID: transaction.linkedTrackedExpenseReportID, - waypoints: Object.keys(transaction?.comment?.waypoints ?? {}).length ? getValidWaypoints(transaction.comment?.waypoints, true) : undefined, + waypoints: Object.keys(transaction.comment?.waypoints ?? {}).length ? getValidWaypoints(transaction.comment?.waypoints, true) : undefined, customUnitRateID, }, }); From e8d2b207f436e125eac85fbb1ee720d593082137 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 30 Jan 2025 15:01:54 +0300 Subject: [PATCH 14/14] passed reimursable param --- src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts | 1 + src/libs/actions/IOU.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts index e0b5c5fecf785..3c2441b205e46 100644 --- a/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts +++ b/src/libs/API/parameters/AddTrackedExpenseToPolicyParams.ts @@ -10,6 +10,7 @@ type AddTrackedExpenseToPolicyParams = { tag: string | undefined; taxCode: string; taxAmount: number; + reimbursable: boolean; billable: boolean | undefined; receipt: Receipt | undefined; waypoints?: string; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 117b0534dbc7e..fb485da80ea9d 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -4146,6 +4146,7 @@ type AddTrackedExpenseToPolicyParam = { created: string; merchant: string; transactionID: string; + reimbursable: boolean; actionableWhisperReportActionID: string; moneyRequestReportID: string; reportPreviewReportActionID: string; @@ -4209,6 +4210,7 @@ function convertTrackedExpenseToRequest( comment, created, merchant, + reimbursable: true, transactionID, actionableWhisperReportActionID, moneyRequestReportID,