@@ -16,11 +16,8 @@ import { formatDate } from '@angular/common';
1616import { getTimeEntriesDataSource } from '../../store/entry.selectors' ;
1717import { DATE_FORMAT } from 'src/environments/environment' ;
1818import { Subscription } from 'rxjs' ;
19-
20-
21- const INTERNAL_APP_STRING = 'ioet' ;
22- const PROJECT_NAME_TO_SKIP = [ 'English Lessons' , 'Safari Books' ] ;
23- const EMPTY_FIELDS_ERROR_MESSAGE = 'Make sure to add a description and/or ticket number when working on an internal app.' ;
19+ import { EMPTY_FIELDS_ERROR_MESSAGE } from 'src/app/modules/shared/messages' ;
20+ import { INTERNAL_APP_STRING , PROJECT_NAME_TO_SKIP } from 'src/app/modules/shared/internal-app-constants' ;
2421
2522type Merged = TechnologyState & ProjectState & ActivityState ;
2623
@@ -144,7 +141,6 @@ export class EntryFieldsComponent implements OnInit, OnDestroy {
144141 const dataToUse = ds . data . find ( ( item ) => item . project_id === this . activeEntry . project_id ) ;
145142 customerName = dataToUse . customer_name ;
146143 projectName = dataToUse . project_name ;
147-
148144 } ) ;
149145 return this . requiredFieldsForInternalAppExist ( customerName , projectName ) && this . entryForm . valid ;
150146 }
@@ -209,10 +205,14 @@ export class EntryFieldsComponent implements OnInit, OnDestroy {
209205
210206 requiredFieldsForInternalAppExist ( customerName , projectName ) {
211207 const emptyValue = '' ;
212- const areEmptyValues = [ this . entryForm . value . uri , this . entryForm . value . description ] . every ( item => item === emptyValue ) ;
213-
214- const isInternalApp = customerName . includes ( 'ioet' ) ;
215- const canSkipDescriptionAndURI = PROJECT_NAME_TO_SKIP . some ( projectNameItem => projectName . includes ( projectNameItem ) ) ;
208+ const areEmptyValues = [ this . entryForm . value . uri , this . entryForm . value . description ] . every (
209+ ( item ) => item === emptyValue
210+ ) ;
211+
212+ const isInternalApp = customerName . includes ( INTERNAL_APP_STRING ) ;
213+ const canSkipDescriptionAndURI = PROJECT_NAME_TO_SKIP . some ( ( projectNameItem ) =>
214+ projectName . includes ( projectNameItem )
215+ ) ;
216216
217217 if ( isInternalApp && areEmptyValues && ! canSkipDescriptionAndURI ) {
218218 this . toastrService . error ( EMPTY_FIELDS_ERROR_MESSAGE ) ;
0 commit comments