From 338d089fca33be03e446434891de4bd77dba0ac6 Mon Sep 17 00:00:00 2001 From: MufridaFaraDiani27 Date: Fri, 15 May 2026 23:51:40 +0700 Subject: [PATCH] periode --- app/Http/Controllers/DashboardController.php | 34 ++++++-- resources/views/auth/login.blade.php | 37 ++++++++ resources/views/dashboard.blade.php | 37 +++++--- resources/views/ulasan/index.blade.php | 4 +- scraper/scraping_pipeline.py | 89 +++++++++++++++++--- 5 files changed, 164 insertions(+), 37 deletions(-) diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index b2a626c..ece5381 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -66,6 +66,13 @@ public function index(Request $request) $wisata = $tab === 'analisis' ? $request->wisata : null; $destinasi = $tab === 'rekomendasi' ? $request->destinasi : null; + // ================================================================ + // PERIODE BULAN YANG DIPILIH + // ================================================================ + $periodeBulan = $request->input('periode_bulan', now()->format('Y-m')); + + [$tahun, $bulan] = explode('-', $periodeBulan); + // ================================================================ // AMBIL SEMUA PERIODE & PERIODE AKTIF // ================================================================ @@ -83,11 +90,21 @@ public function index(Request $request) ->orderBy('p.id', 'desc') ->select('p.*') ->get(); - $availablePeriodeIds = $periodeList->pluck('id')->map(fn($id) => (string) $id); - $periodeAktif = $request->periode_id && $availablePeriodeIds->contains((string) $request->periode_id) - ? $periodeList->firstWhere('id', (int) $request->periode_id) - : $periodeList->first(); - $periodeId = $periodeAktif->id ?? null; + + // Cocokkan pakai kolom bulan & tahun + $periodeAktif = $periodeList->first(function ($p) use ($tahun, $bulan) { + return $p->tahun == (int)$tahun && $p->bulan == (int)$bulan; + }); + + // Jika tidak ada data di bulan tsb + $noDataPesan = null; + if (!$periodeAktif) { + $namaBulanDipilih = \Carbon\Carbon::createFromDate($tahun, $bulan, 1) + ->locale('id')->isoFormat('MMMM YYYY'); + $noDataPesan = "Tidak ada data untuk bulan {$namaBulanDipilih}."; + } + + $periodeId = $periodeAktif->id ?? null; $evaluasi = DB::table('evaluasi_model') ->when($periodeId, fn($q) => $q->where('periode_id', $periodeId)) @@ -345,8 +362,9 @@ public function index(Request $request) 'kataDominan', 'saranPerbaikan', 'prioritas', - 'periodeList', // ← tambahan - 'periodeAktif', // ← tambahan + 'periodeList', + 'periodeAktif', + 'noDataPesan', // ← tambahan baru ))->with([ 'scraperDestinations' => $this->scraperDestinations(), ]); @@ -361,4 +379,4 @@ private function scraperDestinations(): array 'Kebun Teh Gunung Gambir', ]; } -} +} \ No newline at end of file diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 57a047a..03d305b 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -237,6 +237,43 @@ width:150px; } } + +@media(max-width:900px){ + .container{ + flex-direction:column; + height:auto; + } + + .left{ + width:100%; + padding:40px; + } + + .right{ + width:100%; + height:260px; + } + + .overlay p{ + font-size:20px; + } + + .logo img{ + width:150px; + } +} + +/* HILANGKAN ICON PASSWORD BAWAAN BROWSER */ +input[type="password"]::-ms-reveal, +input[type="password"]::-ms-clear { + display: none; +} + +input::-ms-reveal, +input::-ms-clear { + display: none; +} + diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index c09859c..3b1459b 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -15,6 +15,14 @@ {{ session('error') }} @endif + + {{-- PESAN TIDAK ADA DATA --}} + @if($noDataPesan ?? null) +
+ 📅 {{ $noDataPesan }} +
+ @endif + @if($periodeAktif && !$hasAnalisis)
Data ulasan sudah tersedia, tetapi belum dilakukan analisis sentimen. @@ -36,20 +44,21 @@ Terakhir update: {{ $lastUpdate ? \Carbon\Carbon::parse($lastUpdate)->format('d M Y H:i') : '-' }} @endif -
- @csrf - - + + {{-- HAPUS hidden periode_id, pakai periode_bulan saja --}} + + - - + + +
@@ -335,4 +344,4 @@ class="flex-1 py-3 rounded-lg text-sm font-medium transition"> }); -@endsection +@endsection \ No newline at end of file diff --git a/resources/views/ulasan/index.blade.php b/resources/views/ulasan/index.blade.php index 426718d..f4f3a74 100644 --- a/resources/views/ulasan/index.blade.php +++ b/resources/views/ulasan/index.blade.php @@ -17,7 +17,9 @@
@csrf -