借书/还书/续借/逾期管理
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>New Borrow - MZH Library</title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/app.css">
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="/WEB-INF/jsp/common/header.jspf" %>
|
||||
<main class="page-shell">
|
||||
<section class="form-panel" aria-labelledby="borrow-form-title">
|
||||
<p class="eyebrow">Borrowing Management</p>
|
||||
<h1 id="borrow-form-title">New borrow</h1>
|
||||
|
||||
<c:if test="${not empty errorMessage}">
|
||||
<div class="message message-error" role="alert">
|
||||
<c:out value="${errorMessage}" />
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<c:set var="readerIdentifierValue" value="${formValues.readerIdentifier}" />
|
||||
<c:set var="bookIdentifierValue" value="${formValues.bookIdentifier}" />
|
||||
|
||||
<form class="borrow-form" action="${pageContext.request.contextPath}/borrowing/create" method="post" novalidate>
|
||||
<div class="form-grid">
|
||||
<div class="form-field">
|
||||
<label for="readerIdentifier">Reader ID</label>
|
||||
<input id="readerIdentifier" name="readerIdentifier" type="text"
|
||||
value="${fn:escapeXml(readerIdentifierValue)}" required>
|
||||
<c:if test="${not empty errors.readerIdentifier}">
|
||||
<span class="field-error"><c:out value="${errors.readerIdentifier}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="bookIdentifier">Book ID</label>
|
||||
<input id="bookIdentifier" name="bookIdentifier" type="text"
|
||||
value="${fn:escapeXml(bookIdentifierValue)}" required>
|
||||
<c:if test="${not empty errors.bookIdentifier}">
|
||||
<span class="field-error"><c:out value="${errors.bookIdentifier}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="button button-primary" type="submit">Borrow</button>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/borrowing">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,155 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Borrowing Management - MZH Library</title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/app.css">
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="/WEB-INF/jsp/common/header.jspf" %>
|
||||
<main class="page-shell">
|
||||
<section class="dashboard-hero catalog-hero" aria-labelledby="borrowing-title">
|
||||
<div>
|
||||
<p class="eyebrow">Borrowing Management</p>
|
||||
<h1 id="borrowing-title">Manage borrowing</h1>
|
||||
<p>Create borrow records, process returns, renew active loans, and review overdue items.</p>
|
||||
</div>
|
||||
<a class="button button-primary" href="${pageContext.request.contextPath}/borrowing/new">New borrow</a>
|
||||
</section>
|
||||
|
||||
<c:if test="${not empty successMessage}">
|
||||
<div class="message message-success" role="status">
|
||||
<c:out value="${successMessage}" />
|
||||
</div>
|
||||
</c:if>
|
||||
<c:if test="${not empty errorMessage}">
|
||||
<div class="message message-error" role="alert">
|
||||
<c:out value="${errorMessage}" />
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<section class="toolbar-panel" aria-label="Borrowing search">
|
||||
<form class="search-form borrowing-search-form" action="${pageContext.request.contextPath}/borrowing" method="get">
|
||||
<div class="search-field">
|
||||
<label for="readerIdentifier">Reader ID</label>
|
||||
<input id="readerIdentifier" name="readerIdentifier" type="text"
|
||||
value="${fn:escapeXml(criteria.readerIdentifier)}">
|
||||
</div>
|
||||
|
||||
<div class="search-field">
|
||||
<label for="bookIdentifier">Book ID</label>
|
||||
<input id="bookIdentifier" name="bookIdentifier" type="text"
|
||||
value="${fn:escapeXml(criteria.bookIdentifier)}">
|
||||
</div>
|
||||
|
||||
<div class="search-field">
|
||||
<label for="status">Status</label>
|
||||
<select id="status" name="status">
|
||||
<option value="">All statuses</option>
|
||||
<c:forEach var="status" items="${statuses}">
|
||||
<option value="${status.code}" <c:if test="${criteria.statusCode == status.code}">selected</c:if>>
|
||||
<c:out value="${status.displayName}" />
|
||||
</option>
|
||||
</c:forEach>
|
||||
<option value="${overdueStatus}" <c:if test="${criteria.statusCode == overdueStatus}">selected</c:if>>
|
||||
Overdue
|
||||
</option>
|
||||
</select>
|
||||
<c:if test="${not empty errors.status}">
|
||||
<span class="field-error"><c:out value="${errors.status}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<button class="button button-primary" type="submit">Search</button>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/borrowing">Clear</a>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="table-panel" aria-labelledby="borrowing-results-title">
|
||||
<h2 id="borrowing-results-title">Borrowing records</h2>
|
||||
<c:choose>
|
||||
<c:when test="${empty borrowRecords}">
|
||||
<p class="empty-state">No borrowing records match the current filters.</p>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="table-scroll">
|
||||
<table class="data-table borrowing-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Reader</th>
|
||||
<th scope="col">Book</th>
|
||||
<th scope="col">Borrowed</th>
|
||||
<th scope="col">Due</th>
|
||||
<th scope="col">Returned</th>
|
||||
<th scope="col">Renewals</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="record" items="${borrowRecords}">
|
||||
<tr>
|
||||
<td>
|
||||
<strong><c:out value="${record.readerIdentifier}" /></strong>
|
||||
<div class="muted-text"><c:out value="${record.readerName}" /></div>
|
||||
</td>
|
||||
<td>
|
||||
<strong><c:out value="${record.bookIdentifier}" /></strong>
|
||||
<div class="muted-text"><c:out value="${record.bookTitle}" /></div>
|
||||
</td>
|
||||
<td><c:out value="${record.borrowedAtText}" /></td>
|
||||
<td><c:out value="${record.dueAtText}" /></td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${not empty record.returnedAtText}">
|
||||
<c:out value="${record.returnedAtText}" />
|
||||
</c:when>
|
||||
<c:otherwise>Not returned</c:otherwise>
|
||||
</c:choose>
|
||||
</td>
|
||||
<td><c:out value="${record.renewalCount}" /> / <c:out value="${maxRenewals}" /></td>
|
||||
<td>
|
||||
<span class="status-pill status-${record.displayStatusCode}">
|
||||
<c:out value="${record.displayStatusName}" />
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${record.status.code == 'active'}">
|
||||
<div class="table-actions">
|
||||
<form action="${pageContext.request.contextPath}/borrowing/return"
|
||||
method="post"
|
||||
onsubmit="return confirm('Return this book?');">
|
||||
<input type="hidden" name="id" value="${record.id}">
|
||||
<button class="button button-secondary" type="submit">Return</button>
|
||||
</form>
|
||||
<c:if test="${record.renewalCount < maxRenewals}">
|
||||
<form action="${pageContext.request.contextPath}/borrowing/renew"
|
||||
method="post"
|
||||
onsubmit="return confirm('Renew this loan?');">
|
||||
<input type="hidden" name="id" value="${record.id}">
|
||||
<button class="button button-secondary" type="submit">Renew</button>
|
||||
</form>
|
||||
</c:if>
|
||||
</div>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<span class="muted-text">Complete</span>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -12,8 +12,12 @@
|
||||
<a href="${pageContext.request.contextPath}/librarian/home">Librarian</a>
|
||||
<a href="${pageContext.request.contextPath}/books">Books</a>
|
||||
<a href="${pageContext.request.contextPath}/readers">Readers</a>
|
||||
<a href="${pageContext.request.contextPath}/borrowing">Borrowing</a>
|
||||
</c:if>
|
||||
<a href="${pageContext.request.contextPath}/reader/home">Reader</a>
|
||||
<c:if test="${sessionScope.userRole == 'reader'}">
|
||||
<a href="${pageContext.request.contextPath}/reader/loans">My Loans</a>
|
||||
</c:if>
|
||||
<span class="user-pill">
|
||||
<c:out value="${sessionScope.authenticatedUser.displayName}" />
|
||||
</span>
|
||||
|
||||
@@ -46,6 +46,12 @@
|
||||
<p>Create, update, deactivate, and review reader eligibility records.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/readers">Open</a>
|
||||
</article>
|
||||
|
||||
<article class="workspace-card">
|
||||
<h2>Borrowing Management</h2>
|
||||
<p>Create loans, process returns, renew active records, and review overdue items.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/borrowing">Open</a>
|
||||
</article>
|
||||
</c:if>
|
||||
|
||||
<article class="workspace-card">
|
||||
@@ -56,9 +62,17 @@
|
||||
|
||||
<article class="workspace-card">
|
||||
<h2>Reader Center</h2>
|
||||
<p>Reader self-service entry point.</p>
|
||||
<p>Reader self-service entry point for catalog access and loan history.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/reader/home">Open</a>
|
||||
</article>
|
||||
|
||||
<c:if test="${sessionScope.userRole == 'reader'}">
|
||||
<article class="workspace-card">
|
||||
<h2>My Loan History</h2>
|
||||
<p>Review your active, returned, and overdue borrowing records.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/reader/loans">Open</a>
|
||||
</article>
|
||||
</c:if>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Loan History - MZH Library</title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/app.css">
|
||||
</head>
|
||||
<body>
|
||||
<%@ include file="/WEB-INF/jsp/common/header.jspf" %>
|
||||
<main class="page-shell">
|
||||
<section class="dashboard-hero catalog-hero" aria-labelledby="loan-history-title">
|
||||
<div>
|
||||
<p class="eyebrow">Reader Center</p>
|
||||
<h1 id="loan-history-title">Loan history</h1>
|
||||
<p>Review your active, returned, and overdue borrowing records.</p>
|
||||
</div>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/catalog">Search catalog</a>
|
||||
</section>
|
||||
|
||||
<c:if test="${not empty successMessage}">
|
||||
<div class="message message-success" role="status">
|
||||
<c:out value="${successMessage}" />
|
||||
</div>
|
||||
</c:if>
|
||||
<c:if test="${not empty errorMessage}">
|
||||
<div class="message message-error" role="alert">
|
||||
<c:out value="${errorMessage}" />
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<section class="table-panel" aria-labelledby="loan-results-title">
|
||||
<h2 id="loan-results-title">Borrowing records</h2>
|
||||
<c:choose>
|
||||
<c:when test="${empty borrowRecords}">
|
||||
<p class="empty-state">No borrowing records are available for this account.</p>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="table-scroll">
|
||||
<table class="data-table borrowing-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Book ID</th>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Borrowed</th>
|
||||
<th scope="col">Due</th>
|
||||
<th scope="col">Returned</th>
|
||||
<th scope="col">Renewals</th>
|
||||
<th scope="col">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="record" items="${borrowRecords}">
|
||||
<tr>
|
||||
<td><c:out value="${record.bookIdentifier}" /></td>
|
||||
<td><c:out value="${record.bookTitle}" /></td>
|
||||
<td><c:out value="${record.borrowedAtText}" /></td>
|
||||
<td><c:out value="${record.dueAtText}" /></td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${not empty record.returnedAtText}">
|
||||
<c:out value="${record.returnedAtText}" />
|
||||
</c:when>
|
||||
<c:otherwise>Not returned</c:otherwise>
|
||||
</c:choose>
|
||||
</td>
|
||||
<td><c:out value="${record.renewalCount}" /></td>
|
||||
<td>
|
||||
<span class="status-pill status-${record.displayStatusCode}">
|
||||
<c:out value="${record.displayStatusName}" />
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -39,6 +39,20 @@
|
||||
<p>Create, update, deactivate, and review eligibility fields for reader records.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/readers">Manage readers</a>
|
||||
</article>
|
||||
|
||||
<article class="workspace-card">
|
||||
<h2>Borrowing Management</h2>
|
||||
<p>Create loans, process returns, renew records, and review overdue items.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/borrowing">Manage borrowing</a>
|
||||
</article>
|
||||
</c:if>
|
||||
|
||||
<c:if test="${sessionScope.userRole == 'reader'}">
|
||||
<article class="workspace-card">
|
||||
<h2>My Loan History</h2>
|
||||
<p>Review active loans, returned records, renewal counts, and overdue status.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/reader/loans">View history</a>
|
||||
</article>
|
||||
</c:if>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@@ -110,6 +110,28 @@
|
||||
<url-pattern>/readers/delete</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>BorrowingManagementServlet</servlet-name>
|
||||
<servlet-class>com.mzh.library.controller.BorrowingManagementServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>BorrowingManagementServlet</servlet-name>
|
||||
<url-pattern>/borrowing</url-pattern>
|
||||
<url-pattern>/borrowing/new</url-pattern>
|
||||
<url-pattern>/borrowing/create</url-pattern>
|
||||
<url-pattern>/borrowing/return</url-pattern>
|
||||
<url-pattern>/borrowing/renew</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>ReaderLoanHistoryServlet</servlet-name>
|
||||
<servlet-class>com.mzh.library.controller.ReaderLoanHistoryServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>ReaderLoanHistoryServlet</servlet-name>
|
||||
<url-pattern>/reader/loans</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>UnauthorizedServlet</servlet-name>
|
||||
<servlet-class>com.mzh.library.controller.UnauthorizedServlet</servlet-class>
|
||||
|
||||
@@ -289,6 +289,10 @@ h2 {
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
.borrowing-search-form {
|
||||
grid-template-columns: repeat(3, minmax(120px, 1fr)) auto auto;
|
||||
}
|
||||
|
||||
.search-field {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
@@ -305,7 +309,8 @@ h2 {
|
||||
.book-form input,
|
||||
.book-form select,
|
||||
.reader-form input,
|
||||
.reader-form select {
|
||||
.reader-form select,
|
||||
.borrow-form input {
|
||||
width: 100%;
|
||||
min-height: 42px;
|
||||
padding: 9px 11px;
|
||||
@@ -320,7 +325,8 @@ h2 {
|
||||
.book-form input:focus,
|
||||
.book-form select:focus,
|
||||
.reader-form input:focus,
|
||||
.reader-form select:focus {
|
||||
.reader-form select:focus,
|
||||
.borrow-form input:focus {
|
||||
outline: 3px solid rgba(37, 111, 108, 0.18);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
@@ -337,6 +343,10 @@ h2 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.borrowing-table {
|
||||
min-width: 980px;
|
||||
}
|
||||
|
||||
.data-table th,
|
||||
.data-table td {
|
||||
padding: 12px 10px;
|
||||
@@ -397,6 +407,21 @@ h2 {
|
||||
background: #eef1f5;
|
||||
}
|
||||
|
||||
.status-returned {
|
||||
color: var(--color-muted);
|
||||
background: #eef1f5;
|
||||
}
|
||||
|
||||
.status-overdue {
|
||||
color: #7a211a;
|
||||
background: #fff0ee;
|
||||
}
|
||||
|
||||
.muted-text {
|
||||
color: var(--color-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
@@ -413,7 +438,8 @@ h2 {
|
||||
}
|
||||
|
||||
.book-form,
|
||||
.reader-form {
|
||||
.reader-form,
|
||||
.borrow-form {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user