Skip to content

Commit

Permalink
Merge pull request #150 from arc12012/bugs
Browse files Browse the repository at this point in the history
Bugs
  • Loading branch information
clj13001 committed Apr 21, 2017
2 parents 5e8ed1e + 30999b4 commit e7b6682
Show file tree
Hide file tree
Showing 29 changed files with 980 additions and 449 deletions.
25 changes: 21 additions & 4 deletions WebContent/adminLogin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,27 @@ String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2f
String user = "b372dfe7409692";
String password = "74f6e317";
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection(database, user, password);
Statement stmt = connection.createStatement();
ResultSet result;
result = stmt.executeQuery("select admin.*,employee.Name FROM admin INNER JOIN employee ON admin.Admin_ID = employee.Employee_ID WHERE Admin_ID='" + ssoNum + "' AND Password='" + generatedPass + "'");
Connection connection;
Statement stmt;
for(;;){
try{
connection = DriverManager.getConnection(database, user, password);
break;
}
catch(SQLException e){
Thread.sleep(1);
}
}
for(;;){
try{
stmt = connection.createStatement();
break;
}
catch(SQLException e){
Thread.sleep(1);
}
}
ResultSet result = stmt.executeQuery("select admin.*,employee.Name FROM admin INNER JOIN employee ON admin.Admin_ID = employee.Employee_ID WHERE Admin_ID='" + ssoNum + "' AND Password='" + generatedPass + "'");
if (result.next()){
request.getSession();
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/administration/admin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/administration/adminApprove.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
Expand Down
109 changes: 88 additions & 21 deletions WebContent/html/webpages/administration/adminDeviceSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ pageEncoding="ISO-8859-1"%>
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
<!-- Latest compiled and minified Locales -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
<link rel = "stylesheet" type = "text/css" href = "../../css/stylesheet.css">
<link rel = "shortcut icon" href = "../../imgs/synchrony-financial-logo-dlpx_1.ico">
<style>
Expand Down Expand Up @@ -213,26 +219,26 @@ pageEncoding="ISO-8859-1"%>
<!-- Main body! -->
<h2>Device Hub</h2>
<form onsubmit="return false;" class="form-inline">
<input type="search" class="form-control" name="searchBar" placeholder=" search for devices" autocomplete="off" style="width: 50%; text-align: left; margin: 1%;" />
<input id = "fuzzysearchbar" type="search" class="form-control" name="searchBar" placeholder=" search for devices" autocomplete="off" style="width: 50%; text-align: left; margin: 1%;" />
<button id ="add" class="btn btn-primary">Add Device</button>
</form>

<!-- Location information placed here. -->
<table class="table table-bordered table-hover" id = "tabledisplay">
<table class="table table-bordered table-hover" id = "tabledisplay" data-toggle="table" data-sort-name="name" data-sort-order="asc">
<thead>
<tr>
<th>Name</th>
<th>Locker Position</th>
<th class = "column">Description</th>
<th class = "column">Admin Comments</th>
<th>Availability</th>
<th>MAC Address</th>
<th>Manufacturer</th>
<th>Hardware Type</th>
<th>Operating System</th>
<th>Model Name</th>
<th>Serial Number</th>
<th>NFC ID</th>
<th data-field="name" data-sortable="true">Name</th>
<th data-field="locker" data-sortable="true">Locker Position</th>
<th class = "column" data-field="description" data-sortable="true">Description</th>
<th class = "column" data-field="admin" data-sortable="true">Admin Comments</th>
<th data-field="avail" data-sortable="true">Availability</th>
<th data-field="mac" data-sortable="true">MAC Address</th>
<th data-field="manu" data-sortable="true">Manufacturer</th>
<th data-field="hard" data-sortable="true">Hardware Type</th>
<th data-field="os" data-sortable="true">Operating System</th>
<th data-field="model" data-sortable="true">Model Name</th>
<th data-field="serial" data-sortable="true">Serial Number</th>
<th data-field="nfc" data-sortable="true">NFC ID</th>
</tr>
</thead>
<tbody id="tablebodymain">
Expand All @@ -259,16 +265,20 @@ var availabilities = new Array;
var searchbar = document.getElementsByName('searchBar');
searchbar[0].onkeyup = refresh;
function refresh() {
populateDevices(fuzzyFilter(makeDeviceArray()));
//adds event listeners to all table records
$("tr.entry").click(modifyModal);
if($("#fuzzysearchbar").val().localeCompare("")==0){
populateDevices(devices);
$("tr.entry").click(modifyModal);
}
else{
populateDevices(fuzzyFilter(makeDeviceArray()));
//adds event listeners to all table records
$("tr.entry").click(modifyModal);
}
}
//Populate locations into table!
populateDevices(devices);
//adds event listeners to all table records
$("tr.entry").click(modifyModal);
//Exits modal when x is clicked.
$("#closeModifyForm").click(closeModifyModal);
//Open the add modal
Expand Down Expand Up @@ -300,6 +310,32 @@ document.getElementById('modifyManu').innerHTML = manuHTML;
document.getElementById('modifyHardware').innerHTML = hardwareHTML;
document.getElementById('modifyAvailability').innerHTML = availabilityHTML;
$('#tabledisplay').bootstrapTable({onClickRow: function(row,$element)
{
var id = $element[0].getAttribute('id');
for(var i = 0; i < devices.length; i++){
if(id == devices[i].id)
break;
}
//autofill modal
$("#modifyName").val(devices[i].name.replace(/&quot;/g,"\""));
$("#modifyDesc").val(devices[i].description.replace(/&quot;/g,"\""));
$("#modifyAvailability").val(devices[i].status);
$("#modifyMAC").val(devices[i].mac);
$("#modifyManu").val(devices[i].manufacturer.replace(/&quot;/g,"\""));
$("#modifyHardware").val(devices[i].hardware.replace(/&quot;/g,"\""));
$("#modifyModel").val(devices[i].model.replace(/&quot;/g,"\""));
$("#modifySerial").val(devices[i].serial);
$("#modifyNFC").val(devices[i].nfc);
$("#modifyOS").val(devices[i].os);
$("#modifycomment").val(devices[i].admincomment);
$("#modifyPos").val(devices[i].locker);
$("#modifyID").val(devices[i].id);
$("#modifyModal").show();
}
});
//Places all locations from query into page
function populateDevices(deviceArray){
var html = "";
Expand Down Expand Up @@ -367,8 +403,36 @@ function fuzzyFilter(deviceArray)
for (var i = serialFilterResults.length - 1; i >= 0; i--) {
serialFilterResults[i].original.serial=serialFilterResults[i].string;
}
////// Seventh pass: filter by Locker Position
options.extract = function(arg) {return arg.locker;};
var lockerFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = lockerFilterResults.length - 1; i >= 0; i--) {
lockerFilterResults[i].original.locker=lockerFilterResults[i].string;
}
////// Eight pass: filter by Admin Comments
options.extract = function(arg) {return arg.admincomment;};
var admincommentFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = admincommentFilterResults.length - 1; i >= 0; i--) {
admincommentFilterResults[i].original.admincomment=admincommentFilterResults[i].string;
}
////// Ninth pass: filter by OS
options.extract = function(arg) {return arg.os;};
var osFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = osFilterResults.length - 1; i >= 0; i--) {
osFilterResults[i].original.os=osFilterResults[i].string;
}
////// Tenth pass: filter by description
options.extract = function(arg) {return arg.description;};
var descriptionFilterResults = fuzzy.filter(searchText, deviceArray, options);
// replace releveant field with bolded string
for (var i = descriptionFilterResults.length - 1; i >= 0; i--) {
descriptionFilterResults[i].original.description=descriptionFilterResults[i].string;
}
var filteredResults = union([nameFilterResults,macFilterResults,manufacturerFilterResults,hardwareFilterResults,modelFilterResults,serialFilterResults]);
var filteredResults = union([nameFilterResults,macFilterResults,manufacturerFilterResults,hardwareFilterResults,modelFilterResults,serialFilterResults,lockerFilterResults,admincommentFilterResults,osFilterResults,descriptionFilterResults]);
// this returns a filtered array of objects with attributes 'index', 'original', 'score', and 'string'
// I am interested in the 'original' attribute, which is the relevant object exactly as it was submitted,
Expand All @@ -387,6 +451,9 @@ function fuzzyFilter(deviceArray)
model:filteredResults[i].original.model,
serial:filteredResults[i].original.serial,
nfc:filteredResults[i].original.nfc,
locker:filteredResults[i].original.locker,
admincomment:filteredResults[i].original.admincomment,
os:filteredResults[i].original.os
};
}
return finalResults;
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/administration/adminLocation.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/administration/adminpassword.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/error.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/listingPage.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/profileSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Expand Down
11 changes: 10 additions & 1 deletion WebContent/html/webpages/redirect/orderFormHandler.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ if(Integer.parseInt(request.getParameter("location_dropdown"))==0)
String userName = request.getParameter("name");
String phone = request.getParameter("phone");
String email = request.getParameter("email");
String[] options = request.getParameterValues("checkboxes");
int perm = 0;
int urgent = 0;
for(int j = 0; j < options.length; j++){
if(options[j].equals("perm"))
perm = 1;
if(options[j].equals("urgent"))
urgent = 1;
}
// read location ID, but only if we haven't already generated it when adding new location to db
if(location==-1){ location = Integer.parseInt(request.getParameter("location_dropdown"));}
EmployeeQueries.updateEmployee(Integer.parseInt(navsso), userName, phone, location, email);
Expand All @@ -65,7 +74,7 @@ for(int i=0; i<idStringArray.length; i++)
int[] ticketIDs = new int[devIDs.length];
for(int i=0; i<devIDs.length; i++)
{
ticketIDs[i] = TicketQueries.generateTicket(Integer.parseInt(navsso), location, devIDs[i], request.getParameter("timeNeeded"));
ticketIDs[i] = TicketQueries.generateTicket(Integer.parseInt(navsso), location, devIDs[i], request.getParameter("timeNeeded"), perm);
}
// Now that tickets have been generated we will want to notify users.
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/requestPage.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/returnComplete.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/returnPage.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Expand Down
34 changes: 25 additions & 9 deletions WebContent/html/webpages/shoppingCart.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pageEncoding="ISO-8859-1"%>
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>
<title>Innovation Hub</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Expand Down Expand Up @@ -50,6 +50,16 @@ pageEncoding="ISO-8859-1"%>
input[type=tel]{ margin: 0 auto; width: 60%; }
input[type=number]{ margin: 0 auto; width: 60%; }
div.formcheck{
display:inline-block;
margin-right: 5px;
border-style: solid;
padding: 5px;
border-width: 1px;
border-color: #ccc;
border-radius: 4px;
}
</style>

