@@ -4,6 +4,7 @@ import { telephoneFormat, socialSecurityFormat } from '../../../../common/Format
44import Formsy from 'formsy-react'
55import { wireUpCustomFormsyValidators } from '../../../../common/CustomValidators'
66import { FormsyInput } from '../../../../common/FormsyInput'
7+ import { FormsySelect } from '../../../../common/FormsySelect'
78import { FormsyDatePicker } from '../../../../common/FormsyDatePicker'
89import { FormsyMaskedInput } from '../../../../common/FormsyMaskedInput'
910
@@ -28,7 +29,7 @@ class Basic extends React.Component {
2829 console . debug ( 'Basic component in edit mode' )
2930 this . setLocalStateToStoreValues ( )
3031 this . setState ( { showForm : true } )
31- this . setState ( { cachedForm : this . props . info } )
32+ this . setState ( { cachedForm : this . props . basic } )
3233 }
3334
3435 componentDidMount ( ) {
@@ -61,7 +62,7 @@ class Basic extends React.Component {
6162 let value
6263 switch ( event . target . name ) {
6364 case 'phone' :
64- case 'ss ' :
65+ case 'ssn ' :
6566 value = this . sanitizeToJustNumbers ( event . target . value . toString ( ) )
6667 break
6768 default :
@@ -79,22 +80,22 @@ class Basic extends React.Component {
7980 }
8081
8182 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' ,
8384 'country' , 'phone' , 'email' , 'billingNote' , 'otherNote' ]
8485
8586 keys . forEach ( ( keyName ) => {
8687 let value
8788
8889 switch ( keyName ) {
8990 case 'dob' :
90- value = moment ( this . props . info [ keyName ] )
91+ value = moment ( this . props . basic [ keyName ] )
9192 break
9293 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 ( ) )
9596 break
9697 default :
97- value = this . props . info [ keyName ]
98+ value = this . props . basic [ keyName ]
9899 }
99100
100101 this . setState ( {
@@ -104,46 +105,46 @@ class Basic extends React.Component {
104105 }
105106
106107 render ( ) {
107- if ( this . props . info && this . state . showForm === false ) {
108+ if ( this . props . basic && this . state . showForm === false ) {
108109 return (
109110 < div >
110111 < table className = 'table' >
111112 < tbody >
112113 < 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 >
115116 </ tr >
116117 < 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 >
119120 </ tr >
120121 < 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 >
123124 </ tr >
124125 < 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 >
127128 </ tr >
128129 < 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 >
131132 </ tr >
132133 < 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 >
135136 </ tr >
136137 < 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 >
139140 </ tr >
140141 </ tbody >
141142 </ table >
142143
143144 < button type = 'button' className = 'btn btn-default btn-sm' onClick = { this . handleEdit } > EDIT</ button >
144145 </ div >
145146 )
146- } else if ( this . props . info && this . state . showForm === true ) {
147+ } else if ( this . props . basic && this . state . showForm === true ) {
147148 return (
148149 < Formsy . Form onValidSubmit = { this . handleSubmit . bind ( this ) }
149150 name = 'basicInfoForm'
@@ -187,7 +188,7 @@ class Basic extends React.Component {
187188 < tr >
188189 < td >
189190 < FormsyMaskedInput mask = { [ / \d / , / \d / , / \d / , '-' , / \d / , / \d / , '-' , / \d / , / \d / , / \d / , / \d / ] }
190- value = { this . state . ss }
191+ value = { this . state . ssn }
191192 onChange = { this . handleInputChange }
192193 validations = { {
193194 isLength : 9
@@ -197,7 +198,7 @@ class Basic extends React.Component {
197198 isDefaultRequiredValue : 'Valid SSN is required' ,
198199 isLength : 'Valid SSN is required'
199200 } }
200- name = 'ss '
201+ name = 'ssn '
201202 label = 'SSN'
202203 required />
203204 </ td >
@@ -220,14 +221,14 @@ class Basic extends React.Component {
220221 </ tr >
221222 < tr >
222223 < 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 / >
231232 </ td >
232233 < td >
233234 < FormsyInput value = { this . state . address }
0 commit comments