Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5469b5d
add to consts
JS00001 Dec 16, 2025
5706a1c
add workspace translation and visibility
JS00001 Dec 16, 2025
9043449
add headers
JS00001 Dec 16, 2025
9d3b29f
add workspace widths
JS00001 Dec 16, 2025
b445383
add cols for workspace
JS00001 Dec 16, 2025
3368635
cleanup code
JS00001 Dec 16, 2025
6299b2d
add workspace cell component
JS00001 Dec 16, 2025
72f3d1e
implement cells for workspace
JS00001 Dec 16, 2025
adf595b
fix reports behavior with columns showing everything. Only shoiw dfee…
JS00001 Dec 16, 2025
3599d04
sort by workspace
JS00001 Dec 16, 2025
c8f68b8
update sorting
JS00001 Dec 16, 2025
c0cf3da
fix tests
JS00001 Dec 16, 2025
1ab0451
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 16, 2025
06a36c9
fix defaults again
JS00001 Dec 16, 2025
4e1d50a
add sorting for workspace
JS00001 Dec 16, 2025
b66cd37
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 16, 2025
23a3c44
update to use policy name
JS00001 Dec 16, 2025
bb6cf92
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 16, 2025
fdee906
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 16, 2025
5e09bee
add min width
JS00001 Dec 16, 2025
f1c4b3d
revert style changes
JS00001 Dec 16, 2025
a3c428e
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 16, 2025
475571d
update expense policy avatar
JS00001 Dec 16, 2025
8d6fa74
handle team policies
JS00001 Dec 16, 2025
c3b8adb
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 17, 2025
b7ba841
update the workspace cell
JS00001 Dec 17, 2025
4177deb
fix sorting for reports
JS00001 Dec 17, 2025
332c6f5
fix sorting
JS00001 Dec 17, 2025
40dd104
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 17, 2025
f26c340
invert sorting conditions
JS00001 Dec 17, 2025
89c3eac
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 17, 2025
e5b9403
Merge branch 'main' of github.com:Expensify/App into jsenyitko-add-wo…
JS00001 Dec 17, 2025
a74ba44
fix merge conflict errs
JS00001 Dec 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6701,6 +6701,7 @@ const CONST = {
MERCHANT: this.TABLE_COLUMNS.MERCHANT,
FROM: this.TABLE_COLUMNS.FROM,
TO: this.TABLE_COLUMNS.TO,
POLICY_NAME: this.TABLE_COLUMNS.POLICY_NAME,
CARD: this.TABLE_COLUMNS.CARD,
CATEGORY: this.TABLE_COLUMNS.CATEGORY,
TAG: this.TABLE_COLUMNS.TAG,
Expand All @@ -6723,6 +6724,7 @@ const CONST = {
TITLE: this.TABLE_COLUMNS.TITLE,
FROM: this.TABLE_COLUMNS.FROM,
TO: this.TABLE_COLUMNS.TO,
POLICY_NAME: this.TABLE_COLUMNS.POLICY_NAME,
REIMBURSABLE_TOTAL: this.TABLE_COLUMNS.REIMBURSABLE_TOTAL,
NON_REIMBURSABLE_TOTAL: this.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL,
REPORT_ID: this.TABLE_COLUMNS.REPORT_ID,
Expand Down Expand Up @@ -6823,6 +6825,7 @@ const CONST = {
IN: 'in',
COMMENTS: 'comments',
CARD: 'card',
POLICY_NAME: 'policyname',
WITHDRAWAL_ID: 'withdrawalID',
AVATAR: 'avatar',
STATUS: 'status',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import TextCell from './TextCell';
import TotalCell from './TotalCell';
import UserInfoAndActionButtonRow from './UserInfoAndActionButtonRow';
import UserInfoCell from './UserInfoCell';
import WorkspaceCell from './WorkspaceCell';

type ExpenseReportListItemRowProps = {
item: ExpenseReportListItemType;
Expand Down Expand Up @@ -196,6 +197,14 @@ function ExpenseReportListItemRow({
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME)]}>
<WorkspaceCell
policyID={item.policyID}
report={item}
/>
</View>
),
};

const thereIsFromAndTo = !!item?.from && !!item?.to;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import {View} from 'react-native';
import Avatar from '@components/Avatar';
import TextWithTooltip from '@components/TextWithTooltip';
import useThemeStyles from '@hooks/useThemeStyles';
import {getPolicyName, getWorkspaceIcon} from '@libs/ReportUtils';
import CONST from '@src/CONST';
import type {Report} from '@src/types/onyx';

type WorkspaceCellProps = {
policyID?: string;
report?: Report;
};

function WorkspaceCell({policyID, report}: WorkspaceCellProps) {
const styles = useThemeStyles();
const icon = getWorkspaceIcon(report);
const name = getPolicyName({report});

if (report?.type !== CONST.REPORT.TYPE.EXPENSE && report?.type !== CONST.REPORT.TYPE.INVOICE) {
return null;
}

if (!icon || !name) {
return null;
}

return (
<View style={[styles.flexRow, styles.gap3, styles.flex1, styles.alignItemsCenter]}>
<Avatar
imageStyles={[styles.alignSelfCenter]}
size={CONST.AVATAR_SIZE.MID_SUBSCRIPT}
source={icon.source}
avatarID={policyID}
name={name ?? ''}
type={CONST.ICON_TYPE_WORKSPACE}
/>
<TextWithTooltip
text={name ?? ''}
shouldShowTooltip
style={[styles.flex1, styles.flexGrow1]}
/>
</View>
);
}

WorkspaceCell.displayName = 'ReportInfoCell';

export default WorkspaceCell;
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [
translationKey: 'common.to',
canBeMissing: true,
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME,
translationKey: 'workspace.common.workspace',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.CARD,
translationKey: 'common.card',
Expand Down Expand Up @@ -212,6 +216,10 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[]
columnName: CONST.SEARCH.TABLE_COLUMNS.TO,
translationKey: 'common.to',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME,
translationKey: 'workspace.common.workspace',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL,
translationKey: 'common.reimbursableTotal',
Expand Down
9 changes: 9 additions & 0 deletions src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import StatusCell from '@components/SelectionListWithSections/Search/StatusCell'
import TextCell from '@components/SelectionListWithSections/Search/TextCell';
import AmountCell from '@components/SelectionListWithSections/Search/TotalCell';
import UserInfoCell from '@components/SelectionListWithSections/Search/UserInfoCell';
import WorkspaceCell from '@components/SelectionListWithSections/Search/WorkspaceCell';
import Text from '@components/Text';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -499,6 +500,14 @@ function TransactionItemRow({
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME)]}>
<WorkspaceCell
policyID={transactionItem.report?.policyID}
report={transactionItem.report}
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.TITLE]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TITLE)]}>
<TextCell
Expand Down
27 changes: 26 additions & 1 deletion src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import {
generateReportID,
getIcons,
getPersonalDetailsForAccountID,
getPolicyName,
getReportName,
getReportOrDraftReport,
getReportStatusTranslation,
Expand Down Expand Up @@ -2053,6 +2054,17 @@ function getSortedTransactionData(

const sortingProperty = transactionColumnNamesToSortingProperty[sortBy];

if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) {
return data.sort((a, b) => {
const aIsUnreported = a.report?.type !== CONST.REPORT.TYPE.EXPENSE && a.report?.type !== CONST.REPORT.TYPE.INVOICE;
const bIsUnreported = b.report?.type !== CONST.REPORT.TYPE.EXPENSE && b.report?.type !== CONST.REPORT.TYPE.INVOICE;

const aValue = !aIsUnreported ? getPolicyName({report: a.report}) : '';
const bValue = !bIsUnreported ? getPolicyName({report: b.report}) : '';
return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare);
});
}

