diff --git a/WebContent/html/webpages/administration/adminApprove.jsp b/WebContent/html/webpages/administration/adminApprove.jsp
index e144f39..1820d59 100644
--- a/WebContent/html/webpages/administration/adminApprove.jsp
+++ b/WebContent/html/webpages/administration/adminApprove.jsp
@@ -107,6 +107,7 @@
Location Name
Device Name
Status
+ Permanent?
Return Date
@@ -118,6 +119,7 @@
+
@@ -133,6 +135,7 @@
Location Name
Device Name
Status
+ Permanent?
Return Date
@@ -167,18 +170,19 @@
var html = "";
for(var i = 0; i < tickets.length; i++){
//NEED TO ADD IN RETURN DATE AT END BUT THAT WOULD BREAK THINGS AT THE MOMENT
- html += "" + tickets[i].id + " " + tickets[i].username + " " + tickets[i].locationname + " " + tickets[i].devicename + " " + tickets[i].status + " " + tickets[i].return + " ";
+ html += "" + tickets[i].id + " " + tickets[i].username + " " + tickets[i].locationname + " " + tickets[i].devicename + " " + tickets[i].status + " " + tickets[i].permanent + " " + tickets[i].return + " ";
}
document.getElementById("tablebodymain").innerHTML = html;
}
function ticketAction(){
var id = this.id;
- var html = "" + tickets[id].id + " " + tickets[id].username + " " + tickets[id].locationname + " " + tickets[id].devicename + " " + tickets[id].status + " " + tickets[id].return + " ";
+ var html = "" + tickets[id].id + " " + tickets[id].username + " " + tickets[id].locationname + " " + tickets[id].devicename + " " + tickets[id].status + " " + tickets[id].permanent + " " + tickets[id].return + " ";
document.getElementById("tablemodal").innerHTML = html;
$("#ticketIDfield").val(tickets[id].id);
$("#deviceIDfield").val(tickets[id].deviceID);
$("#locationIDfield").val(tickets[id].location);
+ $("#permField").val(tickets[id].permanent);
$("#Modal").show();
}
diff --git a/WebContent/html/webpages/administration/ticketApprove.jsp b/WebContent/html/webpages/administration/ticketApprove.jsp
new file mode 100644
index 0000000..7b35f4c
--- /dev/null
+++ b/WebContent/html/webpages/administration/ticketApprove.jsp
@@ -0,0 +1,66 @@
+<%@ page import = "database.*,entities.Location" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+
+
+
+
+
+
+ Innovation Hub
+
+
+
+
+
+
+
+
+ <%@ include file="../components/navbar.jsp"%>
+
+
+
+
+
+
Approving Tickets
+
Thanks for approving a ticket!
+
You can ship the devices to the following address:
+
+
+
+
+<%
+int locationid = -1;
+for(Cookie c : usercookies){
+ if(c.getName().equals("location")){
+ locationid = Integer.parseInt(c.getValue());
+ c.setMaxAge(0);
+ c.setPath("/");
+ response.addCookie(c);
+ }
+}
+Location location = LocationQueries.getLocationByID(locationid);
+String address = location.getAddress();
+String town = location.getTown();
+String state = location.getState();
+String zip = location.getZip();
+%>
+
+
\ No newline at end of file
diff --git a/WebContent/html/webpages/redirect/locationRedirect.jsp b/WebContent/html/webpages/redirect/locationRedirect.jsp
index 8700f23..9c80f3d 100644
--- a/WebContent/html/webpages/redirect/locationRedirect.jsp
+++ b/WebContent/html/webpages/redirect/locationRedirect.jsp
@@ -37,7 +37,7 @@ String lng = request.getParameter("lng");
int er = 0;
//add form was submitted
if(request.getParameter("add") != null){
- Location location = new Location(0,name,address,town,state,zip,0,lat,lng);
+ Location location = new Location(0,name,address,town,state,zip,0,lat,lng,0,0);
LocationQueries.addLocation(location);
}
//modify form was submitted
@@ -46,7 +46,7 @@ if(request.getParameter("modify") != null){
String strID = request.getParameter("id");
//turn to int for constructor
int id = Integer.parseInt(strID);
- Location location = new Location(id,name,address,town,state,zip,0,lat,lng);
+ Location location = new Location(id,name,address,town,state,zip,0,lat,lng,0,0);
LocationQueries.modifyLocation(location);
}
//delete form was submitted
diff --git a/WebContent/html/webpages/redirect/orderFormHandler.jsp b/WebContent/html/webpages/redirect/orderFormHandler.jsp
index b2c680a..aff74f9 100644
--- a/WebContent/html/webpages/redirect/orderFormHandler.jsp
+++ b/WebContent/html/webpages/redirect/orderFormHandler.jsp
@@ -43,11 +43,13 @@ 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;
+if(options != null){
+ 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"));}
diff --git a/WebContent/html/webpages/redirect/ticketAdminRedirect.jsp b/WebContent/html/webpages/redirect/ticketAdminRedirect.jsp
index e85a30f..2ab57a0 100644
--- a/WebContent/html/webpages/redirect/ticketAdminRedirect.jsp
+++ b/WebContent/html/webpages/redirect/ticketAdminRedirect.jsp
@@ -23,27 +23,32 @@
- Redirect Page
- You shouldn't be seeing this page :)
-
<%
//make instance
String ticketidstr = request.getParameter("ticketid");
String deviceidstr = request.getParameter("deviceid");
String locationidstr = request.getParameter("locationid");
+String permanent = request.getParameter("permField");
int ticketid = Integer.parseInt(ticketidstr);
int deviceid = Integer.parseInt(deviceidstr);
int locationid = Integer.parseInt(locationidstr);
+int perm = permanent.equals("Yes") ? 1 : 0;
//approve form was submitted
if(request.getParameter("approve") != null){
- TicketQueries.acceptTicket(ticketid,deviceid,locationid,Integer.parseInt(navsso));
+ Cookie location = new Cookie("location",Integer.toString(locationid));
+ location.setMaxAge(30*60);
+ location.setPath("/");
+ response.addCookie(location);
+ TicketQueries.acceptTicket(ticketid,deviceid,locationid,Integer.parseInt(navsso),perm);
User client = EmployeeQueries.getEmployeeByID(TicketQueries.getUserID(ticketid));
boolean notificationPreferences = (Math.floor(client.getNotificationPreferences()/2)%2==1);
//The second least significant bit of notificationPreferences - the 2's place - is used for ticket approval notifications.
if(notificationPreferences){
NotificationQueue q = new NotificationQueue(client,"ticketConfirmations");
q.start();
+ response.sendRedirect("../administration/ticketApprove.jsp");
+ return;
}
}
//reject form was submitted
@@ -55,12 +60,10 @@ if(request.getParameter("reject") != null){
if(notificationPreferences){
NotificationQueue q = new NotificationQueue(client, "ticketRejections");
q.start();
+ response.sendRedirect("../administration/adminApprove.jsp");
+ return;
}
}
%>
-
-