80 lines
8.7 KiB
PHP
80 lines
8.7 KiB
PHP
<?php
|
|
// กำหนดหน้าปัจจุบันเพื่อทำ Active State ใน Sidebar
|
|
$currentPage = basename($_SERVER['PHP_SELF']);
|
|
?>
|
|
<aside :class="isExpanded ? 'w-64' : 'w-20'" class="glass-card hidden sm:flex flex-col m-4 mr-0 rounded-[16px] z-20 transition-all duration-300 ease-in-out border-slate-200 dark:border-slate-700/50">
|
|
<!-- Logo area -->
|
|
<div class="h-20 flex items-center justify-center border-b border-slate-200 dark:border-slate-700/50 px-4 shrink-0">
|
|
<img src="public/images/logo.png" alt="Logo" class="w-10 h-10 rounded-full flex-shrink-0 bg-white">
|
|
<span x-show="isExpanded" x-transition.opacity.duration.300ms class="ml-3 font-semibold text-lg truncate dark:text-white">รพ.เกาะสมุย</span>
|
|
</div>
|
|
|
|
<!-- Menu -->
|
|
<nav class="flex-1 overflow-y-auto py-4 space-y-2 px-3 custom-scrollbar">
|
|
<!-- หน้าหลัก (ภาพรวม) -->
|
|
<a href="index.php" class="flex items-center px-3 py-3 rounded-lg group transition-colors <?= $currentPage === 'index.php' ? 'text-primary-600 bg-primary-50 dark:bg-primary-900/20' : 'text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-solid fa-chart-pie w-6 text-center text-lg <?= $currentPage !== 'index.php' ? 'group-hover:text-primary-500 transition-colors' : '' ?>"></i>
|
|
<span x-show="isExpanded" class="ml-3 font-medium <?= $currentPage !== 'index.php' ? 'group-hover:text-slate-900 dark:group-hover:text-white transition-colors' : '' ?>">ภาพรวม</span>
|
|
</a>
|
|
|
|
<!-- ยานพาหนะ -->
|
|
<a href="vehicles.php" class="flex items-center px-3 py-3 rounded-lg group transition-colors <?= $currentPage === 'vehicles.php' ? 'text-primary-600 bg-primary-50 dark:bg-primary-900/20' : 'text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-solid fa-car w-6 text-center text-lg <?= $currentPage !== 'vehicles.php' ? 'group-hover:text-primary-500 transition-colors' : '' ?>"></i>
|
|
<span x-show="isExpanded" class="ml-3 font-medium <?= $currentPage !== 'vehicles.php' ? 'group-hover:text-slate-900 dark:group-hover:text-white transition-colors' : '' ?>">ยานพาหนะ</span>
|
|
</a>
|
|
|
|
<!-- พนักงานขับรถ -->
|
|
<a href="drivers.php" class="flex items-center px-3 py-3 rounded-lg group transition-colors <?= $currentPage === 'drivers.php' ? 'text-primary-600 bg-primary-50 dark:bg-primary-900/20' : 'text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-solid fa-id-card w-6 text-center text-lg <?= $currentPage !== 'drivers.php' ? 'group-hover:text-primary-500 transition-colors' : '' ?>"></i>
|
|
<span x-show="isExpanded" class="ml-3 font-medium <?= $currentPage !== 'drivers.php' ? 'group-hover:text-slate-900 dark:group-hover:text-white transition-colors' : '' ?>">พนักงานขับรถ</span>
|
|
</a>
|
|
|
|
<!-- ตารางการเดินรถ -->
|
|
<a href="schedule.php" class="flex items-center px-3 py-3 rounded-lg group transition-colors <?= $currentPage === 'schedule.php' ? 'text-primary-600 bg-primary-50 dark:bg-primary-900/20' : 'text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-regular fa-calendar-check w-6 text-center text-lg <?= $currentPage !== 'schedule.php' ? 'group-hover:text-primary-500 transition-colors' : '' ?>"></i>
|
|
<span x-show="isExpanded" class="ml-3 font-medium <?= $currentPage !== 'schedule.php' ? 'group-hover:text-slate-900 dark:group-hover:text-white transition-colors' : '' ?>">ตารางการเดินรถ</span>
|
|
</a>
|
|
|
|
<?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin'): ?>
|
|
<!-- หมวดหมู่การตั้งค่าระบบ -->
|
|
<div x-data="{ settingsOpen: <?= in_array($currentPage, ['users.php', 'settings_notifications.php', 'logs.php']) ? 'true' : 'false' ?> }">
|
|
<button @click="settingsOpen = !settingsOpen; if(!isExpanded) toggleSidebar()"
|
|
class="w-full flex items-center justify-between px-3 py-3 rounded-lg group transition-colors <?= in_array($currentPage, ['users.php', 'settings_notifications.php', 'logs.php']) ? 'text-primary-600 bg-primary-50 dark:bg-primary-900/20' : 'text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800/50' ?>">
|
|
<div class="flex items-center">
|
|
<i class="fa-solid fa-gear w-6 text-center text-lg <?= !in_array($currentPage, ['users.php', 'settings_notifications.php', 'logs.php']) ? 'group-hover:text-primary-500 transition-colors' : '' ?>"></i>
|
|
<span x-show="isExpanded" class="ml-3 font-medium <?= !in_array($currentPage, ['users.php', 'settings_notifications.php', 'logs.php']) ? 'group-hover:text-slate-900 dark:group-hover:text-white transition-colors' : '' ?>">ตั้งค่าระบบ</span>
|
|
</div>
|
|
<i x-show="isExpanded" class="fa-solid fa-chevron-down text-xs transition-transform duration-300" :class="settingsOpen ? 'rotate-180' : ''"></i>
|
|
</button>
|
|
|
|
<!-- เมนูย่อย -->
|
|
<div x-show="isExpanded && settingsOpen" x-transition.opacity class="pl-11 pr-3 py-2 space-y-1">
|
|
<a href="users.php" class="block px-3 py-2 rounded-lg text-sm transition-colors <?= $currentPage === 'users.php' ? 'text-primary-600 font-medium bg-primary-50 dark:bg-primary-900/20' : 'text-slate-500 dark:text-slate-400 hover:text-slate-900 hover:bg-slate-50 dark:hover:text-white dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-solid fa-users-gear mr-2 w-4"></i> ตั้งค่าผู้ใช้งาน
|
|
</a>
|
|
<a href="settings_notifications.php" class="block px-3 py-2 rounded-lg text-sm transition-colors <?= $currentPage === 'settings_notifications.php' ? 'text-primary-600 font-medium bg-primary-50 dark:bg-primary-900/20' : 'text-slate-500 dark:text-slate-400 hover:text-slate-900 hover:bg-slate-50 dark:hover:text-white dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-solid fa-bell mr-2 w-4"></i> การแจ้งเตือน
|
|
</a>
|
|
<a href="logs.php" class="block px-3 py-2 rounded-lg text-sm transition-colors <?= $currentPage === 'logs.php' ? 'text-primary-600 font-medium bg-primary-50 dark:bg-primary-900/20' : 'text-slate-500 dark:text-slate-400 hover:text-slate-900 hover:bg-slate-50 dark:hover:text-white dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-solid fa-list-check mr-2 w-4"></i> ประวัติการใช้งาน
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- คู่มือการใช้งาน -->
|
|
<a href="manual.php" class="flex items-center px-3 py-3 rounded-lg group transition-colors <?= $currentPage === 'manual.php' ? 'text-primary-600 bg-primary-50 dark:bg-primary-900/20' : 'text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800/50' ?>">
|
|
<i class="fa-solid fa-book w-6 text-center text-lg <?= $currentPage !== 'manual.php' ? 'group-hover:text-primary-500 transition-colors' : '' ?>"></i>
|
|
<span x-show="isExpanded" class="ml-3 font-medium <?= $currentPage !== 'manual.php' ? 'group-hover:text-slate-900 dark:group-hover:text-white transition-colors' : '' ?>">คู่มือการใช้งาน</span>
|
|
</a>
|
|
</nav>
|
|
|
|
<!-- Bottom Actions -->
|
|
<div class="p-4 border-t border-slate-200 dark:border-slate-700/50 shrink-0">
|
|
<a href="logout.php" class="flex items-center px-3 py-2 text-danger hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors">
|
|
<i class="fa-solid fa-arrow-right-from-bracket w-6 text-center text-lg"></i>
|
|
<span x-show="isExpanded" class="ml-3 font-medium">ออกจากระบบ</span>
|
|
</a>
|
|
</div>
|
|
</aside>
|