Files

166 lines
5.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Segment {{ $segment->name }} Export</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: Arial, sans-serif;
font-size: 11px;
color: #1f2937;
padding: 20px;
background: white;
}
.header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 2px solid #e5e7eb;
}
h1 { font-size: 18px; font-weight: bold; color: #111827; }
.meta {
font-size: 11px;
color: #6b7280;
margin-top: 4px;
line-height: 1.5;
}
.print-btn {
background: #4f46e5;
color: white;
border: none;
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
font-weight: 600;
}
.print-btn:hover { background: #4338ca; }
table {
width: 100%;
border-collapse: collapse;
font-size: 10px;
}
thead th {
background-color: #f3f4f6;
border: 1px solid #d1d5db;
padding: 6px 8px;
text-align: left;
font-size: 9px;
font-weight: 700;
text-transform: uppercase;
color: #6b7280;
letter-spacing: 0.05em;
}
tbody td {
border: 1px solid #e5e7eb;
padding: 5px 8px;
vertical-align: top;
}
tbody tr:nth-child(even) td { background-color: #f9fafb; }
tbody tr:hover td { background-color: #eff6ff; }
.online { color: #16a34a; font-weight: 700; }
.offline { color: #9ca3af; }
.mono { font-family: 'Courier New', monospace; }
.note { color: #4b5563; font-style: italic; }
.footer {
margin-top: 12px;
font-size: 9px;
color: #9ca3af;
text-align: right;
}
/* Print-Stile */
@media print {
.no-print { display: none !important; }
body { padding: 0; font-size: 10px; }
thead th { background-color: #f3f4f6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
tbody tr:nth-child(even) td { background-color: #f9fafb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@page { size: A4 landscape; margin: 1.5cm; }
}
</style>
</head>
<body>
<div class="header">
<div>
<h1>🌐 Segment: {{ $segment->name }}</h1>
<div class="meta">
Subnetz: <strong>{{ $segment->subnet }}</strong>
@if($segment->vlan_id) &nbsp;·&nbsp; VLAN {{ $segment->vlan_id }} @endif
&nbsp;·&nbsp; {{ $hosts->count() }} Hosts
&nbsp;·&nbsp; {{ $hosts->where('status', 'online')->count() }} online
<br>
Exportiert: {{ now()->format('d.m.Y H:i') }}
@if($segment->description) &nbsp;·&nbsp; {{ $segment->description }} @endif
</div>
</div>
<button class="print-btn no-print" onclick="window.print()">🖨️ Als PDF drucken</button>
</div>
<table>
<thead>
<tr>
<th style="width:7%">Status</th>
<th style="width:12%">IP-Adresse</th>
<th style="width:16%">MAC-Adresse</th>
<th style="width:18%">Hostname</th>
<th style="width:14%">Hersteller</th>
<th style="width:7%">Ping</th>
<th>Bemerkung</th>
</tr>
</thead>
<tbody>
@forelse($hosts as $host)
<tr>
<td class="{{ $host->status === 'online' ? 'online' : 'offline' }}">
{{ $host->status === 'online' ? '● Online' : '○ Offline' }}
</td>
<td class="mono">{{ $host->ip_address }}</td>
<td class="mono">{{ $host->mac_address ?? '—' }}</td>
<td>{{ $host->hostname ?? '—' }}</td>
<td>{{ $host->mac_vendor ?? '—' }}</td>
<td class="mono">{{ $host->ping_ms !== null ? $host->ping_ms . ' ms' : '—' }}</td>
<td class="note">{{ $notes[$host->ip_address] ?? '' }}</td>
</tr>
@empty
<tr>
<td colspan="7" style="text-align:center; padding:24px; color:#9ca3af;">
Keine Hosts vorhanden.
</td>
</tr>
@endforelse
</tbody>
</table>
<div class="footer">
Network-MGMT · MMS System Service · {{ now()->format('d.m.Y H:i') }}
</div>
<script>
// Automatisch Druckdialog öffnen (nur wenn direkt als PDF aufgerufen)
if (window.location.pathname.includes('/export/pdf')) {
window.addEventListener('load', function() {
setTimeout(function() { window.print(); }, 300);
});
}
</script>
</body>
</html>