241 lines
13 KiB
PHP
241 lines
13 KiB
PHP
@extends('layouts.user')
|
|
|
|
@section('title', 'Formulir Pemesanan Foto - Florist dan Self Photo Studio Nganjuk')
|
|
|
|
@section('content')
|
|
<section class="section-formulirfoto">
|
|
<div class="container">
|
|
|
|
<div class="row mb-5 text-center">
|
|
<div class="col-12">
|
|
<h2 class="formulirfoto-page-title">Formulir Pemesanan</h2>
|
|
</div>
|
|
</div>
|
|
@if ($errors->any())
|
|
<div class="alert alert-danger">
|
|
<ul>
|
|
@foreach ($errors->all() as $error)
|
|
<li>{{ $error }}</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
<form action="{{ route('transaksi.foto.store') }}" method="POST" enctype="multipart/form-data">
|
|
@csrf
|
|
{{-- DATA DARI HALAMAN SEBELUMNYA (WAJIB ADA) --}}
|
|
<input type="hidden" name="id_paket" value="{{ $foto->id_paket }}">
|
|
<input type="hidden" name="tgl_booking" value="{{ $request->tgl_booking }}">
|
|
<input type="hidden" name="jam_mulai" value="{{ $request->jam_mulai ?? $request->jam_awal }}">
|
|
|
|
{{-- Loop untuk mengirim ulang data Add-ons yang dipilih --}}
|
|
@if (!empty($addonsDetails))
|
|
@foreach ($addonsDetails as $add)
|
|
<input type="hidden" name="addons[{{ $add['id'] }}]" value="{{ $add['qty'] }}">
|
|
@endforeach
|
|
@endif
|
|
<div class="row g-4">
|
|
|
|
<div class="col-lg-6 mb-5 mb-lg-0">
|
|
<h4 class="formulirfoto-section-title mb-3">Informasi Pemesan</h4>
|
|
<div class="formulirfoto-card d-flex flex-column gap-2">
|
|
|
|
<div>
|
|
<label class="form-label small">Nama Lengkap</label>
|
|
<input type="text" name="nama" class="form-control formulirfoto-input"
|
|
placeholder="Masukkan Nama Lengkap" required>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="form-label small">Nomor WhatsApp</label>
|
|
<input type="number" name="no_wa" class="form-control formulirfoto-input"
|
|
placeholder="Masukkan Nomor WhatsApp" required>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-lg-6">
|
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
|
<span class="timer-alert-text">Selesaikan pembayaran dalam</span>
|
|
<span class="timer-badge" id="countdown-timer">00:58:58</span>
|
|
</div>
|
|
<h4 class="formulirfoto-section-title mb-3">Informasi Pembayaran</h4>
|
|
|
|
<div class="formulirfoto-payment-box">
|
|
<div class="summary-item">
|
|
<span class="summary-label">Jadwal Booking:</span>
|
|
<div class="summary-row">
|
|
<span
|
|
class="summary-subtext">{{ \Carbon\Carbon::parse($request->tgl_booking)->translatedFormat('l, d F Y') }}</span>
|
|
<span class="summary-value">{{ $request->jam_mulai }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="summary-item">
|
|
<span class="summary-label">Paket Foto:</span>
|
|
<div class="summary-row">
|
|
<span class="summary-subtext">{{ $foto->nama }}</span>
|
|
<span class="summary-value">Rp {{ number_format($foto->harga, 0, ',', '.') }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="summary-item">
|
|
<span class="summary-label">Additional:</span>
|
|
@forelse($addonsDetails as $add)
|
|
<div class="summary-row">
|
|
<div class="row-left">
|
|
<span class="summary-subtext">{{ $add['nama'] }}</span>
|
|
<span class="summary-qty">x{{ $add['qty'] }}</span>
|
|
</div>
|
|
<span class="summary-value">Rp
|
|
{{ number_format($add['subtotal'], 0, ',', '.') }}</span>
|
|
</div>
|
|
@empty
|
|
<div class="summary-row">
|
|
<span class="summary-subtext text-muted">- Tidak ada tambahan -</span>
|
|
</div>
|
|
@endforelse
|
|
</div>
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<span class="text-muted">Total Pembayaran</span>
|
|
<h5 class=" mb-0">Rp {{ number_format($grandTotal, 0, ',', '.') }}</h5>
|
|
</div>
|
|
<p class="small mb-2">Transfer ke Rekening Berikut:</p>
|
|
<div class="row g-2 mb-4">
|
|
<div class="col-6">
|
|
<div class="formulirfoto-bank-card">
|
|
<div class="d-flex align-items-center gap-2 mb-2">
|
|
<i class="bi bi-bank text-secondary"></i> <span class="small">BCA</span>
|
|
</div>
|
|
<div class="d-flex justify-content-between align-items-end">
|
|
<div>
|
|
<p class="mb-0 small bank-num">1234567890</p>
|
|
<p class="mb-0 x-small bank-name">a.n Flo.do</p>
|
|
</div>
|
|
<button type="button"
|
|
class="btn btn-sm btn-outline-secondary py-1 px-3 x-small btn-copy"
|
|
data-clipboard-text="1234567890">salin</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="formulirbuket-bank-card">
|
|
<div class="d-flex align-items-center gap-2 mb-2">
|
|
<i class="bi bi-bank text-secondary"></i> <span class="small ">BRI</span>
|
|
</div>
|
|
<div class="d-flex justify-content-between align-items-end">
|
|
<div>
|
|
<p class="mb-0 small bank-num">0987654321</p>
|
|
<p class="mb-0 x-small bank-name">a.n Flo.do</p>
|
|
</div>
|
|
<button type="button"
|
|
class="btn btn-sm btn-outline-secondary py-1 px-3 x-small btn-copy"
|
|
data-clipboard-text="0987654321">salin</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p class="small mb-2">Upload Bukti Pembayaran</p>
|
|
<div class="formulirbuket-upload-area mb-2 text-center position-relative">
|
|
<input type="file"
|
|
class="position-absolute w-100 h-100 opacity-0 start-0 top-0 cursor-pointer"
|
|
name="bukti_bayar" accept="image/*" id="fileUpload">
|
|
<div class="py-4" id="uploadPlaceholder">
|
|
<i class="bi bi-file-earmark-arrow-up fs-3 text-secondary"></i>
|
|
<p class="mb-0 small text-muted">Upload Bukti Pembayaran</p>
|
|
<p class="mb-0 x-small text-muted">Max. 2 MB</p>
|
|
</div>
|
|
</div>
|
|
|
|
<p class="x-small text-muted mb-4">
|
|
*Note: Pastikan pembayaran sudah dilakukan sebelum mengunggah bukti, ya!
|
|
</p>
|
|
|
|
<div class="d-flex gap-3">
|
|
<a href="{{ route('booking.cancel') }}"
|
|
class="btn formulirfoto-btn-cancel flex-fill">Batalkan</a>
|
|
{{-- <a href="{{ route('detail.foto', $foto->id_paket) }}"
|
|
class="btn formulirfoto-btn-cancel flex-fill">Batalkan</a> --}}
|
|
<button type="submit" class="btn formulirfoto-btn-submit flex-fill">Kirim
|
|
Pesanan</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
// 1. FITUR COPY NO REK
|
|
document.querySelectorAll('.btn-copy').forEach(btn => {
|
|
btn.addEventListener('click', function() {
|
|
navigator.clipboard.writeText(this.getAttribute('data-clipboard-text'));
|
|
let originalText = this.innerText;
|
|
this.innerText = 'Disalin!';
|
|
setTimeout(() => {
|
|
this.innerText = originalText;
|
|
}, 1500);
|
|
});
|
|
});
|
|
|
|
// 2. FITUR PREVIEW UPLOAD
|
|
const fileInput = document.getElementById('fileUpload');
|
|
if (fileInput) {
|
|
fileInput.addEventListener('change', function() {
|
|
const file = this.files[0];
|
|
const placeholder = document.getElementById('uploadPlaceholder');
|
|
if (file) {
|
|
placeholder.innerHTML = `
|
|
<i class="bi bi-check-circle-fill fs-3 text-success"></i>
|
|
<p class="mb-0 small text-success fw-bold">${file.name}</p>
|
|
<p class="mb-0 x-small text-muted">Klik lagi untuk ganti file</p>
|
|
`;
|
|
// Optional: Kasih border hijau biar makin jelas
|
|
placeholder.parentElement.style.borderColor = "#198754";
|
|
placeholder.parentElement.style.backgroundColor = "#e8f5e9";
|
|
}
|
|
});
|
|
}
|
|
|
|
// 3. FITUR TIMER MUNDUR
|
|
let sisaDetik = {{ $sisaWaktu }};
|
|
let display = document.querySelector('#countdown-timer');
|
|
|
|
function startTimer(duration) {
|
|
let timer = duration,
|
|
hours, minutes, seconds;
|
|
|
|
let interval = setInterval(function() {
|
|
hours = parseInt(timer / 3600, 10);
|
|
minutes = parseInt((timer % 3600) / 60, 10);
|
|
seconds = parseInt(timer % 60, 10);
|
|
|
|
hours = hours < 10 ? "0" + hours : hours;
|
|
minutes = minutes < 10 ? "0" + minutes : minutes;
|
|
seconds = seconds < 10 ? "0" + seconds : seconds;
|
|
|
|
if (display) display.textContent = hours + ":" + minutes + ":" + seconds;
|
|
|
|
if (--timer < 0) {
|
|
clearInterval(interval);
|
|
alert("Waktu pembayaran habis!");
|
|
window.location.href =
|
|
"{{ route('booking.cancel') }}"; // Redirect ke cancel agar session bersih
|
|
}
|
|
}, 1000);
|
|
}
|
|
|
|
// Jalankan timer
|
|
if (sisaDetik > 0) {
|
|
startTimer(sisaDetik);
|
|
} else {
|
|
// Jaga-jaga kalau sisaDetik 0 pas load (redirect langsung)
|
|
window.location.href = "{{ route('booking.cancel') }}";
|
|
}
|
|
});
|
|
</script>
|
|
@endsection
|