diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 71ab52c96754..d23b1515d0e5 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6698,6 +6698,7 @@ const CONST = { SUBMITTED: this.TABLE_COLUMNS.SUBMITTED, APPROVED: this.TABLE_COLUMNS.APPROVED, POSTED: this.TABLE_COLUMNS.POSTED, + EXPORTED: this.TABLE_COLUMNS.EXPORTED, MERCHANT: this.TABLE_COLUMNS.MERCHANT, FROM: this.TABLE_COLUMNS.FROM, TO: this.TABLE_COLUMNS.TO, @@ -6718,6 +6719,7 @@ const CONST = { DATE: this.TABLE_COLUMNS.DATE, SUBMITTED: this.TABLE_COLUMNS.SUBMITTED, APPROVED: this.TABLE_COLUMNS.APPROVED, + EXPORTED: this.TABLE_COLUMNS.EXPORTED, STATUS: this.TABLE_COLUMNS.STATUS, TITLE: this.TABLE_COLUMNS.TITLE, FROM: this.TABLE_COLUMNS.FROM, @@ -6800,6 +6802,7 @@ const CONST = { SUBMITTED: 'submitted', APPROVED: 'approved', POSTED: 'posted', + EXPORTED: 'exported', MERCHANT: 'merchant', DESCRIPTION: 'description', FROM: 'from', diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 91241b5d3404..60298e23d144 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -1041,7 +1041,10 @@ function Search({ navigation.setParams({q: newQuery, rawQuery: undefined}); }; - const {shouldShowYearCreated, shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted} = shouldShowYearUtil(searchResults?.data, isExpenseReportType ?? false); + const {shouldShowYearCreated, shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted, shouldShowYearExported} = shouldShowYearUtil( + searchResults?.data, + isExpenseReportType ?? false, + ); const {shouldShowAmountInWideColumn, shouldShowTaxAmountInWideColumn} = getWideAmountIndicators(searchResults?.data); const shouldShowSorting = !validGroupBy; const shouldShowTableHeader = isLargeScreenWidth && !isChat && !validGroupBy; @@ -1075,6 +1078,7 @@ function Search({ shouldShowYearSubmitted={shouldShowYearSubmitted} shouldShowYearApproved={shouldShowYearApproved} shouldShowYearPosted={shouldShowYearPosted} + shouldShowYearExported={shouldShowYearExported} isAmountColumnWide={shouldShowAmountInWideColumn} isTaxAmountColumnWide={shouldShowTaxAmountInWideColumn} shouldShowSorting={shouldShowSorting} diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index 28faa0dc1e88..0d261cf20a1f 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -107,6 +107,15 @@ function ExpenseReportListItemRow({ /> ), + [CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: ( + + + + ), [CONST.SEARCH.TABLE_COLUMNS.STATUS]: ( ({ backgroundColor: theme.highlightBG, }); - const {amountColumnSize, dateColumnSize, taxAmountColumnSize, submittedColumnSize, approvedColumnSize, postedColumnSize} = useMemo(() => { + const {amountColumnSize, dateColumnSize, taxAmountColumnSize, submittedColumnSize, approvedColumnSize, postedColumnSize, exportedColumnSize} = useMemo(() => { return { amountColumnSize: transactionItem.isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, taxAmountColumnSize: transactionItem.isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, @@ -105,6 +105,7 @@ function TransactionListItem({ submittedColumnSize: transactionItem.shouldShowYearSubmitted ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, approvedColumnSize: transactionItem.shouldShowYearApproved ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, postedColumnSize: transactionItem.shouldShowYearPosted ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, + exportedColumnSize: transactionItem.shouldShowYearExported ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, }; }, [ transactionItem.isAmountColumnWide, @@ -113,6 +114,7 @@ function TransactionListItem({ transactionItem.shouldShowYearSubmitted, transactionItem.shouldShowYearApproved, transactionItem.shouldShowYearPosted, + transactionItem.shouldShowYearExported, ]); const transactionViolations = useMemo(() => { @@ -196,6 +198,7 @@ function TransactionListItem({ submittedColumnSize={submittedColumnSize} approvedColumnSize={approvedColumnSize} postedColumnSize={postedColumnSize} + exportedColumnSize={exportedColumnSize} amountColumnSize={amountColumnSize} taxAmountColumnSize={taxAmountColumnSize} shouldShowCheckbox={!!canSelectMultiple} diff --git a/src/components/SelectionListWithSections/SearchTableHeader.tsx b/src/components/SelectionListWithSections/SearchTableHeader.tsx index 91dcce8a4f9e..764bf0972034 100644 --- a/src/components/SelectionListWithSections/SearchTableHeader.tsx +++ b/src/components/SelectionListWithSections/SearchTableHeader.tsx @@ -34,6 +34,14 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [ columnName: CONST.SEARCH.TABLE_COLUMNS.DATE, translationKey: 'common.date', }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.POSTED, + translationKey: 'search.filters.posted', + }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.EXPORTED, + translationKey: 'search.filters.exported', + }, { columnName: CONST.SEARCH.TABLE_COLUMNS.SUBMITTED, translationKey: 'common.submitted', @@ -42,10 +50,6 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [ columnName: CONST.SEARCH.TABLE_COLUMNS.APPROVED, translationKey: 'search.filters.approved', }, - { - columnName: CONST.SEARCH.TABLE_COLUMNS.POSTED, - translationKey: 'search.filters.posted', - }, { columnName: CONST.SEARCH.TABLE_COLUMNS.MERCHANT, translationKey: 'common.merchant', @@ -196,6 +200,10 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[] columnName: CONST.SEARCH.TABLE_COLUMNS.APPROVED, translationKey: 'search.filters.approved', }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.EXPORTED, + translationKey: 'search.filters.exported', + }, { columnName: CONST.SEARCH.TABLE_COLUMNS.STATUS, translationKey: 'common.status', @@ -259,6 +267,7 @@ type SearchTableHeaderProps = { shouldShowYearSubmitted?: boolean; shouldShowYearApproved?: boolean; shouldShowYearPosted?: boolean; + shouldShowYearExported?: boolean; isAmountColumnWide: boolean; isTaxAmountColumnWide: boolean; shouldShowSorting: boolean; @@ -277,6 +286,7 @@ function SearchTableHeader({ shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted, + shouldShowYearExported, shouldShowSorting, canSelectMultiple, isAmountColumnWide, @@ -318,6 +328,7 @@ function SearchTableHeader({ submittedColumnSize={shouldShowYearSubmitted ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL} approvedColumnSize={shouldShowYearApproved ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL} postedColumnSize={shouldShowYearPosted ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL} + exportedColumnSize={shouldShowYearExported ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL} amountColumnSize={isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL} taxAmountColumnSize={isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL} shouldShowSorting={shouldShowSorting} diff --git a/src/components/SelectionListWithSections/SortableTableHeader.tsx b/src/components/SelectionListWithSections/SortableTableHeader.tsx index 6cd64a675137..b5f883903673 100644 --- a/src/components/SelectionListWithSections/SortableTableHeader.tsx +++ b/src/components/SelectionListWithSections/SortableTableHeader.tsx @@ -28,6 +28,7 @@ type SearchTableHeaderProps = { submittedColumnSize?: TableColumnSize; approvedColumnSize?: TableColumnSize; postedColumnSize?: TableColumnSize; + exportedColumnSize?: TableColumnSize; amountColumnSize: TableColumnSize; taxAmountColumnSize: TableColumnSize; containerStyles?: StyleProp; @@ -45,6 +46,7 @@ function SortableTableHeader({ submittedColumnSize, approvedColumnSize, postedColumnSize, + exportedColumnSize, containerStyles, shouldShowSorting, onSortPress, @@ -86,6 +88,7 @@ function SortableTableHeader({ submittedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE, approvedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE, postedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE, + exportedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE, ), ]} isSortable={isSortable} diff --git a/src/components/SelectionListWithSections/types.ts b/src/components/SelectionListWithSections/types.ts index 181c703965d0..8d0bf24b7424 100644 --- a/src/components/SelectionListWithSections/types.ts +++ b/src/components/SelectionListWithSections/types.ts @@ -252,6 +252,9 @@ type TransactionListItemType = ListItem & /** The date the report was posted */ posted?: string; + /** The date the report was exported */ + exported?: string; + /** Policy to which the transaction belongs */ policy: Policy | undefined; @@ -311,6 +314,11 @@ type TransactionListItemType = ListItem & */ shouldShowYearPosted: boolean; + /** Whether we should show the year for the exported date. + * This is true if at least one transaction in the dataset was exported in past years + */ + shouldShowYearExported: boolean; + isAmountColumnWide: boolean; isTaxAmountColumnWide: boolean; @@ -426,6 +434,9 @@ type TransactionReportGroupListItemType = TransactionGroupListItemType & {groupe /** Final and formatted "to" value used for displaying and sorting */ formattedTo?: string; + /** The date the report was exported */ + exported?: string; + /** * Whether we should show the report year. * This is true if at least one report in the dataset was created in past years @@ -444,6 +455,12 @@ type TransactionReportGroupListItemType = TransactionGroupListItemType & {groupe */ shouldShowYearApproved: boolean; + /** + * Whether we should show the year for the exported date. + * This is true if at least one report in the dataset was exported in past years + */ + shouldShowYearExported: boolean; + /** The main action that can be performed for the report */ action: SearchTransactionAction | undefined; diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index 51b9a6f69a6c..e150aff282a7 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -63,6 +63,9 @@ type TransactionWithOptionalSearchFields = TransactionWithOptionalHighlight & { /** The personal details of the user paying the request */ to?: PersonalDetails; + /** The date the report was exported */ + exported?: string; + /** formatted "to" value used for displaying and sorting on Reports page */ formattedTo?: string; @@ -101,6 +104,7 @@ type TransactionItemRowProps = { submittedColumnSize?: TableColumnSize; approvedColumnSize?: TableColumnSize; postedColumnSize?: TableColumnSize; + exportedColumnSize?: TableColumnSize; amountColumnSize: TableColumnSize; taxAmountColumnSize: TableColumnSize; onCheckboxPress?: (transactionID: string) => void; @@ -146,6 +150,7 @@ function TransactionItemRow({ submittedColumnSize, approvedColumnSize, postedColumnSize, + exportedColumnSize, amountColumnSize, taxAmountColumnSize, onCheckboxPress = () => {}, @@ -180,6 +185,7 @@ function TransactionItemRow({ const isSubmittedColumnWide = submittedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE; const isApprovedColumnWide = approvedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE; const isPostedColumnWide = postedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE; + const isExportedColumnWide = exportedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE; const isAmountColumnWide = amountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE; const isTaxAmountColumnWide = taxAmountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE; @@ -322,6 +328,30 @@ function TransactionItemRow({ /> ), + [CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: ( + + + + ), [CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: ( { + const lastExportedActionByReportID = new Map(); + for (const key of Object.keys(data)) { + if (isReportActionEntry(key)) { + const reportID = key.replace(ONYXKEYS.COLLECTION.REPORT_ACTIONS, ''); + const actions = data[key]; + const exportedActions = Object.values(actions).filter( + (action): action is OnyxTypes.ReportAction => + action.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV || action.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION, + ); + + let exportedAction: OnyxTypes.ReportAction | undefined; + let latestTime = -Infinity; + + for (const action of exportedActions) { + const currentTime = new Date(action.created).getTime(); + if (currentTime > latestTime) { + latestTime = currentTime; + exportedAction = action; + } + } + + if (exportedAction) { + lastExportedActionByReportID.set(reportID, exportedAction); + } + } + } + return lastExportedActionByReportID; +} + /** * Checks if the date of transactions or reports indicate the need to display the year because they are from a past year. * @param data - The search results data (array or object) @@ -884,6 +921,7 @@ function shouldShowYear( shouldShowYearSubmitted: false, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, }; const currentYear = new Date().getFullYear(); @@ -934,6 +972,8 @@ function shouldShowYear( return result; } + const lastExportedActionByReportID = buildLastExportedActionByReportIDMap(data); + for (const key of Object.keys(data)) { if (!checkOnlyReports && isTransactionEntry(key)) { const item = data[key]; @@ -953,6 +993,11 @@ function shouldShowYear( const postedYear = parseInt(item.posted.slice(0, 4), 10); result.shouldShowYearPosted = postedYear !== currentYear; } + + const exportedAction = lastExportedActionByReportID.get(item.reportID); + if (exportedAction?.created && DateUtils.doesDateBelongToAPastYear(exportedAction.created)) { + result.shouldShowYearExported = true; + } } else if (!checkOnlyReports && isReportActionEntry(key)) { const item = data[key]; for (const action of Object.values(item)) { @@ -973,10 +1018,15 @@ function shouldShowYear( if (item.approved && DateUtils.doesDateBelongToAPastYear(item.approved)) { result.shouldShowYearApproved = true; } + + const exportedAction = lastExportedActionByReportID.get(item.reportID); + if (exportedAction?.created && DateUtils.doesDateBelongToAPastYear(exportedAction.created)) { + result.shouldShowYearExported = true; + } } // Early exit if all flags are true - if (result.shouldShowYearCreated && result.shouldShowYearSubmitted && result.shouldShowYearApproved && result.shouldShowYearPosted) { + if (result.shouldShowYearCreated && result.shouldShowYearSubmitted && result.shouldShowYearApproved && result.shouldShowYearPosted && result.shouldShowYearExported) { return result; } } @@ -1133,7 +1183,7 @@ function getTransactionsSections( isActionLoadingSet: ReadonlySet | undefined, ): [TransactionListItemType[], number] { const shouldShowMerchant = getShouldShowMerchant(data); - const {shouldShowYearCreated, shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted} = shouldShowYear(data); + const {shouldShowYearCreated, shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted, shouldShowYearExported} = shouldShowYear(data); const {shouldShowAmountInWideColumn, shouldShowTaxAmountInWideColumn} = getWideAmountIndicators(data); // Pre-filter transaction keys to avoid repeated checks @@ -1147,6 +1197,8 @@ function getTransactionsSections( const transactionsSections: TransactionListItemType[] = []; + const lastExportedActionByReportID = buildLastExportedActionByReportIDMap(data); + const queryJSON = getCurrentSearchQueryJSON(); for (const key of transactionKeys) { @@ -1210,11 +1262,13 @@ function getTransactionsSections( submitted, approved, posted, + exported: lastExportedActionByReportID.get(transactionItem.reportID)?.created ?? '', shouldShowMerchant, shouldShowYear: shouldShowYearCreated, shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted, + shouldShowYearExported, isAmountColumnWide: shouldShowAmountInWideColumn, isTaxAmountColumnWide: shouldShowTaxAmountInWideColumn, violations: transactionViolations, @@ -1591,6 +1645,7 @@ function getReportSections( shouldShowYearSubmitted: shouldShowYearSubmittedTransaction, shouldShowYearApproved: shouldShowYearApprovedTransaction, shouldShowYearPosted: shouldShowYearPostedTransaction, + shouldShowYearExported: shouldShowYearExportedTransaction, } = shouldShowYear(data); const {shouldShowAmountInWideColumn, shouldShowTaxAmountInWideColumn} = getWideAmountIndicators(data); const {moneyRequestReportActionsByTransactionID, holdReportActionsByTransactionID} = createReportActionsLookupMaps(data); @@ -1618,8 +1673,11 @@ function getReportSections( shouldShowYearCreated: shouldShowYearCreatedReport, shouldShowYearSubmitted: shouldShowYearSubmittedReport, shouldShowYearApproved: shouldShowYearApprovedReport, + shouldShowYearExported: shouldShowYearExportedReport, } = shouldShowYear(data, true); + const lastExportedActionByReportID = buildLastExportedActionByReportIDMap(data); + for (const key of orderedKeys) { if (isReportEntry(key) && (data[key].type === CONST.REPORT.TYPE.IOU || data[key].type === CONST.REPORT.TYPE.EXPENSE || data[key].type === CONST.REPORT.TYPE.INVOICE)) { const reportItem = {...data[key]} as OnyxTypes.Report; @@ -1686,6 +1744,7 @@ function getReportSections( groupedBy: CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT, from: fromDetails, to: toDetails, + exported: lastExportedActionByReportID.get(reportItem.reportID)?.created ?? '', formattedFrom, formattedTo, formattedStatus, @@ -1694,6 +1753,7 @@ function getReportSections( shouldShowYear: shouldShowYearCreatedReport, shouldShowYearSubmitted: shouldShowYearSubmittedReport, shouldShowYearApproved: shouldShowYearApprovedReport, + shouldShowYearExported: shouldShowYearExportedReport, hasVisibleViolations: hasVisibleViolationsForReport, }; @@ -1738,11 +1798,13 @@ function getReportSections( formattedTotal, formattedMerchant, date, + exported: lastExportedActionByReportID.get(transactionItem.reportID)?.created ?? '', shouldShowMerchant, shouldShowYear: shouldShowYearCreatedTransaction, shouldShowYearSubmitted: shouldShowYearSubmittedTransaction, shouldShowYearApproved: shouldShowYearApprovedTransaction, shouldShowYearPosted: shouldShowYearPostedTransaction, + shouldShowYearExported: shouldShowYearExportedTransaction, keyForList: transactionItem.transactionID, violations: transactionViolations, isAmountColumnWide: shouldShowAmountInWideColumn, @@ -2302,6 +2364,8 @@ function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): Transla return 'search.filters.approved'; case CONST.SEARCH.TABLE_COLUMNS.POSTED: return 'search.filters.posted'; + case CONST.SEARCH.TABLE_COLUMNS.EXPORTED: + return 'search.filters.exported'; case CONST.SEARCH.TABLE_COLUMNS.MERCHANT: return 'common.merchant'; case CONST.SEARCH.TABLE_COLUMNS.FROM: @@ -2716,6 +2780,7 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.DATE]: true, [CONST.SEARCH.TABLE_COLUMNS.SUBMITTED]: false, [CONST.SEARCH.TABLE_COLUMNS.APPROVED]: false, + [CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: false, [CONST.SEARCH.TABLE_COLUMNS.STATUS]: true, [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: true, @@ -2786,9 +2851,10 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.RECEIPT]: true, [CONST.SEARCH.TABLE_COLUMNS.TYPE]: true, [CONST.SEARCH.TABLE_COLUMNS.DATE]: true, + [CONST.SEARCH.TABLE_COLUMNS.POSTED]: false, + [CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: false, [CONST.SEARCH.TABLE_COLUMNS.SUBMITTED]: false, [CONST.SEARCH.TABLE_COLUMNS.APPROVED]: false, - [CONST.SEARCH.TABLE_COLUMNS.POSTED]: false, [CONST.SEARCH.TABLE_COLUMNS.MERCHANT]: false, [CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION]: false, [CONST.SEARCH.TABLE_COLUMNS.FROM]: false, diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 11b5cd7891ee..55f161c3e3c6 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1727,6 +1727,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ isSubmittedColumnWide = false, isApprovedColumnWide = false, isPostedColumnWide = false, + isExportedColumnWide = false, ): ViewStyle => { let columnWidth; switch (columnName) { @@ -1749,6 +1750,9 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ case CONST.SEARCH.TABLE_COLUMNS.POSTED: columnWidth = {...getWidthStyle(isPostedColumnWide ? variables.w92 : variables.w72)}; break; + case CONST.SEARCH.TABLE_COLUMNS.EXPORTED: + columnWidth = {...getWidthStyle(isExportedColumnWide ? variables.w92 : variables.w72)}; + break; case CONST.SEARCH.TABLE_COLUMNS.DATE: // We will remove this variable & param, but in a follow up PR. We are duplicating the logic here to "use" the variable // to prevent eslint errors. This will be removed diff --git a/tests/unit/MoneyRequestReportUtilsTest.ts b/tests/unit/MoneyRequestReportUtilsTest.ts index 230e7cc55997..49ddea2c80e5 100644 --- a/tests/unit/MoneyRequestReportUtilsTest.ts +++ b/tests/unit/MoneyRequestReportUtilsTest.ts @@ -66,6 +66,7 @@ const transactionItemBaseMock: TransactionListItemType = { submitted: '2024-12-21', approved: undefined, posted: undefined, + exported: undefined, currency: 'USD', date: '2024-12-21', formattedFrom: 'Admin', @@ -93,6 +94,7 @@ const transactionItemBaseMock: TransactionListItemType = { shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, isAmountColumnWide: false, isTaxAmountColumnWide: false, tag: '', diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index a4338dceae28..c60a07ed4ff6 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -776,6 +776,7 @@ const transactionsListItems = [ submitted: undefined, approved: undefined, posted: '', + exported: '', currency: 'USD', date: '2024-12-21', formattedFrom: 'Admin', @@ -803,6 +804,7 @@ const transactionsListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, isAmountColumnWide: false, isTaxAmountColumnWide: false, tag: '', @@ -834,6 +836,7 @@ const transactionsListItems = [ submitted: '2024-12-21 13:05:20', approved: undefined, posted: '', + exported: '', currency: 'USD', date: '2024-12-21', formattedFrom: 'Admin', @@ -860,6 +863,7 @@ const transactionsListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, isAmountColumnWide: false, isTaxAmountColumnWide: false, tag: '', @@ -902,6 +906,7 @@ const transactionsListItems = [ submitted: '2025-03-05', approved: undefined, posted: '', + exported: '', currency: 'VND', hasEReceipt: false, merchant: '(none)', @@ -935,6 +940,7 @@ const transactionsListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, keyForList: '3', isAmountColumnWide: false, isTaxAmountColumnWide: false, @@ -965,6 +971,7 @@ const transactionsListItems = [ submitted: '2025-03-05', approved: undefined, posted: '', + exported: '', currency: 'VND', hasEReceipt: false, merchant: '(none)', @@ -998,6 +1005,7 @@ const transactionsListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, keyForList: '4', isAmountColumnWide: false, isTaxAmountColumnWide: false, @@ -1041,9 +1049,11 @@ const transactionReportGroupListItems = [ policyID: 'A1B2C3', reportID: '123456789', reportName: 'Expense Report #123', + exported: '', shouldShowYear: true, shouldShowYearSubmitted: true, shouldShowYearApproved: false, + shouldShowYearExported: false, stateNum: 0, statusNum: 0, to: emptyPersonalDetails, @@ -1066,6 +1076,7 @@ const transactionReportGroupListItems = [ created: '2024-12-21', currency: 'USD', date: '2024-12-21', + exported: '', formattedFrom: 'Admin', formattedMerchant: 'Expense', formattedTo: '', @@ -1091,6 +1102,7 @@ const transactionReportGroupListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, isAmountColumnWide: false, isTaxAmountColumnWide: false, tag: '', @@ -1118,6 +1130,7 @@ const transactionReportGroupListItems = [ created: '2024-12-21 13:05:20', submitted: '2024-12-21 13:05:20', approved: undefined, + exported: '', currency: 'USD', formattedFrom: 'Admin', formattedStatus: 'Outstanding', @@ -1141,6 +1154,7 @@ const transactionReportGroupListItems = [ shouldShowYear: true, shouldShowYearSubmitted: true, shouldShowYearApproved: false, + shouldShowYearExported: false, stateNum: 1, statusNum: 1, to: { @@ -1166,6 +1180,7 @@ const transactionReportGroupListItems = [ category: '', comment: {comment: ''}, created: '2024-12-21', + exported: '', currency: 'USD', date: '2024-12-21', formattedFrom: 'Admin', @@ -1198,6 +1213,7 @@ const transactionReportGroupListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, isAmountColumnWide: false, isTaxAmountColumnWide: false, tag: '', @@ -1229,6 +1245,7 @@ const transactionReportGroupListItems = [ created: '2025-03-05 16:34:27', submitted: '2025-03-05', approved: undefined, + exported: '', currency: 'VND', formattedFrom: 'Admin', formattedStatus: 'Outstanding', @@ -1248,6 +1265,7 @@ const transactionReportGroupListItems = [ shouldShowYear: true, shouldShowYearSubmitted: true, shouldShowYearApproved: false, + shouldShowYearExported: false, stateNum: 1, statusNum: 1, total: 4400, @@ -1284,6 +1302,7 @@ const transactionReportGroupListItems = [ category: '', comment: {comment: ''}, created: '2025-03-05', + exported: '', currency: 'VND', hasEReceipt: false, merchant: '(none)', @@ -1317,6 +1336,7 @@ const transactionReportGroupListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, keyForList: '3', isAmountColumnWide: false, isTaxAmountColumnWide: false, @@ -1344,6 +1364,7 @@ const transactionReportGroupListItems = [ category: '', comment: {comment: ''}, created: '2025-03-05', + exported: '', currency: 'VND', hasEReceipt: false, merchant: '(none)', @@ -1377,6 +1398,7 @@ const transactionReportGroupListItems = [ shouldShowYearSubmitted: true, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, keyForList: '4', isAmountColumnWide: false, isTaxAmountColumnWide: false, @@ -1399,6 +1421,7 @@ const transactionReportGroupListItems = [ allActions: ['view'], chatReportID: '1706144653204915', created: '2024-12-21 13:05:20', + exported: '', currency: 'USD', formattedFrom: 'Admin', formattedStatus: 'Draft', @@ -1422,6 +1445,7 @@ const transactionReportGroupListItems = [ shouldShowYear: true, shouldShowYearSubmitted: true, shouldShowYearApproved: false, + shouldShowYearExported: false, stateNum: 0, statusNum: 0, to: emptyPersonalDetails, @@ -1873,7 +1897,7 @@ describe('SearchUIUtils', () => { expect(distanceTransaction).toBeDefined(); expect(distanceTransaction?.iouRequestType).toBe(CONST.IOU.REQUEST_TYPE.DISTANCE); - const expectedPropertyCount = 52; + const expectedPropertyCount = 54; expect(Object.keys(distanceTransaction ?? {}).length).toBe(expectedPropertyCount); }); @@ -1906,7 +1930,7 @@ describe('SearchUIUtils', () => { expect(distanceTransaction).toBeDefined(); expect(distanceTransaction?.iouRequestType).toBe(CONST.IOU.REQUEST_TYPE.DISTANCE); - const expectedPropertyCount = 49; + const expectedPropertyCount = 51; expect(Object.keys(distanceTransaction ?? {}).length).toBe(expectedPropertyCount); }); @@ -2764,6 +2788,7 @@ describe('SearchUIUtils', () => { [CONST.SEARCH.TABLE_COLUMNS.DATE]: true, [CONST.SEARCH.TABLE_COLUMNS.SUBMITTED]: false, [CONST.SEARCH.TABLE_COLUMNS.APPROVED]: false, + [CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: false, [CONST.SEARCH.TABLE_COLUMNS.STATUS]: true, [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: true, @@ -2784,6 +2809,7 @@ describe('SearchUIUtils', () => { [CONST.SEARCH.TABLE_COLUMNS.DATE]: true, [CONST.SEARCH.TABLE_COLUMNS.SUBMITTED]: false, [CONST.SEARCH.TABLE_COLUMNS.APPROVED]: false, + [CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: false, [CONST.SEARCH.TABLE_COLUMNS.STATUS]: true, [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: false, diff --git a/tests/unit/Search/handleActionButtonPressTest.ts b/tests/unit/Search/handleActionButtonPressTest.ts index bfb339a6c348..2c796e2b148e 100644 --- a/tests/unit/Search/handleActionButtonPressTest.ts +++ b/tests/unit/Search/handleActionButtonPressTest.ts @@ -19,6 +19,7 @@ const mockReportItemWithHold = { submitted: '2024-12-04', approved: undefined, posted: undefined, + exported: undefined, currency: 'USD', isOneTransactionReport: false, isPolicyExpenseChat: false, @@ -70,6 +71,7 @@ const mockReportItemWithHold = { shouldShowYearSubmitted: false, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, transactions: [ { report: { @@ -117,6 +119,7 @@ const mockReportItemWithHold = { submitted: '2024-12-04', approved: undefined, posted: undefined, + exported: undefined, policyID: '48D7178DE42EE9F9', reportID: '1350959062018695', reportType: 'expense', @@ -163,6 +166,7 @@ const mockReportItemWithHold = { shouldShowYearSubmitted: false, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, keyForList: '1049531721038862176', isAmountColumnWide: false, isTaxAmountColumnWide: false, @@ -202,6 +206,7 @@ const mockReportItemWithHold = { submitted: '2024-12-04', approved: undefined, posted: undefined, + exported: undefined, currency: 'USD', hasEReceipt: false, merchant: 'Forbes', @@ -235,6 +240,7 @@ const mockReportItemWithHold = { shouldShowYearSubmitted: false, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, keyForList: '5345995386715609966', isAmountColumnWide: false, isTaxAmountColumnWide: false, diff --git a/tests/unit/TransactionGroupListItemTest.tsx b/tests/unit/TransactionGroupListItemTest.tsx index a6d46d6544bc..e8af17b43762 100644 --- a/tests/unit/TransactionGroupListItemTest.tsx +++ b/tests/unit/TransactionGroupListItemTest.tsx @@ -34,6 +34,7 @@ const mockTransaction: TransactionListItemType = { submitted: '2025-09-19', approved: undefined, posted: undefined, + exported: undefined, currency: 'USD', policy: { id: '06F34677820A4D07', @@ -71,6 +72,7 @@ const mockTransaction: TransactionListItemType = { shouldShowYearSubmitted: false, shouldShowYearApproved: false, shouldShowYearPosted: false, + shouldShowYearExported: false, keyForList: '1', isAmountColumnWide: false, isTaxAmountColumnWide: false, @@ -97,6 +99,7 @@ const mockReport: TransactionReportGroupListItemType = { created: '2025-09-19 20:00:47', submitted: '2025-09-19', approved: undefined, + exported: undefined, currency: 'USD', isOneTransactionReport: true, isOwnPolicyExpenseChat: false, @@ -128,6 +131,7 @@ const mockReport: TransactionReportGroupListItemType = { shouldShowYear: false, shouldShowYearSubmitted: false, shouldShowYearApproved: false, + shouldShowYearExported: false, action: 'view', transactions: [], groupedBy: 'expense-report',