@@ -12,11 +12,11 @@ import useLocalize from '@hooks/useLocalize';
1212import useOnyx from '@hooks/useOnyx' ;
1313import usePrevious from '@hooks/usePrevious' ;
1414import useThemeStyles from '@hooks/useThemeStyles' ;
15- import * as ReportField from '@libs/actions/Policy/ReportField' ;
15+ import { deleteReportFieldsListValue , removeReportFieldListValue , setReportFieldsListValueEnabled , updateReportFieldListValueEnabled } from '@libs/actions/Policy/ReportField' ;
1616import Navigation from '@libs/Navigation/Navigation' ;
1717import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
18- import * as PolicyUtils from '@libs/PolicyUtils' ;
19- import * as ReportUtils from '@libs/ReportUtils' ;
18+ import { hasAccountingConnections as hasAccountingConnectionsUtil } from '@libs/PolicyUtils' ;
19+ import { getReportFieldKey } from '@libs/ReportUtils' ;
2020import type { SettingsNavigatorParamList } from '@navigation/types' ;
2121import NotFoundPage from '@pages/ErrorPage/NotFoundPage' ;
2222import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper' ;
@@ -37,7 +37,7 @@ function ReportFieldsValueSettingsPage({
3737} : ReportFieldsValueSettingsPageProps ) {
3838 const styles = useThemeStyles ( ) ;
3939 const { translate} = useLocalize ( ) ;
40- const [ formDraft ] = useOnyx ( ONYXKEYS . FORMS . WORKSPACE_REPORT_FIELDS_FORM_DRAFT ) ;
40+ const [ formDraft ] = useOnyx ( ONYXKEYS . FORMS . WORKSPACE_REPORT_FIELDS_FORM_DRAFT , { canBeMissing : true } ) ;
4141
4242 const [ isDeleteTagModalOpen , setIsDeleteTagModalOpen ] = useState ( false ) ;
4343
@@ -46,7 +46,7 @@ function ReportFieldsValueSettingsPage({
4646 let reportFieldDisabledValue : boolean ;
4747
4848 if ( reportFieldID ) {
49- const reportFieldKey = ReportUtils . getReportFieldKey ( reportFieldID ) ;
49+ const reportFieldKey = getReportFieldKey ( reportFieldID ) ;
5050
5151 reportFieldValue = Object . values ( policy ?. fieldList ?. [ reportFieldKey ] ?. values ?? { } ) ?. at ( valueIndex ) ?? '' ;
5252 reportFieldDisabledValue = Object . values ( policy ?. fieldList ?. [ reportFieldKey ] ?. disabledOptions ?? { } ) ?. at ( valueIndex ) ?? false ;
@@ -58,29 +58,29 @@ function ReportFieldsValueSettingsPage({
5858 return [ reportFieldValue , reportFieldDisabledValue ] ;
5959 } , [ formDraft ?. disabledListValues , formDraft ?. listValues , policy ?. fieldList , reportFieldID , valueIndex ] ) ;
6060
61- const hasAccountingConnections = PolicyUtils . hasAccountingConnections ( policy ) ;
61+ const hasAccountingConnections = hasAccountingConnectionsUtil ( policy ) ;
6262 const oldValueName = usePrevious ( currentValueName ) ;
6363
6464 if ( ( ! currentValueName && ! oldValueName ) || hasAccountingConnections ) {
6565 return < NotFoundPage /> ;
6666 }
6767 const deleteListValueAndHideModal = ( ) => {
6868 if ( reportFieldID ) {
69- ReportField . removeReportFieldListValue ( policyID , reportFieldID , [ valueIndex ] ) ;
69+ removeReportFieldListValue ( policyID , reportFieldID , [ valueIndex ] ) ;
7070 } else {
71- ReportField . deleteReportFieldsListValue ( [ valueIndex ] ) ;
71+ deleteReportFieldsListValue ( [ valueIndex ] ) ;
7272 }
7373 setIsDeleteTagModalOpen ( false ) ;
7474 Navigation . goBack ( ) ;
7575 } ;
7676
7777 const updateListValueEnabled = ( value : boolean ) => {
7878 if ( reportFieldID ) {
79- ReportField . updateReportFieldListValueEnabled ( policyID , reportFieldID , [ Number ( valueIndex ) ] , value ) ;
79+ updateReportFieldListValueEnabled ( policyID , reportFieldID , [ Number ( valueIndex ) ] , value ) ;
8080 return ;
8181 }
8282
83- ReportField . setReportFieldsListValueEnabled ( [ valueIndex ] , value ) ;
83+ setReportFieldsListValueEnabled ( [ valueIndex ] , value ) ;
8484 } ;
8585
8686 const navigateToEditValue = ( ) => {
0 commit comments