@vite(['resources/css/app.css', 'resources/js/app.js']) @livewireStyles
@php $customerSession = session('customer_session'); $isCustomerLoggedIn = $customerSession && isset($customerSession['expires_at']) && now()->timestamp < $customerSession['expires_at']; $pendingOrders = collect(); $closestActiveRental = null; if ($isCustomerLoggedIn) { $pendingOrders = \App\Models\Rental::with('units') ->where('nik', $customerSession['nik']) ->where('no_wa', $customerSession['no_wa']) ->where('status', 'pending') ->latest() ->get(); $onlinePendingTotal = $pendingOrders->where('metode_pembayaran', '!=', 'cash')->count(); $cashPendingTotal = $pendingOrders->where('metode_pembayaran', 'cash')->count(); $closestActiveRental = \App\Models\Rental::where('nik', $customerSession['nik']) ->where('no_wa', $customerSession['no_wa']) ->where('status', 'paid') ->where('waktu_selesai', '>', now()) ->orderBy('waktu_selesai', 'asc') ->first(); } $statsTotalRentals = \App\Models\Rental::count(); $statsTotalUsers = \App\Models\Rental::distinct('nik')->count('nik'); $statsTotalHours = round(\App\Models\Rental::whereNotNull('waktu_mulai')->whereNotNull('waktu_selesai')->get()->sum(function ($r) { return \Carbon\Carbon::parse($r->waktu_mulai)->diffInHours(\Carbon\Carbon::parse($r->waktu_selesai)); })); // Fallbacks for empty DB $statsTotalRentals = $statsTotalRentals > 0 ? $statsTotalRentals : 1; $statsTotalUsers = $statsTotalUsers > 0 ? $statsTotalUsers : 1; $statsTotalHours = $statsTotalHours > 0 ? $statsTotalHours : 24; @endphp
@if($isCustomerLoggedIn && $closestActiveRental) @php $selesaiHeroTimestamp = $closestActiveRental->waktu_selesai->timestamp * 1000; @endphp
@endif
RENT SPACE PURWOKERTO

{!! nl2br(e(\App\Models\Setting::getVal('home_title', "Sewa iPhone Impian Anda\nLebih Mudah & Terjangkau."))) !!}

{{ \App\Models\Setting::getVal('home_description', 'Pilihan terbaik untuk merasakan pengalaman menggunakan produk Apple original tanpa harus membeli baru. Proses cepat, stok terlihat transparan, dan langsung transaksi!') }}

Transaksi +
Pelanggan +
Jam Disewa +
{{-- Customer Session Banner --}} @if($isCustomerLoggedIn && $pendingOrders->count() > 0) {{-- Pending Payment Banner (Amber) --}}

{{ $onlinePendingTotal > 0 ? 'Pesanan Menunggu Pembayaran' : 'Pesanan Menunggu Pembayaran di Lokasi' }}

Anda memiliki {{ $pendingOrders->count() }} pesanan {{ $onlinePendingTotal > 0 ? 'yang belum dibayar' : 'dengan metode bayar di tempat' }}.

@elseif($isCustomerLoggedIn && $closestActiveRental) {{-- Active Rental Banner with Countdown (Green) --}} @php $selesaiTimestamp = $closestActiveRental->waktu_selesai->timestamp * 1000; @endphp

KODE {{ $closestActiveRental->booking_code }}

@elseif($isCustomerLoggedIn) {{-- Logged In but No Active/Pending Banner (Blue) --}}

Sesi Peminjam Aktif

Akses pesanan lebih cepat karena Anda sudah masuk.

@elseif(!$isCustomerLoggedIn) {{-- Login CTA for guests --}}

Sudah pernah booking?

Masuk untuk melihat status pesanan dan notifikasi pembayaran Anda.

Masuk
@endif {{-- End Customer Session Banner --}}

Promo Spesial Aktif

Promo yang tersedia pada saat ini.

@php $now = \Carbon\Carbon::now(); $promos = \App\Models\PricingRule::where('is_active', true) ->where('is_hidden', false) ->where(function ($q) use ($now) { $q->whereNull('start_date')->orWhere('start_date', '<=', $now->format('Y-m-d')); }) ->where(function ($q) use ($now) { $q->whereNull('end_date')->orWhere('end_date', '>=', $now->format('Y-m-d')); }) ->get(); @endphp @if($promos->count() > 0) @endif

Katalog Harga Sewa

Pilih unit terbaik yang sesuai dengan kebutuhan dan budget Anda.

@php $categorizedUnits = \App\Models\Unit::with('category') ->where('is_active', true) ->orderBy('category_id') ->orderBy('seri') ->get() ->groupBy(function ($unit) { return $unit->category ? $unit->category->name : 'Lainnya'; }); @endphp
@foreach($categorizedUnits as $categoryName => $units) @php $category = $units->first()->category; @endphp

@if($category && $category->icon) {{ $category->icon }} @else @if(str_contains(strtolower($categoryName), 'iphone'))  @elseif(str_contains(strtolower($categoryName), 'playstation')) 🎮 @else 📦 @endif @endif {{ $categoryName }}

@foreach($units as $unit) @php $isIphone = $unit->category && str_contains(strtolower($unit->category->slug), 'iphone'); @endphp

{{ $unit->seri }}

@if($isIphone)

{{ $unit->warna }} · {{ $unit->memori }}

@elseif($unit->specs)
@foreach($unit->specs as $key => $val) @if($val) {{ $key }}: {{ $val }} @endif @endforeach
@endif @if($unit->kondisi && !$isIphone)

{{ $unit->kondisi }}

@endif
Sewa / Hari
Rp {{ number_format($unit->harga_per_hari, 0, ',', '.') }}
@endforeach
@if($units->count() > 4)
@endif @endforeach
@livewireScripts