276 lines
16 KiB
PHP
276 lines
16 KiB
PHP
@extends('layouts.vending')
|
|
|
|
@section('title', 'Mandanten verwalten')
|
|
|
|
@section('content')
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div class="flex flex-col sm:flex-row sm:justify-between sm:items-center mb-6 sm:mb-8 space-y-4 sm:space-y-0">
|
|
<div>
|
|
<h1 class="text-2xl sm:text-3xl font-bold text-gray-900">Mandanten verwalten</h1>
|
|
<p class="text-gray-600 mt-1 sm:mt-2">Übersicht aller Mandanten im System</p>
|
|
</div>
|
|
<div class="flex items-center space-x-3">
|
|
<a href="{{ route('tenants.select') }}"
|
|
class="inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-lg text-gray-700 bg-white hover:bg-gray-50">
|
|
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
|
|
</svg>
|
|
Zurück zur Auswahl
|
|
</a>
|
|
<a href="{{ route('admin.tenants.create') }}"
|
|
class="inline-flex items-center px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700">
|
|
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
|
|
</svg>
|
|
Neuer Mandant
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
@if(session('success'))
|
|
<div class="mb-6 bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg">
|
|
<div class="flex items-center">
|
|
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
</svg>
|
|
{{ session('success') }}
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if(session('error'))
|
|
<div class="mb-6 bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg">
|
|
<div class="flex items-center">
|
|
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
</svg>
|
|
{{ session('error') }}
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
@if($tenants->count() > 0)
|
|
<!-- Desktop Table View (hidden on mobile) -->
|
|
<div class="hidden lg:block bg-white shadow rounded-lg overflow-hidden">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Mandant
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Beschreibung
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Statistiken
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Status
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Erstellt
|
|
</th>
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Aktionen
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
@foreach($tenants as $tenant)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0 h-12 w-12">
|
|
@if($tenant->logo)
|
|
<img src="{{ asset('storage/' . $tenant->logo) }}" alt="{{ $tenant->name }}" class="h-12 w-12 rounded-full object-cover">
|
|
@else
|
|
<div class="h-12 w-12 rounded-full bg-blue-100 flex items-center justify-center">
|
|
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
|
|
</svg>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
<div class="ml-4">
|
|
<div class="text-sm font-medium text-gray-900">
|
|
{{ $tenant->name }}
|
|
</div>
|
|
<div class="text-sm text-gray-500">
|
|
{{ $tenant->slug }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<div class="text-sm text-gray-900">{{ Str::limit($tenant->description ?? 'Keine Beschreibung', 60) }}</div>
|
|
@if($tenant->domain)
|
|
<div class="text-sm text-gray-500">Domain: {{ $tenant->domain }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="text-sm text-gray-900">
|
|
{{ $tenant->users_count }} Benutzer
|
|
</div>
|
|
<div class="text-sm text-gray-500">
|
|
{{ $tenant->vending_machines_count }} Automaten, {{ $tenant->products_count }} Produkte
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
@if($tenant->is_active)
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
Aktiv
|
|
</span>
|
|
@else
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
|
Inaktiv
|
|
</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ $tenant->created_at->format('d.m.Y') }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
|
<div class="flex justify-end space-x-2">
|
|
<a href="{{ route('tenants.switch', $tenant) }}" class="text-blue-600 hover:text-blue-900">
|
|
Auswählen
|
|
</a>
|
|
<a href="{{ route('admin.tenants.edit', $tenant) }}" class="text-indigo-600 hover:text-indigo-900">
|
|
Bearbeiten
|
|
</a>
|
|
@if(!$tenant->is_active)
|
|
<button class="text-green-600 hover:text-green-900">
|
|
Aktivieren
|
|
</button>
|
|
@else
|
|
<button class="text-yellow-600 hover:text-yellow-900">
|
|
Deaktivieren
|
|
</button>
|
|
@endif
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Mobile Card View (visible on mobile/tablet) -->
|
|
<div class="lg:hidden space-y-4">
|
|
@foreach($tenants as $tenant)
|
|
<div class="bg-white shadow rounded-lg p-6 hover:shadow-lg transition-shadow">
|
|
<!-- Header with Logo and Status -->
|
|
<div class="flex items-start justify-between mb-4">
|
|
<div class="flex items-center">
|
|
@if($tenant->logo)
|
|
<img src="{{ asset('storage/' . $tenant->logo) }}" alt="{{ $tenant->name }}" class="h-12 w-12 rounded-full object-cover">
|
|
@else
|
|
<div class="h-12 w-12 rounded-full bg-blue-100 flex items-center justify-center">
|
|
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
|
|
</svg>
|
|
</div>
|
|
@endif
|
|
<div class="ml-4">
|
|
<h3 class="text-lg font-semibold text-gray-900">{{ $tenant->name }}</h3>
|
|
<p class="text-sm text-gray-500">{{ $tenant->slug }}</p>
|
|
</div>
|
|
</div>
|
|
@if($tenant->is_active)
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
Aktiv
|
|
</span>
|
|
@else
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
|
|
Inaktiv
|
|
</span>
|
|
@endif
|
|
</div>
|
|
|
|
<!-- Description -->
|
|
@if($tenant->description)
|
|
<div class="mb-4">
|
|
<p class="text-sm text-gray-600">{{ $tenant->description }}</p>
|
|
</div>
|
|
@endif
|
|
|
|
<!-- Stats -->
|
|
<div class="grid grid-cols-3 gap-4 mb-4">
|
|
<div class="text-center">
|
|
<div class="text-lg font-semibold text-blue-600">{{ $tenant->users_count }}</div>
|
|
<div class="text-xs text-gray-500">Benutzer</div>
|
|
</div>
|
|
<div class="text-center">
|
|
<div class="text-lg font-semibold text-green-600">{{ $tenant->vending_machines_count }}</div>
|
|
<div class="text-xs text-gray-500">Automaten</div>
|
|
</div>
|
|
<div class="text-center">
|
|
<div class="text-lg font-semibold text-purple-600">{{ $tenant->products_count }}</div>
|
|
<div class="text-xs text-gray-500">Produkte</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex flex-wrap gap-2 pt-4 border-t border-gray-200">
|
|
<a href="{{ route('tenants.switch', $tenant) }}"
|
|
class="inline-flex items-center px-3 py-1.5 border border-blue-300 text-sm font-medium rounded-md text-blue-700 bg-blue-50 hover:bg-blue-100">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"></path>
|
|
</svg>
|
|
Auswählen
|
|
</a>
|
|
<a href="{{ route('admin.tenants.edit', $tenant) }}"
|
|
class="inline-flex items-center px-3 py-1.5 border border-indigo-300 text-sm font-medium rounded-md text-indigo-700 bg-indigo-50 hover:bg-indigo-100">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
|
|
</svg>
|
|
Bearbeiten
|
|
</a>
|
|
@if(!$tenant->is_active)
|
|
<button class="inline-flex items-center px-3 py-1.5 border border-green-300 text-sm font-medium rounded-md text-green-700 bg-green-50 hover:bg-green-100">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
</svg>
|
|
Aktivieren
|
|
</button>
|
|
@else
|
|
<button class="inline-flex items-center px-3 py-1.5 border border-yellow-300 text-sm font-medium rounded-md text-yellow-700 bg-yellow-50 hover:bg-yellow-100">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 9V6a4 4 0 118 0v3M5 9h14l1 12H4L5 9z"></path>
|
|
</svg>
|
|
Deaktivieren
|
|
</button>
|
|
@endif
|
|
</div>
|
|
|
|
<!-- Meta Info -->
|
|
<div class="mt-4 pt-3 border-t border-gray-200 text-xs text-gray-500">
|
|
Erstellt: {{ $tenant->created_at->format('d.m.Y H:i') }}
|
|
@if($tenant->domain)
|
|
• Domain: {{ $tenant->domain }}
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<div class="mt-6">
|
|
{{ $tenants->links() }}
|
|
</div>
|
|
@else
|
|
<div class="text-center py-12">
|
|
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/>
|
|
</svg>
|
|
<h3 class="mt-2 text-sm font-medium text-gray-900">Keine Mandanten</h3>
|
|
<p class="mt-1 text-sm text-gray-500">Beginnen Sie mit der Erstellung des ersten Mandanten.</p>
|
|
<div class="mt-6">
|
|
<a href="{{ route('admin.tenants.create') }}"
|
|
class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700">
|
|
Ersten Mandanten erstellen
|
|
</a>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endsection |