Added working chromebooks

This commit is contained in:
Kenneth Jao 2015-01-11 17:55:33 -05:00
parent 88dbc7685d
commit c252846509
2 changed files with 39 additions and 5 deletions

View File

@ -3,13 +3,18 @@
<h5 class="titleword">Chromebook Checkout</h5>
<div id="tabs">
{{#teacherTabs tabs=tabs}}
<!-- Single -->
<div>
{{> chromebook}}
{{#each chromebooks}}
<div class="row">
{{> chromebook}}
</div>
{{/each}}
</div>
<!-- Carts -->
<div>
<h5>Coming soon...</h5>
</div>
<div>
<h2>Bye</h2>
</div>
{{/teacherTabs}}
</div>

View File

@ -16,4 +16,33 @@ Template.teacher.helpers({
{ name: 'Carts', slug: 'carts' }
];
}
});
Template.teacher.helpers({
chromebooks: function() {
return Chromebooks.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");
}
}
});