Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8215,6 +8215,11 @@ const CONST = {
search: true,
reportView: false,
},
PAID: {
column: this.TABLE_COLUMNS.PAID,
search: true,
reportView: false,
},
POSTED: {
column: this.TABLE_COLUMNS.POSTED,
search: true,
Expand Down Expand Up @@ -8400,6 +8405,7 @@ const CONST = {
APPROVED: this.TABLE_COLUMNS.APPROVED,
FIRST_APPROVER: this.TABLE_COLUMNS.FIRST_APPROVER,
FIRST_APPROVED: this.TABLE_COLUMNS.FIRST_APPROVED,
PAID: this.TABLE_COLUMNS.PAID,
PAID_BY: this.TABLE_COLUMNS.PAID_BY,
EXPORTED: this.TABLE_COLUMNS.EXPORTED,
STATUS: this.TABLE_COLUMNS.STATUS,
Expand Down Expand Up @@ -8604,6 +8610,7 @@ const CONST = {
APPROVED: 'approved',
FIRST_APPROVER: 'firstapprover',
FIRST_APPROVED: 'firstapproved',
PAID: 'paid',
PAID_BY: 'paidBy',
POSTED: 'posted',
EXPORTED: 'exported',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function ExpenseReportListItemRowWide({
const submitterUserID = item.submitterUserID;
const submitterPayrollID = item.submitterPayrollID;
const orderDealNumbers = item.orderDealNumbers;
const {debitedAmount, debitedCurrency, creditedAmount, creditedCurrency} = item;
const {debitedAmount, debitedCurrency, creditedAmount, creditedCurrency, paid: paidDate = ''} = item;

const columnComponents = {
[CONST.SEARCH.TABLE_COLUMNS.AVATAR]: <ExpenseReportListItemAvatar item={item} />,
Expand Down Expand Up @@ -114,6 +114,16 @@ function ExpenseReportListItemRowWide({
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.PAID]: (
<View style={[getSearchColumnStyles(CONST.SEARCH.TABLE_COLUMNS.PAID, {isPaidColumnWide: item.shouldShowYearPaid})]}>
<DateCell
date={paidDate}
showTooltip
isLargeScreenWidth
shouldUseLocalTimeZone
/>
</View>
),
[CONST.SEARCH.TABLE_COLUMNS.PAID_BY]: (
<View style={[getSearchColumnStyles(CONST.SEARCH.TABLE_COLUMNS.PAID_BY)]}>
{!!item.paidByAccountID && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function TransactionListItemWide<TItem extends ListItem>({
const dateColumnSize = transactionItem.shouldShowYear ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
const submittedColumnSize = transactionItem.shouldShowYearSubmitted ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
const approvedColumnSize = transactionItem.shouldShowYearApproved ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
const paidColumnSize = transactionItem.shouldShowYearPaid ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
const postedColumnSize = transactionItem.shouldShowYearPosted ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
const exportedColumnSize = transactionItem.shouldShowYearExported ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;

Expand Down Expand Up @@ -222,6 +223,7 @@ function TransactionListItemWide<TItem extends ListItem>({
dateColumnSize={dateColumnSize}
submittedColumnSize={submittedColumnSize}
approvedColumnSize={approvedColumnSize}
paidColumnSize={paidColumnSize}
postedColumnSize={postedColumnSize}
exportedColumnSize={exportedColumnSize}
amountColumnSize={amountColumnSize}
Expand Down
17 changes: 17 additions & 0 deletions src/components/Search/SearchList/ListItem/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ type TransactionListItemType = ListItem &
/** The date the report was approved */
approved?: string;

/** The date the report was paid */
paid?: string;

/** The date the report was posted */
posted?: string;

Expand Down Expand Up @@ -144,6 +147,11 @@ type TransactionListItemType = ListItem &
*/
shouldShowYearApproved: boolean;

/** Whether we should show the year for the paid date.
* This is true if at least one transaction in the dataset belongs to a report paid in past years
*/
shouldShowYearPaid?: boolean;

/** Whether we should show the year for the posted date.
* This is true if at least one transaction in the dataset was posted in past years
*/
Expand Down Expand Up @@ -255,6 +263,9 @@ type TransactionReportGroupListItemType = TransactionGroupListItemType & {groupe
/** The date of the report's first approval (created date of the earliest APPROVED/FORWARDED report action) */
firstApproved?: string;

/** The date the report was paid (created date of the latest payment report action that was not cancelled) */
paid?: string;

firstApproverAvatar?: AvatarSource;

/** Account ID of the first approver (actor on the earliest APPROVED/FORWARDED report action) */
Expand Down Expand Up @@ -298,6 +309,12 @@ type TransactionReportGroupListItemType = TransactionGroupListItemType & {groupe
*/
shouldShowYearExported: boolean;

/**
* Whether we should show the year for the paid date.
* This is true if at least one report in the dataset was paid in past years
*/
shouldShowYearPaid?: boolean;

/** The main action that can be performed for the report */
action: SearchTransactionAction | undefined;

Expand Down
11 changes: 11 additions & 0 deletions src/components/Search/SearchTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [
columnName: CONST.SEARCH.TABLE_COLUMNS.APPROVED,
translationKey: 'search.filters.approved',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.PAID,
translationKey: 'search.filters.paid',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.MERCHANT,
translationKey: 'common.merchant',
Expand Down Expand Up @@ -280,6 +284,10 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[]
columnName: CONST.SEARCH.TABLE_COLUMNS.FIRST_APPROVED,
translationKey: 'search.filters.firstApproved',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.PAID,
translationKey: 'search.filters.paid',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.PAID_BY,
translationKey: 'search.filters.paidBy',
Expand Down Expand Up @@ -558,6 +566,7 @@ type SearchTableHeaderProps = {
shouldShowYearApproved?: boolean;
shouldShowYearPosted?: boolean;
shouldShowYearExported?: boolean;
shouldShowYearPaid?: boolean;
shouldShowYearWithdrawn?: boolean;
isAmountColumnWide: boolean;
isTaxAmountColumnWide: boolean;
Expand All @@ -583,6 +592,7 @@ function SearchTableHeader({
shouldShowYearApproved,
shouldShowYearPosted,
shouldShowYearExported,
shouldShowYearPaid,
shouldShowYearWithdrawn,
shouldShowSorting,
canSelectMultiple,
Expand Down Expand Up @@ -657,6 +667,7 @@ function SearchTableHeader({
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}
paidColumnSize={shouldShowYearPaid ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
withdrawnColumnSize={shouldShowYearWithdrawn ? 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}
Expand Down
3 changes: 3 additions & 0 deletions src/components/Search/SortableTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type SearchTableHeaderProps = {
approvedColumnSize?: TableColumnSize;
postedColumnSize?: TableColumnSize;
exportedColumnSize?: TableColumnSize;
paidColumnSize?: TableColumnSize;
withdrawnColumnSize?: TableColumnSize;
amountColumnSize: TableColumnSize;
taxAmountColumnSize: TableColumnSize;
Expand All @@ -58,6 +59,7 @@ function SortableTableHeader({
approvedColumnSize,
postedColumnSize,
exportedColumnSize,
paidColumnSize,
withdrawnColumnSize,
containerStyles,
shouldShowSorting,
Expand Down Expand Up @@ -113,6 +115,7 @@ function SortableTableHeader({
isApprovedColumnWide: approvedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
isPostedColumnWide: postedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
isExportedColumnWide: exportedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
isPaidColumnWide: paidColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
isTaxAmountColumnWide: taxAmountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
isAmountColumnWide: amountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
shouldRemoveTotalColumnFlex,
Expand Down
7 changes: 6 additions & 1 deletion src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,7 @@ function Search({
shouldShowYearApproved: false,
shouldShowYearPosted: false,
shouldShowYearExported: false,
shouldShowYearPaid: false,
shouldShowYearWithdrawn: false,
},
[searchResults?.data, isExpenseReportType, type],
Expand Down Expand Up @@ -1299,6 +1300,7 @@ function Search({
isApprovedColumnWide: yearIndicators.shouldShowYearApproved,
isPostedColumnWide: yearIndicators.shouldShowYearPosted,
isExportedColumnWide: yearIndicators.shouldShowYearExported,
isPaidColumnWide: yearIndicators.shouldShowYearPaid,
isWithdrawnColumnWide: yearIndicators.shouldShowYearWithdrawn,
isAmountColumnWide: amountIndicators.shouldShowAmountInWideColumn,
isTaxAmountColumnWide: amountIndicators.shouldShowTaxAmountInWideColumn,
Expand All @@ -1310,6 +1312,7 @@ function Search({
yearIndicators.shouldShowYearApproved,
yearIndicators.shouldShowYearPosted,
yearIndicators.shouldShowYearExported,
yearIndicators.shouldShowYearPaid,
yearIndicators.shouldShowYearWithdrawn,
amountIndicators.shouldShowAmountInWideColumn,
amountIndicators.shouldShowTaxAmountInWideColumn,
Expand Down Expand Up @@ -1458,7 +1461,8 @@ function Search({
);
}

const {shouldShowYearCreated, shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted, shouldShowYearExported, shouldShowYearWithdrawn} = yearIndicators;
const {shouldShowYearCreated, shouldShowYearSubmitted, shouldShowYearApproved, shouldShowYearPosted, shouldShowYearExported, shouldShowYearPaid, shouldShowYearWithdrawn} =
yearIndicators;
const {shouldShowAmountInWideColumn, shouldShowTaxAmountInWideColumn} = amountIndicators;
const shouldShowTableHeader = isLargeScreenWidth && !isChat;
const tableHeaderVisible = canSelectMultiple || shouldShowTableHeader;
Expand Down Expand Up @@ -1534,6 +1538,7 @@ function Search({
shouldShowYearApproved={shouldShowYearApproved}
shouldShowYearPosted={shouldShowYearPosted}
shouldShowYearExported={shouldShowYearExported}
shouldShowYearPaid={shouldShowYearPaid}
shouldShowYearWithdrawn={shouldShowYearWithdrawn}
isAmountColumnWide={shouldShowAmountInWideColumn}
isTaxAmountColumnWide={shouldShowTaxAmountInWideColumn}
Expand Down
17 changes: 17 additions & 0 deletions src/components/TransactionItemRow/TransactionItemRowWide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function TransactionItemRowWide({
isDateColumnCreated = false,
submittedColumnSize,
approvedColumnSize,
paidColumnSize,
postedColumnSize,
exportedColumnSize,
amountColumnSize,
Expand Down Expand Up @@ -166,6 +167,8 @@ function TransactionItemRowWide({
const isDateColumnWide = dateColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
const isSubmittedColumnWide = submittedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
const isApprovedColumnWide = approvedColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
const isPaidColumnWide = paidColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
const {paid: paidDate = ''} = transactionItem;
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;
Expand Down Expand Up @@ -309,6 +312,20 @@ function TransactionItemRowWide({
/>
</View>
);
case CONST.SEARCH.TABLE_COLUMNS.PAID:
return (
<View
key={column}
style={[getSearchColumnStyles(CONST.SEARCH.TABLE_COLUMNS.PAID, {isPaidColumnWide})]}
>
<DateCell
date={paidDate}
showTooltip={shouldShowTooltip}
isLargeScreenWidth
shouldUseLocalTimeZone
/>
</View>
);
case CONST.SEARCH.TABLE_COLUMNS.POSTED:
return (
<View
Expand Down
2 changes: 2 additions & 0 deletions src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function TransactionItemRow({
isDateColumnCreated,
submittedColumnSize,
approvedColumnSize,
paidColumnSize,
postedColumnSize,
exportedColumnSize,
amountColumnSize,
Expand Down Expand Up @@ -202,6 +203,7 @@ function TransactionItemRow({
isDateColumnCreated,
submittedColumnSize,
approvedColumnSize,
paidColumnSize,
postedColumnSize,
exportedColumnSize,
amountColumnSize,
Expand Down
4 changes: 4 additions & 0 deletions src/components/TransactionItemRow/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type TransactionWithOptionalSearchFields = TransactionWithOptionalHighlight & {
/** The date the report was approved, derived from the report and its live actions on the Search page */
approved?: string;

/** The date the report was paid, derived from the report and its live actions on the Search page */
paid?: string;

/** The date the report was exported */
exported?: string;

Expand Down Expand Up @@ -76,6 +79,7 @@ type TransactionItemRowProps = {
isDateColumnCreated?: boolean;
submittedColumnSize?: TableColumnSize;
approvedColumnSize?: TableColumnSize;
paidColumnSize?: TableColumnSize;
postedColumnSize?: TableColumnSize;
exportedColumnSize?: TableColumnSize;
amountColumnSize: TableColumnSize;
Expand Down
2 changes: 2 additions & 0 deletions src/libs/DebugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ function validateReportDraftProperty(key: keyof Report | keyof ReportNameValuePa
case 'created':
case 'submitted':
case 'approved':
case 'paid':
case 'lastMessageText':
case 'lastVisibleActionCreated':
case 'lastReadTime':
Expand Down Expand Up @@ -687,6 +688,7 @@ function validateReportDraftProperty(key: keyof Report | keyof ReportNameValuePa
hasReportBeenReopened: CONST.RED_BRICK_ROAD_PENDING_ACTION,
submitted: CONST.RED_BRICK_ROAD_PENDING_ACTION,
approved: CONST.RED_BRICK_ROAD_PENDING_ACTION,
paid: CONST.RED_BRICK_ROAD_PENDING_ACTION,
isExportedToIntegration: CONST.RED_BRICK_ROAD_PENDING_ACTION,
hasExportError: CONST.RED_BRICK_ROAD_PENDING_ACTION,
export: CONST.RED_BRICK_ROAD_PENDING_ACTION,
Expand Down
Loading
Loading