@@ -100,9 +100,6 @@ const defaultProps = {
100
100
class RequestCallPage extends Component {
101
101
constructor ( props ) {
102
102
super ( props ) ;
103
- this . name = PersonalDetails . extractFirstAndLastNameFromAvailableDetails ( props . currentUserPersonalDetails ) ;
104
- this . isWeekend = moment ( ) . day ( ) === 0 || moment ( ) . day ( ) === 6 ;
105
- this . isBlockedFromConcierge = User . isBlockedFromConcierge ( props . blockedFromConcierge ) ;
106
103
107
104
this . onSubmit = this . onSubmit . bind ( this ) ;
108
105
this . getPhoneNumber = this . getPhoneNumber . bind ( this ) ;
@@ -131,7 +128,7 @@ class RequestCallPage extends Component {
131
128
* @param {Object } values - form input values passed by the Form component
132
129
*/
133
130
onSubmit ( values ) {
134
- if ( this . isBlockedFromConcierge ) {
131
+ if ( User . isBlockedFromConcierge ( this . props . blockedFromConcierge ) ) {
135
132
return ;
136
133
}
137
134
@@ -190,15 +187,19 @@ class RequestCallPage extends Component {
190
187
191
188
getWaitTimeMessage ( ) {
192
189
let waitTimeKey = 'requestCallPage.waitTime.weekend' ;
193
- if ( ! this . isWeekend ) {
190
+ if ( ! this . isWeekend ( ) ) {
194
191
waitTimeKey = this . getWaitTimeMessageKey ( this . props . inboxCallUserWaitTime ) ;
195
192
}
196
193
return `${ this . props . translate ( waitTimeKey , { minutes : this . props . inboxCallUserWaitTime } ) } ${ this . props . translate ( 'requestCallPage.waitTime.guides' ) } ` ;
197
194
}
198
195
196
+ isWeekend ( ) {
197
+ return moment ( ) . day ( ) === 0 || moment ( ) . day ( ) === 6 ;
198
+ }
199
+
199
200
fetchData ( ) {
200
201
// If it is the weekend don't check the wait time
201
- if ( this . isWeekend ) {
202
+ if ( this . isWeekend ( ) ) {
202
203
return ;
203
204
}
204
205
@@ -243,6 +244,8 @@ class RequestCallPage extends Component {
243
244
}
244
245
245
246
render ( ) {
247
+ const { firstName, lastName} = PersonalDetails . extractFirstAndLastNameFromAvailableDetails ( this . props . currentUserPersonalDetails ) ;
248
+
246
249
return (
247
250
< ScreenWrapper >
248
251
< HeaderWithCloseButton
@@ -275,7 +278,7 @@ class RequestCallPage extends Component {
275
278
< View style = { styles . flex1 } >
276
279
< TextInput
277
280
inputID = "firstName"
278
- defaultValue = { this . name . firstName }
281
+ defaultValue = { firstName }
279
282
label = { this . props . translate ( 'common.firstName' ) }
280
283
name = "fname"
281
284
placeholder = { this . props . translate ( 'profilePage.john' ) }
@@ -284,7 +287,7 @@ class RequestCallPage extends Component {
284
287
< View style = { [ styles . flex1 , styles . ml2 ] } >
285
288
< TextInput
286
289
inputID = "lastName"
287
- defaultValue = { this . name . lastName }
290
+ defaultValue = { lastName }
288
291
label = { this . props . translate ( 'common.lastName' ) }
289
292
name = "lname"
290
293
placeholder = { this . props . translate ( 'profilePage.doe' ) }
@@ -309,7 +312,7 @@ class RequestCallPage extends Component {
309
312
placeholder = "100"
310
313
containerStyles = { [ styles . mt4 ] }
311
314
/>
312
- { this . isBlockedFromConcierge ? (
315
+ { User . isBlockedFromConcierge ( this . props . blockedFromConcierge ) ? (
313
316
< View style = { [ styles . flexRow , styles . alignItemsCenter , styles . mt4 ] } >
314
317
< Icon src = { Expensicons . Exclamation } fill = { colors . yellow } />
315
318
< Text style = { [ styles . mutedTextLabel , styles . ml2 , styles . flex1 ] } > { this . props . translate ( 'requestCallPage.blockedFromConcierge' ) } </ Text >
0 commit comments