@@ -4,6 +4,7 @@ import { telephoneFormat, socialSecurityFormat } from '../../../../common/Format
4
4
import Formsy from 'formsy-react'
5
5
import { wireUpCustomFormsyValidators } from '../../../../common/CustomValidators'
6
6
import { FormsyInput } from '../../../../common/FormsyInput'
7
+ import { FormsySelect } from '../../../../common/FormsySelect'
7
8
import { FormsyDatePicker } from '../../../../common/FormsyDatePicker'
8
9
import { FormsyMaskedInput } from '../../../../common/FormsyMaskedInput'
9
10
@@ -28,7 +29,7 @@ class Basic extends React.Component {
28
29
console . debug ( 'Basic component in edit mode' )
29
30
this . setLocalStateToStoreValues ( )
30
31
this . setState ( { showForm : true } )
31
- this . setState ( { cachedForm : this . props . info } )
32
+ this . setState ( { cachedForm : this . props . basic } )
32
33
}
33
34
34
35
componentDidMount ( ) {
@@ -61,7 +62,7 @@ class Basic extends React.Component {
61
62
let value
62
63
switch ( event . target . name ) {
63
64
case 'phone' :
64
- case 'ss ' :
65
+ case 'ssn ' :
65
66
value = this . sanitizeToJustNumbers ( event . target . value . toString ( ) )
66
67
break
67
68
default :
@@ -79,22 +80,22 @@ class Basic extends React.Component {
79
80
}
80
81
81
82
setLocalStateToStoreValues ( ) {
82
- const keys = [ 'name' , 'dob' , 'ss ' , 'martialStatus' , 'gender' , 'address' , 'postal' , 'city' , 'state' ,
83
+ const keys = [ 'name' , 'dob' , 'ssn ' , 'martialStatus' , 'gender' , 'address' , 'postal' , 'city' , 'state' ,
83
84
'country' , 'phone' , 'email' , 'billingNote' , 'otherNote' ]
84
85
85
86
keys . forEach ( ( keyName ) => {
86
87
let value
87
88
88
89
switch ( keyName ) {
89
90
case 'dob' :
90
- value = moment ( this . props . info [ keyName ] )
91
+ value = moment ( this . props . basic [ keyName ] )
91
92
break
92
93
case 'phone' :
93
- case 'ss ' :
94
- value = this . sanitizeToJustNumbers ( this . props . info [ keyName ] . toString ( ) )
94
+ case 'ssn ' :
95
+ value = this . sanitizeToJustNumbers ( this . props . basic [ keyName ] . toString ( ) )
95
96
break
96
97
default :
97
- value = this . props . info [ keyName ]
98
+ value = this . props . basic [ keyName ]
98
99
}
99
100
100
101
this . setState ( {
@@ -104,46 +105,46 @@ class Basic extends React.Component {
104
105
}
105
106
106
107
render ( ) {
107
- if ( this . props . info && this . state . showForm === false ) {
108
+ if ( this . props . basic && this . state . showForm === false ) {
108
109
return (
109
110
< div >
110
111
< table className = 'table' >
111
112
< tbody >
112
113
< tr >
113
- < td > < strong > Name:</ strong > { this . props . info . name } </ td >
114
- < td > < strong > DOB:</ strong > { this . props . info . dob } </ td >
114
+ < td > < strong > Name:</ strong > { this . props . basic . name } </ td >
115
+ < td > < strong > DOB:</ strong > { this . props . basic . dob } </ td >
115
116
</ tr >
116
117
< tr >
117
- < td > < strong > S.S. :</ strong > { socialSecurityFormat ( this . props . info . ss ) } </ td >
118
- < td > < strong > Martial Status:</ strong > { this . props . info . martialStatus } </ td >
118
+ < td > < strong > SSN :</ strong > { socialSecurityFormat ( this . props . basic . ssn ) } </ td >
119
+ < td > < strong > Martial Status:</ strong > { this . props . basic . martialStatus } </ td >
119
120
</ tr >
120
121
< tr >
121
- < td > < strong > Gender:</ strong > { this . props . info . gender } </ td >
122
- < td > < strong > Address:</ strong > { this . props . info . address } </ td >
122
+ < td > < strong > Gender:</ strong > { this . props . basic . gender } </ td >
123
+ < td > < strong > Address:</ strong > { this . props . basic . address } </ td >
123
124
</ tr >
124
125
< tr >
125
- < td > < strong > City:</ strong > { this . props . info . address } </ td >
126
- < td > < strong > Postal:</ strong > { this . props . info . postal } </ td >
126
+ < td > < strong > City:</ strong > { this . props . basic . address } </ td >
127
+ < td > < strong > Postal:</ strong > { this . props . basic . postal } </ td >
127
128
</ tr >
128
129
< tr >
129
- < td > < strong > State:</ strong > { this . props . info . state } </ td >
130
- < td > < strong > Country:</ strong > { this . props . info . country } </ td >
130
+ < td > < strong > State:</ strong > { this . props . basic . state } </ td >
131
+ < td > < strong > Country:</ strong > { this . props . basic . country } </ td >
131
132
</ tr >
132
133
< tr >
133
- < td > < strong > Phone:</ strong > { telephoneFormat ( this . props . info . phone ) } </ td >
134
- < td > < strong > Email:</ strong > { this . props . info . email } </ td >
134
+ < td > < strong > Phone:</ strong > { telephoneFormat ( this . props . basic . phone ) } </ td >
135
+ < td > < strong > Email:</ strong > { this . props . basic . email } </ td >
135
136
</ tr >
136
137
< tr >
137
- < td > < strong > Billing Note:</ strong > { this . props . info . billingNote } </ td >
138
- < td > < strong > Other Note:</ strong > { this . props . info . otherNote } </ td >
138
+ < td > < strong > Billing Note:</ strong > { this . props . basic . billingNote } </ td >
139
+ < td > < strong > Other Note:</ strong > { this . props . basic . otherNote } </ td >
139
140
</ tr >
140
141
</ tbody >
141
142
</ table >
142
143
143
144
< button type = 'button' className = 'btn btn-default btn-sm' onClick = { this . handleEdit } > EDIT</ button >
144
145
</ div >
145
146
)
146
- } else if ( this . props . info && this . state . showForm === true ) {
147
+ } else if ( this . props . basic && this . state . showForm === true ) {
147
148
return (
148
149
< Formsy . Form onValidSubmit = { this . handleSubmit . bind ( this ) }
149
150
name = 'basicInfoForm'
@@ -187,7 +188,7 @@ class Basic extends React.Component {
187
188
< tr >
188
189
< td >
189
190
< FormsyMaskedInput mask = { [ / \d / , / \d / , / \d / , '-' , / \d / , / \d / , '-' , / \d / , / \d / , / \d / , / \d / ] }
190
- value = { this . state . ss }
191
+ value = { this . state . ssn }
191
192
onChange = { this . handleInputChange }
192
193
validations = { {
193
194
isLength : 9
@@ -197,7 +198,7 @@ class Basic extends React.Component {
197
198
isDefaultRequiredValue : 'Valid SSN is required' ,
198
199
isLength : 'Valid SSN is required'
199
200
} }
200
- name = 'ss '
201
+ name = 'ssn '
201
202
label = 'SSN'
202
203
required />
203
204
</ td >
@@ -220,14 +221,14 @@ class Basic extends React.Component {
220
221
</ tr >
221
222
< tr >
222
223
< td >
223
- < strong > Gender: </ strong >
224
- < select onChange = { this . handleInputChange }
225
- name = 'gender'
226
- value = { this . state . gender } >
227
- < option value = 'male' > Male</ option >
228
- < option value = 'female' > Female</ option >
229
- < option value = 'other' > Other</ option >
230
- </ select >
224
+ < FormsySelect value = { this . state . gender }
225
+ onChange = { this . handleInputChange }
226
+ name = 'gender'
227
+ label = 'Gender'
228
+ options = { [ { option : 'male' , title : ' Male' } ,
229
+ { option : 'female' , title : ' Female' } ,
230
+ { option : 'other' , title : ' Other' } ] }
231
+ required / >
231
232
</ td >
232
233
< td >
233
234
< FormsyInput value = { this . state . address }
0 commit comments