Fix timezone to Europe/Amsterdam, fix 500 error on communication and customer pages with bulletproof schema helper, and redesign admin header to compact grouped dropdowns

This commit is contained in:
2026-11-02 11:05:28 +01:00
parent da9992e060
commit 560a6ae20b
10 changed files with 327 additions and 169 deletions
+1
View File
@@ -3,6 +3,7 @@ APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=https://jouwdriedee.nl
APP_TIMEZONE=Europe/Amsterdam
APP_LOCALE=nl
APP_FALLBACK_LOCALE=nl
@@ -6,13 +6,12 @@ use App\Http\Controllers\Controller;
use App\Mail\ContactInquiryReplyMail;
use App\Models\Communication;
use App\Models\CommunicationReply;
use App\Services\DatabaseSchemaHelper;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Schema;
use Illuminate\View\View;
class CommunicationController extends Controller
@@ -22,9 +21,7 @@ class CommunicationController extends Controller
*/
public function index(Request $request): View
{
if (! Schema::hasTable('communications')) {
Artisan::call('migrate', ['--force' => true]);
}
DatabaseSchemaHelper::ensureCommunicationsTables();
$query = Communication::with(['user', 'order', 'replies'])->latest();
@@ -6,10 +6,9 @@ use App\Http\Controllers\Controller;
use App\Models\Communication;
use App\Models\Order;
use App\Models\User;
use App\Services\DatabaseSchemaHelper;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
use Illuminate\View\View;
class CustomerController extends Controller
@@ -19,9 +18,7 @@ class CustomerController extends Controller
*/
public function index(Request $request): View
{
if (! Schema::hasTable('communications')) {
Artisan::call('migrate', ['--force' => true]);
}
DatabaseSchemaHelper::ensureCommunicationsTables();
$search = trim($request->input('q', ''));
+2 -9
View File
@@ -7,13 +7,12 @@ use App\Mail\ContactInquiryReceivedMail;
use App\Models\Communication;
use App\Models\Order;
use App\Models\Setting;
use App\Services\DatabaseSchemaHelper;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Schema;
use Illuminate\View\View;
class ContactController extends Controller
@@ -62,13 +61,7 @@ class ContactController extends Controller
}
}
if (! Schema::hasTable('communications')) {
Artisan::call('migrate', ['--force' => true]);
}
if (! \Illuminate\Support\Facades\Schema::hasTable('communications')) {
\Illuminate\Support\Facades\Artisan::call('migrate', ['--force' => true]);
}
DatabaseSchemaHelper::ensureCommunicationsTables();
$communication = Communication::create([
'user_id' => Auth::id(),
+2 -10
View File
@@ -2,11 +2,9 @@
namespace App\Http\Middleware;
use App\Services\DatabaseSchemaHelper;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Symfony\Component\HttpFoundation\Response;
class EnsureUserIsAdmin
@@ -28,13 +26,7 @@ class EnsureUserIsAdmin
// Auto-migrate check: Ensure that new database tables (like communications) are migrated
// automatically when an admin enters the admin panel, avoiding 500 errors on Coolify/production.
try {
if (! Schema::hasTable('communications')) {
Artisan::call('migrate', ['--force' => true]);
}
} catch (\Throwable $e) {
Log::warning('Auto-migration in EnsureUserIsAdmin failed: '.$e->getMessage());
}
DatabaseSchemaHelper::ensureCommunicationsTables();
return $next($request);
}
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace App\Services;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
class DatabaseSchemaHelper
{
/**
* Ensure the communications and communication_replies tables exist.
* If missing, cleanly migrate or create them so the admin panel never throws a 500 error.
*/
public static function ensureCommunicationsTables(): void
{
try {
if (Schema::hasTable('communications') && Schema::hasTable('communication_replies')) {
return;
}
// If tables are missing but migration was recorded as ran, reset the migration record
if (Schema::hasTable('migrations')) {
DB::table('migrations')->where('migration', 'like', '%create_communications_table%')->delete();
}
Artisan::call('migrate', ['--force' => true]);
// Direct DDL Fallback if artisan migrate didn't create them
if (! Schema::hasTable('communications')) {
Schema::create('communications', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('order_id')->nullable()->constrained('orders')->nullOnDelete();
$table->string('name');
$table->string('email')->index();
$table->string('phone')->nullable();
$table->string('subject');
$table->text('message');
$table->string('status')->default('new')->index();
$table->text('admin_notes')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->timestamp('last_replied_at')->nullable();
$table->timestamps();
});
}
if (! Schema::hasTable('communication_replies')) {
Schema::create('communication_replies', function (Blueprint $table) {
$table->id();
$table->foreignId('communication_id')->constrained('communications')->cascadeOnDelete();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
$table->boolean('is_admin_reply')->default(true);
$table->text('message');
$table->timestamps();
});
}
} catch (\Throwable $e) {
Log::error('ensureCommunicationsTables error: '.$e->getMessage(), ['trace' => $e->getTraceAsString()]);
}
}
}
+1 -1
View File
@@ -65,7 +65,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => env('APP_TIMEZONE', 'Europe/Amsterdam'),
/*
|--------------------------------------------------------------------------
@@ -11,6 +11,7 @@ return new class extends Migration
*/
public function up(): void
{
if (! Schema::hasTable('communications')) {
Schema::create('communications', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
@@ -27,7 +28,9 @@ return new class extends Migration
$table->timestamp('last_replied_at')->nullable();
$table->timestamps();
});
}
if (! Schema::hasTable('communication_replies')) {
Schema::create('communication_replies', function (Blueprint $table) {
$table->id();
$table->foreignId('communication_id')->constrained('communications')->cascadeOnDelete();
@@ -37,6 +40,7 @@ return new class extends Migration
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
@@ -295,9 +295,9 @@
<div class="flex items-center justify-between">
<span>Laatste controle:</span>
<span class="font-mono text-slate-700 font-medium">
{{ $collection->last_synced_at ? $collection->last_synced_at->diffForHumans() : 'Nog niet' }}
{{ $collection->last_synced_at ? $collection->last_synced_at->timezone(config('app.timezone', 'Europe/Amsterdam'))->diffForHumans() : 'Nog niet' }}
@if($collection->last_synced_at)
<span class="text-[10px] text-slate-400 font-normal">({{ $collection->last_synced_at->format('H:i') }})</span>
<span class="text-[10px] text-slate-400 font-normal">({{ $collection->last_synced_at->timezone(config('app.timezone', 'Europe/Amsterdam'))->format('H:i') }})</span>
@endif
</span>
</div>
+189 -80
View File
@@ -24,32 +24,22 @@
}
</style>
</head>
<body class="min-h-full flex flex-col bg-slate-50/70 text-slate-800 selection:bg-slate-900 selection:text-white" x-data="{ mobileNav: false }">
<body class="min-h-full flex flex-col bg-slate-50/70 text-slate-800 selection:bg-slate-900 selection:text-white" x-data="{ mobileNav: false, catalogOpen: false, relationsOpen: false }">
<!-- Admin Header (Sleek, Minimalist, SaaS Style) -->
<header class="bg-white/85 backdrop-blur-md border-b border-slate-200/70 sticky top-0 z-30">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center justify-between h-16 gap-4">
<!-- Brand / Logo -->
<div class="flex items-center space-x-6">
<a href="{{ route('admin.content.index') }}" class="flex items-center space-x-2.5 group">
<img src="/images/logo.svg" alt="Jouwdriedee.nl" class="h-7 w-auto">
<span class="px-2 py-0.5 rounded-md bg-slate-100 text-slate-600 font-medium text-[11px] tracking-wide">Studio CMS</span>
</a>
<!-- Desktop Nav Links -->
<nav class="hidden md:flex items-center space-x-1 text-xs font-medium">
<a href="{{ route('admin.content.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.content.*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="palette" class="w-3.5 h-3.5"></i>
<span>Layout & Teksten</span>
</a>
<a href="{{ route('admin.products.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.products.*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="box" class="w-3.5 h-3.5"></i>
<span>Producten</span>
<!-- Brand / Logo (Always strictly shrink-0 so it never overlaps or wraps) -->
<div class="flex items-center space-x-3 shrink-0">
<a href="{{ route('admin.content.index') }}" class="flex items-center space-x-2 shrink-0 group">
<img src="/images/logo.svg" alt="Jouwdriedee.nl" class="h-6 w-auto shrink-0">
<span class="px-2 py-0.5 rounded-md bg-slate-100 text-slate-600 font-semibold text-[10px] tracking-wider uppercase shrink-0">Studio CMS</span>
</a>
</div>
<!-- Desktop Compact Nav Links with Grouped Dropdowns -->
@php
$draftBadgeCount = 0;
try {
@@ -59,28 +49,7 @@
} catch (\Throwable $e) {
$draftBadgeCount = 0;
}
@endphp
<a href="{{ route('admin.makerworld.staging') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.makerworld.staging*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="layers" class="w-3.5 h-3.5"></i>
<span>Artikel Beheer</span>
@if($draftBadgeCount > 0)
<span class="ml-1 px-1.5 py-0.2 rounded-full text-[10px] font-semibold {{ request()->routeIs('admin.makerworld.staging*') ? 'bg-white text-slate-900' : 'bg-slate-200 text-slate-800' }}">
{{ $draftBadgeCount }}
</span>
@endif
</a>
<a href="{{ route('admin.categories.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.categories.*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="folder-tree" class="w-3.5 h-3.5"></i>
<span>Categorieën</span>
</a>
<a href="{{ route('admin.orders.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.orders.*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="shopping-cart" class="w-3.5 h-3.5"></i>
<span>Bestellingen</span>
</a>
@php
$unreadCommCount = 0;
try {
if (\Illuminate\Support\Facades\Schema::hasTable('communications')) {
@@ -89,31 +58,157 @@
} catch (\Throwable $e) {
$unreadCommCount = 0;
}
$isCatalogActive = request()->routeIs(['admin.products.*', 'admin.makerworld.*', 'admin.categories.*']);
$isRelationsActive = request()->routeIs(['admin.communications.*', 'admin.customers.*']);
@endphp
<a href="{{ route('admin.communications.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.communications.*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="message-square" class="w-3.5 h-3.5"></i>
<span>Communicatie</span>
<nav class="hidden lg:flex items-center space-x-1.5 text-xs font-medium">
<!-- 1. Layout & Teksten -->
<a href="{{ route('admin.content.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.content.*') ? 'bg-slate-900 text-white font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="palette" class="w-3.5 h-3.5"></i>
<span>Layout & Teksten</span>
</a>
<!-- 2. Assortiment (Grouped Dropdown) -->
<div class="relative" @click.outside="catalogOpen = false">
<button
type="button"
@click="catalogOpen = !catalogOpen; relationsOpen = false"
class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 cursor-pointer {{ $isCatalogActive ? 'bg-slate-900 text-white font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}"
>
<i data-lucide="box" class="w-3.5 h-3.5"></i>
<span>Assortiment</span>
@if($draftBadgeCount > 0)
<span class="px-1.5 py-0.2 rounded-full text-[10px] font-semibold {{ $isCatalogActive ? 'bg-white text-slate-900' : 'bg-slate-200 text-slate-800' }}">
{{ $draftBadgeCount }}
</span>
@endif
<i data-lucide="chevron-down" class="w-3 h-3 text-slate-400 transition-transform duration-200" :class="catalogOpen ? 'rotate-180' : ''"></i>
</button>
<!-- Dropdown Menu -->
<div
x-show="catalogOpen"
x-cloak
x-transition:enter="transition ease-out duration-100"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="absolute left-0 mt-1.5 w-60 rounded-xl bg-white border border-slate-200/80 shadow-lg py-1.5 z-40 text-xs"
>
<a href="{{ route('admin.products.index') }}" class="px-3 py-2 flex items-center justify-between hover:bg-slate-50 transition {{ request()->routeIs('admin.products.*') ? 'bg-slate-50 text-slate-900 font-semibold' : 'text-slate-700' }}">
<div class="flex items-center space-x-2.5">
<i data-lucide="box" class="w-3.5 h-3.5 text-slate-400"></i>
<div>
<div class="font-medium text-slate-900">Producten</div>
<div class="text-[11px] text-slate-500">Actieve winkelartikelen</div>
</div>
</div>
</a>
<a href="{{ route('admin.makerworld.staging') }}" class="px-3 py-2 flex items-center justify-between hover:bg-slate-50 transition {{ request()->routeIs('admin.makerworld.staging*') ? 'bg-slate-50 text-slate-900 font-semibold' : 'text-slate-700' }}">
<div class="flex items-center space-x-2.5">
<i data-lucide="layers" class="w-3.5 h-3.5 text-slate-400"></i>
<div>
<div class="font-medium text-slate-900">Artikel Beheer</div>
<div class="text-[11px] text-slate-500">MakerWorld items beoordelen</div>
</div>
</div>
@if($draftBadgeCount > 0)
<span class="px-1.5 py-0.5 rounded-full text-[10px] font-semibold bg-amber-100 text-amber-800">
{{ $draftBadgeCount }}
</span>
@endif
</a>
<div class="my-1 border-t border-slate-100"></div>
<a href="{{ route('admin.categories.index') }}" class="px-3 py-2 flex items-center space-x-2.5 hover:bg-slate-50 transition {{ request()->routeIs('admin.categories.*') ? 'bg-slate-50 text-slate-900 font-semibold' : 'text-slate-700' }}">
<i data-lucide="folder-tree" class="w-3.5 h-3.5 text-slate-400"></i>
<div>
<div class="font-medium text-slate-900">Categorieën</div>
<div class="text-[11px] text-slate-500">Winkelindeling beheren</div>
</div>
</a>
<a href="{{ route('admin.makerworld.index') }}" class="px-3 py-2 flex items-center space-x-2.5 hover:bg-slate-50 transition {{ request()->routeIs('admin.makerworld.index*') ? 'bg-slate-50 text-slate-900 font-semibold' : 'text-slate-700' }}">
<i data-lucide="download-cloud" class="w-3.5 h-3.5 text-slate-400"></i>
<div>
<div class="font-medium text-slate-900">MakerWorld Sync</div>
<div class="text-[11px] text-slate-500">Collecties & automatische check</div>
</div>
</a>
</div>
</div>
<!-- 3. Bestellingen (Direct Link) -->
<a href="{{ route('admin.orders.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.orders.*') ? 'bg-slate-900 text-white font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="shopping-cart" class="w-3.5 h-3.5"></i>
<span>Bestellingen</span>
</a>
<!-- 4. Klanten & Communicatie (Grouped Dropdown) -->
<div class="relative" @click.outside="relationsOpen = false">
<button
type="button"
@click="relationsOpen = !relationsOpen; catalogOpen = false"
class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 cursor-pointer {{ $isRelationsActive ? 'bg-slate-900 text-white font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}"
>
<i data-lucide="users" class="w-3.5 h-3.5"></i>
<span>Klanten & Communicatie</span>
@if($unreadCommCount > 0)
<span class="ml-1 px-1.5 py-0.2 rounded-full text-[10px] font-bold {{ request()->routeIs('admin.communications.*') ? 'bg-white text-slate-900' : 'bg-sky-500 text-white animate-pulse' }}">
<span class="px-1.5 py-0.2 rounded-full text-[10px] font-bold {{ $isRelationsActive ? 'bg-white text-slate-900' : 'bg-sky-500 text-white animate-pulse' }}">
{{ $unreadCommCount }}
</span>
@endif
<i data-lucide="chevron-down" class="w-3 h-3 text-slate-400 transition-transform duration-200" :class="relationsOpen ? 'rotate-180' : ''"></i>
</button>
<!-- Dropdown Menu -->
<div
x-show="relationsOpen"
x-cloak
x-transition:enter="transition ease-out duration-100"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="absolute left-0 mt-1.5 w-64 rounded-xl bg-white border border-slate-200/80 shadow-lg py-1.5 z-40 text-xs"
>
<a href="{{ route('admin.communications.index') }}" class="px-3 py-2 flex items-center justify-between hover:bg-slate-50 transition {{ request()->routeIs('admin.communications.*') ? 'bg-slate-50 text-slate-900 font-semibold' : 'text-slate-700' }}">
<div class="flex items-center space-x-2.5">
<i data-lucide="message-square" class="w-3.5 h-3.5 text-slate-400"></i>
<div>
<div class="font-medium text-slate-900">Communicatie & Vragen</div>
<div class="text-[11px] text-slate-500">Contactberichten & antwoorden</div>
</div>
</div>
@if($unreadCommCount > 0)
<span class="px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-sky-500 text-white animate-pulse">
{{ $unreadCommCount }}
</span>
@endif
</a>
<a href="{{ route('admin.customers.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.customers.*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="users" class="w-3.5 h-3.5"></i>
<span>Klanten</span>
</a>
<div class="my-1 border-t border-slate-100"></div>
<a href="{{ route('admin.makerworld.index') }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ request()->routeIs('admin.makerworld.index*') ? 'bg-slate-900 text-white font-semibold' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i data-lucide="download-cloud" class="w-3.5 h-3.5"></i>
<span>MakerWorld Sync</span>
</a>
</nav>
<a href="{{ route('admin.customers.index') }}" class="px-3 py-2 flex items-center space-x-2.5 hover:bg-slate-50 transition {{ request()->routeIs('admin.customers.*') ? 'bg-slate-50 text-slate-900 font-semibold' : 'text-slate-700' }}">
<i data-lucide="users" class="w-3.5 h-3.5 text-slate-400"></i>
<div>
<div class="font-medium text-slate-900">Klanten & Profielen</div>
<div class="text-[11px] text-slate-500">Geregistreerden & gastbestellers</div>
</div>
</a>
</div>
</div>
</nav>
<!-- Right Actions -->
<div class="flex items-center space-x-2.5">
<div class="flex items-center space-x-2 shrink-0">
@php
$isShopOffline = false;
try {
@@ -125,30 +220,29 @@
}
@endphp
<!-- Webshop Offline / Online Status Switcher -->
<!-- Webshop Offline / Online Status Switcher (Compact) -->
<form action="{{ route('admin.toggle-offline') }}" method="POST" class="inline">
@csrf
@if($isShopOffline)
<button type="submit" class="px-3 py-1.5 rounded-lg bg-rose-500 hover:bg-rose-600 text-white text-xs font-semibold transition flex items-center space-x-1.5 shadow-2xs cursor-pointer" title="Klik om de webshop weer direct online te zetten">
<button type="submit" class="px-2.5 py-1.5 rounded-lg bg-rose-500 hover:bg-rose-600 text-white text-xs font-semibold transition flex items-center space-x-1.5 shadow-2xs cursor-pointer" title="Klik om de webshop weer direct online te zetten">
<span class="w-1.5 h-1.5 rounded-full bg-white animate-pulse"></span>
<span>Webshop: Offline</span>
<span>Offline</span>
</button>
@else
<button type="submit" class="px-2.5 sm:px-3 py-1.5 rounded-lg bg-slate-50 hover:bg-slate-100 text-slate-700 text-xs font-medium transition flex items-center space-x-1.5 border border-slate-200/80 cursor-pointer" title="Klik om de webshop direct offline te zetten voor bezoekers">
<button type="submit" class="px-2.5 py-1.5 rounded-lg bg-slate-50 hover:bg-slate-100 text-slate-700 text-xs font-medium transition flex items-center space-x-1.5 border border-slate-200/80 cursor-pointer" title="Klik om de webshop direct offline te zetten voor bezoekers">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span>
<span class="hidden sm:inline">Webshop: Live</span>
<span class="text-[10px] text-slate-400">(Offline zetten)</span>
<span class="hidden sm:inline">Live</span>
</button>
@endif
</form>
<a href="{{ route('home') }}" target="_blank" class="px-3 py-1.5 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-100 text-xs font-medium transition flex items-center space-x-1.5">
<span>Webshop</span>
<a href="{{ route('home') }}" target="_blank" class="p-1.5 sm:px-2.5 sm:py-1.5 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-100 text-xs font-medium transition flex items-center space-x-1.5 border border-transparent hover:border-slate-200" title="Bekijk Live Webshop">
<span class="hidden sm:inline">Webshop</span>
<i data-lucide="external-link" class="w-3.5 h-3.5 text-slate-400"></i>
</a>
<!-- Mobile trigger -->
<button @click="mobileNav = !mobileNav" type="button" class="md:hidden p-1.5 rounded-lg text-slate-600 hover:bg-slate-100">
<!-- Mobile trigger (Shown on screens below lg) -->
<button @click="mobileNav = !mobileNav" type="button" class="lg:hidden p-1.5 rounded-lg text-slate-600 hover:bg-slate-100">
<i data-lucide="menu" class="w-5 h-5"></i>
</button>
</div>
@@ -156,42 +250,57 @@
</div>
</div>
<!-- Mobile Drawer -->
<div x-show="mobileNav" x-cloak class="md:hidden border-t border-slate-200/80 bg-white px-4 py-3 space-y-1 text-xs font-medium shadow-md">
<a href="{{ route('admin.content.index') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.content.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
<!-- Mobile Drawer (Clean, Grouped Sections) -->
<div x-show="mobileNav" x-cloak class="lg:hidden border-t border-slate-200/80 bg-white px-4 py-3 space-y-3 text-xs font-medium shadow-md">
<div>
<span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 px-3 block mb-1">Content & Layout</span>
<a href="{{ route('admin.content.index') }}" class="block px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.content.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Layout & Teksten
</a>
<a href="{{ route('admin.products.index') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.products.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
</div>
<div>
<span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 px-3 block mb-1">Assortiment</span>
<div class="space-y-0.5">
<a href="{{ route('admin.products.index') }}" class="block px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.products.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Producten
</a>
<a href="{{ route('admin.makerworld.staging') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.makerworld.staging*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Artikel Beheer (Geïmporteerd)
<a href="{{ route('admin.makerworld.staging') }}" class="flex items-center justify-between px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.makerworld.staging*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
<span>Artikel Beheer (Geïmporteerd)</span>
@if(($draftBadgeCount ?? 0) > 0)
<span class="ml-2 px-1.5 py-0.5 rounded-full text-[10px] font-semibold bg-slate-200 text-slate-800">
<span class="px-1.5 py-0.5 rounded-full text-[10px] font-semibold bg-slate-200 text-slate-800">
{{ $draftBadgeCount }}
</span>
@endif
</a>
<a href="{{ route('admin.categories.index') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.categories.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
<a href="{{ route('admin.categories.index') }}" class="block px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.categories.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Categorieën
</a>
<a href="{{ route('admin.orders.index') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.orders.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
<a href="{{ route('admin.makerworld.index') }}" class="block px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.makerworld.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
MakerWorld Sync
</a>
</div>
</div>
<div>
<span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 px-3 block mb-1">Verkoop & Klanten</span>
<div class="space-y-0.5">
<a href="{{ route('admin.orders.index') }}" class="block px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.orders.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Bestellingen
</a>
<a href="{{ route('admin.communications.index') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.communications.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Communicatie
<a href="{{ route('admin.communications.index') }}" class="flex items-center justify-between px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.communications.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
<span>Communicatie</span>
@if(($unreadCommCount ?? 0) > 0)
<span class="ml-2 px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-sky-500 text-white">
<span class="px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-sky-500 text-white">
{{ $unreadCommCount }}
</span>
@endif
</a>
<a href="{{ route('admin.customers.index') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.customers.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
<a href="{{ route('admin.customers.index') }}" class="block px-3 py-1.5 rounded-lg {{ request()->routeIs('admin.customers.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
Klanten &amp; Profielen
</a>
<a href="{{ route('admin.makerworld.index') }}" class="block px-3 py-2 rounded-lg {{ request()->routeIs('admin.makerworld.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
MakerWorld Sync
</a>
</div>
</div>
</div>
</header>