Skip to content

Commit

Permalink
Fixing random shit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew DeQuattro committed Dec 9, 2016
1 parent 195b73b commit 37d23f4
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 49 deletions.
103 changes: 58 additions & 45 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .tmp/sqlitedb.sqlite
Binary file not shown.
14 changes: 12 additions & 2 deletions api/controllers/HookController.js
Expand Up @@ -41,6 +41,8 @@ function hookGlobal(res, pageview, path) {
}

function hookLocal(res, pageview, path) {
console.log("We've almost made it");

var http = require('http');
var options = {
hostname: 'vm344c.se.rit.edu'
Expand Down Expand Up @@ -191,7 +193,12 @@ module.exports = {
hookLocal(res, 'reservations', '/api/DeviceReservation.php?action=get_device_reservation_by_id&devicereservationid=' + req.param('devicereservationid'))
}
, create_device_reservation: function (req, res) {
hookLocal(res, 'reservations', '/api/DeviceReservation.php?action=create_device_reservation&userid=' + req.param('userid') + '&startdate' + req.param('startdate') + '&enddate=' + req.param('enddate'))
hookLocal(res, 'devices', '/api/DeviceReservation.php?action=create_device_reservation&userid=' + req.param('userid') + '&startdate' + req.param('startdate') + '&enddate=' + req.param('enddate'))
//console.log("We made it!");
//console.log(req.param('startdate'));
}
, remove_device_reservation: function (req, res) {
hookLocal(res, 'account', '/api/DeviceReservation.php?action=remove_device_reservation&devicereservationid=' + req.param('devicereservationid'))
}
, update_device_reservation: function (req, res) {
hookLocal(res, 'reservations', '/api/DeviceReservation.php?action=update_device_reservation&devicereservationid=' + req.param('devicereservationid')
Expand All @@ -209,10 +216,13 @@ module.exports = {
hookLocal(res, 'reservations', '/api/ClassReservation.php?action=create_class_reservation&instructorid=' + req.param('instructorid') + '&classid=' + req.param('classid') + '&startdate=' + req.param('startdate')
+ '&enddate=' + req.param('enddate') + '&classroomid=' + req.param('classroomid'))
}
, remove_class_reservation: function (req, res) {
hookLocal(res, 'classrooms', '/api/ClassReservation.php?action=remove_class_reservation&classreservationid=' + req.param('classreservationid'))
}
, update_class_reservation: function (req, res) {
hookLocal(res, 'reservations', '/api/ClassReservation.php?action=update_class_reservation&classreservationid=' + req.param('classreservationid')
+ '&instructorid=' + req.param('instructorid') + '&classid=' + req.param('classid') + '&startdate=' + req.param('startdate')
+ '&enddate=' + req.param('enddate') + '&classroomid=' + req.param('classroomid'))
+ '&enddate=' + req.param('enddate') + '&classroomid=' + req.param('classroomid'))
}


Expand Down
3 changes: 3 additions & 0 deletions config/routes.js
Expand Up @@ -22,6 +22,9 @@ module.exports.routes = {
//Classroom calls
, '/getallclassrooms': 'HookController.get_all_classrooms'

//Device Reservation calls
, '/createdevicereservation': 'HookController.create_device_reservation'

// Routes for testing
, '/email': 'HookController.get_user_by_email'
, '/userid': 'HookController.get_user_by_id'
Expand Down
15 changes: 13 additions & 2 deletions views/devices.ejs
Expand Up @@ -60,6 +60,7 @@
<div class="modal-body">
<p>You are reserving the following device:</p>


<div class="form-group">
<label for="deviceName">Device Name:</label>
<input type="text" class="form-control" name="deviceName" id="deviceName" readonly>
Expand All @@ -82,8 +83,7 @@

</div>
<div class="modal-footer">
<button type="submit" class="btn" name="makeDeviceReservation" id="makeDeviceReservation">Create Reservation</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="createDeviceReservation btn" name="makeDeviceReservation" id="makeDeviceReservation">Create Reservation</button>
</div>
</div>
</div>
Expand All @@ -96,3 +96,14 @@
$(".modal-body #deviceName").val(deviceName);
});
</script>

<script src="/js/jquery.min.js"></script>
<script>
$(document).on("click", ".createDeviceReservation", function(){
var userID = document.getElementById("userID").value;
var deviceReserveDate = document.getElementById("deviceReserveDate").value;
var deviceReturnDate = document.getElementById("deviceReturnDate").value;
console.log(userID);
$.get('/createdevicereservation', {userid: userID, startdate: deviceReserveDate, enddate: deviceReturnDate} );
});
</script>

0 comments on commit 37d23f4

Please sign in to comment.