Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- Author: Gianpiero Beraldin
- Class: Industrial application dev
- Project: Ishina web app
- Teacher: Ed Strange
- Date: 14/02/2018
- File: Customers.jsp
- Purpose: users can register or sign in
- -->
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <%@ page import="model.Constants"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Customers</title>
- <!-- CSS -->
- <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.3.1/jquery.min.js"></script>
- <script
- src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <link rel="stylesheet"
- href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
- <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
- <link rel="stylesheet"
- href="assets/font-awesome/css/font-awesome.min.css">
- <link rel="stylesheet" href="assets/css/form-elements.css">
- <link rel="stylesheet" href="assets/css/style.css">
- <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
- <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- </head>
- <body>
- <jsp:include page="Shared/_Banner.jsp" />
- <c:choose>
- <c:when
- test="${sessionScope.userType == Constants.USER_TYPE_ID_CUSTOMER ||
- sessionScope.userType == Constants.USER_TYPE_ID_EMPLOYEE}">
- <jsp:include page="Shared/_SideBar.jsp" />
- </c:when>
- <c:otherwise>
- <jsp:include page="Shared/_AdminSideBar.jsp" />
- </c:otherwise>
- </c:choose>
- <div style="margin-left: 23%; padding: 1px 16px; height: 1000px;">
- <div class="container">
- <h2>Customers</h2>
- <form action="AlterCustomers" method="post">
- <table class="table table-striped">
- <thead>
- <tr>
- <th><center>Manager Name</center></th>
- <th><center>Email</center></th>
- <th><center>Phone Number</center></th>
- <th><center>Extension</center></th>
- <th><center>Store Name</center></th>
- <th><center>Address</center></th>
- <th><center>Postal Code</center></th>
- <th><center>Edit</center></th>
- <th><center>Toggle Status</center></th>
- </tr>
- </thead>
- <tbody>
- <sql:setDataSource driver="${Constants.DB_DRIVER}"
- url="${Constants.DB_URL}" user="${Constants.DB_LOGIN}"
- password="${Constants.DB_PASSWORD}" />
- <sql:query var="users">
- SELECT user_id, email_address, inactive FROM users WHERE user_type_id=${Constants.USER_TYPE_ID_CUSTOMER}
- </sql:query>
- <c:forEach var="user" begin="0" items="${users.rows}">
- <sql:query var="storeManagers">
- SELECT * FROM store_managers WHERE email_address="${user.email_address}"
- </sql:query>
- <c:forEach var="storeManager" items="${storeManagers.rows}">
- <sql:query var="stores">
- SELECT * FROM stores WHERE store_id=${storeManager.store_id}
- </sql:query>
- <tr>
- <td>${storeManager.name}</td>
- <td>${storeManager.email_address}</td>
- <td>${storeManager.phone_number}</td>
- <td><c:if
- test="${not empty storeManager.phone_number_extension}">
- <c:out value="${storeManager.phone_number_extension}" />
- </c:if></td>
- <c:forEach var="store" items="${stores.rows}">
- <td>${store.name}</td>
- <td>${store.address}</td>
- <td>${store.postal_code}</td>
- <td><button type="submit" class="btn"
- data-toggle="modal" data-target="#editModal">Edit</button></td>
- <c:choose>
- <c:when test="${user.inactive == true}">
- <td><button name="makeActive" type="submit" class="btn"
- value="${user.user_id}">Make active</button></td>
- </c:when>
- <c:otherwise>
- <td><button name="makeInactive" type="submit"
- class="btn" value="${user.user_id}">Make inactive</button></td>
- </c:otherwise>
- </c:choose>
- <div class="modal fade" id="editModal" tabindex="-1"
- role="dialog" aria-labelledby="myModalLabel"
- aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <!-- Modal Header -->
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">
- <span aria-hidden="true">×</span> <span
- class="sr-only">Close</span>
- </button>
- <h4 class="modal-title" id="myModalLabel">Edit
- Customer/Store Information</h4>
- </div>
- <c:set var="names"
- value="${fn:split(storeManager.name, ' ')}" />
- <!-- Modal Body -->
- <div class="modal-body">
- <form role="form" action="AlterCustomers" method="post">
- <div class="form-group">
- <label for="customer-first-name">First Name</label> <input
- type="text" class="form-control"
- name="customer-first-name"
- id="form-customer-first-name" placeholder="First Name"
- value="${names[0]}" />
- </div>
- <div class="form-group">
- <label for="customer-last-name">Last Name</label> <input
- type="text" class="form-control"
- id="form-customer-last-name" name="customer-last-name"
- placeholder="Last Name" value="${names[1]}" />
- </div>
- <div class="form-group">
- <label for="customer-email">Email</label> <input
- type="email" class="form-control"
- id="form-employee-email" name="customer-email-address"
- placeholder="Email"
- value="${storeManager.email_address}" />
- </div>
- <div class="form-group">
- <label for="customer-phone-number">Phone Number</label>
- <input type="email" class="form-control"
- id="form-customer-phone-number"
- name="customer-phone-number" placeholder="Phone Number"
- value="${storeManager.phone_number}" />
- </div>
- <div class="form-group">
- <label for="customer-extension">Extension</label> <input
- type="email" class="form-control"
- id="form-customer-extension" name="customer-extension"
- placeholder="Extension"
- value="${storeManager.phone_number_extension}" />
- </div>
- <div class="form-group">
- <label for="customer-store-name">Store Name</label> <input
- type="email" class="form-control"
- id="form-customer-name" name="customer-store-name"
- placeholder="Store Name" value="${store.name}" />
- </div>
- <div class="form-group">
- <label for="customer-store-address">Store
- Address</label> <input type="email" class="form-control"
- id="form-customer-store-address"
- name="customer-store-address"
- placeholder="Store Address" value="${store.address}" />
- </div>
- <div class="form-group">
- <label for="customer-store-postal-code">Store
- Postal Code</label> <input type="email" class="form-control"
- id="form-customer-store-postal-code"
- name="customer-store-postal-code"
- placeholder="Store Postal Code"
- value="${store.postal_code}" />
- </div>
- <input type="hidden"
- value="${storeManager.store_manager_id}">
- <button value="${user.user_id}" type="submit"
- class="btn btn-default" name="edit">Submit</button>
- <button type="button" class="btn btn-default"
- data-dismiss="modal">Close</button>
- </form>
- </div>
- </div>
- </div>
- </div>
- </c:forEach>
- </tr>
- </c:forEach>
- </c:forEach>
- </tbody>
- </table>
- </form>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement