| [1eb7a55] | 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|---|
| 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
|---|
| 3 |
|
|---|
| 4 | <!DOCTYPE html>
|
|---|
| 5 | <html>
|
|---|
| 6 | <head>
|
|---|
| 7 | <title>${advice != null ? "Edit Consultation" : "New Consultation Request"}</title>
|
|---|
| 8 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
|---|
| 9 | </head>
|
|---|
| 10 | <body>
|
|---|
| 11 | <div class="container col-md-5 mt-5">
|
|---|
| 12 | <div class="card">
|
|---|
| 13 | <div class="card-body">
|
|---|
| 14 | <h3 class="text-center">${advice != null ? "Update Request" : "Ask for Consultation"}</h3>
|
|---|
| 15 |
|
|---|
| 16 | <form action="${pageContext.request.contextPath}/advice/${advice != null ? 'update' : 'insert'}" method="post">
|
|---|
| 17 |
|
|---|
| 18 | <c:if test="${advice != null}">
|
|---|
| 19 | <input type="hidden" name="studentId" value="${advice.student_id}" />
|
|---|
| 20 | <input type="hidden" name="professorId" value="${advice.professor_id}" />
|
|---|
| 21 | </c:if>
|
|---|
| 22 |
|
|---|
| 23 | <div class="form-group">
|
|---|
| 24 | <label>Student</label>
|
|---|
| 25 | <select name="studentId" class="form-control" ${advice != null ? "disabled" : "required"}>
|
|---|
| 26 | <option value="">-- Select Student --</option>
|
|---|
| 27 | <c:forEach var="s" items="${listStudents}">
|
|---|
| 28 | <option value="${s.id}" ${advice.student_id == s.id ? 'selected' : ''}>
|
|---|
| 29 | ${s.name} (ID: ${s.id})
|
|---|
| 30 | </option>
|
|---|
| 31 | </c:forEach>
|
|---|
| 32 | </select>
|
|---|
| 33 | </div>
|
|---|
| 34 |
|
|---|
| 35 | <div class="form-group">
|
|---|
| 36 | <label>Professor</label>
|
|---|
| 37 | <select name="professorId" class="form-control" ${advice != null ? "disabled" : "required"}>
|
|---|
| 38 | <option value="">-- Select Professor --</option>
|
|---|
| 39 | <c:forEach var="p" items="${listProfessors}">
|
|---|
| 40 | <option value="${p.id}" ${advice.professor_id == p.id ? 'selected' : ''}>
|
|---|
| 41 | ${p.name}
|
|---|
| 42 | </option>
|
|---|
| 43 | </c:forEach>
|
|---|
| 44 | </select>
|
|---|
| 45 | </div>
|
|---|
| 46 |
|
|---|
| 47 | <div class="form-group">
|
|---|
| 48 | <label>Request Date (Start)</label>
|
|---|
| 49 | <input type="date" name="startDate" class="form-control"
|
|---|
| 50 | value="${advice != null ? advice.start_date : ''}" required>
|
|---|
| 51 | </div>
|
|---|
| 52 |
|
|---|
| 53 | <div class="form-group">
|
|---|
| 54 | <label>Consultation Date (End / Optional)</label>
|
|---|
| 55 | <input type="date" name="endDate" class="form-control"
|
|---|
| 56 | value="${advice != null ? advice.end_date : ''}">
|
|---|
| 57 | <small class="text-muted">Leave empty if consultation hasn't happened yet.</small>
|
|---|
| 58 | </div>
|
|---|
| 59 |
|
|---|
| 60 | <div class="mt-4">
|
|---|
| 61 | <button type="submit" class="btn btn-success btn-block">
|
|---|
| 62 | ${advice != null ? "Save Changes" : "Send Request"}
|
|---|
| 63 | </button>
|
|---|
| 64 | <a href="${pageContext.request.contextPath}/advice/list" class="btn btn-secondary btn-block">Cancel</a>
|
|---|
| 65 | </div>
|
|---|
| 66 | </form>
|
|---|
| 67 | </div>
|
|---|
| 68 | </div>
|
|---|
| 69 | </div>
|
|---|
| 70 | </body>
|
|---|
| 71 | </html> |
|---|