做读者档案、联系方式、借阅资格功能
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<c:if test="${sessionScope.userRole == 'administrator' or sessionScope.userRole == 'librarian'}">
|
||||
<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>
|
||||
</c:if>
|
||||
<a href="${pageContext.request.contextPath}/reader/home">Reader</a>
|
||||
<span class="user-pill">
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
<p>Create, update, delete, and review book inventory records.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">Open</a>
|
||||
</article>
|
||||
|
||||
<article class="workspace-card">
|
||||
<h2>Reader Management</h2>
|
||||
<p>Create, update, deactivate, and review reader eligibility records.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/readers">Open</a>
|
||||
</article>
|
||||
</c:if>
|
||||
|
||||
<article class="workspace-card">
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
<%@ 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><c:out value="${formTitle}" /> - 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="reader-form-title">
|
||||
<p class="eyebrow">Reader Management</p>
|
||||
<h1 id="reader-form-title"><c:out value="${formTitle}" /></h1>
|
||||
|
||||
<c:if test="${not empty errorMessage}">
|
||||
<div class="message message-error" role="alert">
|
||||
<c:out value="${errorMessage}" />
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<c:set var="hasFormValues" value="${not empty formValues}" />
|
||||
<c:set var="identifierValue" value="${hasFormValues ? formValues.identifier : reader.identifier}" />
|
||||
<c:set var="userIdValue" value="${hasFormValues ? formValues.userId : reader.userId}" />
|
||||
<c:set var="fullNameValue" value="${hasFormValues ? formValues.fullName : reader.fullName}" />
|
||||
<c:set var="phoneValue" value="${hasFormValues ? formValues.phone : reader.phone}" />
|
||||
<c:set var="emailValue" value="${hasFormValues ? formValues.email : reader.email}" />
|
||||
<c:set var="statusValue" value="${hasFormValues ? formValues.status : reader.status.code}" />
|
||||
<c:set var="maxBorrowCountValue" value="${hasFormValues ? formValues.maxBorrowCount : reader.maxBorrowCount}" />
|
||||
|
||||
<form class="reader-form" action="${pageContext.request.contextPath}${formAction}" method="post" novalidate>
|
||||
<c:if test="${reader.id > 0}">
|
||||
<input type="hidden" name="id" value="${reader.id}">
|
||||
</c:if>
|
||||
|
||||
<div class="form-grid">
|
||||
<div class="form-field">
|
||||
<label for="identifier">Reader ID</label>
|
||||
<input id="identifier" name="identifier" type="text" value="${fn:escapeXml(identifierValue)}" required>
|
||||
<c:if test="${not empty errors.identifier}">
|
||||
<span class="field-error"><c:out value="${errors.identifier}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="fullName">Full name</label>
|
||||
<input id="fullName" name="fullName" type="text" value="${fn:escapeXml(fullNameValue)}" required>
|
||||
<c:if test="${not empty errors.fullName}">
|
||||
<span class="field-error"><c:out value="${errors.fullName}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="phone">Phone</label>
|
||||
<input id="phone" name="phone" type="tel" value="${fn:escapeXml(phoneValue)}">
|
||||
<c:if test="${not empty errors.phone}">
|
||||
<span class="field-error"><c:out value="${errors.phone}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="email">Email</label>
|
||||
<input id="email" name="email" type="email" value="${fn:escapeXml(emailValue)}">
|
||||
<c:if test="${not empty errors.email}">
|
||||
<span class="field-error"><c:out value="${errors.email}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="userId">Linked account ID</label>
|
||||
<input id="userId" name="userId" type="number" min="1" value="${fn:escapeXml(userIdValue)}">
|
||||
<c:if test="${not empty errors.userId}">
|
||||
<span class="field-error"><c:out value="${errors.userId}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="maxBorrowCount">Max borrow count</label>
|
||||
<input id="maxBorrowCount" name="maxBorrowCount" type="number" min="1" max="50"
|
||||
value="${fn:escapeXml(maxBorrowCountValue)}" required>
|
||||
<c:if test="${not empty errors.maxBorrowCount}">
|
||||
<span class="field-error"><c:out value="${errors.maxBorrowCount}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="status">Status</label>
|
||||
<select id="status" name="status" required>
|
||||
<option value="">Select status</option>
|
||||
<c:forEach var="status" items="${statuses}">
|
||||
<option value="${status.code}" <c:if test="${statusValue == status.code}">selected</c:if>>
|
||||
<c:out value="${status.displayName}" />
|
||||
</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
<c:if test="${not empty errors.status}">
|
||||
<span class="field-error"><c:out value="${errors.status}" /></span>
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="button button-primary" type="submit">Save</button>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/readers">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,139 @@
|
||||
<%@ 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>Manage Readers - 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="manage-readers-title">
|
||||
<p class="eyebrow">Reader Management</p>
|
||||
<h1 id="manage-readers-title">Manage readers</h1>
|
||||
<p>Create, update, and review reader eligibility and contact records.</p>
|
||||
<a class="button button-primary" href="${pageContext.request.contextPath}/readers/new">New reader</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="Reader management search">
|
||||
<form class="search-form" action="${pageContext.request.contextPath}/readers" method="get">
|
||||
<div class="search-field">
|
||||
<label for="identifier">Reader ID</label>
|
||||
<input id="identifier" name="identifier" type="text" value="${fn:escapeXml(criteria.identifier)}">
|
||||
</div>
|
||||
|
||||
<div class="search-field">
|
||||
<label for="name">Name</label>
|
||||
<input id="name" name="name" type="text" value="${fn:escapeXml(criteria.name)}">
|
||||
</div>
|
||||
|
||||
<div class="search-field">
|
||||
<label for="contact">Phone or email</label>
|
||||
<input id="contact" name="contact" type="text" value="${fn:escapeXml(criteria.contact)}">
|
||||
</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>
|
||||
</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}/readers">Clear</a>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="table-panel" aria-labelledby="reader-results-title">
|
||||
<h2 id="reader-results-title">Reader records</h2>
|
||||
<c:choose>
|
||||
<c:when test="${empty readers}">
|
||||
<p class="empty-state">No reader records match the current filters.</p>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="table-scroll">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Reader ID</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Contact</th>
|
||||
<th scope="col">Account</th>
|
||||
<th scope="col">Borrow limit</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="reader" items="${readers}">
|
||||
<tr>
|
||||
<td><c:out value="${reader.identifier}" /></td>
|
||||
<td><c:out value="${reader.fullName}" /></td>
|
||||
<td>
|
||||
<c:if test="${not empty reader.phone}">
|
||||
<div><c:out value="${reader.phone}" /></div>
|
||||
</c:if>
|
||||
<c:if test="${not empty reader.email}">
|
||||
<div><c:out value="${reader.email}" /></div>
|
||||
</c:if>
|
||||
</td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${not empty reader.username}">
|
||||
<c:out value="${reader.username}" />
|
||||
</c:when>
|
||||
<c:otherwise>Unlinked</c:otherwise>
|
||||
</c:choose>
|
||||
</td>
|
||||
<td><c:out value="${reader.maxBorrowCount}" /></td>
|
||||
<td>
|
||||
<span class="status-pill status-${reader.status.code}">
|
||||
<c:out value="${reader.status.displayName}" />
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="table-actions">
|
||||
<a class="button button-secondary"
|
||||
href="${pageContext.request.contextPath}/readers/edit?id=${reader.id}">Edit</a>
|
||||
<form action="${pageContext.request.contextPath}/readers/delete"
|
||||
method="post"
|
||||
onsubmit="return confirm('Deactivate this reader profile?');">
|
||||
<input type="hidden" name="id" value="${reader.id}">
|
||||
<button class="button button-danger" type="submit">Deactivate</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -33,6 +33,12 @@
|
||||
<p>Create, update, delete, and review inventory fields for book records.</p>
|
||||
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">Manage books</a>
|
||||
</article>
|
||||
|
||||
<article class="workspace-card">
|
||||
<h2>Reader Management</h2>
|
||||
<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>
|
||||
</c:if>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@@ -97,6 +97,19 @@
|
||||
<url-pattern>/books/delete</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>ReaderManagementServlet</servlet-name>
|
||||
<servlet-class>com.mzh.library.controller.ReaderManagementServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>ReaderManagementServlet</servlet-name>
|
||||
<url-pattern>/readers</url-pattern>
|
||||
<url-pattern>/readers/new</url-pattern>
|
||||
<url-pattern>/readers/edit</url-pattern>
|
||||
<url-pattern>/readers/update</url-pattern>
|
||||
<url-pattern>/readers/delete</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>UnauthorizedServlet</servlet-name>
|
||||
<servlet-class>com.mzh.library.controller.UnauthorizedServlet</servlet-class>
|
||||
|
||||
@@ -303,7 +303,9 @@ h2 {
|
||||
.search-form input,
|
||||
.search-form select,
|
||||
.book-form input,
|
||||
.book-form select {
|
||||
.book-form select,
|
||||
.reader-form input,
|
||||
.reader-form select {
|
||||
width: 100%;
|
||||
min-height: 42px;
|
||||
padding: 9px 11px;
|
||||
@@ -316,7 +318,9 @@ h2 {
|
||||
.search-form input:focus,
|
||||
.search-form select:focus,
|
||||
.book-form input:focus,
|
||||
.book-form select:focus {
|
||||
.book-form select:focus,
|
||||
.reader-form input:focus,
|
||||
.reader-form select:focus {
|
||||
outline: 3px solid rgba(37, 111, 108, 0.18);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
@@ -378,6 +382,21 @@ h2 {
|
||||
background: #eef1f5;
|
||||
}
|
||||
|
||||
.status-active {
|
||||
color: var(--color-success);
|
||||
background: #edf8ef;
|
||||
}
|
||||
|
||||
.status-suspended {
|
||||
color: var(--color-warning);
|
||||
background: #fff7e5;
|
||||
}
|
||||
|
||||
.status-inactive {
|
||||
color: var(--color-muted);
|
||||
background: #eef1f5;
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
@@ -393,7 +412,8 @@ h2 {
|
||||
max-width: 860px;
|
||||
}
|
||||
|
||||
.book-form {
|
||||
.book-form,
|
||||
.reader-form {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user