193 lines
10 KiB
PHP
193 lines
10 KiB
PHP
@extends('layouts.vending')
|
|
|
|
@section('title', 'Admin Dashboard')
|
|
|
|
@section('content')
|
|
<div class="max-w-7xl mx-auto px-4">
|
|
<div class="mb-8">
|
|
<h1 class="text-3xl font-bold text-gray-900">Admin Dashboard</h1>
|
|
<p class="text-gray-600 mt-2">Verwalten Sie Ihre Snackautomaten, Produkte und Fächer</p>
|
|
</div>
|
|
|
|
<!-- Statistics Cards -->
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
|
|
<div class="bg-white overflow-hidden shadow rounded-lg">
|
|
<div class="p-5">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<div class="w-8 h-8 bg-blue-500 rounded-md flex items-center justify-center">
|
|
<svg class="w-5 h-5 text-white" 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>
|
|
</div>
|
|
<div class="ml-5 w-0 flex-1">
|
|
<dl>
|
|
<dt class="text-sm font-medium text-gray-500 truncate">Automaten</dt>
|
|
<dd class="text-lg font-medium text-gray-900">
|
|
@php
|
|
$tenantId = session('current_tenant_id');
|
|
$machineCount = $tenantId ? \App\Models\VendingMachine::where('tenant_id', $tenantId)->count() : \App\Models\VendingMachine::count();
|
|
@endphp
|
|
{{ $machineCount }}
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white overflow-hidden shadow rounded-lg">
|
|
<div class="p-5">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<div class="w-8 h-8 bg-green-500 rounded-md flex items-center justify-center">
|
|
<svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div class="ml-5 w-0 flex-1">
|
|
<dl>
|
|
<dt class="text-sm font-medium text-gray-500 truncate">Produkte</dt>
|
|
<dd class="text-lg font-medium text-gray-900">
|
|
@php
|
|
$productCount = $tenantId ? \App\Models\Product::where('tenant_id', $tenantId)->count() : \App\Models\Product::count();
|
|
@endphp
|
|
{{ $productCount }}
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white overflow-hidden shadow rounded-lg">
|
|
<div class="p-5">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<div class="w-8 h-8 bg-yellow-500 rounded-md flex items-center justify-center">
|
|
<svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div class="ml-5 w-0 flex-1">
|
|
<dl>
|
|
<dt class="text-sm font-medium text-gray-500 truncate">Fächer</dt>
|
|
<dd class="text-lg font-medium text-gray-900">
|
|
@php
|
|
if ($tenantId) {
|
|
$slotCount = \App\Models\Slot::whereHas('vendingMachine', function ($q) use ($tenantId) {
|
|
$q->where('tenant_id', $tenantId);
|
|
})->count();
|
|
} else {
|
|
$slotCount = \App\Models\Slot::count();
|
|
}
|
|
@endphp
|
|
{{ $slotCount }}
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white overflow-hidden shadow rounded-lg">
|
|
<div class="p-5">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<div class="w-8 h-8 bg-purple-500 rounded-md flex items-center justify-center">
|
|
<svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div class="ml-5 w-0 flex-1">
|
|
<dl>
|
|
<dt class="text-sm font-medium text-gray-500 truncate">Befüllte Fächer</dt>
|
|
<dd class="text-lg font-medium text-gray-900">
|
|
@php
|
|
if ($tenantId) {
|
|
$filledSlotCount = \App\Models\SlotProduct::whereHas('slot.vendingMachine', function ($q) use ($tenantId) {
|
|
$q->where('tenant_id', $tenantId);
|
|
})->where('quantity', '>', 0)->count();
|
|
} else {
|
|
$filledSlotCount = \App\Models\SlotProduct::where('quantity', '>', 0)->count();
|
|
}
|
|
@endphp
|
|
{{ $filledSlotCount }}
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Quick Actions -->
|
|
<div class="grid grid-cols-1 md:grid-cols-{{ Auth::user()->isSuperAdmin() ? '4' : '3' }} gap-6 items-stretch">
|
|
@if(Auth::user()->isSuperAdmin())
|
|
<div class="bg-white overflow-hidden shadow rounded-lg h-full flex flex-col">
|
|
<div class="p-5 flex-1 flex flex-col">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-4">Mandantenverwaltung</h3>
|
|
<p class="text-gray-600 mb-4 flex-1">Verwalten Sie alle Mandanten im System</p>
|
|
<div class="space-y-2 mt-auto">
|
|
<a href="{{ route('admin.tenants.index') }}" class="block w-full bg-indigo-600 text-white text-center py-2 px-4 rounded hover:bg-indigo-700">
|
|
Mandanten verwalten
|
|
</a>
|
|
<a href="{{ route('tenants.select') }}" class="block w-full bg-purple-600 text-white text-center py-2 px-4 rounded hover:bg-purple-700">
|
|
Mandant wählen
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="bg-white overflow-hidden shadow rounded-lg h-full flex flex-col">
|
|
<div class="p-5 flex-1 flex flex-col">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-4">Produktverwaltung</h3>
|
|
<p class="text-gray-600 mb-4 flex-1">Verwalten Sie Ihren Produktkatalog mit LMIV-Daten</p>
|
|
<div class="space-y-2 mt-auto">
|
|
<a href="{{ route('products.index') }}" class="block w-full bg-blue-600 text-white text-center py-2 px-4 rounded hover:bg-blue-700">
|
|
Produkte verwalten
|
|
</a>
|
|
<a href="{{ route('products.create') }}" class="block w-full bg-green-600 text-white text-center py-2 px-4 rounded hover:bg-green-700">
|
|
Neues Produkt
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white overflow-hidden shadow rounded-lg h-full flex flex-col">
|
|
<div class="p-5 flex-1 flex flex-col">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-4">Automatenverwaltung</h3>
|
|
<p class="text-gray-600 mb-4 flex-1">Konfigurieren Sie Ihre Snackautomaten und Fächer</p>
|
|
<div class="space-y-2 mt-auto">
|
|
<a href="{{ route('vending-machines.index') }}" class="block w-full bg-blue-600 text-white text-center py-2 px-4 rounded hover:bg-blue-700">
|
|
Automaten verwalten
|
|
</a>
|
|
<a href="{{ route('vending-machines.create') }}" class="block w-full bg-green-600 text-white text-center py-2 px-4 rounded hover:bg-green-700">
|
|
Neuer Automat
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white overflow-hidden shadow rounded-lg h-full flex flex-col">
|
|
<div class="p-5 flex-1 flex flex-col">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-4">Fachverwaltung</h3>
|
|
<p class="text-gray-600 mb-4 flex-1">Ordnen Sie Produkte den Automatenfächern zu</p>
|
|
<div class="space-y-2 mt-auto">
|
|
<a href="{{ route('slots.index') }}" class="block w-full bg-blue-600 text-white text-center py-2 px-4 rounded hover:bg-blue-700">
|
|
Fächer verwalten
|
|
</a>
|
|
<a href="{{ route('slots.create') }}" class="block w-full bg-green-600 text-white text-center py-2 px-4 rounded hover:bg-green-700">
|
|
Neues Fach
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection |