| 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|---|
| 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
|---|
| 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
|---|
| 4 |
|
|---|
| 5 | <%-- Create a 'now' object to compare dates --%>
|
|---|
| 6 | <jsp:useBean id="now" class="java.util.Date" />
|
|---|
| 7 |
|
|---|
| 8 | <!DOCTYPE html>
|
|---|
| 9 | <html lang="en">
|
|---|
| 10 | <head>
|
|---|
| 11 | <meta charset="UTF-8">
|
|---|
| 12 | <title>Consultation Log</title>
|
|---|
| 13 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
|---|
| 14 | <style>
|
|---|
| 15 | .status-badge { width: 100px; text-align: center; }
|
|---|
| 16 | </style>
|
|---|
| 17 | </head>
|
|---|
| 18 | <body>
|
|---|
| 19 |
|
|---|
| 20 | <div class="container mt-5">
|
|---|
| 21 | <div class="row align-items-center mb-4">
|
|---|
| 22 | <div class="col">
|
|---|
| 23 | <h2 class="display-5">Advice & Consultations</h2>
|
|---|
| 24 | <p class="text-muted">Current System Date: <strong><fmt:formatDate value="${now}" pattern="yyyy-MM-dd" /></strong></p>
|
|---|
| 25 | </div>
|
|---|
| 26 | <div class="col-auto">
|
|---|
| 27 | <a href="${pageContext.request.contextPath}/advice/new" class="btn btn-primary shadow-sm">+ New Request</a>
|
|---|
| 28 | <a href="${pageContext.request.contextPath}/" class="btn btn-outline-secondary shadow-sm">Home</a>
|
|---|
| 29 | </div>
|
|---|
| 30 | </div>
|
|---|
| 31 |
|
|---|
| 32 | <div class="card shadow-sm">
|
|---|
| 33 | <div class="table-responsive">
|
|---|
| 34 | <table class="table table-hover table-striped mb-0">
|
|---|
| 35 | <thead class="bg-light">
|
|---|
| 36 | <tr>
|
|---|
| 37 | <th>Student ID</th>
|
|---|
| 38 | <th>Professor ID</th>
|
|---|
| 39 | <th>Request Sent</th>
|
|---|
| 40 | <th>Consultation Date</th>
|
|---|
| 41 | <th>Status</th>
|
|---|
| 42 | <th class="text-center">Actions</th>
|
|---|
| 43 | </tr>
|
|---|
| 44 | </thead>
|
|---|
| 45 | <tbody>
|
|---|
| 46 | <c:forEach var="adv" items="${listAdvice}">
|
|---|
| 47 | <tr>
|
|---|
| 48 | <td><span class="badge badge-light p-2 border">#${adv.student_id}</span></td>
|
|---|
| 49 | <td><span class="badge badge-light p-2 border">#${adv.professor_id}</span></td>
|
|---|
| 50 | <td>${adv.start_date}</td>
|
|---|
| 51 | <td>
|
|---|
| 52 | ${adv.end_date != null ? adv.end_date : '<em class="text-muted small">Not set</em>'}
|
|---|
| 53 | </td>
|
|---|
| 54 | <td>
|
|---|
| 55 | <c:choose>
|
|---|
| 56 | <%-- CASE 1: No date has been set by the professor yet --%>
|
|---|
| 57 | <c:when test="${empty adv.end_date}">
|
|---|
| 58 | <span class="badge badge-warning status-badge">Pending</span>
|
|---|
| 59 | </c:when>
|
|---|
| 60 |
|
|---|
| 61 | <%-- CASE 2: The date is set for the FUTURE --%>
|
|---|
| 62 | <c:when test="${adv.end_date > now}">
|
|---|
| 63 | <span class="badge badge-info status-badge">Scheduled</span>
|
|---|
| 64 | </c:when>
|
|---|
| 65 |
|
|---|
| 66 | <%-- CASE 3: The date has passed --%>
|
|---|
| 67 | <c:otherwise>
|
|---|
| 68 | <span class="badge badge-success status-badge">Completed</span>
|
|---|
| 69 | </c:otherwise>
|
|---|
| 70 | </c:choose>
|
|---|
| 71 | </td>
|
|---|
| 72 | <td class="text-center">
|
|---|
| 73 | <a href="${pageContext.request.contextPath}/advice/edit?studentId=${adv.student_id}&professorId=${adv.professor_id}"
|
|---|
| 74 | class="btn btn-sm btn-info">Edit</a>
|
|---|
| 75 |
|
|---|
| 76 | <a href="${pageContext.request.contextPath}/advice/delete?studentId=${adv.student_id}&professorId=${adv.professor_id}"
|
|---|
| 77 | class="btn btn-sm btn-danger"
|
|---|
| 78 | onclick="return confirm('Delete this consultation record?')">Delete</a>
|
|---|
| 79 | </td>
|
|---|
| 80 | </tr>
|
|---|
| 81 | </c:forEach>
|
|---|
| 82 |
|
|---|
| 83 | <c:if test="${empty listAdvice}">
|
|---|
| 84 | <tr>
|
|---|
| 85 | <td colspan="6" class="text-center py-5">
|
|---|
| 86 | <p class="text-muted mb-0">No consultation requests found in the system.</p>
|
|---|
| 87 | </td>
|
|---|
| 88 | </tr>
|
|---|
| 89 | </c:if>
|
|---|
| 90 | </tbody>
|
|---|
| 91 | </table>
|
|---|
| 92 | </div>
|
|---|
| 93 | </div>
|
|---|
| 94 | </div>
|
|---|
| 95 |
|
|---|
| 96 | </body>
|
|---|
| 97 | </html> |
|---|