<%@ 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="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><c:out value="${areaName}" /> - MZH 图书馆</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/app.css?v=20260428-visual-shell">
</head>
<body>
<%@ include file="/WEB-INF/jsp/common/header.jspf" %>
<main class="page-shell">
    <section class="notice-panel" aria-labelledby="area-title">
        <p class="eyebrow">
            <c:out value="${sessionScope.authenticatedUser.role.displayName}" />
        </p>
        <h1 id="area-title"><c:out value="${areaName}" /></h1>
        <p><c:out value="${areaSummary}" /></p>
        <a class="button button-primary" href="${pageContext.request.contextPath}/dashboard">返回控制台</a>
    </section>

    <section class="card-grid role-actions" aria-label="工作区操作">
        <article class="workspace-card">
            <h2>馆藏检索</h2>
            <p>按书名、作者、分类或图书编号检索可用馆藏记录。</p>
            <a class="button button-secondary" href="${pageContext.request.contextPath}/catalog">检索馆藏</a>
        </article>

        <c:if test="${sessionScope.userRole == 'administrator' or sessionScope.userRole == 'librarian'}">
            <c:if test="${sessionScope.userRole == 'administrator'}">
                <article class="workspace-card">
                    <h2>用户管理</h2>
                    <p>创建、更新、停用和查看登录账户。</p>
                    <a class="button button-secondary" href="${pageContext.request.contextPath}/admin/users">管理用户</a>
                </article>

                <article class="workspace-card">
                    <h2>系统日志</h2>
                    <p>查看账户与维护操作的只读审计记录。</p>
                    <a class="button button-secondary" href="${pageContext.request.contextPath}/admin/system-logs">查看日志</a>
                </article>
            </c:if>

            <article class="workspace-card">
                <h2>图书管理</h2>
                <p>创建、更新、删除和查看图书记录的库存字段。</p>
                <a class="button button-secondary" href="${pageContext.request.contextPath}/books">管理图书</a>
            </article>

            <article class="workspace-card">
                <h2>分类维护</h2>
                <p>创建、更新和停用图书记录使用的馆藏分类。</p>
                <a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">管理分类</a>
            </article>

            <article class="workspace-card">
                <h2>读者管理</h2>
                <p>创建、更新、停用和查看读者记录的资格字段。</p>
                <a class="button button-secondary" href="${pageContext.request.contextPath}/readers">管理读者</a>
            </article>

            <article class="workspace-card">
                <h2>借阅管理</h2>
                <p>创建借阅、处理归还、续借记录并查看逾期项目。</p>
                <a class="button button-secondary" href="${pageContext.request.contextPath}/borrowing">管理借阅</a>
            </article>

            <article class="workspace-card">
                <h2>报表中心</h2>
                <p>查看库存摘要、借阅状况、逾期列表和热门图书。</p>
                <a class="button button-secondary" href="${pageContext.request.contextPath}/reports">查看报表</a>
            </article>
        </c:if>

        <c:if test="${sessionScope.userRole == 'reader'}">
            <article class="workspace-card">
                <h2>我的借阅历史</h2>
                <p>查看在借记录、已还记录、续借次数和逾期状态。</p>
                <a class="button button-secondary" href="${pageContext.request.contextPath}/reader/loans">查看历史</a>
            </article>
        </c:if>
    </section>
</main>
</body>
</html>
