diff --git a/src/components/SelectionList/Search/TransactionListItemRow.tsx b/src/components/SelectionList/Search/TransactionListItemRow.tsx index 23f9234819c3..ec112e43fb3c 100644 --- a/src/components/SelectionList/Search/TransactionListItemRow.tsx +++ b/src/components/SelectionList/Search/TransactionListItemRow.tsx @@ -155,7 +155,7 @@ function TotalCell({showTooltip, isLargeScreenWidth, transactionItem}: TotalCell function TypeCell({transactionItem, isLargeScreenWidth}: TransactionCellProps) { const theme = useTheme(); - const typeIcon = getTypeIcon(transactionItem.type); + const typeIcon = getTypeIcon(transactionItem.transactionType); return ( = {}; for (const key in data) { if (key.startsWith(ONYXKEYS.COLLECTION.REPORT)) { - const value = {...data[key]}; - const reportKey = `${ONYXKEYS.COLLECTION.REPORT}${value.reportID}`; + const reportItem = {...data[key]}; + const reportKey = `${ONYXKEYS.COLLECTION.REPORT}${reportItem.reportID}`; const transactions = reportIDToTransactions[reportKey]?.transactions ?? []; + const isExpenseReport = reportItem.type === CONST.REPORT.TYPE.EXPENSE; + + const to = isExpenseReport + ? (data[`${ONYXKEYS.COLLECTION.POLICY}${reportItem.policyID}`] as SearchAccountDetails) + : (data.personalDetailsList?.[reportItem.managerID] as SearchAccountDetails); reportIDToTransactions[reportKey] = { - ...value, - keyForList: value.reportID, - from: data.personalDetailsList?.[value.accountID], - to: data.personalDetailsList?.[value.managerID], + ...reportItem, + keyForList: reportItem.reportID, + from: data.personalDetailsList?.[reportItem.accountID], + to, transactions, }; } else if (key.startsWith(ONYXKEYS.COLLECTION.TRANSACTION)) { diff --git a/src/types/onyx/SearchResults.ts b/src/types/onyx/SearchResults.ts index 89d1b6c72566..05c38115be0f 100644 --- a/src/types/onyx/SearchResults.ts +++ b/src/types/onyx/SearchResults.ts @@ -108,7 +108,7 @@ type SearchReport = { currency?: string; /** The report type */ - type?: string; + type?: ValueOf; /** The accountID of the report manager */ managerID?: number; @@ -116,6 +116,9 @@ type SearchReport = { /** The accountID of the user who created the report */ accountID?: number; + /** The policyID of the report */ + policyID?: string; + /** The date the report was created */ created?: string; @@ -177,7 +180,7 @@ type SearchTransaction = { category: string; /** The type of request */ - type: ValueOf; + transactionType: ValueOf; /** The type of report the transaction is associated with */ reportType: string;