Files

106 lines
6.8 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">Alle Geräte</h2>
</x-slot>
<div class="py-8">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
{{-- Filter --}}
<form method="GET" action="{{ route('network.devices') }}" class="flex gap-3 mb-4">
<input type="text" name="search" value="{{ request('search') }}"
placeholder="IP, MAC, Hostname, Hersteller..."
class="flex-1 border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-200 rounded-md shadow-sm text-sm focus:ring-indigo-500 focus:border-indigo-500" />
<select name="status"
class="border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-200 rounded-md shadow-sm text-sm">
<option value="">Alle Status</option>
<option value="online" {{ request('status') === 'online' ? 'selected' : '' }}>Online</option>
<option value="offline" {{ request('status') === 'offline' ? 'selected' : '' }}>Offline</option>
</select>
<button type="submit" style="background-color: var(--color-primary)"
class="px-4 py-2 text-white text-sm font-medium rounded-md hover:opacity-90 transition">
Suchen
</button>
@if(request()->hasAny(['search', 'status']))
<a href="{{ route('network.devices') }}"
class="px-4 py-2 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 transition">
Zurücksetzen
</a>
@endif
</form>
<div class="bg-white dark:bg-gray-800 shadow-sm rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700 text-sm">
<thead class="bg-gray-50 dark:bg-gray-700">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Status</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">IP-Adresse</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">MAC-Adresse</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Hostname / Bezeichnung</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Hersteller</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Zuletzt gesehen</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Ereignisse</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 dark:divide-gray-700">
@forelse($devices as $device)
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700 transition">
<td class="px-4 py-3">
<span class="inline-flex items-center">
<span class="w-2 h-2 rounded-full mr-2
{{ $device->status === 'online' ? 'bg-green-500' : 'bg-red-400' }}">
</span>
<span class="text-xs {{ $device->status === 'online' ? 'text-green-700 dark:text-green-400' : 'text-gray-500 dark:text-gray-400' }}">
{{ $device->status }}
</span>
</span>
</td>
<td class="px-4 py-3 font-mono text-gray-900 dark:text-gray-100 font-medium">
{{ $device->current_ip }}
</td>
<td class="px-4 py-3 font-mono text-gray-600 dark:text-gray-400 text-xs">
{{ $device->mac_address }}
</td>
<td class="px-4 py-3 text-gray-900 dark:text-gray-100">
@if($device->label)
<span class="font-medium">{{ $device->label }}</span>
<span class="text-gray-400 text-xs ml-1">({{ $device->hostname }})</span>
@else
{{ $device->hostname ?? '—' }}
@endif
</td>
<td class="px-4 py-3 text-gray-600 dark:text-gray-400 text-xs">
{{ $device->mac_vendor ?? '—' }}
</td>
<td class="px-4 py-3 text-gray-500 dark:text-gray-400 text-xs">
{{ $device->last_seen_at?->format('d.m.Y H:i') ?? '—' }}
</td>
<td class="px-4 py-3 text-right">
@php $undoc = $device->events->where('documented', false)->count(); @endphp
<a href="{{ route('network.device', $device) }}"
class="text-indigo-600 hover:text-indigo-800 text-xs">
Detail
@if($undoc > 0)
<span class="ml-1 bg-yellow-100 text-yellow-800 text-xs px-1.5 py-0.5 rounded-full">{{ $undoc }}</span>
@endif
</a>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-4 py-10 text-center text-gray-500">Keine Geräte gefunden.</td>
</tr>
@endforelse
</tbody>
</table>
@if($devices->hasPages())
<div class="px-4 py-3 border-t border-gray-200 dark:border-gray-700">
{{ $devices->links() }}
</div>
@endif
</div>
</div>
</div>
</x-app-layout>