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