Commit 1c4a8cc5d44c7966a03345de5f99fa1a0927958a
1 parent
d197619130
Exists in
master
added parents data insertion when new student is added
Showing
3 changed files
with
60 additions
and
43 deletions
Show diff stats
imports/client/views/org/admin/students/addStudentForm.js
1 | import _ from 'lodash'; | 1 | import _ from 'lodash'; |
2 | import { Meteor } from 'meteor/meteor'; | 2 | import { Meteor } from 'meteor/meteor'; |
3 | 3 | ||
4 | import React, { Component } from 'react'; | 4 | import React, { Component } from 'react'; |
5 | import { Link,browserHistory } from 'react-router'; | 5 | import { Link,browserHistory } from 'react-router'; |
6 | import { Form, FormGroup,InputGroup, | 6 | import { Form, FormGroup,InputGroup, |
7 | DropdownButton,MenuItem,ControlLabel, | 7 | DropdownButton,MenuItem,ControlLabel, |
8 | SplitButton, | 8 | SplitButton, |
9 | FormControl,Glyphicon,Button } from 'react-bootstrap'; | 9 | FormControl,Glyphicon,Button } from 'react-bootstrap'; |
10 | import DatePicker from 'react-bootstrap-date-picker' | 10 | import DatePicker from 'react-bootstrap-date-picker' |
11 | import {addStudentManually} from '/imports/collections/students/methods'; | 11 | import {addStudentManually} from '/imports/collections/students/methods'; |
12 | 12 | ||
13 | export class AddStudentForm extends Component { | 13 | export class AddStudentForm extends Component { |
14 | 14 | ||
15 | constructor(props) { | 15 | constructor(props) { |
16 | super(props); | 16 | super(props); |
17 | this.state = { | 17 | this.state = { |
18 | admissionId: "", | 18 | admissionId: "123", |
19 | firstName: "", | 19 | firstName: "first", |
20 | lastName: "", | 20 | lastName: "last", |
21 | middleName: "", | 21 | middleName: "middle", |
22 | email: "", | 22 | email: "deepak125.dk+21@gmail.com", |
23 | dob: "", | 23 | dob: "", |
24 | formattedDob: "", | 24 | formattedDob: "", |
25 | gender: "", | 25 | gender: "male", |
26 | rollNo: "", | 26 | rollNo: "1", |
27 | class: "", | 27 | class: "2", |
28 | section: "", | 28 | section: "B", |
29 | community: "", | 29 | community: "SC", |
30 | bloodGroup: "", | 30 | bloodGroup: "B+", |
31 | phone: "", | 31 | phone: "9876543321", |
32 | address: "", | 32 | address: "address", |
33 | city: "", | 33 | city: "chennai", |
34 | state: "", | 34 | state: "tn", |
35 | parentName: "", | 35 | parentName: "parentName", |
36 | parentEmail: "", | 36 | parentEmail: "deepak125.dk+41@gmail.com", |
37 | relation: "", | 37 | relation: "father", |
38 | profession: "", | 38 | profession: "farmer", |
39 | parentGender: "", | 39 | parentGender: "male", |
40 | parentPhone: "", | 40 | parentPhone: "987655412", |
41 | parentAddress: "", | 41 | parentAddress: "parentAddress", |
42 | parentCity: "", | 42 | parentCity: "parentCity", |
43 | parentState: "", | 43 | parentState: "parentState", |
44 | parentZipcode: "", | 44 | parentZipcode: "parentZipcode", |
45 | }; | 45 | }; |
46 | this.onUpdate = this.onUpdate.bind(this); | 46 | this.onUpdate = this.onUpdate.bind(this); |
47 | this.handleDob = this.handleDob.bind(this); | 47 | this.handleDob = this.handleDob.bind(this); |
48 | }; | 48 | }; |
49 | 49 | ||
50 | onUpdate(key, value) { | 50 | onUpdate(key, value) { |
51 | this.setState({[key]: value}); | 51 | this.setState({[key]: value}); |
52 | }; | 52 | }; |
53 | 53 | ||
54 | handleDob(value, formattedValue) { | 54 | handleDob(value, formattedValue) { |
55 | this.setState({ | 55 | this.setState({ |
56 | dob: value, // ISO String, ex: "2016-11-19T12:00:00.000Z" | 56 | dob: value, // ISO String, ex: "2016-11-19T12:00:00.000Z" |
57 | formattedDob: formattedValue // Formatted String, ex: "11/19/2016" | 57 | formattedDob: formattedValue // Formatted String, ex: "11/19/2016" |
58 | }); | 58 | }); |
59 | } | 59 | } |
60 | addStudent(e){ | 60 | addStudent(e){ |
61 | e.preventDefault(); | 61 | e.preventDefault(); |
62 | e.persist(); | 62 | e.persist(); |
63 | const firstName = this.state.firstName; | 63 | const firstName = this.state.firstName; |
64 | const middleName = this.state.middleName; | 64 | const middleName = this.state.middleName; |
65 | const lastName = this.state.lastName; | 65 | const lastName = this.state.lastName; |
66 | const admissionId = this.state.admissionId; | 66 | const admissionId = this.state.admissionId; |
67 | const email = this.state.email; | 67 | const email = this.state.email; |
68 | const dob = this.state.dob; | 68 | const dob = this.state.dob; |
69 | const formattedDob = this.state.formattedDob; | 69 | const formattedDob = this.state.formattedDob; |
70 | const gender = this.state.gender; | 70 | const gender = this.state.gender; |
71 | const rollNo = this.state.rollNo; | 71 | const rollNo = this.state.rollNo; |
72 | const studentclass = this.state.class; | 72 | const studentclass = this.state.class; |
73 | const section = this.state.section; | 73 | const section = this.state.section; |
74 | const community = this.state.community; | 74 | const community = this.state.community; |
75 | const bloodGroup = this.state.bloodGroup; | 75 | const bloodGroup = this.state.bloodGroup; |
76 | const phone = this.state.phone; | 76 | const phone = this.state.phone; |
77 | const address = this.state.address; | 77 | const address = this.state.address; |
78 | const city = this.state.city; | 78 | const city = this.state.city; |
79 | const state = this.state.state; | 79 | const state = this.state.state; |
80 | const parentName = this.state.parentName; | 80 | const parentName = this.state.parentName; |
81 | const parentEmail = this.state.parentEmail; | 81 | const parentEmail = this.state.parentEmail; |
82 | const relation = this.state.relation; | 82 | const relation = this.state.relation; |
83 | const profession = this.state.profession; | 83 | const profession = this.state.profession; |
84 | const parentGender = this.state.parentGender; | 84 | const parentGender = this.state.parentGender; |
85 | const parentPhone = this.state.parentPhone; | 85 | const parentPhone = this.state.parentPhone; |
86 | const parentAddress = this.state.parentAddress; | 86 | const parentAddress = this.state.parentAddress; |
87 | const parentCity = this.state.parentCity; | 87 | const parentCity = this.state.parentCity; |
88 | const parentState = this.state.parentState; | 88 | const parentState = this.state.parentState; |
89 | const parentZipcode = this.state.parentZipcode; | 89 | const parentZipcode = this.state.parentZipcode; |
90 | if(admissionId==""){ | 90 | if(admissionId==""){ |
91 | Bert.alert('Enter Admission Id!', 'danger'); | 91 | Bert.alert('Enter Admission Id!', 'danger'); |
92 | }else if(firstName==""){ | 92 | }else if(firstName==""){ |
93 | Bert.alert('Enter Fist Name', 'danger'); | 93 | Bert.alert('Enter Fist Name', 'danger'); |
94 | } else if(middleName==""){ | 94 | } else if(middleName==""){ |
95 | Bert.alert('Enter Middle name!', 'danger'); | 95 | Bert.alert('Enter Middle name!', 'danger'); |
96 | }else if(lastName==""){ | 96 | }else if(lastName==""){ |
97 | Bert.alert('Enter Last name!', 'danger'); | 97 | Bert.alert('Enter Last name!', 'danger'); |
98 | }else if(email==""){ | 98 | }else if(email==""){ |
99 | Bert.alert('Enter email!', 'danger'); | 99 | Bert.alert('Enter email!', 'danger'); |
100 | }else if(dob==""){ | 100 | }else if(dob==""){ |
101 | Bert.alert('Enter DOB!', 'danger'); | 101 | Bert.alert('Enter DOB!', 'danger'); |
102 | }else if(gender==""){ | 102 | }else if(gender==""){ |
103 | Bert.alert('Enter Student Gender!', 'danger'); | 103 | Bert.alert('Enter Student Gender!', 'danger'); |
104 | }else if(studentclass==""){ | 104 | }else if(studentclass==""){ |
105 | Bert.alert('Enter Class!', 'danger'); | 105 | Bert.alert('Enter Class!', 'danger'); |
106 | }else if(section==""){ | 106 | }else if(section==""){ |
107 | Bert.alert('Enter Section!', 'danger'); | 107 | Bert.alert('Enter Section!', 'danger'); |
108 | }else if(community==""){ | 108 | }else if(community==""){ |
109 | Bert.alert('Enter Section!', 'danger'); | 109 | Bert.alert('Enter Section!', 'danger'); |
110 | }else if(bloodGroup==""){ | 110 | }else if(bloodGroup==""){ |
111 | Bert.alert('Enter Blood Group!', 'danger'); | 111 | Bert.alert('Enter Blood Group!', 'danger'); |
112 | }else if(phone==""){ | 112 | }else if(phone==""){ |
113 | Bert.alert('Enter phone!', 'danger'); | 113 | Bert.alert('Enter phone!', 'danger'); |
114 | }else if(address==""){ | 114 | }else if(address==""){ |
115 | Bert.alert('Enter address!', 'danger'); | 115 | Bert.alert('Enter address!', 'danger'); |
116 | }else if(city==""){ | 116 | }else if(city==""){ |
117 | Bert.alert('Enter city!', 'danger'); | 117 | Bert.alert('Enter city!', 'danger'); |
118 | }else if(state==""){ | 118 | }else if(state==""){ |
119 | Bert.alert('Enter state!', 'danger'); | 119 | Bert.alert('Enter state!', 'danger'); |
120 | }else if(parentName==""){ | 120 | }else if(parentName==""){ |
121 | Bert.alert('Enter Parent name!', 'danger'); | 121 | Bert.alert('Enter Parent name!', 'danger'); |
122 | }else if(parentEmail==""){ | 122 | }else if(parentEmail==""){ |
123 | Bert.alert('Enter Parent Email!', 'danger'); | 123 | Bert.alert('Enter Parent Email!', 'danger'); |
124 | }else if(relation==""){ | 124 | }else if(relation==""){ |
125 | Bert.alert('Enter relation!', 'danger'); | 125 | Bert.alert('Enter relation!', 'danger'); |
126 | }else if(profession==""){ | 126 | }else if(profession==""){ |
127 | Bert.alert('Enter parent profession!', 'danger'); | 127 | Bert.alert('Enter parent profession!', 'danger'); |
128 | }else if(parentGender==""){ | 128 | }else if(parentGender==""){ |
129 | Bert.alert("Enter Parent's Gender!", 'danger'); | 129 | Bert.alert("Enter Parent's Gender!", 'danger'); |
130 | }else if(parentPhone==""){ | 130 | }else if(parentPhone==""){ |
131 | Bert.alert("Enter Parent's Phone!", 'danger'); | 131 | Bert.alert("Enter Parent's Phone!", 'danger'); |
132 | }else if(parentAddress==""){ | 132 | }else if(parentAddress==""){ |
133 | Bert.alert("Enter Parent's Address!", 'danger'); | 133 | Bert.alert("Enter Parent's Address!", 'danger'); |
134 | }else if(parentCity==""){ | 134 | }else if(parentCity==""){ |
135 | Bert.alert("Enter Parent's City!", 'danger'); | 135 | Bert.alert("Enter Parent's City!", 'danger'); |
136 | }else if(parentState==""){ | 136 | }else if(parentState==""){ |
137 | Bert.alert("Enter Parent's State!", 'danger'); | 137 | Bert.alert("Enter Parent's State!", 'danger'); |
138 | }else if(parentZipcode==""){ | 138 | }else if(parentZipcode==""){ |
139 | Bert.alert("Enter Parent's zipcode!", 'danger'); | 139 | Bert.alert("Enter Parent's zipcode!", 'danger'); |
140 | }else{ | 140 | }else{ |
141 | addStudentManually.call({ | 141 | addStudentManually.call({ |
142 | admissionId, | 142 | admissionId, |
143 | firstName, | 143 | firstName, |
144 | middleName, | 144 | middleName, |
145 | lastName, | 145 | lastName, |
146 | email, | 146 | email, |
147 | dob, | 147 | dob, |
148 | formattedDob, | 148 | formattedDob, |
149 | gender, | 149 | gender, |
150 | rollNo, | 150 | rollNo, |
151 | studentclass, | 151 | studentclass, |
152 | section, | 152 | section, |
153 | community, | 153 | community, |
154 | bloodGroup, | 154 | bloodGroup, |
155 | phone, | 155 | phone, |
156 | address, | 156 | address, |
157 | city, | 157 | city, |
158 | state, | 158 | state, |
159 | parentName, | 159 | parentName, |
160 | parentEmail, | 160 | parentEmail, |
161 | relation, | 161 | relation, |
162 | profession, | 162 | profession, |
163 | parentGender, | 163 | parentGender, |
164 | parentPhone, | 164 | parentPhone, |
165 | parentAddress, | 165 | parentAddress, |
166 | parentCity, | 166 | parentCity, |
167 | parentState, | 167 | parentState, |
168 | parentZipcode | 168 | parentZipcode |
169 | }, function (error, result) { | 169 | }, function (error, result) { |
170 | console.log(error); | 170 | console.log(error); |
171 | console.log(result); | 171 | console.log(result); |
172 | }); | 172 | }); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | render() { | 175 | render() { |
176 | return ( | 176 | return ( |
177 | <Form onSubmit={ (e) => this.addStudent(e) } inline> | 177 | <Form onSubmit={ (e) => this.addStudent(e) } inline> |
178 | <FormGroup controlId="admissionId"> | 178 | <FormGroup controlId="admissionId"> |
179 | <ControlLabel>Admission Id</ControlLabel> | 179 | <ControlLabel>Admission Id</ControlLabel> |
180 | <FormControl | 180 | <FormControl |
181 | type="text" | 181 | type="text" |
182 | value={this.state.admissionId} | 182 | value={this.state.admissionId} |
183 | placeholder="admission Id" | 183 | placeholder="admission Id" |
184 | onChange={e=>this.onUpdate('admissionId',e.target.value)} | 184 | onChange={e=>this.onUpdate('admissionId',e.target.value)} |
185 | /> | 185 | /> |
186 | </FormGroup> | 186 | </FormGroup> |
187 | 187 | ||
188 | <FormGroup controlId="firstName"> | 188 | <FormGroup controlId="firstName"> |
189 | <ControlLabel>First Name</ControlLabel> | 189 | <ControlLabel>First Name</ControlLabel> |
190 | <FormControl | 190 | <FormControl |
191 | type="text" | 191 | type="text" |
192 | value={this.state.firstName} | 192 | value={this.state.firstName} |
193 | placeholder="First Name" | 193 | placeholder="First Name" |
194 | onChange={e=>this.onUpdate('firstName',e.target.value)} | 194 | onChange={e=>this.onUpdate('firstName',e.target.value)} |
195 | /> | 195 | /> |
196 | </FormGroup> | 196 | </FormGroup> |
197 | <FormGroup controlId="middleName"> | 197 | <FormGroup controlId="middleName"> |
198 | <ControlLabel>Middle Name</ControlLabel> | 198 | <ControlLabel>Middle Name</ControlLabel> |
199 | <FormControl | 199 | <FormControl |
200 | type="text" | 200 | type="text" |
201 | value={this.state.middleName} | 201 | value={this.state.middleName} |
202 | placeholder="Middle Name" | 202 | placeholder="Middle Name" |
203 | onChange={e=>this.onUpdate('middleName',e.target.value)} | 203 | onChange={e=>this.onUpdate('middleName',e.target.value)} |
204 | /> | 204 | /> |
205 | </FormGroup> | 205 | </FormGroup> |
206 | 206 | ||
207 | <FormGroup controlId="lastName"> | 207 | <FormGroup controlId="lastName"> |
208 | <ControlLabel>Last Name</ControlLabel> | 208 | <ControlLabel>Last Name</ControlLabel> |
209 | <FormControl | 209 | <FormControl |
210 | type="text" | 210 | type="text" |
211 | value={this.state.lastName} | 211 | value={this.state.lastName} |
212 | placeholder="Last Name" | 212 | placeholder="Last Name" |
213 | onChange={e=>this.onUpdate('lastName',e.target.value)} | 213 | onChange={e=>this.onUpdate('lastName',e.target.value)} |
214 | /> | 214 | /> |
215 | 215 | ||
216 | </FormGroup> | 216 | </FormGroup> |
217 | <FormGroup controlId="email"> | 217 | <FormGroup controlId="email"> |
218 | <ControlLabel>Email</ControlLabel> | 218 | <ControlLabel>Email</ControlLabel> |
219 | <FormControl | 219 | <FormControl |
220 | type="email" | 220 | type="email" |
221 | value={this.state.email} | 221 | value={this.state.email} |
222 | placeholder="Email" | 222 | placeholder="Email" |
223 | onChange={e=>this.onUpdate('email',e.target.value)} | 223 | onChange={e=>this.onUpdate('email',e.target.value)} |
224 | /> | 224 | /> |
225 | </FormGroup> | 225 | </FormGroup> |
226 | <FormGroup> | 226 | <FormGroup> |
227 | <ControlLabel>Date of birth</ControlLabel> | 227 | <ControlLabel>Date of birth</ControlLabel> |
228 | <DatePicker id="dob" | 228 | <DatePicker id="dob" |
229 | value={this.state.dob} | 229 | value={this.state.dob} |
230 | onChange={this.handleDob} | 230 | onChange={this.handleDob} |
231 | /> | 231 | /> |
232 | </FormGroup> | 232 | </FormGroup> |
233 | 233 | ||
234 | <FormGroup controlId="formControlsSelect"> | 234 | <FormGroup controlId="formControlsSelect"> |
235 | <ControlLabel>Gender</ControlLabel> | 235 | <ControlLabel>Gender</ControlLabel> |
236 | <FormControl componentClass="select" | 236 | <FormControl componentClass="select" |
237 | placeholder="select" | 237 | placeholder="select" |
238 | value={this.state.gender} | 238 | value={this.state.gender} |
239 | onChange={e=>this.onUpdate('gender',e.target.value)} | 239 | onChange={e=>this.onUpdate('gender',e.target.value)} |
240 | > | 240 | > |
241 | <option value="male">Male</option> | 241 | <option value="male">Male</option> |
242 | <option value="female">Female</option> | 242 | <option value="female">Female</option> |
243 | </FormControl> | 243 | </FormControl> |
244 | </FormGroup> | 244 | </FormGroup> |
245 | 245 | ||
246 | <FormGroup controlId="rollNo"> | 246 | <FormGroup controlId="rollNo"> |
247 | <ControlLabel>Roll No</ControlLabel> | 247 | <ControlLabel>Roll No</ControlLabel> |
248 | <FormControl | 248 | <FormControl |
249 | type="text" | 249 | type="text" |
250 | value={this.state.rollNo} | 250 | value={this.state.rollNo} |
251 | placeholder="Roll No" | 251 | placeholder="Roll No" |
252 | onChange={e=>this.onUpdate('rollNo',e.target.value)} | 252 | onChange={e=>this.onUpdate('rollNo',e.target.value)} |
253 | /> | 253 | /> |
254 | </FormGroup> | 254 | </FormGroup> |
255 | <FormGroup controlId="class"> | 255 | <FormGroup controlId="class"> |
256 | <ControlLabel>Class</ControlLabel> | 256 | <ControlLabel>Class</ControlLabel> |
257 | <FormControl | 257 | <FormControl |
258 | type="text" | 258 | type="text" |
259 | value={this.state.class} | 259 | value={this.state.class} |
260 | placeholder="7" | 260 | placeholder="7" |
261 | onChange={e=>this.onUpdate('class',e.target.value)} | 261 | onChange={e=>this.onUpdate('class',e.target.value)} |
262 | /> | 262 | /> |
263 | </FormGroup> | 263 | </FormGroup> |
264 | <FormGroup controlId="section"> | 264 | <FormGroup controlId="section"> |
265 | <ControlLabel>Section</ControlLabel> | 265 | <ControlLabel>Section</ControlLabel> |
266 | <FormControl | 266 | <FormControl |
267 | type="text" | 267 | type="text" |
268 | value={this.state.section} | 268 | value={this.state.section} |
269 | placeholder="B" | 269 | placeholder="B" |
270 | onChange={e=>this.onUpdate('section',e.target.value)} | 270 | onChange={e=>this.onUpdate('section',e.target.value)} |
271 | /> | 271 | /> |
272 | </FormGroup> | 272 | </FormGroup> |
273 | 273 | ||
274 | <FormGroup controlId="community"> | 274 | <FormGroup controlId="community"> |
275 | <ControlLabel>Community</ControlLabel> | 275 | <ControlLabel>Community</ControlLabel> |
276 | <FormControl | 276 | <FormControl |
277 | type="text" | 277 | type="text" |
278 | value={this.state.community} | 278 | value={this.state.community} |
279 | placeholder="General" | 279 | placeholder="General" |
280 | onChange={e=>this.onUpdate('community',e.target.value)} | 280 | onChange={e=>this.onUpdate('community',e.target.value)} |
281 | /> | 281 | /> |
282 | </FormGroup> | 282 | </FormGroup> |
283 | 283 | ||
284 | <FormGroup controlId="bloodGroup"> | 284 | <FormGroup controlId="bloodGroup"> |
285 | <ControlLabel>bloodGroup</ControlLabel> | 285 | <ControlLabel>bloodGroup</ControlLabel> |
286 | <FormControl | 286 | <FormControl |
287 | type="text" | 287 | type="text" |
288 | value={this.state.bloodGroup} | 288 | value={this.state.bloodGroup} |
289 | placeholder="B+" | 289 | placeholder="B+" |
290 | onChange={e=>this.onUpdate('bloodGroup',e.target.value)} | 290 | onChange={e=>this.onUpdate('bloodGroup',e.target.value)} |
291 | /> | 291 | /> |
292 | </FormGroup> | 292 | </FormGroup> |
293 | 293 | ||
294 | <FormGroup controlId="phone"> | 294 | <FormGroup controlId="phone"> |
295 | <ControlLabel>Phone</ControlLabel> | 295 | <ControlLabel>Phone</ControlLabel> |
296 | <FormControl | 296 | <FormControl |
297 | type="text" | 297 | type="text" |
298 | value={this.state.phone} | 298 | value={this.state.phone} |
299 | placeholder="9999999999" | 299 | placeholder="9999999999" |
300 | onChange={e=>this.onUpdate('phone',e.target.value)} | 300 | onChange={e=>this.onUpdate('phone',e.target.value)} |
301 | /> | 301 | /> |
302 | </FormGroup> | 302 | </FormGroup> |
303 | 303 | ||
304 | <FormGroup controlId="address"> | 304 | <FormGroup controlId="address"> |
305 | <ControlLabel>Address</ControlLabel> | 305 | <ControlLabel>Address</ControlLabel> |
306 | <FormControl | 306 | <FormControl |
307 | type="text" | 307 | type="text" |
308 | value={this.state.address} | 308 | value={this.state.address} |
309 | placeholder="#876, Street, town" | 309 | placeholder="#876, Street, town" |
310 | onChange={e=>this.onUpdate('address',e.target.value)} | 310 | onChange={e=>this.onUpdate('address',e.target.value)} |
311 | /> | 311 | /> |
312 | </FormGroup> | 312 | </FormGroup> |
313 | 313 | ||
314 | <FormGroup controlId="city"> | 314 | <FormGroup controlId="city"> |
315 | <ControlLabel>City</ControlLabel> | 315 | <ControlLabel>City</ControlLabel> |
316 | <FormControl | 316 | <FormControl |
317 | type="text" | 317 | type="text" |
318 | value={this.state.city} | 318 | value={this.state.city} |
319 | placeholder="Chennai" | 319 | placeholder="Chennai" |
320 | onChange={e=>this.onUpdate('city',e.target.value)} | 320 | onChange={e=>this.onUpdate('city',e.target.value)} |
321 | /> | 321 | /> |
322 | </FormGroup> | 322 | </FormGroup> |
323 | 323 | ||
324 | <FormGroup controlId="state"> | 324 | <FormGroup controlId="state"> |
325 | <ControlLabel>State</ControlLabel> | 325 | <ControlLabel>State</ControlLabel> |
326 | <FormControl | 326 | <FormControl |
327 | type="text" | 327 | type="text" |
328 | value={this.state.state} | 328 | value={this.state.state} |
329 | placeholder="Tamilnadu" | 329 | placeholder="Tamilnadu" |
330 | onChange={e=>this.onUpdate('state',e.target.value)} | 330 | onChange={e=>this.onUpdate('state',e.target.value)} |
331 | /> | 331 | /> |
332 | </FormGroup> | 332 | </FormGroup> |
333 | 333 | ||
334 | <FormGroup controlId="parentName"> | 334 | <FormGroup controlId="parentName"> |
335 | <ControlLabel>Parent Name</ControlLabel> | 335 | <ControlLabel>Parent Name</ControlLabel> |
336 | <FormControl | 336 | <FormControl |
337 | type="text" | 337 | type="text" |
338 | value={this.state.parentName} | 338 | value={this.state.parentName} |
339 | placeholder="John" | 339 | placeholder="John" |
340 | onChange={e=>this.onUpdate('parentName',e.target.value)} | 340 | onChange={e=>this.onUpdate('parentName',e.target.value)} |
341 | /> | 341 | /> |
342 | </FormGroup> | 342 | </FormGroup> |
343 | 343 | ||
344 | <FormGroup controlId="parentEmail"> | 344 | <FormGroup controlId="parentEmail"> |
345 | <ControlLabel>Parent Email</ControlLabel> | 345 | <ControlLabel>Parent Email</ControlLabel> |
346 | <FormControl | 346 | <FormControl |
347 | type="text" | 347 | type="text" |
348 | value={this.state.parentEmail} | 348 | value={this.state.parentEmail} |
349 | placeholder="john@email.com" | 349 | placeholder="john@email.com" |
350 | onChange={e=>this.onUpdate('parentEmail',e.target.value)} | 350 | onChange={e=>this.onUpdate('parentEmail',e.target.value)} |
351 | /> | 351 | /> |
352 | </FormGroup> | 352 | </FormGroup> |
353 | 353 | ||
354 | <FormGroup controlId="relation"> | 354 | <FormGroup controlId="relation"> |
355 | <ControlLabel>Relation</ControlLabel> | 355 | <ControlLabel>Relation</ControlLabel> |
356 | <FormControl | 356 | <FormControl |
357 | type="text" | 357 | type="text" |
358 | value={this.state.relation} | 358 | value={this.state.relation} |
359 | placeholder="Father" | 359 | placeholder="Father" |
360 | onChange={e=>this.onUpdate('relation',e.target.value)} | 360 | onChange={e=>this.onUpdate('relation',e.target.value)} |
361 | /> | 361 | /> |
362 | </FormGroup> | 362 | </FormGroup> |
363 | 363 | ||
364 | <FormGroup controlId="profession"> | 364 | <FormGroup controlId="profession"> |
365 | <ControlLabel>Profession</ControlLabel> | 365 | <ControlLabel>Profession</ControlLabel> |
366 | <FormControl | 366 | <FormControl |
367 | type="text" | 367 | type="text" |
368 | value={this.state.profession} | 368 | value={this.state.profession} |
369 | placeholder="Farmer" | 369 | placeholder="Farmer" |
370 | onChange={e=>this.onUpdate('profession',e.target.value)} | 370 | onChange={e=>this.onUpdate('profession',e.target.value)} |
371 | /> | 371 | /> |
372 | </FormGroup> | 372 | </FormGroup> |
373 | 373 | ||
374 | <FormGroup controlId="parentGender"> | 374 | <FormGroup controlId="parentGender"> |
375 | <ControlLabel>Parent Gender</ControlLabel> | 375 | <ControlLabel>Parent Gender</ControlLabel> |
376 | <FormControl componentClass="select" | 376 | <FormControl componentClass="select" |
377 | placeholder="select" | 377 | placeholder="select" |
378 | value={this.state.parentGender} | 378 | value={this.state.parentGender} |
379 | onChange={e=>this.onUpdate('parentGender',e.target.value)} | 379 | onChange={e=>this.onUpdate('parentGender',e.target.value)} |
380 | > | 380 | > |
381 | <option value="male">Male</option> | 381 | <option value="male">Male</option> |
382 | <option value="female">Female</option> | 382 | <option value="female">Female</option> |
383 | </FormControl> | 383 | </FormControl> |
384 | </FormGroup> | 384 | </FormGroup> |
385 | 385 | ||
386 | <FormGroup controlId="parentPhone"> | 386 | <FormGroup controlId="parentPhone"> |
387 | <ControlLabel>Parent Phone</ControlLabel> | 387 | <ControlLabel>Parent Phone</ControlLabel> |
388 | <FormControl | 388 | <FormControl |
389 | type="text" | 389 | type="text" |
390 | value={this.state.parentPhone} | 390 | value={this.state.parentPhone} |
391 | placeholder="9876543210" | 391 | placeholder="9876543210" |
392 | onChange={e=>this.onUpdate('parentPhone',e.target.value)} | 392 | onChange={e=>this.onUpdate('parentPhone',e.target.value)} |
393 | /> | 393 | /> |
394 | </FormGroup> | 394 | </FormGroup> |
395 | 395 | ||
396 | <FormGroup controlId="parentAddress"> | 396 | <FormGroup controlId="parentAddress"> |
397 | <ControlLabel>Parent Address</ControlLabel> | 397 | <ControlLabel>Parent Address</ControlLabel> |
398 | <FormControl | 398 | <FormControl |
399 | type="text" | 399 | type="text" |
400 | value={this.state.parentAddress} | 400 | value={this.state.parentAddress} |
401 | placeholder="#12, street, town" | 401 | placeholder="#12, street, town" |
402 | onChange={e=>this.onUpdate('parentAddress',e.target.value)} | 402 | onChange={e=>this.onUpdate('parentAddress',e.target.value)} |
403 | /> | 403 | /> |
404 | </FormGroup> | 404 | </FormGroup> |
405 | 405 | ||
406 | <FormGroup controlId="parentCity"> | 406 | <FormGroup controlId="parentCity"> |
407 | <ControlLabel>Parent City</ControlLabel> | 407 | <ControlLabel>Parent City</ControlLabel> |
408 | <FormControl | 408 | <FormControl |
409 | type="text" | 409 | type="text" |
410 | value={this.state.parentCity} | 410 | value={this.state.parentCity} |
411 | placeholder="Chennai" | 411 | placeholder="Chennai" |
412 | onChange={e=>this.onUpdate('parentCity',e.target.value)} | 412 | onChange={e=>this.onUpdate('parentCity',e.target.value)} |
413 | /> | 413 | /> |
414 | </FormGroup> | 414 | </FormGroup> |
415 | 415 | ||
416 | <FormGroup controlId="parentState"> | 416 | <FormGroup controlId="parentState"> |
417 | <ControlLabel>Parent State</ControlLabel> | 417 | <ControlLabel>Parent State</ControlLabel> |
418 | <FormControl | 418 | <FormControl |
419 | type="text" | 419 | type="text" |
420 | value={this.state.parentState} | 420 | value={this.state.parentState} |
421 | placeholder="Tamilnadu" | 421 | placeholder="Tamilnadu" |
422 | onChange={e=>this.onUpdate('parentState',e.target.value)} | 422 | onChange={e=>this.onUpdate('parentState',e.target.value)} |
423 | /> | 423 | /> |
424 | </FormGroup> | 424 | </FormGroup> |
425 | 425 | ||
426 | <FormGroup controlId="parentZipcode"> | 426 | <FormGroup controlId="parentZipcode"> |
427 | <ControlLabel>Parent Zipcode</ControlLabel> | 427 | <ControlLabel>Parent Zipcode</ControlLabel> |
428 | <FormControl | 428 | <FormControl |
429 | type="text" | 429 | type="text" |
430 | value={this.state.parentZipcode} | 430 | value={this.state.parentZipcode} |
431 | placeholder="600031" | 431 | placeholder="600031" |
432 | onChange={e=>this.onUpdate('parentZipcode',e.target.value)} | 432 | onChange={e=>this.onUpdate('parentZipcode',e.target.value)} |
433 | /> | 433 | /> |
434 | </FormGroup> | 434 | </FormGroup> |
435 | <Button type="submit" bsStyle="default">Add Student</Button> | 435 | <Button type="submit" bsStyle="default">Add Student</Button> |
436 | </Form> | 436 | </Form> |
437 | ); | 437 | ); |
438 | }; | 438 | }; |
439 | 439 | ||
440 | }; | 440 | }; |
441 | 441 |
imports/collections/students/index.js
1 | // import {Students } from '/imports/collections/students/methods' | 1 | // import {Students } from '/imports/collections/students/methods' |
2 | 2 | ||
3 | import _ from 'lodash'; | 3 | import _ from 'lodash'; |
4 | import { Meteor } from 'meteor/meteor'; | 4 | import { Meteor } from 'meteor/meteor'; |
5 | import { Mongo } from 'meteor/mongo'; | 5 | import { Mongo } from 'meteor/mongo'; |
6 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | 6 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; |
7 | 7 | ||
8 | import { Orgs } from '/imports/collections/orgs/index'; | 8 | import { Orgs } from '/imports/collections/orgs/index'; |
9 | import { Users } from '/imports/collections/users/index'; | 9 | import { Users } from '/imports/collections/users/index'; |
10 | 10 | ||
11 | class Student { | 11 | class Student { |
12 | constructor(doc) { | 12 | constructor(doc) { |
13 | _.assign(this, doc); | 13 | _.assign(this, doc); |
14 | }; | 14 | }; |
15 | 15 | ||
16 | getUserIds() { | 16 | getUserIds() { |
17 | return _.filter(_.map(this.users, 'userId')); | 17 | return _.filter(_.map(this.users, 'userId')); |
18 | }; | 18 | }; |
19 | }; | 19 | }; |
20 | export { Student }; | 20 | export { Student }; |
21 | 21 | ||
22 | class StudentsCollection extends Mongo.Collection { | 22 | class StudentsCollection extends Mongo.Collection { |
23 | insert(item, callback) { | 23 | insert(item, callback) { |
24 | _.assign(item, { | 24 | _.assign(item, { |
25 | createdAt: new Date().getTime(), | 25 | createdAt: new Date().getTime(), |
26 | }); | 26 | }); |
27 | return super.insert(item, callback); | 27 | return super.insert(item, callback); |
28 | }; | 28 | }; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | export const Students = new StudentsCollection('Students', { | 31 | export const Students = new StudentsCollection('Students', { |
32 | transform: (item) => { | 32 | transform: (item) => { |
33 | return new Student(item); | 33 | return new Student(item); |
34 | }, | 34 | }, |
35 | }); | 35 | }); |
36 | 36 | ||
37 | _.assign(Students, { | 37 | _.assign(Students, { |
38 | allStudents: () => { | 38 | allStudents: () => { |
39 | const user = Users.current(); | 39 | const user = Users.current(); |
40 | if(!user) return null; | 40 | if(!user) return null; |
41 | return Orgs.find({'users.userId': user._id}); | 41 | return Orgs.find({'users.userId': user._id}); |
42 | }, | 42 | }, |
43 | current: () => { | 43 | current: () => { |
44 | const user = Users.current(); | 44 | const user = Users.current(); |
45 | if(!user) return null; | 45 | if(!user) return null; |
46 | return Orgs.findOne({_id: user.orgId}); | 46 | return Orgs.findOne({_id: user.orgId}); |
47 | }, | 47 | }, |
48 | currentOrgUsers: () => { | 48 | currentOrgUsers: () => { |
49 | const OrgsArr = Orgs.current(); | 49 | const OrgsArr = Orgs.current(); |
50 | if(!OrgsArr) return null; | 50 | if(!OrgsArr) return null; |
51 | return OrgsArr.users; | 51 | return OrgsArr.users; |
52 | }, | 52 | }, |
53 | 53 | ||
54 | }); | 54 | }); |
55 | 55 | ||
56 | Students.deny({ | 56 | Students.deny({ |
57 | insert() { return true; }, | 57 | insert() { return true; }, |
58 | update() { return true; }, | 58 | update() { return true; }, |
59 | remove() { return true; }, | 59 | remove() { return true; }, |
60 | }); | 60 | }); |
61 | 61 | ||
62 | 62 | ||
63 | Students.schema = new SimpleSchema({ | 63 | Students.schema = new SimpleSchema({ |
64 | userId: { type: String }, | 64 | userId: { type: String }, |
65 | orgId: { type: String }, | 65 | orgId: { type: String }, |
66 | admissionId: { type: String, optional: true }, | 66 | admissionId: { type: String, optional: true }, |
67 | enrollmentDate: { type: String, optional: true }, | 67 | enrollmentDate: { type: String, optional: true }, |
68 | address: { type: String, optional: true }, | 68 | address: { type: String, optional: true }, |
69 | prefix: { type: String, optional: true }, | 69 | prefix: { type: String, optional: true }, |
70 | firstName: { type: String, optional: true }, | 70 | firstName: { type: String, optional: true }, |
71 | middlename: { type: String, optional: true }, | 71 | middlename: { type: String, optional: true }, |
72 | lastName: { type: String, optional: true }, | 72 | lastName: { type: String, optional: true }, |
73 | gender: { type: String, optional: true }, | 73 | gender: { type: String, optional: true }, |
74 | dob: { type: String, optional: true }, | 74 | dob: { type: String, optional: true }, |
75 | rollNo: { type: String, optional: true }, | 75 | rollNo: { type: String, optional: true }, |
76 | class: { type: String, optional: true }, | 76 | class: { type: String, optional: true }, |
77 | section: { type: String, optional: true }, | 77 | section: { type: String, optional: true }, |
78 | bloodGroup: { type: String, optional: true }, | 78 | bloodGroup: { type: String, optional: true }, |
79 | community: { type: String, optional: true }, | 79 | community: { type: String, optional: true }, |
80 | nationality: { type: String, optional: true }, | 80 | nationality: { type: String, optional: true }, |
81 | motherTongue: { type: String, optional: true }, | 81 | motherTongue: { type: String, optional: true }, |
82 | motherTongue: { type: String, optional: true }, | 82 | motherTongue: { type: String, optional: true }, |
83 | religion: { type: String, optional: true }, | 83 | religion: { type: String, optional: true }, |
84 | permanentAddress: { | 84 | permanentAddress: { |
85 | type: new SimpleSchema({ | 85 | type: new SimpleSchema({ |
86 | home: { type: String, optional: true }, | 86 | home: { type: String, optional: true }, |
87 | street: { type: String, optional: true }, | 87 | street: { type: String, optional: true }, |
88 | town: { type: String, optional: true }, | 88 | town: { type: String, optional: true }, |
89 | city: { type: String, optional: true }, | 89 | city: { type: String, optional: true }, |
90 | state: { type: String, optional: true }, | 90 | state: { type: String, optional: true }, |
91 | zip: { type: String, optional: true }, | 91 | zip: { type: String, optional: true }, |
92 | }), | 92 | }), |
93 | optional: true | 93 | optional: true |
94 | }, | 94 | }, |
95 | parent: { | 95 | parent: { |
96 | type: [new SimpleSchema({ | 96 | type: [new SimpleSchema({ |
97 | id: { type: String, }, | 97 | id: { type: String, }, |
98 | relatinship: { type: Boolean, }, | 98 | relatinship: { type: String, }, |
99 | })], | 99 | })], |
100 | optional: true | 100 | optional: true |
101 | }, | 101 | }, |
102 | prevInstitute: { | 102 | prevInstitute: { |
103 | type: [new SimpleSchema({ | 103 | type: [new SimpleSchema({ |
104 | name: { type: String, }, | 104 | name: { type: String, }, |
105 | fromYear: { type: Boolean, }, | 105 | fromYear: { type: String, }, |
106 | toYear: { type: Boolean, }, | 106 | toYear: { type: String, }, |
107 | ydId: { type: Boolean, }, | 107 | ydId: { type: String, }, |
108 | })], | 108 | })], |
109 | optional: true | 109 | optional: true |
110 | }, | 110 | }, |
111 | 111 | ||
112 | services: { | 112 | services: { |
113 | type: Object, | 113 | type: Object, |
114 | optional: true, | 114 | optional: true, |
115 | blackbox: true, | 115 | blackbox: true, |
116 | }, | 116 | }, |
117 | 117 | ||
118 | isMetaUser: { type: Boolean, optional: true }, | 118 | isMetaUser: { type: Boolean, optional: true }, |
119 | 119 | ||
120 | createdAt: { type: Date, autoValue: function(){return new Date();}} | 120 | createdAt: { type: Date, autoValue: function(){return new Date();}} |
121 | 121 | ||
122 | }); | 122 | }); |
123 | 123 | ||
124 | Students.attachSchema(Students.schema); | 124 | Students.attachSchema(Students.schema); |
125 | 125 | ||
126 | Students.privateFields = { | 126 | Students.privateFields = { |
127 | orgId: 1, | 127 | orgId: 1, |
128 | address: 1, | 128 | address: 1, |
129 | 129 | ||
130 | firstName: 1, | 130 | firstName: 1, |
131 | lastName: 1, | 131 | lastName: 1, |
132 | emails: 1, | 132 | emails: 1, |
133 | phones: 1, | 133 | phones: 1, |
134 | 134 | ||
135 | isMetaUser: 1, | 135 | isMetaUser: 1, |
136 | createdAt: 1, | 136 | createdAt: 1, |
137 | }; | 137 | }; |
138 | 138 | ||
139 | Students.publicFields = { | 139 | Students.publicFields = { |
140 | firstName: 1, | 140 | firstName: 1, |
141 | lastName: 1, | 141 | lastName: 1, |
142 | emails: 1, | 142 | emails: 1, |
143 | 143 | ||
144 | createdAt: 1, | 144 | createdAt: 1, |
145 | }; | 145 | }; |
146 | 146 |
imports/collections/students/methods.js
1 | // import { } from '/imports/collections/students/methods'; | 1 | // import { } from '/imports/collections/students/methods'; |
2 | import _ from 'lodash'; | 2 | import _ from 'lodash'; |
3 | import { Meteor } from 'meteor/meteor'; | 3 | import { Meteor } from 'meteor/meteor'; |
4 | import { ValidatedMethod } from 'meteor/mdg:validated-method'; | 4 | import { ValidatedMethod } from 'meteor/mdg:validated-method'; |
5 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | 5 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; |
6 | import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; | 6 | import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; |
7 | import { Bert } from 'meteor/themeteorchef:bert'; | 7 | import { Bert } from 'meteor/themeteorchef:bert'; |
8 | import { Users } from '/imports/collections/users/index'; | 8 | import { Users } from '/imports/collections/users/index'; |
9 | import { Students } from '/imports/collections/students/index'; | 9 | import { Students } from '/imports/collections/students/index'; |
10 | import { Parents } from '/imports/collections/parents/index'; | ||
10 | import { Orgs } from '/imports/collections/orgs/index'; | 11 | import { Orgs } from '/imports/collections/orgs/index'; |
11 | export const studentMethods = new ValidatedMethod({ | 12 | export const studentMethods = new ValidatedMethod({ |
12 | name: 'student.method', | 13 | name: 'student.method', |
13 | 14 | ||
14 | validate: new SimpleSchema({ | 15 | validate: new SimpleSchema({ |
15 | itemId: { type: String }, | 16 | itemId: { type: String }, |
16 | }).validator(), | 17 | }).validator(), |
17 | 18 | ||
18 | run({itemId}) { | 19 | run({itemId}) { |
19 | return {}; | 20 | return {}; |
20 | }, | 21 | }, |
21 | 22 | ||
22 | }); | 23 | }); |
23 | 24 | ||
24 | export const addStudentManually = new ValidatedMethod({ | 25 | export const addStudentManually = new ValidatedMethod({ |
25 | name: 'student.addManually', | 26 | name: 'student.addManually', |
26 | 27 | ||
27 | validate: new SimpleSchema({ | 28 | validate: new SimpleSchema({ |
28 | admissionId: { type: String }, | 29 | admissionId: { type: String }, |
29 | firstName: { type: String }, | 30 | firstName: { type: String }, |
30 | middleName: { type: String }, | 31 | middleName: { type: String }, |
31 | lastName: { type: String }, | 32 | lastName: { type: String }, |
32 | email: { type: String }, | 33 | email: { type: String }, |
33 | dob: { type: String }, | 34 | dob: { type: String }, |
34 | formattedDob: { type: String }, | 35 | formattedDob: { type: String }, |
35 | gender: { type: String }, | 36 | gender: { type: String }, |
36 | rollNo: { type: String }, | 37 | rollNo: { type: String }, |
37 | studentclass: { type: String }, | 38 | studentclass: { type: String }, |
38 | section: { type: String }, | 39 | section: { type: String }, |
39 | community: { type: String }, | 40 | community: { type: String }, |
40 | bloodGroup: { type: String }, | 41 | bloodGroup: { type: String }, |
41 | phone: { type: String }, | 42 | phone: { type: String }, |
42 | address: { type: String }, | 43 | address: { type: String }, |
43 | city: { type: String }, | 44 | city: { type: String }, |
44 | state: { type: String }, | 45 | state: { type: String }, |
45 | parentName: { type: String }, | 46 | parentName: { type: String }, |
46 | parentEmail: { type: String }, | 47 | parentEmail: { type: String }, |
47 | relation: { type: String }, | 48 | relation: { type: String }, |
48 | profession: { type: String }, | 49 | profession: { type: String }, |
49 | parentGender: { type: String }, | 50 | parentGender: { type: String }, |
50 | parentPhone: { type: String }, | 51 | parentPhone: { type: String }, |
51 | parentAddress: { type: String }, | 52 | parentAddress: { type: String }, |
52 | parentCity: { type: String }, | 53 | parentCity: { type: String }, |
53 | parentState: { type: String }, | 54 | parentState: { type: String }, |
54 | parentZipcode: { type: String }, | 55 | parentZipcode: { type: String }, |
55 | }).validator(), | 56 | }).validator(), |
56 | 57 | ||
57 | run(data) { | 58 | run(data) { |
58 | console.log("data"); | 59 | console.log("data"); |
59 | console.log(data); | 60 | console.log(data); |
60 | const user = Users.findOne({_id: this.userId}); | 61 | const user = Users.findOne({_id: this.userId}); |
61 | orgId = user.orgId; | 62 | orgId = user.orgId; |
62 | newStudentId = Users.insert({ | 63 | newStudentId = Users.insert({ |
63 | emails: [data.email], | 64 | emails: [{address:data.email, verified: false}], |
64 | username: firstName, | 65 | username: data.firstName, |
65 | firstName: firstName, | 66 | firstName: data.firstName, |
66 | middleName: middleName, | 67 | middleName: data.middleName, |
67 | lastName: lastName, | 68 | lastName: data.lastName, |
68 | orgId: orgId, | 69 | orgId: orgId, |
69 | role: 'STUDENT' | 70 | role: 'STUDENT' |
70 | }); | 71 | }); |
71 | newParentId = Users.insert({ | 72 | newParentUserId = Users.insert({ |
72 | emails: [data.parentEmail], | 73 | emails: [{address:data.parentEmail, verified: false}], |
73 | username: parentName, | 74 | username: data.parentName, |
74 | firstName: parentName, | 75 | firstName: data.parentName, |
75 | orgId: orgId, | 76 | orgId: orgId, |
76 | role: 'PARENT' | 77 | role: 'PARENT' |
77 | }); | 78 | }); |
79 | if(newParentUserId){ | ||
80 | newParentId = Parents.insert({ | ||
81 | userId: newParentUserId, | ||
82 | orgId: orgId, | ||
83 | address: data.address, | ||
84 | gender: data.gender, | ||
85 | dob: data.dob, | ||
86 | rollNo: data.rollNo, | ||
87 | class: data.studentclass, | ||
88 | section: data.section, | ||
89 | bloodGroup: data.bloodGroup, | ||
90 | community: data.community, | ||
91 | }); | ||
92 | console.log("newParentUserId"); | ||
93 | console.log(newParentUserId); | ||
94 | } | ||
78 | console.log("newUserId"); | 95 | console.log("newUserId"); |
79 | console.log(newUserId); | 96 | console.log(newStudentId); |
80 | if(newUserId){ | 97 | if(newStudentId){ |
81 | Students.insert({ | 98 | Students.insert({ |
82 | userId: newUserId, | 99 | userId: newStudentId, |
83 | orgId: orgId, | 100 | orgId: orgId, |
84 | admissionId: data.admissionId, | 101 | admissionId: data.admissionId, |
85 | address: data.address, | 102 | address: data.address, |
86 | gender: data.gender, | 103 | gender: data.gender, |
87 | dob: data.dob, | 104 | dob: data.dob, |
88 | rollNo: data.rollNo, | 105 | rollNo: data.rollNo, |
89 | class: data.studentclass, | 106 | class: data.studentclass, |
90 | section: data.section, | 107 | section: data.section, |
91 | bloodGroup: data.bloodGroup, | 108 | bloodGroup: data.bloodGroup, |
92 | community: data.community, | 109 | community: data.community, |
93 | 110 | parent: [{id: newParentUserId, relatinship: data.relation}] | |
94 | }); | 111 | }); |
95 | } | 112 | } |
96 | return {newUserId}; | 113 | return {newStudentId}; |
97 | }, | 114 | }, |
98 | 115 | ||
99 | }); | 116 | }); |
100 | 117 |