Files
marcoandClaude Sonnet 4.6 41078fdc08 Initial commit: WitShop Laravel Online-Shop
- Laravel 11, Blade, Alpine.js, Tailwind CSS
- Produkt- & Kategorieverwaltung mit Varianten
- Checkout (Vorkasse + Rechnung), Session-Warenkorb
- Admin-Backend (Dashboard, Bestellungen, Kunden, CMS)
- DSGVO-konform: Cookie-Consent, Impressum, Widerruf, AGB
- PDF-Rechnung via dompdf, SMTP-Mailversand
- Kundenverwaltung mit manueller Freischaltung

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 00:34:09 +02:00

105 lines
5.4 KiB
PHP

@extends('layouts.admin')
@section('title', 'Kunden')
@section('content')
@php $pendingCount = \App\Models\User::where('role','customer')->where('approved', false)->count(); @endphp
@if($pendingCount > 0)
<div class="mb-4 bg-amber-50 border border-amber-200 rounded-lg px-4 py-3 flex items-center gap-3 text-sm text-amber-800">
<svg class="w-5 h-5 shrink-0 text-amber-500" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>
<span><strong>{{ $pendingCount }} Kunde{{ $pendingCount > 1 ? 'n' : '' }}</strong> warte{{ $pendingCount > 1 ? 'n' : 't' }} auf Freischaltung.</span>
</div>
@endif
<div class="flex items-center gap-4 mb-6">
<h2 class="text-lg font-semibold">Kunden</h2>
<form method="GET" class="flex gap-2 ml-2">
<input type="text" name="q" value="{{ request('q') }}"
placeholder="Name oder E-Mail …"
class="border rounded px-3 py-1.5 text-sm w-64">
<button class="bg-gray-200 px-3 py-1.5 rounded text-sm hover:bg-gray-300">Suchen</button>
@if(request('q'))
<a href="{{ route('admin.customers.index') }}" class="px-3 py-1.5 rounded text-sm text-gray-500 hover:bg-gray-100">✕ Zurücksetzen</a>
@endif
</form>
<span class="ml-auto text-sm text-gray-400">{{ $customers->total() }} Kunden gesamt</span>
</div>
<div class="bg-white rounded shadow overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50 text-left border-b">
<tr>
<th class="px-4 py-3">Name</th>
<th class="px-4 py-3">E-Mail</th>
<th class="px-4 py-3">Registriert</th>
<th class="px-4 py-3 text-center">Bestellungen</th>
<th class="px-4 py-3">Verifiziert</th>
<th class="px-4 py-3 text-center">Status</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y">
@forelse($customers as $customer)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 font-medium">
<a href="{{ route('admin.customers.show', $customer) }}" class="hover:text-blue-600">
{{ $customer->name }}
</a>
</td>
<td class="px-4 py-3 text-gray-600">{{ $customer->email }}</td>
<td class="px-4 py-3 text-gray-400">{{ $customer->created_at->format('d.m.Y') }}</td>
<td class="px-4 py-3 text-center">
@if($customer->orders_count > 0)
<a href="{{ route('admin.customers.show', $customer) }}"
class="inline-flex items-center justify-center w-7 h-7 rounded-full bg-blue-100 text-blue-700 font-semibold text-xs hover:bg-blue-200">
{{ $customer->orders_count }}
</a>
@else
<span class="text-gray-300">—</span>
@endif
</td>
<td class="px-4 py-3">
@if($customer->email_verified_at)
<span class="text-green-600 text-xs font-medium">✓ Ja</span>
@else
<span class="text-orange-500 text-xs">Ausstehend</span>
@endif
</td>
<td class="px-4 py-3 text-center">
<form method="POST" action="{{ route('admin.customers.toggle-approval', $customer) }}">
@csrf
<button type="submit"
class="text-xs px-2.5 py-1 rounded-full font-medium transition
{{ $customer->approved
? 'bg-green-100 text-green-700 hover:bg-green-200'
: 'bg-red-100 text-red-700 hover:bg-red-200' }}">
{{ $customer->approved ? '✓ Aktiv' : '✗ Gesperrt' }}
</button>
</form>
</td>
<td class="px-4 py-3 text-right space-x-3">
<a href="{{ route('admin.customers.show', $customer) }}"
class="text-blue-600 hover:underline text-xs">Details</a>
<form method="POST" action="{{ route('admin.customers.destroy', $customer) }}"
class="inline" onsubmit="return confirm('Kunde und alle Daten löschen?')">
@csrf @method('DELETE')
<button class="text-red-500 hover:underline text-xs">Löschen</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-4 py-12 text-center text-gray-400">
@if(request('q'))
Keine Kunden für „{{ request('q') }}" gefunden.
@else
Noch keine registrierten Kunden.
@endif
</td>
</tr>
@endforelse
</tbody>
</table>
<div class="px-4 py-3 border-t">{{ $customers->withQueryString()->links() }}</div>
</div>
@endsection