Skip to content
3 changes: 3 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -6800,6 +6802,7 @@ const CONST = {
SUBMITTED: 'submitted',
APPROVED: 'approved',
POSTED: 'posted',
EXPORTED: 'exported',
MERCHANT: 'merchant',
DESCRIPTION: 'description',
FROM: 'from',
Expand Down
6 changes: 5 additions & 1 deletion src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1075,6 +1078,7 @@ function Search({
shouldShowYearSubmitted={shouldShowYearSubmitted}
shouldShowYearApproved={shouldShowYearApproved}
shouldShowYearPosted={shouldShowYearPosted}
shouldShowYearExported={shouldShowYearExported}
isAmountColumnWide={shouldShowAmountInWideColumn}
isTaxAmountColumnWide={shouldShowTaxAmountInWideColumn}
shouldShowSorting={shouldShowSorting}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ function ExpenseReportListItemRow({
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.EXPORTED, false, false, false, false, false, false, false, item.shouldShowYearExported)]}>
<DateCell
date={item.exported ?? ''}
showTooltip
isLargeScreenWidth
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.STATUS]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.STATUS)]}>
<StatusCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ function TransactionListItem<TItem extends ListItem>({
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,
dateColumnSize: transactionItem.shouldShowYear ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
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,
Expand All @@ -113,6 +114,7 @@ function TransactionListItem<TItem extends ListItem>({
transactionItem.shouldShowYearSubmitted,
transactionItem.shouldShowYearApproved,
transactionItem.shouldShowYearPosted,
transactionItem.shouldShowYearExported,
]);

const transactionViolations = useMemo(() => {
Expand Down Expand Up @@ -196,6 +198,7 @@ function TransactionListItem<TItem extends ListItem>({
submittedColumnSize={submittedColumnSize}
approvedColumnSize={approvedColumnSize}
postedColumnSize={postedColumnSize}
exportedColumnSize={exportedColumnSize}
amountColumnSize={amountColumnSize}
taxAmountColumnSize={taxAmountColumnSize}
shouldShowCheckbox={!!canSelectMultiple}
Expand Down
19 changes: 15 additions & 4 deletions src/components/SelectionListWithSections/SearchTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just moved this to the correct order

{
columnName: CONST.SEARCH.TABLE_COLUMNS.MERCHANT,
translationKey: 'common.merchant',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -259,6 +267,7 @@ type SearchTableHeaderProps = {
shouldShowYearSubmitted?: boolean;
shouldShowYearApproved?: boolean;
shouldShowYearPosted?: boolean;
shouldShowYearExported?: boolean;
isAmountColumnWide: boolean;
isTaxAmountColumnWide: boolean;
shouldShowSorting: boolean;
Expand All @@ -277,6 +286,7 @@ function SearchTableHeader({
shouldShowYearSubmitted,
shouldShowYearApproved,
shouldShowYearPosted,
shouldShowYearExported,
shouldShowSorting,
canSelectMultiple,
isAmountColumnWide,
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type SearchTableHeaderProps = {
submittedColumnSize?: TableColumnSize;
approvedColumnSize?: TableColumnSize;
postedColumnSize?: TableColumnSize;
exportedColumnSize?: TableColumnSize;
amountColumnSize: TableColumnSize;
taxAmountColumnSize: TableColumnSize;
containerStyles?: StyleProp<ViewStyle>;
Expand All @@ -45,6 +46,7 @@ function SortableTableHeader({
submittedColumnSize,
approvedColumnSize,
postedColumnSize,
exportedColumnSize,
containerStyles,
shouldShowSorting,
onSortPress,
Expand Down Expand Up @@ -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}
Expand Down
17 changes: 17 additions & 0 deletions src/components/SelectionListWithSections/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;

Expand Down
31 changes: 31 additions & 0 deletions src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -101,6 +104,7 @@ type TransactionItemRowProps = {
submittedColumnSize?: TableColumnSize;
approvedColumnSize?: TableColumnSize;
postedColumnSize?: TableColumnSize;
exportedColumnSize?: TableColumnSize;
amountColumnSize: TableColumnSize;
taxAmountColumnSize: TableColumnSize;
onCheckboxPress?: (transactionID: string) => void;
Expand Down Expand Up @@ -146,6 +150,7 @@ function TransactionItemRow({
submittedColumnSize,
approvedColumnSize,
postedColumnSize,
exportedColumnSize,
amountColumnSize,
taxAmountColumnSize,
onCheckboxPress = () => {},
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -322,6 +328,30 @@ function TransactionItemRow({
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.EXPORTED]: (
<View
key={CONST.SEARCH.TABLE_COLUMNS.EXPORTED}
style={[
StyleUtils.getReportTableColumnStyles(
CONST.SEARCH.TABLE_COLUMNS.EXPORTED,
false,
false,
false,
areAllOptionalColumnsHidden,
false,
false,
false,
isExportedColumnWide,
),
]}
>
<DateCell
date={transactionItem.exported ?? ''}
showTooltip={shouldShowTooltip}
isLargeScreenWidth={!shouldUseNarrowLayout}
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: (
<View
key={CONST.SEARCH.TABLE_COLUMNS.CATEGORY}
Expand Down Expand Up @@ -525,6 +555,7 @@ function TransactionItemRow({
report?.total,
isApprovedColumnWide,
isPostedColumnWide,
isExportedColumnWide,
isReportItemChild,
onButtonPress,
isActionLoading,
Expand Down
Loading
Loading