<?php
$pageTitle = 'Thông báo - PET SPA'; $pageStyles = ['owner.css']; $activeOwnerPage = 'notifications';
require BASE_PATH . '/app/views/layouts/header.php'; require BASE_PATH . '/app/views/layouts/navbar.php';
?>
<main class="owner-area"><div class="container-fluid"><div class="row g-4"><div class="col-xl-2 col-lg-3"><?php require BASE_PATH . '/app/views/layouts/owner-sidebar.php'; ?></div><section class="col-xl-10 col-lg-9"><div class="owner-page-header d-flex justify-content-between align-items-center"><div><h1>Thông báo</h1><p>Cập nhật mới từ khách hàng và lịch hẹn.</p></div><form method="post" action="<?= BASE_URL ?>/?url=owner/notifications/read-all"><input type="hidden" name="_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>"><button class="btn btn-outline-secondary">Đánh dấu đã đọc</button></form></div><div class="owner-card p-0 overflow-hidden"><?php foreach ($notifications as $notification): ?><form method="post" action="<?= BASE_URL ?>/?url=owner/notification/read" class="p-3 border-bottom <?= $notification['is_read'] ? '' : 'bg-light' ?>"><input type="hidden" name="_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>"><input type="hidden" name="notification_id" value="<?= (int) $notification['id'] ?>"><button class="btn btn-link text-start p-0 text-decoration-none w-100"><strong><?= htmlspecialchars($notification['title']) ?></strong><div class="text-muted small"><?= htmlspecialchars($notification['message']) ?></div><small class="text-muted"><?= htmlspecialchars($notification['created_at']) ?></small></button></form><?php endforeach; ?><?php if (!$notifications): ?><p class="p-4 mb-0 text-muted">Chưa có thông báo.</p><?php endif; ?></div></section></div></div></main>
<?php require BASE_PATH . '/app/views/layouts/footer.php'; ?>
