Commit 84e744e348cef2d371a8563dc3299aefe1763511
1 parent
e277faafa4
Exists in
master
fixed users page
Showing
10 changed files
with
53 additions
and
36 deletions
Show diff stats
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 | import { Users } from '/imports/collections/users/index'; | 8 | import { Users } from '/imports/collections/users/index'; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * General Components | 11 | * General Components |
12 | */ | 12 | */ |
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 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | 18 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; |
19 | 19 | ||
20 | 20 | ||
21 | import { AdminAppModule } from '/imports/client/views/org/admin/app/module/Index'; | 21 | import { AdminAppModule } from '/imports/client/views/org/admin/app/module/Index'; |
22 | import { DashboardController } from '/imports/client/views/org/admin/dashboard/index'; | 22 | import { DashboardController } from '/imports/client/views/org/admin/dashboard/index'; |
23 | import { Orgs } from '/imports/collections/orgs/index'; | 23 | import { Orgs } from '/imports/collections/orgs/index'; |
24 | import { importCsvController } from '/imports/client/views/org/importCsv/index' | 24 | import { importCsvController } from '/imports/client/views/org/importCsv/index' |
25 | 25 | ||
26 | /** | 26 | /** |
27 | Admin | 27 | Admin |
28 | **/ | 28 | **/ |
29 | import { AdminSettingsController } from '/imports/client/views/org/admin/settings/index' | 29 | import { AdminSettingsController } from '/imports/client/views/org/admin/settings/index' |
30 | // | 30 | // |
31 | import { AdminUsersModule } from '/imports/client/views/org/admin/users/module/index' | 31 | import { AdminUsersModule } from '/imports/client/views/org/admin/users/module/index' |
32 | import { AdminUsersListController } from '/imports/client/views/org/admin/users/list/index' | 32 | import { AdminUsersListController } from '/imports/client/views/org/admin/users/list/index' |
33 | import { StudentDataController } from '/imports/client/views/org/admin/users/students/index' | 33 | import { StudentDataController } from '/imports/client/views/org/admin/users/students/index' |
34 | import { staffViewController } from '/imports/client/views/org/admin/users/staff/index' | 34 | import { staffViewController } from '/imports/client/views/org/admin/users/staff/index' |
35 | import { ParentViewController } from '/imports/client/views/org/admin/users/parents/index' | 35 | import { ParentViewController } from '/imports/client/views/org/admin/users/parents/index' |
36 | 36 | ||
37 | //Admin mail | 37 | //Admin mail |
38 | import { AdminMailModule } from '/imports/client/views/org/admin/mailbox/module/index' | 38 | import { AdminMailModule } from '/imports/client/views/org/admin/mailbox/module/index' |
39 | import { AdminInboxController } from '/imports/client/views/org/admin/mailbox/inbox/index' | 39 | import { AdminInboxController } from '/imports/client/views/org/admin/mailbox/inbox/index' |
40 | import { AdminComposeMailController } from '/imports/client/views/org/admin/mailbox/compose/index' | 40 | import { AdminComposeMailController } from '/imports/client/views/org/admin/mailbox/compose/index' |
41 | import { AdminSentMailController } from '/imports/client/views/org/admin/mailbox/sent/index' | 41 | import { AdminSentMailController } from '/imports/client/views/org/admin/mailbox/sent/index' |
42 | import { AdminImportantMailController } from '/imports/client/views/org/admin/mailbox/important/index' | 42 | import { AdminImportantMailController } from '/imports/client/views/org/admin/mailbox/important/index' |
43 | 43 | ||
44 | 44 | ||
45 | //students | 45 | //students |
46 | 46 | ||
47 | //teachers | 47 | //teachers |
48 | 48 | ||
49 | //parents | 49 | //parents |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Invalid Org Components | 52 | * Invalid Org Components |
53 | */ | 53 | */ |
54 | 54 | ||
55 | /** | 55 | /** |
56 | There are three types of routes | 56 | There are three types of routes |
57 | 1)getOrgRoutes: all the routes that should be present for a registered org | 57 | 1)getOrgRoutes: all the routes that should be present for a registered org |
58 | 2)getInvalidOrgRoute: all the routes where someone tries to enter a subdomain which hasn't been registered yet (404 mostly :D) | 58 | 2)getInvalidOrgRoute: all the routes where someone tries to enter a subdomain which hasn't been registered yet (404 mostly :D) |
59 | 3)getNonOrgRoutes: all routes linked to normal site, ie signing up a new org. CHeking out demo and everything internal | 59 | 3)getNonOrgRoutes: all routes linked to normal site, ie signing up a new org. CHeking out demo and everything internal |
60 | **/ | 60 | **/ |
61 | const getOrgAdminRoutes = () => ( | 61 | const getOrgAdminRoutes = () => ( |
62 | <Router history={ browserHistory }> | 62 | <Router history={ browserHistory }> |
63 | <Route path="/" component = { AdminAppModule } > | 63 | <Route path="/" component = { AdminAppModule } > |
64 | <IndexRoute name="index" component = { DashboardController } /> | 64 | <IndexRoute name="index" component = { DashboardController } /> |
65 | <Route name="import" path="/import" component = { importCsvController } /> | 65 | <Route name="import" path="/import" component = { importCsvController } /> |
66 | <Route name="settings" path="/settings" component = { AdminSettingsController } /> | 66 | <Route name="settings" path="/settings" component = { AdminSettingsController } /> |
67 | <Route name="users" path = "/users" component = {AdminUsersModule}> | 67 | <Route name="users" exact={true} path = "/users" component = {AdminUsersModule}> |
68 | <IndexRoute component = {AdminUsersListController} /> | 68 | <IndexRoute component = {AdminUsersListController} /> |
69 | <Route name="students" path = "/users/students" component = {StudentDataController} /> | 69 | <Route name="students" path = "/users/students" component = {StudentDataController} /> |
70 | <Route name="staff" path = "/users/staff" component = {staffViewController} /> | 70 | <Route name="staff" path = "/users/staff" component = {staffViewController} /> |
71 | <Route name="parents" path = "/users/parents" component = {ParentViewController} /> | 71 | <Route name="parents" path = "/users/parents" component = {ParentViewController} /> |
72 | </Route> | 72 | </Route> |
73 | <Route name="mail" path = "/mail" component = {AdminMailModule}> | 73 | <Route name="mail" path = "/mail" component = {AdminMailModule}> |
74 | <IndexRoute component = {AdminInboxController} /> | 74 | <IndexRoute component = {AdminInboxController} /> |
75 | <Route name="mail-compose" path = "/mail/compose" component = {AdminComposeMailController} /> | 75 | <Route name="mail-compose" path = "/mail/compose" component = {AdminComposeMailController} /> |
76 | <Route name="mail-sent" path = "/mail/sent" component = {AdminSentMailController} /> | 76 | <Route name="mail-sent" path = "/mail/sent" component = {AdminSentMailController} /> |
77 | <Route name="mail-important" path = "/mail/important" component = {AdminImportantMailController} /> | 77 | <Route name="mail-important" path = "/mail/important" component = {AdminImportantMailController} /> |
78 | </Route> | 78 | </Route> |
79 | <Route path="*" component = { NotFound } /> | 79 | <Route path="*" component = { NotFound } /> |
80 | </Route> | 80 | </Route> |
81 | </Router> | 81 | </Router> |
82 | ) | 82 | ) |
83 | const getOrgNonLoggedInRoutes = () => ( | 83 | const getOrgNonLoggedInRoutes = () => ( |
84 | <Router history={ browserHistory }> | 84 | <Router history={ browserHistory }> |
85 | <Route path="/" component={ EnterModule }> | 85 | <Route path="/" component={ EnterModule }> |
86 | <Route path="*" component={ NotFound } /> | 86 | <Route path="*" component={ NotFound } /> |
87 | </Route> | 87 | </Route> |
88 | </Router> | 88 | </Router> |
89 | ) | 89 | ) |
90 | 90 | ||
91 | const getInvalidOrgRoute = () => ( | 91 | const getInvalidOrgRoute = () => ( |
92 | <Router history={ browserHistory }> | 92 | <Router history={ browserHistory }> |
93 | <Route path="/" component={ App }> | 93 | <Route path="/" component={ App }> |
94 | <IndexRoute name="index" component={ NotFound } /> | 94 | <IndexRoute name="index" component={ NotFound } /> |
95 | <Route path="*" component={ NotFound } /> | 95 | <Route path="*" component={ NotFound } /> |
96 | </Route> | 96 | </Route> |
97 | </Router> | 97 | </Router> |
98 | ) | 98 | ) |
99 | 99 | ||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * NonOrg Components | 102 | * NonOrg Components |
103 | */ | 103 | */ |
104 | import Signup from '/imports/client/views/nonOrg/enter/SignupView'; | 104 | import Signup from '/imports/client/views/nonOrg/enter/SignupView'; |
105 | import { NonOrgApp } from '/imports/client/layouts/NonOrgApp'; | 105 | import { NonOrgApp } from '/imports/client/layouts/NonOrgApp'; |
106 | import {NonOrgAppModule} from '/imports/client/views/nonOrg/app/module/Index'; | 106 | import {NonOrgAppModule} from '/imports/client/views/nonOrg/app/module/Index'; |
107 | 107 | ||
108 | const getNonOrgRoutes = () => ( | 108 | const getNonOrgRoutes = () => ( |
109 | <Router history={ browserHistory }> | 109 | <Router history={ browserHistory }> |
110 | <Route path="/" component={ NonOrgApp }> | 110 | <Route path="/" component={ NonOrgApp }> |
111 | <IndexRoute name="index" component={ NonOrgAppModule } /> | 111 | <IndexRoute name="index" component={ NonOrgAppModule } /> |
112 | <Route name="signup" path="/signup" component={ Signup } /> | 112 | <Route name="signup" path="/signup" component={ Signup } /> |
113 | <Route path="*" component={ NotFound } /> | 113 | <Route path="*" component={ NotFound } /> |
114 | </Route> | 114 | </Route> |
115 | </Router> | 115 | </Router> |
116 | ) | 116 | ) |
117 | 117 | ||
118 | //Authenticate function to give access to users only | 118 | //Authenticate function to give access to users only |
119 | const authenticate = (nextState, replace) => { | 119 | const authenticate = (nextState, replace) => { |
120 | if (!Meteor.loggingIn() && !Meteor.userId()) { | 120 | if (!Meteor.loggingIn() && !Meteor.userId()) { |
121 | replace({ | 121 | replace({ |
122 | pathname: '/login', | 122 | pathname: '/login', |
123 | state: { nextPathname: nextState.location.pathname }, | 123 | state: { nextPathname: nextState.location.pathname }, |
124 | }); | 124 | }); |
125 | } | 125 | } |
126 | }; | 126 | }; |
127 | 127 | ||
128 | 128 | ||
129 | /** | 129 | /** |
130 | 130 | ||
131 | **/ | 131 | **/ |
132 | const detectOrg = () => { | 132 | const detectOrg = () => { |
133 | orgSlug = ""; | 133 | orgSlug = ""; |
134 | //www.app.ydapp.in | 134 | //www.app.ydapp.in |
135 | // | 135 | // |
136 | var hostnameArray = document.location.hostname.split( "." ); | 136 | var hostnameArray = document.location.hostname.split( "." ); |
137 | //['www','app', 'ydapp','in']; | 137 | //['www','app', 'ydapp','in']; |
138 | if(hostnameArray[0] !== "www"){ | 138 | if(hostnameArray[0] !== "www"){ |
139 | if((hostnameArray[1]==='localhost'||hostnameArray[1]==='ydapp')){ | 139 | if((hostnameArray[1]==='localhost'||hostnameArray[1]==='ydapp')){ |
140 | orgSlug = hostnameArray[0]; | 140 | orgSlug = hostnameArray[0]; |
141 | } | 141 | } |
142 | }else{ | 142 | }else{ |
143 | if((hostnameArray[2]==='localhost'||hostnameArray[2]==='ydapp')){ | 143 | if((hostnameArray[2]==='localhost'||hostnameArray[2]==='ydapp')){ |
144 | orgSlug = hostnameArray[1]; | 144 | orgSlug = hostnameArray[1]; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | if(orgSlug!==""){ | 148 | if(orgSlug!==""){ |
149 | console.log(orgSlug); | 149 | console.log(orgSlug); |
150 | Meteor.call('checkExistingOrg', {slug:orgSlug}, function(err, res) { | 150 | Meteor.call('checkExistingOrg', {slug:orgSlug}, function(err, res) { |
151 | console.log(err); | 151 | console.log(err); |
152 | console.log(res); | 152 | console.log(res); |
153 | 153 | ||
154 | if(res){ | 154 | if(res){ |
155 | Session.set('orgId', res._id); | 155 | Session.set('orgId', res._id); |
156 | Session.set('orgSlug', orgSlug); | 156 | Session.set('orgSlug', orgSlug); |
157 | if(Meteor.loggingIn() || Meteor.userId()){ | 157 | if(Meteor.loggingIn() || Meteor.userId()){ |
158 | userRole = _.find(res.users, {userId: Meteor.user()._id}).role; | 158 | userRole = _.find(res.users, {userId: Meteor.user()._id}).role; |
159 | Session.set('userRole', userRole); | 159 | Session.set('userRole', userRole); |
160 | if(userRole=='ADMIN'){ | 160 | if(userRole=='ADMIN'){ |
161 | render(getOrgAdminRoutes(),document.getElementById('app')); | 161 | render(getOrgAdminRoutes(),document.getElementById('app')); |
162 | }else{ | 162 | }else{ |
163 | 163 | ||
164 | } | 164 | } |
165 | }else{ | 165 | }else{ |
166 | render(getOrgNonLoggedInRoutes(),document.getElementById('app')); | 166 | render(getOrgNonLoggedInRoutes(),document.getElementById('app')); |
167 | } | 167 | } |
168 | }else{ | 168 | }else{ |
169 | render(getInvalidOrgRoute(),document.getElementById('app')); | 169 | render(getInvalidOrgRoute(),document.getElementById('app')); |
170 | } | 170 | } |
171 | }); | 171 | }); |
172 | }else{ | 172 | }else{ |
173 | render(getNonOrgRoutes(),document.getElementById('app')); | 173 | render(getNonOrgRoutes(),document.getElementById('app')); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | const checkSlug = (nextState, replace) => { | 176 | const checkSlug = (nextState, replace) => { |
177 | orgId = Session.get('orgId'); | 177 | orgId = Session.get('orgId'); |
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | Meteor.startup(() => { | 181 | Meteor.startup(() => { |
182 | detectOrg(); | 182 | detectOrg(); |
183 | }); | 183 | }); |
184 | 184 |
imports/client/views/org/admin/app/module/Breadcrumb.js
1 | import _ from 'lodash'; | 1 | import _ from 'lodash'; |
2 | import { Meteor } from 'meteor/meteor'; | 2 | import { Meteor } from 'meteor/meteor'; |
3 | 3 | ||
4 | import React, { Component } from 'react'; | 4 | import React, { Component } from 'react'; |
5 | import { Link,browserHistory } from 'react-router'; | 5 | import { Link,browserHistory } from 'react-router'; |
6 | import { Navbar,Modal, Nav, NavItem, | 6 | import { Navbar,Modal, Nav, NavItem, |
7 | Glyphicon, Collapse, FormGroup, FormControl, Panel, | 7 | Glyphicon, Collapse, FormGroup, FormControl, Panel, |
8 | NavbarToggler, NavbarBrand, Table, ButtonToolbar, | 8 | NavbarToggler, NavbarBrand, Table, ButtonToolbar, |
9 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | 9 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, |
10 | NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap'; | 10 | NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap'; |
11 | 11 | ||
12 | 12 | ||
13 | export class AdminBreadcrumb extends Component { | 13 | export class AdminBreadcrumb extends Component { |
14 | 14 | ||
15 | constructor(props) { | 15 | constructor(props) { |
16 | super(props); | 16 | super(props); |
17 | this.state = { | 17 | this.state = { |
18 | 18 | ||
19 | }; | 19 | }; |
20 | this.onUpdate = this.onUpdate.bind(this); | 20 | this.onUpdate = this.onUpdate.bind(this); |
21 | }; | 21 | }; |
22 | 22 | ||
23 | onUpdate(key, value) { | 23 | onUpdate(key, value) { |
24 | this.setState({[key]: value}); | 24 | this.setState({[key]: value}); |
25 | }; | 25 | }; |
26 | 26 | ||
27 | breadcrumbItem(){ | 27 | breadcrumbItem(){ |
28 | layout = this.props.layout; | 28 | layout = this.props.layout; |
29 | var item=[], i=0; | 29 | var item=[], i=0; |
30 | var length = Object.keys(layout).length; | 30 | var length = Object.keys(layout).length; |
31 | console.log(length); | ||
32 | for(breadcrumb in layout){ | 31 | for(breadcrumb in layout){ |
33 | if(i==0){ | 32 | if(i==0){ |
34 | item.push( | 33 | item.push( |
35 | <Breadcrumb.Item href="#" key={i}> | 34 | <Breadcrumb.Item href="#" key={i}> |
36 | <i className="icon-home2 position-left"></i> {layout[breadcrumb]} | 35 | <i className="icon-home2 position-left"></i> {layout[breadcrumb]} |
37 | </Breadcrumb.Item> | 36 | </Breadcrumb.Item> |
38 | ) | 37 | ) |
39 | i++; | 38 | i++; |
40 | }else if(i<length-1){ | 39 | }else if(i<length-1){ |
41 | item.push( | 40 | item.push( |
42 | <Breadcrumb.Item href="#" key={i}> | 41 | <Breadcrumb.Item href="#" key={i}> |
43 | {layout[breadcrumb]} | 42 | {layout[breadcrumb]} |
44 | </Breadcrumb.Item> | 43 | </Breadcrumb.Item> |
45 | ) | 44 | ) |
46 | i++; | 45 | i++; |
47 | }else if(i==length-1){ | 46 | }else if(i==length-1){ |
48 | item.push( | 47 | item.push( |
49 | <Breadcrumb.Item active href="#" key={i}> | 48 | <Breadcrumb.Item active href="#" key={i}> |
50 | {layout[breadcrumb]} | 49 | {layout[breadcrumb]} |
51 | </Breadcrumb.Item> | 50 | </Breadcrumb.Item> |
52 | ) | 51 | ) |
53 | } | 52 | } |
54 | } | 53 | } |
55 | return item; | 54 | return item; |
56 | } | 55 | } |
57 | 56 | ||
58 | render() { | 57 | render() { |
59 | 58 | ||
60 | return ( | 59 | return ( |
61 | <div className="page-header page-header-default"> | 60 | <div className="page-header page-header-default"> |
62 | <div className="breadcrumb-line"> | 61 | <div className="breadcrumb-line"> |
63 | <Breadcrumb> | 62 | <Breadcrumb> |
64 | {this.breadcrumbItem()} | 63 | {this.breadcrumbItem()} |
65 | </Breadcrumb> | 64 | </Breadcrumb> |
66 | 65 | ||
67 | {/** | 66 | {/** |
68 | <ul className="breadcrumb-elements"> | 67 | <ul className="breadcrumb-elements"> |
69 | <NavItem href="#"><i className="icon-comment-discussion position-left"></i> Support</NavItem> | 68 | <NavItem href="#"><i className="icon-comment-discussion position-left"></i> Support</NavItem> |
70 | <NavDropdown title="Settings" id="setting"> | 69 | <NavDropdown title="Settings" id="setting"> |
71 | <MenuItem><i className="icon-user-lock"></i> Account security</MenuItem> | 70 | <MenuItem><i className="icon-user-lock"></i> Account security</MenuItem> |
72 | <MenuItem><i className="icon-statistics"></i> Analytics</MenuItem> | 71 | <MenuItem><i className="icon-statistics"></i> Analytics</MenuItem> |
73 | <MenuItem><i className="icon-accessibility"></i> Accessibility</MenuItem> | 72 | <MenuItem><i className="icon-accessibility"></i> Accessibility</MenuItem> |
74 | <MenuItem divider/> | 73 | <MenuItem divider/> |
75 | <MenuItem><i className="icon-gear"></i> All settings</MenuItem> | 74 | <MenuItem><i className="icon-gear"></i> All settings</MenuItem> |
76 | </NavDropdown> | 75 | </NavDropdown> |
77 | </ul> | 76 | </ul> |
78 | **/} | 77 | **/} |
79 | </div> | 78 | </div> |
80 | </div> | 79 | </div> |
81 | ); | 80 | ); |
82 | }; | 81 | }; |
83 | 82 | ||
84 | }; | 83 | }; |
85 | 84 |
imports/client/views/org/admin/app/module/Sidebar.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 { If, Case } from '/imports/client/components/Logic'; | 6 | import { If, Case } from '/imports/client/components/Logic'; |
7 | import { Navbar,Modal, Nav, NavItem, | 7 | import { Navbar,Modal, Nav, NavItem, |
8 | Glyphicon, Collapse, FormGroup, FormControl, Panel, | 8 | Glyphicon, Collapse, FormGroup, FormControl, Panel, |
9 | NavbarToggler, NavbarBrand, Table, ButtonToolbar, | 9 | NavbarToggler, NavbarBrand, Table, ButtonToolbar, |
10 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | 10 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, |
11 | NavDropdown, MenuItem, Breadcrumb, Button } | 11 | NavDropdown, MenuItem, Breadcrumb, Button } |
12 | from 'react-bootstrap'; | 12 | from 'react-bootstrap'; |
13 | import {LinkContainer} from 'react-router-bootstrap'; | 13 | import {LinkContainer} from 'react-router-bootstrap'; |
14 | 14 | ||
15 | 15 | ||
16 | export class AdminSidebar extends Component { | 16 | export class AdminSidebar extends Component { |
17 | 17 | ||
18 | constructor(props) { | 18 | constructor(props) { |
19 | super(props); | 19 | super(props); |
20 | this.state = { | 20 | this.state = { |
21 | 21 | ||
22 | }; | 22 | }; |
23 | this.onUpdate = this.onUpdate.bind(this); | 23 | this.onUpdate = this.onUpdate.bind(this); |
24 | }; | 24 | }; |
25 | 25 | ||
26 | onUpdate(key, value) { | 26 | onUpdate(key, value) { |
27 | this.setState({[key]: value}); | 27 | this.setState({[key]: value}); |
28 | }; | 28 | }; |
29 | 29 | ||
30 | render() { | 30 | render() { |
31 | const {user, org} = this.props.data; | 31 | const {user, org} = this.props.data; |
32 | const bulb = this.props.layout.bulb; | 32 | const bulb = this.props.layout.bulb; |
33 | console.log("this.props"); | 33 | console.log("this.props"); |
34 | console.log(bulb); | 34 | console.log(bulb); |
35 | var activeDashboard = ""; | 35 | var activeDashboard = ""; |
36 | if(bulb=="DASHBOARD"){activeDashboard=true;} | 36 | if(bulb=="DASHBOARD"){activeDashboard=true;} |
37 | return ( | 37 | return ( |
38 | <div className="sidebar sidebar-main sidebar-default"> | 38 | <div className="sidebar sidebar-main sidebar-default"> |
39 | <div className="sidebar-content"> | 39 | <div className="sidebar-content"> |
40 | <div className="sidebar-category sidebar-category-visible"> | 40 | <div className="sidebar-category sidebar-category-visible"> |
41 | <div className="category-content no-padding"> | 41 | <div className="category-content no-padding"> |
42 | <Nav className="navigation navigation-main navigation-accordion"> | 42 | <Nav className="navigation navigation-main navigation-accordion"> |
43 | <NavItem className="navigation-header"><span>{org.name}</span> <i className="icon-menu" title="Main pages"></i></NavItem> | 43 | <NavItem className="navigation-header"><span>{org.name}</span> <i className="icon-menu" title="Main pages"></i></NavItem> |
44 | <LinkContainer to="/"> | 44 | <LinkContainer to="/"> |
45 | <NavItem className={activeDashboard?"active":""} eventKey={1} ><i className="icon-home4"></i> <span>Dashboard</span></NavItem> | 45 | <NavItem className={activeDashboard?"active":""} eventKey={1} ><i className="icon-home4"></i> <span>Dashboard</span></NavItem> |
46 | </LinkContainer> | 46 | </LinkContainer> |
47 | <NavDropdown eventKey={2} title="Settings" name="Settings" id="setting"> | 47 | <NavDropdown eventKey={2} title="Users Info" name="userinfo" id="academic"> |
48 | <LinkContainer to="/"> | 48 | <LinkContainer to="/users/students" exact="true"> |
49 | <MenuItem eventKey={2.3}>Users Info</MenuItem> | 49 | <MenuItem eventKey={2.1}>Students</MenuItem> |
50 | </LinkContainer> | ||
51 | <LinkContainer to="/users/staff" exact="true"> | ||
52 | <MenuItem eventKey={2.2}>Staff</MenuItem> | ||
53 | </LinkContainer> | ||
54 | <LinkContainer to="/users/parents" exact="true"> | ||
55 | <MenuItem eventKey={2.3}>Parents</MenuItem> | ||
56 | </LinkContainer> | ||
57 | </NavDropdown> | ||
58 | <NavDropdown eventKey={3} title="MailBox" name="userinfo" id="communication"> | ||
59 | <LinkContainer to="/mail/compose" exact="true"> | ||
60 | <MenuItem eventKey={3.1}>Compose</MenuItem> | ||
61 | </LinkContainer> | ||
62 | <LinkContainer to="/mail/sent" exact="true"> | ||
63 | <MenuItem eventKey={3.2}>Sent</MenuItem> | ||
64 | </LinkContainer> | ||
65 | <LinkContainer to="/mail/important" exact="true"> | ||
66 | <MenuItem eventKey={3.3}>Important</MenuItem> | ||
50 | </LinkContainer> | 67 | </LinkContainer> |
51 | </NavDropdown> | 68 | </NavDropdown> |
52 | {/** <NavDropdown eventKey={3} title="Academic" name="Academic" id="academic"> | 69 | {/** <NavDropdown eventKey={3} title="Academic" name="Academic" id="academic"> |
53 | <MenuItem eventKey={3.1}>Layout 1</MenuItem> | 70 | <MenuItem eventKey={3.1}>Layout 1</MenuItem> |
54 | <MenuItem eventKey={3.2}>Layout 2</MenuItem> | 71 | <MenuItem eventKey={3.2}>Layout 2</MenuItem> |
55 | <MenuItem eventKey={3.3}>Layout 3</MenuItem> | 72 | <MenuItem eventKey={3.3}>Layout 3</MenuItem> |
56 | <MenuItem eventKey={3.4}>Layout 4</MenuItem> | 73 | <MenuItem eventKey={3.4}>Layout 4</MenuItem> |
57 | <MenuItem eventKey={3.5}>Layout 5</MenuItem> | 74 | <MenuItem eventKey={3.5}>Layout 5</MenuItem> |
58 | </NavDropdown> | 75 | </NavDropdown> |
59 | <NavDropdown eventKey={4} title="Communication" name="Communication" id="communication"> | 76 | <NavDropdown eventKey={4} title="Communication" name="Communication" id="communication"> |
60 | <MenuItem eventKey={4.1}>Primary palett</MenuItem> | 77 | <MenuItem eventKey={4.1}>Primary palett</MenuItem> |
61 | <MenuItem eventKey={4.2}>Danger palett</MenuItem> | 78 | <MenuItem eventKey={4.2}>Danger palett</MenuItem> |
62 | <MenuItem eventKey={4.3}>Success palett</MenuItem> | 79 | <MenuItem eventKey={4.3}>Success palett</MenuItem> |
63 | <MenuItem eventKey={4.4}>Warning palett</MenuItem> | 80 | <MenuItem eventKey={4.4}>Warning palett</MenuItem> |
64 | <MenuItem divider /> | 81 | <MenuItem divider /> |
65 | <MenuItem eventKey={4.5}>Info palett</MenuItem> | 82 | <MenuItem eventKey={4.5}>Info palett</MenuItem> |
66 | <MenuItem eventKey={4.6}>Info palett</MenuItem> | 83 | <MenuItem eventKey={4.6}>Info palett</MenuItem> |
67 | <MenuItem eventKey={4.7}>Info palett</MenuItem> | 84 | <MenuItem eventKey={4.7}>Info palett</MenuItem> |
68 | <MenuItem eventKey={4.8}>Info palett</MenuItem> | 85 | <MenuItem eventKey={4.8}>Info palett</MenuItem> |
69 | </NavDropdown> | 86 | </NavDropdown> |
70 | <NavDropdown eventKey={5} title="Finance" name="Finance" id="finance"> | 87 | <NavDropdown eventKey={5} title="Finance" name="Finance" id="finance"> |
71 | <MenuItem eventKey={5.1}>Primary palett</MenuItem> | 88 | <MenuItem eventKey={5.1}>Primary palett</MenuItem> |
72 | <MenuItem eventKey={5.2}>Danger palett</MenuItem> | 89 | <MenuItem eventKey={5.2}>Danger palett</MenuItem> |
73 | <MenuItem eventKey={5.3}>Success palett</MenuItem> | 90 | <MenuItem eventKey={5.3}>Success palett</MenuItem> |
74 | <MenuItem eventKey={5.4}>Warning palett</MenuItem> | 91 | <MenuItem eventKey={5.4}>Warning palett</MenuItem> |
75 | <NavDropdown eventKey={5.5} title="Calumns" id="calumns"> | 92 | <NavDropdown eventKey={5.5} title="Calumns" id="calumns"> |
76 | <MenuItem>Success palett</MenuItem> | 93 | <MenuItem>Success palett</MenuItem> |
77 | <MenuItem>Warning palett</MenuItem> | 94 | <MenuItem>Warning palett</MenuItem> |
78 | </NavDropdown> | 95 | </NavDropdown> |
79 | </NavDropdown> | 96 | </NavDropdown> |
80 | 97 | ||
81 | <NavItem eventKey={6} href="#"><i className="icon-file-stats"></i><span> Reports </span></NavItem> | 98 | <NavItem eventKey={6} href="#"><i className="icon-file-stats"></i><span> Reports </span></NavItem> |
82 | <NavItem eventKey={7} href="#"><i className="icon-design"></i> <span>Examinations</span></NavItem> | 99 | <NavItem eventKey={7} href="#"><i className="icon-design"></i> <span>Examinations</span></NavItem> |
83 | **/} | 100 | **/} |
84 | </Nav> | 101 | </Nav> |
85 | </div> | 102 | </div> |
86 | </div> | 103 | </div> |
87 | </div> | 104 | </div> |
88 | </div> | 105 | </div> |
89 | ); | 106 | ); |
90 | }; | 107 | }; |
91 | 108 | ||
92 | }; | 109 | }; |
93 | 110 |
imports/client/views/org/admin/users/list/AdminUsersList.js
1 | import _ from 'lodash'; | 1 | import _ from 'lodash'; |
2 | import { Meteor } from 'meteor/meteor'; | 2 | import { Meteor } from 'meteor/meteor'; |
3 | import React, { Component } from 'react'; | 3 | import React, { Component } from 'react'; |
4 | import { Link } from 'react-router'; | 4 | import { Link } from 'react-router'; |
5 | import { Avatar } from '/imports/client/components/Avatar'; | 5 | import { Avatar } from '/imports/client/components/Avatar'; |
6 | import { Icon } from '/imports/client/components/Icon'; | 6 | import { Icon } from '/imports/client/components/Icon'; |
7 | import classNames from 'classnames'; | 7 | import classNames from 'classnames'; |
8 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | 8 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; |
9 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; | 9 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; |
10 | import { Navbar,Modal, Nav, NavItem, | 10 | import { Navbar,Modal, Nav, NavItem, |
11 | Glyphicon, Collapse, | 11 | Glyphicon, Collapse, |
12 | NavbarToggler, NavbarBrand, | 12 | NavbarToggler, NavbarBrand, |
13 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | 13 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, |
14 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; | 14 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; |
15 | import { VerifyModule } from '/imports/client/views/verify/module/index' | 15 | import { VerifyModule } from '/imports/client/views/verify/module/index' |
16 | 16 | ||
17 | var Accordion = require('react-bootstrap').Accordion; | ||
18 | var Panel = require('react-bootstrap').Panel; | ||
19 | export class AdminUsersList extends Component { | 17 | export class AdminUsersList extends Component { |
20 | render() { | 18 | render() { |
21 | return ( | 19 | return ( |
22 | <div className="row"> | 20 | <div className="row"> |
23 | <div className="col-lg-3 col-md-6"> | 21 | <div className="col-lg-3 col-md-6"> |
24 | <div className="thumbnail"> | 22 | <div className="thumbnail"> |
25 | <Link to="/students" > | 23 | <Link to="/users/students" > |
26 | <div className="thumb thumb-rounded"> | 24 | <div className="thumb thumb-rounded"> |
27 | <img src="assets/images/download2.png" alt="" /> | 25 | <img src="/assets/images/download2.png" alt="" /> |
28 | </div> | 26 | </div> |
29 | <div className="caption text-center"> | 27 | <div className="caption text-center"> |
30 | <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> | 28 | <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> |
31 | </div> | 29 | </div> |
32 | </Link> | 30 | </Link> |
33 | </div> | 31 | </div> |
34 | </div> | 32 | </div> |
35 | <div className="col-lg-3 col-md-6"> | 33 | <div className="col-lg-3 col-md-6"> |
36 | <div className="thumbnail"> | 34 | <div className="thumbnail"> |
37 | <Link to="/staff" > | 35 | <Link to="/users/staff" > |
38 | <div className="thumb thumb-rounded"> | 36 | <div className="thumb thumb-rounded"> |
39 | <img src="assets/images/download3.png" alt=""/> | 37 | <img src="/assets/images/download3.png" alt=""/> |
40 | </div> | 38 | </div> |
41 | <div className="caption text-center"> | 39 | <div className="caption text-center"> |
42 | <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> | 40 | <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> |
43 | </div> | 41 | </div> |
44 | </Link> | 42 | </Link> |
45 | </div> | 43 | </div> |
46 | </div> | 44 | </div> |
47 | <div className="col-lg-3 col-md-6"> | 45 | <div className="col-lg-3 col-md-6"> |
48 | <div className="thumbnail"> | 46 | <div className="thumbnail"> |
49 | <Link to="/parents" > | 47 | <Link to="/users/parents" > |
50 | <div className="thumb thumb-rounded"> | 48 | <div className="thumb thumb-rounded"> |
51 | <img src="assets/images/download3.png" alt=""/> | 49 | <img src="/assets/images/download3.png" alt=""/> |
52 | </div> | 50 | </div> |
53 | <div className="caption text-center"> | 51 | <div className="caption text-center"> |
54 | <h6 className="text-semibold no-margin">Parents <small className="display-block">Click to view</small></h6> | 52 | <h6 className="text-semibold no-margin">Parents <small className="display-block">Click to view</small></h6> |
55 | </div> | 53 | </div> |
56 | </Link> | 54 | </Link> |
57 | </div> | 55 | </div> |
58 | </div> | 56 | </div> |
59 | </div> | 57 | </div> |
60 | ); | 58 | ); |
61 | }; | 59 | }; |
62 | 60 | ||
63 | }; | 61 | }; |
64 | 62 |
imports/client/views/org/admin/users/list/index.js
1 | // import { MailModule } from '/imports/client/views/org/admin/mailbox/module/index' | 1 | // import { MailModule } from '/imports/client/views/org/admin/mailbox/module/index' |
2 | import { | 2 | import { |
3 | composeWithTracker, | 3 | composeWithTracker, |
4 | compose, | 4 | compose, |
5 | composeAll | 5 | composeAll |
6 | } from 'react-komposer'; | 6 | } from 'react-komposer'; |
7 | import { AdminUsersList } from './AdminUsersList'; | 7 | import { AdminUsersList } from './AdminUsersList'; |
8 | import { Loading } from '/imports/client/components/Loading'; | 8 | import { Loading } from '/imports/client/components/Loading'; |
9 | 9 | ||
10 | import { Users } from '/imports/collections/users/index'; | 10 | import { Users } from '/imports/collections/users/index'; |
11 | import { Orgs } from '/imports/collections/orgs/index'; | 11 | import { Orgs } from '/imports/collections/orgs/index'; |
12 | 12 | ||
13 | 13 | ||
14 | const meteorTick = (props, onData) => { | 14 | const meteorTick = (props, onData) => { |
15 | 15 | Shelf.layout.set({ | |
16 | bulb: 'USERS', | ||
17 | subbulb: 'LIST', | ||
18 | }); | ||
16 | const handles = [ | 19 | const handles = [ |
17 | Meteor.subscribe('users.current'), | 20 | Meteor.subscribe('users.current'), |
18 | Meteor.subscribe('orgs.current'), | 21 | Meteor.subscribe('orgs.current'), |
19 | ]; | 22 | ]; |
20 | 23 | ||
21 | const user = Users.current(); | 24 | if(_.every(handles, (handle) => (handle.ready()))) { |
22 | |||
23 | if(_.every(handles, (handle) => (handle.ready()) ) && user) { | ||
24 | onData(null, { | 25 | onData(null, { |
25 | layout: Shelf.layout.get(), | 26 | layout: Shelf.layout.get(), |
26 | data: { | 27 | data: { |
27 | companyId: props.params.companyId, | 28 | // companyId: props.params.companyId, |
28 | user: Users.current(), | 29 | // user: Users.current(), |
29 | org: Orgs.current(), | 30 | // org: Orgs.current(), |
30 | }, | 31 | }, |
31 | }); | 32 | }); |
32 | } | 33 | } |
33 | 34 | ||
34 | return () => { | 35 | return () => { |
35 | _.each(handles, (handle) => handle.stop() ); | 36 | _.each(handles, (handle) => handle.stop() ); |
36 | }; | 37 | }; |
37 | }; | 38 | }; |
38 | 39 | ||
39 | 40 | ||
40 | const reduxTick = (props, onData) => { | 41 | const reduxTick = (props, onData) => { |
41 | onData(null, { | 42 | onData(null, { |
42 | data: {} | 43 | data: {} |
43 | }); | 44 | }); |
44 | }; | 45 | }; |
45 | 46 | ||
46 | 47 | ||
47 | export const AdminUsersListController = composeAll( | 48 | export const AdminUsersListController = composeAll( |
48 | composeWithTracker(meteorTick, Loading), | 49 | composeWithTracker(meteorTick, Loading), |
49 | compose(reduxTick, Loading), | 50 | compose(reduxTick, Loading), |
imports/client/views/org/admin/users/module/AdminUserViewLayout.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 } from 'react-router'; | 5 | import { Link } from 'react-router'; |
6 | import classNames from 'classnames'; | 6 | import classNames from 'classnames'; |
7 | import { Users } from '/imports/collections/users/index'; | 7 | import { Users } from '/imports/collections/users/index'; |
8 | import { If, Case } from '/imports/client/components/Logic'; | 8 | import { If, Case } from '/imports/client/components/Logic'; |
9 | import {Header} from './Header' | 9 | import {Header} from './Header' |
10 | 10 | ||
11 | 11 | ||
12 | export class AdminUserViewLayout extends Component { | 12 | export class AdminUserViewLayout extends Component { |
13 | 13 | ||
14 | renderMenuItem(bulb, label, path, auth) { | 14 | renderMenuItem(bulb, label, path, auth) { |
15 | const user = Users.current(); | 15 | const user = Users.current(); |
16 | return ( | 16 | return ( |
17 | <If | 17 | <If |
18 | if = {(user.getRole() == "SECRETARY") || auth.indexOf(user.getRole()) !== -1 || auth[0] == "ALL"} | 18 | if = {(user.getRole() == "SECRETARY") || auth.indexOf(user.getRole()) !== -1 || auth[0] == "ALL"} |
19 | then = {() => ( | 19 | then = {() => ( |
20 | <Link | 20 | <Link |
21 | to = {path} | 21 | to = {path} |
22 | className = {classNames( | 22 | className = {classNames( |
23 | "tabsLayout-menuItem", | 23 | "tabsLayout-menuItem", |
24 | (bulb === this.props.layout.subbulb) && 'active' | 24 | (bulb === this.props.layout.subbulb) && 'active' |
25 | )} | 25 | )} |
26 | > | 26 | > |
27 | {label} | 27 | {label} |
28 | </Link> | 28 | </Link> |
29 | )} | 29 | )} |
30 | /> | 30 | /> |
31 | ); | 31 | ); |
32 | }; | 32 | }; |
33 | 33 | ||
34 | renderSeparator() { | 34 | renderSeparator() { |
35 | return <div className = "tabsLayout-menuSeparator"/>; | 35 | return <div className = "tabsLayout-menuSeparator"/>; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | render() { | 38 | render() { |
39 | const user = this.props.data.user; | 39 | const user = this.props.data.user; |
40 | return ( | 40 | return ( |
41 | <div className = "tabsLayout-box"> | 41 | <div className = "tabsLayout-box"> |
42 | <Header /> | 42 | <Header |
43 | layout = {this.props.layout} | ||
44 | /> | ||
43 | <div className = "tabsLayout-content"> | 45 | <div className = "tabsLayout-content"> |
44 | { this.props.children } | 46 | { this.props.children } |
45 | </div> | 47 | </div> |
46 | </div> | 48 | </div> |
47 | ); | 49 | ); |
48 | }; | 50 | }; |
49 | 51 | ||
50 | }; | 52 | }; |
51 | 53 |
imports/client/views/org/admin/users/module/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 | import './header.css'; |
9 | 9 | ||
10 | 10 | ||
11 | export class Header extends Component { | 11 | export class Header extends Component { |
12 | 12 | ||
13 | constructor(props) { | 13 | constructor(props) { |
14 | super(props); | 14 | super(props); |
15 | this.state = { | 15 | this.state = { |
16 | 16 | ||
17 | }; | 17 | }; |
18 | this.onUpdate = this.onUpdate.bind(this); | 18 | this.onUpdate = this.onUpdate.bind(this); |
19 | }; | 19 | }; |
20 | 20 | ||
21 | onUpdate(key, value) { | 21 | onUpdate(key, value) { |
22 | this.setState({[key]: value}); | 22 | this.setState({[key]: value}); |
23 | }; | 23 | }; |
24 | 24 | ||
25 | render() { | 25 | render() { |
26 | if(this.props.layout.subbulb=='LIST'){ | ||
27 | return null; | ||
28 | } | ||
26 | return ( | 29 | return ( |
27 | <div className = "enterPane-box"> | 30 | <div className = "enterPane-box"> |
28 | <div className="row"> | 31 | <div className="row"> |
29 | 32 | ||
30 | <div className="col-lg-4 col-md-8"> | 33 | <div className="col-lg-4 col-md-8"> |
31 | <Link to="/students" > | 34 | <Link to="/users/students" > |
32 | <div className="panel panel-body"> | 35 | <div className="panel panel-body"> |
33 | <div className="media"> | 36 | <div className="media"> |
34 | <div className="media-left"> | 37 | <div className="media-left"> |
35 | <img src="assets/images/download2.png" className="img-circle" alt=""/> | 38 | <img src="/assets/images/download2.png" className="img-circle" alt=""/> |
36 | </div> | 39 | </div> |
37 | 40 | ||
38 | <div className="media-body"> | 41 | <div className="media-body"> |
39 | <h6 className="media-heading">Students</h6> | 42 | <h6 className="media-heading">Students</h6> |
40 | <p className="text-muted">Click to view</p> | 43 | <p className="text-muted">Click to view</p> |
41 | </div> | 44 | </div> |
42 | </div> | 45 | </div> |
43 | </div> | 46 | </div> |
44 | </Link> | 47 | </Link> |
45 | </div> | 48 | </div> |
46 | <div className="col-lg-4 col-md-8"> | 49 | <div className="col-lg-4 col-md-8"> |
47 | <Link to="/staff" > | 50 | <Link to="/users/staff" > |
48 | <div className="panel panel-body"> | 51 | <div className="panel panel-body"> |
49 | <div className="media"> | 52 | <div className="media"> |
50 | <div className="media-left"> | 53 | <div className="media-left"> |
51 | <img src="assets/images/download.png" className="img-circle" alt=""/> | 54 | <img src="/assets/images/download.png" className="img-circle" alt=""/> |
52 | </div> | 55 | </div> |
53 | 56 | ||
54 | <div className="media-body"> | 57 | <div className="media-body"> |
55 | <h6 className="media-heading">Teachers</h6> | 58 | <h6 className="media-heading">Teachers</h6> |
56 | <p className="text-muted">Click to view</p> | 59 | <p className="text-muted">Click to view</p> |
57 | </div> | 60 | </div> |
58 | </div> | 61 | </div> |
59 | </div> | 62 | </div> |
60 | </Link> | 63 | </Link> |
61 | </div> | 64 | </div> |
62 | 65 | ||
63 | <div className="col-lg-4 col-md-8"> | 66 | <div className="col-lg-4 col-md-8"> |
64 | <Link to="/parents" > | 67 | <Link to="/users/parents" > |
65 | <div className="panel panel-body"> | 68 | <div className="panel panel-body"> |
66 | <div className="media"> | 69 | <div className="media"> |
67 | <div className="media-left"> | 70 | <div className="media-left"> |
68 | <img src="assets/images/download3.png" className="img-circle" alt=""/> | 71 | <img src="/assets/images/download3.png" className="img-circle" alt=""/> |
69 | </div> | 72 | </div> |
70 | 73 | ||
71 | <div className="media-body"> | 74 | <div className="media-body"> |
72 | <h6 className="media-heading">Parents</h6> | 75 | <h6 className="media-heading">Parents</h6> |
73 | <p className="text-muted">Click to view</p> | 76 | <p className="text-muted">Click to view</p> |
74 | </div> | 77 | </div> |
75 | </div> | 78 | </div> |
76 | </div> | 79 | </div> |
77 | </Link> | 80 | </Link> |
78 | </div> | 81 | </div> |
79 | 82 | ||
80 | </div> | 83 | </div> |
81 | </div> | 84 | </div> |
82 | ); | 85 | ); |
83 | }; | 86 | }; |
84 | 87 | ||
85 | }; | 88 | }; |
86 | 89 |
imports/client/views/org/admin/users/parents/index.js
1 | import _ from 'lodash'; | 1 | import _ from 'lodash'; |
2 | import { | 2 | import { |
3 | composeWithTracker, | 3 | composeWithTracker, |
4 | compose, | 4 | compose, |
5 | composeAll | 5 | composeAll |
6 | } from 'react-komposer'; | 6 | } from 'react-komposer'; |
7 | import { Loading } from '/imports/client/components/Loading'; | 7 | import { Loading } from '/imports/client/components/Loading'; |
8 | 8 | ||
9 | import { Orgs } from '/imports/collections/orgs/index'; | 9 | import { Orgs } from '/imports/collections/orgs/index'; |
10 | import { Users } from '/imports/collections/users/index'; | 10 | import { Users } from '/imports/collections/users/index'; |
11 | import { Parents } from '/imports/collections/parents/index'; | 11 | import { Parents } from '/imports/collections/parents/index'; |
12 | import { ParentsView } from './parentsview'; | 12 | import { ParentsView } from './parentsview'; |
13 | 13 | ||
14 | 14 | ||
15 | 15 | ||
16 | const meteorTick = (props, onData) => { | 16 | const meteorTick = (props, onData) => { |
17 | Shelf.layout.set({ | 17 | Shelf.layout.set({ |
18 | bulb: 'SETTINGS', | 18 | bulb: 'USERS', |
19 | subbulb: 'USERS', | 19 | subbulb: 'PARENTS', |
20 | view: 'PARENTS' | ||
21 | }); | 20 | }); |
22 | const handles = [ | 21 | const handles = [ |
23 | Meteor.subscribe('users.current'), | 22 | Meteor.subscribe('users.current'), |
24 | Meteor.subscribe('orgs.current'), | 23 | Meteor.subscribe('orgs.current'), |
25 | Meteor.subscribe('users.forMyOrg'), | 24 | Meteor.subscribe('users.forMyOrg'), |
26 | Meteor.subscribe('parent.forMyOrg'), | 25 | Meteor.subscribe('parent.forMyOrg'), |
27 | ]; | 26 | ]; |
28 | 27 | ||
29 | if(_.every(handles, (handle) => (handle.ready()) )) { | 28 | if(_.every(handles, (handle) => (handle.ready()) )) { |
30 | const user = Users.current(); | 29 | const user = Users.current(); |
31 | const org = Orgs.current(); | 30 | const org = Orgs.current(); |
32 | console.log("parents"); | 31 | console.log("parents"); |
33 | parent = Users.find({"role":"PARENT"}).fetch() ? Users.find({"role":"PARENT"}).fetch() : ""; | 32 | parent = Users.find({"role":"PARENT"}).fetch() ? Users.find({"role":"PARENT"}).fetch() : ""; |
34 | console.log(Users.find({"role":"PARENT"}).fetch()); | 33 | console.log(Users.find({"role":"PARENT"}).fetch()); |
35 | parentData = Parents.find().fetch() ? Parents.find().fetch() : ""; | 34 | parentData = Parents.find().fetch() ? Parents.find().fetch() : ""; |
36 | console.log("parentData"); | 35 | console.log("parentData"); |
37 | console.log(parentData); | 36 | console.log(parentData); |
38 | for(var i=0; i< parent.length; i++){ | 37 | for(var i=0; i< parent.length; i++){ |
39 | for(var j=0; j< parentData.length; j++){ | 38 | for(var j=0; j< parentData.length; j++){ |
40 | if(parent[i]._id == parentData[j].userId){ | 39 | if(parent[i]._id == parentData[j].userId){ |
41 | parent[i].relationship = parentData[j].relationship; | 40 | parent[i].relationship = parentData[j].relationship; |
42 | parent[i].profession = parentData[j].profession; | 41 | parent[i].profession = parentData[j].profession; |
43 | parent[i].relationship = parentData[j].relationship; | 42 | parent[i].relationship = parentData[j].relationship; |
44 | } | 43 | } |
45 | } | 44 | } |
46 | } | 45 | } |
47 | onData(null, { | 46 | onData(null, { |
48 | data: { | 47 | data: { |
49 | user: user, | 48 | user: user, |
50 | org: org, | 49 | org: org, |
51 | parent: parent | 50 | parent: parent |
52 | }, | 51 | }, |
53 | }); | 52 | }); |
54 | } | 53 | } |
55 | 54 | ||
56 | return () => { | 55 | return () => { |
57 | _.each(handles, (handle) => handle.stop() ); | 56 | _.each(handles, (handle) => handle.stop() ); |
58 | }; | 57 | }; |
59 | }; | 58 | }; |
60 | 59 | ||
61 | 60 | ||
62 | const reduxTick = (props, onData) => { | 61 | const reduxTick = (props, onData) => { |
63 | onData(null, { | 62 | onData(null, { |
64 | data: {} | 63 | data: {} |
65 | }); | 64 | }); |
66 | }; | 65 | }; |
67 | 66 | ||
68 | 67 | ||
69 | export const ParentViewController = composeAll( | 68 | export const ParentViewController = composeAll( |
70 | composeWithTracker(meteorTick, Loading), | 69 | composeWithTracker(meteorTick, Loading), |
71 | compose(reduxTick, Loading), | 70 | compose(reduxTick, Loading), |
72 | )(ParentsView); | 71 | )(ParentsView); |
73 | 72 |
imports/client/views/org/admin/users/staff/index.js
1 | // import { InviteSignupController } from '/imports/client/views/invite/signup/index' | 1 | // import { InviteSignupController } from '/imports/client/views/invite/signup/index' |
2 | import _ from 'lodash'; | 2 | import _ from 'lodash'; |
3 | import { | 3 | import { |
4 | composeWithTracker, | 4 | composeWithTracker, |
5 | compose, | 5 | compose, |
6 | composeAll | 6 | composeAll |
7 | } from 'react-komposer'; | 7 | } from 'react-komposer'; |
8 | import { Loading } from '/imports/client/components/Loading'; | 8 | import { Loading } from '/imports/client/components/Loading'; |
9 | 9 | ||
10 | import { Orgs } from '/imports/collections/orgs/index'; | 10 | import { Orgs } from '/imports/collections/orgs/index'; |
11 | import { Users } from '/imports/collections/users/index'; | 11 | import { Users } from '/imports/collections/users/index'; |
12 | import { Staffs } from '/imports/collections/staff/index'; | 12 | import { Staffs } from '/imports/collections/staff/index'; |
13 | import { StaffView } from './StaffView'; | 13 | import { StaffView } from './StaffView'; |
14 | 14 | ||
15 | const meteorTick = (props, onData) => { | 15 | const meteorTick = (props, onData) => { |
16 | Shelf.layout.set({ | 16 | Shelf.layout.set({ |
17 | bulb: 'SETTINGS', | 17 | bulb: 'USERS', |
18 | subbulb: 'USERS', | 18 | subbulb: 'STAFF', |
19 | view: 'STAFF' | ||
20 | }); | 19 | }); |
21 | const handles = [ | 20 | const handles = [ |
22 | Meteor.subscribe('users.current'), | 21 | Meteor.subscribe('users.current'), |
23 | Meteor.subscribe('orgs.current'), | 22 | Meteor.subscribe('orgs.current'), |
24 | Meteor.subscribe('users.forMyOrg'), | 23 | Meteor.subscribe('users.forMyOrg'), |
25 | Meteor.subscribe('staff.forMyOrg'), | 24 | Meteor.subscribe('staff.forMyOrg'), |
26 | ]; | 25 | ]; |
27 | 26 | ||
28 | if(_.every(handles, (handle) => (handle.ready()) )) { | 27 | if(_.every(handles, (handle) => (handle.ready()) )) { |
29 | const user = Users.current(); | 28 | const user = Users.current(); |
30 | const org = Orgs.current(); | 29 | const org = Orgs.current(); |
31 | staff = Users.find({"role":"STAFF"}).fetch() ? Users.find({"role":"STAFF"}).fetch() : ""; | 30 | staff = Users.find({"role":"STAFF"}).fetch() ? Users.find({"role":"STAFF"}).fetch() : ""; |
32 | console.log(Users.find({"role":"STAFF"}).fetch()); | 31 | console.log(Users.find({"role":"STAFF"}).fetch()); |
33 | staffData = Staffs.find().fetch() ? Staffs.find().fetch() : ""; | 32 | staffData = Staffs.find().fetch() ? Staffs.find().fetch() : ""; |
34 | console.log("staffData"); | 33 | console.log("staffData"); |
35 | console.log(staffData); | 34 | console.log(staffData); |
36 | for(var i=0; i< staff.length; i++){ | 35 | for(var i=0; i< staff.length; i++){ |
37 | for(var j=0; j< staffData.length; j++){ | 36 | for(var j=0; j< staffData.length; j++){ |
38 | if(staff[i]._id == staffData[j].userId){ | 37 | if(staff[i]._id == staffData[j].userId){ |
39 | staff[i].type = staffData[j].type; | 38 | staff[i].type = staffData[j].type; |
40 | staff[i].employeeId = staffData[j].employeeId; | 39 | staff[i].employeeId = staffData[j].employeeId; |
41 | staff[i].dob = staffData[j].dob; | 40 | staff[i].dob = staffData[j].dob; |
42 | } | 41 | } |
43 | } | 42 | } |
44 | } | 43 | } |
45 | onData(null, { | 44 | onData(null, { |
46 | data: { | 45 | data: { |
47 | user: user, | 46 | user: user, |
48 | org: org, | 47 | org: org, |
49 | staff: staff | 48 | staff: staff |
50 | }, | 49 | }, |
51 | }); | 50 | }); |
52 | } | 51 | } |
53 | 52 | ||
54 | return () => { | 53 | return () => { |
55 | _.each(handles, (handle) => handle.stop() ); | 54 | _.each(handles, (handle) => handle.stop() ); |
56 | }; | 55 | }; |
57 | }; | 56 | }; |
58 | 57 | ||
59 | 58 | ||
60 | const reduxTick = (props, onData) => { | 59 | const reduxTick = (props, onData) => { |
61 | onData(null, { | 60 | onData(null, { |
62 | data: {} | 61 | data: {} |
63 | }); | 62 | }); |
64 | }; | 63 | }; |
65 | 64 | ||
66 | 65 | ||
67 | export const staffViewController = composeAll( | 66 | export const staffViewController = composeAll( |
68 | composeWithTracker(meteorTick, Loading), | 67 | composeWithTracker(meteorTick, Loading), |
69 | compose(reduxTick, Loading), | 68 | compose(reduxTick, Loading), |
70 | )(StaffView); | 69 | )(StaffView); |
71 | 70 |
imports/client/views/org/admin/users/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 | Shelf.layout.set({ | 17 | Shelf.layout.set({ |
18 | bulb: 'SETTINGS', | 18 | bulb: 'USERS', |
19 | subbulb: 'USERS', | 19 | subbulb: 'STUDENTS', |
20 | view: 'STUDENTS' | ||
21 | }); | 20 | }); |
22 | const handles = [ | 21 | const handles = [ |
23 | Meteor.subscribe('users.current'), | 22 | Meteor.subscribe('users.current'), |
24 | Meteor.subscribe('orgs.current'), | 23 | Meteor.subscribe('orgs.current'), |
25 | Meteor.subscribe('users.forMyOrg'), | 24 | Meteor.subscribe('users.forMyOrg'), |
26 | Meteor.subscribe('student.forMyOrg'), | 25 | Meteor.subscribe('student.forMyOrg'), |
27 | ]; | 26 | ]; |
28 | 27 | ||
29 | if(_.every(handles, (handle) => (handle.ready()) )) { | 28 | if(_.every(handles, (handle) => (handle.ready()) )) { |
30 | const user = Users.current(); | 29 | const user = Users.current(); |
31 | const org = Orgs.current(); | 30 | const org = Orgs.current(); |
32 | students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : ""; | 31 | students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : ""; |
33 | studentData = Students.find().fetch() ? Students.find().fetch() : ""; | 32 | studentData = Students.find().fetch() ? Students.find().fetch() : ""; |
34 | for(var i=0; i< studentData.length; i++){ | 33 | for(var i=0; i< studentData.length; i++){ |
35 | for(var j=0; j< students.length; j++){ | 34 | for(var j=0; j< students.length; j++){ |
36 | if(studentData[i].userId == students[j]._id && studentData[i].admissionId){ | 35 | if(studentData[i].userId == students[j]._id && studentData[i].admissionId){ |
37 | studentData[i].firstName = students[j].firstName; | 36 | studentData[i].firstName = students[j].firstName; |
38 | studentData[i].lastName = students[j].lastName; | 37 | studentData[i].lastName = students[j].lastName; |
39 | }else{ | 38 | }else{ |
40 | 39 | ||
41 | } | 40 | } |
42 | } | 41 | } |
43 | } | 42 | } |
44 | onData(null, { | 43 | onData(null, { |
45 | data: { | 44 | data: { |
46 | user: user, | 45 | user: user, |
47 | org: org, | 46 | org: org, |
48 | studentData: studentData | 47 | studentData: studentData |
49 | }, | 48 | }, |
50 | }); | 49 | }); |
51 | } | 50 | } |
52 | 51 | ||
53 | return () => { | 52 | return () => { |
54 | _.each(handles, (handle) => handle.stop() ); | 53 | _.each(handles, (handle) => handle.stop() ); |
55 | }; | 54 | }; |
56 | }; | 55 | }; |
57 | 56 | ||
58 | 57 | ||
59 | const reduxTick = (props, onData) => { | 58 | const reduxTick = (props, onData) => { |
60 | onData(null, { | 59 | onData(null, { |
61 | data: {} | 60 | data: {} |
62 | }); | 61 | }); |
63 | }; | 62 | }; |
64 | 63 | ||
65 | 64 | ||
66 | export const StudentDataController = composeAll( | 65 | export const StudentDataController = composeAll( |
67 | composeWithTracker(meteorTick, Loading), | 66 | composeWithTracker(meteorTick, Loading), |
68 | compose(reduxTick, Loading), | 67 | compose(reduxTick, Loading), |
69 | )(StudentView); | 68 | )(StudentView); |
70 | 69 |