diff --git a/chromebook-checkout-meteor/client/admin.css b/chromebook-checkout-meteor/client/admin.css index a961b96..e82d5c5 100644 --- a/chromebook-checkout-meteor/client/admin.css +++ b/chromebook-checkout-meteor/client/admin.css @@ -10,7 +10,7 @@ margin-top:13%; margin-bottom:0; height:auto; - max-width:600px; + max-width:60%; box-shadow: 0px 5px 10px #222222; padding-bottom:0; padding-top:0; diff --git a/chromebook-checkout-meteor/client/admin.html b/chromebook-checkout-meteor/client/admin.html index ea9b234..0dae1ee 100644 --- a/chromebook-checkout-meteor/client/admin.html +++ b/chromebook-checkout-meteor/client/admin.html @@ -15,8 +15,8 @@ {{#each chromebooks}}
{{> chromebook}} - - + +
{{/each}} diff --git a/chromebook-checkout-meteor/client/admin.js b/chromebook-checkout-meteor/client/admin.js index 90b6016..423c558 100644 --- a/chromebook-checkout-meteor/client/admin.js +++ b/chromebook-checkout-meteor/client/admin.js @@ -9,7 +9,9 @@ Template.admin.events({ event.preventDefault(); var chromebook_number = $("input[name='anumber']")[0].value; - var chromebook_serial = $("input[name='anumber']")[0].nextElementSibling.value; + var chromebook_serial = $("input[name='aserial']")[0].value; + + if (!((chromebook_number === "") || (chromebook_serial === ""))) Chromebooks.insert({ "status": 0, @@ -20,10 +22,34 @@ Template.admin.events({ }); // Clear form - chromebook_number.value = ""; - chromebook_serial.value = ""; + $("input[name='anumber']")[0].value = ""; + $("input[name='aserial']")[0].value = ""; // Prevent default form return false; + }, + 'click .cross' : function() { + if (Roles.userIsInRole(Meteor.userId(), ['admin'])) { + Chromebooks.remove(this._id); + } + }, + 'click .yield' : 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"); + } } }); \ No newline at end of file diff --git a/chromebook-checkout-meteor/client/checkout.css b/chromebook-checkout-meteor/client/checkout.css index a2e83d9..955c7d4 100644 --- a/chromebook-checkout-meteor/client/checkout.css +++ b/chromebook-checkout-meteor/client/checkout.css @@ -20,6 +20,7 @@ margin-bottom: 25%; .titleword { text-align: center; + margin-top: 0; } .row { diff --git a/chromebook-checkout-meteor/client/chromebook.js b/chromebook-checkout-meteor/client/chromebook.js index 217d880..85bf3e1 100644 --- a/chromebook-checkout-meteor/client/chromebook.js +++ b/chromebook-checkout-meteor/client/chromebook.js @@ -22,6 +22,15 @@ Template.chromebook.helpers({ }); Template.chromebook.events({ + 'click .available, click .unavailable, click .checkedout': function() { + if (Roles.userIsInRole(Meteor.userId(), ['admin']) + && Router.current().route.path() === '/admin') { + var chromebook_number = $("input[name='anumber']")[0].value; + var chromebook_serial = $("input[name='anumber']")[0].nextElementSibling.value; + chromebook_number = this.number; + chromebook_serial = this.serial; + } + }, 'click .available': function() { if ((Chromebooks.findOne({userid: Meteor.userId()}) === undefined) || (Roles.userIsInRole(Meteor.userId(), ['admin', 'teacher']))) { diff --git a/chromebook-checkout-meteor/client/initial.html b/chromebook-checkout-meteor/client/initial.html index 83d001f..7926c24 100644 --- a/chromebook-checkout-meteor/client/initial.html +++ b/chromebook-checkout-meteor/client/initial.html @@ -4,8 +4,8 @@
Chromebook Checkout
-

Checkout a chromebook. +

Checkout a chromebook.

-

+ diff --git a/chromebook-checkout-meteor/client/main.css b/chromebook-checkout-meteor/client/main.css index 82a62f5..c002b9e 100644 --- a/chromebook-checkout-meteor/client/main.css +++ b/chromebook-checkout-meteor/client/main.css @@ -18,6 +18,14 @@ html { display: table; } +.chromeicon { + height: 35px; + width: 35px; + float: right; + margin-right: 31%; + margin-top: 1.2%; +} + body { font:35px/1.5 'Lato'; color:#777; @@ -100,12 +108,17 @@ p { } p.bottom { padding-top:0%; - margin-left:auto; + margin-left:30%; margin-right:auto; color:#f7f7f7; max-width:325px; font:27px 'Lato'; } + +.bottom { + display: inline; +} + p.footer { color:#f7f7f7 }