47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
ReactiveTabs.createInterface({
|
|
template: 'teacherTabs',
|
|
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' }
|
|
];
|
|
}
|
|
});
|
|
|
|
Template.teacher.helpers({
|
|
chromebooks: function() {
|
|
return Chromebooks.find();
|
|
},
|
|
carts: function() {
|
|
return carts.find();
|
|
}
|
|
});
|
|
|
|
|
|
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");
|
|
}
|
|
}
|
|
}); |