Commit d75229d74eb7c6b49ea71132bfff98541d069683

Authored by Deepak
1 parent 0c2ad31a0d
Exists in master

fixed dob issue and added teachers view

imports/client/views/core/DatePicker.js
... ... @@ -4,18 +4,25 @@ import 'jquery-ui/ui/widgets/datepicker'
4 4  
5 5 class DatePicker extends Component {
6 6 componentDidMount() {
  7 + SELF = this;
7 8 $('.datepicker').datepicker({
8 9 changeMonth: true,
9 10 changeYear: true,
10 11 showButtonPanel: true,
11   - yearRange: '-116:-1',
12   - dateFormat: 'dd/mm/yy'
  12 + yearRange: '-25:-1',
  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 22 render() {
17 23 return (
18 24 <input
  25 + id="datepickerDOB"
19 26 type="text"
20 27 className="datepicker form-control"
21 28 placeholder="DD-MM-YYYY"
... ...
imports/client/views/core/Form.js
... ... @@ -58,6 +58,7 @@ class Form extends Component {
58 58 }
59 59  
60 60 setValue (path, value) {
  61 + console.log(value);
61 62 if (!path) {
62 63 throw new Error(`setValue() requires a path`)
63 64 }
... ...
imports/client/views/org/admin/Breadcrumb.js
... ... @@ -0,0 +1,56 @@
  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 +};
... ...
imports/client/views/org/admin/Header.js
... ... @@ -0,0 +1,58 @@
  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 +};
... ...
imports/client/views/org/admin/Sidebar.js
... ... @@ -0,0 +1,85 @@
  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 +};
... ...
imports/client/views/org/admin/students/AddStudentFormContainer.js
... ... @@ -51,13 +51,12 @@ export class AddStudentFormContainer extends Component {
51 51 validations={{
52 52 admissionId: [(value) => isRequired('Admission id', value)],
53 53 firstName: [(value) => isRequired('First name', value)],
54   - middleName: [(value) => isRequired('Middle name', value)],
55 54 lastName: [(value) => isRequired('Last name', value)],
56 55 email: [(value) => isRequired('Email', value), isValidEmail],
57 56 dob: [(value) => isRequired('Date of birth', value)],
58 57 gender: [(value) => isRequired('Gender', value)],
59 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 60 section: [(value) => this.state.currentStep === 1 && isRequired('Section', value)],
62 61 community: [(value) => this.state.currentStep === 1 && isRequired('Community', value)],
63 62 bloodGroup: [(value) => this.state.currentStep === 1 && isRequired('Blood group', value)],
... ...
imports/client/views/org/admin/students/Header.js
... ... @@ -1,98 +0,0 @@
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="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   -};
imports/client/views/org/admin/students/StudentForm.js
... ... @@ -67,34 +67,36 @@ const StudentForm = props =&gt; (
67 67 </Col>
68 68 </Row>
69 69 <Row>
70   - <Col xs={12} sm={6}>
71   - <FormGroup controlId="middleName">
72   - <Label required>Middle Name</Label>
73   - <FormControl
74   - type="text"
75   - value={props.getValue('middleName')}
76   - placeholder="Middle Name"
77   - onChange={e => props.setValue('middleName', e.target.value)}
78   - />
79   - {props.isSubmitted() && props.errors && props.errors.middleName && (
80   - <ErrorLabel> {props.errors.middleName} </ErrorLabel>
81   - )}
82   - </FormGroup>
83   - </Col>
84   - <Col xs={12} sm={6}>
85   - <FormGroup controlId="lastName">
86   - <Label required>Last Name</Label>
87   - <FormControl
88   - type="text"
89   - value={props.getValue('lastName')}
90   - placeholder="Last Name"
91   - onChange={e => props.setValue('lastName', e.target.value)}
92   - />
93   - {props.isSubmitted() && props.errors && props.errors.lastName && (
94   - <ErrorLabel> {props.errors.lastName} </ErrorLabel>
95   - )}
96   - </FormGroup>
97   - </Col>
  70 + <Col xs={12} sm={6}>
  71 + <FormGroup controlId="lastName">
  72 + <Label required>Last Name</Label>
  73 + <FormControl
  74 + type="text"
  75 + value={props.getValue('lastName')}
  76 + placeholder="Last Name"
  77 + onChange={e => props.setValue('lastName', e.target.value)}
  78 + />
  79 + {props.isSubmitted() && props.errors && props.errors.lastName && (
  80 + <ErrorLabel> {props.errors.lastName} </ErrorLabel>
  81 + )}
  82 + </FormGroup>
  83 + </Col>
  84 + <Col xs={12} sm={6}>
  85 + <FormGroup controlId="formControlsSelect">
  86 + <Label>Gender</Label>
  87 + <FormControl componentClass="select"
  88 + placeholder="select"
  89 + value={props.getValue('gender')}
  90 + onChange={e => props.setValue('gender', e.target.value)}
  91 + >
  92 + <option value="male">Male</option>
  93 + <option value="female">Female</option>
  94 + </FormControl>
  95 + {props.isSubmitted() && props.errors && props.errors.gender && (
  96 + <ErrorLabel> {props.errors.gender} </ErrorLabel>
  97 + )}
  98 + </FormGroup>
  99 + </Col>
98 100 </Row>
99 101 <Row>
100 102 <Col xs={12} sm={6}>
... ... @@ -116,6 +118,7 @@ const StudentForm = props =&gt; (
116 118 <Label required>Date of birth</Label>
117 119 <DatePicker
118 120 id="dob"
  121 + setValue = {props.setValue}
119 122 value={props.getValue('dob')}
120 123 onChange={(e) => {
121 124 props.setValue('dob', e.target.value)
... ... @@ -128,22 +131,7 @@ const StudentForm = props =&gt; (
128 131 </Col>
129 132 </Row>
130 133 <Row>
131   - <Col xs={12} sm={6}>
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>
  134 +
147 135 </Row>
148 136 </fieldset>
149 137 )}
... ... @@ -170,12 +158,12 @@ const StudentForm = props =&gt; (
170 158 <Label required>Class</Label>
171 159 <FormControl
172 160 type="text"
173   - value={props.getValue('class')}
  161 + value={props.getValue('studentClass')}
174 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 && (
178   - <ErrorLabel> {props.errors.class} </ErrorLabel>
  165 + {props.isSubmitted() && props.errors && props.errors.studentClass && (
  166 + <ErrorLabel> {props.errors.studentClass} </ErrorLabel>
179 167 )}
180 168 </FormGroup>
181 169 </Col>
... ... @@ -419,6 +407,20 @@ const StudentForm = props =&gt; (
419 407 </Col>
420 408 </Row>
421 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 424 <Col xs={12} sm={6}>
423 425 <FormGroup controlId="parentZipcode">
424 426 <Label required>Parent Zipcode</Label>
... ...
imports/client/views/org/admin/students/StudentView.js
... ... @@ -8,11 +8,13 @@ import { Navbar,Modal, Nav, NavItem,
8 8 NavbarToggler, NavbarBrand, Table, ButtonToolbar,
9 9 NavLink, DropdownItem, DropdownToggle, DropdownMenu,
10 10 NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap';
11   -import { AddStudent } from './addStudent';
12 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 15 import { FabMenuView } from './FabMenu';
15 16 import { UploadCsv } from './UploadCsv';
  17 +import { AddStudent } from './addStudent';
16 18 import { Students } from '/imports/collections/students/index';
17 19  
18 20  
... ... @@ -42,7 +44,6 @@ export class StudentView extends Component {
42 44 };
43 45  
44 46 render() {
45   - console.log(this.props);
46 47 firstNameSearch = this.state.firstNameSearch;
47 48 lastNameSearch = this.state.lastNameSearch;
48 49 var students =_.filter(this.props.data.students,function(item){
... ... @@ -54,85 +55,13 @@ export class StudentView extends Component {
54 55 <div className="appLayout-box">
55 56 <div className="page-container">
56 57 <div className="page-content">
57   - <div className="sidebar sidebar-main sidebar-default">
58   - <div className="sidebar-content">
59   -
60   - <div className="sidebar-category sidebar-category-visible">
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>
  58 + <AdminSidebar
  59 + user = {this.props.data.user}
  60 + org = {this.props.data.org}
  61 + />
110 62 {/*end sidebar*/}
111 63 <div className="content-wrapper">
112   - <div className="page-header page-header-default">
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>
  64 + <AdminBreadcrumb />
136 65 {/*content*/}
137 66  
138 67 <div className="content has-detached-left">
... ...
imports/client/views/org/admin/teachers/index.js
... ... @@ -9,7 +9,8 @@ import { Loading } from &#39;/imports/client/components/Loadi
9 9  
10 10 import { Orgs } from '/imports/collections/orgs/index';
11 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 15 const meteorTick = (props, onData) => {
15 16  
... ... @@ -21,10 +22,22 @@ const meteorTick = (props, onData) =&gt; {
21 22 if(_.every(handles, (handle) => (handle.ready()) )) {
22 23 const user = Users.current();
23 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 35 onData(null, {
25 36 data: {
26 37 user: user,
27   - org: org
  38 + org: org,
  39 + teachersData: teachersData,
  40 + teachers: teachers
28 41 },
29 42 });
30 43 }
... ... @@ -45,4 +58,4 @@ const reduxTick = (props, onData) =&gt; {
45 58 export const teachersViewController = composeAll(
46 59 composeWithTracker(meteorTick, Loading),
47 60 compose(reduxTick, Loading),
48   -)(teachersView);
  61 +)(TeachersView);
... ...
imports/client/views/org/admin/teachers/teachersView.js
... ... @@ -5,10 +5,12 @@ import React, { Component } from &#39;react&#39;;
5 5 import { Link,browserHistory } from 'react-router';
6 6 import { FormGroup,
7 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   -
10   -export class teachersView extends Component {
11   -
  13 +export class TeachersView extends Component {
12 14 constructor(props) {
13 15 super(props);
14 16 this.state = {
... ... @@ -24,8 +26,81 @@ export class teachersView extends Component {
24 26 render() {
25 27 const {user, org} = this.props.data;
26 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 104 </div>
30 105 );
31 106 };
... ...
imports/client/views/org/admin/teachers/view/TeachersRow.js
... ... @@ -0,0 +1,56 @@
  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 +};
... ...
imports/client/views/org/admin/teachers/view/TeachersTable.js
... ... @@ -0,0 +1,65 @@
  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 +};
... ...
imports/client/views/org/app/module/AppLayout.js
... ... @@ -87,7 +87,7 @@ export class AppLayout extends Component {
87 87 <MenuItem>Warning palett</MenuItem>
88 88 </NavDropdown>
89 89 </NavDropdown>
90   -
  90 +
91 91 <NavItem eventKey={6} href="#"><i className="icon-file-stats"></i><span> Reports </span></NavItem>
92 92 <NavItem eventKey={7} href="#"><i className="icon-design"></i> <span>Examinations</span></NavItem>
93 93  
... ... @@ -118,73 +118,39 @@ export class AppLayout extends Component {
118 118 <MenuItem divider/>
119 119 <MenuItem><i className="icon-gear"></i> All settings</MenuItem>
120 120 </NavDropdown>
121   -
  121 +
122 122 </ul>
123 123 </div>
124 124 </div>
125 125 <div className="content">
126   -
127   - <div className="row">
128   - <div className="col-lg-3 col-md-6">
129   - <div className="thumbnail">
130   - <Link to="/students" >
131   - <div className="thumb thumb-rounded">
132   - <img src="assets/images/download2.png" alt="" />
133   -
134   - </div>
135   -
136   - <div className="caption text-center">
137   - <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6>
138   -
139   - </div>
140   - </Link>
141   - </div>
142   - </div>
143   -
144   - <div className="col-lg-3 col-md-6">
145   - <div className="thumbnail">
146   - <Link to="/students" >
147   - <div className="thumb thumb-rounded">
148   - <img src="assets/images/download.png" alt="" />
149   - </div>
150   -
151   - <div className="caption text-center">
152   - <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6>
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>
  126 + <div className="row">
  127 + <div className="col-lg-3 col-md-6">
  128 + <div className="thumbnail">
  129 + <Link to="/students" >
  130 + <div className="thumb thumb-rounded">
  131 + <img src="assets/images/download2.png" alt="" />
  132 + </div>
  133 + <div className="caption text-center">
  134 + <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6>
  135 + </div>
  136 + </Link>
  137 + </div>
  138 + </div>
  139 + <div className="col-lg-3 col-md-6">
  140 + <div className="thumbnail">
  141 + <Link to="/teachers" >
  142 + <div className="thumb thumb-rounded">
  143 + <img src="assets/images/download3.png" alt=""/>
  144 + </div>
  145 + <div className="caption text-center">
  146 + <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6>
  147 + </div>
  148 + </Link>
  149 + </div>
  150 + </div>
  151 +
  152 + </div>
  153 + </div>
188 154 </div>
189 155 </div>
190 156 </div>
... ...
imports/collections/students/methods.js
... ... @@ -28,14 +28,12 @@ export const addStudentManually = new ValidatedMethod({
28 28 validate: new SimpleSchema({
29 29 admissionId: { type: String },
30 30 firstName: { type: String },
31   - middleName: { type: String },
32 31 lastName: { type: String },
33 32 email: { type: String },
34 33 dob: { type: String },
35   - formattedDob: { type: String },
36 34 gender: { type: String },
37 35 rollNo: { type: String },
38   - studentclass: { type: String },
  36 + studentClass: { type: String },
39 37 section: { type: String },
40 38 community: { type: String },
41 39 bloodGroup: { type: String },
... ... @@ -62,16 +60,13 @@ export const addStudentManually = new ValidatedMethod({
62 60 orgId = user.orgId;
63 61 newStudentId = Users.insert({
64 62 emails: [{address:data.email, verified: false}],
65   - username: data.firstName,
66 63 firstName: data.firstName,
67   - middleName: data.middleName,
68 64 lastName: data.lastName,
69 65 orgId: orgId,
70 66 role: 'STUDENT'
71 67 });
72 68 newParentUserId = Users.insert({
73 69 emails: [{address:data.parentEmail, verified: false}],
74   - username: data.parentName,
75 70 firstName: data.parentName,
76 71 orgId: orgId,
77 72 role: 'PARENT'
... ... @@ -84,7 +79,7 @@ export const addStudentManually = new ValidatedMethod({
84 79 gender: data.gender,
85 80 dob: data.dob,
86 81 rollNo: data.rollNo,
87   - class: data.studentclass,
  82 + studentClass: data.studentClass,
88 83 section: data.section,
89 84 bloodGroup: data.bloodGroup,
90 85 community: data.community,
... ... @@ -99,7 +94,7 @@ export const addStudentManually = new ValidatedMethod({
99 94 gender: data.gender,
100 95 dob: data.dob,
101 96 rollNo: data.rollNo,
102   - class: data.studentclass,
  97 + class: data.studentClass,
103 98 section: data.section,
104 99 bloodGroup: data.bloodGroup,
105 100 community: data.community,
... ...
imports/collections/teachers/index.js
... ... @@ -0,0 +1,96 @@
  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 +};
... ...
imports/collections/teachers/methods.js
... ... @@ -0,0 +1,22 @@
  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 +});
... ...
imports/collections/teachers/publications.js
... ... @@ -0,0 +1,12 @@
  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 +});
... ...
imports/server/collections.js
... ... @@ -6,3 +6,6 @@ import &#39;/imports/collections/users/publications&#39;;
6 6 import '/imports/collections/students/methods';
7 7 import '/imports/collections/students/publications';
8 8 import '/imports/collections/students/serverCsvUpload';
  9 +
  10 +import '/imports/collections/teachers/methods';
  11 +import '/imports/collections/teachers/publications';
... ...