diff --git a/src/components/SelectionList/Search/ReportListItem.tsx b/src/components/SelectionList/Search/ReportListItem.tsx index 553839ae8457..7119cee06cd9 100644 --- a/src/components/SelectionList/Search/ReportListItem.tsx +++ b/src/components/SelectionList/Search/ReportListItem.tsx @@ -88,8 +88,8 @@ function ReportListItem({ return null; } - const participantFrom = reportItem.transactions[0].from; - const participantTo = reportItem.transactions[0].to; + const participantFrom = reportItem.from; + const participantTo = reportItem.to; // These values should come as part of the item via SearchUtils.getSections() but ReportListItem is not yet 100% handled // This will be simplified in future once sorting of ReportListItem is done diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index b26ff9c4eb57..819e01f62c3e 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -179,6 +179,12 @@ type TransactionListItemType = ListItem & type ReportListItemType = ListItem & SearchReport & { + /** The personal details of the user requesting money */ + from: SearchAccountDetails; + + /** The personal details of the user paying the request */ + to: SearchAccountDetails; + transactions: TransactionListItemType[]; }; diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 5a7f514a7196..e290a55c737b 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -166,6 +166,8 @@ function getReportSections(data: OnyxTypes.SearchResults['data'], metadata: Onyx reportIDToTransactions[reportKey] = { ...value, + from: data.personalDetailsList?.[value.accountID], + to: data.personalDetailsList?.[value.managerID], transactions, }; } else if (key.startsWith(ONYXKEYS.COLLECTION.TRANSACTION)) { @@ -199,7 +201,7 @@ function getReportSections(data: OnyxTypes.SearchResults['data'], metadata: Onyx if (reportIDToTransactions[reportKey]?.transactions) { reportIDToTransactions[reportKey].transactions.push(transaction); } else { - reportIDToTransactions[reportKey] = {transactions: [transaction]}; + reportIDToTransactions[reportKey].transactions = [transaction]; } } } diff --git a/src/types/onyx/SearchResults.ts b/src/types/onyx/SearchResults.ts index 62c5a1d3eb6e..e2bc89075af0 100644 --- a/src/types/onyx/SearchResults.ts +++ b/src/types/onyx/SearchResults.ts @@ -112,6 +112,12 @@ type SearchReport = { /** The action that can be performed for the report */ action?: string; + + /** The net report sender ID */ + accountID?: number; + + /** The net report recipient ID */ + managerID?: number; }; /** Model of transaction search result */