@@ -54,6 +54,7 @@ import type {
5454 SearchTask ,
5555 SearchTransaction ,
5656 SearchTransactionAction ,
57+ SearchWithdrawalIDGroup ,
5758} from '@src/types/onyx/SearchResults' ;
5859import type IconAsset from '@src/types/utils/IconAsset' ;
5960import { canApproveIOU , canIOUBePaid , canSubmitReport } from './actions/IOU' ;
@@ -1392,8 +1393,21 @@ function getCardSections(data: OnyxTypes.SearchResults['data']): TransactionCard
13921393 * Do not use directly, use only via `getSections()` facade.
13931394 */
13941395function getWithdrawalIDSections ( data : OnyxTypes . SearchResults [ 'data' ] ) : TransactionWithdrawalIDGroupListItemType [ ] {
1395- // Will be implemented as part of https://github.com/Expensify/App/pull/66078
1396- return data ? [ ] : [ ] ;
1396+ const withdrawalIDSections : Record < string , TransactionWithdrawalIDGroupListItemType > = { } ;
1397+
1398+ for ( const key in data ) {
1399+ if ( isGroupEntry ( key ) ) {
1400+ const withdrawalIDGroup = data [ key ] as SearchWithdrawalIDGroup ;
1401+
1402+ withdrawalIDSections [ key ] = {
1403+ groupedBy : CONST . SEARCH . GROUP_BY . WITHDRAWAL_ID ,
1404+ transactions : [ ] ,
1405+ ...withdrawalIDGroup ,
1406+ } ;
1407+ }
1408+ }
1409+
1410+ return Object . values ( withdrawalIDSections ) ;
13971411}
13981412
13991413/**
@@ -1481,7 +1495,7 @@ function getSortedSections(
14811495 case CONST . SEARCH . GROUP_BY . CARD :
14821496 return getSortedCardData ( data as TransactionCardGroupListItemType [ ] , localeCompare ) ;
14831497 case CONST . SEARCH . GROUP_BY . WITHDRAWAL_ID :
1484- return getSortedWithdrawalIDData ( data as TransactionWithdrawalIDGroupListItemType [ ] ) ;
1498+ return getSortedWithdrawalIDData ( data as TransactionWithdrawalIDGroupListItemType [ ] , localeCompare ) ;
14851499 }
14861500 }
14871501
@@ -1576,27 +1590,26 @@ function getSortedReportData(data: TransactionReportGroupListItemType[], localeC
15761590
15771591/**
15781592 * @private
1579- * Sorts report sections based on a specified column and sort order.
1593+ * Sorts member sections based on a specified column and sort order.
15801594 */
15811595function getSortedMemberData ( data : TransactionMemberGroupListItemType [ ] , localeCompare : LocaleContextProps [ 'localeCompare' ] ) {
15821596 return data . sort ( ( a , b ) => localeCompare ( a . displayName ?? a . login ?? '' , b . displayName ?? b . login ?? '' ) ) ;
15831597}
15841598
15851599/**
15861600 * @private
1587- * Sorts report sections based on a specified column and sort order.
1601+ * Sorts card sections based on a specified column and sort order.
15881602 */
15891603function getSortedCardData ( data : TransactionCardGroupListItemType [ ] , localeCompare : LocaleContextProps [ 'localeCompare' ] ) {
15901604 return data . sort ( ( a , b ) => localeCompare ( a . displayName ?? a . login ?? '' , b . displayName ?? b . login ?? '' ) ) ;
15911605}
15921606
15931607/**
15941608 * @private
1595- * Sorts report sections based on a specified column and sort order.
1609+ * Sorts withdrawal ID sections based on a specified column and sort order.
15961610 */
1597- function getSortedWithdrawalIDData ( data : TransactionWithdrawalIDGroupListItemType [ ] ) {
1598- // Will be implemented as part of https://github.com/Expensify/App/pull/66078
1599- return data ? [ ] : [ ] ;
1611+ function getSortedWithdrawalIDData ( data : TransactionWithdrawalIDGroupListItemType [ ] , localeCompare : LocaleContextProps [ 'localeCompare' ] ) {
1612+ return data . sort ( ( a , b ) => localeCompare ( b . debitPosted , a . debitPosted ) ) ;
16001613}
16011614
16021615/**
0 commit comments