notif & sidebar fixed
This commit is contained in:
parent
d554186fc1
commit
3ec452b1fc
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Materi;
|
||||
use App\Models\Tugas;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class NotifikasiController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$since = Carbon::now()->subDays(7);
|
||||
|
||||
// Materi baru dari semua guru
|
||||
$materiBaru = Materi::with(['mengajar.guru', 'mengajar.mapel', 'mengajar.kelas'])
|
||||
->where('created_at', '>=', $since)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get()
|
||||
->map(fn($m) => [
|
||||
'type' => 'materi',
|
||||
'title' => 'Materi Diunggah',
|
||||
'message' => optional($m->mengajar->guru)->nama . ' mengupload: ' . $m->judul_materi,
|
||||
'sub' => optional($m->mengajar->mapel)->nama_mapel . ' · ' . optional($m->mengajar->kelas)->nama_kelas,
|
||||
'time' => $m->created_at->diffForHumans(),
|
||||
'time_raw'=> $m->created_at->toIso8601String(),
|
||||
]);
|
||||
|
||||
// Tugas baru dari semua guru
|
||||
$tugasBaru = Tugas::with(['mengajar.guru', 'mengajar.mapel', 'mengajar.kelas'])
|
||||
->where('created_at', '>=', $since)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get()
|
||||
->map(fn($t) => [
|
||||
'type' => 'tugas',
|
||||
'title' => 'Tugas Dibuat',
|
||||
'message' => optional($t->mengajar->guru)->nama . ' membuat: ' . $t->judul_tugas,
|
||||
'sub' => optional($t->mengajar->mapel)->nama_mapel . ' · ' . optional($t->mengajar->kelas)->nama_kelas,
|
||||
'time' => $t->created_at->diffForHumans(),
|
||||
'time_raw'=> $t->created_at->toIso8601String(),
|
||||
]);
|
||||
|
||||
$notifications = $materiBaru->concat($tugasBaru)
|
||||
->sortByDesc('time_raw')
|
||||
->values();
|
||||
|
||||
return response()->json([
|
||||
'count' => $notifications->count(),
|
||||
'notifications' => $notifications,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Guru;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\PengumpulanTugas;
|
||||
use App\Models\Mengajar;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class NotifikasiController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$guru = Auth::guard('guru')->user();
|
||||
$since = Carbon::now()->subDays(7);
|
||||
|
||||
$idMengajars = Mengajar::where('id_guru', $guru->id_guru)
|
||||
->pluck('id_mengajar');
|
||||
|
||||
// Ambil id_tugas dari mengajar guru ini
|
||||
$idTugas = \App\Models\Tugas::whereIn('id_mengajar', $idMengajars)
|
||||
->pluck('id_tugas');
|
||||
|
||||
// Pengumpulan tugas terbaru
|
||||
$pengumpulan = PengumpulanTugas::with(['siswa', 'tugas.mengajar.mapel'])
|
||||
->whereIn('id_tugas', $idTugas)
|
||||
->where('created_at', '>=', $since)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get()
|
||||
->map(fn($p) => [
|
||||
'type' => 'pengumpulan',
|
||||
'title' => 'Tugas Dikumpulkan',
|
||||
'message' => optional($p->siswa)->nama . ' mengumpulkan: ' . optional($p->tugas)->judul_tugas,
|
||||
'status' => $p->status,
|
||||
'time' => $p->created_at->diffForHumans(),
|
||||
'time_raw'=> $p->created_at->toIso8601String(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'count' => $pengumpulan->count(),
|
||||
'notifications' => $pengumpulan->values(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Siswa;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Materi;
|
||||
use App\Models\Tugas;
|
||||
use App\Models\Mengajar;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class NotifikasiController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$siswa = Auth::guard('siswa')->user();
|
||||
$since = Carbon::now()->subDays(7);
|
||||
|
||||
// ID mengajar untuk kelas siswa ini
|
||||
$idMengajars = Mengajar::where('id_kelas', $siswa->id_kelas)
|
||||
->pluck('id_mengajar');
|
||||
|
||||
// Materi baru
|
||||
$materiBaru = Materi::with(['mengajar.mapel', 'mengajar.kelas'])
|
||||
->whereIn('id_mengajar', $idMengajars)
|
||||
->where('created_at', '>=', $since)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get()
|
||||
->map(fn($m) => [
|
||||
'type' => 'materi',
|
||||
'title' => 'Materi Baru',
|
||||
'message' => optional($m->mengajar->mapel)->nama_mapel . ': ' . $m->judul_materi,
|
||||
'time' => $m->created_at->diffForHumans(),
|
||||
'time_raw'=> $m->created_at->toIso8601String(),
|
||||
]);
|
||||
|
||||
// Tugas baru
|
||||
$tugasBaru = Tugas::with(['mengajar.mapel', 'mengajar.kelas'])
|
||||
->whereIn('id_mengajar', $idMengajars)
|
||||
->where('created_at', '>=', $since)
|
||||
->orderBy('created_at', 'desc')
|
||||
->get()
|
||||
->map(fn($t) => [
|
||||
'type' => 'tugas',
|
||||
'title' => 'Tugas Baru',
|
||||
'message' => optional($t->mengajar->mapel)->nama_mapel . ': ' . $t->judul_tugas,
|
||||
'time' => $t->created_at->diffForHumans(),
|
||||
'time_raw'=> $t->created_at->toIso8601String(),
|
||||
]);
|
||||
|
||||
$notifications = $materiBaru->concat($tugasBaru)
|
||||
->sortByDesc('time_raw')
|
||||
->values();
|
||||
|
||||
return response()->json([
|
||||
'count' => $notifications->count(),
|
||||
'notifications' => $notifications,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,71 +10,141 @@
|
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
body { font-family: 'Poppins', sans-serif; background-color: #f5f9ff; margin: 0; }
|
||||
.admin-wrapper { display: flex; min-height: 100vh; }
|
||||
* { box-sizing: border-box; }
|
||||
body { font-family: 'Poppins', sans-serif; background-color: #f5f9ff; margin: 0; height: 100vh; overflow: hidden; }
|
||||
.admin-wrapper { display: flex; height: 100vh; overflow: hidden; }
|
||||
|
||||
/* ── SIDEBAR ── */
|
||||
/* ── SIDEBAR (scrollable internally for admin) ── */
|
||||
.sidebar {
|
||||
width: 260px;
|
||||
width: 260px; flex-shrink: 0;
|
||||
background: #ffffff;
|
||||
border-right: 2px solid #e6f0ff;
|
||||
padding: 30px 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
display: flex; flex-direction: column;
|
||||
transition: width 0.3s ease, padding 0.3s ease;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
overflow-y: auto; overflow-x: hidden;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.sidebar.collapsed { width: 0; padding: 0; border-right: none; }
|
||||
|
||||
.sidebar-logo { text-align: center; margin-bottom: 40px; white-space: nowrap; }
|
||||
.sidebar-logo { text-align: center; margin-bottom: 36px; white-space: nowrap; flex-shrink: 0; }
|
||||
.sidebar-logo img { width: 90px; }
|
||||
.sidebar-menu { display: flex; flex-direction: column; white-space: nowrap; }
|
||||
|
||||
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 12px 18px; margin-bottom: 6px; border-radius: 12px; color: #64748b; text-decoration: none; font-weight: 500; font-size: 14px; transition: all 0.2s ease; }
|
||||
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 11px 18px; margin-bottom: 4px; border-radius: 12px; color: #64748b; text-decoration: none; font-weight: 500; font-size: 14px; transition: all 0.2s ease; }
|
||||
.sidebar-link:hover { background: #e6f0ff; color: #1d4ed8; }
|
||||
.sidebar-link.active { background: #e6f0ff; color: #1d4ed8; }
|
||||
.sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; }
|
||||
|
||||
.sidebar-section { font-size: 10px; font-weight: 700; color: #94a3b8; letter-spacing: 1px; text-transform: uppercase; padding: 4px 18px; margin: 8px 0 4px; white-space: nowrap; }
|
||||
.sidebar-logout { margin-top: auto; padding-top: 16px; border-top: 1px solid #f1f5f9; }
|
||||
.sidebar-logout { margin-top: auto; padding-top: 16px; border-top: 1px solid #f1f5f9; flex-shrink: 0; }
|
||||
.sidebar-logout button { width: 100%; border: none; background: transparent; color: #ef4444; font-weight: 600; font-size: 14px; padding: 10px 18px; text-align: left; border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: background 0.2s; }
|
||||
.sidebar-logout button:hover { background: #fef2f2; }
|
||||
|
||||
/* ── TOGGLE BUTTON ── */
|
||||
.sidebar-toggle-btn {
|
||||
position: fixed; top: 50%; transform: translateY(-50%);
|
||||
left: 260px; z-index: 1000;
|
||||
width: 22px; height: 48px;
|
||||
background: #2b8ef3; border: none;
|
||||
border-radius: 0 10px 10px 0;
|
||||
cursor: pointer;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
transition: left 0.3s ease, background 0.2s;
|
||||
box-shadow: 2px 0 8px rgba(43,142,243,0.3);
|
||||
}
|
||||
/* ── TOGGLE ── */
|
||||
.sidebar-toggle-btn { position: fixed; top: 50%; transform: translateY(-50%); left: 260px; z-index: 1000; width: 22px; height: 48px; background: #2b8ef3; border: none; border-radius: 0 10px 10px 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: left 0.3s ease, background 0.2s; box-shadow: 2px 0 8px rgba(43,142,243,0.3); }
|
||||
.sidebar-toggle-btn:hover { background: #1a7ae0; }
|
||||
.sidebar-toggle-btn.collapsed { left: 0; }
|
||||
.toggle-arrow { width: 12px; height: 12px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s ease; }
|
||||
.sidebar-toggle-btn.collapsed .toggle-arrow { transform: rotate(180deg); }
|
||||
|
||||
/* ── MAIN ── */
|
||||
.main { flex: 1; background: #f5f9ff; display: flex; flex-direction: column; min-width: 0; }
|
||||
/* ── MAIN (scrollable) ── */
|
||||
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
|
||||
|
||||
.topbar { background: #2b8ef3; margin: 20px; padding: 16px 24px; border-radius: 16px; color: white; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 8px 24px rgba(43,142,243,0.25); }
|
||||
.topbar { background: #2b8ef3; margin: 20px 20px 0; padding: 16px 24px; border-radius: 16px; color: white; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 8px 24px rgba(43,142,243,0.25); flex-shrink: 0; }
|
||||
.topbar-left { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 10px; }
|
||||
.topbar-right { display: flex; align-items: center; gap: 14px; }
|
||||
.topbar-icon { width: 24px; height: 24px; cursor: pointer; }
|
||||
|
||||
.content { padding: 20px 28px 28px; flex: 1; overflow-y: auto; }
|
||||
|
||||
/* ── NOTIF BELL ── */
|
||||
.notif-wrap { position: relative; }
|
||||
|
||||
.notif-btn {
|
||||
width: 36px; height: 36px; border-radius: 50%;
|
||||
background: rgba(255,255,255,0.2);
|
||||
border: 2px solid rgba(255,255,255,0.4);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
cursor: pointer; transition: background 0.2s; flex-shrink: 0;
|
||||
}
|
||||
.notif-btn:hover { background: rgba(255,255,255,0.35); }
|
||||
.notif-btn svg { width: 18px; height: 18px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||
|
||||
.notif-badge {
|
||||
position: absolute; top: -4px; right: -4px;
|
||||
min-width: 18px; height: 18px;
|
||||
background: #ef4444;
|
||||
border: 2px solid #2b8ef3;
|
||||
border-radius: 99px;
|
||||
font-size: 10px; font-weight: 700;
|
||||
color: white; display: none;
|
||||
align-items: center; justify-content: center;
|
||||
padding: 0 4px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* ── NOTIF DROPDOWN ── */
|
||||
.notif-dropdown {
|
||||
position: absolute; top: calc(100% + 12px); right: 0;
|
||||
width: 340px;
|
||||
background: white; border-radius: 20px;
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
|
||||
z-index: 9998;
|
||||
opacity: 0; pointer-events: none;
|
||||
transform: translateY(-8px) scale(0.97);
|
||||
transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notif-dropdown.show {
|
||||
opacity: 1; pointer-events: all;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
|
||||
.notif-head {
|
||||
padding: 16px 18px 12px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
}
|
||||
|
||||
.notif-head-title { font-size: 14px; font-weight: 700; color: #0f1f3d; }
|
||||
.notif-head-count { font-size: 11px; color: #94a3b8; }
|
||||
|
||||
.notif-list { max-height: 340px; overflow-y: auto; }
|
||||
|
||||
.notif-item {
|
||||
display: flex; align-items: flex-start; gap: 12px;
|
||||
padding: 13px 18px;
|
||||
border-bottom: 1px solid #f8fafc;
|
||||
transition: background 0.15s; cursor: default;
|
||||
}
|
||||
.notif-item:hover { background: #f8faff; }
|
||||
.notif-item:last-child { border-bottom: none; }
|
||||
|
||||
.notif-icon-wrap {
|
||||
width: 36px; height: 36px; border-radius: 12px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
flex-shrink: 0; font-size: 16px;
|
||||
}
|
||||
|
||||
.notif-icon-materi { background: #e8f4ff; }
|
||||
.notif-icon-tugas { background: #fff7e6; }
|
||||
.notif-icon-pengumpulan { background: #eefaf3; }
|
||||
|
||||
.notif-body { flex: 1; min-width: 0; }
|
||||
.notif-title { font-size: 12px; font-weight: 700; color: #0f1f3d; margin-bottom: 2px; }
|
||||
.notif-message { font-size: 12px; color: #475569; margin-bottom: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.notif-sub { font-size: 11px; color: #94a3b8; }
|
||||
.notif-time { font-size: 10px; color: #94a3b8; white-space: nowrap; margin-top: 2px; }
|
||||
|
||||
.notif-empty { padding: 32px 18px; text-align: center; }
|
||||
.notif-empty-icon { font-size: 36px; margin-bottom: 8px; }
|
||||
.notif-empty-text { font-size: 13px; color: #94a3b8; }
|
||||
|
||||
/* ── TOPBAR AVATAR ── */
|
||||
.topbar-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.5); cursor: pointer; transition: all 0.2s; display: block; }
|
||||
.topbar-avatar:hover { border-color: white; transform: scale(1.05); }
|
||||
.topbar-avatar-icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.4); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
|
||||
.topbar-avatar-icon:hover { background: rgba(255,255,255,0.35); }
|
||||
.topbar-avatar-icon svg { width: 20px; height: 20px; stroke: white; }
|
||||
|
||||
.content { padding: 0 28px 28px; flex: 1; }
|
||||
|
||||
/* ── PROFILE MODAL ── */
|
||||
.profile-modal-overlay { position: fixed; inset: 0; background: rgba(15,31,61,0.45); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
|
||||
.profile-modal-overlay.show { opacity: 1; pointer-events: all; }
|
||||
|
|
@ -107,7 +177,6 @@
|
|||
.modal-toast.success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; display: block; }
|
||||
.modal-toast.error { background: #fef2f2; border: 1.5px solid #fca5a5; color: #991b1b; display: block; }
|
||||
</style>
|
||||
|
||||
@stack('styles')
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -117,12 +186,10 @@
|
|||
<div class="sidebar-logo">
|
||||
<img src="{{ asset('images/logo/logosmk.png') }}" alt="Logo SMK">
|
||||
</div>
|
||||
|
||||
<nav class="sidebar-menu">
|
||||
<a href="{{ route('admin.dashboard') }}" class="sidebar-link {{ request()->routeIs('admin.dashboard') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/home.png') }}" class="sidebar-icon" alt=""><span>Dashboard</span>
|
||||
</a>
|
||||
|
||||
<div class="sidebar-section">Data Master</div>
|
||||
<a href="{{ route('admin.guru.index') }}" class="sidebar-link {{ request()->routeIs('admin.guru.*') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/guru.png') }}" class="sidebar-icon" alt=""><span>Daftar Guru</span>
|
||||
|
|
@ -136,7 +203,6 @@
|
|||
<a href="{{ route('admin.mapel.index') }}" class="sidebar-link {{ request()->routeIs('admin.mapel.*') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/mapel.png') }}" class="sidebar-icon" alt=""><span>Mata Pelajaran</span>
|
||||
</a>
|
||||
|
||||
<div class="sidebar-section">Konten Guru</div>
|
||||
<a href="{{ route('admin.materi.history') }}" class="sidebar-link {{ request()->routeIs('admin.materi.*') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/mapel.png') }}" class="sidebar-icon" alt=""><span>History Materi</span>
|
||||
|
|
@ -144,7 +210,6 @@
|
|||
<a href="{{ route('admin.tugas.history') }}" class="sidebar-link {{ request()->routeIs('admin.tugas.*') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/guru.png') }}" class="sidebar-icon" alt=""><span>History Tugas</span>
|
||||
</a>
|
||||
|
||||
<div class="sidebar-section">Gamifikasi</div>
|
||||
<a href="{{ route('admin.challenge.index') }}" class="sidebar-link {{ request()->routeIs('admin.challenge.*') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/challenge.png') }}" class="sidebar-icon" alt=""><span>Challenge</span>
|
||||
|
|
@ -153,7 +218,6 @@
|
|||
<img src="{{ asset('images/icon/sidebar/lb.png') }}" class="sidebar-icon" alt=""><span>Leaderboard</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<form action="{{ route('admin.logout') }}" method="POST" class="sidebar-logout">
|
||||
@csrf
|
||||
<button type="submit">
|
||||
|
|
@ -173,7 +237,27 @@
|
|||
👋 Hai, <span id="topbar-username">{{ Auth::guard('admin')->user()->username ?? 'Admin' }}</span>
|
||||
</div>
|
||||
<div class="topbar-right">
|
||||
<img src="{{ asset('images/icon/sidebar/notif.png') }}" class="topbar-icon" alt="Notification">
|
||||
|
||||
{{-- NOTIF BELL --}}
|
||||
<div class="notif-wrap" id="notifWrap">
|
||||
<button class="notif-btn" id="notifBtn" onclick="toggleNotif(event)">
|
||||
<svg viewBox="0 0 24 24"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>
|
||||
</button>
|
||||
<div class="notif-badge" id="notifBadge"></div>
|
||||
<div class="notif-dropdown" id="notifDropdown">
|
||||
<div class="notif-head">
|
||||
<span class="notif-head-title">Notifikasi</span>
|
||||
<span class="notif-head-count" id="notifCount">7 hari terakhir</span>
|
||||
</div>
|
||||
<div class="notif-list" id="notifList">
|
||||
<div class="notif-empty">
|
||||
<div class="notif-empty-icon">🔔</div>
|
||||
<div class="notif-empty-text">Memuat notifikasi...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php $admin = Auth::guard('admin')->user(); @endphp
|
||||
@if($admin->foto_profil)
|
||||
<img src="{{ Storage::url($admin->foto_profil) }}" class="topbar-avatar" id="topbar-foto" onclick="openProfileModal()" alt="Profil">
|
||||
|
|
@ -237,7 +321,7 @@
|
|||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
// ── Sidebar toggle ──
|
||||
// ── Sidebar ──
|
||||
const sidebar = document.getElementById('mainSidebar');
|
||||
const toggleBtn = document.getElementById('sidebarToggleBtn');
|
||||
const SIDEBAR_W = 260;
|
||||
|
|
@ -254,88 +338,107 @@ function updateToggle(isCollapsed) {
|
|||
localStorage.setItem('adminSidebarOpen', isCollapsed ? 'true' : 'false');
|
||||
});
|
||||
|
||||
// Restore state — admin/guru default OPEN
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const saved = localStorage.getItem('adminSidebarOpen');
|
||||
if (saved === 'false') {
|
||||
sidebar.classList.add('collapsed');
|
||||
updateToggle(true);
|
||||
} else {
|
||||
updateToggle(false);
|
||||
if (saved === 'false') { sidebar.classList.add('collapsed'); updateToggle(true); }
|
||||
else { updateToggle(false); }
|
||||
});
|
||||
|
||||
// ── Notifikasi ──
|
||||
const NOTIF_URL = '{{ route("admin.notifikasi") }}';
|
||||
const notifIcons = { materi: '📖', tugas: '📝', pengumpulan: '✅' };
|
||||
|
||||
function renderNotifItem(n) {
|
||||
const iconClass = `notif-icon-${n.type}`;
|
||||
return `
|
||||
<div class="notif-item">
|
||||
<div class="notif-icon-wrap ${iconClass}">${notifIcons[n.type] ?? '🔔'}</div>
|
||||
<div class="notif-body">
|
||||
<div class="notif-title">${n.title}</div>
|
||||
<div class="notif-message">${n.message}</div>
|
||||
${n.sub ? `<div class="notif-sub">${n.sub}</div>` : ''}
|
||||
<div class="notif-time">${n.time}</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
async function fetchNotif() {
|
||||
try {
|
||||
const res = await fetch(NOTIF_URL, { headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content } });
|
||||
const data = await res.json();
|
||||
const badge = document.getElementById('notifBadge');
|
||||
const list = document.getElementById('notifList');
|
||||
const count = document.getElementById('notifCount');
|
||||
|
||||
if (data.count > 0) {
|
||||
badge.style.display = 'flex';
|
||||
badge.textContent = data.count > 99 ? '99+' : data.count;
|
||||
} else {
|
||||
badge.style.display = 'none';
|
||||
}
|
||||
|
||||
count.textContent = `${data.count} notifikasi`;
|
||||
|
||||
if (data.notifications.length === 0) {
|
||||
list.innerHTML = `<div class="notif-empty"><div class="notif-empty-icon">🔔</div><div class="notif-empty-text">Tidak ada notifikasi baru</div></div>`;
|
||||
} else {
|
||||
list.innerHTML = data.notifications.map(renderNotifItem).join('');
|
||||
}
|
||||
} catch (e) { /* silent */ }
|
||||
}
|
||||
|
||||
function toggleNotif(e) {
|
||||
e.stopPropagation();
|
||||
document.getElementById('notifDropdown').classList.toggle('show');
|
||||
}
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!document.getElementById('notifWrap').contains(e.target)) {
|
||||
document.getElementById('notifDropdown').classList.remove('show');
|
||||
}
|
||||
});
|
||||
|
||||
fetchNotif();
|
||||
setInterval(fetchNotif, 30000);
|
||||
|
||||
// ── Profile Modal ──
|
||||
function openProfileModal() {
|
||||
document.getElementById('profileModalOverlay').classList.add('show');
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
function openProfileModal() { document.getElementById('profileModalOverlay').classList.add('show'); document.body.style.overflow = 'hidden'; }
|
||||
function closeProfileModal() {
|
||||
document.getElementById('profileModalOverlay').classList.remove('show');
|
||||
document.body.style.overflow = '';
|
||||
const toast = document.getElementById('modal-toast');
|
||||
toast.className = 'modal-toast'; toast.textContent = '';
|
||||
document.getElementById('profileModalOverlay').classList.remove('show'); document.body.style.overflow = '';
|
||||
const t = document.getElementById('modal-toast'); t.className = 'modal-toast'; t.textContent = '';
|
||||
}
|
||||
|
||||
function closeOnOverlay(e) {
|
||||
if (e.target === document.getElementById('profileModalOverlay')) closeProfileModal();
|
||||
}
|
||||
|
||||
function closeOnOverlay(e) { if (e.target === document.getElementById('profileModalOverlay')) closeProfileModal(); }
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeProfileModal(); });
|
||||
|
||||
document.getElementById('modal-foto-input').addEventListener('change', function () {
|
||||
const file = this.files[0]; if (!file) return;
|
||||
const url = URL.createObjectURL(file);
|
||||
const preview = document.getElementById('modal-foto-preview');
|
||||
const icon = document.getElementById('modal-foto-icon');
|
||||
preview.src = url; preview.style.display = 'block';
|
||||
if (icon) icon.style.display = 'none';
|
||||
const preview = document.getElementById('modal-foto-preview'); const icon = document.getElementById('modal-foto-icon');
|
||||
preview.src = url; preview.style.display = 'block'; if (icon) icon.style.display = 'none';
|
||||
});
|
||||
|
||||
document.getElementById('profile-form').addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
const btn = document.getElementById('btn-save');
|
||||
const toast = document.getElementById('modal-toast');
|
||||
const btn = document.getElementById('btn-save'); const toast = document.getElementById('modal-toast');
|
||||
btn.disabled = true; btn.textContent = 'Menyimpan...';
|
||||
const formData = new FormData(this);
|
||||
try {
|
||||
const res = await fetch('{{ route("admin.profile.update") }}', {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content },
|
||||
body: formData,
|
||||
});
|
||||
const res = await fetch('{{ route("admin.profile.update") }}', { method: 'POST', headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content }, body: formData });
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
if (data.foto_url) {
|
||||
const topbarFoto = document.getElementById('topbar-foto');
|
||||
const topbarIcon = document.getElementById('topbar-foto-icon');
|
||||
if (topbarFoto) { topbarFoto.src = data.foto_url + '?t=' + Date.now(); }
|
||||
else if (topbarIcon) {
|
||||
const img = document.createElement('img');
|
||||
img.src = data.foto_url + '?t=' + Date.now();
|
||||
img.className = 'topbar-avatar'; img.id = 'topbar-foto';
|
||||
img.onclick = openProfileModal; img.alt = 'Profil';
|
||||
topbarIcon.replaceWith(img);
|
||||
}
|
||||
const mp = document.getElementById('modal-foto-preview');
|
||||
const mi = document.getElementById('modal-foto-icon');
|
||||
if (mp) { mp.src = data.foto_url; mp.style.display = 'block'; }
|
||||
if (mi) mi.style.display = 'none';
|
||||
const tf = document.getElementById('topbar-foto'); const ti = document.getElementById('topbar-foto-icon');
|
||||
if (tf) { tf.src = data.foto_url + '?t=' + Date.now(); }
|
||||
else if (ti) { const img = document.createElement('img'); img.src = data.foto_url + '?t=' + Date.now(); img.className = 'topbar-avatar'; img.id = 'topbar-foto'; img.onclick = openProfileModal; img.alt = 'Profil'; ti.replaceWith(img); }
|
||||
const mp = document.getElementById('modal-foto-preview'); const mi = document.getElementById('modal-foto-icon');
|
||||
if (mp) { mp.src = data.foto_url; mp.style.display = 'block'; } if (mi) mi.style.display = 'none';
|
||||
}
|
||||
if (data.username) document.getElementById('topbar-username').textContent = data.username;
|
||||
toast.className = 'modal-toast success'; toast.textContent = '✓ ' + data.message;
|
||||
this.querySelector('[name="password"]').value = '';
|
||||
this.querySelector('[name="password_confirmation"]').value = '';
|
||||
} else {
|
||||
const errors = data.errors ? Object.values(data.errors).flat().join(' · ') : 'Terjadi kesalahan.';
|
||||
toast.className = 'modal-toast error'; toast.textContent = errors;
|
||||
}
|
||||
} catch (err) {
|
||||
toast.className = 'modal-toast error'; toast.textContent = 'Gagal terhubung ke server.';
|
||||
} finally {
|
||||
btn.disabled = false; btn.textContent = 'Simpan Perubahan';
|
||||
}
|
||||
this.querySelector('[name="password"]').value = ''; this.querySelector('[name="password_confirmation"]').value = '';
|
||||
} else { const errors = data.errors ? Object.values(data.errors).flat().join(' · ') : 'Terjadi kesalahan.'; toast.className = 'modal-toast error'; toast.textContent = errors; }
|
||||
} catch (err) { toast.className = 'modal-toast error'; toast.textContent = 'Gagal terhubung ke server.'; }
|
||||
finally { btn.disabled = false; btn.textContent = 'Simpan Perubahan'; }
|
||||
});
|
||||
</script>
|
||||
@stack('scripts')
|
||||
|
|
|
|||
|
|
@ -5,24 +5,22 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>@yield('title', 'Panel Guru')</title>
|
||||
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
body { font-family: 'Poppins', sans-serif; background-color: #f5f9ff; margin: 0; }
|
||||
.wrapper { display: flex; min-height: 100vh; }
|
||||
* { box-sizing: border-box; }
|
||||
body { font-family: 'Poppins', sans-serif; background-color: #f5f9ff; margin: 0; height: 100vh; overflow: hidden; }
|
||||
.wrapper { display: flex; height: 100vh; overflow: hidden; }
|
||||
|
||||
.sidebar { width: 260px; background: #ffffff; border-right: 2px solid #e6f0ff; padding: 30px 20px; display: flex; flex-direction: column; transition: width 0.3s ease, padding 0.3s ease; overflow: hidden; flex-shrink: 0; }
|
||||
.sidebar { width: 260px; flex-shrink: 0; background: #ffffff; border-right: 2px solid #e6f0ff; padding: 30px 20px; display: flex; flex-direction: column; transition: width 0.3s ease, padding 0.3s ease; overflow: hidden; height: 100vh; position: sticky; top: 0; }
|
||||
.sidebar.collapsed { width: 0; padding: 0; border-right: none; }
|
||||
.sidebar-logo { text-align: center; margin-bottom: 40px; white-space: nowrap; }
|
||||
.sidebar-logo { text-align: center; margin-bottom: 36px; white-space: nowrap; flex-shrink: 0; }
|
||||
.sidebar-logo img { width: 90px; }
|
||||
|
||||
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 12px 18px; margin-bottom: 6px; border-radius: 12px; color: #64748b; text-decoration: none; font-weight: 500; font-size: 14px; transition: all 0.2s ease; white-space: nowrap; }
|
||||
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 11px 18px; margin-bottom: 4px; border-radius: 12px; color: #64748b; text-decoration: none; font-weight: 500; font-size: 14px; transition: all 0.2s ease; white-space: nowrap; }
|
||||
.sidebar-link:hover { background: #e6f0ff; color: #1d4ed8; }
|
||||
.sidebar-link.active { background: #e6f0ff; color: #1d4ed8; }
|
||||
.sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; }
|
||||
.sidebar-logout { margin-top: auto; padding-top: 16px; border-top: 1px solid #f1f5f9; }
|
||||
.sidebar-logout { margin-top: auto; padding-top: 16px; border-top: 1px solid #f1f5f9; flex-shrink: 0; }
|
||||
.sidebar-logout button { width: 100%; border: none; background: transparent; color: #ef4444; font-weight: 600; font-size: 14px; padding: 10px 18px; text-align: left; border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: background 0.2s; }
|
||||
.sidebar-logout button:hover { background: #fef2f2; }
|
||||
|
||||
|
|
@ -32,12 +30,38 @@
|
|||
.toggle-arrow { width: 12px; height: 12px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s ease; }
|
||||
.sidebar-toggle-btn.collapsed .toggle-arrow { transform: rotate(180deg); }
|
||||
|
||||
.main { flex: 1; background: #f5f9ff; display: flex; flex-direction: column; min-width: 0; }
|
||||
.topbar { background: #2b8ef3; margin: 20px; padding: 16px 24px; border-radius: 16px; color: white; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 8px 24px rgba(43,142,243,0.25); }
|
||||
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
|
||||
.topbar { background: #2b8ef3; margin: 20px 20px 0; padding: 16px 24px; border-radius: 16px; color: white; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 8px 24px rgba(43,142,243,0.25); flex-shrink: 0; }
|
||||
.topbar-left { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
|
||||
.topbar-waving { width: 26px; height: 26px; }
|
||||
.topbar-right { display: flex; align-items: center; gap: 14px; }
|
||||
.topbar-icon { width: 24px; height: 24px; cursor: pointer; }
|
||||
.content { padding: 20px 28px 28px; flex: 1; overflow-y: auto; }
|
||||
|
||||
/* NOTIF */
|
||||
.notif-wrap { position: relative; }
|
||||
.notif-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.4); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
|
||||
.notif-btn:hover { background: rgba(255,255,255,0.35); }
|
||||
.notif-btn svg { width: 18px; height: 18px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; background: #ef4444; border: 2px solid #2b8ef3; border-radius: 99px; font-size: 10px; font-weight: 700; color: white; display: none; align-items: center; justify-content: center; padding: 0 4px; line-height: 1; }
|
||||
.notif-dropdown { position: absolute; top: calc(100% + 12px); right: 0; width: 340px; background: white; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05); z-index: 9998; opacity: 0; pointer-events: none; transform: translateY(-8px) scale(0.97); transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1); overflow: hidden; }
|
||||
.notif-dropdown.show { opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }
|
||||
.notif-head { padding: 16px 18px 12px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
|
||||
.notif-head-title { font-size: 14px; font-weight: 700; color: #0f1f3d; }
|
||||
.notif-head-count { font-size: 11px; color: #94a3b8; }
|
||||
.notif-list { max-height: 340px; overflow-y: auto; }
|
||||
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 18px; border-bottom: 1px solid #f8fafc; transition: background 0.15s; cursor: default; }
|
||||
.notif-item:hover { background: #f8faff; }
|
||||
.notif-item:last-child { border-bottom: none; }
|
||||
.notif-icon-wrap { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
|
||||
.notif-icon-pengumpulan { background: #eefaf3; }
|
||||
.notif-body { flex: 1; min-width: 0; }
|
||||
.notif-title { font-size: 12px; font-weight: 700; color: #0f1f3d; margin-bottom: 2px; }
|
||||
.notif-message { font-size: 12px; color: #475569; margin-bottom: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.notif-sub { font-size: 11px; color: #94a3b8; }
|
||||
.notif-time { font-size: 10px; color: #94a3b8; white-space: nowrap; margin-top: 2px; }
|
||||
.notif-empty { padding: 32px 18px; text-align: center; }
|
||||
.notif-empty-icon { font-size: 36px; margin-bottom: 8px; }
|
||||
.notif-empty-text { font-size: 13px; color: #94a3b8; }
|
||||
|
||||
.topbar-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.5); cursor: pointer; transition: all 0.2s; display: block; }
|
||||
.topbar-avatar:hover { border-color: white; transform: scale(1.05); }
|
||||
|
|
@ -45,9 +69,6 @@
|
|||
.topbar-avatar-icon:hover { background: rgba(255,255,255,0.35); }
|
||||
.topbar-avatar-icon svg { width: 20px; height: 20px; stroke: white; }
|
||||
|
||||
.content { padding: 0 28px 28px; flex: 1; }
|
||||
|
||||
/* MODAL */
|
||||
.profile-modal-overlay { position: fixed; inset: 0; background: rgba(15,31,61,0.45); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
|
||||
.profile-modal-overlay.show { opacity: 1; pointer-events: all; }
|
||||
.profile-modal { background: white; border-radius: 24px; width: 100%; max-width: 440px; padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,0.18); transform: translateY(20px) scale(0.97); transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1); position: relative; max-height: 90vh; overflow-y: auto; }
|
||||
|
|
@ -79,15 +100,12 @@
|
|||
.modal-toast.success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; display: block; }
|
||||
.modal-toast.error { background: #fef2f2; border: 1.5px solid #fca5a5; color: #991b1b; display: block; }
|
||||
</style>
|
||||
|
||||
@stack('styles')
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
|
||||
<aside class="sidebar" id="mainSidebar">
|
||||
<div class="sidebar-logo"><img src="{{ asset('images/logo/logosmk.png') }}" alt="Logo"></div>
|
||||
|
||||
<a href="{{ route('guru.dashboard') }}" class="sidebar-link {{ request()->routeIs('guru.dashboard') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/home.png') }}" class="sidebar-icon"><span>Dashboard</span>
|
||||
</a>
|
||||
|
|
@ -106,7 +124,6 @@
|
|||
<a href="{{ route('guru.leaderboard.index') }}" class="sidebar-link {{ request()->routeIs('guru.leaderboard.*') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/lb.png') }}" class="sidebar-icon"><span>Leaderboard</span>
|
||||
</a>
|
||||
|
||||
<form action="{{ route('guru.logout') }}" method="POST" class="sidebar-logout">
|
||||
@csrf
|
||||
<button type="submit">
|
||||
|
|
@ -127,7 +144,22 @@
|
|||
Selamat datang, {{ Auth::guard('guru')->user()->nama ?? 'Guru' }}
|
||||
</div>
|
||||
<div class="topbar-right">
|
||||
<img src="{{ asset('images/icon/sidebar/notif.png') }}" class="topbar-icon" alt="Notification">
|
||||
<div class="notif-wrap" id="notifWrap">
|
||||
<button class="notif-btn" id="notifBtn" onclick="toggleNotif(event)">
|
||||
<svg viewBox="0 0 24 24"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>
|
||||
</button>
|
||||
<div class="notif-badge" id="notifBadge"></div>
|
||||
<div class="notif-dropdown" id="notifDropdown">
|
||||
<div class="notif-head">
|
||||
<span class="notif-head-title">Notifikasi</span>
|
||||
<span class="notif-head-count" id="notifCount">7 hari terakhir</span>
|
||||
</div>
|
||||
<div class="notif-list" id="notifList">
|
||||
<div class="notif-empty"><div class="notif-empty-icon">🔔</div><div class="notif-empty-text">Memuat notifikasi...</div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php $guru = Auth::guard('guru')->user(); @endphp
|
||||
@if($guru->foto_profil)
|
||||
<img src="{{ Storage::url($guru->foto_profil) }}" class="topbar-avatar" id="topbar-foto" onclick="openProfileModal()" alt="Profil">
|
||||
|
|
@ -138,19 +170,14 @@
|
|||
@endif
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="content">
|
||||
@yield('content')
|
||||
</main>
|
||||
<main class="content">@yield('content')</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- PROFILE MODAL --}}
|
||||
<div class="profile-modal-overlay" id="profileModalOverlay" onclick="closeOnOverlay(event)">
|
||||
<div class="profile-modal">
|
||||
<button class="modal-close" onclick="closeProfileModal()">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
|
||||
</button>
|
||||
<button class="modal-close" onclick="closeProfileModal()"><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>
|
||||
<div class="modal-title">Edit Profil</div>
|
||||
<div class="modal-subtitle">Perbarui foto profil dan password</div>
|
||||
<div id="modal-toast" class="modal-toast"></div>
|
||||
|
|
@ -158,12 +185,9 @@
|
|||
@csrf
|
||||
<div class="foto-upload-area">
|
||||
<div class="foto-circle">
|
||||
@if($guru->foto_profil)
|
||||
<img src="{{ Storage::url($guru->foto_profil) }}" id="modal-foto-preview" alt="">
|
||||
@else
|
||||
<svg id="modal-foto-icon" viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/></svg>
|
||||
<img src="" id="modal-foto-preview" alt="" style="display:none">
|
||||
@endif
|
||||
@if($guru->foto_profil) <img src="{{ Storage::url($guru->foto_profil) }}" id="modal-foto-preview" alt="">
|
||||
@else <svg id="modal-foto-icon" viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/></svg>
|
||||
<img src="" id="modal-foto-preview" alt="" style="display:none"> @endif
|
||||
</div>
|
||||
<div class="foto-info">
|
||||
<p>JPG, PNG, WEBP · Maks. 2MB</p>
|
||||
|
|
@ -171,23 +195,11 @@
|
|||
<input type="file" name="foto_profil" id="modal-foto-input" accept="image/*" style="display:none">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">NIP <span>(tidak dapat diubah)</span></label>
|
||||
<input type="text" class="modal-input" value="{{ $guru->nip }}" disabled>
|
||||
</div>
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">Nama Lengkap <span>(tidak dapat diubah)</span></label>
|
||||
<input type="text" class="modal-input" value="{{ $guru->nama }}" disabled>
|
||||
</div>
|
||||
<div class="modal-field"><label class="modal-label">NIP <span>(tidak dapat diubah)</span></label><input type="text" class="modal-input" value="{{ $guru->nip }}" disabled></div>
|
||||
<div class="modal-field"><label class="modal-label">Nama Lengkap <span>(tidak dapat diubah)</span></label><input type="text" class="modal-input" value="{{ $guru->nama }}" disabled></div>
|
||||
<hr class="modal-divider">
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">Password Baru <span>(kosongkan jika tidak ingin mengubah)</span></label>
|
||||
<input type="password" name="password" class="modal-input" placeholder="Password baru" autocomplete="new-password">
|
||||
</div>
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">Konfirmasi Password</label>
|
||||
<input type="password" name="password_confirmation" class="modal-input" placeholder="Ulangi password baru" autocomplete="new-password">
|
||||
</div>
|
||||
<div class="modal-field"><label class="modal-label">Password Baru <span>(kosongkan jika tidak ingin mengubah)</span></label><input type="password" name="password" class="modal-input" placeholder="Password baru" autocomplete="new-password"></div>
|
||||
<div class="modal-field"><label class="modal-label">Konfirmasi Password</label><input type="password" name="password_confirmation" class="modal-input" placeholder="Ulangi password baru" autocomplete="new-password"></div>
|
||||
<button type="submit" class="btn-save-modal" id="btn-save">Simpan Perubahan</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -195,101 +207,47 @@
|
|||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
const sidebar = document.getElementById('mainSidebar');
|
||||
const toggleBtn = document.getElementById('sidebarToggleBtn');
|
||||
const SIDEBAR_W = 260;
|
||||
const sidebar = document.getElementById('mainSidebar'), toggleBtn = document.getElementById('sidebarToggleBtn'), SIDEBAR_W = 260;
|
||||
function updateToggle(c) { toggleBtn.style.left = c ? '0px' : SIDEBAR_W+'px'; c ? toggleBtn.classList.add('collapsed') : toggleBtn.classList.remove('collapsed'); }
|
||||
toggleBtn.addEventListener('click', function() { const c = sidebar.classList.contains('collapsed'); sidebar.classList.toggle('collapsed'); updateToggle(!c); localStorage.setItem('guruSidebarOpen', c ? 'true' : 'false'); });
|
||||
window.addEventListener('DOMContentLoaded', () => { const s = localStorage.getItem('guruSidebarOpen'); if (s === 'false') { sidebar.classList.add('collapsed'); updateToggle(true); } else { updateToggle(false); } });
|
||||
|
||||
function updateToggle(isCollapsed) {
|
||||
toggleBtn.style.left = isCollapsed ? '0px' : SIDEBAR_W + 'px';
|
||||
isCollapsed ? toggleBtn.classList.add('collapsed') : toggleBtn.classList.remove('collapsed');
|
||||
}
|
||||
|
||||
toggleBtn.addEventListener('click', function () {
|
||||
const isCollapsed = sidebar.classList.contains('collapsed');
|
||||
sidebar.classList.toggle('collapsed');
|
||||
updateToggle(!isCollapsed);
|
||||
localStorage.setItem('guruSidebarOpen', isCollapsed ? 'true' : 'false');
|
||||
});
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const saved = localStorage.getItem('guruSidebarOpen');
|
||||
if (saved === 'false') {
|
||||
sidebar.classList.add('collapsed');
|
||||
updateToggle(true);
|
||||
} else {
|
||||
updateToggle(false);
|
||||
}
|
||||
});
|
||||
|
||||
function openProfileModal() {
|
||||
document.getElementById('profileModalOverlay').classList.add('show');
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
function closeProfileModal() {
|
||||
document.getElementById('profileModalOverlay').classList.remove('show');
|
||||
document.body.style.overflow = '';
|
||||
const toast = document.getElementById('modal-toast');
|
||||
toast.className = 'modal-toast'; toast.textContent = '';
|
||||
}
|
||||
|
||||
function closeOnOverlay(e) {
|
||||
if (e.target === document.getElementById('profileModalOverlay')) closeProfileModal();
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeProfileModal(); });
|
||||
|
||||
document.getElementById('modal-foto-input').addEventListener('change', function () {
|
||||
const file = this.files[0]; if (!file) return;
|
||||
const url = URL.createObjectURL(file);
|
||||
const preview = document.getElementById('modal-foto-preview');
|
||||
const icon = document.getElementById('modal-foto-icon');
|
||||
preview.src = url; preview.style.display = 'block';
|
||||
if (icon) icon.style.display = 'none';
|
||||
});
|
||||
|
||||
document.getElementById('profile-form').addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
const btn = document.getElementById('btn-save');
|
||||
const toast = document.getElementById('modal-toast');
|
||||
btn.disabled = true; btn.textContent = 'Menyimpan...';
|
||||
const formData = new FormData(this);
|
||||
const NOTIF_URL = '{{ route("guru.notifikasi") }}';
|
||||
async function fetchNotif() {
|
||||
try {
|
||||
const res = await fetch('{{ route("guru.profile.update") }}', {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content },
|
||||
body: formData,
|
||||
});
|
||||
const res = await fetch(NOTIF_URL, { headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content } });
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
if (data.foto_url) {
|
||||
const topbarFoto = document.getElementById('topbar-foto');
|
||||
const topbarIcon = document.getElementById('topbar-foto-icon');
|
||||
if (topbarFoto) { topbarFoto.src = data.foto_url + '?t=' + Date.now(); }
|
||||
else if (topbarIcon) {
|
||||
const img = document.createElement('img');
|
||||
img.src = data.foto_url + '?t=' + Date.now();
|
||||
img.className = 'topbar-avatar'; img.id = 'topbar-foto';
|
||||
img.onclick = openProfileModal; img.alt = 'Profil';
|
||||
topbarIcon.replaceWith(img);
|
||||
}
|
||||
const mp = document.getElementById('modal-foto-preview');
|
||||
const mi = document.getElementById('modal-foto-icon');
|
||||
if (mp) { mp.src = data.foto_url; mp.style.display = 'block'; }
|
||||
if (mi) mi.style.display = 'none';
|
||||
}
|
||||
toast.className = 'modal-toast success'; toast.textContent = '✓ ' + data.message;
|
||||
this.querySelector('[name="password"]').value = '';
|
||||
this.querySelector('[name="password_confirmation"]').value = '';
|
||||
} else {
|
||||
const errors = data.errors ? Object.values(data.errors).flat().join(' · ') : 'Terjadi kesalahan.';
|
||||
toast.className = 'modal-toast error'; toast.textContent = errors;
|
||||
}
|
||||
} catch (err) {
|
||||
toast.className = 'modal-toast error'; toast.textContent = 'Gagal terhubung ke server.';
|
||||
} finally {
|
||||
btn.disabled = false; btn.textContent = 'Simpan Perubahan';
|
||||
}
|
||||
const badge = document.getElementById('notifBadge'), list = document.getElementById('notifList'), count = document.getElementById('notifCount');
|
||||
badge.style.display = data.count > 0 ? 'flex' : 'none';
|
||||
if (data.count > 0) badge.textContent = data.count > 99 ? '99+' : data.count;
|
||||
count.textContent = `${data.count} notifikasi`;
|
||||
list.innerHTML = data.notifications.length === 0
|
||||
? `<div class="notif-empty"><div class="notif-empty-icon">🔔</div><div class="notif-empty-text">Tidak ada notifikasi baru</div></div>`
|
||||
: data.notifications.map(n => `<div class="notif-item"><div class="notif-icon-wrap notif-icon-pengumpulan">✅</div><div class="notif-body"><div class="notif-title">${n.title}</div><div class="notif-message">${n.message}</div><div class="notif-time">${n.time}</div></div></div>`).join('');
|
||||
} catch(e) {}
|
||||
}
|
||||
function toggleNotif(e) { e.stopPropagation(); document.getElementById('notifDropdown').classList.toggle('show'); }
|
||||
document.addEventListener('click', e => { if (!document.getElementById('notifWrap').contains(e.target)) document.getElementById('notifDropdown').classList.remove('show'); });
|
||||
fetchNotif(); setInterval(fetchNotif, 30000);
|
||||
|
||||
function openProfileModal() { document.getElementById('profileModalOverlay').classList.add('show'); document.body.style.overflow='hidden'; }
|
||||
function closeProfileModal() { document.getElementById('profileModalOverlay').classList.remove('show'); document.body.style.overflow=''; const t=document.getElementById('modal-toast'); t.className='modal-toast'; t.textContent=''; }
|
||||
function closeOnOverlay(e) { if (e.target===document.getElementById('profileModalOverlay')) closeProfileModal(); }
|
||||
document.addEventListener('keydown', e => { if (e.key==='Escape') closeProfileModal(); });
|
||||
document.getElementById('modal-foto-input').addEventListener('change', function() { const f=this.files[0]; if(!f)return; const u=URL.createObjectURL(f); const p=document.getElementById('modal-foto-preview'); const i=document.getElementById('modal-foto-icon'); p.src=u; p.style.display='block'; if(i)i.style.display='none'; });
|
||||
document.getElementById('profile-form').addEventListener('submit', async function(e) {
|
||||
e.preventDefault(); const btn=document.getElementById('btn-save'); const toast=document.getElementById('modal-toast');
|
||||
btn.disabled=true; btn.textContent='Menyimpan...'; const fd=new FormData(this);
|
||||
try {
|
||||
const res=await fetch('{{ route("guru.profile.update") }}',{method:'POST',headers:{'X-CSRF-TOKEN':document.querySelector('meta[name="csrf-token"]').content},body:fd});
|
||||
const data=await res.json();
|
||||
if(data.success){
|
||||
if(data.foto_url){const tf=document.getElementById('topbar-foto');const ti=document.getElementById('topbar-foto-icon');if(tf){tf.src=data.foto_url+'?t='+Date.now();}else if(ti){const img=document.createElement('img');img.src=data.foto_url+'?t='+Date.now();img.className='topbar-avatar';img.id='topbar-foto';img.onclick=openProfileModal;img.alt='Profil';ti.replaceWith(img);}const mp=document.getElementById('modal-foto-preview');const mi=document.getElementById('modal-foto-icon');if(mp){mp.src=data.foto_url;mp.style.display='block';}if(mi)mi.style.display='none';}
|
||||
toast.className='modal-toast success'; toast.textContent='✓ '+data.message;
|
||||
this.querySelector('[name="password"]').value=''; this.querySelector('[name="password_confirmation"]').value='';
|
||||
} else { const err=data.errors?Object.values(data.errors).flat().join(' · '):'Terjadi kesalahan.'; toast.className='modal-toast error'; toast.textContent=err; }
|
||||
} catch(err){toast.className='modal-toast error';toast.textContent='Gagal terhubung ke server.';}
|
||||
finally{btn.disabled=false;btn.textContent='Simpan Perubahan';}
|
||||
});
|
||||
</script>
|
||||
@stack('scripts')
|
||||
|
|
|
|||
|
|
@ -5,39 +5,63 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>@yield('title', 'Siswa Panel')</title>
|
||||
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
body { font-family: 'Poppins', sans-serif; background-color: #f8f9fa; margin: 0; }
|
||||
.siswa-wrapper { display: flex; min-height: 100vh; position: relative; }
|
||||
* { box-sizing: border-box; }
|
||||
body { font-family: 'Poppins', sans-serif; background-color: #f5f9ff; margin: 0; height: 100vh; overflow: hidden; }
|
||||
.siswa-wrapper { display: flex; height: 100vh; overflow: hidden; }
|
||||
|
||||
.sidebar { width: 260px; background: #ffffff; border-right: 2px solid #e6f0ff; padding: 30px 20px; display: flex; flex-direction: column; transition: width 0.3s ease, padding 0.3s ease; overflow: hidden; flex-shrink: 0; }
|
||||
.sidebar { width: 260px; flex-shrink: 0; background: #ffffff; border-right: 2px solid #e6f0ff; padding: 30px 20px; display: flex; flex-direction: column; transition: width 0.3s ease, padding 0.3s ease; overflow: hidden; height: 100vh; position: sticky; top: 0; }
|
||||
.sidebar.collapsed { width: 0; padding: 0; border-right: none; }
|
||||
.sidebar-logo { text-align: center; margin-bottom: 40px; white-space: nowrap; }
|
||||
.sidebar-logo { text-align: center; margin-bottom: 36px; white-space: nowrap; flex-shrink: 0; }
|
||||
.sidebar-logo img { width: 90px; }
|
||||
.sidebar-menu { display: flex; flex-direction: column; white-space: nowrap; }
|
||||
|
||||
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 12px 18px; margin-bottom: 12px; border-radius: 12px; color: #64748b; text-decoration: none; font-weight: 500; transition: all 0.2s ease; }
|
||||
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 11px 18px; margin-bottom: 8px; border-radius: 12px; color: #64748b; text-decoration: none; font-weight: 500; transition: all 0.2s ease; }
|
||||
.sidebar-link:hover { background: #e6f0ff; color: #1d4ed8; }
|
||||
.sidebar-link.active { background: #e6f0ff; color: #1d4ed8; }
|
||||
.sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; }
|
||||
.sidebar-logout { margin-top: auto; }
|
||||
.sidebar-logout button { width: 100%; border: none; background: transparent; color: #ef4444; font-weight: 600; padding: 10px; text-align: left; }
|
||||
.sidebar-logout { margin-top: auto; flex-shrink: 0; }
|
||||
.sidebar-logout button { width: 100%; border: none; background: transparent; color: #ef4444; font-weight: 600; padding: 10px; text-align: left; border-radius: 12px; cursor: pointer; }
|
||||
.sidebar-logout button:hover { background: #fef2f2; }
|
||||
|
||||
.sidebar-toggle-btn { position: fixed; top: 50%; transform: translateY(-50%); left: 260px; z-index: 1000; width: 22px; height: 48px; background: #2b8ef3; border: none; border-radius: 0 10px 10px 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: left 0.3s ease; box-shadow: 2px 0 8px rgba(43,142,243,0.3); }
|
||||
.sidebar-toggle-btn { position: fixed; top: 50%; transform: translateY(-50%); left: 260px; z-index: 1000; width: 22px; height: 48px; background: #2b8ef3; border: none; border-radius: 0 10px 10px 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: left 0.3s ease, background 0.2s; box-shadow: 2px 0 8px rgba(43,142,243,0.3); }
|
||||
.sidebar-toggle-btn:hover { background: #1a7ae0; }
|
||||
.sidebar-toggle-btn.collapsed { left: 0; }
|
||||
.toggle-arrow { width: 12px; height: 12px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s ease; }
|
||||
.sidebar-toggle-btn.collapsed .toggle-arrow { transform: rotate(180deg); }
|
||||
|
||||
.main { flex: 1; background: #f5f9ff; display: flex; flex-direction: column; min-width: 0; }
|
||||
|
||||
.topbar { background: #2b8ef3; margin: 20px; padding: 16px 24px; border-radius: 16px; color: white; display: flex; justify-content: space-between; align-items: center; }
|
||||
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
|
||||
.topbar { background: #2b8ef3; margin: 20px 20px 0; padding: 16px 24px; border-radius: 16px; color: white; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
|
||||
.topbar-left { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 10px; }
|
||||
.topbar-right { display: flex; align-items: center; gap: 14px; }
|
||||
.topbar-icon { width: 24px; height: 24px; cursor: pointer; }
|
||||
.content { padding: 20px 28px 28px; flex: 1; overflow-y: auto; }
|
||||
|
||||
/* NOTIF */
|
||||
.notif-wrap { position: relative; }
|
||||
.notif-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.4); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
|
||||
.notif-btn:hover { background: rgba(255,255,255,0.35); }
|
||||
.notif-btn svg { width: 18px; height: 18px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; background: #ef4444; border: 2px solid #2b8ef3; border-radius: 99px; font-size: 10px; font-weight: 700; color: white; display: none; align-items: center; justify-content: center; padding: 0 4px; line-height: 1; }
|
||||
.notif-dropdown { position: absolute; top: calc(100% + 12px); right: 0; width: 340px; background: white; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05); z-index: 9998; opacity: 0; pointer-events: none; transform: translateY(-8px) scale(0.97); transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1); overflow: hidden; }
|
||||
.notif-dropdown.show { opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }
|
||||
.notif-head { padding: 16px 18px 12px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
|
||||
.notif-head-title { font-size: 14px; font-weight: 700; color: #0f1f3d; }
|
||||
.notif-head-count { font-size: 11px; color: #94a3b8; }
|
||||
.notif-list { max-height: 340px; overflow-y: auto; }
|
||||
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 18px; border-bottom: 1px solid #f8fafc; transition: background 0.15s; cursor: default; }
|
||||
.notif-item:hover { background: #f8faff; }
|
||||
.notif-item:last-child { border-bottom: none; }
|
||||
.notif-icon-wrap { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
|
||||
.notif-icon-materi { background: #e8f4ff; }
|
||||
.notif-icon-tugas { background: #fff7e6; }
|
||||
.notif-body { flex: 1; min-width: 0; }
|
||||
.notif-title { font-size: 12px; font-weight: 700; color: #0f1f3d; margin-bottom: 2px; }
|
||||
.notif-message { font-size: 12px; color: #475569; margin-bottom: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.notif-time { font-size: 10px; color: #94a3b8; white-space: nowrap; margin-top: 2px; }
|
||||
.notif-empty { padding: 32px 18px; text-align: center; }
|
||||
.notif-empty-icon { font-size: 36px; margin-bottom: 8px; }
|
||||
.notif-empty-text { font-size: 13px; color: #94a3b8; }
|
||||
|
||||
.topbar-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.5); cursor: pointer; transition: all 0.2s; display: block; }
|
||||
.topbar-avatar:hover { border-color: white; transform: scale(1.05); }
|
||||
|
|
@ -45,21 +69,15 @@
|
|||
.topbar-avatar-icon:hover { background: rgba(255,255,255,0.35); }
|
||||
.topbar-avatar-icon svg { width: 20px; height: 20px; stroke: white; }
|
||||
|
||||
.content { padding: 20px 30px; flex: 1; }
|
||||
|
||||
/* ── MODAL ── */
|
||||
.profile-modal-overlay { position: fixed; inset: 0; background: rgba(15,31,61,0.45); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
|
||||
.profile-modal-overlay.show { opacity: 1; pointer-events: all; }
|
||||
.profile-modal { background: white; border-radius: 24px; width: 100%; max-width: 440px; padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,0.18); transform: translateY(20px) scale(0.97); transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1); position: relative; max-height: 90vh; overflow-y: auto; }
|
||||
.profile-modal-overlay.show .profile-modal { transform: translateY(0) scale(1); }
|
||||
|
||||
.modal-close { position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; border-radius: 50%; background: #f1f5f9; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
|
||||
.modal-close:hover { background: #e2e8f0; }
|
||||
.modal-close svg { width: 16px; height: 16px; stroke: #64748b; }
|
||||
|
||||
.modal-title { font-size: 18px; font-weight: 800; color: #0d1b2e; margin-bottom: 4px; }
|
||||
.modal-subtitle { font-size: 13px; color: #94a3b8; margin-bottom: 22px; }
|
||||
|
||||
.foto-upload-area { display: flex; align-items: center; gap: 18px; background: #f8fafc; border-radius: 14px; padding: 14px 18px; margin-bottom: 18px; border: 1.5px dashed #e2e8f0; transition: border-color 0.2s; }
|
||||
.foto-upload-area:hover { border-color: #2b8ef3; }
|
||||
.foto-circle { width: 68px; height: 68px; border-radius: 50%; overflow: hidden; background: #e6f0ff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 3px solid #dbeeff; }
|
||||
|
|
@ -68,35 +86,26 @@
|
|||
.foto-info p { font-size: 12px; color: #94a3b8; margin: 0 0 7px; }
|
||||
.btn-pilih-foto { display: inline-block; background: #e6f0ff; color: #2b8ef3; font-size: 12px; font-weight: 700; padding: 7px 15px; border-radius: 8px; cursor: pointer; border: none; transition: background 0.2s; }
|
||||
.btn-pilih-foto:hover { background: #dbeeff; }
|
||||
|
||||
.modal-field { margin-bottom: 13px; }
|
||||
.modal-label { display: block; font-size: 11px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
|
||||
.modal-label span { color: #94a3b8; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 10px; margin-left: 4px; }
|
||||
.modal-input { width: 100%; background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 10px 13px; font-size: 14px; font-family: 'Poppins', sans-serif; color: #1e293b; outline: none; transition: all 0.2s; }
|
||||
.modal-input:focus { border-color: #2b8ef3; background: white; box-shadow: 0 0 0 3px rgba(43,142,243,0.1); }
|
||||
.modal-input:disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
|
||||
|
||||
.modal-divider { border: none; border-top: 1px solid #f1f5f9; margin: 16px 0; }
|
||||
|
||||
.btn-save-modal { width: 100%; background: linear-gradient(135deg,#2b8ef3,#1a7ae0); color: white; border: none; border-radius: 12px; padding: 13px; font-size: 14px; font-weight: 700; font-family: 'Poppins', sans-serif; cursor: pointer; transition: all 0.2s; box-shadow: 0 6px 18px rgba(43,142,243,0.3); }
|
||||
.btn-save-modal:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(43,142,243,0.35); }
|
||||
.btn-save-modal:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
|
||||
|
||||
.modal-toast { border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500; margin-bottom: 13px; display: none; }
|
||||
.modal-toast.success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; display: block; }
|
||||
.modal-toast.error { background: #fef2f2; border: 1.5px solid #fca5a5; color: #991b1b; display: block; }
|
||||
</style>
|
||||
|
||||
@stack('styles')
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="siswa-wrapper">
|
||||
|
||||
<aside class="sidebar collapsed" id="mainSidebar">
|
||||
<div class="sidebar-logo">
|
||||
<img src="{{ asset('images/logo/logosmk.png') }}" alt="Logo SMK">
|
||||
</div>
|
||||
<div class="sidebar-logo"><img src="{{ asset('images/logo/logosmk.png') }}" alt="Logo SMK"></div>
|
||||
<nav class="sidebar-menu">
|
||||
<a href="{{ route('siswa.dashboard') }}" class="sidebar-link {{ request()->routeIs('siswa.dashboard') ? 'active' : '' }}">
|
||||
<img src="{{ asset('images/icon/sidebar/home.png') }}" class="sidebar-icon" alt=""><span>Dashboard</span>
|
||||
|
|
@ -124,63 +133,54 @@
|
|||
<svg class="toggle-arrow" viewBox="0 0 24 24"><polyline points="15 18 9 12 15 6"></polyline></svg>
|
||||
</button>
|
||||
|
||||
<div class="main" id="mainContent">
|
||||
<div class="main">
|
||||
<header class="topbar">
|
||||
<div class="topbar-left">
|
||||
👋 Hai, {{ Auth::guard('siswa')->user()->nama ?? 'Siswa' }}
|
||||
</div>
|
||||
<div class="topbar-left">👋 Hai, {{ Auth::guard('siswa')->user()->nama ?? 'Siswa' }}</div>
|
||||
<div class="topbar-right">
|
||||
<img src="{{ asset('images/icon/sidebar/notif.png') }}" class="topbar-icon" alt="Notification">
|
||||
<div class="notif-wrap" id="notifWrap">
|
||||
<button class="notif-btn" id="notifBtn" onclick="toggleNotif(event)">
|
||||
<svg viewBox="0 0 24 24"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>
|
||||
</button>
|
||||
<div class="notif-badge" id="notifBadge"></div>
|
||||
<div class="notif-dropdown" id="notifDropdown">
|
||||
<div class="notif-head">
|
||||
<span class="notif-head-title">Notifikasi</span>
|
||||
<span class="notif-head-count" id="notifCount">7 hari terakhir</span>
|
||||
</div>
|
||||
<div class="notif-list" id="notifList">
|
||||
<div class="notif-empty"><div class="notif-empty-icon">🔔</div><div class="notif-empty-text">Memuat notifikasi...</div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php $siswa = Auth::guard('siswa')->user(); @endphp
|
||||
@if($siswa->foto_profil)
|
||||
<img src="{{ Storage::url($siswa->foto_profil) }}"
|
||||
class="topbar-avatar" id="topbar-foto"
|
||||
onclick="openProfileModal()" alt="Profil">
|
||||
<img src="{{ Storage::url($siswa->foto_profil) }}" class="topbar-avatar" id="topbar-foto" onclick="openProfileModal()" alt="Profil">
|
||||
@else
|
||||
<div class="topbar-avatar-icon" id="topbar-foto-icon" onclick="openProfileModal()">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/>
|
||||
</svg>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/></svg>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="content">
|
||||
@yield('content')
|
||||
</main>
|
||||
<main class="content">@yield('content')</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- PROFILE MODAL --}}
|
||||
<div class="profile-modal-overlay" id="profileModalOverlay" onclick="closeOnOverlay(event)">
|
||||
<div class="profile-modal">
|
||||
|
||||
<button class="modal-close" onclick="closeProfileModal()">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button class="modal-close" onclick="closeProfileModal()"><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>
|
||||
<div class="modal-title">Edit Profil</div>
|
||||
<div class="modal-subtitle">Perbarui foto profil dan password</div>
|
||||
|
||||
<div id="modal-toast" class="modal-toast"></div>
|
||||
|
||||
<form id="profile-form" enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
<div class="foto-upload-area">
|
||||
<div class="foto-circle">
|
||||
@if($siswa->foto_profil)
|
||||
<img src="{{ Storage::url($siswa->foto_profil) }}" id="modal-foto-preview" alt="">
|
||||
@else
|
||||
<svg id="modal-foto-icon" viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/>
|
||||
</svg>
|
||||
<img src="" id="modal-foto-preview" alt="" style="display:none">
|
||||
@endif
|
||||
@if($siswa->foto_profil) <img src="{{ Storage::url($siswa->foto_profil) }}" id="modal-foto-preview" alt="">
|
||||
@else <svg id="modal-foto-icon" viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/></svg>
|
||||
<img src="" id="modal-foto-preview" alt="" style="display:none"> @endif
|
||||
</div>
|
||||
<div class="foto-info">
|
||||
<p>JPG, PNG, WEBP · Maks. 2MB</p>
|
||||
|
|
@ -188,29 +188,11 @@ class="topbar-avatar" id="topbar-foto"
|
|||
<input type="file" name="foto_profil" id="modal-foto-input" accept="image/*" style="display:none">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">NISN <span>(tidak dapat diubah)</span></label>
|
||||
<input type="text" class="modal-input" value="{{ $siswa->nisn }}" disabled>
|
||||
</div>
|
||||
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">Nama Lengkap <span>(tidak dapat diubah)</span></label>
|
||||
<input type="text" class="modal-input" value="{{ $siswa->nama }}" disabled>
|
||||
</div>
|
||||
|
||||
<div class="modal-field"><label class="modal-label">NISN <span>(tidak dapat diubah)</span></label><input type="text" class="modal-input" value="{{ $siswa->nisn }}" disabled></div>
|
||||
<div class="modal-field"><label class="modal-label">Nama Lengkap <span>(tidak dapat diubah)</span></label><input type="text" class="modal-input" value="{{ $siswa->nama }}" disabled></div>
|
||||
<hr class="modal-divider">
|
||||
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">Password Baru <span>(kosongkan jika tidak ingin mengubah)</span></label>
|
||||
<input type="password" name="password" class="modal-input" placeholder="Password baru" autocomplete="new-password">
|
||||
</div>
|
||||
|
||||
<div class="modal-field">
|
||||
<label class="modal-label">Konfirmasi Password</label>
|
||||
<input type="password" name="password_confirmation" class="modal-input" placeholder="Ulangi password baru" autocomplete="new-password">
|
||||
</div>
|
||||
|
||||
<div class="modal-field"><label class="modal-label">Password Baru <span>(kosongkan jika tidak ingin mengubah)</span></label><input type="password" name="password" class="modal-input" placeholder="Password baru" autocomplete="new-password"></div>
|
||||
<div class="modal-field"><label class="modal-label">Konfirmasi Password</label><input type="password" name="password_confirmation" class="modal-input" placeholder="Ulangi password baru" autocomplete="new-password"></div>
|
||||
<button type="submit" class="btn-save-modal" id="btn-save">Simpan Perubahan</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -218,116 +200,49 @@ class="topbar-avatar" id="topbar-foto"
|
|||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
// Sidebar toggle
|
||||
const sidebar = document.getElementById('mainSidebar');
|
||||
const toggleBtn = document.getElementById('sidebarToggleBtn');
|
||||
const SIDEBAR_W = 260;
|
||||
const sidebar=document.getElementById('mainSidebar'),toggleBtn=document.getElementById('sidebarToggleBtn'),SIDEBAR_W=260;
|
||||
function updateTogglePosition(c){toggleBtn.style.left=c?'0px':SIDEBAR_W+'px';c?toggleBtn.classList.add('collapsed'):toggleBtn.classList.remove('collapsed');}
|
||||
toggleBtn.addEventListener('click',function(){const c=sidebar.classList.contains('collapsed');sidebar.classList.toggle('collapsed');updateTogglePosition(!c);});
|
||||
|
||||
function updateTogglePosition(isCollapsed) {
|
||||
toggleBtn.style.left = isCollapsed ? '0px' : SIDEBAR_W + 'px';
|
||||
isCollapsed ? toggleBtn.classList.add('collapsed') : toggleBtn.classList.remove('collapsed');
|
||||
const NOTIF_URL='{{ route("siswa.notifikasi") }}';
|
||||
const notifIcons={materi:'📖',tugas:'📝'};
|
||||
async function fetchNotif(){
|
||||
try{
|
||||
const res=await fetch(NOTIF_URL,{headers:{'X-CSRF-TOKEN':document.querySelector('meta[name="csrf-token"]').content}});
|
||||
const data=await res.json();
|
||||
const badge=document.getElementById('notifBadge'),list=document.getElementById('notifList'),count=document.getElementById('notifCount');
|
||||
badge.style.display=data.count>0?'flex':'none';
|
||||
if(data.count>0)badge.textContent=data.count>99?'99+':data.count;
|
||||
count.textContent=`${data.count} notifikasi`;
|
||||
list.innerHTML=data.notifications.length===0
|
||||
?`<div class="notif-empty"><div class="notif-empty-icon">🔔</div><div class="notif-empty-text">Tidak ada notifikasi baru</div></div>`
|
||||
:data.notifications.map(n=>`<div class="notif-item"><div class="notif-icon-wrap notif-icon-${n.type}">${notifIcons[n.type]??'🔔'}</div><div class="notif-body"><div class="notif-title">${n.title}</div><div class="notif-message">${n.message}</div><div class="notif-time">${n.time}</div></div></div>`).join('');
|
||||
}catch(e){}
|
||||
}
|
||||
function toggleNotif(e){e.stopPropagation();document.getElementById('notifDropdown').classList.toggle('show');}
|
||||
document.addEventListener('click',e=>{if(!document.getElementById('notifWrap').contains(e.target))document.getElementById('notifDropdown').classList.remove('show');});
|
||||
fetchNotif();setInterval(fetchNotif,30000);
|
||||
|
||||
toggleBtn.addEventListener('click', function () {
|
||||
const isCollapsed = sidebar.classList.contains('collapsed');
|
||||
sidebar.classList.toggle('collapsed');
|
||||
updateTogglePosition(!isCollapsed);
|
||||
});
|
||||
|
||||
// Modal
|
||||
function openProfileModal() {
|
||||
document.getElementById('profileModalOverlay').classList.add('show');
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
function closeProfileModal() {
|
||||
document.getElementById('profileModalOverlay').classList.remove('show');
|
||||
document.body.style.overflow = '';
|
||||
const toast = document.getElementById('modal-toast');
|
||||
toast.className = 'modal-toast';
|
||||
toast.textContent = '';
|
||||
}
|
||||
|
||||
function closeOnOverlay(e) {
|
||||
if (e.target === document.getElementById('profileModalOverlay')) closeProfileModal();
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeProfileModal(); });
|
||||
|
||||
// Foto preview
|
||||
document.getElementById('modal-foto-input').addEventListener('change', function () {
|
||||
const file = this.files[0];
|
||||
if (!file) return;
|
||||
const url = URL.createObjectURL(file);
|
||||
const preview = document.getElementById('modal-foto-preview');
|
||||
const icon = document.getElementById('modal-foto-icon');
|
||||
preview.src = url;
|
||||
preview.style.display = 'block';
|
||||
if (icon) icon.style.display = 'none';
|
||||
});
|
||||
|
||||
// AJAX submit
|
||||
document.getElementById('profile-form').addEventListener('submit', async function (e) {
|
||||
e.preventDefault();
|
||||
const btn = document.getElementById('btn-save');
|
||||
const toast = document.getElementById('modal-toast');
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Menyimpan...';
|
||||
|
||||
const formData = new FormData(this);
|
||||
|
||||
try {
|
||||
const res = await fetch('{{ route("siswa.profile.update") }}', {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content },
|
||||
body: formData,
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (data.success) {
|
||||
if (data.foto_url) {
|
||||
const topbarFoto = document.getElementById('topbar-foto');
|
||||
const topbarFotoIcon = document.getElementById('topbar-foto-icon');
|
||||
|
||||
if (topbarFoto) {
|
||||
topbarFoto.src = data.foto_url + '?t=' + Date.now();
|
||||
} else if (topbarFotoIcon) {
|
||||
const img = document.createElement('img');
|
||||
img.src = data.foto_url + '?t=' + Date.now();
|
||||
img.className = 'topbar-avatar';
|
||||
img.id = 'topbar-foto';
|
||||
img.onclick = openProfileModal;
|
||||
img.alt = 'Profil';
|
||||
topbarFotoIcon.replaceWith(img);
|
||||
}
|
||||
|
||||
const modalPreview = document.getElementById('modal-foto-preview');
|
||||
const modalIcon = document.getElementById('modal-foto-icon');
|
||||
if (modalPreview) { modalPreview.src = data.foto_url; modalPreview.style.display = 'block'; }
|
||||
if (modalIcon) modalIcon.style.display = 'none';
|
||||
}
|
||||
|
||||
toast.className = 'modal-toast success';
|
||||
toast.textContent = '✓ ' + data.message;
|
||||
this.querySelector('[name="password"]').value = '';
|
||||
this.querySelector('[name="password_confirmation"]').value = '';
|
||||
|
||||
} else {
|
||||
const errors = data.errors ? Object.values(data.errors).flat().join(' · ') : 'Terjadi kesalahan.';
|
||||
toast.className = 'modal-toast error';
|
||||
toast.textContent = errors;
|
||||
}
|
||||
} catch (err) {
|
||||
toast.className = 'modal-toast error';
|
||||
toast.textContent = 'Gagal terhubung ke server.';
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Simpan Perubahan';
|
||||
}
|
||||
function openProfileModal(){document.getElementById('profileModalOverlay').classList.add('show');document.body.style.overflow='hidden';}
|
||||
function closeProfileModal(){document.getElementById('profileModalOverlay').classList.remove('show');document.body.style.overflow='';const t=document.getElementById('modal-toast');t.className='modal-toast';t.textContent='';}
|
||||
function closeOnOverlay(e){if(e.target===document.getElementById('profileModalOverlay'))closeProfileModal();}
|
||||
document.addEventListener('keydown',e=>{if(e.key==='Escape')closeProfileModal();});
|
||||
document.getElementById('modal-foto-input').addEventListener('change',function(){const f=this.files[0];if(!f)return;const u=URL.createObjectURL(f);const p=document.getElementById('modal-foto-preview');const i=document.getElementById('modal-foto-icon');p.src=u;p.style.display='block';if(i)i.style.display='none';});
|
||||
document.getElementById('profile-form').addEventListener('submit',async function(e){
|
||||
e.preventDefault();const btn=document.getElementById('btn-save');const toast=document.getElementById('modal-toast');
|
||||
btn.disabled=true;btn.textContent='Menyimpan...';const fd=new FormData(this);
|
||||
try{
|
||||
const res=await fetch('{{ route("siswa.profile.update") }}',{method:'POST',headers:{'X-CSRF-TOKEN':document.querySelector('meta[name="csrf-token"]').content},body:fd});
|
||||
const data=await res.json();
|
||||
if(data.success){
|
||||
if(data.foto_url){const tf=document.getElementById('topbar-foto');const ti=document.getElementById('topbar-foto-icon');if(tf){tf.src=data.foto_url+'?t='+Date.now();}else if(ti){const img=document.createElement('img');img.src=data.foto_url+'?t='+Date.now();img.className='topbar-avatar';img.id='topbar-foto';img.onclick=openProfileModal;img.alt='Profil';ti.replaceWith(img);}const mp=document.getElementById('modal-foto-preview');const mi=document.getElementById('modal-foto-icon');if(mp){mp.src=data.foto_url;mp.style.display='block';}if(mi)mi.style.display='none';}
|
||||
toast.className='modal-toast success';toast.textContent='✓ '+data.message;
|
||||
this.querySelector('[name="password"]').value='';this.querySelector('[name="password_confirmation"]').value='';
|
||||
}else{const err=data.errors?Object.values(data.errors).flat().join(' · '):'Terjadi kesalahan.';toast.className='modal-toast error';toast.textContent=err;}
|
||||
}catch(err){toast.className='modal-toast error';toast.textContent='Gagal terhubung ke server.';}
|
||||
finally{btn.disabled=false;btn.textContent='Simpan Perubahan';}
|
||||
});
|
||||
</script>
|
||||
|
||||
@stack('scripts')
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
use App\Http\Controllers\Admin\LeaderboardController as AdminLeaderboardController;
|
||||
use App\Http\Controllers\Admin\ProfileController as AdminProfileController;
|
||||
use App\Http\Controllers\Admin\MateriTugasController as AdminMateriTugasController;
|
||||
use App\Http\Controllers\Admin\NotifikasiController as AdminNotifikasiController;
|
||||
|
||||
// GURU CONTROLLERS
|
||||
use App\Http\Controllers\Guru\LoginController as GuruLoginController;
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
use App\Http\Controllers\Guru\ProfileController as GuruProfileController;
|
||||
use App\Http\Controllers\Guru\MapelController as GuruMapelController;
|
||||
use App\Http\Controllers\Guru\LeaderboardController as GuruLeaderboardController;
|
||||
use App\Http\Controllers\Guru\NotifikasiController as GuruNotifikasiController;
|
||||
|
||||
//SISWA CONTROLLERS
|
||||
use App\Http\Controllers\Siswa\LoginController as SiswaLoginController;
|
||||
|
|
@ -34,6 +36,7 @@
|
|||
use App\Http\Controllers\Siswa\ChallengeController as SiswaChallengeController;
|
||||
use App\Http\Controllers\Siswa\LeaderboardController as SiswaLeaderboardController;
|
||||
use App\Http\Controllers\Siswa\ProfileController as SiswaProfileController;
|
||||
use App\Http\Controllers\Siswa\NotifikasiController as SiswaNotifikasiController;
|
||||
|
||||
// ====================
|
||||
// LANDING PAGE
|
||||
|
|
@ -82,43 +85,44 @@
|
|||
// =======================================================
|
||||
Route::middleware(['auth:admin'])->prefix('admin')->name('admin.')->group(function () {
|
||||
|
||||
// DASHBOARD
|
||||
Route::get('/dashboard', [AdminController::class, 'dashboard'])->name('dashboard');
|
||||
|
||||
Route::get('/notif', function () {
|
||||
return view('admin.notif');
|
||||
})->name('notif');
|
||||
|
||||
// PROFILE
|
||||
Route::get('/profile', [AdminProfileController::class, 'edit'])->name('profile.edit');
|
||||
Route::post('/profile', [AdminProfileController::class, 'updateAjax'])->name('profile.update');
|
||||
|
||||
// ── GURU ──────────────────────────────────────────────
|
||||
//GURU
|
||||
Route::get('/guru/kelas-by-mapel', [AdminGuruController::class, 'getKelasByMapel'])
|
||||
->name('guru.kelasByMapel');
|
||||
Route::resource('guru', AdminGuruController::class);
|
||||
|
||||
// ── SISWA / KELAS / MAPEL ─────────────────────────────
|
||||
//SISWA KELAS DAN MAPEL
|
||||
Route::resource('siswa', AdminSiswaController::class);
|
||||
Route::resource('kelas', AdminKelasController::class);
|
||||
Route::resource('mapel', AdminMapelController::class);
|
||||
|
||||
// ── HISTORY MATERI ────────────────────────────────────
|
||||
//HISTORI MATERI
|
||||
Route::get('/materi/history', [AdminMateriTugasController::class, 'historyMateri'])->name('materi.history');
|
||||
Route::delete('/materi/{id}', [AdminMateriTugasController::class, 'destroyMateri'])->name('materi.destroy');
|
||||
|
||||
// ── HISTORY TUGAS ─────────────────────────────────────
|
||||
//HISTRORY TUGAS
|
||||
Route::get('/tugas/history', [AdminMateriTugasController::class, 'historyTugas'])->name('tugas.history');
|
||||
Route::get('/tugas/{id}/detail', [AdminMateriTugasController::class, 'detailTugas'])->name('tugas.detail');
|
||||
Route::delete('/tugas/{id}', [AdminMateriTugasController::class, 'destroyTugas'])->name('tugas.destroy');
|
||||
|
||||
// ── CHALLENGE ─────────────────────────────────────────
|
||||
//CHALLENGE
|
||||
Route::get('/challenge/{id}/edit-data', [AdminChallengeController::class, 'editData'])
|
||||
->name('challenge.editData');
|
||||
Route::resource('challenge', AdminChallengeController::class);
|
||||
|
||||
// ── LEADERBOARD ───────────────────────────────────────
|
||||
//LEADERBOARD
|
||||
Route::resource('leaderboard', AdminLeaderboardController::class)->only(['index']);
|
||||
|
||||
// ── LOGOUT ────────────────────────────────────────────
|
||||
// NOTIF
|
||||
Route::get('/notifikasi', [AdminNotifikasiController::class, 'index'])->name('notifikasi');
|
||||
|
||||
//LOGOUT
|
||||
Route::post('/logout', [LoginController::class, 'logout'])->name('logout');
|
||||
|
||||
});
|
||||
|
|
@ -157,6 +161,8 @@
|
|||
Route::get('/profile', [GuruProfileController::class, 'edit'])->name('profile.edit');
|
||||
Route::post('/profile', [GuruProfileController::class, 'updateAjax'])->name('profile.update');
|
||||
|
||||
Route::get('/notifikasi', [GuruNotifikasiController::class, 'index'])->name('notifikasi');
|
||||
|
||||
// LOGOUT GURU
|
||||
Route::post('/logout', [GuruLoginController::class, 'logout'])->name('logout');
|
||||
});
|
||||
|
|
@ -190,6 +196,9 @@
|
|||
//PROFILE SISWA
|
||||
Route::get('/profile', [SiswaProfileController::class, 'edit'])->name('profile.edit');
|
||||
Route::post('/profile', [SiswaProfileController::class, 'updateAjax'])->name('profile.update');
|
||||
|
||||
// NOTIF
|
||||
Route::get('/notifikasi', [SiswaNotifikasiController::class, 'index'])->name('notifikasi');
|
||||
|
||||
// LOGOUT SISWA
|
||||
Route::post('/logout', [SiswaLoginController::class, 'logout'])->name('logout');
|
||||
|
|
|
|||
Loading…
Reference in New Issue