@@ -123,45 +123,57 @@ const taskColumnNamesToSortingProperty = {
123123 [ CONST . SEARCH . TABLE_COLUMNS . IN ] : 'parentReportID' as const ,
124124} ;
125125
126- const expenseStatusOptions : Array < MultiSelectItem < SingularSearchStatus > > = [
127- { text : translateLocal ( 'common.unreported' ) , value : CONST . SEARCH . STATUS . EXPENSE . UNREPORTED } ,
128- { text : translateLocal ( 'common.drafts' ) , value : CONST . SEARCH . STATUS . EXPENSE . DRAFTS } ,
129- { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . EXPENSE . OUTSTANDING } ,
130- { text : translateLocal ( 'iou.approved' ) , value : CONST . SEARCH . STATUS . EXPENSE . APPROVED } ,
131- { text : translateLocal ( 'iou.settledExpensify' ) , value : CONST . SEARCH . STATUS . EXPENSE . PAID } ,
132- { text : translateLocal ( 'iou.done' ) , value : CONST . SEARCH . STATUS . EXPENSE . DONE } ,
133- ] ;
134-
135- const expenseReportedStatusOptions : Array < MultiSelectItem < SingularSearchStatus > > = [
136- { text : translateLocal ( 'common.drafts' ) , value : CONST . SEARCH . STATUS . EXPENSE . DRAFTS } ,
137- { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . EXPENSE . OUTSTANDING } ,
138- { text : translateLocal ( 'iou.approved' ) , value : CONST . SEARCH . STATUS . EXPENSE . APPROVED } ,
139- { text : translateLocal ( 'iou.settledExpensify' ) , value : CONST . SEARCH . STATUS . EXPENSE . PAID } ,
140- { text : translateLocal ( 'iou.done' ) , value : CONST . SEARCH . STATUS . EXPENSE . DONE } ,
141- ] ;
142-
143- const chatStatusOptions : Array < MultiSelectItem < SingularSearchStatus > > = [
144- { text : translateLocal ( 'common.unread' ) , value : CONST . SEARCH . STATUS . CHAT . UNREAD } ,
145- { text : translateLocal ( 'common.sent' ) , value : CONST . SEARCH . STATUS . CHAT . SENT } ,
146- { text : translateLocal ( 'common.attachments' ) , value : CONST . SEARCH . STATUS . CHAT . ATTACHMENTS } ,
147- { text : translateLocal ( 'common.links' ) , value : CONST . SEARCH . STATUS . CHAT . LINKS } ,
148- { text : translateLocal ( 'search.filters.pinned' ) , value : CONST . SEARCH . STATUS . CHAT . PINNED } ,
149- ] ;
150-
151- const invoiceStatusOptions : Array < MultiSelectItem < SingularSearchStatus > > = [
152- { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . INVOICE . OUTSTANDING } ,
153- { text : translateLocal ( 'iou.settledExpensify' ) , value : CONST . SEARCH . STATUS . INVOICE . PAID } ,
154- ] ;
155-
156- const tripStatusOptions : Array < MultiSelectItem < SingularSearchStatus > > = [
157- { text : translateLocal ( 'search.filters.current' ) , value : CONST . SEARCH . STATUS . TRIP . CURRENT } ,
158- { text : translateLocal ( 'search.filters.past' ) , value : CONST . SEARCH . STATUS . TRIP . PAST } ,
159- ] ;
160-
161- const taskStatusOptions : Array < MultiSelectItem < SingularSearchStatus > > = [
162- { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . TASK . OUTSTANDING } ,
163- { text : translateLocal ( 'search.filters.completed' ) , value : CONST . SEARCH . STATUS . TASK . COMPLETED } ,
164- ] ;
126+ function getExpenseStatusOptions ( ) : Array < MultiSelectItem < SingularSearchStatus > > {
127+ return [
128+ { text : translateLocal ( 'common.unreported' ) , value : CONST . SEARCH . STATUS . EXPENSE . UNREPORTED } ,
129+ { text : translateLocal ( 'common.drafts' ) , value : CONST . SEARCH . STATUS . EXPENSE . DRAFTS } ,
130+ { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . EXPENSE . OUTSTANDING } ,
131+ { text : translateLocal ( 'iou.approved' ) , value : CONST . SEARCH . STATUS . EXPENSE . APPROVED } ,
132+ { text : translateLocal ( 'iou.settledExpensify' ) , value : CONST . SEARCH . STATUS . EXPENSE . PAID } ,
133+ { text : translateLocal ( 'iou.done' ) , value : CONST . SEARCH . STATUS . EXPENSE . DONE } ,
134+ ] ;
135+ } ;
136+
137+ function getExpenseReportedStatusOptions ( ) : Array < MultiSelectItem < SingularSearchStatus > > {
138+ return [
139+ { text : translateLocal ( 'common.drafts' ) , value : CONST . SEARCH . STATUS . EXPENSE . DRAFTS } ,
140+ { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . EXPENSE . OUTSTANDING } ,
141+ { text : translateLocal ( 'iou.approved' ) , value : CONST . SEARCH . STATUS . EXPENSE . APPROVED } ,
142+ { text : translateLocal ( 'iou.settledExpensify' ) , value : CONST . SEARCH . STATUS . EXPENSE . PAID } ,
143+ { text : translateLocal ( 'iou.done' ) , value : CONST . SEARCH . STATUS . EXPENSE . DONE } ,
144+ ] ;
145+ }
146+
147+ function getChatStatusOptions ( ) : Array < MultiSelectItem < SingularSearchStatus > > {
148+ return [
149+ { text : translateLocal ( 'common.unread' ) , value : CONST . SEARCH . STATUS . CHAT . UNREAD } ,
150+ { text : translateLocal ( 'common.sent' ) , value : CONST . SEARCH . STATUS . CHAT . SENT } ,
151+ { text : translateLocal ( 'common.attachments' ) , value : CONST . SEARCH . STATUS . CHAT . ATTACHMENTS } ,
152+ { text : translateLocal ( 'common.links' ) , value : CONST . SEARCH . STATUS . CHAT . LINKS } ,
153+ { text : translateLocal ( 'search.filters.pinned' ) , value : CONST . SEARCH . STATUS . CHAT . PINNED } ,
154+ ] ;
155+ }
156+
157+ function getInvoiceStatusOptions ( ) : Array < MultiSelectItem < SingularSearchStatus > > {
158+ return [
159+ { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . INVOICE . OUTSTANDING } ,
160+ { text : translateLocal ( 'iou.settledExpensify' ) , value : CONST . SEARCH . STATUS . INVOICE . PAID } ,
161+ ] ;
162+ }
163+
164+ function getTripStatusOptions ( ) : Array < MultiSelectItem < SingularSearchStatus > > {
165+ return [
166+ { text : translateLocal ( 'search.filters.current' ) , value : CONST . SEARCH . STATUS . TRIP . CURRENT } ,
167+ { text : translateLocal ( 'search.filters.past' ) , value : CONST . SEARCH . STATUS . TRIP . PAST } ,
168+ ] ;
169+ }
170+
171+ function getTaskStatusOptions ( ) : Array < MultiSelectItem < SingularSearchStatus > > {
172+ return [
173+ { text : translateLocal ( 'common.outstanding' ) , value : CONST . SEARCH . STATUS . TASK . OUTSTANDING } ,
174+ { text : translateLocal ( 'search.filters.completed' ) , value : CONST . SEARCH . STATUS . TASK . COMPLETED } ,
175+ ] ;
176+ }
165177
166178let currentAccountID : number | undefined ;
167179Onyx . connect ( {
@@ -1819,16 +1831,16 @@ function isSearchDataLoaded(searchResults: SearchResults | undefined, queryJSON:
18191831function getStatusOptions ( type : SearchDataTypes , groupBy : SearchGroupBy | undefined ) {
18201832 switch ( type ) {
18211833 case CONST . SEARCH . DATA_TYPES . CHAT :
1822- return chatStatusOptions ;
1834+ return getChatStatusOptions ( ) ;
18231835 case CONST . SEARCH . DATA_TYPES . INVOICE :
1824- return invoiceStatusOptions ;
1836+ return getInvoiceStatusOptions ( ) ;
18251837 case CONST . SEARCH . DATA_TYPES . TRIP :
1826- return tripStatusOptions ;
1838+ return getTripStatusOptions ( ) ;
18271839 case CONST . SEARCH . DATA_TYPES . TASK :
1828- return taskStatusOptions ;
1840+ return getTaskStatusOptions ( ) ;
18291841 case CONST . SEARCH . DATA_TYPES . EXPENSE :
18301842 default :
1831- return groupBy === CONST . SEARCH . GROUP_BY . REPORTS || groupBy === CONST . SEARCH . GROUP_BY . MEMBERS ? expenseReportedStatusOptions : expenseStatusOptions ;
1843+ return groupBy === CONST . SEARCH . GROUP_BY . REPORTS || groupBy === CONST . SEARCH . GROUP_BY . MEMBERS ? getExpenseReportedStatusOptions ( ) : getExpenseStatusOptions ( ) ;
18321844 }
18331845}
18341846
0 commit comments