Blame view
imports/client/views/org/admin/staff/index.js
1.72 KB
a8c5a7fb6
|
1 2 3 4 5 6 7 8 9 10 11 |
// import { InviteSignupController } from '/imports/client/views/invite/signup/index' import _ from 'lodash'; import { composeWithTracker, compose, composeAll } from 'react-komposer'; import { Loading } from '/imports/client/components/Loading'; import { Orgs } from '/imports/collections/orgs/index'; import { Users } from '/imports/collections/users/index'; |
925ffa9d3
|
12 13 |
import { Staffs } from '/imports/collections/staff/index'; import { StaffView } from './StaffView'; |
a8c5a7fb6
|
14 15 16 17 18 19 20 21 22 23 24 |
const meteorTick = (props, onData) => { const handles = [ Meteor.subscribe('users.current'), Meteor.subscribe('orgs.current') ]; if(_.every(handles, (handle) => (handle.ready()) )) { const user = Users.current(); const org = Orgs.current(); |
925ffa9d3
|
25 26 27 28 29 30 31 |
staff = Users.find({"role":"STAFF"}).fetch() ? Users.find({"role":"TEACHER"}).fetch() : ""; staffData = Staffs.find().fetch() ? Staffs.find().fetch() : ""; for(var i=0; i< staff.length; i++){ for(var j=0; j< staff.length; j++){ if(staff[i]._id == staffData[j].userId){ staff[i].class = staffData[j].class; staff[i].dob = staffData[j].dob; |
d75229d74
|
32 33 34 |
} } } |
a8c5a7fb6
|
35 36 37 |
onData(null, { data: { user: user, |
d75229d74
|
38 |
org: org, |
925ffa9d3
|
39 |
staff: staff |
a8c5a7fb6
|
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
}, }); } return () => { _.each(handles, (handle) => handle.stop() ); }; }; const reduxTick = (props, onData) => { onData(null, { data: {} }); }; |
925ffa9d3
|
55 |
export const staffViewController = composeAll( |
a8c5a7fb6
|
56 57 |
composeWithTracker(meteorTick, Loading), compose(reduxTick, Loading), |
925ffa9d3
|
58 |
)(StaffView); |