Commit d75229d74eb7c6b49ea71132bfff98541d069683

Authored by Deepak
1 parent 0c2ad31a0d
Exists in master

fixed dob issue and added teachers view

imports/client/views/core/DatePicker.js
1 import React, { Component, PropTypes } from 'react' 1 import React, { Component, PropTypes } from 'react'
2 import $ from 'jquery' 2 import $ from 'jquery'
3 import 'jquery-ui/ui/widgets/datepicker' 3 import 'jquery-ui/ui/widgets/datepicker'
4 4
5 class DatePicker extends Component { 5 class DatePicker extends Component {
6 componentDidMount() { 6 componentDidMount() {
7 SELF = this;
7 $('.datepicker').datepicker({ 8 $('.datepicker').datepicker({
8 changeMonth: true, 9 changeMonth: true,
9 changeYear: true, 10 changeYear: true,
10 showButtonPanel: true, 11 showButtonPanel: true,
11 yearRange: '-116:-1', 12 yearRange: '-25:-1',
12 dateFormat: 'dd/mm/yy' 13 dateFormat: 'dd/mm/yy',
14 onSelect: function(dateText, inst) {
15 var date = $(this).val();
16 // $("#datepickerDOB").val(date);
17 SELF.props.setValue('dob',date);
18 }
13 }); 19 });
14 } 20 }
15 21
16 render() { 22 render() {
17 return ( 23 return (
18 <input 24 <input
25 id="datepickerDOB"
19 type="text" 26 type="text"
20 className="datepicker form-control" 27 className="datepicker form-control"
21 placeholder="DD-MM-YYYY" 28 placeholder="DD-MM-YYYY"
22 onChange={this.props.onChange} 29 onChange={this.props.onChange}
23 value={this.props.value} 30 value={this.props.value}
24 /> 31 />
25 ) 32 )
26 } 33 }
27 } 34 }
28 35
29 DatePicker.propTypes = { 36 DatePicker.propTypes = {
30 value: PropTypes.string.isRequired, 37 value: PropTypes.string.isRequired,
31 onChange: PropTypes.func.isRequired, 38 onChange: PropTypes.func.isRequired,
32 } 39 }
33 40
34 export default DatePicker 41 export default DatePicker
35 42
imports/client/views/core/Form.js
1 import React, { Component, PropTypes } from 'react' 1 import React, { Component, PropTypes } from 'react'
2 import isEqual from 'lodash/isEqual' 2 import isEqual from 'lodash/isEqual'
3 import get from 'lodash/get' 3 import get from 'lodash/get'
4 import cloneDeep from 'lodash/cloneDeep' 4 import cloneDeep from 'lodash/cloneDeep'
5 import set from 'lodash/set' 5 import set from 'lodash/set'
6 6
7 // github.com/smalldots 7 // github.com/smalldots
8 class Form extends Component { 8 class Form extends Component {
9 constructor(props) { 9 constructor(props) {
10 super(props) 10 super(props)
11 this.state = { 11 this.state = {
12 values: props.initialValues || {}, 12 values: props.initialValues || {},
13 dirtyValues: [], 13 dirtyValues: [],
14 submitted: false 14 submitted: false
15 } 15 }
16 this.isPristine = this.isPristine.bind(this) 16 this.isPristine = this.isPristine.bind(this)
17 this.isDirty = this.isDirty.bind(this) 17 this.isDirty = this.isDirty.bind(this)
18 this.isSubmitted = this.isSubmitted.bind(this) 18 this.isSubmitted = this.isSubmitted.bind(this)
19 this.getValue = this.getValue.bind(this) 19 this.getValue = this.getValue.bind(this)
20 this.setValue = this.setValue.bind(this) 20 this.setValue = this.setValue.bind(this)
21 this.setPristine = this.setPristine.bind(this) 21 this.setPristine = this.setPristine.bind(this)
22 this.setDirty = this.setDirty.bind(this) 22 this.setDirty = this.setDirty.bind(this)
23 this.resetSubmitted = this.resetSubmitted.bind(this) 23 this.resetSubmitted = this.resetSubmitted.bind(this)
24 } 24 }
25 25
26 componentWillReceiveProps(nextProps) { 26 componentWillReceiveProps(nextProps) {
27 if (!isEqual(this.props.initialValues, nextProps.initialValues)) { 27 if (!isEqual(this.props.initialValues, nextProps.initialValues)) {
28 this.setState(prevState => ({ 28 this.setState(prevState => ({
29 values: { ...nextProps.initialValues, ...prevState.values } 29 values: { ...nextProps.initialValues, ...prevState.values }
30 })) 30 }))
31 } 31 }
32 } 32 }
33 33
34 isPristine(path) { 34 isPristine(path) {
35 if (path) { 35 if (path) {
36 return !this.state.dirtyValues.find(dirtyValue => dirtyValue === path) 36 return !this.state.dirtyValues.find(dirtyValue => dirtyValue === path)
37 } 37 }
38 return !this.state.dirtyValues.length 38 return !this.state.dirtyValues.length
39 } 39 }
40 40
41 isDirty(path) { 41 isDirty(path) {
42 return !this.isPristine(path) 42 return !this.isPristine(path)
43 } 43 }
44 44
45 isSubmitted() { 45 isSubmitted() {
46 return this.state.submitted 46 return this.state.submitted
47 } 47 }
48 48
49 resetSubmitted() { 49 resetSubmitted() {
50 this.setState({ submitted: false }) 50 this.setState({ submitted: false })
51 } 51 }
52 52
53 getValue(path) { 53 getValue(path) {
54 if (!path) { 54 if (!path) {
55 throw new Error(`getValue() requires a path`) 55 throw new Error(`getValue() requires a path`)
56 } 56 }
57 return get(this.state.values, path, '') 57 return get(this.state.values, path, '')
58 } 58 }
59 59
60 setValue (path, value) { 60 setValue (path, value) {
61 console.log(value);
61 if (!path) { 62 if (!path) {
62 throw new Error(`setValue() requires a path`) 63 throw new Error(`setValue() requires a path`)
63 } 64 }
64 if (value === undefined) { 65 if (value === undefined) {
65 throw new Error(`setValue() requires a non-undefined value`) 66 throw new Error(`setValue() requires a non-undefined value`)
66 } 67 }
67 this.setState(prevState => { 68 this.setState(prevState => {
68 const prevValues = prevState.values 69 const prevValues = prevState.values
69 // Lo-Dash's set() mutates the original value, so we need to make a copy 70 // Lo-Dash's set() mutates the original value, so we need to make a copy
70 const prevValuesCopy = cloneDeep(prevValues) 71 const prevValuesCopy = cloneDeep(prevValues)
71 const nextValues = set(prevValuesCopy, path, value) 72 const nextValues = set(prevValuesCopy, path, value)
72 return { values: nextValues } 73 return { values: nextValues }
73 }) 74 })
74 this.setDirty(path) 75 this.setDirty(path)
75 } 76 }
76 77
77 setPristine(path) { 78 setPristine(path) {
78 if (!path) { 79 if (!path) {
79 throw new Error(`setPristine() requires a path`) 80 throw new Error(`setPristine() requires a path`)
80 } 81 }
81 this.setState(prevState => ({ 82 this.setState(prevState => ({
82 dirtyValues: ( 83 dirtyValues: (
83 this.isPristine(path) 84 this.isPristine(path)
84 ? prevState.dirtyValues 85 ? prevState.dirtyValues
85 : prevState.dirtyValues.filter(dirtyValue => dirtyValue !== path) 86 : prevState.dirtyValues.filter(dirtyValue => dirtyValue !== path)
86 ) 87 )
87 })) 88 }))
88 } 89 }
89 90
90 setDirty(path) { 91 setDirty(path) {
91 if (!path) { 92 if (!path) {
92 throw new Error(`setDirty() requires a path`) 93 throw new Error(`setDirty() requires a path`)
93 } 94 }
94 this.setState(prevState => ({ 95 this.setState(prevState => ({
95 dirtyValues: ( 96 dirtyValues: (
96 this.isDirty(path) 97 this.isDirty(path)
97 ? prevState.dirtyValues 98 ? prevState.dirtyValues
98 : [...prevState.dirtyValues, path] 99 : [...prevState.dirtyValues, path]
99 ) 100 )
100 })) 101 }))
101 } 102 }
102 103
103 reset() { 104 reset() {
104 this.setState({ 105 this.setState({
105 values: this.props.initialValues, 106 values: this.props.initialValues,
106 dirtyValues: [], 107 dirtyValues: [],
107 submitted: false 108 submitted: false
108 }) 109 })
109 } 110 }
110 111
111 handleSubmit(event) { 112 handleSubmit(event) {
112 if (event) { 113 if (event) {
113 event.preventDefault() 114 event.preventDefault()
114 } 115 }
115 this.setState({ submitted: true }) 116 this.setState({ submitted: true })
116 if (this.props.onSubmit) { 117 if (this.props.onSubmit) {
117 this.props.onSubmit(this.state.values) 118 this.props.onSubmit(this.state.values)
118 } 119 }
119 } 120 }
120 121
121 render() { 122 render() {
122 // eslint-disable-next-line 123 // eslint-disable-next-line
123 const { initialValues, children, ...rest } = this.props 124 const { initialValues, children, ...rest } = this.props
124 return ( 125 return (
125 <form {...rest} onSubmit={this.handleSubmit}> 126 <form {...rest} onSubmit={this.handleSubmit}>
126 {children({ 127 {children({
127 values: this.state.values, 128 values: this.state.values,
128 isPristine: this.isPristine, 129 isPristine: this.isPristine,
129 isDirty: this.isDirty, 130 isDirty: this.isDirty,
130 isSubmitted: this.isSubmitted, 131 isSubmitted: this.isSubmitted,
131 getValue: this.getValue, 132 getValue: this.getValue,
132 setValue: this.setValue, 133 setValue: this.setValue,
133 setPristine: this.setPristine, 134 setPristine: this.setPristine,
134 setDirty: this.setDirty, 135 setDirty: this.setDirty,
135 reset: this.reset, 136 reset: this.reset,
136 resetSubmitted: this.resetSubmitted 137 resetSubmitted: this.resetSubmitted
137 })} 138 })}
138 </form> 139 </form>
139 ) 140 )
140 } 141 }
141 } 142 }
142 143
143 Form.propTypes = { 144 Form.propTypes = {
144 initialValues: PropTypes.object, 145 initialValues: PropTypes.object,
145 onSubmit: PropTypes.func, 146 onSubmit: PropTypes.func,
146 children: PropTypes.func.isRequired 147 children: PropTypes.func.isRequired
147 } 148 }
148 149
149 Form.defaultProps = { initialValues: {} } 150 Form.defaultProps = { initialValues: {} }
150 151
151 export default Form 152 export default Form
152 153
imports/client/views/org/admin/Breadcrumb.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 { Navbar,Modal, Nav, NavItem,
7 Glyphicon, Collapse, FormGroup, FormControl, Panel,
8 NavbarToggler, NavbarBrand, Table, ButtonToolbar,
9 NavLink, DropdownItem, DropdownToggle, DropdownMenu,
10 NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap';
11
12
13 export class AdminBreadcrumb extends Component {
14
15 constructor(props) {
16 super(props);
17 this.state = {
18
19 };
20 this.onUpdate = this.onUpdate.bind(this);
21 };
22
23 onUpdate(key, value) {
24 this.setState({[key]: value});
25 };
26
27 render() {
28 return (
29 <div className="page-header page-header-default">
30 <div className="breadcrumb-line">
31 <Breadcrumb>
32 <Breadcrumb.Item href="#">
33 <i className="icon-home2 position-left"></i> Users
34 </Breadcrumb.Item>
35 <Breadcrumb.Item active href="#">
36 Setup
37 </Breadcrumb.Item>
38 </Breadcrumb>
39
40 <ul className="breadcrumb-elements">
41 <NavItem href="#"><i className="icon-comment-discussion position-left"></i> Support</NavItem>
42 <NavDropdown title="Settings" id="setting">
43 <MenuItem><i className="icon-user-lock"></i> Account security</MenuItem>
44 <MenuItem><i className="icon-statistics"></i> Analytics</MenuItem>
45 <MenuItem><i className="icon-accessibility"></i> Accessibility</MenuItem>
46 <MenuItem divider/>
47 <MenuItem><i className="icon-gear"></i> All settings</MenuItem>
48 </NavDropdown>
49
50 </ul>
51 </div>
52 </div>
53 );
54 };
55
56 };
57
imports/client/views/org/admin/Header.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,
7 FormControl,Glyphicon,Button } from 'react-bootstrap';
8
9
10 export class Header extends Component {
11
12 constructor(props) {
13 super(props);
14 this.state = {
15
16 };
17 this.onUpdate = this.onUpdate.bind(this);
18 };
19
20 onUpdate(key, value) {
21 this.setState({[key]: value});
22 };
23
24 render() {
25 return (
26 <div className = "enterPane-box">
27 <div className="row">
28 <div className="col-lg-3 col-md-6">
29 <div className="thumbnail">
30 <Link to="/students" >
31 <div className="thumb thumb-rounded">
32 <img src="assets/images/download2.png" alt="" />
33 </div>
34 <div className="caption text-center">
35 <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6>
36 </div>
37 </Link>
38 </div>
39 </div>
40 <div className="col-lg-3 col-md-6">
41 <div className="thumbnail">
42 <Link to="/teachers" >
43 <div className="thumb thumb-rounded">
44 <img src="assets/images/download3.png" alt=""/>
45 </div>
46 <div className="caption text-center">
47 <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6>
48 </div>
49 </Link>
50 </div>
51 </div>
52
53 </div>
54 </div>
55 );
56 };
57
58 };
59
imports/client/views/org/admin/Sidebar.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 { Navbar,Modal, Nav, NavItem,
7 Glyphicon, Collapse, FormGroup, FormControl, Panel,
8 NavbarToggler, NavbarBrand, Table, ButtonToolbar,
9 NavLink, DropdownItem, DropdownToggle, DropdownMenu,
10 NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap';
11
12
13 export class AdminSidebar extends Component {
14
15 constructor(props) {
16 super(props);
17 this.state = {
18
19 };
20 this.onUpdate = this.onUpdate.bind(this);
21 };
22
23 onUpdate(key, value) {
24 this.setState({[key]: value});
25 };
26
27 render() {
28 const {user, org} = this.props;
29 return (
30 <div className="sidebar sidebar-main sidebar-default">
31 <div className="sidebar-content">
32 <div className="sidebar-category sidebar-category-visible">
33 <div className="category-content no-padding">
34 <Nav className="navigation navigation-main navigation-accordion">
35 <NavItem className="navigation-header"><span>#schoolname</span> <i className="icon-menu" title="Main pages"></i></NavItem>
36 <NavItem className="active" eventKey={1} href="#"><i className="icon-home4"></i> <span>Dashboard</span></NavItem>
37
38 <NavDropdown eventKey={2} title="Settings" name="Settings" id="setting">
39 <MenuItem eventKey={2.1}>Information</MenuItem>
40 <MenuItem eventKey={2.2}>Infrastructure</MenuItem>
41 <MenuItem eventKey={2.3}>Users</MenuItem>
42 <MenuItem eventKey={2.4}>Academic Settings</MenuItem>
43 <MenuItem eventKey={2.5}>Account Configuration</MenuItem>
44 </NavDropdown>
45 <NavDropdown eventKey={3} title="Academic" name="Academic" id="academic">
46 <MenuItem eventKey={3.1}>Layout 1</MenuItem>
47 <MenuItem eventKey={3.2}>Layout 2</MenuItem>
48 <MenuItem eventKey={3.3}>Layout 3</MenuItem>
49 <MenuItem eventKey={3.4}>Layout 4</MenuItem>
50 <MenuItem eventKey={3.5}>Layout 5</MenuItem>
51 </NavDropdown>
52 <NavDropdown eventKey={4} title="Communication" name="Communication" id="communication">
53 <MenuItem eventKey={4.1}>Primary palett</MenuItem>
54 <MenuItem eventKey={4.2}>Danger palett</MenuItem>
55 <MenuItem eventKey={4.3}>Success palett</MenuItem>
56 <MenuItem eventKey={4.4}>Warning palett</MenuItem>
57 <MenuItem divider />
58 <MenuItem eventKey={4.5}>Info palett</MenuItem>
59 <MenuItem eventKey={4.6}>Info palett</MenuItem>
60 <MenuItem eventKey={4.7}>Info palett</MenuItem>
61 <MenuItem eventKey={4.8}>Info palett</MenuItem>
62 </NavDropdown>
63 <NavDropdown eventKey={5} title="Finance" name="Finance" id="finance">
64 <MenuItem eventKey={5.1}>Primary palett</MenuItem>
65 <MenuItem eventKey={5.2}>Danger palett</MenuItem>
66 <MenuItem eventKey={5.3}>Success palett</MenuItem>
67 <MenuItem eventKey={5.4}>Warning palett</MenuItem>
68 <NavDropdown eventKey={5.5} title="Calumns" id="calumns">
69 <MenuItem>Success palett</MenuItem>
70 <MenuItem>Warning palett</MenuItem>
71 </NavDropdown>
72 </NavDropdown>
73
74 <NavItem eventKey={6} href="#"><i className="icon-file-stats"></i><span> Reports </span></NavItem>
75 <NavItem eventKey={7} href="#"><i className="icon-design"></i> <span>Examinations</span></NavItem>
76
77 </Nav>
78 </div>
79 </div>
80 </div>
81 </div>
82 );
83 };
84
85 };
86
imports/client/views/org/admin/students/AddStudentFormContainer.js
1 import React, { Component } from 'react' 1 import React, { Component } from 'react'
2 import { AddStudentForm } from './addStudentForm' 2 import { AddStudentForm } from './addStudentForm'
3 import StudentForm from './StudentForm' 3 import StudentForm from './StudentForm'
4 import Form from '/imports/client/views/core/Form' 4 import Form from '/imports/client/views/core/Form'
5 import Validator from '/imports/client/views/core/Validator' 5 import Validator from '/imports/client/views/core/Validator'
6 import { isRequired, isValidEmail } from '/imports/client/views/core/validations' 6 import { isRequired, isValidEmail } from '/imports/client/views/core/validations'
7 import { addStudentManually } from '/imports/collections/students/methods'; 7 import { addStudentManually } from '/imports/collections/students/methods';
8 8
9 export class AddStudentFormContainer extends Component { 9 export class AddStudentFormContainer extends Component {
10 10
11 constructor(props) { 11 constructor(props) {
12 super(props) 12 super(props)
13 this.state = { currentStep: 0 } 13 this.state = { currentStep: 0 }
14 this.handleNextClick = this.handleNextClick.bind(this) 14 this.handleNextClick = this.handleNextClick.bind(this)
15 this.handleBackClick = this.handleBackClick.bind(this) 15 this.handleBackClick = this.handleBackClick.bind(this)
16 this.handleSubmit = this.handleSubmit.bind(this) 16 this.handleSubmit = this.handleSubmit.bind(this)
17 } 17 }
18 18
19 handleNextClick() { 19 handleNextClick() {
20 this.form.handleSubmit() 20 this.form.handleSubmit()
21 if (this.validator.getErrors() && Object.keys(this.validator.getErrors()).length > 0) return 21 if (this.validator.getErrors() && Object.keys(this.validator.getErrors()).length > 0) return
22 this.setState({ currentStep: this.state.currentStep + 1 }) 22 this.setState({ currentStep: this.state.currentStep + 1 })
23 this.form.resetSubmitted() 23 this.form.resetSubmitted()
24 } 24 }
25 25
26 handleBackClick() { 26 handleBackClick() {
27 this.setState({ currentStep: this.state.currentStep + -1 }) 27 this.setState({ currentStep: this.state.currentStep + -1 })
28 } 28 }
29 29
30 handleSubmit() { 30 handleSubmit() {
31 if (this.state.currentStep === 3) { 31 if (this.state.currentStep === 3) {
32 addStudentManually.call(this.form.state.values) 32 addStudentManually.call(this.form.state.values)
33 } 33 }
34 } 34 }
35 35
36 //render callback 36 //render callback
37 render() { 37 render() {
38 return ( 38 return (
39 <Form 39 <Form
40 onSubmit={this.handleSubmit} 40 onSubmit={this.handleSubmit}
41 ref={form => this.form = form} 41 ref={form => this.form = form}
42 initialValues={{ 42 initialValues={{
43 gender: 'male', 43 gender: 'male',
44 parentGender: 'male', 44 parentGender: 'male',
45 }} 45 }}
46 > 46 >
47 {({ values, setValue, getValue, isSubmitted, isDirty }) => ( 47 {({ values, setValue, getValue, isSubmitted, isDirty }) => (
48 <Validator 48 <Validator
49 values={values} 49 values={values}
50 ref={validator => this.validator = validator} 50 ref={validator => this.validator = validator}
51 validations={{ 51 validations={{
52 admissionId: [(value) => isRequired('Admission id', value)], 52 admissionId: [(value) => isRequired('Admission id', value)],
53 firstName: [(value) => isRequired('First name', value)], 53 firstName: [(value) => isRequired('First name', value)],
54 middleName: [(value) => isRequired('Middle name', value)],
55 lastName: [(value) => isRequired('Last name', value)], 54 lastName: [(value) => isRequired('Last name', value)],
56 email: [(value) => isRequired('Email', value), isValidEmail], 55 email: [(value) => isRequired('Email', value), isValidEmail],
57 dob: [(value) => isRequired('Date of birth', value)], 56 dob: [(value) => isRequired('Date of birth', value)],
58 gender: [(value) => isRequired('Gender', value)], 57 gender: [(value) => isRequired('Gender', value)],
59 rollNo: [(value) => this.state.currentStep === 1 && isRequired('Roll no', value)], 58 rollNo: [(value) => this.state.currentStep === 1 && isRequired('Roll no', value)],
60 class: [(value) => this.state.currentStep === 1 && isRequired('Class', value)], 59 studentClass: [(value) => this.state.currentStep === 1 && isRequired('Class', value)],
61 section: [(value) => this.state.currentStep === 1 && isRequired('Section', value)], 60 section: [(value) => this.state.currentStep === 1 && isRequired('Section', value)],
62 community: [(value) => this.state.currentStep === 1 && isRequired('Community', value)], 61 community: [(value) => this.state.currentStep === 1 && isRequired('Community', value)],
63 bloodGroup: [(value) => this.state.currentStep === 1 && isRequired('Blood group', value)], 62 bloodGroup: [(value) => this.state.currentStep === 1 && isRequired('Blood group', value)],
64 phone: [(value) => this.state.currentStep === 1 && isRequired('Phone', value)], 63 phone: [(value) => this.state.currentStep === 1 && isRequired('Phone', value)],
65 address: [(value) => this.state.currentStep === 2 && isRequired('Address', value)], 64 address: [(value) => this.state.currentStep === 2 && isRequired('Address', value)],
66 city: [(value) => this.state.currentStep === 2 && isRequired('City', value)], 65 city: [(value) => this.state.currentStep === 2 && isRequired('City', value)],
67 state: [(value) => this.state.currentStep === 2 && isRequired('State', value)], 66 state: [(value) => this.state.currentStep === 2 && isRequired('State', value)],
68 parentName: [(value) => this.state.currentStep === 3 && isRequired('Parent name', value)], 67 parentName: [(value) => this.state.currentStep === 3 && isRequired('Parent name', value)],
69 parentEmail: [(value) => this.state.currentStep === 3 && isRequired('Parent email', value), (value) => this.state.currentStep === 3 && isValidEmail(value)], 68 parentEmail: [(value) => this.state.currentStep === 3 && isRequired('Parent email', value), (value) => this.state.currentStep === 3 && isValidEmail(value)],
70 relation: [(value) => this.state.currentStep === 3 && isRequired('Relation', value)], 69 relation: [(value) => this.state.currentStep === 3 && isRequired('Relation', value)],
71 profession: [(value) => this.state.currentStep === 3 && isRequired('Profession', value)], 70 profession: [(value) => this.state.currentStep === 3 && isRequired('Profession', value)],
72 parentGender: [(value) => this.state.currentStep === 3 && isRequired('Parent gender', value)], 71 parentGender: [(value) => this.state.currentStep === 3 && isRequired('Parent gender', value)],
73 parentPhone: [(value) => this.state.currentStep === 3 && isRequired('Parent phone', value)], 72 parentPhone: [(value) => this.state.currentStep === 3 && isRequired('Parent phone', value)],
74 parentAddress: [(value) => this.state.currentStep === 3 && isRequired('Parent address', value)], 73 parentAddress: [(value) => this.state.currentStep === 3 && isRequired('Parent address', value)],
75 parentCity: [(value) => this.state.currentStep === 3 && isRequired('Parent city', value)], 74 parentCity: [(value) => this.state.currentStep === 3 && isRequired('Parent city', value)],
76 parentState: [(value) => this.state.currentStep === 3 && isRequired('Parent state', value)], 75 parentState: [(value) => this.state.currentStep === 3 && isRequired('Parent state', value)],
77 parentZipcode: [(value) => this.state.currentStep === 3 && isRequired('Parent zip code', value)], 76 parentZipcode: [(value) => this.state.currentStep === 3 && isRequired('Parent zip code', value)],
78 }} 77 }}
79 > 78 >
80 {({ errors }) => ( 79 {({ errors }) => (
81 <StudentForm 80 <StudentForm
82 isDirty={isDirty} 81 isDirty={isDirty}
83 setValue={setValue} 82 setValue={setValue}
84 getValue={getValue} 83 getValue={getValue}
85 isSubmitted={isSubmitted} 84 isSubmitted={isSubmitted}
86 errors={errors} 85 errors={errors}
87 onNextClick={this.handleNextClick} 86 onNextClick={this.handleNextClick}
88 onBackClick={this.handleBackClick} 87 onBackClick={this.handleBackClick}
89 currentStep={this.state.currentStep} 88 currentStep={this.state.currentStep}
90 /> 89 />
91 )} 90 )}
92 </Validator> 91 </Validator>
93 )} 92 )}
94 </Form> 93 </Form>
95 ) 94 )
96 } 95 }
97 } 96 }
98 97
imports/client/views/org/admin/students/Header.js
1 import _ from 'lodash'; File was deleted
2 import { Meteor } from 'meteor/meteor';
3
4 import React, { Component } from 'react';
5 import { Link,browserHistory } from 'react-router';
6 import { FormGroup,
7 FormControl,Glyphicon,Button } from 'react-bootstrap';
8
9
10 export class Header extends Component {
11
12 constructor(props) {
13 super(props);
14 this.state = {
15
16 };
17 this.onUpdate = this.onUpdate.bind(this);
18 };
19
20 onUpdate(key, value) {
21 this.setState({[key]: value});
22 };
23
24 render() {
25 return (
26 <div className = "enterPane-box">
27 <div className="row">
28 <div className="col-lg-3 col-md-6">
29 <div className="panel panel-body">
30 <div className="media">
31 <div className="media-left">
32 <a href="assets/images/placeholder.png" data-popup="lightbox">
33 <img src="assets/images/download2.png" className="img-circle img-lg" alt="" />
34 </a>
35 </div>
36 <div className="media-body">
37 <h6 className="media-heading">Students</h6>
38 <span className="text-muted">Click to view</span>
39 </div>
40 </div>
41 </div>
42 </div>
43 <div className="col-lg-3 col-md-6">
44 <div className="panel panel-body">
45 <div className="media">
46 <div className="media-left">
47 <a href="assets/images/placeholder.jpg" data-popup="lightbox">
48 <img src="assets/images/download.png" className="img-circle img-lg" alt="" />
49 </a>
50 </div>
51
52 <div className="media-body">
53 <h6 className="media-heading">Teachers</h6>
54 <span className="text-muted">Click to view</span>
55 </div>
56 </div>
57 </div>
58 </div>
59
60 <div className="col-lg-3 col-md-6">
61 <div className="panel panel-body">
62 <div className="media">
63 <div className="media-left">
64 <a href="assets/images/placeholder.jpg" data-popup="lightbox">
65 <img src="assets/images/download3.png" className="img-circle img-lg" alt="" />
66 </a>
67 </div>
68
69 <div className="media-body">
70 <h6 className="media-heading">Parents</h6>
71 <span className="text-muted">Click to view</span>
72 </div>
73 </div>
74 </div>
75 </div>
76
77 <div className="col-lg-3 col-md-6">
78 <div className="panel panel-body">
79 <div className="media">
80 <div className="media-left">
81 <a href="assets/images/placeholder.jpg" data-popup="lightbox">
82 <img src="assets/images/download1.png" className="img-circle img-lg" alt="" />
83 </a>
84 </div>
85
86 <div className="media-body">
87 <h6 className="media-heading">Non Teaching Staff</h6>
88 <span className="text-muted">Click to view</span>
89 </div>
90 </div>
91 </div>
92 </div>
93 </div>
94 </div>
95 );
96 };
97
98 };
99 1 import _ from 'lodash';
imports/client/views/org/admin/students/StudentForm.js
1 import React, { PropTypes } from 'react' 1 import React, { PropTypes } from 'react'
2 import { 2 import {
3 Row, 3 Row,
4 Col, 4 Col,
5 FormGroup, 5 FormGroup,
6 FormControl, 6 FormControl,
7 Button 7 Button
8 } from 'react-bootstrap' 8 } from 'react-bootstrap'
9 import DatePicker from '/imports/client/views/core/DatePicker' 9 import DatePicker from '/imports/client/views/core/DatePicker'
10 import Label from '/imports/client/views/core/Label' 10 import Label from '/imports/client/views/core/Label'
11 import Stepper from '/imports/client/views/core/Stepper' 11 import Stepper from '/imports/client/views/core/Stepper'
12 import ErrorLabel from '/imports/client/views/core/ErrorLabel' 12 import ErrorLabel from '/imports/client/views/core/ErrorLabel'
13 13
14 const StudentForm = props => ( 14 const StudentForm = props => (
15 <div className="stepy-validation"> 15 <div className="stepy-validation">
16 <Stepper 16 <Stepper
17 steps={[ 17 steps={[
18 { 18 {
19 label: 'Personal data', 19 label: 'Personal data',
20 active: props.currentStep === 0, 20 active: props.currentStep === 0,
21 }, 21 },
22 { 22 {
23 label: 'Academic', 23 label: 'Academic',
24 active: props.currentStep === 1, 24 active: props.currentStep === 1,
25 }, 25 },
26 { 26 {
27 label: 'Address', 27 label: 'Address',
28 active: props.currentStep === 2, 28 active: props.currentStep === 2,
29 }, 29 },
30 { 30 {
31 label: 'Parent info', 31 label: 'Parent info',
32 active: props.currentStep === 3, 32 active: props.currentStep === 3,
33 } 33 }
34 ]} 34 ]}
35 /> 35 />
36 {props.currentStep === 0 && ( 36 {props.currentStep === 0 && (
37 <fieldset title="1"> 37 <fieldset title="1">
38 <legend className="text-semibold">Personal data</legend> 38 <legend className="text-semibold">Personal data</legend>
39 <Row> 39 <Row>
40 <Col xs={12} sm={6}> 40 <Col xs={12} sm={6}>
41 <FormGroup controlId="admissionId"> 41 <FormGroup controlId="admissionId">
42 <Label required>Admission Id</Label> 42 <Label required>Admission Id</Label>
43 <FormControl 43 <FormControl
44 type="text" 44 type="text"
45 value={props.getValue('admissionId')} 45 value={props.getValue('admissionId')}
46 placeholder="admission Id" 46 placeholder="admission Id"
47 onChange={e => props.setValue('admissionId', e.target.value)} 47 onChange={e => props.setValue('admissionId', e.target.value)}
48 /> 48 />
49 {props.isSubmitted() && props.errors && props.errors.admissionId && ( 49 {props.isSubmitted() && props.errors && props.errors.admissionId && (
50 <ErrorLabel> {props.errors.admissionId} </ErrorLabel> 50 <ErrorLabel> {props.errors.admissionId} </ErrorLabel>
51 )} 51 )}
52 </FormGroup> 52 </FormGroup>
53 </Col> 53 </Col>
54 <Col xs={12} sm={6}> 54 <Col xs={12} sm={6}>
55 <FormGroup controlId="firstName"> 55 <FormGroup controlId="firstName">
56 <Label required>First Name</Label> 56 <Label required>First Name</Label>
57 <FormControl 57 <FormControl
58 type="text" 58 type="text"
59 value={props.getValue('firstName')} 59 value={props.getValue('firstName')}
60 placeholder="First Name" 60 placeholder="First Name"
61 onChange={e => props.setValue('firstName', e.target.value)} 61 onChange={e => props.setValue('firstName', e.target.value)}
62 /> 62 />
63 {props.isSubmitted() && props.errors && props.errors.firstName && ( 63 {props.isSubmitted() && props.errors && props.errors.firstName && (
64 <ErrorLabel> {props.errors.firstName} </ErrorLabel> 64 <ErrorLabel> {props.errors.firstName} </ErrorLabel>
65 )} 65 )}
66 </FormGroup> 66 </FormGroup>
67 </Col> 67 </Col>
68 </Row> 68 </Row>
69 <Row> 69 <Row>
70 <Col xs={12} sm={6}> 70 <Col xs={12} sm={6}>
71 <FormGroup controlId="middleName"> 71 <FormGroup controlId="lastName">
72 <Label required>Middle Name</Label> 72 <Label required>Last Name</Label>
73 <FormControl 73 <FormControl
74 type="text" 74 type="text"
75 value={props.getValue('middleName')} 75 value={props.getValue('lastName')}
76 placeholder="Middle Name" 76 placeholder="Last Name"
77 onChange={e => props.setValue('middleName', e.target.value)} 77 onChange={e => props.setValue('lastName', e.target.value)}
78 /> 78 />
79 {props.isSubmitted() && props.errors && props.errors.middleName && ( 79 {props.isSubmitted() && props.errors && props.errors.lastName && (
80 <ErrorLabel> {props.errors.middleName} </ErrorLabel> 80 <ErrorLabel> {props.errors.lastName} </ErrorLabel>
81 )} 81 )}
82 </FormGroup> 82 </FormGroup>
83 </Col> 83 </Col>
84 <Col xs={12} sm={6}> 84 <Col xs={12} sm={6}>
85 <FormGroup controlId="lastName"> 85 <FormGroup controlId="formControlsSelect">
86 <Label required>Last Name</Label> 86 <Label>Gender</Label>
87 <FormControl 87 <FormControl componentClass="select"
88 type="text" 88 placeholder="select"
89 value={props.getValue('lastName')} 89 value={props.getValue('gender')}
90 placeholder="Last Name" 90 onChange={e => props.setValue('gender', e.target.value)}
91 onChange={e => props.setValue('lastName', e.target.value)} 91 >
92 /> 92 <option value="male">Male</option>
93 {props.isSubmitted() && props.errors && props.errors.lastName && ( 93 <option value="female">Female</option>
94 <ErrorLabel> {props.errors.lastName} </ErrorLabel> 94 </FormControl>
95 )} 95 {props.isSubmitted() && props.errors && props.errors.gender && (
96 </FormGroup> 96 <ErrorLabel> {props.errors.gender} </ErrorLabel>
97 </Col> 97 )}
98 </FormGroup>
99 </Col>
98 </Row> 100 </Row>
99 <Row> 101 <Row>
100 <Col xs={12} sm={6}> 102 <Col xs={12} sm={6}>
101 <FormGroup controlId="email"> 103 <FormGroup controlId="email">
102 <Label required>Email</Label> 104 <Label required>Email</Label>
103 <FormControl 105 <FormControl
104 type="email" 106 type="email"
105 value={props.getValue('email')} 107 value={props.getValue('email')}
106 placeholder="Email" 108 placeholder="Email"
107 onChange={e => props.setValue('email', e.target.value)} 109 onChange={e => props.setValue('email', e.target.value)}
108 /> 110 />
109 {props.isSubmitted() && props.errors && props.errors.email && ( 111 {props.isSubmitted() && props.errors && props.errors.email && (
110 <ErrorLabel> {props.errors.email} </ErrorLabel> 112 <ErrorLabel> {props.errors.email} </ErrorLabel>
111 )} 113 )}
112 </FormGroup> 114 </FormGroup>
113 </Col> 115 </Col>
114 <Col xs={12} sm={6}> 116 <Col xs={12} sm={6}>
115 <FormGroup> 117 <FormGroup>
116 <Label required>Date of birth</Label> 118 <Label required>Date of birth</Label>
117 <DatePicker 119 <DatePicker
118 id="dob" 120 id="dob"
121 setValue = {props.setValue}
119 value={props.getValue('dob')} 122 value={props.getValue('dob')}
120 onChange={(e) => { 123 onChange={(e) => {
121 props.setValue('dob', e.target.value) 124 props.setValue('dob', e.target.value)
122 }} 125 }}
123 /> 126 />
124 {props.isSubmitted() && props.errors && props.errors.dob && ( 127 {props.isSubmitted() && props.errors && props.errors.dob && (
125 <ErrorLabel> {props.errors.dob} </ErrorLabel> 128 <ErrorLabel> {props.errors.dob} </ErrorLabel>
126 )} 129 )}
127 </FormGroup> 130 </FormGroup>
128 </Col> 131 </Col>
129 </Row> 132 </Row>
130 <Row> 133 <Row>
131 <Col xs={12} sm={6}> 134
132 <FormGroup controlId="formControlsSelect">
133 <Label>Gender</Label>
134 <FormControl componentClass="select"
135 placeholder="select"
136 value={props.getValue('gender')}
137 onChange={e => props.setValue('gender', e.target.value)}
138 >
139 <option value="male">Male</option>
140 <option value="female">Female</option>
141 </FormControl>
142 {props.isSubmitted() && props.errors && props.errors.gender && (
143 <ErrorLabel> {props.errors.gender} </ErrorLabel>
144 )}
145 </FormGroup>
146 </Col>
147 </Row> 135 </Row>
148 </fieldset> 136 </fieldset>
149 )} 137 )}
150 {props.currentStep === 1 && ( 138 {props.currentStep === 1 && (
151 <fieldset title="Academic"> 139 <fieldset title="Academic">
152 <legend className="text-semibold">Academic</legend> 140 <legend className="text-semibold">Academic</legend>
153 <Row> 141 <Row>
154 <Col xs={12} sm={6}> 142 <Col xs={12} sm={6}>
155 <FormGroup controlId="rollNo"> 143 <FormGroup controlId="rollNo">
156 <Label required>Roll No</Label> 144 <Label required>Roll No</Label>
157 <FormControl 145 <FormControl
158 type="text" 146 type="text"
159 value={props.getValue('rollNo')} 147 value={props.getValue('rollNo')}
160 placeholder="Roll No" 148 placeholder="Roll No"
161 onChange={e => props.setValue('rollNo', e.target.value)} 149 onChange={e => props.setValue('rollNo', e.target.value)}
162 /> 150 />
163 {props.isSubmitted() && props.errors && props.errors.rollNo && ( 151 {props.isSubmitted() && props.errors && props.errors.rollNo && (
164 <ErrorLabel> {props.errors.rollNo} </ErrorLabel> 152 <ErrorLabel> {props.errors.rollNo} </ErrorLabel>
165 )} 153 )}
166 </FormGroup> 154 </FormGroup>
167 </Col> 155 </Col>
168 <Col xs={12} sm={6}> 156 <Col xs={12} sm={6}>
169 <FormGroup controlId="class"> 157 <FormGroup controlId="class">
170 <Label required>Class</Label> 158 <Label required>Class</Label>
171 <FormControl 159 <FormControl
172 type="text" 160 type="text"
173 value={props.getValue('class')} 161 value={props.getValue('studentClass')}
174 placeholder="7" 162 placeholder="7"
175 onChange={e => props.setValue('class', e.target.value)} 163 onChange={e => props.setValue('studentClass', e.target.value)}
176 /> 164 />
177 {props.isSubmitted() && props.errors && props.errors.class && ( 165 {props.isSubmitted() && props.errors && props.errors.studentClass && (
178 <ErrorLabel> {props.errors.class} </ErrorLabel> 166 <ErrorLabel> {props.errors.studentClass} </ErrorLabel>
179 )} 167 )}
180 </FormGroup> 168 </FormGroup>
181 </Col> 169 </Col>
182 </Row> 170 </Row>
183 <Row> 171 <Row>
184 <Col xs={12} sm={6}> 172 <Col xs={12} sm={6}>
185 <FormGroup controlId="section"> 173 <FormGroup controlId="section">
186 <Label required>Section</Label> 174 <Label required>Section</Label>
187 <FormControl 175 <FormControl
188 type="text" 176 type="text"
189 value={props.getValue('section')} 177 value={props.getValue('section')}
190 placeholder="B" 178 placeholder="B"
191 onChange={e => props.setValue('section', e.target.value)} 179 onChange={e => props.setValue('section', e.target.value)}
192 /> 180 />
193 {props.isSubmitted() && props.errors && props.errors.section && ( 181 {props.isSubmitted() && props.errors && props.errors.section && (
194 <ErrorLabel> {props.errors.section} </ErrorLabel> 182 <ErrorLabel> {props.errors.section} </ErrorLabel>
195 )} 183 )}
196 </FormGroup> 184 </FormGroup>
197 </Col> 185 </Col>
198 <Col xs={12} sm={6}> 186 <Col xs={12} sm={6}>
199 <FormGroup controlId="community"> 187 <FormGroup controlId="community">
200 <Label required>Community</Label> 188 <Label required>Community</Label>
201 <FormControl 189 <FormControl
202 type="text" 190 type="text"
203 value={props.getValue('community')} 191 value={props.getValue('community')}
204 placeholder="General" 192 placeholder="General"
205 onChange={e => props.setValue('community', e.target.value)} 193 onChange={e => props.setValue('community', e.target.value)}
206 /> 194 />
207 {props.isSubmitted() && props.errors && props.errors.community && ( 195 {props.isSubmitted() && props.errors && props.errors.community && (
208 <ErrorLabel> {props.errors.community} </ErrorLabel> 196 <ErrorLabel> {props.errors.community} </ErrorLabel>
209 )} 197 )}
210 </FormGroup> 198 </FormGroup>
211 </Col> 199 </Col>
212 </Row> 200 </Row>
213 <Row> 201 <Row>
214 <Col xs={12} sm={6}> 202 <Col xs={12} sm={6}>
215 <FormGroup controlId="bloodGroup"> 203 <FormGroup controlId="bloodGroup">
216 <Label required>bloodGroup</Label> 204 <Label required>bloodGroup</Label>
217 <FormControl 205 <FormControl
218 type="text" 206 type="text"
219 value={props.getValue('bloodGroup')} 207 value={props.getValue('bloodGroup')}
220 placeholder="B+" 208 placeholder="B+"
221 onChange={e => props.setValue('bloodGroup', e.target.value)} 209 onChange={e => props.setValue('bloodGroup', e.target.value)}
222 /> 210 />
223 {props.isSubmitted() && props.errors && props.errors.bloodGroup && ( 211 {props.isSubmitted() && props.errors && props.errors.bloodGroup && (
224 <ErrorLabel> {props.errors.bloodGroup} </ErrorLabel> 212 <ErrorLabel> {props.errors.bloodGroup} </ErrorLabel>
225 )} 213 )}
226 </FormGroup> 214 </FormGroup>
227 </Col> 215 </Col>
228 <Col xs={12} sm={6}> 216 <Col xs={12} sm={6}>
229 <FormGroup controlId="phone"> 217 <FormGroup controlId="phone">
230 <Label required>Phone</Label> 218 <Label required>Phone</Label>
231 <FormControl 219 <FormControl
232 type="text" 220 type="text"
233 value={props.getValue('phone')} 221 value={props.getValue('phone')}
234 placeholder="9999999999" 222 placeholder="9999999999"
235 onChange={e => props.setValue('phone', e.target.value)} 223 onChange={e => props.setValue('phone', e.target.value)}
236 /> 224 />
237 {props.isSubmitted() && props.errors && props.errors.phone && ( 225 {props.isSubmitted() && props.errors && props.errors.phone && (
238 <ErrorLabel> {props.errors.phone} </ErrorLabel> 226 <ErrorLabel> {props.errors.phone} </ErrorLabel>
239 )} 227 )}
240 </FormGroup> 228 </FormGroup>
241 </Col> 229 </Col>
242 </Row> 230 </Row>
243 </fieldset> 231 </fieldset>
244 )} 232 )}
245 {props.currentStep === 2 && ( 233 {props.currentStep === 2 && (
246 <fieldset title="Address"> 234 <fieldset title="Address">
247 <legend className="text-semibold">Address</legend> 235 <legend className="text-semibold">Address</legend>
248 <Row> 236 <Row>
249 <Col xs={12} sm={6}> 237 <Col xs={12} sm={6}>
250 <FormGroup controlId="address"> 238 <FormGroup controlId="address">
251 <Label required>Address</Label> 239 <Label required>Address</Label>
252 <FormControl 240 <FormControl
253 type="text" 241 type="text"
254 value={props.getValue('address')} 242 value={props.getValue('address')}
255 placeholder="#876, Street, town" 243 placeholder="#876, Street, town"
256 onChange={e => props.setValue('address', e.target.value)} 244 onChange={e => props.setValue('address', e.target.value)}
257 /> 245 />
258 {props.isSubmitted() && props.errors && props.errors.address && ( 246 {props.isSubmitted() && props.errors && props.errors.address && (
259 <ErrorLabel> {props.errors.address} </ErrorLabel> 247 <ErrorLabel> {props.errors.address} </ErrorLabel>
260 )} 248 )}
261 </FormGroup> 249 </FormGroup>
262 </Col> 250 </Col>
263 <Col xs={12} sm={6}> 251 <Col xs={12} sm={6}>
264 <FormGroup controlId="city"> 252 <FormGroup controlId="city">
265 <Label required>City</Label> 253 <Label required>City</Label>
266 <FormControl 254 <FormControl
267 type="text" 255 type="text"
268 value={props.getValue('city')} 256 value={props.getValue('city')}
269 placeholder="Chennai" 257 placeholder="Chennai"
270 onChange={e => props.setValue('city', e.target.value)} 258 onChange={e => props.setValue('city', e.target.value)}
271 /> 259 />
272 {props.isSubmitted() && props.errors && props.errors.city && ( 260 {props.isSubmitted() && props.errors && props.errors.city && (
273 <ErrorLabel> {props.errors.city} </ErrorLabel> 261 <ErrorLabel> {props.errors.city} </ErrorLabel>
274 )} 262 )}
275 </FormGroup> 263 </FormGroup>
276 </Col> 264 </Col>
277 </Row> 265 </Row>
278 <Row> 266 <Row>
279 <Col xs={12} sm={6}> 267 <Col xs={12} sm={6}>
280 <FormGroup controlId="state"> 268 <FormGroup controlId="state">
281 <Label required>State</Label> 269 <Label required>State</Label>
282 <FormControl 270 <FormControl
283 type="text" 271 type="text"
284 value={props.getValue('state')} 272 value={props.getValue('state')}
285 placeholder="Tamilnadu" 273 placeholder="Tamilnadu"
286 onChange={e => props.setValue('state', e.target.value)} 274 onChange={e => props.setValue('state', e.target.value)}
287 /> 275 />
288 {props.isSubmitted() && props.errors && props.errors.state && ( 276 {props.isSubmitted() && props.errors && props.errors.state && (
289 <ErrorLabel> {props.errors.state} </ErrorLabel> 277 <ErrorLabel> {props.errors.state} </ErrorLabel>
290 )} 278 )}
291 </FormGroup> 279 </FormGroup>
292 </Col> 280 </Col>
293 </Row> 281 </Row>
294 </fieldset> 282 </fieldset>
295 )} 283 )}
296 {props.currentStep === 3 && ( 284 {props.currentStep === 3 && (
297 <fieldset title="2"> 285 <fieldset title="2">
298 <legend className="text-semibold">Parent information</legend> 286 <legend className="text-semibold">Parent information</legend>
299 <Row> 287 <Row>
300 <Col xs={12} sm={6}> 288 <Col xs={12} sm={6}>
301 <FormGroup controlId="parentName"> 289 <FormGroup controlId="parentName">
302 <Label required>Parent Name</Label> 290 <Label required>Parent Name</Label>
303 <FormControl 291 <FormControl
304 type="text" 292 type="text"
305 value={props.getValue('parentName')} 293 value={props.getValue('parentName')}
306 placeholder="John" 294 placeholder="John"
307 onChange={e => props.setValue('parentName', e.target.value)} 295 onChange={e => props.setValue('parentName', e.target.value)}
308 /> 296 />
309 {props.isSubmitted() && props.errors && props.errors.parentName && ( 297 {props.isSubmitted() && props.errors && props.errors.parentName && (
310 <ErrorLabel> {props.errors.parentName} </ErrorLabel> 298 <ErrorLabel> {props.errors.parentName} </ErrorLabel>
311 )} 299 )}
312 </FormGroup> 300 </FormGroup>
313 </Col> 301 </Col>
314 <Col xs={12} sm={6}> 302 <Col xs={12} sm={6}>
315 <FormGroup controlId="parentEmail"> 303 <FormGroup controlId="parentEmail">
316 <Label required>Parent Email</Label> 304 <Label required>Parent Email</Label>
317 <FormControl 305 <FormControl
318 type="text" 306 type="text"
319 value={props.getValue('parentEmail')} 307 value={props.getValue('parentEmail')}
320 placeholder="john@email.com" 308 placeholder="john@email.com"
321 onChange={e => props.setValue('parentEmail', e.target.value)} 309 onChange={e => props.setValue('parentEmail', e.target.value)}
322 /> 310 />
323 {props.isSubmitted() && props.errors && props.errors.parentEmail && ( 311 {props.isSubmitted() && props.errors && props.errors.parentEmail && (
324 <ErrorLabel> {props.errors.parentEmail} </ErrorLabel> 312 <ErrorLabel> {props.errors.parentEmail} </ErrorLabel>
325 )} 313 )}
326 </FormGroup> 314 </FormGroup>
327 </Col> 315 </Col>
328 </Row> 316 </Row>
329 <Row> 317 <Row>
330 <Col xs={12} sm={6}> 318 <Col xs={12} sm={6}>
331 <FormGroup controlId="relation"> 319 <FormGroup controlId="relation">
332 <Label required>Relation</Label> 320 <Label required>Relation</Label>
333 <FormControl 321 <FormControl
334 type="text" 322 type="text"
335 value={props.getValue('relation')} 323 value={props.getValue('relation')}
336 placeholder="Father" 324 placeholder="Father"
337 onChange={e => props.setValue('relation', e.target.value)} 325 onChange={e => props.setValue('relation', e.target.value)}
338 /> 326 />
339 {props.isSubmitted() && props.errors && props.errors.relation && ( 327 {props.isSubmitted() && props.errors && props.errors.relation && (
340 <ErrorLabel> {props.errors.relation} </ErrorLabel> 328 <ErrorLabel> {props.errors.relation} </ErrorLabel>
341 )} 329 )}
342 </FormGroup> 330 </FormGroup>
343 </Col> 331 </Col>
344 <Col xs={12} sm={6}> 332 <Col xs={12} sm={6}>
345 <FormGroup controlId="profession"> 333 <FormGroup controlId="profession">
346 <Label required>Profession</Label> 334 <Label required>Profession</Label>
347 <FormControl 335 <FormControl
348 type="text" 336 type="text"
349 value={props.getValue('profession')} 337 value={props.getValue('profession')}
350 placeholder="Farmer" 338 placeholder="Farmer"
351 onChange={e => props.setValue('profession', e.target.value)} 339 onChange={e => props.setValue('profession', e.target.value)}
352 /> 340 />
353 {props.isSubmitted() && props.errors && props.errors.profession && ( 341 {props.isSubmitted() && props.errors && props.errors.profession && (
354 <ErrorLabel> {props.errors.profession} </ErrorLabel> 342 <ErrorLabel> {props.errors.profession} </ErrorLabel>
355 )} 343 )}
356 </FormGroup> 344 </FormGroup>
357 </Col> 345 </Col>
358 </Row> 346 </Row>
359 <Row> 347 <Row>
360 <Col xs={12} sm={6}> 348 <Col xs={12} sm={6}>
361 <FormGroup controlId="parentGender"> 349 <FormGroup controlId="parentGender">
362 <Label>Parent Gender</Label> 350 <Label>Parent Gender</Label>
363 <FormControl componentClass="select" 351 <FormControl componentClass="select"
364 placeholder="select" 352 placeholder="select"
365 value={props.getValue('parentGender')} 353 value={props.getValue('parentGender')}
366 onChange={e => props.setValue('parentGender', e.target.value)} 354 onChange={e => props.setValue('parentGender', e.target.value)}
367 > 355 >
368 <option value="male">Male</option> 356 <option value="male">Male</option>
369 <option value="female">Female</option> 357 <option value="female">Female</option>
370 </FormControl> 358 </FormControl>
371 {props.isSubmitted() && props.errors && props.errors.parentGender && ( 359 {props.isSubmitted() && props.errors && props.errors.parentGender && (
372 <ErrorLabel> {props.errors.parentGender} </ErrorLabel> 360 <ErrorLabel> {props.errors.parentGender} </ErrorLabel>
373 )} 361 )}
374 </FormGroup> 362 </FormGroup>
375 </Col> 363 </Col>
376 <Col xs={12} sm={6}> 364 <Col xs={12} sm={6}>
377 <FormGroup controlId="parentPhone"> 365 <FormGroup controlId="parentPhone">
378 <Label required>Parent Phone</Label> 366 <Label required>Parent Phone</Label>
379 <FormControl 367 <FormControl
380 type="text" 368 type="text"
381 value={props.getValue('parentPhone')} 369 value={props.getValue('parentPhone')}
382 placeholder="9876543210" 370 placeholder="9876543210"
383 onChange={e => props.setValue('parentPhone', e.target.value)} 371 onChange={e => props.setValue('parentPhone', e.target.value)}
384 /> 372 />
385 {props.isSubmitted() && props.errors && props.errors.parentPhone && ( 373 {props.isSubmitted() && props.errors && props.errors.parentPhone && (
386 <ErrorLabel> {props.errors.parentPhone} </ErrorLabel> 374 <ErrorLabel> {props.errors.parentPhone} </ErrorLabel>
387 )} 375 )}
388 </FormGroup> 376 </FormGroup>
389 </Col> 377 </Col>
390 </Row> 378 </Row>
391 <Row> 379 <Row>
392 <Col xs={12} sm={6}> 380 <Col xs={12} sm={6}>
393 <FormGroup controlId="parentAddress"> 381 <FormGroup controlId="parentAddress">
394 <Label required>Parent Address</Label> 382 <Label required>Parent Address</Label>
395 <FormControl 383 <FormControl
396 type="text" 384 type="text"
397 value={props.getValue('parentAddress')} 385 value={props.getValue('parentAddress')}
398 placeholder="#12, street, town" 386 placeholder="#12, street, town"
399 onChange={e => props.setValue('parentAddress', e.target.value)} 387 onChange={e => props.setValue('parentAddress', e.target.value)}
400 /> 388 />
401 {props.isSubmitted() && props.errors && props.errors.parentAddress && ( 389 {props.isSubmitted() && props.errors && props.errors.parentAddress && (
402 <ErrorLabel> {props.errors.parentAddress} </ErrorLabel> 390 <ErrorLabel> {props.errors.parentAddress} </ErrorLabel>
403 )} 391 )}
404 </FormGroup> 392 </FormGroup>
405 </Col> 393 </Col>
406 <Col xs={12} sm={6}> 394 <Col xs={12} sm={6}>
407 <FormGroup controlId="parentCity"> 395 <FormGroup controlId="parentCity">
408 <Label required>Parent City</Label> 396 <Label required>Parent City</Label>
409 <FormControl 397 <FormControl
410 type="text" 398 type="text"
411 value={props.getValue('parentCity')} 399 value={props.getValue('parentCity')}
412 placeholder="Chennai" 400 placeholder="Chennai"
413 onChange={e => props.setValue('parentCity', e.target.value)} 401 onChange={e => props.setValue('parentCity', e.target.value)}
414 /> 402 />
415 {props.isSubmitted() && props.errors && props.errors.parentCity && ( 403 {props.isSubmitted() && props.errors && props.errors.parentCity && (
416 <ErrorLabel> {props.errors.parentCity} </ErrorLabel> 404 <ErrorLabel> {props.errors.parentCity} </ErrorLabel>
417 )} 405 )}
418 </FormGroup> 406 </FormGroup>
419 </Col> 407 </Col>
420 </Row> 408 </Row>
421 <Row> 409 <Row>
410 <Col xs={12} sm={6}>
411 <FormGroup controlId="parentState">
412 <Label required>Parent State</Label>
413 <FormControl
414 type="text"
415 value={props.getValue('parentState')}
416 placeholder="600031"
417 onChange={e => props.setValue('parentState', e.target.value)}
418 />
419 {props.isSubmitted() && props.errors && props.errors.parentState && (
420 <ErrorLabel> {props.errors.parentState} </ErrorLabel>
421 )}
422 </FormGroup>
423 </Col>
422 <Col xs={12} sm={6}> 424 <Col xs={12} sm={6}>
423 <FormGroup controlId="parentZipcode"> 425 <FormGroup controlId="parentZipcode">
424 <Label required>Parent Zipcode</Label> 426 <Label required>Parent Zipcode</Label>
425 <FormControl 427 <FormControl
426 type="text" 428 type="text"
427 value={props.getValue('parentZipcode')} 429 value={props.getValue('parentZipcode')}
428 placeholder="600031" 430 placeholder="600031"
429 onChange={e => props.setValue('parentZipcode', e.target.value)} 431 onChange={e => props.setValue('parentZipcode', e.target.value)}
430 /> 432 />
431 {props.isSubmitted() && props.errors && props.errors.parentZipcode && ( 433 {props.isSubmitted() && props.errors && props.errors.parentZipcode && (
432 <ErrorLabel> {props.errors.parentZipcode} </ErrorLabel> 434 <ErrorLabel> {props.errors.parentZipcode} </ErrorLabel>
433 )} 435 )}
434 </FormGroup> 436 </FormGroup>
435 </Col> 437 </Col>
436 </Row> 438 </Row>
437 </fieldset> 439 </fieldset>
438 )} 440 )}
439 <div style={{ textAlign: 'left' }}> 441 <div style={{ textAlign: 'left' }}>
440 {props.currentStep > 0 && ( 442 {props.currentStep > 0 && (
441 <div style={{ display: 'inline-block', marginRight: 10 }}> 443 <div style={{ display: 'inline-block', marginRight: 10 }}>
442 <Button onClick={props.onBackClick}> 444 <Button onClick={props.onBackClick}>
443 <i className="icon-arrow-left13 position-left"></i> 445 <i className="icon-arrow-left13 position-left"></i>
444 BACK 446 BACK
445 </Button> 447 </Button>
446 448
447 </div> 449 </div>
448 )} 450 )}
449 {props.currentStep < 3 && ( 451 {props.currentStep < 3 && (
450 <div style={{ display: 'inline-block' }}> 452 <div style={{ display: 'inline-block' }}>
451 <Button 453 <Button
452 bsStyle="primary" 454 bsStyle="primary"
453 onClick={props.onNextClick} 455 onClick={props.onNextClick}
454 > 456 >
455 NEXT 457 NEXT
456 <i className="icon-arrow-right14 position-right" /> 458 <i className="icon-arrow-right14 position-right" />
457 </Button> 459 </Button>
458 </div> 460 </div>
459 )} 461 )}
460 {props.currentStep === 3 && ( 462 {props.currentStep === 3 && (
461 <div style={{ display: 'inline-block' }}> 463 <div style={{ display: 'inline-block' }}>
462 <Button 464 <Button
463 bsStyle="primary" 465 bsStyle="primary"
464 onClick={props.onNextClick} 466 onClick={props.onNextClick}
465 > 467 >
466 SAVE 468 SAVE
467 <i className="fa fa-check" /> 469 <i className="fa fa-check" />
468 </Button> 470 </Button>
469 </div> 471 </div>
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 { Navbar,Modal, Nav, NavItem, 6 import { Navbar,Modal, Nav, NavItem,
7 Glyphicon, Collapse, FormGroup, FormControl, Panel, 7 Glyphicon, Collapse, FormGroup, FormControl, Panel,
8 NavbarToggler, NavbarBrand, Table, ButtonToolbar, 8 NavbarToggler, NavbarBrand, Table, ButtonToolbar,
9 NavLink, DropdownItem, DropdownToggle, DropdownMenu, 9 NavLink, DropdownItem, DropdownToggle, DropdownMenu,
10 NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap'; 10 NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap';
11 import { AddStudent } from './addStudent';
12 import { StudentTable } from './view/StudentTable'; 11 import { StudentTable } from './view/StudentTable';
13 import { Header } from './Header'; 12 import { Header } from '../Header';
13 import { AdminSidebar } from '../Sidebar'
14 import { AdminBreadcrumb } from '../Breadcrumb'
14 import { FabMenuView } from './FabMenu'; 15 import { FabMenuView } from './FabMenu';
15 import { UploadCsv } from './UploadCsv'; 16 import { UploadCsv } from './UploadCsv';
17 import { AddStudent } from './addStudent';
16 import { Students } from '/imports/collections/students/index'; 18 import { Students } from '/imports/collections/students/index';
17 19
18 20
19 export class StudentView extends Component { 21 export class StudentView extends Component {
20 22
21 constructor(props) { 23 constructor(props) {
22 super(props); 24 super(props);
23 this.state = { 25 this.state = {
24 show: false, 26 show: false,
25 firstNameSearch: "", 27 firstNameSearch: "",
26 lastNameSearch: "", 28 lastNameSearch: "",
27 }; 29 };
28 this.showModal = this.showModal.bind(this); 30 this.showModal = this.showModal.bind(this);
29 this.hideModal = this.hideModal.bind(this); 31 this.hideModal = this.hideModal.bind(this);
30 this.onUpdate = this.onUpdate.bind(this); 32 this.onUpdate = this.onUpdate.bind(this);
31 }; 33 };
32 34
33 showModal() { 35 showModal() {
34 this.setState({show: true}); 36 this.setState({show: true});
35 } 37 }
36 38
37 hideModal() { 39 hideModal() {
38 this.setState({show: false}); 40 this.setState({show: false});
39 } 41 }
40 onUpdate(key, value) { 42 onUpdate(key, value) {
41 this.setState({[key]: value}); 43 this.setState({[key]: value});
42 }; 44 };
43 45
44 render() { 46 render() {
45 console.log(this.props);
46 firstNameSearch = this.state.firstNameSearch; 47 firstNameSearch = this.state.firstNameSearch;
47 lastNameSearch = this.state.lastNameSearch; 48 lastNameSearch = this.state.lastNameSearch;
48 var students =_.filter(this.props.data.students,function(item){ 49 var students =_.filter(this.props.data.students,function(item){
49 if(item.firstName){ 50 if(item.firstName){
50 return _.includes(item.firstName.toLowerCase(),firstNameSearch.toLowerCase()); 51 return _.includes(item.firstName.toLowerCase(),firstNameSearch.toLowerCase());
51 } 52 }
52 }); 53 });
53 return ( 54 return (
54 <div className="appLayout-box"> 55 <div className="appLayout-box">
55 <div className="page-container"> 56 <div className="page-container">
56 <div className="page-content"> 57 <div className="page-content">
57 <div className="sidebar sidebar-main sidebar-default"> 58 <AdminSidebar
58 <div className="sidebar-content"> 59 user = {this.props.data.user}
59 60 org = {this.props.data.org}
60 <div className="sidebar-category sidebar-category-visible"> 61 />
61 <div className="category-content no-padding">
62 <Nav className="navigation navigation-main navigation-accordion">
63 <NavItem className="navigation-header"><span>#schoolname</span> <i className="icon-menu" title="Main pages"></i></NavItem>
64 <NavItem className="active" eventKey={1} href="#"><i className="icon-home4"></i> <span>Dashboard</span></NavItem>
65
66 <NavDropdown eventKey={2} title="Settings" name="Settings" id="setting">
67 <MenuItem eventKey={2.1}>Information</MenuItem>
68 <MenuItem eventKey={2.2}>Infrastructure</MenuItem>
69 <MenuItem eventKey={2.3}>Users</MenuItem>
70 <MenuItem eventKey={2.4}>Academic Settings</MenuItem>
71 <MenuItem eventKey={2.5}>Account Configuration</MenuItem>
72 </NavDropdown>
73 <NavDropdown eventKey={3} title="Academic" name="Academic" id="academic">
74 <MenuItem eventKey={3.1}>Layout 1</MenuItem>
75 <MenuItem eventKey={3.2}>Layout 2</MenuItem>
76 <MenuItem eventKey={3.3}>Layout 3</MenuItem>
77 <MenuItem eventKey={3.4}>Layout 4</MenuItem>
78 <MenuItem eventKey={3.5}>Layout 5</MenuItem>
79 </NavDropdown>
80 <NavDropdown eventKey={4} title="Communication" name="Communication" id="communication">
81 <MenuItem eventKey={4.1}>Primary palett</MenuItem>
82 <MenuItem eventKey={4.2}>Danger palett</MenuItem>
83 <MenuItem eventKey={4.3}>Success palett</MenuItem>
84 <MenuItem eventKey={4.4}>Warning palett</MenuItem>
85 <MenuItem divider />
86 <MenuItem eventKey={4.5}>Info palett</MenuItem>
87 <MenuItem eventKey={4.6}>Info palett</MenuItem>
88 <MenuItem eventKey={4.7}>Info palett</MenuItem>
89 <MenuItem eventKey={4.8}>Info palett</MenuItem>
90 </NavDropdown>
91 <NavDropdown eventKey={5} title="Finance" name="Finance" id="finance">
92 <MenuItem eventKey={5.1}>Primary palett</MenuItem>
93 <MenuItem eventKey={5.2}>Danger palett</MenuItem>
94 <MenuItem eventKey={5.3}>Success palett</MenuItem>
95 <MenuItem eventKey={5.4}>Warning palett</MenuItem>
96 <NavDropdown eventKey={5.5} title="Calumns" id="calumns">
97 <MenuItem>Success palett</MenuItem>
98 <MenuItem>Warning palett</MenuItem>
99 </NavDropdown>
100 </NavDropdown>
101
102 <NavItem eventKey={6} href="#"><i className="icon-file-stats"></i><span> Reports </span></NavItem>
103 <NavItem eventKey={7} href="#"><i className="icon-design"></i> <span>Examinations</span></NavItem>
104
105 </Nav>
106 </div>
107 </div>
108 </div>
109 </div>
110 {/*end sidebar*/} 62 {/*end sidebar*/}
111 <div className="content-wrapper"> 63 <div className="content-wrapper">
112 <div className="page-header page-header-default"> 64 <AdminBreadcrumb />
113 <div className="breadcrumb-line">
114 <Breadcrumb>
115 <Breadcrumb.Item href="#">
116 <i className="icon-home2 position-left"></i> Users
117 </Breadcrumb.Item>
118 <Breadcrumb.Item active href="#">
119 Setup
120 </Breadcrumb.Item>
121 </Breadcrumb>
122
123 <ul className="breadcrumb-elements">
124 <NavItem href="#"><i className="icon-comment-discussion position-left"></i> Support</NavItem>
125 <NavDropdown title="Settings" id="setting">
126 <MenuItem><i className="icon-user-lock"></i> Account security</MenuItem>
127 <MenuItem><i className="icon-statistics"></i> Analytics</MenuItem>
128 <MenuItem><i className="icon-accessibility"></i> Accessibility</MenuItem>
129 <MenuItem divider/>
130 <MenuItem><i className="icon-gear"></i> All settings</MenuItem>
131 </NavDropdown>
132
133 </ul>
134 </div>
135 </div>
136 {/*content*/} 65 {/*content*/}
137 66
138 <div className="content has-detached-left"> 67 <div className="content has-detached-left">
139 <div className="container-detached"> 68 <div className="container-detached">
140 <div className="content-detached"> 69 <div className="content-detached">
141 <Header/> 70 <Header/>
142 <StudentTable 71 <StudentTable
143 data = {this.props.data} 72 data = {this.props.data}
144 students = {students} 73 students = {students}
145 /> 74 />
146 <AddStudent/> 75 <AddStudent/>
147 <UploadCsv /> 76 <UploadCsv />
148 </div> 77 </div>
149 </div> 78 </div>
150 <div className="sidebar-detached affix-top"> 79 <div className="sidebar-detached affix-top">
151 <div className="sidebar sidebar-default"> 80 <div className="sidebar sidebar-default">
152 <div className="sidebar-content"> 81 <div className="sidebar-content">
153 82
154 <div className="sidebar-category"> 83 <div className="sidebar-category">
155 <div className="category-title"> 84 <div className="category-title">
156 <span>Advanced Search</span> 85 <span>Advanced Search</span>
157 <ul className="icons-list"> 86 <ul className="icons-list">
158 <li><a href="#" data-action="collapse"></a></li> 87 <li><a href="#" data-action="collapse"></a></li>
159 </ul> 88 </ul>
160 </div> 89 </div>
161 90
162 <div className="category-content"> 91 <div className="category-content">
163 <form action="#"> 92 <form action="#">
164 <div className="has-feedback has-feedback-left"> 93 <div className="has-feedback has-feedback-left">
165 <input type="search" className="form-control" 94 <input type="search" className="form-control"
166 value={this.state.firstNameSearch} 95 value={this.state.firstNameSearch}
167 onChange={e=>this.onUpdate('firstNameSearch',e.target.value)} 96 onChange={e=>this.onUpdate('firstNameSearch',e.target.value)}
168 placeholder="First Name" 97 placeholder="First Name"
169 /> 98 />
170 <div className="form-control-feedback"> 99 <div className="form-control-feedback">
171 <i className="icon-search4 text-size-base text-muted"></i> 100 <i className="icon-search4 text-size-base text-muted"></i>
172 </div> 101 </div>
173 </div> 102 </div>
174 </form> 103 </form>
175 </div> 104 </div>
176 <div className="category-content"> 105 <div className="category-content">
177 <form action="#"> 106 <form action="#">
178 <div className="has-feedback has-feedback-left"> 107 <div className="has-feedback has-feedback-left">
179 <input type="search" className="form-control" 108 <input type="search" className="form-control"
180 value={this.state.lastNameSearch} 109 value={this.state.lastNameSearch}
181 onChange={e=>this.onUpdate('lastNameSearch',e.target.value)} 110 onChange={e=>this.onUpdate('lastNameSearch',e.target.value)}
182 placeholder="Last Name" /> 111 placeholder="Last Name" />
183 <div className="form-control-feedback"> 112 <div className="form-control-feedback">
184 <i className="icon-search4 text-size-base text-muted"></i> 113 <i className="icon-search4 text-size-base text-muted"></i>
185 </div> 114 </div>
186 </div> 115 </div>
187 </form> 116 </form>
188 </div> 117 </div>
189 </div> 118 </div>
190 </div> 119 </div>
191 </div> 120 </div>
192 </div> 121 </div>
193 </div> 122 </div>
194 </div> 123 </div>
195 </div> 124 </div>
196 </div> 125 </div>
197 </div> 126 </div>
198 ); 127 );
199 }; 128 };
imports/client/views/org/admin/teachers/index.js
1 // import { InviteSignupController } from '/imports/client/views/invite/signup/index' 1 // import { InviteSignupController } from '/imports/client/views/invite/signup/index'
2 import _ from 'lodash'; 2 import _ from 'lodash';
3 import { 3 import {
4 composeWithTracker, 4 composeWithTracker,
5 compose, 5 compose,
6 composeAll 6 composeAll
7 } from 'react-komposer'; 7 } from 'react-komposer';
8 import { Loading } from '/imports/client/components/Loading'; 8 import { Loading } from '/imports/client/components/Loading';
9 9
10 import { Orgs } from '/imports/collections/orgs/index'; 10 import { Orgs } from '/imports/collections/orgs/index';
11 import { Users } from '/imports/collections/users/index'; 11 import { Users } from '/imports/collections/users/index';
12 import { teachersView } from './teachersView'; 12 import { Teachers } from '/imports/collections/teachers/index';
13 import { TeachersView } from './TeachersView';
13 14
14 const meteorTick = (props, onData) => { 15 const meteorTick = (props, onData) => {
15 16
16 const handles = [ 17 const handles = [
17 Meteor.subscribe('users.current'), 18 Meteor.subscribe('users.current'),
18 Meteor.subscribe('orgs.current') 19 Meteor.subscribe('orgs.current')
19 ]; 20 ];
20 21
21 if(_.every(handles, (handle) => (handle.ready()) )) { 22 if(_.every(handles, (handle) => (handle.ready()) )) {
22 const user = Users.current(); 23 const user = Users.current();
23 const org = Orgs.current(); 24 const org = Orgs.current();
25 teachers = Users.find({"role":"TEACHER"}).fetch() ? Users.find({"role":"TEACHER"}).fetch() : "";
26 teachersData = Teachers.find().fetch() ? Teachers.find().fetch() : "";
27 for(var i=0; i< teachers.length; i++){
28 for(var j=0; j< teachers.length; j++){
29 if(teachers[i]._id == teachersData[j].userId){
30 teachers[i].class = teachersData[j].class;
31 teachers[i].dob = teachersData[j].dob;
32 }
33 }
34 }
24 onData(null, { 35 onData(null, {
25 data: { 36 data: {
26 user: user, 37 user: user,
27 org: org 38 org: org,
39 teachersData: teachersData,
40 teachers: teachers
28 }, 41 },
29 }); 42 });
30 } 43 }
31 44
32 return () => { 45 return () => {
33 _.each(handles, (handle) => handle.stop() ); 46 _.each(handles, (handle) => handle.stop() );
34 }; 47 };
35 }; 48 };
36 49
37 50
38 const reduxTick = (props, onData) => { 51 const reduxTick = (props, onData) => {
39 onData(null, { 52 onData(null, {
40 data: {} 53 data: {}
41 }); 54 });
42 }; 55 };
43 56
44 57
45 export const teachersViewController = composeAll( 58 export const teachersViewController = composeAll(
46 composeWithTracker(meteorTick, Loading), 59 composeWithTracker(meteorTick, Loading),
47 compose(reduxTick, Loading), 60 compose(reduxTick, Loading),
48 )(teachersView); 61 )(TeachersView);
49 62
imports/client/views/org/admin/teachers/teachersView.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, 6 import { FormGroup,
7 FormControl,Glyphicon,Button } from 'react-bootstrap'; 7 FormControl,Glyphicon,Button } from 'react-bootstrap';
8 import { Header } from '../Header';
9 import { AdminSidebar } from '../Sidebar'
10 import { AdminBreadcrumb } from '../Breadcrumb'
11 import { TeachersTable } from './view/TeachersTable'
8 12
9 13 export class TeachersView extends Component {
10 export class teachersView extends Component {
11
12 constructor(props) { 14 constructor(props) {
13 super(props); 15 super(props);
14 this.state = { 16 this.state = {
15 17
16 }; 18 };
17 this.onUpdate = this.onUpdate.bind(this); 19 this.onUpdate = this.onUpdate.bind(this);
18 }; 20 };
19 21
20 onUpdate(key, value) { 22 onUpdate(key, value) {
21 this.setState({[key]: value}); 23 this.setState({[key]: value});
22 }; 24 };
23 25
24 render() { 26 render() {
25 const {user, org} = this.props.data; 27 const {user, org} = this.props.data;
26 return ( 28 return (
27 <div className = "enterPane-box"> 29 <div className="appLayout-box">
30 <div className="page-container">
31 <div className="page-content">
32 <AdminSidebar
33 user = {this.props.data.user}
34 org = {this.props.data.org}
35 />
36 {/*end sidebar*/}
37 <div className="content-wrapper">
38 <AdminBreadcrumb />
39 {/*content*/}
40
41 <div className="content has-detached-left">
42 <div className="container-detached">
43 <div className="content-detached">
44 <Header/>
45 <TeachersTable
46 data = {this.props.data}
47 teachers = {teachers}
48 />
49 {
50 /**
51 <AddTeacher/>
52 <UploadCsvTeacher />
53 */
54 }
55 </div>
56 </div>
57 <div className="sidebar-detached affix-top">
58 <div className="sidebar sidebar-default">
59 <div className="sidebar-content">
60
61 <div className="sidebar-category">
62 <div className="category-title">
63 <span>Advanced Search</span>
64 <ul className="icons-list">
65 <li><a href="#" data-action="collapse"></a></li>
66 </ul>
67 </div>
28 68
69 <div className="category-content">
70 <form action="#">
71 <div className="has-feedback has-feedback-left">
72 <input type="search" className="form-control"
73 value={this.state.firstNameSearch}
74 onChange={e=>this.onUpdate('firstNameSearch',e.target.value)}
75 placeholder="First Name"
76 />
77 <div className="form-control-feedback">
78 <i className="icon-search4 text-size-base text-muted"></i>
79 </div>
80 </div>
81 </form>
82 </div>
83 <div className="category-content">
84 <form action="#">
85 <div className="has-feedback has-feedback-left">
86 <input type="search" className="form-control"
87 value={this.state.lastNameSearch}
88 onChange={e=>this.onUpdate('lastNameSearch',e.target.value)}
89 placeholder="Last Name" />
90 <div className="form-control-feedback">
91 <i className="icon-search4 text-size-base text-muted"></i>
92 </div>
93 </div>
94 </form>
95 </div>
96 </div>
97 </div>
98 </div>
99 </div>
100 </div>
101 </div>
102 </div>
103 </div>
29 </div> 104 </div>
30 ); 105 );
31 }; 106 };
32 107
imports/client/views/org/admin/teachers/view/TeachersRow.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,
7 FormControl,Glyphicon,Button } from 'react-bootstrap';
8
9
10 export class teachersRow extends Component {
11
12 constructor(props) {
13 super(props);
14 this.state = {
15
16 };
17 this.onUpdate = this.onUpdate.bind(this);
18 };
19
20 onUpdate(key, value) {
21 this.setState({[key]: value});
22 };
23
24 render() {
25 const {student} = this.props;
26 if(student.firstName){
27 return (
28 <tr>
29 <td>{student.firstName}</td>
30 <td>{student.lastName}</td>
31 <td>{student.class}</td>
32 <td>{student.dob? moment(student.dob).format("LL") : <span></span>}</td>
33 <td><span className="label label-success">Active</span></td>
34 <td className="text-center">
35 <ul className="icons-list">
36 <li className="dropdown">
37 <a href="#" className="dropdown-toggle" data-toggle="dropdown">
38 <i className="icon-menu9"></i>
39 </a>
40 <ul className="dropdown-menu dropdown-menu-right">
41 <li><a href="#"><i className="icon-file-pdf"></i> Export to .pdf</a></li>
42 <li><a href="#"><i className="icon-file-excel"></i> Export to .csv</a></li>
43 <li><a href="#"><i className="icon-file-word"></i> Export to .doc</a></li>
44 </ul>
45 </li>
46 </ul>
47 </td>
48 </tr>
49 );
50 }else {
51 return null;
52 }
53
54 };
55
56 };
57
imports/client/views/org/admin/teachers/view/TeachersTable.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 {moment} from 'meteor/momentjs:moment'
10 import {TeachersRow} from './TeachersRow'
11
12 export class TeachersTable extends Component {
13
14 constructor(props) {
15 super(props);
16 this.state = {
17 show: false
18 };
19 this.onUpdate = this.onUpdate.bind(this);
20 };
21 onUpdate(key, value) {
22 this.setState({[key]: value});
23 };
24
25 render() {
26 return (
27 <div className="panel panel-flat">
28 <div className="panel-heading">
29 <h5 className="panel-title">Teachers Details</h5>
30 <div className="heading-elements">
31 <ul className="icons-list">
32 <li><a data-action="collapse"></a></li>
33 <li><a data-action="reload"></a></li>
34 </ul>
35 </div>
36 </div>
37 <Table striped bordered condensed hover>
38 <thead>
39 <tr>
40 <th>First Name</th>
41 <th>Last Name</th>
42 <th>Class</th>
43 <th>DOB</th>
44 <th>Status</th>
45 <th className="text-center">Actions</th>
46 </tr>
47 </thead>
48 <tbody>
49 {
50 this.props.teachers.map(function(student, i)
51 {
52 return(
53 <TeachersRow
54 teacher = {teacher}
55 />
56 )
57 })
58 }
59 </tbody>
60 </Table>
61 </div>
62 );
63 };
64
65 };
66
imports/client/views/org/app/module/AppLayout.js
1 import _ from 'lodash'; 1 import _ from 'lodash';
2 import { Meteor } from 'meteor/meteor'; 2 import { Meteor } from 'meteor/meteor';
3 import React, { Component } from 'react'; 3 import React, { Component } from 'react';
4 import { Link } from 'react-router'; 4 import { Link } from 'react-router';
5 import { Avatar } from '/imports/client/components/Avatar'; 5 import { Avatar } from '/imports/client/components/Avatar';
6 import { Icon } from '/imports/client/components/Icon'; 6 import { Icon } from '/imports/client/components/Icon';
7 import classNames from 'classnames'; 7 import classNames from 'classnames';
8 import { EnterModule } from '/imports/client/views/org/enter/module/index'; 8 import { EnterModule } from '/imports/client/views/org/enter/module/index';
9 // import { VerifyModule } from '/imports/client/views/verify/module/index'; 9 // import { VerifyModule } from '/imports/client/views/verify/module/index';
10 import { Navbar,Modal, Nav, NavItem, 10 import { Navbar,Modal, Nav, NavItem,
11 Glyphicon, Collapse, 11 Glyphicon, Collapse,
12 NavbarToggler, NavbarBrand, 12 NavbarToggler, NavbarBrand,
13 NavLink, DropdownItem, DropdownToggle, DropdownMenu, 13 NavLink, DropdownItem, DropdownToggle, DropdownMenu,
14 NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; 14 NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap';
15 import { VerifyModule } from '/imports/client/views/verify/module/index' 15 import { VerifyModule } from '/imports/client/views/verify/module/index'
16 16
17 var Accordion = require('react-bootstrap').Accordion; 17 var Accordion = require('react-bootstrap').Accordion;
18 var Panel = require('react-bootstrap').Panel; 18 var Panel = require('react-bootstrap').Panel;
19 export class AppLayout extends Component { 19 export class AppLayout extends Component {
20 20
21 render() { 21 render() {
22 console.log(this.props); 22 console.log(this.props);
23 const {user} = this.props.data; 23 const {user} = this.props.data;
24 24
25 if(!user) { 25 if(!user) {
26 return ( 26 return (
27 <EnterModule 27 <EnterModule
28 pane = {this.props.location.query.enter} 28 pane = {this.props.location.query.enter}
29 location = {this.props.location} 29 location = {this.props.location}
30 /> 30 />
31 ); 31 );
32 } 32 }
33 if(!user.isEmailVerified()) { 33 if(!user.isEmailVerified()) {
34 return ( 34 return (
35 <VerifyModule 35 <VerifyModule
36 pane = {this.props.location.query.verify} 36 pane = {this.props.location.query.verify}
37 location = {this.props.location} 37 location = {this.props.location}
38 /> 38 />
39 ); 39 );
40 } 40 }
41 return ( 41 return (
42 42
43 <div className = "appLayout-box"> 43 <div className = "appLayout-box">
44 <div className="page-container"> 44 <div className="page-container">
45 <div className="page-content"> 45 <div className="page-content">
46 <div className="sidebar sidebar-main sidebar-default"> 46 <div className="sidebar sidebar-main sidebar-default">
47 <div className="sidebar-content"> 47 <div className="sidebar-content">
48 48
49 <div className="sidebar-category sidebar-category-visible"> 49 <div className="sidebar-category sidebar-category-visible">
50 <div className="category-content no-padding"> 50 <div className="category-content no-padding">
51 <Nav className="navigation navigation-main navigation-accordion"> 51 <Nav className="navigation navigation-main navigation-accordion">
52 <NavItem className="navigation-header"><span>#schoolname</span> <i className="icon-menu" title="Main pages"></i></NavItem> 52 <NavItem className="navigation-header"><span>#schoolname</span> <i className="icon-menu" title="Main pages"></i></NavItem>
53 <NavItem className="active" eventKey={1} href="#"><i className="icon-home4"></i> <span>Dashboard</span></NavItem> 53 <NavItem className="active" eventKey={1} href="#"><i className="icon-home4"></i> <span>Dashboard</span></NavItem>
54 54
55 <NavDropdown eventKey={2} title="Settings" name="Settings" id="setting"> 55 <NavDropdown eventKey={2} title="Settings" name="Settings" id="setting">
56 <MenuItem eventKey={2.1}>Information</MenuItem> 56 <MenuItem eventKey={2.1}>Information</MenuItem>
57 <MenuItem eventKey={2.2}>Infrastructure</MenuItem> 57 <MenuItem eventKey={2.2}>Infrastructure</MenuItem>
58 <MenuItem eventKey={2.3}>Users</MenuItem> 58 <MenuItem eventKey={2.3}>Users</MenuItem>
59 <MenuItem eventKey={2.4}>Academic Settings</MenuItem> 59 <MenuItem eventKey={2.4}>Academic Settings</MenuItem>
60 <MenuItem eventKey={2.5}>Account Configuration</MenuItem> 60 <MenuItem eventKey={2.5}>Account Configuration</MenuItem>
61 </NavDropdown> 61 </NavDropdown>
62 <NavDropdown eventKey={3} title="Academic" name="Academic" id="academic"> 62 <NavDropdown eventKey={3} title="Academic" name="Academic" id="academic">
63 <MenuItem eventKey={3.1}>Layout 1</MenuItem> 63 <MenuItem eventKey={3.1}>Layout 1</MenuItem>
64 <MenuItem eventKey={3.2}>Layout 2</MenuItem> 64 <MenuItem eventKey={3.2}>Layout 2</MenuItem>
65 <MenuItem eventKey={3.3}>Layout 3</MenuItem> 65 <MenuItem eventKey={3.3}>Layout 3</MenuItem>
66 <MenuItem eventKey={3.4}>Layout 4</MenuItem> 66 <MenuItem eventKey={3.4}>Layout 4</MenuItem>
67 <MenuItem eventKey={3.5}>Layout 5</MenuItem> 67 <MenuItem eventKey={3.5}>Layout 5</MenuItem>
68 </NavDropdown> 68 </NavDropdown>
69 <NavDropdown eventKey={4} title="Communication" name="Communication" id="communication"> 69 <NavDropdown eventKey={4} title="Communication" name="Communication" id="communication">
70 <MenuItem eventKey={4.1}>Primary palett</MenuItem> 70 <MenuItem eventKey={4.1}>Primary palett</MenuItem>
71 <MenuItem eventKey={4.2}>Danger palett</MenuItem> 71 <MenuItem eventKey={4.2}>Danger palett</MenuItem>
72 <MenuItem eventKey={4.3}>Success palett</MenuItem> 72 <MenuItem eventKey={4.3}>Success palett</MenuItem>
73 <MenuItem eventKey={4.4}>Warning palett</MenuItem> 73 <MenuItem eventKey={4.4}>Warning palett</MenuItem>
74 <MenuItem divider /> 74 <MenuItem divider />
75 <MenuItem eventKey={4.5}>Info palett</MenuItem> 75 <MenuItem eventKey={4.5}>Info palett</MenuItem>
76 <MenuItem eventKey={4.6}>Info palett</MenuItem> 76 <MenuItem eventKey={4.6}>Info palett</MenuItem>
77 <MenuItem eventKey={4.7}>Info palett</MenuItem> 77 <MenuItem eventKey={4.7}>Info palett</MenuItem>
78 <MenuItem eventKey={4.8}>Info palett</MenuItem> 78 <MenuItem eventKey={4.8}>Info palett</MenuItem>
79 </NavDropdown> 79 </NavDropdown>
80 <NavDropdown eventKey={5} title="Finance" name="Finance" id="finance"> 80 <NavDropdown eventKey={5} title="Finance" name="Finance" id="finance">
81 <MenuItem eventKey={5.1}>Primary palett</MenuItem> 81 <MenuItem eventKey={5.1}>Primary palett</MenuItem>
82 <MenuItem eventKey={5.2}>Danger palett</MenuItem> 82 <MenuItem eventKey={5.2}>Danger palett</MenuItem>
83 <MenuItem eventKey={5.3}>Success palett</MenuItem> 83 <MenuItem eventKey={5.3}>Success palett</MenuItem>
84 <MenuItem eventKey={5.4}>Warning palett</MenuItem> 84 <MenuItem eventKey={5.4}>Warning palett</MenuItem>
85 <NavDropdown eventKey={5.5} title="Calumns" id="calumns"> 85 <NavDropdown eventKey={5.5} title="Calumns" id="calumns">
86 <MenuItem>Success palett</MenuItem> 86 <MenuItem>Success palett</MenuItem>
87 <MenuItem>Warning palett</MenuItem> 87 <MenuItem>Warning palett</MenuItem>
88 </NavDropdown> 88 </NavDropdown>
89 </NavDropdown> 89 </NavDropdown>
90 90
91 <NavItem eventKey={6} href="#"><i className="icon-file-stats"></i><span> Reports </span></NavItem> 91 <NavItem eventKey={6} href="#"><i className="icon-file-stats"></i><span> Reports </span></NavItem>
92 <NavItem eventKey={7} href="#"><i className="icon-design"></i> <span>Examinations</span></NavItem> 92 <NavItem eventKey={7} href="#"><i className="icon-design"></i> <span>Examinations</span></NavItem>
93 93
94 </Nav> 94 </Nav>
95 </div> 95 </div>
96 </div> 96 </div>
97 </div> 97 </div>
98 </div> 98 </div>
99 {/*end sidebar*/} 99 {/*end sidebar*/}
100 <div className="content-wrapper"> 100 <div className="content-wrapper">
101 <div className="page-header page-header-default"> 101 <div className="page-header page-header-default">
102 <div className="breadcrumb-line"> 102 <div className="breadcrumb-line">
103 <Breadcrumb> 103 <Breadcrumb>
104 <Breadcrumb.Item href="#"> 104 <Breadcrumb.Item href="#">
105 <i className="icon-home2 position-left"></i> Users 105 <i className="icon-home2 position-left"></i> Users
106 </Breadcrumb.Item> 106 </Breadcrumb.Item>
107 <Breadcrumb.Item active href="#"> 107 <Breadcrumb.Item active href="#">
108 Setup 108 Setup
109 </Breadcrumb.Item> 109 </Breadcrumb.Item>
110 </Breadcrumb> 110 </Breadcrumb>
111 111
112 <ul className="breadcrumb-elements"> 112 <ul className="breadcrumb-elements">
113 <NavItem href="#"><i className="icon-comment-discussion position-left"></i> Support</NavItem> 113 <NavItem href="#"><i className="icon-comment-discussion position-left"></i> Support</NavItem>
114 <NavDropdown title="Settings" id="setting"> 114 <NavDropdown title="Settings" id="setting">
115 <MenuItem><i className="icon-user-lock"></i> Account security</MenuItem> 115 <MenuItem><i className="icon-user-lock"></i> Account security</MenuItem>
116 <MenuItem><i className="icon-statistics"></i> Analytics</MenuItem> 116 <MenuItem><i className="icon-statistics"></i> Analytics</MenuItem>
117 <MenuItem><i className="icon-accessibility"></i> Accessibility</MenuItem> 117 <MenuItem><i className="icon-accessibility"></i> Accessibility</MenuItem>
118 <MenuItem divider/> 118 <MenuItem divider/>
119 <MenuItem><i className="icon-gear"></i> All settings</MenuItem> 119 <MenuItem><i className="icon-gear"></i> All settings</MenuItem>
120 </NavDropdown> 120 </NavDropdown>
121 121
122 </ul> 122 </ul>
123 </div> 123 </div>
124 </div> 124 </div>
125 <div className="content"> 125 <div className="content">
126 126 <div className="row">
127 <div className="row"> 127 <div className="col-lg-3 col-md-6">
128 <div className="col-lg-3 col-md-6"> 128 <div className="thumbnail">
129 <div className="thumbnail"> 129 <Link to="/students" >
130 <Link to="/students" > 130 <div className="thumb thumb-rounded">
131 <div className="thumb thumb-rounded"> 131 <img src="assets/images/download2.png" alt="" />
132 <img src="assets/images/download2.png" alt="" /> 132 </div>
133 133 <div className="caption text-center">
134 </div> 134 <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6>
135 135 </div>
136 <div className="caption text-center"> 136 </Link>
137 <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> 137 </div>
138 138 </div>
139 </div> 139 <div className="col-lg-3 col-md-6">
140 </Link> 140 <div className="thumbnail">
141 </div> 141 <Link to="/teachers" >
142 </div> 142 <div className="thumb thumb-rounded">
143 143 <img src="assets/images/download3.png" alt=""/>
144 <div className="col-lg-3 col-md-6"> 144 </div>
145 <div className="thumbnail"> 145 <div className="caption text-center">
146 <Link to="/students" > 146 <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6>
147 <div className="thumb thumb-rounded"> 147 </div>
148 <img src="assets/images/download.png" alt="" /> 148 </Link>
149 </div> 149 </div>
150 150 </div>
151 <div className="caption text-center"> 151
152 <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> 152 </div>
153 </div> 153 </div>
154 </Link>
155 </div>
156 </div>
157
158 <div className="col-lg-3 col-md-6">
159 <div className="thumbnail">
160 <a href="userprofileparents.html">
161 <div className="thumb thumb-rounded">
162 <img src="assets/images/download3.png" alt=""/>
163 </div>
164
165 <div className="caption text-center">
166 <h6 className="text-semibold no-margin">Parents <small className="display-block">Click to view</small></h6>
167 </div>
168 </a>
169 </div>
170 </div>
171
172 <div className="col-lg-3 col-md-6">
173 <div className="thumbnail">
174 <a href="#">
175 <div className="thumb thumb-rounded">
176 <img src="assets/images/download1.png" alt="" />
177 </div>
178
179 <div className="caption text-center">
180 <h6 className="text-semibold no-margin">Non-Teaching Staff <small className="display-block">Click to view</small></h6>
181 </div>
182 </a>
183 </div>
184 </div>
185 </div>
186
187 </div>
188 </div> 154 </div>
189 </div> 155 </div>
190 </div> 156 </div>
191 157
192 <div className = "appLayout-wrapOuter"> 158 <div className = "appLayout-wrapOuter">
193 <div className = "appLayout-wrapInner"> 159 <div className = "appLayout-wrapInner">
194 <div className = "appLayout-menuWrap"> 160 <div className = "appLayout-menuWrap">
195 161
196 </div> 162 </div>
197 <div className = "appLayout-contentWrap"> 163 <div className = "appLayout-contentWrap">
198 <div className = "appLayout-content"> 164 <div className = "appLayout-content">
199 165
200 </div> 166 </div>
201 </div> 167 </div>
202 </div> 168 </div>
203 </div> 169 </div>
204 </div> 170 </div>
205 ); 171 );
206 }; 172 };
207 173
208 }; 174 };
209 175
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 { Parents } from '/imports/collections/parents/index';
11 import { Orgs } from '/imports/collections/orgs/index'; 11 import { Orgs } from '/imports/collections/orgs/index';
12 export const studentMethods = new ValidatedMethod({ 12 export const studentMethods = new ValidatedMethod({
13 name: 'student.method', 13 name: 'student.method',
14 14
15 validate: new SimpleSchema({ 15 validate: new SimpleSchema({
16 itemId: { type: String }, 16 itemId: { type: String },
17 }).validator(), 17 }).validator(),
18 18
19 run({itemId}) { 19 run({itemId}) {
20 return {}; 20 return {};
21 }, 21 },
22 22
23 }); 23 });
24 24
25 export const addStudentManually = new ValidatedMethod({ 25 export const addStudentManually = new ValidatedMethod({
26 name: 'student.addManually', 26 name: 'student.addManually',
27 27
28 validate: new SimpleSchema({ 28 validate: new SimpleSchema({
29 admissionId: { type: String }, 29 admissionId: { type: String },
30 firstName: { type: String }, 30 firstName: { type: String },
31 middleName: { type: String },
32 lastName: { type: String }, 31 lastName: { type: String },
33 email: { type: String }, 32 email: { type: String },
34 dob: { type: String }, 33 dob: { type: String },
35 formattedDob: { type: String },
36 gender: { type: String }, 34 gender: { type: String },
37 rollNo: { type: String }, 35 rollNo: { type: String },
38 studentclass: { type: String }, 36 studentClass: { type: String },
39 section: { type: String }, 37 section: { type: String },
40 community: { type: String }, 38 community: { type: String },
41 bloodGroup: { type: String }, 39 bloodGroup: { type: String },
42 phone: { type: String }, 40 phone: { type: String },
43 address: { type: String }, 41 address: { type: String },
44 city: { type: String }, 42 city: { type: String },
45 state: { type: String }, 43 state: { type: String },
46 parentName: { type: String }, 44 parentName: { type: String },
47 parentEmail: { type: String }, 45 parentEmail: { type: String },
48 relation: { type: String }, 46 relation: { type: String },
49 profession: { type: String }, 47 profession: { type: String },
50 parentGender: { type: String }, 48 parentGender: { type: String },
51 parentPhone: { type: String }, 49 parentPhone: { type: String },
52 parentAddress: { type: String }, 50 parentAddress: { type: String },
53 parentCity: { type: String }, 51 parentCity: { type: String },
54 parentState: { type: String }, 52 parentState: { type: String },
55 parentZipcode: { type: String }, 53 parentZipcode: { type: String },
56 }).validator(), 54 }).validator(),
57 55
58 run(data) { 56 run(data) {
59 console.log("data"); 57 console.log("data");
60 console.log(data); 58 console.log(data);
61 const user = Users.findOne({_id: this.userId}); 59 const user = Users.findOne({_id: this.userId});
62 orgId = user.orgId; 60 orgId = user.orgId;
63 newStudentId = Users.insert({ 61 newStudentId = Users.insert({
64 emails: [{address:data.email, verified: false}], 62 emails: [{address:data.email, verified: false}],
65 username: data.firstName,
66 firstName: data.firstName, 63 firstName: data.firstName,
67 middleName: data.middleName,
68 lastName: data.lastName, 64 lastName: data.lastName,
69 orgId: orgId, 65 orgId: orgId,
70 role: 'STUDENT' 66 role: 'STUDENT'
71 }); 67 });
72 newParentUserId = Users.insert({ 68 newParentUserId = Users.insert({
73 emails: [{address:data.parentEmail, verified: false}], 69 emails: [{address:data.parentEmail, verified: false}],
74 username: data.parentName,
75 firstName: data.parentName, 70 firstName: data.parentName,
76 orgId: orgId, 71 orgId: orgId,
77 role: 'PARENT' 72 role: 'PARENT'
78 }); 73 });
79 if(newParentUserId){ 74 if(newParentUserId){
80 newParentId = Parents.insert({ 75 newParentId = Parents.insert({
81 userId: newParentUserId, 76 userId: newParentUserId,
82 orgId: orgId, 77 orgId: orgId,
83 address: data.address, 78 address: data.address,
84 gender: data.gender, 79 gender: data.gender,
85 dob: data.dob, 80 dob: data.dob,
86 rollNo: data.rollNo, 81 rollNo: data.rollNo,
87 class: data.studentclass, 82 studentClass: data.studentClass,
88 section: data.section, 83 section: data.section,
89 bloodGroup: data.bloodGroup, 84 bloodGroup: data.bloodGroup,
90 community: data.community, 85 community: data.community,
91 }); 86 });
92 } 87 }
93 if(newStudentId){ 88 if(newStudentId){
94 Students.insert({ 89 Students.insert({
95 userId: newStudentId, 90 userId: newStudentId,
96 orgId: orgId, 91 orgId: orgId,
97 admissionId: data.admissionId, 92 admissionId: data.admissionId,
98 address: data.address, 93 address: data.address,
99 gender: data.gender, 94 gender: data.gender,
100 dob: data.dob, 95 dob: data.dob,
101 rollNo: data.rollNo, 96 rollNo: data.rollNo,
102 class: data.studentclass, 97 class: data.studentClass,
103 section: data.section, 98 section: data.section,
104 bloodGroup: data.bloodGroup, 99 bloodGroup: data.bloodGroup,
105 community: data.community, 100 community: data.community,
106 parent: [{id: newParentUserId, relatinship: data.relation}] 101 parent: [{id: newParentUserId, relatinship: data.relation}]
107 }); 102 });
108 } 103 }
109 return {newStudentId}; 104 return {newStudentId};
110 }, 105 },
111 106
112 }); 107 });
113 108
imports/collections/teachers/index.js
File was created 1 // import {Parents } from '/imports/collections/parents/index'
2
3 import _ from 'lodash';
4 import { Meteor } from 'meteor/meteor';
5 import { Mongo } from 'meteor/mongo';
6 import { SimpleSchema } from 'meteor/aldeed:simple-schema';
7
8 import { Orgs } from '/imports/collections/orgs/index';
9 import { Users } from '/imports/collections/users/index';
10
11 class Teacher {
12 constructor(doc) {
13 _.assign(this, doc);
14 };
15
16 getUserIds() {
17 return _.filter(_.map(this.users, 'userId'));
18 };
19 };
20 export { Teacher };
21
22 class TeachersCollection extends Mongo.Collection {
23 insert(item, callback) {
24 _.assign(item, {
25 createdAt: new Date().getTime(),
26 });
27 return super.insert(item, callback);
28 };
29 };
30
31 export const Teachers = new TeachersCollection('Teachers', {
32 transform: (item) => {
33 return new Teacher(item);
34 },
35 });
36
37 _.assign(Teachers, {
38 allStudents: () => {
39 const user = Users.current();
40 if(!user) return null;
41 return Orgs.find({'users.userId': user._id});
42 },
43 current: () => {
44 const user = Users.current();
45 if(!user) return null;
46 return Orgs.findOne({_id: user.orgId});
47 },
48 currentOrgUsers: () => {
49 const OrgsArr = Orgs.current();
50 if(!OrgsArr) return null;
51 return OrgsArr.users;
52 },
53
54 });
55
56 Teachers.deny({
57 insert() { return true; },
58 update() { return true; },
59 remove() { return true; },
60 });
61
62
63 Teachers.schema = new SimpleSchema({
64 userId: { type: String },
65 orgId: { type: String },
66 type: { type: String },
67 gender: { type: String, optional: true },
68 services: {
69 type: Object,
70 optional: true,
71 blackbox: true,
72 },
73
74 isMetaUser: { type: Boolean, optional: true },
75
76 createdAt: { type: Date, autoValue: function(){return new Date();}}
77
78 });
79
80 Teachers.attachSchema(Teachers.schema);
81
82 Teachers.privateFields = {
83 orgId: 1,
84 address: 1,
85
86 isMetaUser: 1,
87 createdAt: 1,
88 };
89
90 Teachers.publicFields = {
91 firstName: 1,
92 lastName: 1,
93 emails: 1,
94
95 createdAt: 1,
96 };
97
imports/collections/teachers/methods.js
File was created 1 // import {Parents } from '/imports/collections/parents/methods'
2 import _ from 'lodash';
3 import { Meteor } from 'meteor/meteor';
4 import { ValidatedMethod } from 'meteor/mdg:validated-method';
5 import { SimpleSchema } from 'meteor/aldeed:simple-schema';
6 import { DDPRateLimiter } from 'meteor/ddp-rate-limiter';
7 import { Bert } from 'meteor/themeteorchef:bert';
8 import { Users } from '/imports/collections/users/index';
9 import { Teachers } from '/imports/collections/teachers/index';
10 import { Orgs } from '/imports/collections/orgs/index';
11 export const teachersMethods = new ValidatedMethod({
12 name: 'teachers.method',
13
14 validate: new SimpleSchema({
15 itemId: { type: String },
16 }).validator(),
17
18 run({itemId}) {
19 return {};
20 },
21
22 });
23
imports/collections/teachers/publications.js
File was created 1 import { Meteor } from 'meteor/meteor';
2 import { check, Match } from 'meteor/check'
3
4 import { Orgs } from '/imports/collections/orgs/index';
5 import { Users } from '/imports/collections/users/index';
6 import { Teachers } from '/imports/collections/teachers/index';
7
8 Meteor.publish('teachers.forMyOrg', function () {
9 const user = Users.findOne({_id: this.userId});
10 if(!user) return [];
11 return Teachers.find({orgId: user.orgId});
12 });
13
imports/server/collections.js
1 import '/imports/collections/orgs/publications' 1 import '/imports/collections/orgs/publications'
2 import '/imports/collections/orgs/methods'; 2 import '/imports/collections/orgs/methods';
3 3
4 import '/imports/collections/users/publications'; 4 import '/imports/collections/users/publications';
5 5
6 import '/imports/collections/students/methods'; 6 import '/imports/collections/students/methods';
7 import '/imports/collections/students/publications'; 7 import '/imports/collections/students/publications';
8 import '/imports/collections/students/serverCsvUpload'; 8 import '/imports/collections/students/serverCsvUpload';
9
10 import '/imports/collections/teachers/methods';
11 import '/imports/collections/teachers/publications';
9 12