Files
jouwdriedee/resources/views/admin/communications/index.blade.php
T

224 lines
13 KiB
PHP

@extends('layouts.admin')
@section('title', 'Communicatie & Klantvragen | Jouwdriedee Beheer')
@section('content')
<div class="space-y-6">
<!-- Header Section -->
<div class="flex flex-col sm:flex-row sm:items-center justify-between pb-6 border-b border-slate-200/80 gap-4">
<div>
<div class="inline-flex items-center space-x-1.5 text-xs text-slate-500 font-medium mb-1">
<i data-lucide="message-square" class="w-3.5 h-3.5"></i>
<span>Klantenservice &amp; Inquiries</span>
</div>
<h1 class="text-2xl font-bold tracking-tight text-slate-900">Communicatie ({{ $counts['all'] }})</h1>
<p class="text-xs text-slate-500 mt-1">
Overzicht van binnengekomen vragen via de webshop, afschriften en verzonden reacties.
</p>
</div>
<div class="flex items-center space-x-2">
<a href="{{ route('admin.customers.index') }}" class="px-3.5 py-2 rounded-xl bg-white hover:bg-slate-50 text-slate-700 text-xs font-medium transition flex items-center space-x-1.5 border border-slate-200/80 shadow-2xs">
<i data-lucide="users" class="w-3.5 h-3.5 text-slate-400"></i>
<span>Klantprofielen</span>
</a>
<a href="{{ route('contact.index') }}" target="_blank" class="px-3.5 py-2 rounded-xl bg-slate-900 hover:bg-slate-800 text-white text-xs font-medium transition flex items-center space-x-1.5 shadow-xs">
<i data-lucide="external-link" class="w-3.5 h-3.5 text-slate-400"></i>
<span>Open Formulier</span>
</a>
</div>
</div>
<!-- Flash message -->
@if(session('success'))
<div class="p-3.5 rounded-xl bg-emerald-50 border border-emerald-200/60 text-emerald-800 text-xs flex items-center space-x-2.5">
<i data-lucide="check-circle" class="w-4 h-4 text-emerald-600 shrink-0"></i>
<span class="font-medium">{{ session('success') }}</span>
</div>
@endif
<!-- Filter & Search Bar -->
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
<!-- Status Tabs -->
<div class="flex items-center space-x-1.5 p-1 bg-slate-100/80 rounded-xl max-w-max text-xs font-medium overflow-x-auto">
<a href="{{ route('admin.communications.index', ['status' => 'all', 'q' => $search]) }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ $currentStatus === 'all' ? 'bg-white text-slate-900 font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900' }}">
<span>Alle</span>
<span class="px-1.5 py-0.2 rounded-md text-[10px] {{ $currentStatus === 'all' ? 'bg-slate-100 text-slate-700' : 'bg-slate-200/60 text-slate-600' }}">
{{ $counts['all'] }}
</span>
</a>
<a href="{{ route('admin.communications.index', ['status' => 'new', 'q' => $search]) }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ $currentStatus === 'new' ? 'bg-white text-slate-900 font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900' }}">
<span class="w-1.5 h-1.5 rounded-full bg-sky-500 {{ $counts['new'] > 0 ? 'animate-pulse' : '' }}"></span>
<span>Nieuw</span>
@if($counts['new'] > 0)
<span class="px-1.5 py-0.2 rounded-md text-[10px] bg-sky-100 text-sky-800 font-bold">
{{ $counts['new'] }}
</span>
@endif
</a>
<a href="{{ route('admin.communications.index', ['status' => 'in_progress', 'q' => $search]) }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ $currentStatus === 'in_progress' ? 'bg-white text-slate-900 font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900' }}">
<span>In behandeling</span>
<span class="px-1.5 py-0.2 rounded-md text-[10px] bg-slate-200/60 text-slate-600">
{{ $counts['in_progress'] }}
</span>
</a>
<a href="{{ route('admin.communications.index', ['status' => 'resolved', 'q' => $search]) }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ $currentStatus === 'resolved' ? 'bg-white text-slate-900 font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900' }}">
<span>Beantwoord</span>
<span class="px-1.5 py-0.2 rounded-md text-[10px] bg-slate-200/60 text-slate-600">
{{ $counts['resolved'] }}
</span>
</a>
<a href="{{ route('admin.communications.index', ['status' => 'closed', 'q' => $search]) }}" class="px-3 py-1.5 rounded-lg transition flex items-center space-x-1.5 {{ $currentStatus === 'closed' ? 'bg-white text-slate-900 font-semibold shadow-2xs' : 'text-slate-600 hover:text-slate-900' }}">
<span>Gesloten</span>
</a>
</div>
<!-- Search Form -->
<form action="{{ route('admin.communications.index') }}" method="GET" class="flex items-center space-x-2">
<input type="hidden" name="status" value="{{ $currentStatus }}">
<div class="relative w-full sm:w-64">
<input
type="text"
name="q"
value="{{ $search }}"
placeholder="Zoek op naam, e-mail..."
class="w-full pl-8 pr-3 py-1.5 bg-white border border-slate-200/80 rounded-xl text-xs text-slate-900 placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-slate-900 focus:border-slate-900"
>
<i data-lucide="search" class="w-3.5 h-3.5 text-slate-400 absolute left-2.5 top-1/2 -translate-y-1/2"></i>
</div>
@if($search)
<a href="{{ route('admin.communications.index', ['status' => $currentStatus]) }}" class="px-2.5 py-1.5 text-xs text-slate-500 hover:text-slate-800 transition">
Wissen
</a>
@endif
</form>
</div>
<!-- Communications Table Card -->
<div class="rounded-2xl bg-white border border-slate-200/80 overflow-hidden shadow-2xs">
<div class="overflow-x-auto">
<table class="w-full text-left text-xs text-slate-700">
<thead class="bg-slate-50/80 text-[11px] uppercase tracking-wider text-slate-500 font-semibold border-b border-slate-200/70">
<tr>
<th class="py-3 px-4 w-20">ID</th>
<th class="py-3 px-4 w-40">Datum &amp; Tijd</th>
<th class="py-3 px-4">Klant</th>
<th class="py-3 px-4">Onderwerp &amp; Vraag</th>
<th class="py-3 px-4 w-32">Status</th>
<th class="py-3 px-4 text-right w-28">Actie</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 font-medium">
@forelse($communications as $comm)
<tr class="hover:bg-slate-50/60 transition {{ $comm->status === 'new' ? 'bg-sky-50/30 font-semibold' : '' }}">
<!-- ID -->
<td class="py-3.5 px-4 font-mono text-slate-500">
#{{ $comm->id }}
</td>
<!-- Datum -->
<td class="py-3.5 px-4 text-slate-500 whitespace-nowrap">
<div>{{ $comm->created_at->format('d-m-Y') }}</div>
<div class="text-[10px] text-slate-400 font-mono">{{ $comm->created_at->format('H:i') }}</div>
</td>
<!-- Klant -->
<td class="py-3.5 px-4">
<div class="flex items-center space-x-2">
<a href="{{ route('admin.customers.show', $comm->user_id ?? $comm->email) }}" class="font-semibold text-slate-900 hover:underline">
{{ $comm->name }}
</a>
@if($comm->user_id)
<span class="px-1.5 py-0.2 rounded bg-slate-100 text-slate-600 text-[10px] font-normal" title="Geregistreerde klant">
Account
</span>
@else
<span class="px-1.5 py-0.2 rounded bg-slate-50 text-slate-400 text-[10px] font-normal" title="Gastbezoeker">
Gast
</span>
@endif
</div>
<div class="text-[11px] text-slate-400 font-normal">
{{ $comm->email }}
</div>
@if($comm->order)
<div class="text-[10px] text-slate-500 mt-0.5">
Betreft order:
<a href="{{ route('admin.orders.show', $comm->order) }}" class="font-mono text-indigo-600 hover:underline">
#{{ $comm->order->order_number }}
</a>
</div>
@endif
</td>
<!-- Onderwerp & Snippet -->
<td class="py-3.5 px-4">
<a href="{{ route('admin.communications.show', $comm) }}" class="font-bold text-slate-900 hover:text-slate-700 block truncate max-w-md">
{{ $comm->subject }}
</a>
<p class="text-[11px] text-slate-500 font-normal line-clamp-1 max-w-md mt-0.5">
{{ $comm->message }}
</p>
@if($comm->replies->isNotEmpty())
<span class="inline-flex items-center space-x-1 text-[10px] text-emerald-700 font-semibold mt-1">
<i data-lucide="check" class="w-3 h-3"></i>
<span>{{ $comm->replies->count() }} reactie(s) verzonden</span>
</span>
@endif
</td>
<!-- Status Badge -->
<td class="py-3.5 px-4 whitespace-nowrap">
<span class="px-2.5 py-0.5 rounded-full text-[10px] font-semibold
@if($comm->status === 'new') bg-sky-50 text-sky-700 border border-sky-200/80
@elseif($comm->status === 'in_progress') bg-amber-50 text-amber-700 border border-amber-200/80
@elseif($comm->status === 'resolved') bg-emerald-50 text-emerald-700 border border-emerald-200/80
@else bg-slate-100 text-slate-600 border border-slate-200/60
@endif">
{{ $comm->status_label }}
</span>
</td>
<!-- Actie -->
<td class="py-3.5 px-4 text-right whitespace-nowrap">
<a href="{{ route('admin.communications.show', $comm) }}" class="inline-flex items-center space-x-1 px-2.5 py-1 rounded-lg bg-slate-100 hover:bg-slate-900 text-slate-700 hover:text-white text-xs font-medium transition">
<span>Bekijken</span>
<i data-lucide="chevron-right" class="w-3 h-3"></i>
</a>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="py-12 text-center text-slate-400">
<div class="w-10 h-10 rounded-xl bg-slate-100 flex items-center justify-center text-slate-400 mx-auto mb-2">
<i data-lucide="inbox" class="w-5 h-5"></i>
</div>
<p class="text-xs font-medium text-slate-600">Geen berichten gevonden</p>
<p class="text-[11px] text-slate-400 mt-0.5">Vragen van klanten via het contactformulier verschijnen hier direct.</p>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if($communications->hasPages())
<div class="p-4 border-t border-slate-100">
{{ $communications->links() }}
</div>
@endif
</div>
</div>
@endsection