Commit 796a9c53f517c6c11c3a06ed6a8e597011fca904

Authored by Deepak
1 parent 1d1a74ecec
Exists in master

add student form

imports/client/views/org/admin/students/FabMenu.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 { FormGroup,Panel,Table, 6 import { FormGroup,Panel,Table,
7 ButtonToolbar,Modal, 7 ButtonToolbar,Modal,
8 FormControl,Glyphicon,Button } from 'react-bootstrap'; 8 FormControl,Glyphicon,Button } from 'react-bootstrap';
9 import { AddStudentForm } from './addStudentForm'; 9 import { AddStudentForm } from './addStudentForm';
10 import FloatingActionButton from 'material-ui/FloatingActionButton'; 10
11 import ContentAdd from 'material-ui/svg-icons/content/add';
12 const style = { 11 const style = {
13 marginRight: 20, 12 margin: 12,
14 }; 13 };
15 export class FabMenuView extends Component { 14 export class FabMenuView extends Component {
16
17 constructor(props) { 15 constructor(props) {
18 super(props); 16 super(props);
19 this.state = { 17 this.state = {
20 show: false 18 show: false
21 }; 19 };
22 this.onUpdate = this.onUpdate.bind(this); 20 this.onUpdate = this.onUpdate.bind(this);
23 }; 21 };
24 onUpdate(key, value) { 22 onUpdate(key, value) {
25 this.setState({[key]: value}); 23 this.setState({[key]: value});
26 }; 24 };
27 25
28 render() { 26 render() {
29 return ( 27 return (
30 <div> 28 <div>
31 <FloatingActionButton> 29 <Button bsStyle="primary">Add Student</Button>
32 <ContentAdd /> 30 <Button bsStyle="info">Upload CSV</Button>
33 </FloatingActionButton>
34 </div> 31 </div>
35 ); 32 );
36 }; 33 };
37 34
38 }; 35 };
39 36
imports/client/views/org/admin/students/StudentTable.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 { FormGroup,Panel,Table, 6 import { FormGroup,Panel,Table,
7 ButtonToolbar,Modal, 7 ButtonToolbar,Modal,
8 FormControl,Glyphicon,Button } from 'react-bootstrap'; 8 FormControl,Glyphicon,Button } from 'react-bootstrap';
9 import { AddStudentForm } from './addStudentForm'; 9 import { AddStudentForm } from './addStudentForm';
10 10
11 export class StudentTable extends Component { 11 export class StudentTable extends Component {
12 12
13 constructor(props) { 13 constructor(props) {
14 super(props); 14 super(props);
15 this.state = { 15 this.state = {
16 show: false 16 show: false
17 }; 17 };
18 this.onUpdate = this.onUpdate.bind(this); 18 this.onUpdate = this.onUpdate.bind(this);
19 }; 19 };
20 onUpdate(key, value) { 20 onUpdate(key, value) {
21 this.setState({[key]: value}); 21 this.setState({[key]: value});
22 }; 22 };
23 23
24 render() { 24 render() {
25 return ( 25 return (
26 <div className="panel panel-flat"> 26 <div className="panel panel-flat">
27 <div className="panel-heading"> 27 <div className="panel-heading">
28 <h5 className="panel-title">Student Details</h5> 28 <h5 className="panel-title">Student Details</h5>
29 <div className="heading-elements"> 29 <div className="heading-elements">
30 <ul className="icons-list"> 30 <ul className="icons-list">
31 <li><a data-action="collapse"></a></li> 31 <li><a data-action="collapse"></a></li>
32 <li><a data-action="reload"></a></li> 32 <li><a data-action="reload"></a></li>
33 </ul> 33 </ul>
34 </div> 34 </div>
35 </div> 35 </div>
36 36
37 37
38 <Table striped bordered condensed hover> 38 <Table striped bordered condensed hover>
39 <thead> 39 <thead>
40 <tr> 40 <tr>
41 <th>First Name</th> 41 <th>First Name</th>
42 <th>Last Name</th> 42 <th>Last Name</th>
43 <th>className</th> 43 <th>className</th>
44 <th>DOB</th> 44 <th>DOB</th>
45 <th>Status</th> 45 <th>Status</th>
46 <th className="text-center">Actions</th> 46 <th className="text-center">Actions</th>
47 </tr> 47 </tr>
48 </thead> 48 </thead>
49 <tbody> 49 <tbody>
50 { 50 {
51 this.props.data.students.map(function(student, i) 51 this.props.data.students.map(function(student, i)
52 { 52 {
53 return( 53 return(
54 <tr> 54 <tr key={i}>
55 <td>{student.firstName}</td> 55 <td>{student.firstName}</td>
56 <td>{student.lastName}</td> 56 <td>{student.lastName}</td>
57 <td>VII</td> 57 <td>VII</td>
58 <td>22 Jun 1972</td> 58 <td>22 Jun 1972</td>
59 <td><span className="label label-success">Active</span></td> 59 <td><span className="label label-success">Active</span></td>
60 <td className="text-center"> 60 <td className="text-center">
61 <ul className="icons-list"> 61 <ul className="icons-list">
62 <li className="dropdown"> 62 <li className="dropdown">
63 <a href="#" className="dropdown-toggle" data-toggle="dropdown"> 63 <a href="#" className="dropdown-toggle" data-toggle="dropdown">
64 <i className="icon-menu9"></i> 64 <i className="icon-menu9"></i>
65 </a> 65 </a>
66 66
67 <ul className="dropdown-menu dropdown-menu-right"> 67 <ul className="dropdown-menu dropdown-menu-right">
68 <li><a href="#"><i className="icon-file-pdf"></i> Export to .pdf</a></li> 68 <li><a href="#"><i className="icon-file-pdf"></i> Export to .pdf</a></li>
69 <li><a href="#"><i className="icon-file-excel"></i> Export to .csv</a></li> 69 <li><a href="#"><i className="icon-file-excel"></i> Export to .csv</a></li>
70 <li><a href="#"><i className="icon-file-word"></i> Export to .doc</a></li> 70 <li><a href="#"><i className="icon-file-word"></i> Export to .doc</a></li>
71 </ul> 71 </ul>
72 </li> 72 </li>
73 </ul> 73 </ul>
74 </td> 74 </td>
75 </tr> 75 </tr>
76 ) 76 )
77 }) 77 })
78 } 78 }
79 <tr> 79 <tr>
80 <td>Jackelyn</td> 80 <td>Jackelyn</td>
81 <td>Weible</td> 81 <td>Weible</td>
82 <td><a href="#">XI</a></td> 82 <td><a href="#">XI</a></td>
83 <td>3 Oct 1981</td> 83 <td>3 Oct 1981</td>
84 <td><span className="label label-default">Inactive</span></td> 84 <td><span className="label label-default">Inactive</span></td>
85 <td className="text-center"> 85 <td className="text-center">
86 <ul className="icons-list"> 86 <ul className="icons-list">
87 <li className="dropdown"> 87 <li className="dropdown">
88 <a href="#" className="dropdown-toggle" data-toggle="dropdown"> 88 <a href="#" className="dropdown-toggle" data-toggle="dropdown">
89 <i className="icon-menu9"></i> 89 <i className="icon-menu9"></i>
90 </a> 90 </a>
91 91
92 <ul className="dropdown-menu dropdown-menu-right"> 92 <ul className="dropdown-menu dropdown-menu-right">
93 <li><a href="#"><i className="icon-file-pdf"></i> Export to .pdf</a></li> 93 <li><a href="#"><i className="icon-file-pdf"></i> Export to .pdf</a></li>
94 <li><a href="#"><i className="icon-file-excel"></i> Export to .csv</a></li> 94 <li><a href="#"><i className="icon-file-excel"></i> Export to .csv</a></li>
95 <li><a href="#"><i className="icon-file-word"></i> Export to .doc</a></li> 95 <li><a href="#"><i className="icon-file-word"></i> Export to .doc</a></li>
96 </ul> 96 </ul>
97 </li> 97 </li>
98 </ul> 98 </ul>
99 </td> 99 </td>
100 </tr> 100 </tr>
101 </tbody> 101 </tbody>
102 </Table> 102 </Table>
103 </div> 103 </div>
104 ); 104 );
105 }; 105 };
106 106
107 }; 107 };
108 108
imports/client/views/org/admin/students/StudentView.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 { FormGroup,Panel,Table, 6 import { FormGroup,Panel,Table,
7 ButtonToolbar,Modal, 7 ButtonToolbar,Modal,
8 FormControl,Glyphicon,Button } from 'react-bootstrap'; 8 FormControl,Glyphicon,Button } from 'react-bootstrap';
9 import { AddStudentForm } from './addStudentForm'; 9 import { AddStudent } from './addStudent';
10 import { StudentTable } from './StudentTable'; 10 import { StudentTable } from './StudentTable';
11 import { Header } from './Header'; 11 import { Header } from './Header';
12 import { FabMenuView } from './FabMenu'; 12 import { FabMenuView } from './FabMenu';
13 13
14 export class StudentView extends Component { 14 export class StudentView extends Component {
15 15
16 constructor(props) { 16 constructor(props) {
17 super(props); 17 super(props);
18 this.state = { 18 this.state = {
19 show: false 19 show: false
20 }; 20 };
21 this.showModal = this.showModal.bind(this); 21 this.showModal = this.showModal.bind(this);
22 this.hideModal = this.hideModal.bind(this); 22 this.hideModal = this.hideModal.bind(this);
23 this.onUpdate = this.onUpdate.bind(this); 23 this.onUpdate = this.onUpdate.bind(this);
24 }; 24 };
25 25
26 showModal() { 26 showModal() {
27 this.setState({show: true}); 27 this.setState({show: true});
28 } 28 }
29 29
30 hideModal() { 30 hideModal() {
31 this.setState({show: false}); 31 this.setState({show: false});
32 } 32 }
33 onUpdate(key, value) { 33 onUpdate(key, value) {
34 this.setState({[key]: value}); 34 this.setState({[key]: value});
35 }; 35 };
36 36
37 render() { 37 render() {
38 return ( 38 return (
39 <div className="content has-detached-left"> 39 <div className="content has-detached-left">
40 <div className="container-detached"> 40 <div className="container-detached">
41 <div className="content-detached"> 41 <div className="content-detached">
42 <Header/> 42 <Header/>
43 <StudentTable 43 <StudentTable
44 data = {this.props.data} 44 data = {this.props.data}
45 /> 45 />
46 <FabMenuView/> 46 <AddStudent/>
47 47
48 </div> 48 </div>
49 </div> 49 </div>
50 <div className="sidebar-detached affix-top"> 50 <div className="sidebar-detached affix-top">
51 <div className="sidebar sidebar-default"> 51 <div className="sidebar sidebar-default">
52 <div className="sidebar-content"> 52 <div className="sidebar-content">
53 53
54 <div className="sidebar-category"> 54 <div className="sidebar-category">
55 <div className="category-title"> 55 <div className="category-title">
56 <span>Advanced Search</span> 56 <span>Advanced Search</span>
57 <ul className="icons-list"> 57 <ul className="icons-list">
58 <li><a href="#" data-action="collapse"></a></li> 58 <li><a href="#" data-action="collapse"></a></li>
59 </ul> 59 </ul>
60 </div> 60 </div>
61 61
62 <div className="category-content"> 62 <div className="category-content">
63 <form action="#"> 63 <form action="#">
64 <div className="has-feedback has-feedback-left"> 64 <div className="has-feedback has-feedback-left">
65 <input type="search" className="form-control" placeholder="First Name" /> 65 <input type="search" className="form-control" placeholder="First Name" />
66 <div className="form-control-feedback"> 66 <div className="form-control-feedback">
67 <i className="icon-search4 text-size-base text-muted"></i> 67 <i className="icon-search4 text-size-base text-muted"></i>
68 </div> 68 </div>
69 </div> 69 </div>
70 </form> 70 </form>
71 </div> 71 </div>
72 <div className="category-content"> 72 <div className="category-content">
73 <form action="#"> 73 <form action="#">
74 <div className="has-feedback has-feedback-left"> 74 <div className="has-feedback has-feedback-left">
75 <input type="search" className="form-control" placeholder="Last Name" /> 75 <input type="search" className="form-control" placeholder="Last Name" />
76 <div className="form-control-feedback"> 76 <div className="form-control-feedback">
77 <i className="icon-search4 text-size-base text-muted"></i> 77 <i className="icon-search4 text-size-base text-muted"></i>
78 </div> 78 </div>
79 </div> 79 </div>
80 </form> 80 </form>
81 </div> 81 </div>
82 <div className="category-content"> 82
83 <form action="#">
84 <div className="has-feedback has-feedback-left">
85 <div className="btn-group">
86 <button type="button" className="dropdown-toggle form-control" data-toggle="dropdown">
87 <span data-bind="label">Select className</span>&nbsp;<span className="caret"></span>
88 </button>
89 <ul className="dropdown-menu" role="menu">
90 <li><a href="#">Item 1</a></li>
91 <li><a href="#">Another item</a></li>
92 <li><a href="#">This is a longer item that will not fit properly</a></li>
93 </ul>
94 </div>
95 <div className="form-control-feedback">
96 <i className="icon-search4 text-size-base text-muted"></i>
97 </div>
98 </div>
99 </form>
100 </div>
101 </div> 83 </div>
102 84
103 85
104 </div> 86 </div>
105 </div> 87 </div>
106 </div> 88 </div>
107 </div> 89 </div>
108 ); 90 );
109 }; 91 };
110 92
111 }; 93 };
112 94
imports/client/views/org/admin/students/addStudent.js
File was created 1 import _ from 'lodash';
2 import { Meteor } from 'meteor/meteor';
3
4 import React, { Component } from 'react';
5 import { Link,browserHistory } from 'react-router';
6 import { FormGroup,Panel,Table,
7 ButtonToolbar,Modal,
8 FormControl,Glyphicon,Button } from 'react-bootstrap';
9 import { AddStudentForm } from './addStudentForm';
10
11 const style = {
12 margin: 12,
13 };
14 export class AddStudent extends Component {
15 constructor(props) {
16 super(props);
17 this.state = {
18 show: false
19 };
20 this.showModal = this.showModal.bind(this);
21 this.hideModal = this.hideModal.bind(this);
22 this.onUpdate = this.onUpdate.bind(this);
23 };
24
25 showModal() {
26 this.setState({show: true});
27 }
28
29 hideModal() {
30 this.setState({show: false});
31 }
32 onUpdate(key, value) {
33 this.setState({[key]: value});
34 };
35
36 render() {
37 return (
38 <div>
39 <ButtonToolbar>
40 <Button bsStyle="primary" onClick={this.showModal}>
41 Add Student
42 </Button>
43 <Modal
44 {...this.props}
45 show={this.state.show}
46 onHide={this.hideModal}
47 dialogClassName="custom-modal"
48 >
49 <Modal.Header closeButton>
50 <Modal.Title id="contained-modal-title-lg">New Student</Modal.Title>
51 </Modal.Header>
52 <Modal.Body>
53 <AddStudentForm />
54 </Modal.Body>
55 <Modal.Footer>
56 <Button onClick={this.hideModal}>Close</Button>
57 </Modal.Footer>
58 </Modal>
59 </ButtonToolbar>
60 </div>
61 );
62 };
63
64 };
65
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 { 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 firstName: "", 18 admissionId: "",
19 lastName: "", 19 firstName: "",
20 middleName: "", 20 lastName: "",
21 dob: "", 21 middleName: "",
22 email: "",
23 dob: "",
24 gender: "",
25 rollNo: "",
26 class: "",
27 section: "",
28 bloodGroup: "",
29 phone: "",
30 address: "",
31 city: "",
32 state: "",
33 parentName: "",
34 parentEmail: "",
35 relation: "",
36 profession: "",
37 parentGender: "",
38 parentPhone: "",
39 parentAddress: "",
40 parentCity: "",
41 parentState: "",
42 parentZipcode: "",
22 }; 43 };
23 this.onUpdate = this.onUpdate.bind(this); 44 this.onUpdate = this.onUpdate.bind(this);
24 this.aFunction = this.aFunction.bind(this);
25 }; 45 };
26 46
27 onUpdate(key, value) { 47 onUpdate(key, value) {
28 this.setState({[key]: value}); 48 this.setState({[key]: value});
29 }; 49 };
30 aFunction(e){
31 console.log(e);
32 console.log(e);
33 }
34 addStudent(e){ 50 addStudent(e){
35 e.preventDefault(); 51 e.preventDefault();
36 e.persist(); 52 e.persist();
37 const firstName = this.state.firstName; 53 const firstName = this.state.firstName;
38 const middleName = this.state.middleName; 54 const middleName = this.state.middleName;
39 const lastName = this.state.lastName; 55 const lastName = this.state.lastName;
40 if(firstName==""){ 56 if(firstName==""){
41 Bert.alert('Enter Fist Name', 'danger'); 57 Bert.alert('Enter Fist Name', 'danger');
42 } else if(middleName==""){ 58 } else if(middleName==""){
43 Bert.alert('Enter Middle name!', 'danger'); 59 Bert.alert('Enter Middle name!', 'danger');
44 } else{ 60 } else{
45 addStudentManually.call({ 61 addStudentManually.call({
46 firstName: firstName, 62 firstName: firstName,
47 middleName: middleName, 63 middleName: middleName,
48 lastName: lastName 64 lastName: lastName
49 }, function (error, result) { 65 }, function (error, result) {
50 console.log(error); 66 console.log(error);
51 console.log(result); 67 console.log(result);
52 }); 68 });
53 } 69 }
54 } 70 }
55 render() { 71 render() {
56 return ( 72 return (
57 <form onSubmit={ (e) => this.addStudent(e) }> 73 <Form onSubmit={ (e) => this.addStudent(e) }>
74 <FormGroup controlId="formBasicText">
75 <ControlLabel>Admission Id</ControlLabel>
76 <FormControl
77 type="text"
78 value={this.state.firstName}
79 placeholder="First Name"
80 onChange={e=>this.onUpdate('firstName',e.target.value)}
81 />
82 </FormGroup>
83
58 <FormGroup controlId="formBasicText"> 84 <FormGroup controlId="formBasicText">
59 <ControlLabel>First Name</ControlLabel> 85 <ControlLabel>First Name</ControlLabel>
60 <FormControl 86 <FormControl
61 type="text" 87 type="text"
62 value={this.state.firstName} 88 value={this.state.firstName}
63 placeholder="First Name" 89 placeholder="First Name"
64 onChange={e=>this.onUpdate('firstName',e.target.value)} 90 onChange={e=>this.onUpdate('firstName',e.target.value)}
65 /> 91 />
66 </FormGroup> 92 </FormGroup>
67 <FormGroup controlId="formBasicText"> 93 <FormGroup controlId="formBasicText">
68 <ControlLabel>Middle Name</ControlLabel> 94 <ControlLabel>Middle Name</ControlLabel>
69 <FormControl 95 <FormControl
70 type="text" 96 type="text"
71 value={this.state.middleName} 97 value={this.state.middleName}
72 placeholder="Middle Name" 98 placeholder="Middle Name"
73 onChange={e=>this.onUpdate('middleName',e.target.value)} 99 onChange={e=>this.onUpdate('middleName',e.target.value)}
74 /> 100 />
75 </FormGroup> 101 </FormGroup>
76 <FormGroup controlId="formBasicText"> 102 <FormGroup controlId="formBasicText">
77 <ControlLabel>Last Name</ControlLabel> 103 <ControlLabel>Last Name</ControlLabel>
78 <FormControl 104 <FormControl
79 type="text" 105 type="text"
80 value={this.state.lastName} 106 value={this.state.lastName}
81 placeholder="Last Name" 107 placeholder="Last Name"
82 onChange={e=>this.onUpdate('lastName',e.target.value)} 108 onChange={e=>this.onUpdate('lastName',e.target.value)}
83 /> 109 />
84 </FormGroup> 110 </FormGroup>
85 <Button type="submit" bsStyle="default">Add Student</Button> 111 <Button type="submit" bsStyle="default">Add Student</Button>
86 </form> 112 </Form>
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 { Orgs } from '/imports/collections/orgs/index'; 10 import { Orgs } from '/imports/collections/orgs/index';
11 export const studentMethods = new ValidatedMethod({ 11 export const studentMethods = new ValidatedMethod({
12 name: 'student.method', 12 name: 'student.method',
13 13
14 validate: new SimpleSchema({ 14 validate: new SimpleSchema({
15 itemId: { type: String }, 15 itemId: { type: String },
16 }).validator(), 16 }).validator(),
17 17
18 run({itemId}) { 18 run({itemId}) {
19 return {}; 19 return {};
20 }, 20 },
21 21
22 }); 22 });
23 23
24 export const addStudentManually = new ValidatedMethod({ 24 export const addStudentManually = new ValidatedMethod({
25 name: 'student.addManually', 25 name: 'student.addManually',
26 26
27 validate: new SimpleSchema({ 27 validate: new SimpleSchema({
28 firstName: { type: String }, 28 firstName: { type: String },
29 middleName: { type: String }, 29 middleName: { type: String },
30 lastName: { type: String }, 30 lastName: { type: String },
31 }).validator(), 31 }).validator(),
32 32
33 run({firstName,middleName,lastName}) { 33 run({firstName,middleName,lastName}) {
34 console.log(firstName);
35 console.log(middleName);
36 console.log(lastName);
37 const user = Users.findOne({_id: this.userId}); 34 const user = Users.findOne({_id: this.userId});
38 orgId = user.orgId; 35 orgId = user.orgId;
39 newUserId = Users.insert({ 36 newUserId = Users.insert({
40 username: firstName, 37 username: firstName,
41 firstName: firstName, 38 firstName: firstName,
42 middleName: middleName, 39 middleName: middleName,
43 lastName: lastName, 40 lastName: lastName,
44 orgId: orgId, 41 orgId: orgId,
45 role: 'STUDENT' 42 role: 'STUDENT'
46 }); 43 });
47 log(newUserId);
48 if(newUserId){ 44 if(newUserId){
49 Students.insert({ 45 Students.insert({
50 userId: newUserId, 46 userId: newUserId,
51 orgId: orgId, 47 orgId: orgId,
52 }); 48 });
53 } 49 }
54 return {newUserId}; 50 return {newUserId};
55 }, 51 },
56 52
57 }); 53 });
58 54