feat: complete admin CMS for customizable layout, texts, products, categories and orders
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Nieuw Product Toevoegen | Jouwdriedee Beheer')
|
||||
|
||||
@section('content')
|
||||
<div class="space-y-6 max-w-4xl mx-auto">
|
||||
|
||||
<!-- Header -->
|
||||
<div class="flex items-center justify-between pb-6 border-b border-slate-800">
|
||||
<div>
|
||||
<a href="{{ route('admin.products.index') }}" class="text-xs text-amber-400 font-bold hover:underline inline-flex items-center space-x-1 mb-1">
|
||||
<i data-lucide="arrow-left" class="w-3.5 h-3.5"></i>
|
||||
<span>Terug naar Producten</span>
|
||||
</a>
|
||||
<h1 class="font-heading text-2xl font-black text-white">Nieuw Product Toevoegen</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Create Form -->
|
||||
<form action="{{ route('admin.products.store') }}" method="POST" class="space-y-6">
|
||||
@csrf
|
||||
|
||||
<div class="p-6 rounded-3xl bg-slate-900 border border-slate-800 space-y-5">
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div class="md:col-span-2 space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Productnaam *</label>
|
||||
<input type="text" name="name" value="{{ old('name') }}" required placeholder="bijv. Articulated Mecha Robot" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white font-bold focus:outline-none focus:ring-2 focus:ring-amber-400">
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Categorie *</label>
|
||||
<select name="category_id" required class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2.5 text-xs text-white font-bold">
|
||||
@foreach($categories as $cat)
|
||||
<option value="{{ $cat->id }}" {{ old('category_id') == $cat->id ? 'selected' : '' }}>
|
||||
{{ $cat->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Basisprijs (€) *</label>
|
||||
<input type="number" step="0.01" name="base_price" value="{{ old('base_price', '14.95') }}" required class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white font-bold">
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2 space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Afbeelding Pad of URL</label>
|
||||
<input type="text" name="image_url" value="{{ old('image_url', '/images/products/crystal-dragon.jpg') }}" placeholder="/images/products/naam.jpg of https://..." class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Korte Omschrijving (voor overzichtskaarten)</label>
|
||||
<textarea name="short_description" rows="2" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2 text-xs text-white">{{ old('short_description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Volledige Productbeschrijving *</label>
|
||||
<textarea name="description" rows="5" required class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white leading-relaxed">{{ old('description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<!-- Print Specs -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4 pt-3 border-t border-slate-800">
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Afmetingen (LxBxH)</label>
|
||||
<input type="text" name="dimensions" value="{{ old('dimensions', '15 x 10 x 8 cm') }}" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white">
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Gewicht (gram)</label>
|
||||
<input type="number" name="weight_grams" value="{{ old('weight_grams', '85') }}" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white">
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Printtijd (uren)</label>
|
||||
<input type="number" step="0.1" name="print_time_hours" value="{{ old('print_time_hours', '4.5') }}" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Toggles -->
|
||||
<div class="pt-3 border-t border-slate-800 flex items-center space-x-6">
|
||||
<label class="flex items-center space-x-2 cursor-pointer text-xs font-bold text-slate-200">
|
||||
<input type="checkbox" name="is_active" value="1" checked class="w-4 h-4 rounded text-amber-400 bg-slate-950 border-slate-700">
|
||||
<span>Direct zichtbaar in webshop (Actief)</span>
|
||||
</label>
|
||||
|
||||
<label class="flex items-center space-x-2 cursor-pointer text-xs font-bold text-slate-200">
|
||||
<input type="checkbox" name="is_featured" value="1" class="w-4 h-4 rounded text-amber-400 bg-slate-950 border-slate-700">
|
||||
<span>Uitlichten op homepage</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end space-x-3">
|
||||
<a href="{{ route('admin.products.index') }}" class="px-4 py-2.5 rounded-xl bg-slate-800 text-slate-300 hover:text-white text-xs font-bold transition">
|
||||
Annuleren
|
||||
</a>
|
||||
<button type="submit" class="px-6 py-2.5 rounded-xl bg-amber-400 hover:bg-amber-300 text-slate-950 font-black text-xs transition flex items-center space-x-1.5">
|
||||
<i data-lucide="plus" class="w-4 h-4"></i>
|
||||
<span>Product Publiceren</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,116 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Product Bewerken: ' . $product->name . ' | Jouwdriedee Beheer')
|
||||
|
||||
@section('content')
|
||||
<div class="space-y-6 max-w-4xl mx-auto">
|
||||
|
||||
<!-- Header -->
|
||||
<div class="flex items-center justify-between pb-6 border-b border-slate-800">
|
||||
<div>
|
||||
<a href="{{ route('admin.products.index') }}" class="text-xs text-amber-400 font-bold hover:underline inline-flex items-center space-x-1 mb-1">
|
||||
<i data-lucide="arrow-left" class="w-3.5 h-3.5"></i>
|
||||
<span>Terug naar Producten</span>
|
||||
</a>
|
||||
<h1 class="font-heading text-2xl font-black text-white">Product Bewerken: {{ $product->name }}</h1>
|
||||
</div>
|
||||
|
||||
<a href="{{ route('product.show', $product->slug) }}" target="_blank" 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">
|
||||
<span>Bekijk Live</span>
|
||||
<i data-lucide="external-link" class="w-3.5 h-3.5"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Edit Form -->
|
||||
<form action="{{ route('admin.products.update', $product) }}" method="POST" class="space-y-6">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="p-6 rounded-3xl bg-slate-900 border border-slate-800 space-y-5">
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div class="md:col-span-2 space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Productnaam *</label>
|
||||
<input type="text" name="name" value="{{ old('name', $product->name) }}" required class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white font-bold focus:outline-none focus:ring-2 focus:ring-amber-400">
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Categorie *</label>
|
||||
<select name="category_id" required class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2.5 text-xs text-white font-bold">
|
||||
@foreach($categories as $cat)
|
||||
<option value="{{ $cat->id }}" {{ old('category_id', $product->category_id) == $cat->id ? 'selected' : '' }}>
|
||||
{{ $cat->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Basisprijs (€) *</label>
|
||||
<input type="number" step="0.01" name="base_price" value="{{ old('base_price', $product->base_price) }}" required class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white font-bold">
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2 space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Afbeelding Pad / URL</label>
|
||||
<input type="text" name="image_url" value="{{ old('image_url', $product->image_url) }}" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Korte Omschrijving (voor catalogus cards)</label>
|
||||
<textarea name="short_description" rows="2" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2 text-xs text-white">{{ old('short_description', $product->short_description) }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Volledige Productbeschrijving *</label>
|
||||
<textarea name="description" rows="6" required class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3.5 py-2.5 text-xs text-white leading-relaxed">{{ old('description', $product->description) }}</textarea>
|
||||
</div>
|
||||
|
||||
<!-- Print Specs -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4 pt-3 border-t border-slate-800">
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Afmetingen (LxBxH)</label>
|
||||
<input type="text" name="dimensions" value="{{ old('dimensions', $product->dimensions) }}" placeholder="bijv. 12 x 8 x 10 cm" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white">
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Gewicht (gram)</label>
|
||||
<input type="number" name="weight_grams" value="{{ old('weight_grams', $product->weight_grams) }}" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white">
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-xs font-bold text-slate-300">Printtijd (uren)</label>
|
||||
<input type="number" step="0.1" name="print_time_hours" value="{{ old('print_time_hours', $product->print_time_hours) }}" class="w-full bg-slate-950 border border-slate-700 rounded-xl px-3 py-2 text-xs text-white">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Toggles -->
|
||||
<div class="pt-3 border-t border-slate-800 flex items-center space-x-6">
|
||||
<label class="flex items-center space-x-2 cursor-pointer text-xs font-bold text-slate-200">
|
||||
<input type="checkbox" name="is_active" value="1" {{ old('is_active', $product->is_active) ? 'checked' : '' }} class="w-4 h-4 rounded text-amber-400 bg-slate-950 border-slate-700">
|
||||
<span>Zichtbaar in webshop (Actief)</span>
|
||||
</label>
|
||||
|
||||
<label class="flex items-center space-x-2 cursor-pointer text-xs font-bold text-slate-200">
|
||||
<input type="checkbox" name="is_featured" value="1" {{ old('is_featured', $product->is_featured) ? 'checked' : '' }} class="w-4 h-4 rounded text-amber-400 bg-slate-950 border-slate-700">
|
||||
<span>Uitlichten op homepage</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end space-x-3">
|
||||
<a href="{{ route('admin.products.index') }}" class="px-4 py-2.5 rounded-xl bg-slate-800 text-slate-300 hover:text-white text-xs font-bold transition">
|
||||
Annuleren
|
||||
</a>
|
||||
<button type="submit" class="px-6 py-2.5 rounded-xl bg-amber-400 hover:bg-amber-300 text-slate-950 font-black text-xs transition flex items-center space-x-1.5">
|
||||
<i data-lucide="save" class="w-4 h-4"></i>
|
||||
<span>Wijzigingen Opslaan</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -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 • {{ $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
|
||||
Reference in New Issue
Block a user