From 4fe48e21ad4a00b2390a2903280cc03d265ffaf9 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Sun, 23 Apr 2017 20:11:09 -0400 Subject: [PATCH] Bootstrap Tables. Boostrap Tables Everywhere. --- .../webpages/administration/adminApprove.jsp | 56 +++++++++---- .../webpages/administration/adminLocation.jsp | 80 +++++++++++++++---- .../webpages/administration/allTickets.jsp | 14 ++-- WebContent/html/webpages/mytickets.jsp | 7 +- 4 files changed, 117 insertions(+), 40 deletions(-) diff --git a/WebContent/html/webpages/administration/adminApprove.jsp b/WebContent/html/webpages/administration/adminApprove.jsp index af64ee3..4eafaf7 100644 --- a/WebContent/html/webpages/administration/adminApprove.jsp +++ b/WebContent/html/webpages/administration/adminApprove.jsp @@ -11,13 +11,18 @@ pageEncoding="ISO-8859-1"%> - Innovation Hub - - - - - - + Innovation Hub + + + + + + + + + + + @@ -93,16 +107,16 @@ pageEncoding="ISO-8859-1"%>
- +
- - - - - - - + + + + + + + @@ -147,6 +161,18 @@ String ticketStr = Ticket.arrayToString(tickets); var searchbar = document.getElementsByName('searchBar'); searchbar[0].onkeyup = refresh; + // Set up table record event listeners + $('#tabledisplay').bootstrapTable({onClickRow: function(row,$element){ + var id = $element[0].getAttribute('id'); + var html = ""; + document.getElementById("tablemodal").innerHTML = html; + $("#ticketIDfield").val(ticks[id].id); + $("#deviceIDfield").val(ticks[id].deviceID); + $("#locationIDfield").val(ticks[id].location); + $("#permField").val(ticks[id].permanent); + $("#Modal").show(); + }}); + /* Params: tickets - array of objects, formatted as tickets. This function will display tickets in a table on the webpage. diff --git a/WebContent/html/webpages/administration/adminLocation.jsp b/WebContent/html/webpages/administration/adminLocation.jsp index 4868e39..9bb08d9 100644 --- a/WebContent/html/webpages/administration/adminLocation.jsp +++ b/WebContent/html/webpages/administration/adminLocation.jsp @@ -15,11 +15,17 @@ + + + + + + + + - -
Ticket IDRequestor NameLocation NameDevice NameStatusPermanent?Return DateTicket IDRequestor NameLocation NameDevice NameStatusPermanent?Return Date
" + ticks[id].id + "" + ticks[id].username + "" + ticks[id].locationname + "" + ticks[id].devicename + "" + ticks[id].status + "" + ticks[id].permanent + "" + ticks[id].return + "
- - - - - - - - - - - - +
NameAddressTownStateZip Code
+ + + + + + + + + + + +
NameAddressTownStateZip Code
@@ -297,6 +312,41 @@ window.onkeydown = function(e){if (e.keyCode == 27){closeAddModal();closeModifyM //Event listener exits modal when click outside modal. window.onclick = function(e){var add = document.getElementById('addModal'); var modify = document.getElementById('modifyModal'); if(e.target == add || e.target == modify) {closeAddModal();closeModifyModal();}} +// Event listener for table records. +$('#tabledisplay').bootstrapTable({onClickRow: function(row,$element){ + var id = $element[0].getAttribute('id'); + for(var i = 0; i < locations.length; i++){ + if(id == locations[i].id) + break; + } + //autofill all information from what you clicked on into modal + $("#modifyName").val(locations[i].name.replace(/"/g,"\"")); + $("#modifyAddress").val(locations[i].address.replace(/"/g,"\"")); + $("#modifyTown").val(locations[i].town.replace(/"/g,"\"")); + $("#modifyState").val(locations[i].state); + $("#modifyZip").val(locations[i].zip); + $("#modifyID").val(locations[i].id); + + var geocoder = new google.maps.Geocoder(); + //this function assumes that you are using a proper zip code... + geocoder.geocode({'address':locations[i].zip}, function(results,status) + {if (status == google.maps.GeocoderStatus.OK) + {$("#modifylat").val(results[0].geometry.location.lat()); + $("#modifylng").val(results[0].geometry.location.lng());} + }); + + //if the location has a foreign key constraint, then the delete button should be restricted + if(locations[i].numDevices > 0 || locations[i].numEmployees > 0){ + $('#thedeletebutton').attr('disabled',true); + $('#thedeletebutton').attr('title','Cannot delete because devices and/or employees are at this location!'); + } + else{ + $('#thedeletebutton').attr('disabled',false); + $('#thedeletebutton').removeAttr('title'); + } + $("#modifyModal").show(); +}}); + //Places all locations from query into page function populateLocations(){ var html = ""; diff --git a/WebContent/html/webpages/administration/allTickets.jsp b/WebContent/html/webpages/administration/allTickets.jsp index a512dc0..0ea097a 100644 --- a/WebContent/html/webpages/administration/allTickets.jsp +++ b/WebContent/html/webpages/administration/allTickets.jsp @@ -29,10 +29,6 @@ pageEncoding="ISO-8859-1"%> text-align: center; } - tr.entry{ - cursor: pointer; - } - .table{ width: auto; background-color: #E9EAEB; @@ -45,6 +41,12 @@ pageEncoding="ISO-8859-1"%> body{ overflow: visible; } + + div.displayDevice{ + padding-right: 30px; + padding-bottom: 30px; + } + @@ -65,7 +67,8 @@ pageEncoding="ISO-8859-1"%>
-
+ +
@@ -81,6 +84,7 @@ pageEncoding="ISO-8859-1"%>
+
<% diff --git a/WebContent/html/webpages/mytickets.jsp b/WebContent/html/webpages/mytickets.jsp index ee3e086..47047c1 100644 --- a/WebContent/html/webpages/mytickets.jsp +++ b/WebContent/html/webpages/mytickets.jsp @@ -30,10 +30,6 @@ pageEncoding="ISO-8859-1"%> width: 50%; } - tr.entry{ - cursor: pointer; - } - .table{ background-color: #E9EAEB; } @@ -43,10 +39,11 @@ pageEncoding="ISO-8859-1"%> } div.displayDevice{ - overflow: visible; padding-right: 30px; margin-bottom: 30px; + overflow: hidden; height: auto; + width: auto; }