Commit afd2caa6ca988fbcc79adb84eaba5089795bd995
Exists in
master
Merge branch 'master' of https://bitbucket.org/youngdesk/ydapp
Showing
16 changed files
Show diff stats
client/stylesheets/custom.css
1 | 1 | body |
2 | 2 | { |
3 | - background: -webkit-linear-gradient(#00b395, #00cdaa); | |
4 | - background: -o-linear-gradient(#00b395, #00cdaa); | |
5 | - background: linear-gradient(#00b395, #00cdaa); | |
3 | + background: -webkit-linear-gradient(#00b395, #00b395); | |
4 | + background: -o-linear-gradient(#00b395, #00b395); | |
5 | + background: linear-gradient(#00b395, #00b395); | |
6 | +} | |
7 | + | |
8 | +table .dropdown span{ | |
9 | + color: #000000; | |
10 | +} | |
11 | +table .dropdown-toggle{ | |
12 | + cursor: pointer; | |
13 | +} | |
14 | +table .dropdown .fa{ | |
15 | + display: inline; | |
16 | + margin: 6px 6px; | |
17 | +} | |
18 | +table .dropdown-menu { | |
19 | + min-width: 134px; | |
20 | +} | |
21 | +table .dropdown-menu > li { | |
22 | + cursor: pointer; | |
23 | +} | |
24 | +table .dropdown-menu > li:hover{ | |
25 | + text-decoration: none; | |
26 | + color: #333333; | |
27 | + background-color: #f5f5f5; | |
28 | +} | |
29 | +table .dropdown-menu > li > span{ | |
30 | + padding: 6px 16px; | |
31 | + display: block; | |
32 | +} | |
33 | +.panel-body{ | |
34 | + max-height: 550px; | |
35 | + overflow-y: scroll; | |
6 | 36 | } | ... | ... |
imports/client/app/routes.js
... | ... | @@ -23,7 +23,8 @@ import { importCsvController } from '/imports/client/views/org/impo |
23 | 23 | |
24 | 24 | //admin |
25 | 25 | import { StudentDataController } from '/imports/client/views/org/admin/students/index' |
26 | -import { staffViewController } from '/imports/client/views/org/admin/staff/index' | |
26 | +import { staffViewController } from '/imports/client/views/org/admin/staff/index' | |
27 | +import { ParentViewController } from '/imports/client/views/org/admin/parents/index' | |
27 | 28 | //students |
28 | 29 | |
29 | 30 | //teachers |
... | ... | @@ -56,6 +57,7 @@ const getOrgRoutes = () => ( |
56 | 57 | <Route name="import" path="/import" component={ importCsvController } /> |
57 | 58 | <Route name="student" path="/students" component={ StudentDataController } /> |
58 | 59 | <Route name="staff" path="/staff" component={ staffViewController } /> |
60 | + <Route name="parent" path="/parents" component={ ParentViewController } /> | |
59 | 61 | <Route path="*" component={ NotFound } /> |
60 | 62 | </Route> |
61 | 63 | </Router> | ... | ... |
imports/client/views/nonOrg/enter/signup.css
imports/client/views/org/admin/AdminLayout.js
... | ... | @@ -57,6 +57,18 @@ export class AdminAppLayout extends Component { |
57 | 57 | </Link> |
58 | 58 | </div> |
59 | 59 | </div> |
60 | + <div className="col-lg-3 col-md-6"> | |
61 | + <div className="thumbnail"> | |
62 | + <Link to="/parents" > | |
63 | + <div className="thumb thumb-rounded"> | |
64 | + <img src="assets/images/download3.png" alt=""/> | |
65 | + </div> | |
66 | + <div className="caption text-center"> | |
67 | + <h6 className="text-semibold no-margin">Parents <small className="display-block">Click to view</small></h6> | |
68 | + </div> | |
69 | + </Link> | |
70 | + </div> | |
71 | + </div> | |
60 | 72 | </div> |
61 | 73 | </div> |
62 | 74 | </div> | ... | ... |
imports/client/views/org/admin/Header.js
... | ... | @@ -5,6 +5,7 @@ import React, { Component } from 'react'; |
5 | 5 | import { Link,browserHistory } from 'react-router'; |
6 | 6 | import { FormGroup, |
7 | 7 | FormControl,Glyphicon,Button } from 'react-bootstrap'; |
8 | +import './header.css'; | |
8 | 9 | |
9 | 10 | |
10 | 11 | export class Header extends Component { |
... | ... | @@ -25,29 +26,55 @@ export class Header extends Component { |
25 | 26 | return ( |
26 | 27 | <div className = "enterPane-box"> |
27 | 28 | <div className="row"> |
29 | + | |
28 | 30 | <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="" /> | |
31 | + <Link to="/parents" > | |
32 | + <div className="panel panel-body"> | |
33 | + <div className="media"> | |
34 | + <div className="media-left"> | |
35 | + <img src="assets/images/download2.png" className="img-circle" alt=""/> | |
33 | 36 | </div> |
34 | - <div className="caption text-center"> | |
35 | - <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> | |
37 | + | |
38 | + <div className="media-body"> | |
39 | + <h6 className="media-heading">Students</h6> | |
40 | + <p className="text-muted">Click to view</p> | |
36 | 41 | </div> |
37 | - </Link> | |
38 | 42 | </div> |
43 | + </div> | |
44 | + </Link> | |
39 | 45 | </div> |
40 | 46 | <div className="col-lg-3 col-md-6"> |
41 | - <div className="thumbnail"> | |
42 | - <Link to="/staff" > | |
43 | - <div className="thumb thumb-rounded"> | |
44 | - <img src="assets/images/download3.png" alt=""/> | |
47 | + <Link to="/parents" > | |
48 | + <div className="panel panel-body"> | |
49 | + <div className="media"> | |
50 | + <div className="media-left"> | |
51 | + <img src="assets/images/download.png" className="img-circle" alt=""/> | |
45 | 52 | </div> |
46 | - <div className="caption text-center"> | |
47 | - <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> | |
53 | + | |
54 | + <div className="media-body"> | |
55 | + <h6 className="media-heading">Teachers</h6> | |
56 | + <p className="text-muted">Click to view</p> | |
48 | 57 | </div> |
49 | - </Link> | |
58 | + </div> | |
59 | + </div> | |
60 | + </Link> | |
61 | + </div> | |
62 | + | |
63 | + <div className="col-lg-3 col-md-6"> | |
64 | + <Link to="/parents" > | |
65 | + <div className="panel panel-body"> | |
66 | + <div className="media"> | |
67 | + <div className="media-left"> | |
68 | + <img src="assets/images/download3.png" className="img-circle" alt=""/> | |
69 | + </div> | |
70 | + | |
71 | + <div className="media-body"> | |
72 | + <h6 className="media-heading">Parents</h6> | |
73 | + <p className="text-muted">Click to view</p> | |
74 | + </div> | |
75 | + </div> | |
50 | 76 | </div> |
77 | + </Link> | |
51 | 78 | </div> |
52 | 79 | |
53 | 80 | </div> | ... | ... |
imports/client/views/org/admin/header.css
imports/client/views/org/admin/parents/index.js
... | ... | @@ -0,0 +1,66 @@ |
1 | +import _ from 'lodash'; | |
2 | +import { | |
3 | + composeWithTracker, | |
4 | + compose, | |
5 | + composeAll | |
6 | + } from 'react-komposer'; | |
7 | +import { Loading } from '/imports/client/components/Loading'; | |
8 | + | |
9 | +import { Orgs } from '/imports/collections/orgs/index'; | |
10 | +import { Users } from '/imports/collections/users/index'; | |
11 | +import { Parents } from '/imports/collections/parents/index'; | |
12 | +import { ParentsView } from './parentsview'; | |
13 | + | |
14 | + | |
15 | + | |
16 | +const meteorTick = (props, onData) => { | |
17 | + | |
18 | + const handles = [ | |
19 | + Meteor.subscribe('users.current'), | |
20 | + Meteor.subscribe('orgs.current'), | |
21 | + Meteor.subscribe('users.forMyOrg'), | |
22 | + Meteor.subscribe('parent.forMyOrg'), | |
23 | + ]; | |
24 | + | |
25 | + if(_.every(handles, (handle) => (handle.ready()) )) { | |
26 | + const user = Users.current(); | |
27 | + const org = Orgs.current(); | |
28 | + console.log("parents"); | |
29 | + parent = Users.find({"role":"PARENT"}).fetch() ? Users.find({"role":"PARENT"}).fetch() : ""; | |
30 | + console.log(Users.find({"role":"PARENT"}).fetch()); | |
31 | + parentData = Parents.find().fetch() ? Parents.find().fetch() : ""; | |
32 | + console.log("parentData"); | |
33 | + console.log(parentData); | |
34 | + for(var i=0; i< parent.length; i++){ | |
35 | + for(var j=0; j< parentData.length; j++){ | |
36 | + if(parent[i]._id == parentData[j].userId){ | |
37 | + parent[i].relationship = parentData[j].relationship; | |
38 | + } | |
39 | + } | |
40 | + } | |
41 | + onData(null, { | |
42 | + data: { | |
43 | + user: user, | |
44 | + org: org, | |
45 | + parent: parent | |
46 | + }, | |
47 | + }); | |
48 | + } | |
49 | + | |
50 | + return () => { | |
51 | + _.each(handles, (handle) => handle.stop() ); | |
52 | + }; | |
53 | +}; | |
54 | + | |
55 | + | |
56 | +const reduxTick = (props, onData) => { | |
57 | + onData(null, { | |
58 | + data: {} | |
59 | + }); | |
60 | +}; | |
61 | + | |
62 | + | |
63 | +export const ParentViewController = composeAll( | |
64 | + composeWithTracker(meteorTick, Loading), | |
65 | + compose(reduxTick, Loading), | |
66 | +)(ParentsView); | ... | ... |
imports/client/views/org/admin/parents/parentsview.js
... | ... | @@ -0,0 +1,108 @@ |
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 | +import { Header } from '../Header'; | |
9 | +import { AdminSidebar } from '../Sidebar' | |
10 | +import { AdminBreadcrumb } from '../Breadcrumb' | |
11 | +import { ParentTable } from './view/ParentTable' | |
12 | + | |
13 | + | |
14 | +export class ParentsView extends Component { | |
15 | + | |
16 | + constructor(props) { | |
17 | + super(props); | |
18 | + this.state = { | |
19 | + | |
20 | + }; | |
21 | + this.onUpdate = this.onUpdate.bind(this); | |
22 | + }; | |
23 | + | |
24 | + onUpdate(key, value) { | |
25 | + this.setState({[key]: value}); | |
26 | + }; | |
27 | + | |
28 | + render() { | |
29 | + const {user, org, parent} = this.props.data; | |
30 | + return ( | |
31 | + <div className="appLayout-box"> | |
32 | + <div className="page-container"> | |
33 | + <div className="page-content"> | |
34 | + <AdminSidebar | |
35 | + user = {user} | |
36 | + org = {org} | |
37 | + /> | |
38 | + <div className="content-wrapper"> | |
39 | + <AdminBreadcrumb /> | |
40 | + | |
41 | + <div className="content has-detached-left"> | |
42 | + <div className="container-detached"> | |
43 | + <div className="content-detached"> | |
44 | + <Header | |
45 | + user = {user} | |
46 | + org = {org} | |
47 | + /> | |
48 | + <ParentTable | |
49 | + data = {this.props.data} | |
50 | + parent = {parent} | |
51 | + /> | |
52 | + {/* <AddStaff/> | |
53 | + <UploadCsvStaff /> */} | |
54 | + </div> | |
55 | + </div> | |
56 | + <div className="sidebar-detached affix-top"> | |
57 | + <div className="sidebar sidebar-default"> | |
58 | + <div className="sidebar-content"> | |
59 | + | |
60 | + <div className="sidebar-category"> | |
61 | + <div className="category-title"> | |
62 | + <span>Advanced Search</span> | |
63 | + <ul className="icons-list"> | |
64 | + <li><a href="#" data-action="collapse"></a></li> | |
65 | + </ul> | |
66 | + </div> | |
67 | + | |
68 | + <div className="category-content"> | |
69 | + <form action="#"> | |
70 | + <div className="has-feedback has-feedback-left"> | |
71 | + <input type="search" className="form-control" | |
72 | + value={this.state.firstNameSearch} | |
73 | + onChange={e=>this.onUpdate('firstNameSearch',e.target.value)} | |
74 | + placeholder="First Name" | |
75 | + /> | |
76 | + <div className="form-control-feedback"> | |
77 | + <i className="icon-search4 text-size-base text-muted"></i> | |
78 | + </div> | |
79 | + </div> | |
80 | + </form> | |
81 | + </div> | |
82 | + <div className="category-content"> | |
83 | + <form action="#"> | |
84 | + <div className="has-feedback has-feedback-left"> | |
85 | + <input type="search" className="form-control" | |
86 | + value={this.state.lastNameSearch} | |
87 | + onChange={e=>this.onUpdate('lastNameSearch',e.target.value)} | |
88 | + placeholder="Last Name" /> | |
89 | + <div className="form-control-feedback"> | |
90 | + <i className="icon-search4 text-size-base text-muted"></i> | |
91 | + </div> | |
92 | + </div> | |
93 | + </form> | |
94 | + </div> | |
95 | + </div> | |
96 | + </div> | |
97 | + </div> | |
98 | + </div> | |
99 | + </div> | |
100 | + </div> | |
101 | + </div> | |
102 | + </div> | |
103 | + </div> | |
104 | + ); | |
105 | + }; | |
106 | + | |
107 | + | |
108 | +}; | ... | ... |
imports/client/views/org/admin/parents/view/ParentRow.js
... | ... | @@ -0,0 +1,54 @@ |
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 ParentRow 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 {parent} = this.props; | |
26 | + if(parent.firstName){ | |
27 | + return ( | |
28 | + <tr> | |
29 | + <td>{parent.firstName}</td> | |
30 | + <td>{parent.relationship}</td> {/* relationship doesnt reflect here */} | |
31 | + <td><span className="label label-success">Active</span></td> | |
32 | + <td className="text-center"> | |
33 | + <ul className="icons-list"> | |
34 | + <li className="dropdown"> | |
35 | + <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | |
36 | + <i className="icon-menu9"></i> | |
37 | + </a> | |
38 | + <ul className="dropdown-menu dropdown-menu-right"> | |
39 | + <li><a href="#"><i className="icon-file-pdf"></i> Export to .pdf</a></li> | |
40 | + <li><a href="#"><i className="icon-file-excel"></i> Export to .csv</a></li> | |
41 | + <li><a href="#"><i className="icon-file-word"></i> Export to .doc</a></li> | |
42 | + </ul> | |
43 | + </li> | |
44 | + </ul> | |
45 | + </td> | |
46 | + </tr> | |
47 | + ); | |
48 | + }else { | |
49 | + return null; | |
50 | + } | |
51 | + | |
52 | + }; | |
53 | + | |
54 | + }; | ... | ... |
imports/client/views/org/admin/parents/view/ParentTable.js
... | ... | @@ -0,0 +1,64 @@ |
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 {ParentRow} from './ParentRow' | |
11 | + | |
12 | +export class ParentTable 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">Parent 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>Relationship</th> | |
42 | + <th>Status</th> | |
43 | + <th className="text-center">Actions</th> | |
44 | + </tr> | |
45 | + </thead> | |
46 | + <tbody> | |
47 | + { | |
48 | + this.props.parent.map(function(parent, i) | |
49 | + { | |
50 | + return( | |
51 | + <ParentRow | |
52 | + key = {i} | |
53 | + parent = {parent} | |
54 | + /> | |
55 | + ) | |
56 | + }) | |
57 | + } | |
58 | + </tbody> | |
59 | + </Table> | |
60 | + </div> | |
61 | + ); | |
62 | + }; | |
63 | + | |
64 | +}; | ... | ... |
imports/client/views/org/admin/students/index.js
... | ... | @@ -26,6 +26,7 @@ const meteorTick = (props, onData) => { |
26 | 26 | const user = Users.current(); |
27 | 27 | const org = Orgs.current(); |
28 | 28 | students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : ""; |
29 | + console.log(students); | |
29 | 30 | studentData = Students.find().fetch() ? Students.find().fetch() : ""; |
30 | 31 | for(var i=0; i< students.length; i++){ |
31 | 32 | for(var j=0; j< studentData.length; j++){ | ... | ... |
imports/client/views/org/admin/students/view/StudentRow.js
... | ... | @@ -12,15 +12,25 @@ export class StudentRow extends Component { |
12 | 12 | constructor(props) { |
13 | 13 | super(props); |
14 | 14 | this.state = { |
15 | - | |
15 | + editOpen: false, | |
16 | 16 | }; |
17 | 17 | this.onUpdate = this.onUpdate.bind(this); |
18 | + this.toggleEditOpen = this.toggleEditOpen.bind(this); | |
19 | + this.deleteStudent = this.deleteStudent.bind(this); | |
18 | 20 | }; |
19 | 21 | |
20 | 22 | onUpdate(key, value) { |
21 | 23 | this.setState({[key]: value}); |
22 | 24 | }; |
23 | - | |
25 | + toggleEditOpen(){ | |
26 | + this.setState({ | |
27 | + editOpen : !this.state.editOpen | |
28 | + }) | |
29 | + } | |
30 | + deleteStudent(){ | |
31 | + console.log("Delete"); | |
32 | + console.log(this.props.student._id); | |
33 | + } | |
24 | 34 | render() { |
25 | 35 | const {student} = this.props; |
26 | 36 | if(student.firstName){ |
... | ... | @@ -33,14 +43,14 @@ export class StudentRow extends Component { |
33 | 43 | <td><span className="label label-success">Active</span></td> |
34 | 44 | <td className="text-center"> |
35 | 45 | <ul className="icons-list"> |
36 | - <li className="dropdown"> | |
37 | - <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | |
46 | + <li className={this.state.editOpen? "dropdown open": "dropdown" }> | |
47 | + <span className="dropdown-toggle" onClick={this.toggleEditOpen}> | |
38 | 48 | <i className="icon-menu9"></i> |
39 | - </a> | |
49 | + </span> | |
40 | 50 | <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> | |
51 | + <li onClick={this.viewStudent}><Link to={`/student/${student._id}`}><span><i className="fa fa-binoculars"></i>View </span></Link></li> | |
52 | + <li onClick={this.editStudent}><span><i className="fa fa-pencil-square"></i> Edit </span></li> | |
53 | + <li onClick={this.deleteStudent}><span><i className="fa fa-exclamation-triangle"></i> Delete</span></li> | |
44 | 54 | </ul> |
45 | 55 | </li> |
46 | 56 | </ul> | ... | ... |
imports/client/views/org/admin/students/view/StudentTable.js
... | ... | @@ -5,7 +5,7 @@ import React, { Component } from 'react'; |
5 | 5 | import { Link,browserHistory } from 'react-router'; |
6 | 6 | import { FormGroup,Panel,Table, |
7 | 7 | ButtonToolbar,Modal, |
8 | - FormControl,Glyphicon,Button } from 'react-bootstrap'; | |
8 | + FormControl,Glyphicon,Button, } from 'react-bootstrap'; | |
9 | 9 | import {moment} from 'meteor/momentjs:moment' |
10 | 10 | import {StudentRow} from './StudentRow' |
11 | 11 | |
... | ... | @@ -14,14 +14,18 @@ export class StudentTable extends Component { |
14 | 14 | constructor(props) { |
15 | 15 | super(props); |
16 | 16 | this.state = { |
17 | - show: false | |
17 | + show: false, | |
18 | + panleOpen: true, | |
18 | 19 | }; |
19 | 20 | this.onUpdate = this.onUpdate.bind(this); |
21 | + this.togglePanel = this.togglePanel.bind(this); | |
20 | 22 | }; |
21 | 23 | onUpdate(key, value) { |
22 | 24 | this.setState({[key]: value}); |
23 | 25 | }; |
24 | - | |
26 | + togglePanel(){ | |
27 | + this.setState({panleOpen: !this.state.panleOpen}); | |
28 | + } | |
25 | 29 | render() { |
26 | 30 | return ( |
27 | 31 | <div className="panel panel-flat"> |
... | ... | @@ -29,35 +33,37 @@ export class StudentTable extends Component { |
29 | 33 | <h5 className="panel-title">Student Details</h5> |
30 | 34 | <div className="heading-elements"> |
31 | 35 | <ul className="icons-list"> |
32 | - <li><a data-action="collapse"></a></li> | |
33 | - <li><a data-action="reload"></a></li> | |
36 | + <li onClick={this.togglePanel}><a data-action="collapse" className={this.state.panleOpen?"rotate-180":null}></a></li> | |
34 | 37 | </ul> |
35 | 38 | </div> |
36 | 39 | </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.students.map(function(student, i) | |
51 | - { | |
52 | - return( | |
53 | - <StudentRow | |
54 | - student = {student} | |
55 | - /> | |
56 | - ) | |
57 | - }) | |
58 | - } | |
59 | - </tbody> | |
60 | - </Table> | |
40 | + <Panel collapsible expanded={this.state.panleOpen}> | |
41 | + <Table striped bordered condensed hover> | |
42 | + <thead> | |
43 | + <tr> | |
44 | + <th>First Name</th> | |
45 | + <th>Last Name</th> | |
46 | + <th>Class</th> | |
47 | + <th>DOB</th> | |
48 | + <th>Status</th> | |
49 | + <th className="text-center">Actions</th> | |
50 | + </tr> | |
51 | + </thead> | |
52 | + <tbody> | |
53 | + { | |
54 | + this.props.students.map(function(student, i) | |
55 | + { | |
56 | + return( | |
57 | + <StudentRow | |
58 | + key = { i } | |
59 | + student = {student} | |
60 | + /> | |
61 | + ) | |
62 | + }) | |
63 | + } | |
64 | + </tbody> | |
65 | + </Table> | |
66 | + </Panel> | |
61 | 67 | </div> |
62 | 68 | ); |
63 | 69 | }; | ... | ... |
imports/collections/parents/methods.js
... | ... | @@ -8,8 +8,8 @@ import { Bert } from 'meteor/themeteorchef:bert'; |
8 | 8 | import { Users } from '/imports/collections/users/index'; |
9 | 9 | import { Students } from '/imports/collections/students/index'; |
10 | 10 | import { Orgs } from '/imports/collections/orgs/index'; |
11 | -export const studentMethods = new ValidatedMethod({ | |
12 | - name: 'student.method', | |
11 | +export const parentMethods = new ValidatedMethod({ | |
12 | + name: 'parent.method', | |
13 | 13 | |
14 | 14 | validate: new SimpleSchema({ |
15 | 15 | itemId: { type: String }, |
... | ... | @@ -20,80 +20,3 @@ export const studentMethods = new ValidatedMethod({ |
20 | 20 | }, |
21 | 21 | |
22 | 22 | }); |
23 | - | |
24 | -export const addStudentManually = new ValidatedMethod({ | |
25 | - name: 'student.addManually', | |
26 | - | |
27 | - validate: new SimpleSchema({ | |
28 | - admissionId: { type: String }, | |
29 | - firstName: { type: String }, | |
30 | - middleName: { type: String }, | |
31 | - lastName: { type: String }, | |
32 | - email: { type: String }, | |
33 | - dob: { type: String }, | |
34 | - formattedDob: { type: String }, | |
35 | - gender: { type: String }, | |
36 | - rollNo: { type: String }, | |
37 | - studentclass: { type: String }, | |
38 | - section: { type: String }, | |
39 | - community: { type: String }, | |
40 | - bloodGroup: { type: String }, | |
41 | - phone: { type: String }, | |
42 | - address: { type: String }, | |
43 | - city: { type: String }, | |
44 | - state: { type: String }, | |
45 | - parentName: { type: String }, | |
46 | - parentEmail: { type: String }, | |
47 | - relation: { type: String }, | |
48 | - profession: { type: String }, | |
49 | - parentGender: { type: String }, | |
50 | - parentPhone: { type: String }, | |
51 | - parentAddress: { type: String }, | |
52 | - parentCity: { type: String }, | |
53 | - parentState: { type: String }, | |
54 | - parentZipcode: { type: String }, | |
55 | - }).validator(), | |
56 | - | |
57 | - run(data) { | |
58 | - console.log("data"); | |
59 | - console.log(data); | |
60 | - const user = Users.findOne({_id: this.userId}); | |
61 | - orgId = user.orgId; | |
62 | - newStudentId = Users.insert({ | |
63 | - emails: [data.email], | |
64 | - username: firstName, | |
65 | - firstName: firstName, | |
66 | - middleName: middleName, | |
67 | - lastName: lastName, | |
68 | - orgId: orgId, | |
69 | - role: 'STUDENT' | |
70 | - }); | |
71 | - newParentId = Users.insert({ | |
72 | - emails: [data.parentEmail], | |
73 | - username: parentName, | |
74 | - firstName: parentName, | |
75 | - orgId: orgId, | |
76 | - role: 'PARENT' | |
77 | - }); | |
78 | - console.log("newUserId"); | |
79 | - console.log(newUserId); | |
80 | - if(newUserId){ | |
81 | - Students.insert({ | |
82 | - userId: newUserId, | |
83 | - orgId: orgId, | |
84 | - admissionId: data.admissionId, | |
85 | - address: data.address, | |
86 | - gender: data.gender, | |
87 | - dob: data.dob, | |
88 | - rollNo: data.rollNo, | |
89 | - class: data.studentclass, | |
90 | - section: data.section, | |
91 | - bloodGroup: data.bloodGroup, | |
92 | - community: data.community, | |
93 | - | |
94 | - }); | |
95 | - } | |
96 | - return {newUserId}; | |
97 | - }, | |
98 | - | |
99 | -}); | ... | ... |
imports/collections/parents/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 { Parents } from '/imports/collections/parents/index'; | |
7 | + | |
8 | +Meteor.publish('parent.forMyOrg', function () { | |
9 | + const user = Users.findOne({_id: this.userId}); | |
10 | + if(!user) return []; | |
11 | + return Parents.find({orgId: user.orgId}); | |
12 | +}); | ... | ... |
imports/server/collections.js
... | ... | @@ -10,3 +10,6 @@ import '/imports/collections/students/serverCsvUpload'; |
10 | 10 | import '/imports/collections/staff/methods'; |
11 | 11 | import '/imports/collections/staff/publications'; |
12 | 12 | import '/imports/collections/staff/serverCsvUpload'; |
13 | + | |
14 | +import '/imports/collections/parents/methods'; | |
15 | +import '/imports/collections/parents/publications'; | ... | ... |