158 lines
9.3 KiB
PHP
158 lines
9.3 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex items-center space-x-2">
|
|
@if($scan->segment)
|
|
<a href="{{ route('network.segments.show', $scan->segment) }}" class="text-gray-500 hover:text-gray-700">{{ $scan->segment->name }}</a>
|
|
<span class="text-gray-400">/</span>
|
|
@endif
|
|
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200">Scan {{ $scan->created_at->format('d.m.Y H:i') }}</h2>
|
|
</div>
|
|
@if($scan->segment)
|
|
<div class="flex gap-2">
|
|
<a href="{{ route('network.segments.export.xlsx', $scan->segment) }}"
|
|
class="px-3 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">
|
|
📊 Excel
|
|
</a>
|
|
<a href="{{ route('network.segments.export.pdf', $scan->segment) }}"
|
|
class="px-3 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">
|
|
📄 PDF
|
|
</a>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</x-slot>
|
|
|
|
<div class="py-8">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
|
|
|
{{-- Scan-Info --}}
|
|
<div class="grid grid-cols-2 md:grid-cols-5 gap-4">
|
|
@foreach(['Subnetz' => $scan->subnet, 'Quelle' => $scan->scanner, 'Gesamt' => $scan->total_hosts, 'Online' => $scan->online_hosts, 'Neue Geräte' => $scan->new_devices] as $label => $val)
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
|
|
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ $label }}</p>
|
|
<p class="mt-1 text-xl font-bold text-gray-900 dark:text-gray-100">{{ $val }}</p>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
{{-- Host-Tabelle --}}
|
|
<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</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">Ping</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Ports</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Bemerkung</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100 dark:divide-gray-700">
|
|
@foreach($hosts as $host)
|
|
<tr class="{{ $host->status === 'online' ? '' : 'opacity-50' }} hover:bg-gray-50 dark:hover:bg-gray-700 transition">
|
|
<td class="px-4 py-2">
|
|
<span class="w-2 h-2 rounded-full inline-block {{ $host->status === 'online' ? 'bg-green-500' : 'bg-gray-300' }}"></span>
|
|
</td>
|
|
<td class="px-4 py-2 font-mono font-medium text-gray-900 dark:text-gray-100">
|
|
@if($host->device)
|
|
<a href="{{ route('network.device', $host->device) }}" class="text-indigo-600 hover:underline">
|
|
{{ $host->ip_address }}
|
|
</a>
|
|
@else
|
|
{{ $host->ip_address }}
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-2 font-mono text-xs text-gray-600 dark:text-gray-400">{{ $host->mac_address ?? '—' }}</td>
|
|
<td class="px-4 py-2 text-gray-700 dark:text-gray-300">{{ $host->hostname ?? '—' }}</td>
|
|
<td class="px-4 py-2 text-xs text-gray-600 dark:text-gray-400">{{ $host->mac_vendor ?? '—' }}</td>
|
|
<td class="px-4 py-2 text-xs text-gray-600 dark:text-gray-400">{{ $host->ping_ms ? $host->ping_ms . ' ms' : '—' }}</td>
|
|
<td class="px-4 py-2 text-xs text-gray-600 dark:text-gray-400 max-w-xs truncate">{{ $host->ports ?? '—' }}</td>
|
|
<td class="px-4 py-2 min-w-48">
|
|
@if($scan->segment_id)
|
|
<div class="note-cell" data-ip="{{ $host->ip_address }}">
|
|
<span class="note-display text-xs text-gray-600 dark:text-gray-400 cursor-pointer hover:text-indigo-600 italic"
|
|
title="Klicken zum Bearbeiten">
|
|
{{ $notes[$host->ip_address] ?? '+ Bemerkung' }}
|
|
</span>
|
|
<div class="note-form hidden flex gap-1 items-center">
|
|
<input type="text" maxlength="500"
|
|
class="note-input flex-1 text-xs border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-200 rounded px-2 py-1 focus:ring-indigo-500 focus:border-indigo-500"
|
|
value="{{ $notes[$host->ip_address] ?? '' }}" />
|
|
<button class="note-save text-xs px-2 py-1 rounded text-white" style="background-color: var(--color-primary)">✓</button>
|
|
<button class="note-cancel text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400">✕</button>
|
|
</div>
|
|
</div>
|
|
@else
|
|
<span class="text-xs text-gray-300">—</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@if($scan->segment_id)
|
|
<script>
|
|
(function() {
|
|
const saveUrl = '{{ route('network.segments.ip-notes', $scan->segment_id) }}';
|
|
const csrfToken = '{{ csrf_token() }}';
|
|
|
|
document.querySelectorAll('.note-cell').forEach(function(cell) {
|
|
const ip = cell.dataset.ip;
|
|
const display = cell.querySelector('.note-display');
|
|
const form = cell.querySelector('.note-form');
|
|
const input = cell.querySelector('.note-input');
|
|
const save = cell.querySelector('.note-save');
|
|
const cancel = cell.querySelector('.note-cancel');
|
|
|
|
display.addEventListener('click', function() {
|
|
display.classList.add('hidden');
|
|
form.classList.remove('hidden');
|
|
input.focus();
|
|
});
|
|
|
|
cancel.addEventListener('click', function() {
|
|
form.classList.add('hidden');
|
|
display.classList.remove('hidden');
|
|
});
|
|
|
|
save.addEventListener('click', function() {
|
|
fetch(saveUrl, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-CSRF-TOKEN': csrfToken,
|
|
'Accept': 'application/json',
|
|
},
|
|
body: JSON.stringify({ ip_address: ip, note: input.value }),
|
|
})
|
|
.then(r => r.json())
|
|
.then(function(data) {
|
|
if (data.ok) {
|
|
display.textContent = input.value || '+ Bemerkung';
|
|
form.classList.add('hidden');
|
|
display.classList.remove('hidden');
|
|
}
|
|
})
|
|
.catch(function() {
|
|
alert('Fehler beim Speichern.');
|
|
});
|
|
});
|
|
|
|
input.addEventListener('keydown', function(e) {
|
|
if (e.key === 'Enter') save.click();
|
|
if (e.key === 'Escape') cancel.click();
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
@endif
|
|
</x-app-layout>
|