feat: complete admin CMS for customizable layout, texts, products, categories and orders

This commit is contained in:
2026-10-31 21:18:01 +01:00
parent 957661a186
commit f8c002366b
21 changed files with 2076 additions and 76 deletions
@@ -0,0 +1,170 @@
@extends('layouts.admin')
@section('title', 'Producten Beheren | Jouwdriedee Beheer')
@section('content')
<div class="space-y-6">
<!-- Header -->
<div class="flex flex-col sm:flex-row sm:items-center justify-between pb-6 border-b border-slate-800 gap-4">
<div>
<div class="inline-flex items-center space-x-2 text-xs text-amber-400 font-bold uppercase tracking-wider mb-1">
<i data-lucide="box" class="w-4 h-4"></i>
<span>Assortiment & Voorraad</span>
</div>
<h1 class="font-heading text-2xl sm:text-3xl font-black text-white">Producten Overzicht ({{ $products->total() }})</h1>
<p class="text-xs sm:text-sm text-slate-400 mt-1">Beheer prijzen, teksten, specificaties en afbeeldingen van alle 3D prints.</p>
</div>
<div class="flex items-center space-x-3 self-start sm:self-auto">
<a href="{{ route('admin.makerworld.index') }}" class="px-3.5 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white text-xs font-bold transition flex items-center space-x-1.5 border border-slate-700">
<i data-lucide="download-cloud" class="w-4 h-4"></i>
<span>MakerWorld Importer</span>
</a>
<a href="{{ route('admin.products.create') }}" class="px-4 py-2 rounded-xl bg-amber-400 hover:bg-amber-300 text-slate-950 font-black text-xs transition flex items-center space-x-1.5 shadow-sm">
<i data-lucide="plus" class="w-4 h-4"></i>
<span>Nieuw Product</span>
</a>
</div>
</div>
<!-- Search & Filters -->
<div class="p-4 rounded-2xl bg-slate-900 border border-slate-800 flex flex-col sm:flex-row items-center justify-between gap-3">
<form action="{{ route('admin.products.index') }}" method="GET" class="w-full sm:w-auto flex-1 flex items-center space-x-2">
<div class="relative flex-1 max-w-md">
<input
type="text"
name="q"
value="{{ request('q') }}"
placeholder="Zoek op naam of omschrijving..."
class="w-full bg-slate-950 border border-slate-700 rounded-xl pl-9 pr-3.5 py-2 text-xs text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-amber-400"
>
<i data-lucide="search" class="w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2"></i>
</div>
<select name="category_id" onchange="this.form.submit()" class="bg-slate-950 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white">
<option value="">Alle Categorieën</option>
@foreach($categories as $cat)
<option value="{{ $cat->id }}" {{ request('category_id') == $cat->id ? 'selected' : '' }}>{{ $cat->name }}</option>
@endforeach
</select>
<button type="submit" class="px-3 py-2 bg-slate-800 hover:bg-slate-700 text-white rounded-xl text-xs font-bold transition">
Filter
</button>
@if(request()->hasAny(['q', 'category_id']))
<a href="{{ route('admin.products.index') }}" class="text-xs text-rose-400 hover:underline">Wissen</a>
@endif
</form>
</div>
<!-- Products Table -->
<div class="rounded-3xl bg-slate-900 border border-slate-800 overflow-hidden shadow-xl">
<div class="overflow-x-auto">
<table class="w-full text-left text-xs text-slate-300">
<thead class="bg-slate-950/80 text-[11px] uppercase tracking-wider text-slate-400 font-bold border-b border-slate-800">
<tr>
<th class="py-3.5 px-4">Product</th>
<th class="py-3.5 px-4">Categorie</th>
<th class="py-3.5 px-4">Basisprijs</th>
<th class="py-3.5 px-4">Specificaties</th>
<th class="py-3.5 px-4">Status</th>
<th class="py-3.5 px-4 text-right">Acties</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-800/80 font-medium">
@forelse($products as $product)
<tr class="hover:bg-slate-800/50 transition">
<td class="py-3.5 px-4">
<div class="flex items-center space-x-3">
<div class="w-12 h-12 rounded-xl bg-slate-950 overflow-hidden border border-slate-800 flex-shrink-0">
<img src="{{ $product->image_url }}" alt="{{ $product->name }}" class="w-full h-full object-cover">
</div>
<div>
<a href="{{ route('admin.products.edit', $product) }}" class="font-bold text-white hover:text-amber-400 transition block text-sm">
{{ $product->name }}
</a>
<span class="text-[10px] text-slate-500 font-mono">/product/{{ $product->slug }}</span>
</div>
</div>
</td>
<td class="py-3.5 px-4">
@if($product->category)
<span class="px-2 py-0.5 rounded-md bg-slate-800 text-slate-300 text-[11px] font-bold border border-slate-700">
{{ $product->category->name }}
</span>
@else
<span class="text-slate-500">-</span>
@endif
</td>
<td class="py-3.5 px-4">
<span class="font-black text-amber-400 font-heading text-sm">{{ $product->formatted_price }}</span>
</td>
<td class="py-3.5 px-4 text-[11px] text-slate-400 space-y-0.5">
<div>{{ $product->dimensions ?? 'Standaard' }}</div>
<div>~{{ $product->weight_grams ?? 0 }}g &bull; {{ $product->print_time_hours ?? 0 }}u</div>
</td>
<td class="py-3.5 px-4">
<div class="flex flex-col gap-1">
@if($product->is_active)
<span class="inline-flex items-center space-x-1 text-emerald-400 text-[11px] font-bold">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-400"></span>
<span>Actief</span>
</span>
@else
<span class="inline-flex items-center space-x-1 text-slate-500 text-[11px] font-bold">
<span class="w-1.5 h-1.5 rounded-full bg-slate-500"></span>
<span>Verborgen</span>
</span>
@endif
@if($product->is_featured)
<span class="inline-flex items-center text-amber-400 text-[10px] font-bold">
★ Uitgelicht
</span>
@endif
</div>
</td>
<td class="py-3.5 px-4 text-right">
<div class="flex items-center justify-end space-x-2">
<a href="{{ route('product.show', $product->slug) }}" target="_blank" class="p-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white transition" title="Bekijk in Shop">
<i data-lucide="external-link" class="w-3.5 h-3.5"></i>
</a>
<a href="{{ route('admin.products.edit', $product) }}" class="p-1.5 rounded-lg bg-slate-800 hover:bg-amber-400 text-slate-300 hover:text-slate-950 transition" title="Bewerken">
<i data-lucide="pencil" class="w-3.5 h-3.5"></i>
</a>
<form action="{{ route('admin.products.destroy', $product) }}" method="POST" onsubmit="return confirm('Weet je zeker dat je dit product wilt verwijderen?')">
@csrf
@method('DELETE')
<button type="submit" class="p-1.5 rounded-lg bg-slate-800 hover:bg-rose-500 text-slate-300 hover:text-white transition cursor-pointer" title="Verwijderen">
<i data-lucide="trash-2" class="w-3.5 h-3.5"></i>
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="p-8 text-center text-slate-500">
Geen producten gevonden.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if($products->hasPages())
<div class="p-4 border-t border-slate-800 bg-slate-950/60">
{{ $products->links() }}
</div>
@endif
</div>
</div>
@endsection