diff --git a/app/Http/Controllers/Admin/AdminBookingController.php b/app/Http/Controllers/Admin/AdminBookingController.php index cd8027f..905747c 100644 --- a/app/Http/Controllers/Admin/AdminBookingController.php +++ b/app/Http/Controllers/Admin/AdminBookingController.php @@ -10,118 +10,120 @@ class AdminBookingController extends Controller { - /** - * Tampilkan daftar semua pesanan. - */ + const DP_PERCENTAGE = 0.5; // 50% dari total harga + public function index() { $bookings = Booking::latest()->paginate(15); return view('admin.bookings.index', compact('bookings')); } - /** - * Tampilkan detail pesanan. - */ public function show(string $id) { $booking = Booking::findOrFail($id); - return view('admin.bookings.show', compact('booking')); + $expectedDpAmount = $booking->total_price * self::DP_PERCENTAGE; + + return view('admin.bookings.show', compact('booking', 'expectedDpAmount')); } - /** - * Konfirmasi DP: simpan bukti, ubah status ke 'booked', lalu arahkan ke WhatsApp. - */ public function confirmDp(Request $request, $id) { $booking = Booking::findOrFail($id); + $expectedDpAmount = $booking->total_price * self::DP_PERCENTAGE; - // Validasi input $request->validate([ - 'dp_amount' => 'required|numeric|min:0', + 'dp_amount' => 'required|numeric|min:1', 'dp_proof' => 'required|image|max:2048', + ], [ + 'dp_amount.required' => 'Nominal DP wajib diisi.', + 'dp_amount.numeric' => 'Nominal DP harus berupa angka.', + 'dp_amount.min' => 'Nominal DP harus lebih dari 0.', + 'dp_proof.required' => 'Bukti transfer DP wajib diunggah.', + 'dp_proof.image' => 'File bukti harus berupa gambar.', + 'dp_proof.max' => 'Ukuran file maksimal 2MB.', ]); - // Simpan bukti DP + if ($request->dp_amount != $expectedDpAmount) { + return back()->withErrors([ + 'dp_amount' => "Nominal DP harus tepat Rp" . number_format($expectedDpAmount, 0, ',', '.') . " (50% dari total harga)." + ])->withInput(); + } + $path = $request->file('dp_proof')->store('bukti_dp', 'public'); - // Update data booking $booking->update([ 'dp_amount' => $request->dp_amount, 'dp_proof' => $path, 'status' => 'booked', ]); - // Set pesan sukses session()->flash('success', 'DP berhasil dikonfirmasi. Silakan kirim pesan ke pelanggan.'); - // Buat pesan WhatsApp $message = "Halo kak {$booking->contact_name},\n\n" . "Terima kasih, DP kamu untuk sesi {$booking->session_name} pada tanggal " . Carbon::parse($booking->booking_date)->translatedFormat('d F Y') . " pukul {$booking->booking_time} telah kami terima.\n" . "Pesananmu sudah dikonfirmasi ✅ Sampai jumpa di hari H!"; - // Format nomor WhatsApp (08xx → 628xx) $whatsappNumber = preg_replace('/[^0-9]/', '', $booking->whatsapp_number); if (str_starts_with($whatsappNumber, '0')) { $whatsappNumber = '62' . substr($whatsappNumber, 1); } - // ✅ URL BENAR: TANPA SPASI EKSTRA $url = 'https://wa.me/' . $whatsappNumber . '?text=' . urlencode($message); return redirect()->away($url); } - /** - * Selesaikan pesanan: simpan bukti pelunasan, ubah status ke 'completed', lalu arahkan ke WhatsApp. - */ public function completeBooking(Request $request, $id) { $booking = Booking::findOrFail($id); + $expectedFinalAmount = $booking->total_price - $booking->dp_amount; - // Validasi input $request->validate([ - 'final_payment_amount' => 'required|numeric|min:0', + 'final_payment_amount' => 'required|numeric|min:1', 'final_payment_proof' => 'required|image|max:2048', + ], [ + 'final_payment_amount.required' => 'Nominal pelunasan wajib diisi.', + 'final_payment_amount.numeric' => 'Nominal pelunasan harus berupa angka.', + 'final_payment_amount.min' => 'Nominal pelunasan harus lebih dari 0.', + 'final_payment_proof.required' => 'Bukti pelunasan wajib diunggah.', + 'final_payment_proof.image' => 'File bukti harus berupa gambar.', + 'final_payment_proof.max' => 'Ukuran file maksimal 2MB.', ]); - // Simpan bukti pelunasan + if ($request->final_payment_amount != $expectedFinalAmount) { + return back()->withErrors([ + 'final_payment_amount' => "Nominal pelunasan harus tepat Rp" . number_format($expectedFinalAmount, 0, ',', '.') . " (total - DP)." + ])->withInput(); + } + $path = $request->file('final_payment_proof')->store('bukti_pelunasan', 'public'); - // Update data booking $booking->update([ 'final_payment_amount' => $request->final_payment_amount, 'final_payment_proof' => $path, 'status' => 'completed', ]); - // Set pesan sukses session()->flash('success', 'Pelunasan berhasil dikonfirmasi.'); - // Buat pesan WhatsApp $message = "Halo kak {$booking->contact_name},\n\n" . "Kami telah menerima pelunasan untuk sesi {$booking->session_name} pada tanggal " . Carbon::parse($booking->booking_date)->translatedFormat('d F Y') . ".\n" . "Terima kasih telah mempercayakan layanan kami. See you next time! ❤️"; - // Format nomor WhatsApp $whatsappNumber = preg_replace('/[^0-9]/', '', $booking->whatsapp_number); if (str_starts_with($whatsappNumber, '0')) { $whatsappNumber = '62' . substr($whatsappNumber, 1); } - // ✅ URL BENAR: TANPA SPASI EKSTRA $url = 'https://wa.me/' . $whatsappNumber . '?text=' . urlencode($message); return redirect()->away($url); } - /** - * Hapus pesanan dan file bukti pembayaran. - */ public function destroy(Booking $booking) { - // Hapus file bukti jika ada if ($booking->dp_proof && Storage::disk('public')->exists($booking->dp_proof)) { Storage::disk('public')->delete($booking->dp_proof); } diff --git a/resources/css/app.css b/resources/css/app.css index ad6eeed..ba26713 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -61,6 +61,9 @@ select:focus[data-flux-control] { @apply outline-hidden ring-2 ring-accent ring-offset-2 ring-offset-accent-foreground; } + + + /* \[:where(&)\]:size-4 { @apply size-4; } */ diff --git a/resources/views/admin/backgrounds/create.blade.php b/resources/views/admin/backgrounds/create.blade.php index e10e223..fac9941 100644 --- a/resources/views/admin/backgrounds/create.blade.php +++ b/resources/views/admin/backgrounds/create.blade.php @@ -7,7 +7,23 @@ {{-- Meng-include partial form --}} @include('admin.backgrounds._form', ['background' => null]) + +
+

Tambah Background Baru

+
+
+ @csrf + + @include('admin.backgrounds._form', ['background' => null]) + +
+
+
+
diff --git a/resources/views/admin/backgrounds/index.blade.php b/resources/views/admin/backgrounds/index.blade.php index cbb1681..d0576ba 100644 --- a/resources/views/admin/backgrounds/index.blade.php +++ b/resources/views/admin/backgrounds/index.blade.php @@ -1,64 +1,138 @@ -
-
-

Manajemen Backgrounds

- - Tambah Background - -
- - @if(session('success')) - -
\ No newline at end of file diff --git a/resources/views/admin/bookings/show.blade.php b/resources/views/admin/bookings/show.blade.php index c500b04..163aedf 100644 --- a/resources/views/admin/bookings/show.blade.php +++ b/resources/views/admin/bookings/show.blade.php @@ -19,6 +19,17 @@ class="inline-flex items-center gap-2 bg-gray-200 hover:bg-gray-300 text-gray-80 @endif + + @if ($errors->any()) +
+ +
+ @endif +
@@ -42,7 +53,6 @@ class="inline-flex items-center gap-2 bg-gray-200 hover:bg-gray-300 text-gray-80 {{ $booking->session_name }} @endif

- @if($booking->session_name === 'baby-smash-cake')

Nama Bayi: {{ $booking->baby_name ?? '-' }}

@@ -60,12 +70,10 @@ class="inline-flex items-center gap-2 bg-gray-200 hover:bg-gray-300 text-gray-80 @endphp

@endif - @if($booking->session_name === 'group-photography')

Jumlah Orang: {{ $booking->group_size ?? '-' }}

@endif -

Paket: {{ $booking->package_name }}

Total: Rp{{ number_format($booking->total_price, 0, ',', '.') }}

Catatan: {{ $booking->notes ?? '—' }}

@@ -83,7 +91,6 @@ class="inline-flex items-center gap-2 bg-gray-200 hover:bg-gray-300 text-gray-80 @endforeach @endif - @if($booking->selected_extra_items)

Extra Item:

- \ No newline at end of file diff --git a/resources/views/admin/sdk/index.blade.php b/resources/views/admin/sdk/index.blade.php index aecdb85..7ce28a1 100644 --- a/resources/views/admin/sdk/index.blade.php +++ b/resources/views/admin/sdk/index.blade.php @@ -1,66 +1,105 @@ -
-
-

Daftar Syarat & Ketentuan

- - Tambah Baru +
+ + + @if (session('success')) -
\ No newline at end of file diff --git a/resources/views/components/layouts/app/header.blade.php b/resources/views/components/layouts/app/header.blade.php index 4d912e9..4de6c2b 100644 --- a/resources/views/components/layouts/app/header.blade.php +++ b/resources/views/components/layouts/app/header.blade.php @@ -1,126 +1,153 @@ - - - @include('partials.head') - - - - - - - - - - - - - - {{ __('Dashboard') }} - - - - - - - - - - - - - - - - - - - - + + @include('partials.head') + + + + + + + + + + + + + + + + + + + + + {{ __('Dashboard') }} + + + + + + + + + + + + + - - - -
-
- - - {{ auth()->user()->initials() }} - + + + + + + + + + + + + + + +
+
+ + + {{ auth()->user()->initials() }} - -
- {{ auth()->user()->name }} - {{ auth()->user()->email }} -
+
+
+ {{ auth()->user()->name }} + {{ auth()->user()->email }}
- - - - - - {{ __('Settings') }} - - - - -
- @csrf - - {{ __('Log Out') }} - -
- - - - - - - - - - - - - - - +
+
+ + + + + + {{ __('Settings') }} + + + + + +
+ @csrf + + {{ __('Log Out') }} + +
+
+
+ + + + + + + + + + + + + {{ __('Dashboard') }} - - - + + + - + - - + + {{ __('Repository') }} - + - + {{ __('Documentation') }} - - - + + + + +
{{ $slot }} - - @fluxScripts - - +
+ + @fluxScripts + + + + + \ No newline at end of file diff --git a/resources/views/components/layouts/app/sidebar.blade.php b/resources/views/components/layouts/app/sidebar.blade.php index bcc69f1..e63e518 100644 --- a/resources/views/components/layouts/app/sidebar.blade.php +++ b/resources/views/components/layouts/app/sidebar.blade.php @@ -1,5 +1,5 @@ - + @include('partials.head') diff --git a/resources/views/kategori/baby.blade.php b/resources/views/kategori/baby.blade.php index c87bc99..395e54f 100644 --- a/resources/views/kategori/baby.blade.php +++ b/resources/views/kategori/baby.blade.php @@ -1754,7 +1754,7 @@ function updateTotalPrice() { messageSpan.textContent = `⚠️ Hanya tersisa ${data.available_times.length} slot. Segera booking!`; infoBox.classList.add('limited'); } else { - messageSpan.textContent = `✅ Ada ${data.available_times.length} slot yang tersedia.`; + messageSpan.textContent = `Masih ada ${data.available_times.length} slot ( sesi waktu ) yang tersedia.`; infoBox.classList.add('available'); } }