{% extends 'base.html' %}

{% block title %}通知详情 - 图书管理系统{% endblock %}

{% block head %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Nunito+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{{ url_for('static', filename='css/notification_detail.css') }}">
{% endblock %}

{% block content %}
<div class="notification-detail-container">
    <div class="notification-card {% if notification.status == 0 %}unread{% endif %}" data-id="{{ notification.id }}">
        <div class="notification-header">
            <div class="notification-meta-top">
                <span class="notification-type">{{ notification.type }}</span>
                <span class="notification-status">
                    {% if notification.status == 0 %}
                        <span class="unread-badge">未读</span>
                    {% else %}
                        <span class="read-badge">已读</span>
                    {% endif %}
                </span>
            </div>
            <h1 class="notification-title">{{ notification.title }}</h1>
            <div class="notification-time">
                <i class="far fa-clock"></i> {{ notification.created_at.strftime('%Y-%m-%d %H:%M') }}
            </div>
        </div>

        <div class="notification-content">
            <div class="notification-body">
                {{ notification.content|safe }}
            </div>
        </div>

        <div class="notification-footer">
            <a href="{{ url_for('announcement.user_notifications') }}" class="btn btn-back">
                <i class="fas fa-arrow-left"></i> 返回通知列表
            </a>

            {% if notification.status == 0 %}
                <button class="btn btn-mark-read" id="markAsReadBtn">
                    <i class="fas fa-check"></i> 标记为已读
                </button>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}

{% block scripts %}
<script src="{{ url_for('static', filename='js/notification_detail.js') }}"></script>
{% endblock %}