if (sortBy === CONST.SEARCH.TABLE_COLUMNS.TITLE) {
return data.sort((a, b) => {
const aValue = a.report?.reportName ?? '';
Expand Down Expand Up @@ -2161,6 +2173,14 @@ function getSortedReportData(
});
}

if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) {
return data.sort((a, b) => {
const aValue = getPolicyName({report: a});
const bValue = getPolicyName({report: b});
return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare);
});
}

if (sortBy === CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL) {
return data.sort((a, b) => {
const aTotal = a.total;
Expand Down Expand Up @@ -2360,6 +2380,8 @@ function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): Transla
return 'common.title';
case CONST.SEARCH.TABLE_COLUMNS.STATUS:
return 'common.status';
case CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME:
return 'workspace.common.workspace';
case CONST.SEARCH.TABLE_COLUMNS.CARD:
return 'common.card';
case CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL:
Expand Down Expand Up @@ -2760,6 +2782,7 @@ function getColumnsToShow(
[CONST.SEARCH.TABLE_COLUMNS.TITLE]: true,
[CONST.SEARCH.TABLE_COLUMNS.FROM]: true,
[CONST.SEARCH.TABLE_COLUMNS.TO]: true,
[CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false,
[CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE_TOTAL]: false,
[CONST.SEARCH.TABLE_COLUMNS.NON_REIMBURSABLE_TOTAL]: false,
[CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true,
Expand All @@ -2777,12 +2800,13 @@ function getColumnsToShow(
// columns hidden by default
const columns: ColumnVisibility = {};
const requiredColumns = new Set<keyof ColumnVisibility>([CONST.SEARCH.TABLE_COLUMNS.AVATAR, CONST.SEARCH.TABLE_COLUMNS.TOTAL]);
const columnsToShow = visibleColumns.length ? visibleColumns : CONST.SEARCH.DEFAULT_COLUMNS.EXPENSE_REPORT;

for (const columnId of Object.keys(reportColumns) as SearchColumnType[]) {
columns[columnId] = requiredColumns.has(columnId);
}

for (const column of visibleColumns) {
for (const column of columnsToShow) {
columns[column as keyof ColumnVisibility] = true;
}

Expand Down Expand Up @@ -2835,6 +2859,7 @@ function getColumnsToShow(
[CONST.SEARCH.TABLE_COLUMNS.FROM]: false,
[CONST.SEARCH.TABLE_COLUMNS.TO]: false,
[CONST.SEARCH.TABLE_COLUMNS.CARD]: false,
[CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false,
[CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: false,
[CONST.SEARCH.TABLE_COLUMNS.TAG]: false,
[CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE]: false,
Expand Down
1 change: 1 addition & 0 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
case CONST.SEARCH.TABLE_COLUMNS.ACTION:
columnWidth = {...getWidthStyle(variables.w80), ...styles.alignItemsCenter};
break;
case CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME:
case CONST.SEARCH.TABLE_COLUMNS.CARD:
case CONST.SEARCH.TABLE_COLUMNS.REPORT_ID:
case CONST.SEARCH.TABLE_COLUMNS.BASE_62_REPORT_ID:
Expand Down
1 change: 1 addition & 0 deletions src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ export default {
w130: 130,
w184: 184,
w191: 191,
w200: 200,
// Transaction item row heights based on layout types
// Wide screen (desktop) layout
optionRowWideItemHeight: 64,
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/Search/SearchUIUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2758,7 +2758,7 @@ describe('SearchUIUtils', () => {
});

describe('Test getColumnsToShow', () => {
test('Should show all columns when no custom columns are saved & viewing expense reports', () => {
test('Should show all default columns when no custom columns are saved & viewing expense reports', () => {
expect(SearchUIUtils.getColumnsToShow(1, [], [], false, CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT)).toEqual({
[CONST.SEARCH.TABLE_COLUMNS.AVATAR]: true,
[CONST.SEARCH.TABLE_COLUMNS.DATE]: true,
Expand All @@ -2767,6 +2767,7 @@ describe('SearchUIUtils', () => {
[CONST.SEARCH.TABLE_COLUMNS.STATUS]: true,
[CONST.SEARCH.TABLE_COLUMNS.TITLE]: true,
[CONST.SEARCH.TABLE_COLUMNS.FROM]: true,
[CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false,
[CONST.SEARCH.TABLE_COLUMNS.TO]: true,
[CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true,
[CONST.SEARCH.TABLE_COLUMNS.ACTION]: true,
Expand All @@ -2789,6 +2790,7 @@ describe('SearchUIUtils', () => {
[CONST.SEARCH.TABLE_COLUMNS.STATUS]: true,
[CONST.SEARCH.TABLE_COLUMNS.TITLE]: true,
[CONST.SEARCH.TABLE_COLUMNS.FROM]: false,
[CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false,
[CONST.SEARCH.TABLE_COLUMNS.TO]: false,
// Total should always be visible
[CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true,
Expand Down
Loading