@@ -28,17 +28,17 @@ import useTheme from '@hooks/useTheme';
2828import useThemeStyles from '@hooks/useThemeStyles' ;
2929import useWindowDimensions from '@hooks/useWindowDimensions' ;
3030import { turnOffMobileSelectionMode } from '@libs/actions/MobileSelectionMode' ;
31- import * as CurrencyUtils from '@libs/CurrencyUtils' ;
32- import * as DeviceCapabilities from '@libs/DeviceCapabilities' ;
31+ import { deleteWorkspacePerDiemRates , downloadPerDiemCSV , openPolicyPerDiemPage } from '@libs/actions/Policy/PerDiem' ;
32+ import { convertAmountToDisplayString } from '@libs/CurrencyUtils' ;
33+ import { canUseTouchScreen } from '@libs/DeviceCapabilities' ;
3334import localeCompare from '@libs/LocaleCompare' ;
3435import Navigation from '@libs/Navigation/Navigation' ;
3536import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
3637import type { FullScreenNavigatorParamList } from '@libs/Navigation/types' ;
3738import { getPerDiemCustomUnit } from '@libs/PolicyUtils' ;
3839import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper' ;
39- import * as Link from '@userActions/Link' ;
40- import * as Modal from '@userActions/Modal' ;
41- import * as PerDiem from '@userActions/Policy/PerDiem' ;
40+ import { openExternalLink } from '@userActions/Link' ;
41+ import { close } from '@userActions/Modal' ;
4242import CONST from '@src/CONST' ;
4343import ROUTES from '@src/ROUTES' ;
4444import type SCREENS from '@src/SCREENS' ;
@@ -138,7 +138,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
138138 const canSelectMultiple = shouldUseNarrowLayout ? selectionMode ?. isEnabled : true ;
139139
140140 const fetchPerDiem = useCallback ( ( ) => {
141- PerDiem . openPolicyPerDiemPage ( policyID ) ;
141+ openPolicyPerDiemPage ( policyID ) ;
142142 } , [ policyID ] ) ;
143143
144144 const { isOffline} = useNetwork ( { onReconnect : fetchPerDiem } ) ;
@@ -170,19 +170,17 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
170170 pendingAction : value . pendingAction ,
171171 rightElement : (
172172 < >
173- < View style = { styles . flex1 } >
174- < Text style = { [ styles . alignItemsStart , styles . textSupporting , styles . label ] } > { value . subRateName } </ Text >
173+ < View style = { styles . flex2 } >
174+ < Text style = { [ styles . alignItemsStart , styles . textSupporting , styles . label , styles . pl2 ] } > { value . subRateName } </ Text >
175175 </ View >
176176 < View style = { styles . flex1 } >
177- < Text style = { [ styles . alignSelfEnd , styles . textSupporting , styles . pl2 , styles . label ] } >
178- { CurrencyUtils . convertAmountToDisplayString ( value . rate , value . currency ) }
179- </ Text >
177+ < Text style = { [ styles . alignSelfEnd , styles . textSupporting , styles . pl2 , styles . label ] } > { convertAmountToDisplayString ( value . rate , value . currency ) } </ Text >
180178 </ View >
181179 </ >
182180 ) ,
183181 } ;
184182 } ) ,
185- [ allSubRates , selectedPerDiem , canSelectMultiple , styles . flex1 , styles . alignItemsStart , styles . textSupporting , styles . label , styles . alignSelfEnd , styles . pl2 ] ,
183+ [ allSubRates , selectedPerDiem , canSelectMultiple , styles . flex2 , styles . alignItemsStart , styles . textSupporting , styles . label , styles . pl2 , styles . flex1 , styles . alignSelfEnd ] ,
186184 ) ;
187185
188186 const toggleSubRate = ( subRate : PolicyOption ) => {
@@ -207,11 +205,11 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
207205
208206 const getCustomListHeader = ( ) => (
209207 < View style = { [ styles . flex1 , styles . flexRow , styles . justifyContentBetween , canSelectMultiple && styles . pl3 , ! canSelectMultiple && [ styles . ph9 , styles . pv3 , styles . pb5 ] ] } >
210- < View style = { styles . flex1 } >
208+ < View style = { styles . flex3 } >
211209 < Text style = { [ styles . searchInputStyle , styles . alignSelfStart ] } > { translate ( 'common.destination' ) } </ Text >
212210 </ View >
213- < View style = { styles . flex1 } >
214- < Text style = { [ styles . searchInputStyle , styles . alignItemsStart ] } > { translate ( 'common.subrate' ) } </ Text >
211+ < View style = { styles . flex2 } >
212+ < Text style = { [ styles . searchInputStyle , styles . alignItemsStart , styles . pl2 ] } > { translate ( 'common.subrate' ) } </ Text >
215213 </ View >
216214 < View style = { styles . flex1 } >
217215 < Text style = { [ styles . searchInputStyle , styles . alignSelfEnd ] } > { translate ( 'workspace.perDiem.amount' ) } </ Text >
@@ -228,7 +226,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
228226 } ;
229227
230228 const handleDeletePerDiemRates = ( ) => {
231- PerDiem . deleteWorkspacePerDiemRates ( policyID , customUnit , selectedPerDiem ) ;
229+ deleteWorkspacePerDiemRates ( policyID , customUnit , selectedPerDiem ) ;
232230 setSelectedPerDiem ( [ ] ) ;
233231 setDeletePerDiemConfirmModalVisible ( false ) ;
234232 } ;
@@ -289,7 +287,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
289287 < Text style = { [ styles . textNormal , styles . colorMuted ] } > { translate ( 'workspace.perDiem.subtitle' ) } </ Text >
290288 < TextLink
291289 style = { [ styles . textNormal , styles . link ] }
292- onPress = { ( ) => Link . openExternalLink ( CONST . DEEP_DIVE_PER_DIEM ) }
290+ onPress = { ( ) => openExternalLink ( CONST . DEEP_DIVE_PER_DIEM ) }
293291 >
294292 { translate ( 'workspace.common.learnMore' ) }
295293 </ TextLink >
@@ -304,7 +302,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
304302 text : translate ( 'spreadsheet.importSpreadsheet' ) ,
305303 onSelected : ( ) => {
306304 if ( isOffline ) {
307- Modal . close ( ( ) => setIsOfflineModalVisible ( true ) ) ;
305+ close ( ( ) => setIsOfflineModalVisible ( true ) ) ;
308306 return ;
309307 }
310308 Navigation . navigate ( ROUTES . WORKSPACE_PER_DIEM_IMPORT . getRoute ( policyID ) ) ;
@@ -315,10 +313,10 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
315313 text : translate ( 'spreadsheet.downloadCSV' ) ,
316314 onSelected : ( ) => {
317315 if ( isOffline ) {
318- Modal . close ( ( ) => setIsOfflineModalVisible ( true ) ) ;
316+ close ( ( ) => setIsOfflineModalVisible ( true ) ) ;
319317 return ;
320318 }
321- PerDiem . downloadPerDiemCSV ( policyID , ( ) => {
319+ downloadPerDiemCSV ( policyID , ( ) => {
322320 setIsDownloadFailureModalVisible ( true ) ;
323321 } ) ;
324322 } ,
@@ -415,12 +413,13 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
415413 sections = { [ { data : subRatesList , isDisabled : false } ] }
416414 onCheckboxPress = { toggleSubRate }
417415 onSelectRow = { openSubRateDetails }
418- shouldPreventDefaultFocusOnSelectRow = { ! DeviceCapabilities . canUseTouchScreen ( ) }
416+ shouldPreventDefaultFocusOnSelectRow = { ! canUseTouchScreen ( ) }
419417 onSelectAll = { toggleAllSubRates }
420418 ListItem = { TableListItem }
421419 customListHeader = { getCustomListHeader ( ) }
422420 listHeaderWrapperStyle = { [ styles . ph9 , styles . pv3 , styles . pb5 ] }
423421 listHeaderContent = { shouldUseNarrowLayout ? getHeaderText ( ) : null }
422+ listItemTitleContainerStyles = { styles . flex3 }
424423 showScrollIndicator = { false }
425424 />
426425 ) }
0 commit comments