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:
@@ -3,6 +3,7 @@ APP_ENV=production
|
|||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=false
|
APP_DEBUG=false
|
||||||
APP_URL=https://jouwdriedee.nl
|
APP_URL=https://jouwdriedee.nl
|
||||||
|
APP_TIMEZONE=Europe/Amsterdam
|
||||||
|
|
||||||
APP_LOCALE=nl
|
APP_LOCALE=nl
|
||||||
APP_FALLBACK_LOCALE=nl
|
APP_FALLBACK_LOCALE=nl
|
||||||
|
|||||||
@@ -6,13 +6,12 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Mail\ContactInquiryReplyMail;
|
use App\Mail\ContactInquiryReplyMail;
|
||||||
use App\Models\Communication;
|
use App\Models\Communication;
|
||||||
use App\Models\CommunicationReply;
|
use App\Models\CommunicationReply;
|
||||||
|
use App\Services\DatabaseSchemaHelper;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class CommunicationController extends Controller
|
class CommunicationController extends Controller
|
||||||
@@ -22,9 +21,7 @@ class CommunicationController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request): View
|
public function index(Request $request): View
|
||||||
{
|
{
|
||||||
if (! Schema::hasTable('communications')) {
|
DatabaseSchemaHelper::ensureCommunicationsTables();
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = Communication::with(['user', 'order', 'replies'])->latest();
|
$query = Communication::with(['user', 'order', 'replies'])->latest();
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Models\Communication;
|
use App\Models\Communication;
|
||||||
use App\Models\Order;
|
use App\Models\Order;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Services\DatabaseSchemaHelper;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class CustomerController extends Controller
|
class CustomerController extends Controller
|
||||||
@@ -19,9 +18,7 @@ class CustomerController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request): View
|
public function index(Request $request): View
|
||||||
{
|
{
|
||||||
if (! Schema::hasTable('communications')) {
|
DatabaseSchemaHelper::ensureCommunicationsTables();
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$search = trim($request->input('q', ''));
|
$search = trim($request->input('q', ''));
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ use App\Mail\ContactInquiryReceivedMail;
|
|||||||
use App\Models\Communication;
|
use App\Models\Communication;
|
||||||
use App\Models\Order;
|
use App\Models\Order;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
|
use App\Services\DatabaseSchemaHelper;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class ContactController extends Controller
|
class ContactController extends Controller
|
||||||
@@ -62,13 +61,7 @@ class ContactController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! Schema::hasTable('communications')) {
|
DatabaseSchemaHelper::ensureCommunicationsTables();
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! \Illuminate\Support\Facades\Schema::hasTable('communications')) {
|
|
||||||
\Illuminate\Support\Facades\Artisan::call('migrate', ['--force' => true]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$communication = Communication::create([
|
$communication = Communication::create([
|
||||||
'user_id' => Auth::id(),
|
'user_id' => Auth::id(),
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Services\DatabaseSchemaHelper;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class EnsureUserIsAdmin
|
class EnsureUserIsAdmin
|
||||||
@@ -28,13 +26,7 @@ class EnsureUserIsAdmin
|
|||||||
|
|
||||||
// Auto-migrate check: Ensure that new database tables (like communications) are migrated
|
// 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.
|
// automatically when an admin enters the admin panel, avoiding 500 errors on Coolify/production.
|
||||||
try {
|
DatabaseSchemaHelper::ensureCommunicationsTables();
|
||||||
if (! Schema::hasTable('communications')) {
|
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
|
||||||
}
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
Log::warning('Auto-migration in EnsureUserIsAdmin failed: '.$e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
@@ -65,7 +65,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'timezone' => 'UTC',
|
'timezone' => env('APP_TIMEZONE', 'Europe/Amsterdam'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -11,31 +11,35 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('communications', function (Blueprint $table) {
|
if (! Schema::hasTable('communications')) {
|
||||||
$table->id();
|
Schema::create('communications', function (Blueprint $table) {
|
||||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
$table->id();
|
||||||
$table->foreignId('order_id')->nullable()->constrained('orders')->nullOnDelete();
|
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||||
$table->string('name');
|
$table->foreignId('order_id')->nullable()->constrained('orders')->nullOnDelete();
|
||||||
$table->string('email')->index();
|
$table->string('name');
|
||||||
$table->string('phone')->nullable();
|
$table->string('email')->index();
|
||||||
$table->string('subject');
|
$table->string('phone')->nullable();
|
||||||
$table->text('message');
|
$table->string('subject');
|
||||||
$table->string('status')->default('new')->index(); // new, in_progress, resolved, closed
|
$table->text('message');
|
||||||
$table->text('admin_notes')->nullable();
|
$table->string('status')->default('new')->index(); // new, in_progress, resolved, closed
|
||||||
$table->string('ip_address', 45)->nullable();
|
$table->text('admin_notes')->nullable();
|
||||||
$table->text('user_agent')->nullable();
|
$table->string('ip_address', 45)->nullable();
|
||||||
$table->timestamp('last_replied_at')->nullable();
|
$table->text('user_agent')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamp('last_replied_at')->nullable();
|
||||||
});
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Schema::create('communication_replies', function (Blueprint $table) {
|
if (! Schema::hasTable('communication_replies')) {
|
||||||
$table->id();
|
Schema::create('communication_replies', function (Blueprint $table) {
|
||||||
$table->foreignId('communication_id')->constrained('communications')->cascadeOnDelete();
|
$table->id();
|
||||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
$table->foreignId('communication_id')->constrained('communications')->cascadeOnDelete();
|
||||||
$table->boolean('is_admin_reply')->default(true);
|
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||||
$table->text('message');
|
$table->boolean('is_admin_reply')->default(true);
|
||||||
$table->timestamps();
|
$table->text('message');
|
||||||
});
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -295,9 +295,9 @@
|
|||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<span>Laatste controle:</span>
|
<span>Laatste controle:</span>
|
||||||
<span class="font-mono text-slate-700 font-medium">
|
<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)
|
@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
|
@endif
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,96 +24,191 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</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) -->
|
<!-- 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">
|
<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="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 -->
|
<!-- Brand / Logo (Always strictly shrink-0 so it never overlaps or wraps) -->
|
||||||
<div class="flex items-center space-x-6">
|
<div class="flex items-center space-x-3 shrink-0">
|
||||||
<a href="{{ route('admin.content.index') }}" class="flex items-center space-x-2.5 group">
|
<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-7 w-auto">
|
<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-medium text-[11px] tracking-wide">Studio CMS</span>
|
<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 {
|
||||||
|
if (\Illuminate\Support\Facades\Schema::hasTable('products')) {
|
||||||
|
$draftBadgeCount = \App\Models\Product::where('status', 'draft')->count();
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$draftBadgeCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$unreadCommCount = 0;
|
||||||
|
try {
|
||||||
|
if (\Illuminate\Support\Facades\Schema::hasTable('communications')) {
|
||||||
|
$unreadCommCount = \App\Models\Communication::where('status', 'new')->count();
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$unreadCommCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$isCatalogActive = request()->routeIs(['admin.products.*', 'admin.makerworld.*', 'admin.categories.*']);
|
||||||
|
$isRelationsActive = request()->routeIs(['admin.communications.*', 'admin.customers.*']);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<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>
|
</a>
|
||||||
|
|
||||||
<!-- Desktop Nav Links -->
|
<!-- 2. Assortiment (Grouped Dropdown) -->
|
||||||
<nav class="hidden md:flex items-center space-x-1 text-xs font-medium">
|
<div class="relative" @click.outside="catalogOpen = false">
|
||||||
<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' }}">
|
<button
|
||||||
<i data-lucide="palette" class="w-3.5 h-3.5"></i>
|
type="button"
|
||||||
<span>Layout & Teksten</span>
|
@click="catalogOpen = !catalogOpen; relationsOpen = false"
|
||||||
</a>
|
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' }}"
|
||||||
|
>
|
||||||
<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>
|
<i data-lucide="box" class="w-3.5 h-3.5"></i>
|
||||||
<span>Producten</span>
|
<span>Assortiment</span>
|
||||||
</a>
|
|
||||||
|
|
||||||
@php
|
|
||||||
$draftBadgeCount = 0;
|
|
||||||
try {
|
|
||||||
if (\Illuminate\Support\Facades\Schema::hasTable('products')) {
|
|
||||||
$draftBadgeCount = \App\Models\Product::where('status', 'draft')->count();
|
|
||||||
}
|
|
||||||
} 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)
|
@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' }}">
|
<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 }}
|
{{ $draftBadgeCount }}
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
</a>
|
<i data-lucide="chevron-down" class="w-3 h-3 text-slate-400 transition-transform duration-200" :class="catalogOpen ? 'rotate-180' : ''"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
<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' }}">
|
<!-- Dropdown Menu -->
|
||||||
<i data-lucide="folder-tree" class="w-3.5 h-3.5"></i>
|
<div
|
||||||
<span>Categorieën</span>
|
x-show="catalogOpen"
|
||||||
</a>
|
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.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' }}">
|
<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' }}">
|
||||||
<i data-lucide="shopping-cart" class="w-3.5 h-3.5"></i>
|
<div class="flex items-center space-x-2.5">
|
||||||
<span>Bestellingen</span>
|
<i data-lucide="layers" class="w-3.5 h-3.5 text-slate-400"></i>
|
||||||
</a>
|
<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>
|
||||||
|
|
||||||
@php
|
<div class="my-1 border-t border-slate-100"></div>
|
||||||
$unreadCommCount = 0;
|
|
||||||
try {
|
<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' }}">
|
||||||
if (\Illuminate\Support\Facades\Schema::hasTable('communications')) {
|
<i data-lucide="folder-tree" class="w-3.5 h-3.5 text-slate-400"></i>
|
||||||
$unreadCommCount = \App\Models\Communication::where('status', 'new')->count();
|
<div>
|
||||||
}
|
<div class="font-medium text-slate-900">Categorieën</div>
|
||||||
} catch (\Throwable $e) {
|
<div class="text-[11px] text-slate-500">Winkelindeling beheren</div>
|
||||||
$unreadCommCount = 0;
|
</div>
|
||||||
}
|
</a>
|
||||||
@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' }}">
|
<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="message-square" class="w-3.5 h-3.5"></i>
|
<i data-lucide="download-cloud" class="w-3.5 h-3.5 text-slate-400"></i>
|
||||||
<span>Communicatie</span>
|
<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)
|
@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 }}
|
{{ $unreadCommCount }}
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
</a>
|
<i data-lucide="chevron-down" class="w-3 h-3 text-slate-400 transition-transform duration-200" :class="relationsOpen ? 'rotate-180' : ''"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
<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' }}">
|
<!-- Dropdown Menu -->
|
||||||
<i data-lucide="users" class="w-3.5 h-3.5"></i>
|
<div
|
||||||
<span>Klanten</span>
|
x-show="relationsOpen"
|
||||||
</a>
|
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.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' }}">
|
<div class="my-1 border-t border-slate-100"></div>
|
||||||
<i data-lucide="download-cloud" class="w-3.5 h-3.5"></i>
|
|
||||||
<span>MakerWorld Sync</span>
|
<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' }}">
|
||||||
</a>
|
<i data-lucide="users" class="w-3.5 h-3.5 text-slate-400"></i>
|
||||||
</nav>
|
<div>
|
||||||
</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 -->
|
<!-- Right Actions -->
|
||||||
<div class="flex items-center space-x-2.5">
|
<div class="flex items-center space-x-2 shrink-0">
|
||||||
@php
|
@php
|
||||||
$isShopOffline = false;
|
$isShopOffline = false;
|
||||||
try {
|
try {
|
||||||
@@ -125,30 +220,29 @@
|
|||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<!-- Webshop Offline / Online Status Switcher -->
|
<!-- Webshop Offline / Online Status Switcher (Compact) -->
|
||||||
<form action="{{ route('admin.toggle-offline') }}" method="POST" class="inline">
|
<form action="{{ route('admin.toggle-offline') }}" method="POST" class="inline">
|
||||||
@csrf
|
@csrf
|
||||||
@if($isShopOffline)
|
@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 class="w-1.5 h-1.5 rounded-full bg-white animate-pulse"></span>
|
||||||
<span>Webshop: Offline</span>
|
<span>Offline</span>
|
||||||
</button>
|
</button>
|
||||||
@else
|
@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="w-1.5 h-1.5 rounded-full bg-emerald-500"></span>
|
||||||
<span class="hidden sm:inline">Webshop: Live</span>
|
<span class="hidden sm:inline">Live</span>
|
||||||
<span class="text-[10px] text-slate-400">(Offline zetten)</span>
|
|
||||||
</button>
|
</button>
|
||||||
@endif
|
@endif
|
||||||
</form>
|
</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">
|
<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>Webshop</span>
|
<span class="hidden sm:inline">Webshop</span>
|
||||||
<i data-lucide="external-link" class="w-3.5 h-3.5 text-slate-400"></i>
|
<i data-lucide="external-link" class="w-3.5 h-3.5 text-slate-400"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Mobile trigger -->
|
<!-- Mobile trigger (Shown on screens below lg) -->
|
||||||
<button @click="mobileNav = !mobileNav" type="button" class="md:hidden p-1.5 rounded-lg text-slate-600 hover:bg-slate-100">
|
<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>
|
<i data-lucide="menu" class="w-5 h-5"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -156,42 +250,57 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Mobile Drawer -->
|
<!-- Mobile Drawer (Clean, Grouped Sections) -->
|
||||||
<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">
|
<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">
|
||||||
<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' }}">
|
<div>
|
||||||
Layout & Teksten
|
<span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 px-3 block mb-1">Content & Layout</span>
|
||||||
</a>
|
<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' }}">
|
||||||
<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' }}">
|
Layout & Teksten
|
||||||
Producten
|
</a>
|
||||||
</a>
|
</div>
|
||||||
<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)
|
<div>
|
||||||
@if(($draftBadgeCount ?? 0) > 0)
|
<span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 px-3 block mb-1">Assortiment</span>
|
||||||
<span class="ml-2 px-1.5 py-0.5 rounded-full text-[10px] font-semibold bg-slate-200 text-slate-800">
|
<div class="space-y-0.5">
|
||||||
{{ $draftBadgeCount }}
|
<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' }}">
|
||||||
</span>
|
Producten
|
||||||
@endif
|
</a>
|
||||||
</a>
|
<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' }}">
|
||||||
<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' }}">
|
<span>Artikel Beheer (Geïmporteerd)</span>
|
||||||
Categorieën
|
@if(($draftBadgeCount ?? 0) > 0)
|
||||||
</a>
|
<span class="px-1.5 py-0.5 rounded-full text-[10px] font-semibold bg-slate-200 text-slate-800">
|
||||||
<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' }}">
|
{{ $draftBadgeCount }}
|
||||||
Bestellingen
|
</span>
|
||||||
</a>
|
@endif
|
||||||
<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' }}">
|
</a>
|
||||||
Communicatie
|
<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' }}">
|
||||||
@if(($unreadCommCount ?? 0) > 0)
|
Categorieën
|
||||||
<span class="ml-2 px-1.5 py-0.5 rounded-full text-[10px] font-bold bg-sky-500 text-white">
|
</a>
|
||||||
{{ $unreadCommCount }}
|
<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' }}">
|
||||||
</span>
|
MakerWorld Sync
|
||||||
@endif
|
</a>
|
||||||
</a>
|
</div>
|
||||||
<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' }}">
|
</div>
|
||||||
Klanten & Profielen
|
|
||||||
</a>
|
<div>
|
||||||
<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' }}">
|
<span class="text-[10px] font-semibold uppercase tracking-wider text-slate-400 px-3 block mb-1">Verkoop & Klanten</span>
|
||||||
MakerWorld Sync
|
<div class="space-y-0.5">
|
||||||
</a>
|
<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="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="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-1.5 rounded-lg {{ request()->routeIs('admin.customers.*') ? 'bg-slate-100 text-slate-900 font-semibold' : 'text-slate-600 hover:bg-slate-50' }}">
|
||||||
|
Klanten & Profielen
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user