Commit 691a06c2fb64fe63bc2a888a4fbb976301c16de4
1 parent
167dd6325a
Exists in
master
Staff profile
Showing
14 changed files
with
382 additions
and
97 deletions
Show diff stats
client/stylesheets/custom.css
1 | body | 1 | body |
2 | { | 2 | { |
3 | background: -webkit-linear-gradient(#00b395, #00cdaa); | 3 | background: -webkit-linear-gradient(#00b395, #00b395); |
4 | background: -o-linear-gradient(#00b395, #00cdaa); | 4 | background: -o-linear-gradient(#00b395, #00b395); |
5 | background: linear-gradient(#00b395, #00cdaa); | 5 | background: linear-gradient(#00b395, #00b395); |
6 | } | 6 | } |
7 | 7 |
imports/client/app/routes.js
1 | /* eslint-disable max-len */ | 1 | /* eslint-disable max-len */ |
2 | 2 | ||
3 | import React from 'react'; | 3 | import React from 'react'; |
4 | import { render } from 'react-dom'; | 4 | import { render } from 'react-dom'; |
5 | import { Router, Route, | 5 | import { Router, Route, |
6 | IndexRoute, browserHistory } from 'react-router'; | 6 | IndexRoute, browserHistory } from 'react-router'; |
7 | import { Meteor } from 'meteor/meteor'; | 7 | import { Meteor } from 'meteor/meteor'; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * General Components | 10 | * General Components |
11 | */ | 11 | */ |
12 | import Index from '/imports/client/views/app/module/Index'; | 12 | import Index from '/imports/client/views/app/module/Index'; |
13 | import NotFound from '/imports/client/views/org/NotFound'; | 13 | import NotFound from '/imports/client/views/org/NotFound'; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Org Components | 16 | * Org Components |
17 | */ | 17 | */ |
18 | 18 | ||
19 | import { App } from '/imports/client/layouts/OrgApp'; | 19 | import { App } from '/imports/client/layouts/OrgApp'; |
20 | import { AppModule } from '/imports/client/views/org/app/module/Index'; | 20 | import { AppModule } from '/imports/client/views/org/app/module/Index'; |
21 | import { Orgs } from '/imports/collections/orgs/index'; | 21 | import { Orgs } from '/imports/collections/orgs/index'; |
22 | import { importCsvController } from '/imports/client/views/org/importCsv/index' | 22 | import { importCsvController } from '/imports/client/views/org/importCsv/index' |
23 | 23 | ||
24 | //admin | 24 | //admin |
25 | import { StudentDataController } from '/imports/client/views/org/admin/students/index' | 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 | //students | 28 | //students |
28 | 29 | ||
29 | //teachers | 30 | //teachers |
30 | 31 | ||
31 | //parents | 32 | //parents |
32 | 33 | ||
33 | 34 | ||
34 | 35 | ||
35 | /** | 36 | /** |
36 | * NonOrg Components | 37 | * NonOrg Components |
37 | */ | 38 | */ |
38 | import Signup from '/imports/client/views/nonOrg/enter/SignupView'; | 39 | import Signup from '/imports/client/views/nonOrg/enter/SignupView'; |
39 | import { NonOrgApp } from '/imports/client/layouts/NonOrgApp'; | 40 | import { NonOrgApp } from '/imports/client/layouts/NonOrgApp'; |
40 | import {NonOrgAppModule} from '/imports/client/views/nonOrg/app/module/Index'; | 41 | import {NonOrgAppModule} from '/imports/client/views/nonOrg/app/module/Index'; |
41 | 42 | ||
42 | /** | 43 | /** |
43 | * Invalid Org Components | 44 | * Invalid Org Components |
44 | */ | 45 | */ |
45 | 46 | ||
46 | /** | 47 | /** |
47 | There are three types of routes | 48 | There are three types of routes |
48 | 1)getOrgRoutes: all the routes that should be present for a registered org | 49 | 1)getOrgRoutes: all the routes that should be present for a registered org |
49 | 2)getInvalidOrgRoute: all the routes where someone tries to enter a subdomain which hasn't been registered yet (404 mostly :D) | 50 | 2)getInvalidOrgRoute: all the routes where someone tries to enter a subdomain which hasn't been registered yet (404 mostly :D) |
50 | 3)getNonOrgRoutes: all routes linked to normal site, ie signing up a new org. CHeking out demo and everything internal | 51 | 3)getNonOrgRoutes: all routes linked to normal site, ie signing up a new org. CHeking out demo and everything internal |
51 | **/ | 52 | **/ |
52 | const getOrgRoutes = () => ( | 53 | const getOrgRoutes = () => ( |
53 | <Router history={ browserHistory }> | 54 | <Router history={ browserHistory }> |
54 | <Route path="/" component={ App }> | 55 | <Route path="/" component={ App }> |
55 | <IndexRoute name="index" component={ AppModule } /> | 56 | <IndexRoute name="index" component={ AppModule } /> |
56 | <Route name="import" path="/import" component={ importCsvController } /> | 57 | <Route name="import" path="/import" component={ importCsvController } /> |
57 | <Route name="student" path="/students" component={ StudentDataController } /> | 58 | <Route name="student" path="/students" component={ StudentDataController } /> |
58 | <Route name="staff" path="/staff" component={ staffViewController } /> | 59 | <Route name="staff" path="/staff" component={ staffViewController } /> |
60 | <Route name="parent" path="/parents" component={ ParentViewController } /> | ||
59 | <Route path="*" component={ NotFound } /> | 61 | <Route path="*" component={ NotFound } /> |
60 | </Route> | 62 | </Route> |
61 | </Router> | 63 | </Router> |
62 | ) | 64 | ) |
63 | 65 | ||
64 | 66 | ||
65 | const getInvalidOrgRoute = () => ( | 67 | const getInvalidOrgRoute = () => ( |
66 | <Router history={ browserHistory }> | 68 | <Router history={ browserHistory }> |
67 | <Route path="/" component={ App }> | 69 | <Route path="/" component={ App }> |
68 | <IndexRoute name="index" component={ NotFound } /> | 70 | <IndexRoute name="index" component={ NotFound } /> |
69 | <Route path="*" component={ NotFound } /> | 71 | <Route path="*" component={ NotFound } /> |
70 | </Route> | 72 | </Route> |
71 | </Router> | 73 | </Router> |
72 | ) | 74 | ) |
73 | 75 | ||
74 | const getNonOrgRoutes = () => ( | 76 | const getNonOrgRoutes = () => ( |
75 | <Router history={ browserHistory }> | 77 | <Router history={ browserHistory }> |
76 | <Route path="/" component={ NonOrgApp }> | 78 | <Route path="/" component={ NonOrgApp }> |
77 | <IndexRoute name="index" component={ NonOrgAppModule } /> | 79 | <IndexRoute name="index" component={ NonOrgAppModule } /> |
78 | <Route name="signup" path="/signup" component={ Signup } /> | 80 | <Route name="signup" path="/signup" component={ Signup } /> |
79 | <Route path="*" component={ NotFound } /> | 81 | <Route path="*" component={ NotFound } /> |
80 | </Route> | 82 | </Route> |
81 | </Router> | 83 | </Router> |
82 | ) | 84 | ) |
83 | 85 | ||
84 | //Authenticate function to give access to users only | 86 | //Authenticate function to give access to users only |
85 | const authenticate = (nextState, replace) => { | 87 | const authenticate = (nextState, replace) => { |
86 | if (!Meteor.loggingIn() && !Meteor.userId()) { | 88 | if (!Meteor.loggingIn() && !Meteor.userId()) { |
87 | replace({ | 89 | replace({ |
88 | pathname: '/login', | 90 | pathname: '/login', |
89 | state: { nextPathname: nextState.location.pathname }, | 91 | state: { nextPathname: nextState.location.pathname }, |
90 | }); | 92 | }); |
91 | } | 93 | } |
92 | }; | 94 | }; |
93 | 95 | ||
94 | 96 | ||
95 | /** | 97 | /** |
96 | 98 | ||
97 | **/ | 99 | **/ |
98 | const detectOrg = () => { | 100 | const detectOrg = () => { |
99 | orgSlug = ""; | 101 | orgSlug = ""; |
100 | var hostnameArray = document.location.hostname.split( "." ); | 102 | var hostnameArray = document.location.hostname.split( "." ); |
101 | if(hostnameArray[0] !== "www"){ | 103 | if(hostnameArray[0] !== "www"){ |
102 | if((hostnameArray[1]==='localhost'||hostnameArray[1]==='ydapp')){ | 104 | if((hostnameArray[1]==='localhost'||hostnameArray[1]==='ydapp')){ |
103 | orgSlug = hostnameArray[0]; | 105 | orgSlug = hostnameArray[0]; |
104 | } | 106 | } |
105 | }else{ | 107 | }else{ |
106 | if((hostnameArray[2]==='localhost'||hostnameArray[2]==='ydapp')){ | 108 | if((hostnameArray[2]==='localhost'||hostnameArray[2]==='ydapp')){ |
107 | orgSlug = hostnameArray[1]; | 109 | orgSlug = hostnameArray[1]; |
108 | } | 110 | } |
109 | } | 111 | } |
110 | 112 | ||
111 | if(orgSlug!==""){ | 113 | if(orgSlug!==""){ |
112 | console.log(orgSlug); | 114 | console.log(orgSlug); |
113 | Meteor.call('checkExistingOrg', {slug:orgSlug}, function(err, res) { | 115 | Meteor.call('checkExistingOrg', {slug:orgSlug}, function(err, res) { |
114 | if(res){ | 116 | if(res){ |
115 | Session.set('orgId', res._id); | 117 | Session.set('orgId', res._id); |
116 | Session.set('orgSlug', orgSlug); | 118 | Session.set('orgSlug', orgSlug); |
117 | render(getOrgRoutes(),document.getElementById('app')); | 119 | render(getOrgRoutes(),document.getElementById('app')); |
118 | }else{ | 120 | }else{ |
119 | render(getInvalidOrgRoute(),document.getElementById('app')); | 121 | render(getInvalidOrgRoute(),document.getElementById('app')); |
120 | } | 122 | } |
121 | }); | 123 | }); |
122 | }else{ | 124 | }else{ |
123 | render(getNonOrgRoutes(),document.getElementById('app')); | 125 | render(getNonOrgRoutes(),document.getElementById('app')); |
124 | } | 126 | } |
125 | } | 127 | } |
126 | const checkSlug = (nextState, replace) => { | 128 | const checkSlug = (nextState, replace) => { |
127 | orgId = Session.get('orgId'); | 129 | orgId = Session.get('orgId'); |
128 | } | 130 | } |
129 | 131 | ||
130 | 132 | ||
131 | Meteor.startup(() => { | 133 | Meteor.startup(() => { |
132 | detectOrg(); | 134 | detectOrg(); |
133 | }); | 135 | }); |
134 | 136 |
imports/client/views/nonOrg/enter/signup.css
1 | .Signup | 1 | .Signup |
2 | { | 2 | { |
3 | float: right; | 3 | float: right; |
4 | margin: 20px auto; | 4 | margin: 20px auto; |
5 | width: 400px; | 5 | width: 400px; |
6 | height: auto; | 6 | height: auto; |
7 | padding: 20px; | 7 | padding: 20px; |
8 | -webkit-border-radius: 8px/7px; | 8 | -webkit-border-radius: 8px/7px; |
9 | -moz-border-radius: 8px/7px; | 9 | -moz-border-radius: 8px/7px; |
10 | border-radius: 8px/7px; | 10 | border-radius: 8px/7px; |
11 | background-color: white; | 11 | background-color: white; |
12 | -webkit-box-shadow: 1px 2px 5px rgba(0,0,0,.31); | 12 | -webkit-box-shadow: 1px 2px 5px rgba(0,0,0,.31); |
13 | -moz-box-shadow: 1px 2px 5px rgba(0,0,0,.31); | 13 | -moz-box-shadow: 1px 2px 5px rgba(0,0,0,.31); |
14 | box-shadow: 1px 2px 5px rgba(0,0,0,.31); | 14 | box-shadow: 1px 2px 5px rgba(0,0,0,.31); |
15 | border: solid 1px #cbc9c9; | 15 | border: solid 1px #cbc9c9; |
16 | font-family: 'Ubuntu', sans-serif; | 16 | font-family: 'Ubuntu', sans-serif; |
17 | } | 17 | } |
18 | 18 | ||
19 | .Content | 19 | .Content |
20 | { | 20 | { |
21 | margin: 20px auto; | 21 | margin: 20px auto; |
22 | width: 750px; | 22 | width: 750px; |
23 | height: auto; | 23 | height: auto; |
24 | padding: 20px; | 24 | padding: 20px; |
25 | font-family: 'Ubuntu', sans-serif; | 25 | font-family: 'Ubuntu', sans-serif; |
26 | color: white; | 26 | color: white; |
27 | float:left; | 27 | float:left; |
28 | } | 28 | } |
29 | 29 | ||
30 | .section-heading | 30 | .section-heading |
31 | { | 31 | { |
32 | text-align: center; | 32 | text-align: center; |
33 | } | 33 | } |
34 | 34 | ||
35 | .signupView .contact | 35 | .signupView .contact |
36 | { | 36 | { |
37 | text-align: center; | 37 | text-align: center; |
38 | text-indent: 0px !important; | 38 | text-indent: 0px !important; |
39 | } | 39 | } |
40 | 40 | ||
41 | |||
42 | @media screen and (max-width:768px){ | ||
41 | .container | 43 | .container |
42 | { | 44 | { |
43 | /*width:1300px !important;*/ | 45 | /*width:1300px !important;*/ |
44 | } | 46 | } |
47 | .Signup | ||
48 | { | ||
49 | float:none; | ||
50 | clear:both; | ||
51 | } | ||
52 | } | ||
45 | 53 | ||
46 | .signupView h1 | 54 | .signupView h1 |
47 | { | 55 | { |
48 | font-size: 45px !important; | 56 | font-size: 45px !important; |
49 | } | 57 | } |
50 | 58 | ||
51 | .signupView p | 59 | .signupView p |
52 | { | 60 | { |
53 | text-indent: 50px; | 61 | text-indent: 50px; |
54 | text-align: justify; | 62 | text-align: justify; |
55 | font-size:15px; | 63 | font-size:15px; |
56 | } | 64 | } |
57 | 65 | ||
58 | .signupView h6 | 66 | .signupView h6 |
59 | { | 67 | { |
60 | text-align: center; | 68 | text-align: center; |
61 | } | 69 | } |
62 | 70 | ||
63 | .signupView i | 71 | .signupView i |
64 | { | 72 | { |
65 | display: inline-block; | 73 | display: inline-block; |
66 | width: 100%; | 74 | width: 100%; |
67 | text-align: center; | 75 | text-align: center; |
68 | } | 76 | } |
69 | 77 | ||
70 | 78 | ||
71 | 79 | ||
72 | .wrapper | 80 | .wrapper |
73 | { | 81 | { |
74 | overflow: hidden; | 82 | overflow: hidden; |
75 | } | 83 | } |
76 | 84 | ||
77 | .page-header | 85 | .page-header |
78 | { | 86 | { |
79 | text-align: center; | 87 | text-align: center; |
80 | color:#00b395; | 88 | color:#00b395; |
81 | font-weight: bolder; | 89 | font-weight: bolder; |
82 | } | 90 | } |
83 | 91 | ||
84 | .side-heading | 92 | .side-heading |
85 | { | 93 | { |
86 | /*padding: 10px;*/ | 94 | /*padding: 10px;*/ |
87 | text-align: left; | 95 | text-align: left; |
88 | font-weight: bold; | 96 | font-weight: bold; |
89 | color:#00b395; | 97 | color:#00b395; |
90 | font-size: 14px; | 98 | font-size: 14px; |
91 | } | 99 | } |
92 | 100 | ||
93 | .signupView hr { | 101 | .signupView hr { |
94 | display: block; | 102 | display: block; |
95 | height: 1px; | 103 | height: 1px; |
96 | border: 0; | 104 | border: 0; |
97 | border-top: 1px solid #00b395; | 105 | border-top: 1px solid #00b395; |
98 | padding: 0; | 106 | padding: 0; |
99 | } | 107 | } |
100 | 108 | ||
101 | .blue { | 109 | .blue { |
102 | background-color: #00b395; | 110 | background-color: #00b395; |
103 | background-image: -webkit-linear-gradient(top,#00b395,#00cdaa); | 111 | background-image: -webkit-linear-gradient(top,#00b395,#00cdaa); |
104 | background-image: -moz-linear-gradient(top,#00b395,#00cdaa); | 112 | background-image: -moz-linear-gradient(top,#00b395,#00cdaa); |
105 | background-image: -ms-linear-gradient(top,#00b395,#00cdaa); | 113 | background-image: -ms-linear-gradient(top,#00b395,#00cdaa); |
106 | background-image: -o-linear-gradient(top,#00b395,#00cdaa); | 114 | background-image: -o-linear-gradient(top,#00b395,#00cdaa); |
107 | background-image: linear-gradient(top,#00b395,#00cdaa); | 115 | background-image: linear-gradient(top,#00b395,#00cdaa); |
108 | 116 | ||
109 | border: 1px solid #00b395; | 117 | border: 1px solid #00b395; |
110 | color: white; | 118 | color: white; |
111 | 119 | ||
112 | font-size: 13px; | 120 | font-size: 13px; |
113 | font-weight: bold; | 121 | font-weight: bold; |
114 | text-align: center; | 122 | text-align: center; |
115 | height: 27px; | 123 | height: 27px; |
116 | line-height: 27px; | 124 | line-height: 27px; |
117 | min-width: 54px; | 125 | min-width: 54px; |
118 | padding: 0 10px; | 126 | padding: 0 10px; |
119 | text-decoration: none; | 127 | text-decoration: none; |
120 | } | 128 | } |
121 | 129 | ||
122 | .blue:hover { | 130 | .blue:hover { |
123 | border: 1px solid #00b395; | 131 | border: 1px solid #00b395; |
124 | 132 | ||
125 | color: white; | 133 | color: white; |
126 | background-color: #00b395; | 134 | background-color: #00b395; |
127 | background-image: -webkit-linear-gradient(top,#00b395,#009f85); | 135 | background-image: -webkit-linear-gradient(top,#00b395,#009f85); |
128 | background-image: -moz-linear-gradient(top,#00b395,#009f85); | 136 | background-image: -moz-linear-gradient(top,#00b395,#009f85); |
129 | background-image: -ms-linear-gradient(top,#00b395,#009f85); | 137 | background-image: -ms-linear-gradient(top,#00b395,#009f85); |
130 | background-image: -o-linear-gradient(top,#00b395,#009f85); | 138 | background-image: -o-linear-gradient(top,#00b395,#009f85); |
131 | background-image: linear-gradient(top,#00b395,#009f85); | 139 | background-image: linear-gradient(top,#00b395,#009f85); |
132 | 140 | ||
133 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.1); | 141 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.1); |
134 | -moz-box-shadow: 0 1px 1px rgba(0,0,0,.1); | 142 | -moz-box-shadow: 0 1px 1px rgba(0,0,0,.1); |
135 | box-shadow: 0 1px 1px rgba(0,0,0,.1); | 143 | box-shadow: 0 1px 1px rgba(0,0,0,.1); |
136 | width: auto; | 144 | width: auto; |
137 | height: 27px; | 145 | height: 27px; |
138 | } | 146 | } |
139 | 147 |
imports/client/views/org/admin/AdminLayout.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 { AdminSidebar } from './Sidebar' | 9 | import { AdminSidebar } from './Sidebar' |
10 | import { AdminBreadcrumb } from './Breadcrumb' | 10 | import { AdminBreadcrumb } from './Breadcrumb' |
11 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; | 11 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; |
12 | import { Navbar,Modal, Nav, NavItem, | 12 | import { Navbar,Modal, Nav, NavItem, |
13 | Glyphicon, Collapse, | 13 | Glyphicon, Collapse, |
14 | NavbarToggler, NavbarBrand, | 14 | NavbarToggler, NavbarBrand, |
15 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | 15 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, |
16 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; | 16 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; |
17 | import { VerifyModule } from '/imports/client/views/verify/module/index' | 17 | import { VerifyModule } from '/imports/client/views/verify/module/index' |
18 | 18 | ||
19 | var Accordion = require('react-bootstrap').Accordion; | 19 | var Accordion = require('react-bootstrap').Accordion; |
20 | var Panel = require('react-bootstrap').Panel; | 20 | var Panel = require('react-bootstrap').Panel; |
21 | export class AdminAppLayout extends Component { | 21 | export class AdminAppLayout extends Component { |
22 | render() { | 22 | render() { |
23 | const {user, org} = this.props; | 23 | const {user, org} = this.props; |
24 | return ( | 24 | return ( |
25 | <div className = "appLayout-box"> | 25 | <div className = "appLayout-box"> |
26 | <div className="page-container"> | 26 | <div className="page-container"> |
27 | <div className="page-content"> | 27 | <div className="page-content"> |
28 | <AdminSidebar | 28 | <AdminSidebar |
29 | user = {user} | 29 | user = {user} |
30 | org = {org} | 30 | org = {org} |
31 | /> | 31 | /> |
32 | <div className="content-wrapper"> | 32 | <div className="content-wrapper"> |
33 | <AdminBreadcrumb /> | 33 | <AdminBreadcrumb /> |
34 | <div className="content"> | 34 | <div className="content"> |
35 | <div className="row"> | 35 | <div className="row"> |
36 | <div className="col-lg-3 col-md-6"> | 36 | <div className="col-lg-3 col-md-6"> |
37 | <div className="thumbnail"> | 37 | <div className="thumbnail"> |
38 | <Link to="/students" > | 38 | <Link to="/students" > |
39 | <div className="thumb thumb-rounded"> | 39 | <div className="thumb thumb-rounded"> |
40 | <img src="assets/images/download2.png" alt="" /> | 40 | <img src="assets/images/download2.png" alt="" /> |
41 | </div> | 41 | </div> |
42 | <div className="caption text-center"> | 42 | <div className="caption text-center"> |
43 | <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> | 43 | <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> |
44 | </div> | 44 | </div> |
45 | </Link> | 45 | </Link> |
46 | </div> | 46 | </div> |
47 | </div> | 47 | </div> |
48 | <div className="col-lg-3 col-md-6"> | 48 | <div className="col-lg-3 col-md-6"> |
49 | <div className="thumbnail"> | 49 | <div className="thumbnail"> |
50 | <Link to="/staff" > | 50 | <Link to="/staff" > |
51 | <div className="thumb thumb-rounded"> | 51 | <div className="thumb thumb-rounded"> |
52 | <img src="assets/images/download3.png" alt=""/> | 52 | <img src="assets/images/download3.png" alt=""/> |
53 | </div> | 53 | </div> |
54 | <div className="caption text-center"> | 54 | <div className="caption text-center"> |
55 | <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> | 55 | <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> |
56 | </div> | 56 | </div> |
57 | </Link> | 57 | </Link> |
58 | </div> | 58 | </div> |
59 | </div> | 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 | </div> | 72 | </div> |
61 | </div> | 73 | </div> |
62 | </div> | 74 | </div> |
63 | </div> | 75 | </div> |
64 | </div> | 76 | </div> |
65 | </div> | 77 | </div> |
66 | ); | 78 | ); |
67 | }; | 79 | }; |
68 | 80 | ||
69 | }; | 81 | }; |
70 | 82 |
imports/client/views/org/admin/Header.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.css'; | ||
8 | 9 | ||
9 | 10 | ||
10 | export class Header extends Component { | 11 | export class Header extends Component { |
11 | 12 | ||
12 | constructor(props) { | 13 | constructor(props) { |
13 | super(props); | 14 | super(props); |
14 | this.state = { | 15 | this.state = { |
15 | 16 | ||
16 | }; | 17 | }; |
17 | this.onUpdate = this.onUpdate.bind(this); | 18 | this.onUpdate = this.onUpdate.bind(this); |
18 | }; | 19 | }; |
19 | 20 | ||
20 | onUpdate(key, value) { | 21 | onUpdate(key, value) { |
21 | this.setState({[key]: value}); | 22 | this.setState({[key]: value}); |
22 | }; | 23 | }; |
23 | 24 | ||
24 | render() { | 25 | render() { |
25 | return ( | 26 | return ( |
26 | <div className = "enterPane-box"> | 27 | <div className = "enterPane-box"> |
27 | <div className="row"> | 28 | <div className="row"> |
29 | |||
28 | <div className="col-lg-3 col-md-6"> | 30 | <div className="col-lg-3 col-md-6"> |
29 | <div className="thumbnail"> | 31 | <Link to="/parents" > |
30 | <Link to="/students" > | 32 | <div className="panel panel-body"> |
31 | <div className="thumb thumb-rounded"> | 33 | <div className="media"> |
32 | <img src="assets/images/download2.png" alt="" /> | 34 | <div className="media-left"> |
35 | <img src="assets/images/download2.png" className="img-circle" alt=""/> | ||
33 | </div> | 36 | </div> |
34 | <div className="caption text-center"> | 37 | |
35 | <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> | 38 | <div className="media-body"> |
39 | <h6 className="media-heading">Students</h6> | ||
40 | <p className="text-muted">Click to view</p> | ||
36 | </div> | 41 | </div> |
37 | </Link> | ||
38 | </div> | 42 | </div> |
43 | </div> | ||
44 | </Link> | ||
39 | </div> | 45 | </div> |
40 | <div className="col-lg-3 col-md-6"> | 46 | <div className="col-lg-3 col-md-6"> |
41 | <div className="thumbnail"> | 47 | <Link to="/parents" > |
42 | <Link to="/staff" > | 48 | <div className="panel panel-body"> |
43 | <div className="thumb thumb-rounded"> | 49 | <div className="media"> |
44 | <img src="assets/images/download3.png" alt=""/> | 50 | <div className="media-left"> |
51 | <img src="assets/images/download.png" className="img-circle" alt=""/> | ||
45 | </div> | 52 | </div> |
46 | <div className="caption text-center"> | 53 | |
47 | <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> | 54 | <div className="media-body"> |
55 | <h6 className="media-heading">Teachers</h6> | ||
56 | <p className="text-muted">Click to view</p> | ||
48 | </div> | 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 | </div> | 76 | </div> |
77 | </Link> | ||
51 | </div> | 78 | </div> |
52 | 79 | ||
53 | </div> | 80 | </div> |
54 | </div> | 81 | </div> |
55 | ); | 82 | ); |
56 | }; | 83 | }; |
57 | 84 | ||
58 | }; | 85 | }; |
imports/client/views/org/admin/header.css
File was created | 1 | .img-circle | |
2 | { | ||
3 | width: 70px; | ||
4 | height: 70px; | ||
5 | } | ||
6 |
imports/client/views/org/admin/parents/index.js
File was created | 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); | ||
67 |
imports/client/views/org/admin/parents/parentsview.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 | 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 | }; | ||
109 |
imports/client/views/org/admin/parents/view/ParentRow.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 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 | }; | ||
55 |
imports/client/views/org/admin/parents/view/ParentTable.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 {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 | }; | ||
65 |
imports/client/views/org/admin/students/index.js
1 | // import { StudentDataController } from '/imports/client/views/org/admin/students/index' | 1 | // import { StudentDataController } from '/imports/client/views/org/admin/students/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 { StudentView } from './StudentView'; | 12 | import { StudentView } from './StudentView'; |
13 | import { Students } from '/imports/collections/students/index'; | 13 | import { Students } from '/imports/collections/students/index'; |
14 | 14 | ||
15 | 15 | ||
16 | const meteorTick = (props, onData) => { | 16 | const meteorTick = (props, onData) => { |
17 | 17 | ||
18 | const handles = [ | 18 | const handles = [ |
19 | Meteor.subscribe('users.current'), | 19 | Meteor.subscribe('users.current'), |
20 | Meteor.subscribe('orgs.current'), | 20 | Meteor.subscribe('orgs.current'), |
21 | Meteor.subscribe('users.forMyOrg'), | 21 | Meteor.subscribe('users.forMyOrg'), |
22 | Meteor.subscribe('student.forMyOrg'), | 22 | Meteor.subscribe('student.forMyOrg'), |
23 | ]; | 23 | ]; |
24 | 24 | ||
25 | if(_.every(handles, (handle) => (handle.ready()) )) { | 25 | if(_.every(handles, (handle) => (handle.ready()) )) { |
26 | const user = Users.current(); | 26 | const user = Users.current(); |
27 | const org = Orgs.current(); | 27 | const org = Orgs.current(); |
28 | students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : ""; | 28 | students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : ""; |
29 | console.log(students); | ||
29 | studentData = Students.find().fetch() ? Students.find().fetch() : ""; | 30 | studentData = Students.find().fetch() ? Students.find().fetch() : ""; |
30 | for(var i=0; i< students.length; i++){ | 31 | for(var i=0; i< students.length; i++){ |
31 | for(var j=0; j< studentData.length; j++){ | 32 | for(var j=0; j< studentData.length; j++){ |
32 | if(students[i]._id == studentData[j].userId){ | 33 | if(students[i]._id == studentData[j].userId){ |
33 | students[i].class = studentData[j].class; | 34 | students[i].class = studentData[j].class; |
34 | students[i].dob = studentData[j].dob; | 35 | students[i].dob = studentData[j].dob; |
35 | } | 36 | } |
36 | } | 37 | } |
37 | } | 38 | } |
38 | onData(null, { | 39 | onData(null, { |
39 | data: { | 40 | data: { |
40 | user: user, | 41 | user: user, |
41 | org: org, | 42 | org: org, |
42 | students: students, | 43 | students: students, |
43 | studentData: studentData | 44 | studentData: studentData |
44 | }, | 45 | }, |
45 | }); | 46 | }); |
46 | } | 47 | } |
47 | 48 | ||
48 | return () => { | 49 | return () => { |
49 | _.each(handles, (handle) => handle.stop() ); | 50 | _.each(handles, (handle) => handle.stop() ); |
50 | }; | 51 | }; |
51 | }; | 52 | }; |
52 | 53 | ||
53 | 54 | ||
54 | const reduxTick = (props, onData) => { | 55 | const reduxTick = (props, onData) => { |
55 | onData(null, { | 56 | onData(null, { |
56 | data: {} | 57 | data: {} |
57 | }); | 58 | }); |
58 | }; | 59 | }; |
59 | 60 | ||
60 | 61 | ||
61 | export const StudentDataController = composeAll( | 62 | export const StudentDataController = composeAll( |
62 | composeWithTracker(meteorTick, Loading), | 63 | composeWithTracker(meteorTick, Loading), |
63 | compose(reduxTick, Loading), | 64 | compose(reduxTick, Loading), |
64 | )(StudentView); | 65 | )(StudentView); |
65 | 66 |
imports/collections/parents/methods.js
1 | // import {Parents } from '/imports/collections/parents/methods' | 1 | // import {Parents } from '/imports/collections/parents/methods' |
2 | import _ from 'lodash'; | 2 | import _ from 'lodash'; |
3 | import { Meteor } from 'meteor/meteor'; | 3 | import { Meteor } from 'meteor/meteor'; |
4 | import { ValidatedMethod } from 'meteor/mdg:validated-method'; | 4 | import { ValidatedMethod } from 'meteor/mdg:validated-method'; |
5 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | 5 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; |
6 | import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; | 6 | import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; |
7 | import { Bert } from 'meteor/themeteorchef:bert'; | 7 | import { Bert } from 'meteor/themeteorchef:bert'; |
8 | import { Users } from '/imports/collections/users/index'; | 8 | import { Users } from '/imports/collections/users/index'; |
9 | import { Students } from '/imports/collections/students/index'; | 9 | import { Students } from '/imports/collections/students/index'; |
10 | import { Orgs } from '/imports/collections/orgs/index'; | 10 | import { Orgs } from '/imports/collections/orgs/index'; |
11 | export const studentMethods = new ValidatedMethod({ | 11 | export const parentMethods = new ValidatedMethod({ |
12 | name: 'student.method', | 12 | name: 'parent.method', |
13 | 13 | ||
14 | validate: new SimpleSchema({ | 14 | validate: new SimpleSchema({ |
15 | itemId: { type: String }, | 15 | itemId: { type: String }, |
16 | }).validator(), | 16 | }).validator(), |
17 | 17 | ||
18 | run({itemId}) { | 18 | run({itemId}) { |
19 | return {}; | 19 | return {}; |
20 | }, | 20 | }, |
21 | 21 | ||
22 | }); | 22 | }); |
23 | |||
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 | }); | ||
100 | 23 |
imports/collections/parents/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 { 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 | }); | ||
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 | 9 | ||
10 | import '/imports/collections/staff/methods'; | 10 | import '/imports/collections/staff/methods'; |
11 | import '/imports/collections/staff/publications'; | 11 | import '/imports/collections/staff/publications'; |
12 | import '/imports/collections/staff/serverCsvUpload'; | 12 | import '/imports/collections/staff/serverCsvUpload'; |
13 | |||
14 | import '/imports/collections/parents/methods'; | ||
15 | import '/imports/collections/parents/publications'; | ||
13 | 16 |