@@ -25,11 +25,11 @@ import {clearPolicyTitleFieldError, setPolicyDefaultReportTitle} from '@userActi
2525import CONST from '@src/CONST' ;
2626import ONYXKEYS from '@src/ONYXKEYS' ;
2727import type SCREENS from '@src/SCREENS' ;
28- import INPUT_IDS from '@src/types/form/RulesCustomNameModalForm ' ;
28+ import INPUT_IDS from '@src/types/form/ReportsDefaultTitleModalForm ' ;
2929
3030type RulesCustomNamePageProps = PlatformStackScreenProps < SettingsNavigatorParamList , typeof SCREENS . WORKSPACE . REPORTS_DEFAULT_TITLE > ;
3131
32- function RulesCustomNamePage ( { route} : RulesCustomNamePageProps ) {
32+ function ReportsDefaultTitlePage ( { route} : RulesCustomNamePageProps ) {
3333 const policyID = route . params . policyID ;
3434 const policy = usePolicy ( policyID ) ;
3535
@@ -48,13 +48,13 @@ function RulesCustomNamePage({route}: RulesCustomNamePageProps) {
4848 const customNameDefaultValue = Str . htmlDecode ( fieldListItem ?. defaultValue ?? '' ) ;
4949
5050 const validateCustomName = useCallback (
51- ( { customName } : FormOnyxValues < typeof ONYXKEYS . FORMS . RULES_CUSTOM_NAME_MODAL_FORM > ) => {
52- const errors : FormInputErrors < typeof ONYXKEYS . FORMS . RULES_CUSTOM_NAME_MODAL_FORM > = { } ;
53- if ( ! customName ) {
54- errors [ INPUT_IDS . CUSTOM_NAME ] = translate ( 'common.error.fieldRequired' ) ;
55- } else if ( customName . length > CONST . WORKSPACE_NAME_CHARACTER_LIMIT ) {
56- errors [ INPUT_IDS . CUSTOM_NAME ] = translate ( 'common.error.characterLimitExceedCounter' , {
57- length : customName . length ,
51+ ( { defaultTitle } : FormOnyxValues < typeof ONYXKEYS . FORMS . REPORTS_DEFAULT_TITLE_MODAL_FORM > ) => {
52+ const errors : FormInputErrors < typeof ONYXKEYS . FORMS . REPORTS_DEFAULT_TITLE_MODAL_FORM > = { } ;
53+ if ( ! defaultTitle ) {
54+ errors [ INPUT_IDS . DEFAULT_TITLE ] = translate ( 'common.error.fieldRequired' ) ;
55+ } else if ( defaultTitle . length > CONST . WORKSPACE_NAME_CHARACTER_LIMIT ) {
56+ errors [ INPUT_IDS . DEFAULT_TITLE ] = translate ( 'common.error.characterLimitExceedCounter' , {
57+ length : defaultTitle . length ,
5858 limit : CONST . WORKSPACE_NAME_CHARACTER_LIMIT ,
5959 } ) ;
6060 }
@@ -75,8 +75,8 @@ function RulesCustomNamePage({route}: RulesCustomNamePageProps) {
7575 clearTitleFieldError ( ) ;
7676 } ) ;
7777
78- const submitForm = ( values : FormOnyxValues < typeof ONYXKEYS . FORMS . RULES_CUSTOM_NAME_MODAL_FORM > ) => {
79- setPolicyDefaultReportTitle ( policyID , values . customName ) ;
78+ const submitForm = ( values : FormOnyxValues < typeof ONYXKEYS . FORMS . REPORTS_DEFAULT_TITLE_MODAL_FORM > ) => {
79+ setPolicyDefaultReportTitle ( policyID , values . defaultTitle ) ;
8080 Navigation . goBack ( ) ;
8181 } ;
8282
@@ -91,7 +91,7 @@ function RulesCustomNamePage({route}: RulesCustomNamePageProps) {
9191 < ScreenWrapper
9292 enableEdgeToEdgeBottomSafeAreaPadding
9393 shouldEnableMaxHeight
94- testID = { RulesCustomNamePage . displayName }
94+ testID = { ReportsDefaultTitlePage . displayName }
9595 >
9696 < HeaderWithBackButton
9797 title = { translate ( 'workspace.rules.expenseReportRules.customNameTitle' ) }
@@ -111,7 +111,7 @@ function RulesCustomNamePage({route}: RulesCustomNamePageProps) {
111111 </ View >
112112 < FormProvider
113113 style = { [ styles . flexGrow1 , styles . mh5 ] }
114- formID = { ONYXKEYS . FORMS . RULES_CUSTOM_NAME_MODAL_FORM }
114+ formID = { ONYXKEYS . FORMS . REPORTS_DEFAULT_TITLE_MODAL_FORM }
115115 validate = { validateCustomName }
116116 onSubmit = { submitForm }
117117 submitButtonText = { translate ( 'common.save' ) }
@@ -128,7 +128,7 @@ function RulesCustomNamePage({route}: RulesCustomNamePageProps) {
128128 >
129129 < InputWrapper
130130 InputComponent = { TextInput }
131- inputID = { INPUT_IDS . CUSTOM_NAME }
131+ inputID = { INPUT_IDS . DEFAULT_TITLE }
132132 defaultValue = { customNameDefaultValue }
133133 label = { translate ( 'workspace.rules.expenseReportRules.customNameInputLabel' ) }
134134 aria-label = { translate ( 'workspace.rules.expenseReportRules.customNameInputLabel' ) }
@@ -145,6 +145,6 @@ function RulesCustomNamePage({route}: RulesCustomNamePageProps) {
145145 ) ;
146146}
147147
148- RulesCustomNamePage . displayName = 'RulesCustomNamePage ' ;
148+ ReportsDefaultTitlePage . displayName = 'ReportsDefaultTitlePage ' ;
149149
150- export default RulesCustomNamePage ;
150+ export default ReportsDefaultTitlePage ;
0 commit comments