Files
2026-09-16 23:20:08 +07:00

156 lines
12 KiB
PHP

<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ศูนย์รับแจ้งเหตุและสั่งการนเรนทรอ่าวไทย</title>
<!-- Old System CSS -->
<link rel="stylesheet" href="assets/app.css">
<!-- SweetAlert2 -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Lucide Icons -->
<script src="https://unpkg.com/lucide@latest"></script>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<style>
:root {
--font-sans: 'Sarabun', sans-serif !important;
}
body, * {
font-family: 'Sarabun', sans-serif !important;
}
body {
margin: 0;
padding: 0;
}
.animate-fadeIn { animation: fadeIn 0.3s ease-in-out; }
.animate-slideDown { animation: slideDown 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
/* Custom scrollbar for sidebar */
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
</style>
</head>
<body class="h-screen w-screen bg-slate-50 flex flex-col text-slate-800 antialiased font-sans overflow-hidden">
<?php if(!isLoggedIn()): ?>
<!-- Empty for Login Screen -->
<?php else:
$currentPage = basename($_SERVER['PHP_SELF']);
?>
<!-- Header -->
<header class="bg-white border-b border-slate-200/80 sticky top-0 z-40 shadow-sm transition-all flex-shrink-0" id="app-header">
<div class="px-4 lg:px-6 py-3.5 flex flex-col md:flex-row md:items-center md:justify-between gap-4">
<div class="flex items-center gap-3">
<div class="p-2.5 bg-indigo-600 rounded-xl text-white shadow-md shadow-indigo-100 flex items-center justify-center">
<i data-lucide="activity" class="w-6 h-6"></i>
</div>
<div>
<h1 class="text-lg md:text-xl font-bold text-slate-900 tracking-tight"><?php echo htmlspecialchars(getSetting($pdo, 'system_name', 'ระบบบริหารจัดการ ศูนย์รับแจ้งเหตุและสั่งการนเรนทรอ่าวไทย')); ?></h1>
<p class="text-xs text-slate-400 mt-0.5 font-semibold tracking-wider uppercase">Narenthorn Gulf of Thailand Dispatch & Fleet Command Center</p>
</div>
</div>
<div class="flex flex-wrap items-center gap-2.5 md:gap-4 self-end md:self-auto">
<div class="flex items-center gap-2.5 bg-slate-50 border border-slate-200/60 px-3 py-1.5 rounded-xl text-xs md:text-sm text-slate-600 shadow-xs">
<i data-lucide="clock" class="w-4 h-4 text-indigo-500 animate-pulse"></i>
<span class="font-mono font-bold tracking-wider text-slate-800"><?php echo date('H:i'); ?></span>
<span class="text-slate-300">|</span>
<span class="text-slate-500 font-semibold"><?php echo date('d/m/Y'); ?></span>
<span class="ml-1.5 flex items-center gap-1.5 px-2 py-0.5 rounded-lg border text-xs font-bold text-amber-700 bg-amber-50 border-amber-200/60">
<i data-lucide="sun" class="w-3.5 h-3.5"></i> เวรเช้า
</span>
</div>
<div class="flex items-center gap-2.5 bg-slate-50 border border-slate-200/60 px-3 py-1.5 rounded-xl shadow-xs">
<div class="w-8 h-8 rounded-lg bg-indigo-50 border border-indigo-100 text-indigo-600 flex items-center justify-center font-extrabold text-sm shadow-xs">
<i data-lucide="user" class="w-4 h-4"></i>
</div>
<div class="hidden sm:block text-left">
<div class="text-xs font-bold text-slate-800 truncate max-w-[140px]"><?php echo htmlspecialchars($_SESSION['name']); ?></div>
<div class="flex items-center gap-1 mt-0.5">
<span class="text-[10px] font-bold px-1.5 py-0.5 rounded border uppercase tracking-wider bg-indigo-50 text-indigo-700 border-indigo-200/60"><?php echo htmlspecialchars($_SESSION['role']); ?></span>
</div>
</div>
<a href="logout.php" class="ml-1 p-1.5 text-slate-400 hover:text-rose-600 hover:bg-rose-50 border border-transparent hover:border-rose-100 rounded-lg transition-all cursor-pointer" title="ออกจากระบบ">
<i data-lucide="log-out" class="w-4 h-4"></i>
</a>
</div>
</div>
</div>
</header>
<div class="flex-1 flex flex-col md:flex-row overflow-hidden bg-slate-50">
<!-- Sidebar -->
<aside class="fixed md:static inset-y-0 left-0 w-64 bg-slate-900 text-slate-100 border-r border-slate-800 z-40 transform transition-transform duration-300 flex flex-col h-full -translate-x-full md:translate-x-0" id="app-sidebar">
<div class="p-4 border-b border-slate-800/80">
<div class="text-xs font-bold text-slate-400 tracking-wider uppercase mb-1">เมนูการปฏิบัติงาน</div>
<div class="text-[10px] text-indigo-400 font-bold uppercase tracking-wider">ผู้ใช้งานสิทธิ์: <?php echo htmlspecialchars($_SESSION['role']); ?></div>
</div>
<nav class="flex-1 px-3 py-4 space-y-1.5 overflow-y-auto sidebar-scroll">
<a href="dashboard.php" class="w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'dashboard.php' || $currentPage === 'index.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-900/40 font-bold' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<i data-lucide="phone-call" class="w-4 h-4 <?php echo $currentPage === 'dashboard.php' || $currentPage === 'index.php' ? 'text-white' : 'text-slate-400 group-hover:text-white'; ?>"></i>
<span>รับแจ้งเหตุ</span>
<?php if($currentPage === 'dashboard.php' || $currentPage === 'index.php'): ?><div class="ml-auto w-1.5 h-1.5 bg-white rounded-full"></div><?php endif; ?>
</a>
<a href="incidents.php" class="w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'incidents.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-900/40 font-bold' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<i data-lucide="activity" class="w-4 h-4 <?php echo $currentPage === 'incidents.php' ? 'text-white' : 'text-slate-400 group-hover:text-white'; ?>"></i>
<span>หน้าเคสปฏิบัติการ</span>
<?php if($currentPage === 'incidents.php'): ?><div class="ml-auto w-1.5 h-1.5 bg-white rounded-full"></div><?php endif; ?>
</a>
<a href="daily_report.php" class="w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'daily_report.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-900/40 font-bold' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<i data-lucide="file-text" class="w-4 h-4 <?php echo $currentPage === 'daily_report.php' ? 'text-white' : 'text-slate-400 group-hover:text-white'; ?>"></i>
<span>รายงานประจำวัน</span>
<?php if($currentPage === 'daily_report.php'): ?><div class="ml-auto w-1.5 h-1.5 bg-white rounded-full"></div><?php endif; ?>
</a>
<a href="radio_test.php" class="w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'radio_test.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-900/40 font-bold' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<i data-lucide="radio" class="w-4 h-4 <?php echo $currentPage === 'radio_test.php' ? 'text-white' : 'text-slate-400 group-hover:text-white'; ?>"></i>
<span>ทดสอบวิทยุ</span>
<?php if($currentPage === 'radio_test.php'): ?><div class="ml-auto w-1.5 h-1.5 bg-white rounded-full"></div><?php endif; ?>
</a>
<a href="statistics.php" class="w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'statistics.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-900/40 font-bold' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<i data-lucide="bar-chart-2" class="w-4 h-4 <?php echo $currentPage === 'statistics.php' ? 'text-white' : 'text-slate-400 group-hover:text-white'; ?>"></i>
<span>รายงานสถิติ</span>
<?php if($currentPage === 'statistics.php'): ?><div class="ml-auto w-1.5 h-1.5 bg-white rounded-full"></div><?php endif; ?>
</a>
<a href="dashboard_ems.php" class="w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'dashboard_ems.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-900/40 font-bold' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<i data-lucide="layout-dashboard" class="w-4 h-4 <?php echo $currentPage === 'dashboard_ems.php' ? 'text-white' : 'text-slate-400 group-hover:text-white'; ?>"></i>
<span>Dashboard EMS</span>
<?php if($currentPage === 'dashboard_ems.php'): ?><div class="ml-auto w-1.5 h-1.5 bg-white rounded-full"></div><?php endif; ?>
</a>
<a href="ambulances.php" class="w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'ambulances.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-900/40 font-bold' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<i data-lucide="truck" class="w-4 h-4 <?php echo $currentPage === 'ambulances.php' ? 'text-white' : 'text-slate-400 group-hover:text-white'; ?>"></i>
<span>ความพร้อมรถพยาบาล</span>
<?php if($currentPage === 'ambulances.php'): ?><div class="ml-auto w-1.5 h-1.5 bg-white rounded-full"></div><?php endif; ?>
</a>
<a href="admin.php" class="w-full flex items-center justify-between px-4 py-3 rounded-xl text-sm font-semibold transition-all cursor-pointer <?php echo $currentPage === 'admin.php' ? 'bg-indigo-600 text-white shadow-md shadow-indigo-500/20' : 'text-slate-300 hover:text-white hover:bg-slate-800/70'; ?>">
<div class="flex items-center gap-3">
<i data-lucide="settings" class="w-4 h-4"></i> Admin
</div>
<?php if ($currentPage === 'admin.php'): ?>
<div class="w-1.5 h-1.5 rounded-full bg-white animate-pulse"></div>
<?php endif; ?>
</a>
</nav>
<div class="p-4 border-t border-slate-800 bg-slate-950/40">
<a href="logout.php" class="w-full flex items-center gap-3 px-4 py-3 text-sm font-semibold text-rose-400 hover:text-rose-300 hover:bg-rose-500/10 rounded-xl transition-all cursor-pointer">
<i data-lucide="log-out" class="w-4 h-4"></i>
<span>ออกจากระบบ</span>
</a>
</div>
</aside>
<!-- Main Content Area -->
<main class="flex-1 overflow-y-auto p-4 md:p-6 animate-fadeIn relative">
<?php endif; ?>