2015-01-11 15:02:46 -05:00
|
|
|
ReactiveTabs.createInterface({
|
2015-01-11 16:55:54 -05:00
|
|
|
template: 'teacherTabs',
|
2015-01-11 15:02:46 -05:00
|
|
|
onChange: function (slug, template) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.teacher.helpers({
|
|
|
|
|
tabs: function () {
|
|
|
|
|
// Every tab object MUST have a name and a slug!
|
|
|
|
|
return [
|
|
|
|
|
{ name: 'Single', slug: 'single' },
|
|
|
|
|
{ name: 'Carts', slug: 'carts' }
|
|
|
|
|
];
|
|
|
|
|
}
|
2015-01-11 17:55:33 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.teacher.helpers({
|
|
|
|
|
chromebooks: function() {
|
|
|
|
|
return Chromebooks.find();
|
2015-01-11 20:47:24 -05:00
|
|
|
},
|
|
|
|
|
carts: function() {
|
|
|
|
|
return carts.find();
|
2015-01-11 17:55:33 -05:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Template.teacher.events({
|
|
|
|
|
'click .cross' : function() {
|
|
|
|
|
if (Roles.userIsInRole(Meteor.userId(), ['admin'])) {
|
|
|
|
|
if (this.status === 0) {
|
|
|
|
|
Chromebooks.update(this._id, {$set: {status: 2}});
|
|
|
|
|
Chromebooks.update(this._id, {$set: {user: null}});
|
|
|
|
|
}
|
|
|
|
|
else if (this.status ===1) {
|
|
|
|
|
Chromebooks.update(this._id, {$set: {status: 2}});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Chromebooks.update(this._id, {$set: {status: 0}});
|
|
|
|
|
Chromebooks.update(this._id, {$set: {last_checkout: null}});
|
|
|
|
|
Chromebooks.update(this._id, {$set: {userid: null}});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
alert("Access Denied");
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-11 15:02:46 -05:00
|
|
|
});
|