Files

149 lines
9.3 KiB
PHP

@extends('layouts.app')
@section('title', 'Winkelwagen | Jouwdriedee.nl')
@section('content')
<div class="border-b border-slate-200/80 py-6 sm:py-8 bg-slate-50/50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<h1 class="text-2xl sm:text-3xl font-bold tracking-tight text-slate-900">
Winkelwagen
</h1>
<p class="text-xs text-slate-500 mt-1">Overzicht van jouw geselecteerde 3D prints en configuraties.</p>
</div>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 sm:py-12">
@if(empty($cart))
<div class="p-10 sm:p-14 text-center rounded-2xl bg-white border border-slate-200/80 shadow-xs space-y-3 max-w-md mx-auto">
<div class="w-12 h-12 rounded-xl bg-slate-100 text-slate-400 flex items-center justify-center mx-auto">
<i data-lucide="shopping-bag" class="w-6 h-6"></i>
</div>
<h2 class="text-base font-bold text-slate-900">Je winkelwagen is nog leeg</h2>
<p class="text-xs text-slate-500 max-w-xs mx-auto">Bekijk onze studio collectie of upload direct een eigen model.</p>
<div class="pt-3 flex flex-col sm:flex-row items-center justify-center gap-2">
<a href="{{ route('catalog') }}" class="w-full sm:w-auto px-4 py-2 rounded-xl bg-slate-900 hover:bg-slate-800 text-white font-medium text-xs inline-flex items-center justify-center space-x-1.5 shadow-xs transition">
<span>Bekijk collectie</span>
<i data-lucide="arrow-right" class="w-3.5 h-3.5"></i>
</a>
<a href="{{ route('custom.request') }}" class="w-full sm:w-auto px-4 py-2 rounded-xl bg-white hover:bg-slate-50 border border-slate-200 text-slate-700 font-medium text-xs inline-flex items-center justify-center space-x-1.5 transition">
<span>Eigen bestand uploaden</span>
</a>
</div>
</div>
@else
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
<!-- Items Lijst -->
<div class="lg:col-span-8 space-y-3">
@foreach($cart as $key => $item)
<div class="p-4 sm:p-5 rounded-2xl bg-white border border-slate-200/80 shadow-2xs flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="flex items-center space-x-3.5 w-full sm:w-auto">
<div class="w-16 h-16 rounded-xl bg-slate-100 overflow-hidden shrink-0 border border-slate-200/60">
<img src="{{ $item['image_url'] }}" alt="{{ $item['name'] }}" class="w-full h-full object-cover">
</div>
<div class="space-y-1">
<h3 class="text-sm font-semibold text-slate-900">{{ $item['name'] }}</h3>
<div class="flex flex-wrap items-center gap-1.5 text-[11px] text-slate-500">
<span class="px-1.5 py-0.2 rounded bg-slate-100 text-slate-700 font-medium">{{ strtoupper($item['material']) }}</span>
<span>&bull;</span>
<span>Kleur: {{ $item['color'] }}</span>
<span>&bull;</span>
<span class="font-mono text-slate-600">{{ $item['scale'] }}</span>
</div>
@if(!empty($item['custom_file_name']))
<div class="text-[10px] text-slate-500 font-mono flex items-center space-x-1 pt-0.5">
<i data-lucide="file-code" class="w-3 h-3 text-slate-400"></i>
<span>{{ $item['custom_file_name'] }}</span>
</div>
@endif
@if(!empty($item['custom_model_url']))
<div class="text-[10px] text-slate-500 font-mono flex items-center space-x-1 pt-0.5">
<i data-lucide="link" class="w-3 h-3 text-slate-400"></i>
<span class="truncate max-w-xs">{{ $item['custom_model_url'] }}</span>
</div>
@endif
<div class="text-xs font-medium text-slate-600 pt-0.5">
€ {{ number_format($item['price'], 2, ',', '.') }} per stuk
</div>
</div>
</div>
<!-- Aantal en acties -->
<div class="flex items-center justify-between sm:justify-end space-x-4 w-full sm:w-auto pt-2 sm:pt-0 border-t sm:border-t-0 border-slate-100">
<!-- Update Formulier -->
<form action="{{ route('cart.update') }}" method="POST" class="flex items-center space-x-1.5">
@csrf
<input type="hidden" name="key" value="{{ $key }}">
<input type="number" name="quantity" min="1" max="50" value="{{ $item['quantity'] }}" class="w-12 bg-slate-50 border border-slate-200 rounded-lg px-2 py-1 text-xs text-center font-medium text-slate-900 focus:bg-white focus:outline-none focus:ring-1 focus:ring-slate-900">
<button type="submit" class="p-1 rounded-lg text-slate-400 hover:text-slate-800 transition cursor-pointer" title="Bijwerken">
<i data-lucide="refresh-cw" class="w-3 h-3"></i>
</button>
</form>
<span class="font-semibold text-slate-900 text-sm w-20 text-right">
€ {{ number_format($item['price'] * $item['quantity'], 2, ',', '.') }}
</span>
<!-- Verwijder Formulier -->
<form action="{{ route('cart.remove', $key) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="p-1.5 text-slate-400 hover:text-rose-600 transition cursor-pointer" title="Verwijderen">
<i data-lucide="trash-2" class="w-4 h-4"></i>
</button>
</form>
</div>
</div>
@endforeach
</div>
<!-- Samenvatting -->
<div class="lg:col-span-4">
<div class="p-6 rounded-2xl bg-white border border-slate-200/80 shadow-xs space-y-4 sticky top-24">
<h3 class="text-xs font-bold text-slate-900 uppercase tracking-wider pb-2 border-b border-slate-100">
Besteloverzicht
</h3>
<div class="space-y-2 text-xs">
<div class="flex justify-between text-slate-600">
<span>Subtotaal</span>
<span class="font-semibold text-slate-900">€ {{ number_format($subtotal, 2, ',', '.') }}</span>
</div>
<div class="flex justify-between text-slate-600">
<span>Verzendkosten</span>
@if($shipping == 0)
<span class="text-emerald-700 font-semibold bg-emerald-50 px-2 py-0.5 rounded-md">Gratis</span>
@else
<span class="font-semibold text-slate-900">€ {{ number_format($shipping, 2, ',', '.') }}</span>
@endif
</div>
@if($subtotal < 50)
<p class="text-[11px] text-slate-600 bg-slate-50 p-2.5 rounded-xl border border-slate-200/60">
Bestel nog voor <strong>€ {{ number_format(50 - $subtotal, 2, ',', '.') }}</strong> voor gratis verzending.
</p>
@endif
</div>
<div class="pt-3 border-t border-slate-100 flex justify-between items-baseline">
<span class="text-xs font-medium text-slate-600">Totaal (incl. btw)</span>
<span class="text-xl font-bold text-slate-900">€ {{ number_format($total, 2, ',', '.') }}</span>
</div>
<a href="{{ route('checkout.index') }}" class="w-full py-3 rounded-xl bg-slate-900 hover:bg-slate-800 text-white font-medium text-xs transition shadow-xs flex items-center justify-center space-x-2">
<span>Doorgaan naar afrekenen</span>
<i data-lucide="arrow-right" class="w-3.5 h-3.5"></i>
</a>
<div class="flex items-center justify-center space-x-2 text-[11px] text-slate-400 pt-1">
<span>Veilig betalen via iDEAL</span>
<span>&bull;</span>
<span>PostNL bezorging</span>
</div>
</div>
</div>
</div>
@endif
</div>
@endsection