Files
jouwdriedee/resources/views/shop/show.blade.php
T
2026-10-31 13:24:24 +01:00

290 lines
17 KiB
PHP

@extends('layouts.app')
@section('title', $product->name . ' | Jouwdriedee.nl')
@section('content')
<!-- Breadcrumbs -->
<div class="bg-white border-b border-slate-200 py-3.5">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-xs text-slate-500 flex items-center space-x-2">
<a href="{{ route('home') }}" class="hover:text-indigo-600">Home</a>
<span>/</span>
<a href="{{ route('catalog') }}" class="hover:text-indigo-600">Catalogus</a>
@if($product->category)
<span>/</span>
<a href="{{ route('catalog', ['category' => $product->category->slug]) }}" class="hover:text-indigo-600">{{ $product->category->name }}</a>
@endif
<span>/</span>
<span class="font-bold text-slate-900 truncate">{{ $product->name }}</span>
</div>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10"
x-data="{
basePrice: {{ $product->base_price }},
selectedMaterial: '{{ $product->available_materials[0] ?? 'pla' }}',
materialMultipliers: {
@foreach($allMaterials as $code => $mat)
'{{ $code }}': {{ $mat->price_multiplier }},
@endforeach
},
selectedColor: '{{ $product->available_colors[0] ?? 'Mat Zwart' }}',
selectedScale: '100%',
scaleMultipliers: {
'100%': 1.0,
'150%': 1.45,
'200%': 1.95
},
selectedInfill: 'Standaard (20%)',
quantity: 1,
get calculatedPrice() {
let mult = this.materialMultipliers[this.selectedMaterial] || 1.0;
let scaleMult = this.scaleMultipliers[this.selectedScale] || 1.0;
let unit = (this.basePrice * mult * scaleMult);
return (unit * this.quantity).toFixed(2).replace('.', ',');
},
get unitPriceFormatted() {
let mult = this.materialMultipliers[this.selectedMaterial] || 1.0;
let scaleMult = this.scaleMultipliers[this.selectedScale] || 1.0;
let unit = (this.basePrice * mult * scaleMult);
return unit.toFixed(2).replace('.', ',');
}
}">
<div class="grid grid-cols-1 lg:grid-cols-12 gap-12">
<!-- Linkerkant: Productgalerij & 3D Specificaties -->
<div class="lg:col-span-6 space-y-6">
<div class="rounded-3xl bg-white border border-slate-200 overflow-hidden shadow-sm">
<div class="relative h-96 sm:h-112 bg-slate-100 flex items-center justify-center overflow-hidden">
<img
src="{{ $product->image_url }}"
alt="{{ $product->name }}"
class="w-full h-full object-cover object-center"
>
<div class="absolute top-4 left-4 flex flex-col gap-2">
@if($product->is_featured)
<span class="px-3 py-1 rounded-full bg-indigo-600 text-white font-mono text-xs font-bold shadow-xs">
Populair
</span>
@endif
</div>
</div>
</div>
<!-- 3D Print Technische Specificaties Card -->
<div class="p-6 rounded-3xl bg-white border border-slate-200 shadow-2xs space-y-4">
<h3 class="text-xs font-bold text-slate-900 uppercase tracking-wider flex items-center space-x-2">
<i data-lucide="cpu" class="w-4 h-4 text-indigo-600"></i>
<span>Print- & Technische Specificaties</span>
</h3>
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs">
<div class="p-3 rounded-2xl bg-slate-50 border border-slate-100">
<span class="text-slate-400 block text-[10px] uppercase font-bold">Afmetingen</span>
<span class="font-bold text-slate-800 font-mono mt-0.5 block">{{ $product->dimensions ?? 'Standaard' }}</span>
</div>
<div class="p-3 rounded-2xl bg-slate-50 border border-slate-100">
<span class="text-slate-400 block text-[10px] uppercase font-bold">Gewicht</span>
<span class="font-bold text-slate-800 font-mono mt-0.5 block">~{{ $product->weight_grams ?? '80' }} gram</span>
</div>
<div class="p-3 rounded-2xl bg-slate-50 border border-slate-100">
<span class="text-slate-400 block text-[10px] uppercase font-bold">Printtijd</span>
<span class="font-bold text-slate-800 font-mono mt-0.5 block">{{ $product->print_time_hours ?? '4.0' }} uur</span>
</div>
<div class="p-3 rounded-2xl bg-slate-50 border border-slate-100">
<span class="text-slate-400 block text-[10px] uppercase font-bold">Laaghoogte</span>
<span class="font-bold text-slate-800 font-mono mt-0.5 block">0.16 mm</span>
</div>
</div>
<div class="pt-2 flex items-center justify-between text-xs text-slate-500 border-t border-slate-100">
<span class="flex items-center space-x-1.5">
<i data-lucide="check" class="w-3.5 h-3.5 text-emerald-500"></i>
<span>Gekalibreerd op Bambu Lab X1 Carbon</span>
</span>
<span class="flex items-center space-x-1.5">
<i data-lucide="check" class="w-3.5 h-3.5 text-emerald-500"></i>
<span>Handmatig nagekeken & ontbraamd</span>
</span>
</div>
</div>
<!-- Productomschrijving -->
<div class="p-6 rounded-3xl bg-white border border-slate-200 shadow-2xs space-y-3">
<h3 class="text-sm font-bold text-slate-900">Over dit product</h3>
<p class="text-xs text-slate-600 leading-relaxed whitespace-pre-line">
{{ $product->description }}
</p>
</div>
</div>
<!-- Rechterkant: Interactive 3D Configurator & Bestelmodule -->
<div class="lg:col-span-6 space-y-6">
<div class="p-7 rounded-3xl bg-white border border-slate-200 shadow-md space-y-6">
<div>
@if($product->category)
<span class="text-xs font-bold uppercase tracking-wider text-indigo-600 block mb-1">
{{ $product->category->name }}
</span>
@endif
<h1 class="text-2xl sm:text-3xl font-black text-slate-900 tracking-tight">{{ $product->name }}</h1>
<p class="text-xs text-slate-500 mt-2 leading-relaxed">{{ $product->short_description }}</p>
</div>
<!-- Live Prijs Display -->
<div class="p-4 rounded-2xl bg-indigo-50/60 border border-indigo-100 flex items-center justify-between">
<div>
<span class="text-[11px] text-slate-500 block font-medium">Berekende stukprijs</span>
<div class="flex items-baseline space-x-2">
<span class="text-2xl font-black text-indigo-600 font-mono">€ <span x-text="unitPriceFormatted"></span></span>
<span class="text-xs text-slate-400 font-normal">incl. btw</span>
</div>
</div>
<div class="text-right">
<span class="px-2.5 py-1 rounded-full bg-emerald-100 text-emerald-800 text-[11px] font-bold inline-flex items-center space-x-1">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span>
<span>Direct op voorraad / Print-klaar</span>
</span>
</div>
</div>
<!-- Bestelformulier met Customizer -->
<form action="{{ route('cart.add') }}" method="POST" class="space-y-6">
@csrf
<input type="hidden" name="product_id" value="{{ $product->id }}">
<input type="hidden" name="material" x-model="selectedMaterial">
<input type="hidden" name="color" x-model="selectedColor">
<input type="hidden" name="scale" x-model="selectedScale">
<input type="hidden" name="infill" x-model="selectedInfill">
<input type="hidden" name="quantity" x-model="quantity">
<!-- 1. Materiaal Keuze -->
<div>
<div class="flex items-center justify-between mb-2">
<label class="text-xs font-bold text-slate-800 uppercase tracking-wider">1. Kies Filament / Materiaal</label>
<span class="text-xs font-mono font-bold text-indigo-600" x-text="selectedMaterial.toUpperCase()"></span>
</div>
<div class="grid grid-cols-2 sm:grid-cols-3 gap-2.5">
@foreach($product->available_materials ?? ['pla'] as $matCode)
@php $mat = $allMaterials[$matCode] ?? null; @endphp
@if($mat)
<button
type="button"
@click="selectedMaterial = '{{ $mat->code }}'"
:class="selectedMaterial === '{{ $mat->code }}' ? 'border-indigo-600 bg-indigo-50/50 ring-2 ring-indigo-500/20 text-indigo-950' : 'border-slate-200 bg-white text-slate-700 hover:bg-slate-50'"
class="p-3 rounded-2xl border text-left transition flex flex-col justify-between cursor-pointer"
>
<div class="flex items-center justify-between">
<span class="font-bold text-xs">{{ $mat->name }}</span>
@if($mat->price_multiplier > 1.0)
<span class="text-[10px] font-mono px-1.5 py-0.5 rounded bg-slate-100 text-slate-600 font-bold">+{{ round(($mat->price_multiplier - 1) * 100) }}%</span>
@endif
</div>
<p class="text-[10px] text-slate-500 mt-1 line-clamp-1">{{ $mat->description }}</p>
</button>
@endif
@endforeach
</div>
</div>
<!-- 2. Kleur Selectie (Swatches) -->
<div>
<div class="flex items-center justify-between mb-2">
<label class="text-xs font-bold text-slate-800 uppercase tracking-wider">2. Kies Printkleur</label>
<span class="text-xs font-bold text-slate-800" x-text="selectedColor"></span>
</div>
<div class="flex flex-wrap gap-2.5">
@foreach($allColors as $c)
<button
type="button"
@click="selectedColor = '{{ $c->name }}'"
:class="selectedColor === '{{ $c->name }}' ? 'ring-2 ring-indigo-600 ring-offset-2 scale-105' : 'hover:scale-105 border-slate-300'"
class="w-8 h-8 rounded-full border shadow-xs transition flex items-center justify-center cursor-pointer relative group"
style="background-color: {{ $c->hex }};"
title="{{ $c->name }}"
>
<template x-if="selectedColor === '{{ $c->name }}'">
<i data-lucide="check" class="w-4 h-4 {{ in_array($c->name, ['Sneeuwwit', 'Galaxy Grijs']) ? 'text-slate-900' : 'text-white' }} stroke-[3]"></i>
</template>
</button>
@endforeach
</div>
</div>
<!-- 3. Formaat & Schaal -->
<div>
<div class="flex items-center justify-between mb-2">
<label class="text-xs font-bold text-slate-800 uppercase tracking-wider">3. Schaal / Grootte</label>
<span class="text-xs font-mono font-bold text-slate-700" x-text="selectedScale"></span>
</div>
<div class="grid grid-cols-3 gap-2 text-xs">
<button
type="button"
@click="selectedScale = '100%'"
:class="selectedScale === '100%' ? 'border-indigo-600 bg-indigo-50 font-bold text-indigo-900' : 'border-slate-200 text-slate-600 hover:bg-slate-50'"
class="p-2.5 rounded-xl border text-center transition cursor-pointer"
>
<span>100% (Normaal)</span>
</button>
<button
type="button"
@click="selectedScale = '150%'"
:class="selectedScale === '150%' ? 'border-indigo-600 bg-indigo-50 font-bold text-indigo-900' : 'border-slate-200 text-slate-600 hover:bg-slate-50'"
class="p-2.5 rounded-xl border text-center transition cursor-pointer"
>
<span>150% (+45%)</span>
</button>
<button
type="button"
@click="selectedScale = '200%'"
:class="selectedScale === '200%' ? 'border-indigo-600 bg-indigo-50 font-bold text-indigo-900' : 'border-slate-200 text-slate-600 hover:bg-slate-50'"
class="p-2.5 rounded-xl border text-center transition cursor-pointer"
>
<span>200% (+95%)</span>
</button>
</div>
</div>
<!-- Aantal en Toevoegen Knop -->
<div class="pt-4 border-t border-slate-100 space-y-4">
<div class="flex items-center space-x-3">
<div class="flex items-center border border-slate-200 rounded-2xl bg-slate-50 overflow-hidden">
<button type="button" @click="if (quantity > 1) quantity--" class="px-3.5 py-3 hover:bg-slate-200 transition text-slate-600 font-bold cursor-pointer">-</button>
<span class="px-4 py-3 font-mono font-bold text-xs text-slate-900" x-text="quantity"></span>
<button type="button" @click="if (quantity < 50) quantity++" class="px-3.5 py-3 hover:bg-slate-200 transition text-slate-600 font-bold cursor-pointer">+</button>
</div>
<button type="submit" class="flex-1 py-3.5 px-6 rounded-2xl bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-sm transition shadow-lg shadow-indigo-600/25 flex items-center justify-center space-x-2 cursor-pointer">
<i data-lucide="shopping-bag" class="w-4 h-4"></i>
<span>In Winkelwagen • € <span x-text="calculatedPrice"></span></span>
</button>
</div>
<div class="flex items-center justify-center space-x-4 text-[11px] text-slate-500 pt-1">
<span class="flex items-center space-x-1">
<i data-lucide="truck" class="w-3.5 h-3.5 text-slate-400"></i>
<span>Gratis verzending vanaf € 50,-</span>
</span>
<span>•</span>
<span class="flex items-center space-x-1">
<i data-lucide="rotate-ccw" class="w-3.5 h-3.5 text-slate-400"></i>
<span>14 dagen bedenktijd</span>
</span>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection