Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter+sidebar #90

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Http/Controllers/DashboardRplController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Models\Siswa;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Models\Materi;
use Illuminate\Support\Facades\Auth;

class DashboardRplController extends Controller
Expand Down
13 changes: 11 additions & 2 deletions app/Http/Controllers/SiswaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@ class SiswaController extends Controller
public function index(Request $request)
{
$statusFilter = $request->get('status', 'all');
$kategoriFilter = $request->get('kategori', 'all'); // Default 'all'
$userId = Auth::id();

// Query dasar untuk data siswa
$siswaQuery = Siswa::where('user_id', $userId);

// Filter status jika tidak "all"
if ($statusFilter !== 'all') {
$siswaQuery->where('status', $statusFilter);
}

// Filter kategori jika tidak "all"
if ($kategoriFilter !== 'all') {
$siswaQuery->where('kategori', $kategoriFilter);
}

// Proses data siswa dan hitung total waktu
$siswa = $siswaQuery->orderBy('created_at', 'desc')->get()->map(function ($item) {
if ($item->waktu_mulai && $item->waktu_selesai) {
$waktuMulai = Carbon::parse($item->waktu_mulai);
Expand All @@ -38,7 +47,7 @@ public function index(Request $request)
$aktivitas = Aktivitas::all();
$materitkj = Materi::where('jurusan', 'TKJ')->get();

return view('monitoring_siswa.siswa', compact('siswa', 'materitkj', 'aktivitas', 'statusFilter'));
return view('monitoring_siswa.siswa', compact('siswa', 'materitkj', 'aktivitas', 'statusFilter', 'kategoriFilter'));
}

public function updateTime(Request $request, $id)
Expand Down Expand Up @@ -67,7 +76,7 @@ public function updateTime(Request $request, $id)
}

$currentDate = Carbon::parse($item->waktu_mulai)->format('Y-m-d');
$newWaktuSelesai = $currentDate.' '.$request->waktu_selesai;
$newWaktuSelesai = $currentDate . ' ' . $request->waktu_selesai;

$item->update([
'waktu_selesai' => $newWaktuSelesai,
Expand Down
18 changes: 14 additions & 4 deletions resources/views/components/app/navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@
<h6 class="font-weight-bold mb-0">Dashboard</h6>
</nav>
<div class="collapse navbar-collapse mt-sm-0 mt-2 me-md-0 me-sm-4" id="navbar">
<div class="ms-md-auto pe-md-1 d-flex align-items-center mb-0 font-weight-bold breadcrumb-text text-white">
<div class="ms-md-auto pe-md-1 d-flex align-items-center mb-0 gap-2 font-weight-bold breadcrumb-text text-white">
<!-- Sidebar Button -->
<li class="nav-item d-xl-none ps-3 me-3 d-flex align-items-center">
<a href="javascript:;" class="nav-link text-body p-0" id="iconNavbarSidenav">
<div class="sidenav-toggler-inner">
<i class="sidenav-toggler-line"></i>
<i class="sidenav-toggler-line"></i>
<i class="sidenav-toggler-line"></i>
</div>
</a>
</li>
<!-- Logout Form -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<a href="login" onclick="event.preventD efault();
this.closest('form').submit();">
<button class="btn btn-sm btn-white mb-0 me-1" type="submit">Log out</button>
<a href="login" onclick="event.preventDefault(); this.closest('form').submit();">
<button class="btn btn-sm btn-white mb-0 me-1" type="submit">Log out</button>
</a>
</form>
</div>
Expand Down
113 changes: 57 additions & 56 deletions resources/views/components/app/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,64 @@
<div class="collapse navbar-collapse px-4 w-auto " id="sidenav-collapse-main">
<ul class="navbar-nav">
@if (Auth::user()->jurusan === 'TKJ')
<li class="nav-item">
<a class="nav-link {{ Request::is('dashboardsiswa') ? 'active' : '' }}" href="{{ route('dashboardsiswa.index') }}">
<div
class="icon icon-shape icon-sm px-0 text-center d-flex align-items-center justify-content-center">
<svg width="30px" height="30px" viewBox="0 0 48 48" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>dashboard</title>
<g id="dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="template" transform="translate(12.000000, 12.000000)" fill="#FFFFFF"
fill-rule="nonzero">
<path class="color-foreground"
d="M0,1.71428571 C0,0.76752 0.76752,0 1.71428571,0 L22.2857143,0 C23.2325143,0 24,0.76752 24,1.71428571 L24,5.14285714 C24,6.08962286 23.2325143,6.85714286 22.2857143,6.85714286 L1.71428571,6.85714286 C0.76752,6.85714286 0,6.08962286 0,5.14285714 L0,1.71428571 Z"
id="Path"></path>
<path class="color-background"
d="M0,12 C0,11.0532171 0.76752,10.2857143 1.71428571,10.2857143 L12,10.2857143 C12.9468,10.2857143 13.7142857,11.0532171 13.7142857,12 L13.7142857,22.2857143 C13.7142857,23.2325143 12.9468,24 12,24 L1.71428571,24 C0.76752,24 0,23.2325143 0,22.2857143 L0,12 Z"
id="Path"></path>
<path class="color-background"
d="M18.8571429,10.2857143 C17.9103429,10.2857143 17.1428571,11.0532171 17.1428571,12 L17.1428571,22.2857143 C17.1428571,23.2325143 17.9103429,24 18.8571429,24 L22.2857143,24 C23.2325143,24 24,23.2325143 24,22.2857143 L24,12 C24,11.0532171 23.2325143,10.2857143 22.2857143,10.2857143 L18.8571429,10.2857143 Z"
id="Path"></path>
</g>
</g>
</svg>
</div>
<span class="nav-link-text ms-1">Dashboard</span>
</a>
</li>
@endif
<li class="nav-item">
<a class="nav-link {{ Request::is('dashboardsiswa') ? 'active' : '' }}"
href="{{ route('dashboardsiswa.index') }}">
<div
class="icon icon-shape icon-sm px-0 text-center d-flex align-items-center justify-content-center">
<svg width="30px" height="30px" viewBox="0 0 48 48" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>dashboard</title>
<g id="dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="template" transform="translate(12.000000, 12.000000)" fill="#FFFFFF"
fill-rule="nonzero">
<path class="color-foreground"
d="M0,1.71428571 C0,0.76752 0.76752,0 1.71428571,0 L22.2857143,0 C23.2325143,0 24,0.76752 24,1.71428571 L24,5.14285714 C24,6.08962286 23.2325143,6.85714286 22.2857143,6.85714286 L1.71428571,6.85714286 C0.76752,6.85714286 0,6.08962286 0,5.14285714 L0,1.71428571 Z"
id="Path"></path>
<path class="color-background"
d="M0,12 C0,11.0532171 0.76752,10.2857143 1.71428571,10.2857143 L12,10.2857143 C12.9468,10.2857143 13.7142857,11.0532171 13.7142857,12 L13.7142857,22.2857143 C13.7142857,23.2325143 12.9468,24 12,24 L1.71428571,24 C0.76752,24 0,23.2325143 0,22.2857143 L0,12 Z"
id="Path"></path>
<path class="color-background"
d="M18.8571429,10.2857143 C17.9103429,10.2857143 17.1428571,11.0532171 17.1428571,12 L17.1428571,22.2857143 C17.1428571,23.2325143 17.9103429,24 18.8571429,24 L22.2857143,24 C23.2325143,24 24,23.2325143 24,22.2857143 L24,12 C24,11.0532171 23.2325143,10.2857143 22.2857143,10.2857143 L18.8571429,10.2857143 Z"
id="Path"></path>
</g>
</g>
</svg>
</div>
<span class="nav-link-text ms-1">Dashboard</span>
</a>
</li>
@endif

@if (Auth::user()->jurusan === 'RPL')

<li class="nav-item">
<a class="nav-link {{ Request::is('dashboardrpl') ? 'active' : '' }}" href="{{ route('dashboardrpl.index') }}">
<div
class="icon icon-shape icon-sm px-0 text-center d-flex align-items-center justify-content-center">
<svg width="30px" height="30px" viewBox="0 0 48 48" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>dashboard</title>
<g id="dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="template" transform="translate(12.000000, 12.000000)" fill="#FFFFFF"
fill-rule="nonzero">
<path class="color-foreground"
d="M0,1.71428571 C0,0.76752 0.76752,0 1.71428571,0 L22.2857143,0 C23.2325143,0 24,0.76752 24,1.71428571 L24,5.14285714 C24,6.08962286 23.2325143,6.85714286 22.2857143,6.85714286 L1.71428571,6.85714286 C0.76752,6.85714286 0,6.08962286 0,5.14285714 L0,1.71428571 Z"
id="Path"></path>
<path class="color-background"
d="M0,12 C0,11.0532171 0.76752,10.2857143 1.71428571,10.2857143 L12,10.2857143 C12.9468,10.2857143 13.7142857,11.0532171 13.7142857,12 L13.7142857,22.2857143 C13.7142857,23.2325143 12.9468,24 12,24 L1.71428571,24 C0.76752,24 0,23.2325143 0,22.2857143 L0,12 Z"
id="Path"></path>
<path class="color-background"
d="M18.8571429,10.2857143 C17.9103429,10.2857143 17.1428571,11.0532171 17.1428571,12 L17.1428571,22.2857143 C17.1428571,23.2325143 17.9103429,24 18.8571429,24 L22.2857143,24 C23.2325143,24 24,23.2325143 24,22.2857143 L24,12 C24,11.0532171 23.2325143,10.2857143 22.2857143,10.2857143 L18.8571429,10.2857143 Z"
id="Path"></path>
</g>
</g>
</svg>
</div>
<span class="nav-link-text ms-1">Dashboard</span>
</a>
</li>
@endif
@if (Auth::user()->jurusan === 'RPL')
<li class="nav-item">
<a class="nav-link {{ Request::is('dashboardrpl') ? 'active' : '' }}"
href="{{ route('dashboardrpl.index') }}">
<div
class="icon icon-shape icon-sm px-0 text-center d-flex align-items-center justify-content-center">
<svg width="30px" height="30px" viewBox="0 0 48 48" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>dashboard</title>
<g id="dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="template" transform="translate(12.000000, 12.000000)" fill="#FFFFFF"
fill-rule="nonzero">
<path class="color-foreground"
d="M0,1.71428571 C0,0.76752 0.76752,0 1.71428571,0 L22.2857143,0 C23.2325143,0 24,0.76752 24,1.71428571 L24,5.14285714 C24,6.08962286 23.2325143,6.85714286 22.2857143,6.85714286 L1.71428571,6.85714286 C0.76752,6.85714286 0,6.08962286 0,5.14285714 L0,1.71428571 Z"
id="Path"></path>
<path class="color-background"
d="M0,12 C0,11.0532171 0.76752,10.2857143 1.71428571,10.2857143 L12,10.2857143 C12.9468,10.2857143 13.7142857,11.0532171 13.7142857,12 L13.7142857,22.2857143 C13.7142857,23.2325143 12.9468,24 12,24 L1.71428571,24 C0.76752,24 0,23.2325143 0,22.2857143 L0,12 Z"
id="Path"></path>
<path class="color-background"
d="M18.8571429,10.2857143 C17.9103429,10.2857143 17.1428571,11.0532171 17.1428571,12 L17.1428571,22.2857143 C17.1428571,23.2325143 17.9103429,24 18.8571429,24 L22.2857143,24 C23.2325143,24 24,23.2325143 24,22.2857143 L24,12 C24,11.0532171 23.2325143,10.2857143 22.2857143,10.2857143 L18.8571429,10.2857143 Z"
id="Path"></path>
</g>
</g>
</svg>
</div>
<span class="nav-link-text ms-1">Dashboard</span>
</a>
</li>
@endif

@if (Auth::user()->jurusan === 'TKJ')
<li class="nav-item">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard_siswa.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</style>
{{-- Navbar --}}
<x-app.navbar />

{{-- Main Container --}}
<div class="container-fluid py-4 px-5">
{{-- Header Section --}}
Expand Down Expand Up @@ -204,6 +203,7 @@ class="btn btn-sm btn-outline-dark d-flex align-items-center me-2">
{{-- Footer --}}
<x-app.footer />
</div>
</div>
</main>

{{-- Chart.js Script --}}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboardrpl.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-app-layout>
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg">

<x-app.navbar />
<x-app.navbar/>

<div class="container-fluid py-4 px-5">
<h3 class="font-weight-bold mb-0">Hi, {{ auth()->user()->username }}</h3>
Expand Down
Loading
Loading