162 lines
9.6 KiB
PHP
162 lines
9.6 KiB
PHP
@extends('layouts.vending')
|
|
|
|
@section('title', 'Snackautomaten')
|
|
|
|
@section('content')
|
|
<div class="max-w-7xl mx-auto px-4">
|
|
<div class="flex justify-between items-center mb-8">
|
|
<div>
|
|
<h1 class="text-3xl font-bold text-gray-900">Snackautomaten</h1>
|
|
<p class="text-gray-600 mt-2">Verwalten Sie Ihre Snackautomaten</p>
|
|
</div>
|
|
<a href="{{ route('vending-machines.create') }}" class="bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700">
|
|
Neuer Automat
|
|
</a>
|
|
</div>
|
|
|
|
@if(session('success'))
|
|
<div class="bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-6">
|
|
{{ session('success') }}
|
|
</div>
|
|
@endif
|
|
|
|
@if($vendingMachines->count() > 0)
|
|
<div class="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">
|
|
Automat
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Standort
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
Slots
|
|
</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($vendingMachines as $machine)
|
|
<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">
|
|
<div class="h-12 w-12 rounded bg-green-100 flex items-center justify-center">
|
|
<svg class="w-6 h-6 text-green-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>
|
|
</div>
|
|
<div class="ml-4">
|
|
<div class="text-sm font-medium text-gray-900">
|
|
{{ $machine->name }}
|
|
</div>
|
|
@if($machine->serial_number)
|
|
<div class="text-sm text-gray-500">
|
|
S/N: {{ $machine->serial_number }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="text-sm text-gray-900">{{ $machine->location }}</div>
|
|
@if($machine->description)
|
|
<div class="text-sm text-gray-500">{{ Str::limit($machine->description, 50) }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="text-sm text-gray-900">
|
|
{{ $machine->slots->count() }} Slots
|
|
</div>
|
|
<div class="text-sm text-gray-500">
|
|
{{ $machine->slots->whereNotNull('pivot.product_id')->count() }} belegt
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
@if($machine->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">
|
|
{{ $machine->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">
|
|
@if($machine->tenant && $machine->tenant->public_slug && $machine->machine_number)
|
|
<a href="{{ route('vending.public.machine', ['publicSlug' => $machine->tenant->public_slug, 'machineNumber' => $machine->machine_number]) }}"
|
|
class="text-blue-600 hover:text-blue-900" target="_blank">
|
|
Ansehen
|
|
</a>
|
|
@elseif($machine->machine_number)
|
|
<span class="text-gray-400">Ansehen (kein öffentlicher Zugang)</span>
|
|
@else
|
|
<span class="text-red-400">Fehlende Maschinennummer</span>
|
|
@endif
|
|
@if($machine && $machine->id)
|
|
<a href="{{ route('vending-machines.show', ['vending_machine' => $machine->id]) }}" class="text-indigo-600 hover:text-indigo-900">
|
|
Details
|
|
</a>
|
|
@else
|
|
<span class="text-gray-400">Details (Fehler)</span>
|
|
@endif
|
|
@if($machine && $machine->id)
|
|
<a href="{{ route('vending-machines.edit', ['vending_machine' => $machine->id]) }}" class="text-yellow-600 hover:text-yellow-900">
|
|
Bearbeiten
|
|
</a>
|
|
@else
|
|
<span class="text-gray-400">Bearbeiten (Fehler)</span>
|
|
@endif
|
|
@if($machine && $machine->id)
|
|
<form action="{{ route('vending-machines.destroy', ['vending_machine' => $machine->id]) }}" method="POST" class="inline"
|
|
onsubmit="return confirm('Sind Sie sicher, dass Sie diesen Automaten löschen möchten?')">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="text-red-600 hover:text-red-900">
|
|
Löschen
|
|
</button>
|
|
</form>
|
|
@endif
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-6">
|
|
{{ $vendingMachines->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 Automaten</h3>
|
|
<p class="mt-1 text-sm text-gray-500">Beginnen Sie mit der Erstellung Ihres ersten Snackautomaten.</p>
|
|
<div class="mt-6">
|
|
<a href="{{ route('vending-machines.create') }}" class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700">
|
|
Ersten Automaten erstellen
|
|
</a>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endsection |