From 6873f94b8347ae1962c64c92ce33109a221ce028 Mon Sep 17 00:00:00 2001 From: Stephen Gesityan Date: Thu, 5 Jun 2025 01:57:25 +0700 Subject: [PATCH] Checkpoint --- .../admin/AdminProfileController.php | 73 +++ .../Controllers/admin/BookingsController.php | 2 +- .../Controllers/admin/TableController.php | 2 +- .../views/admin/bookings/index.blade.php | 6 +- resources/views/admin/profile/index.blade.php | 177 ++++++ resources/views/layouts/admin.blade.php | 6 +- resources/views/layouts/super-admin.blade.php | 326 ++++++----- .../views/superadmin/dashboard.blade.php | 507 ++++++++++-------- routes/web.php | 5 + 9 files changed, 702 insertions(+), 402 deletions(-) create mode 100644 app/Http/Controllers/admin/AdminProfileController.php create mode 100644 resources/views/admin/profile/index.blade.php diff --git a/app/Http/Controllers/admin/AdminProfileController.php b/app/Http/Controllers/admin/AdminProfileController.php new file mode 100644 index 0000000..c0fb75f --- /dev/null +++ b/app/Http/Controllers/admin/AdminProfileController.php @@ -0,0 +1,73 @@ +validate([ + 'name' => 'required|string|max:255', + 'email' => [ + 'required', + 'string', + 'email', + 'max:255', + Rule::unique('users')->ignore($user->id), + ], + ]); + + $user->update([ + 'name' => $request->name, + 'email' => $request->email, + ]); + + return redirect()->route('admin.profile.index') + ->with('success', 'Profile berhasil diperbarui.'); + } + + /** + * Update the admin password. + */ + public function updatePassword(Request $request) + { + $request->validate([ + 'current_password' => 'required', + 'password' => 'required|string|min:8|confirmed', + ]); + + $user = Auth::user(); + + // Check if current password is correct + if (!Hash::check($request->current_password, $user->password)) { + return back()->withErrors(['current_password' => 'Password saat ini tidak sesuai.']); + } + + $user->update([ + 'password' => Hash::make($request->password), + ]); + + return redirect()->route('admin.profile.index') + ->with('success', 'Password berhasil diperbarui.'); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/admin/BookingsController.php b/app/Http/Controllers/admin/BookingsController.php index 372593b..004904f 100644 --- a/app/Http/Controllers/admin/BookingsController.php +++ b/app/Http/Controllers/admin/BookingsController.php @@ -63,7 +63,7 @@ public function index(Request $request) $query->orderBy($sortColumn, $sortDirection); } - $bookings = $query->paginate(10)->withQueryString(); + $bookings = $query->paginate(20)->withQueryString(); return view('admin.bookings.index', compact('bookings')); } diff --git a/app/Http/Controllers/admin/TableController.php b/app/Http/Controllers/admin/TableController.php index 454d8fe..f6bceba 100644 --- a/app/Http/Controllers/admin/TableController.php +++ b/app/Http/Controllers/admin/TableController.php @@ -29,7 +29,7 @@ public function index(Request $request) $query->where('status', $request->status); } - $tables = $query->latest()->paginate(10); + $tables = $query->orderBy('created_at', 'asc')->paginate(10); return view('admin.tables.index', compact('tables')); } diff --git a/resources/views/admin/bookings/index.blade.php b/resources/views/admin/bookings/index.blade.php index 02cf085..62950e8 100644 --- a/resources/views/admin/bookings/index.blade.php +++ b/resources/views/admin/bookings/index.blade.php @@ -251,13 +251,13 @@ class="inline">
-
+
Menampilkan {{ $bookings->firstItem() ?? 0 }} - {{ $bookings->lastItem() ?? 0 }} dari {{ $bookings->total() }} data
-
- {{ $bookings->appends(request()->query())->links() }} +
+ {{ $bookings->appends(request()->query())->onEachSide(1)->links() }}
diff --git a/resources/views/admin/profile/index.blade.php b/resources/views/admin/profile/index.blade.php new file mode 100644 index 0000000..e76ba9e --- /dev/null +++ b/resources/views/admin/profile/index.blade.php @@ -0,0 +1,177 @@ +@extends('layouts.admin') + +@section('content') +
+ +
+

Pengaturan Profile

+

Kelola informasi akun dan keamanan Anda

+
+ + + @if(session('success')) +
+ {{ session('success') }} +
+ @endif + +
+ +
+
+

Informasi Profile

+

Perbarui informasi dasar akun Anda

+
+ +
+ @csrf + @method('PUT') + + +
+
+ {{ substr($user->name, 0, 1) }} +
+
+

{{ $user->name }}

+

{{ ucfirst($user->role) }}

+ @if($user->venue) +

{{ $user->venue->name }}

+ @endif +
+
+ + +
+ + + @error('name') +

{{ $message }}

+ @enderror +
+ + +
+ + + @error('email') +

{{ $message }}

+ @enderror +
+ + +
+

Informasi Akun

+
+

Role: {{ ucfirst($user->role) }}

+

Bergabung: {{ $user->created_at->format('d M Y') }}

+ @if($user->email_verified_at) +

Status Email: + ✓ Terverifikasi +

+ @else +

Status Email: + ✗ Belum Terverifikasi +

+ @endif +
+
+ + + +
+
+ + +
+
+

Ubah Password

+

Pastikan akun Anda menggunakan password yang kuat

+
+ +
+ @csrf + @method('PUT') + + +
+ + + @error('current_password') +

{{ $message }}

+ @enderror +
+ + +
+ + + @error('password') +

{{ $message }}

+ @enderror +
+ + +
+ + +
+ + +
+

Persyaratan Password:

+
    +
  • • Minimal 8 karakter
  • +
  • • Kombinasi huruf besar dan kecil
  • +
  • • Minimal satu angka
  • +
  • • Minimal satu karakter khusus
  • +
+
+ + + +
+
+
+ + +
+
+ + + +
+

Tips Keamanan

+

+ Selalu gunakan password yang unik dan kuat. Jangan bagikan informasi login Anda kepada siapa pun. + Jika Anda mencurigai adanya aktivitas yang tidak biasa, segera ubah password Anda. +

+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/layouts/admin.blade.php b/resources/views/layouts/admin.blade.php index 6177508..6cddc7e 100644 --- a/resources/views/layouts/admin.blade.php +++ b/resources/views/layouts/admin.blade.php @@ -189,8 +189,10 @@ class="ml-auto h-4 w-4 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="cu