init backend presensi
This commit is contained in:
3
app/Views/partials/footer.php
Normal file
3
app/Views/partials/footer.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<footer class="py-3 px-6 border-t border-gray-200 dark:border-gray-700 text-center text-sm text-gray-500 dark:text-gray-400">
|
||||
© <?= date('Y') ?> SMAN 1 Garut. All rights reserved.
|
||||
</footer>
|
||||
19
app/Views/partials/header.php
Normal file
19
app/Views/partials/header.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<header class="sticky top-0 z-30 flex items-center justify-between h-16 px-6 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 shadow-sm">
|
||||
<div class="flex items-center gap-4">
|
||||
<button type="button" id="sidebar-toggle" class="lg:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700" aria-label="Toggle sidebar">
|
||||
<i class="bx bx-menu text-2xl"></i>
|
||||
</button>
|
||||
<h1 class="text-lg font-semibold hidden sm:block">Dashboard</h1>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<?php if (!empty($user)): ?>
|
||||
<span class="text-sm text-gray-600 dark:text-gray-400"><?= esc($user['name']) ?></span>
|
||||
<form id="logout-form" method="post" action="<?= base_url('logout') ?>" class="inline">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-white bg-primary rounded-lg hover:opacity-90 focus:ring-2 focus:ring-primary/20">
|
||||
<i class="bx bx-log-out"></i> Logout
|
||||
</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
20
app/Views/partials/scripts.php
Normal file
20
app/Views/partials/scripts.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var sidebar = document.getElementById('sidebar');
|
||||
var toggle = document.getElementById('sidebar-toggle');
|
||||
var backdrop = document.getElementById('sidebar-backdrop');
|
||||
if (toggle && sidebar) {
|
||||
toggle.addEventListener('click', function() {
|
||||
sidebar.classList.toggle('-translate-x-full');
|
||||
if (backdrop) backdrop.classList.toggle('hidden');
|
||||
});
|
||||
}
|
||||
if (backdrop && sidebar) {
|
||||
backdrop.addEventListener('click', function() {
|
||||
sidebar.classList.add('-translate-x-full');
|
||||
backdrop.classList.add('hidden');
|
||||
});
|
||||
}
|
||||
// Logout form submits normally (POST to /logout, then redirect by server)
|
||||
});
|
||||
</script>
|
||||
63
app/Views/partials/sidebar.php
Normal file
63
app/Views/partials/sidebar.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
$user = $user ?? null;
|
||||
$currentUri = $current_uri ?? '';
|
||||
$roleCodes = $user && !empty($user['roles']) ? array_column($user['roles'], 'role_code') : [];
|
||||
$isAdmin = in_array('ADMIN', $roleCodes, true);
|
||||
$isParent = in_array('ORANG_TUA', $roleCodes, true);
|
||||
|
||||
$navClassActive = 'flex items-center gap-3 px-4 py-3 rounded-lg bg-primary/10 text-primary font-medium';
|
||||
$navClassInactive = 'flex items-center gap-3 px-4 py-3 rounded-lg text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700';
|
||||
|
||||
function nav_is_active(string $currentUri, string $path, bool $exact = true): bool {
|
||||
if ($exact) {
|
||||
return $currentUri === $path;
|
||||
}
|
||||
return $currentUri === $path || strpos($currentUri, $path . '/') === 0;
|
||||
}
|
||||
?>
|
||||
<aside id="sidebar" class="w-64 min-h-screen bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 transform -translate-x-full lg:translate-x-0 transition-transform duration-200 fixed lg:static inset-y-0 left-0 z-40">
|
||||
<div class="flex flex-col h-full">
|
||||
<div class="flex items-center h-16 px-6 border-b border-gray-200 dark:border-gray-700">
|
||||
<a href="<?= base_url('dashboard') ?>" class="text-xl font-bold text-primary dark:text-primary-400">SMAN 1 Garut</a>
|
||||
</div>
|
||||
<nav class="flex-1 p-4 space-y-1 overflow-y-auto">
|
||||
<a href="<?= base_url('dashboard') ?>" class="<?= nav_is_active($currentUri, 'dashboard') ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-home-alt text-xl"></i>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
<a href="<?= base_url('dashboard/schedule/today') ?>" class="<?= nav_is_active($currentUri, 'dashboard/schedule/today') ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-calendar text-xl"></i>
|
||||
<span>Jadwal Hari Ini</span>
|
||||
</a>
|
||||
<a href="<?= base_url('dashboard/attendance/reports') ?>" class="<?= nav_is_active($currentUri, 'dashboard/attendance/reports') ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-calendar-check text-xl"></i>
|
||||
<span>Laporan Absensi</span>
|
||||
</a>
|
||||
<a href="<?= base_url('dashboard/discipline') ?>" class="<?= nav_is_active($currentUri, 'dashboard/discipline') ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-error-alt text-xl"></i>
|
||||
<span>Poin Pelanggaran</span>
|
||||
</a>
|
||||
<?php if ($isParent): ?>
|
||||
<a href="<?= base_url('dashboard/parent') ?>" class="<?= nav_is_active($currentUri, 'dashboard/parent') ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-user-circle text-xl"></i>
|
||||
<span>Portal Orang Tua</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($isAdmin): ?>
|
||||
<a href="<?= base_url('dashboard/presence-settings') ?>" class="<?= nav_is_active($currentUri, 'dashboard/presence-settings') ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-map-pin text-xl"></i>
|
||||
<span>Pengaturan Presensi</span>
|
||||
</a>
|
||||
<a href="<?= base_url('dashboard/academic/settings') ?>" class="<?= nav_is_active($currentUri, 'dashboard/academic', false) ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-cog text-xl"></i>
|
||||
<span>Pengaturan Academic</span>
|
||||
</a>
|
||||
<a href="<?= base_url('dashboard/devices') ?>" class="<?= nav_is_active($currentUri, 'dashboard/devices') ? $navClassActive : $navClassInactive ?>">
|
||||
<i class="bx bx-devices text-xl"></i>
|
||||
<span>Device Absen</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
</div>
|
||||
</aside>
|
||||
<div id="sidebar-backdrop" class="fixed inset-0 bg-black/50 z-30 lg:hidden hidden" aria-hidden="true"></div>
|
||||
Reference in New Issue
Block a user