@@ -77,6 +77,7 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
7777 traitId : UserTraitIds . education ,
7878 traits : {
7979 data : memberEducation || [ ] ,
80+ traitId : UserTraitIds . education ,
8081 } ,
8182 } , props . education )
8283 . then ( ( ) => {
@@ -90,20 +91,9 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
9091 }
9192
9293 function handleFormValueChange ( key : string , event : React . ChangeEvent < HTMLInputElement > ) : void {
93- let value : string | boolean | Date | undefined
94-
95- switch ( key ) {
96- case 'endDate' :
97- value = new Date ( event . target . value )
98- break
99- default :
100- value = event . target . value
101- break
102- }
103-
10494 setFormValues ( {
10595 ...formValues ,
106- [ key ] : value ,
96+ [ key ] : event . target . value ,
10797 } )
10898 }
10999
@@ -118,25 +108,24 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
118108 function handleFormAction ( ) : void {
119109 setFormErrors ( { } )
120110
121- if ( ! trim ( formValues . schoolCollegeName as string ) ) {
111+ if ( ! trim ( formValues . collegeName as string ) ) {
122112 setFormErrors ( {
123- schoolCollegeName : 'School is required' ,
113+ collegeName : 'School is required' ,
124114 } )
125115 return
126116 }
127117
128- if ( ! trim ( formValues . major as string ) ) {
118+ if ( ! trim ( formValues . degree as string ) ) {
129119 setFormErrors ( {
130- major : 'Degree is required' ,
120+ degree : 'Degree is required' ,
131121 } )
132122 return
133123 }
134124
135125 const updatedEducation : UserTrait = {
136- graduated : formValues . graduated ,
137- major : formValues . major ,
138- schoolCollegeName : formValues . schoolCollegeName ,
139- timePeriodTo : formValues . endDate ? ( formValues . endDate as Date ) . toISOString ( ) : undefined ,
126+ collegeName : formValues . collegeName ,
127+ degree : formValues . degree ,
128+ endYear : formValues . endYear ,
140129 }
141130
142131 if ( editedItemIndex !== undefined && memberEducation ) {
@@ -160,10 +149,9 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
160149 setEditedItemIndex ( indx )
161150
162151 setFormValues ( {
163- endDate : education . timePeriodTo ? new Date ( education . timePeriodTo ) : undefined ,
164- graduated : education . graduated ,
165- major : education . major ,
166- schoolCollegeName : education . schoolCollegeName ,
152+ collegeName : education . collegeName ,
153+ degree : education . degree ,
154+ endYear : education . endYear ,
167155 } )
168156 }
169157
@@ -226,7 +214,7 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
226214 memberEducation ?. map ( ( education : UserTrait , indx : number ) => (
227215 < div
228216 className = { styles . educationCardWrap }
229- key = { `${ education . schoolCollegeName } -${ education . major } ` }
217+ key = { `${ education . collegeName } -${ education . degree } ` }
230218 >
231219 < EducationCard education = { education } isModalView />
232220 < div className = { styles . actionElements } >
@@ -257,24 +245,24 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
257245 < InputText
258246 name = 'school'
259247 label = 'Name of College or University *'
260- error = { formErrors . schoolCollegeName }
248+ error = { formErrors . collegeName }
261249 placeholder = 'Enter name of college or university'
262250 dirty
263251 tabIndex = { 0 }
264252 type = 'text'
265- onChange = { bind ( handleFormValueChange , this , 'schoolCollegeName ' ) }
266- value = { formValues . schoolCollegeName as string }
253+ onChange = { bind ( handleFormValueChange , this , 'collegeName ' ) }
254+ value = { formValues . collegeName as string }
267255 />
268256 < InputText
269- name = 'major '
257+ name = 'degree '
270258 label = 'Degree *'
271- error = { formErrors . major }
259+ error = { formErrors . degree }
272260 placeholder = 'Enter Degree'
273261 dirty
274262 tabIndex = { 0 }
275263 type = 'text'
276- onChange = { bind ( handleFormValueChange , this , 'major ' ) }
277- value = { formValues . major as string }
264+ onChange = { bind ( handleFormValueChange , this , 'degree ' ) }
265+ value = { formValues . degree as string }
278266 />
279267 < InputSelect
280268 options = { yearOptions }
0 commit comments