</head>
Expand All @@ -68,7 +78,7 @@ pageEncoding="ISO-8859-1"%>
<form name="orderForm" onsubmit="return submitOrderForm()" action="redirect/orderFormHandler.jsp" method="post">
<input type="text" name="userID" style = "display: none;"/>
<input type="text" name="orderAll" style = "display: none;"/>
<input type="text" name="deviceIDs" style="display: none;">
<input type="text" name="deviceIDs" style="display: none;">
<div class="form-group row">
<label for="name">Your name</label><br/>
<input type="text" class="form-control" name="name" placeholder="Name" required>
Expand All @@ -80,7 +90,7 @@ pageEncoding="ISO-8859-1"%>
<div class="form-group row">
<label for="email">Email</label><br/>
<input type="email" class="form-control" name="email" placeholder="name@org.domain" style="margin: 0 auto; width:60%" required>
</div>
</div>
<div class="form-group">
<label for="location_dropdown">Place to ship to</label><br/>
<select class="form-control" name="location_dropdown" id="dropdown" onchange="forceUpdateLocationMetadata()" style="width:65%; max-height: 80%; text-align: center; vertical-align: center; align-items: center; display: block; position: relative; margin: 0% auto; text-align-last:center; padding:">
Expand Down Expand Up @@ -164,12 +174,18 @@ pageEncoding="ISO-8859-1"%>
<input type="text" onkeyup="forceDropdownCustomLocation" class="form-control" name="zip" placeholder="Zip Code" pattern="[0-9]{5}" title="Input must be 5 digits" style="margin: 0 auto; width:60%" required/>
</div>
</div>
</div>
<div class="form-group row">
<label for="timeNeeded">When will you be able to return it?</label><br/>
<input type="date" class="form-control" name="timeNeeded" style="width:20%; margin:0% auto" required/>
</div>
<button type="submit" class="btn btn-primary" name="Submit">Submit</button>
</div>
<div class="form-group row">
<label for="timeNeeded">When will you be able to return it?</label><br/>
<input type="date" class="form-control" name="timeNeeded" style="width:20%; margin:0% auto" required/>
</div>
<div class="form-group row">
<label for="urgent">This is an urgent request</label>
<input type = "checkbox" name = "checkboxes" value="urgent"><br>
<label for="urgent">This is a permanent loan</label>
<input type = "checkbox" name = "checkboxes" value = "perm">
</div>
<button type="submit" class="btn btn-primary" name="Submit">Submit</button>
</form>
</div>

Expand Down
Loading

0 comments on commit e7b6682

Please sign in to comment.