@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => '']) @php $gedungAliasMap = [ 'A' => 'trsgda', 'B' => 'trsgdb', 'C' => 'trsgdc', 'E' => 'trsgde', 'F' => 'trsgdf', ]; $currentGedung = strtoupper((string) ($record->gedung ?? '')); $topologyBackUrl = isset($gedungAliasMap[$currentGedung]) ? url($gedungAliasMap[$currentGedung]) : url($url_menu); $deleteDescendants = $delete_descendants ?? collect(); $deleteDescendantCount = $deleteDescendants->count(); $toggleActionLabel = $record->isactive == '1' ? 'Non aktifkan' : 'Aktifkan'; $toggleButtonLabel = $record->isactive == '1' ? 'Hapus' : 'Aktifkan'; $toggleButtonClass = $record->isactive == '1' ? 'btn-danger' : 'btn-success'; $toggleButtonIcon = $record->isactive == '1' ? 'fa-trash' : 'fa-check'; $deleteActionUrl = $topologyBackUrl . '/' . encrypt($record->id); $deleteDescendantsForJs = $deleteDescendants->map(function ($desc) { return [ 'name' => $desc->nama_perangkat ?? '-', 'kategori' => $desc->nama_kategori ?? '', 'port' => $desc->port_terpakai ?? '', 'status' => ((string) ($desc->isactive ?? '1') === '1') ? 'Aktif' : 'Tidak Aktif', 'depth' => (int) ($desc->depth ?? 1), ]; })->values(); @endphp
{{-- Header --}}
Topologi @if ($authorize->edit == '1' && $record->isactive == '1') Edit @endif @if ($authorize->delete == '1') @endif
Detail Perangkat
{{-- Device Info Header --}}
@php $kat = strtolower($record->nama_kategori ?? ''); $icon = 'fa-microchip'; if (str_contains($kat, 'server')) $icon = 'fa-server'; elseif (str_contains($kat, 'switch')) $icon = 'fa-network-wired'; elseif (str_contains($kat, 'cpu') || str_contains($kat, 'pc')) $icon = 'fa-desktop'; elseif (str_contains($kat, 'printer')) $icon = 'fa-print'; elseif (str_contains($kat, 'monitor')) $icon = 'fa-tv'; elseif (str_contains($kat, 'scanner')) $icon = 'fa-barcode'; @endphp

{{ $record->nama_perangkat }}

@if (($is_master_active ?? true) === false) @php $orphanReason = $orphan_reason ?? 'inactive'; $isDeleted = $orphanReason === 'deleted'; $badgeColor = $isDeleted ? 'danger' : 'warning'; $badgeText = $isDeleted ? 'DIHAPUS DARI MASTER' : 'NONAKTIF DI MASTER'; @endphp {{ $badgeText }} @else {{ $isactive_map[$record->isactive] ?? $record->isactive }} @endif
{{-- Orphaned Device Alert Callout --}} @if (($is_master_active ?? true) === false) @php $alertOrphanReason = $orphan_reason ?? 'inactive'; $alertIsDeleted = $alertOrphanReason === 'deleted'; $alertStatusLabel = $alertIsDeleted ? 'Dihapus' : 'Tidak Aktif'; $alertBorderColor = $alertIsDeleted ? '#e74c3c' : '#e67e22'; $alertBgColor = $alertIsDeleted ? '#fdf2f2' : '#fef9e7'; $alertIconBg = $alertIsDeleted ? '#e74c3c' : '#e67e22'; $alertIcon = $alertIsDeleted ? 'fa-trash-can' : 'fa-exclamation-triangle'; @endphp
Perangkat {{ $alertStatusLabel }} di MIS Asset

Perangkat {{ $record->nama_perangkat }} sudah {{ $alertStatusLabel }} dari sistem Master Aset (MIS Asset). Data detail master tidak tersedia.

Silakan hapus/edit perangkat ini dari Topologi, atau aktifkan kembali di MIS Asset.

@endif
{{-- Info Grid --}}
Gedung

{{ $gedung_map[$record->gedung] ?? $record->gedung ?? '-' }}

Location

{{ $record->location ?? '-' }}

Kategori

{{ $kategori_map[$record->kategori] ?? $record->kategori ?? '-' }}

Parent

{{ $parent_map[$record->parent] ?? '-' }}

@if(!empty($record->parent_id) && !empty($record->port_sumber_input))
Port Sumber (Input Jaringan)

Port {{ $record->port_sumber_input }} (Uplink/Sumber)

@endif
Port

{{ $record->port_terpakai ?? '-' }}

@if (!($is_teknisi ?? false))
IP Address

{{ $record->ip_address ?? '-' }}

@endif
Link Gedung

@if ($record->link_gedung) @php $linkGedungKey = strtoupper((string) $record->link_gedung); $linkGedungUrl = isset($gedungAliasMap[$linkGedungKey]) ? url($gedungAliasMap[$linkGedungKey]) : url($url_menu); @endphp → {{ $gedung_map[$record->link_gedung] ?? $record->link_gedung }} @else - @endif

@if ($record->keterangan)
Keterangan

{{ $record->keterangan }}

@endif
@if (!empty($master_details) && count($master_details) > 0)
Detail Master Perangkat
@foreach ($master_details as $detail)
{{ $detail['label'] }}

{{ $detail['value'] }}

@endforeach
@endif @php $hasAssetPhotos = !empty($asset_photos) && count($asset_photos) > 0; $hasLocalPhotos = !empty($record->foto_dekat) || !empty($record->foto_jauh); @endphp @if ($hasAssetPhotos || $hasLocalPhotos)
Dokumentasi Perangkat
{{-- Asset Photos from msjasset --}} @if ($hasAssetPhotos)
Master Asset Foto dari sistem asset ({{ count($asset_photos) }} foto)
@foreach ($asset_photos as $idx => $assetImg)
Foto Asset {{ $idx + 1 }}
Foto Asset {{ $idx + 1 }}
@endforeach
@endif {{-- Local uploaded photos --}} @if ($hasLocalPhotos)
Upload Lokal Foto yang diupload di topologi ini
Foto Perangkat (Dekat) @if (!empty($record->foto_dekat))
Foto perangkat dekat
@else

Belum ada foto.

@endif
Foto Perangkat (Jauh) @if (!empty($record->foto_jauh))
Foto perangkat jauh
@else

Belum ada foto.

@endif
@endif @endif @php $detailKatName = strtolower($record->nama_kategori ?? ''); $detailHasPort = str_contains($detailKatName, 'switch') || str_contains($detailKatName, 'server') || str_contains($detailKatName, 'router'); $detailTotalPort = (int) ($record->jumlah_port ?? 0); $detailUplinkPort = (!empty($record->parent_id) && !empty($record->port_sumber_input)) ? (string) $record->port_sumber_input : ''; $uplinkParent = $uplink_parent ?? null; $usedPortMap = []; $rusakPortMap = []; foreach ($children as $child) { $port = (string) ($child->port_terpakai ?? ''); if ($port === '') { continue; } $childKat = strtolower($child->nama_kategori ?? ''); $isPlaceholder = ($child->is_placeholder ?? '0') === '1'; $isRusak = str_contains($childKat, 'rusak') || ($isPlaceholder && (($child->port_status ?? 'normal') === 'rusak')); if ($isRusak) { $rusakPortMap[$port] = $child; } elseif (!$isPlaceholder) { $usedPortMap[$port] = $child; } } $connectedChildren = $connected_children ?? $children->filter(function ($child) { return ($child->is_placeholder ?? '0') !== '1'; })->values(); $connectedDevices = $connected_devices ?? $connectedChildren; @endphp @if ($detailHasPort && $detailTotalPort > 0)
Port Grid Virtual ({{ $detailTotalPort }} Port)
Filter:
@for ($i = 1; $i <= $detailTotalPort; $i++) @php $p = (string) $i; $isUsed = isset($usedPortMap[$p]); $isRusak = isset($rusakPortMap[$p]); $isUplink = $detailUplinkPort !== '' && $p === $detailUplinkPort; $stateClass = $isUplink ? 'uplink' : ($isRusak ? 'rusak' : ($isUsed ? 'used' : 'available')); $stateKey = $isUplink ? 'uplink' : ($isRusak ? 'rusak' : ($isUsed ? 'used' : 'available')); $stateText = $isUplink ? 'Uplink/Sumber' : ($isRusak ? 'Rusak' : ($isUsed ? 'Terisi' : 'Kosong')); $stateTitle = 'Port ' . $i; $portUrl = null; if ($isUplink) { $stateTitle .= ' (Uplink/Sumber)'; $uplinkParentName = $uplinkParent->nama_perangkat ?? ($parent_map[$record->parent_id] ?? 'Perangkat Induk'); if (!empty($uplinkParentName)) { $stateTitle .= ' - dari ' . $uplinkParentName; } if ($uplinkParent && !empty($uplinkParent->id)) { $uplinkGedungKey = strtoupper((string) ($uplinkParent->gedung ?? $record->gedung ?? '')); $uplinkBaseUrl = isset($gedungAliasMap[$uplinkGedungKey]) ? url($gedungAliasMap[$uplinkGedungKey]) : url($url_menu); $portUrl = $uplinkBaseUrl . '/show/' . encrypt($uplinkParent->id); } } elseif ($isUsed) { $stateTitle .= ' - ' . ($usedPortMap[$p]->nama_perangkat ?? 'Terisi'); $childGedungKey = strtoupper((string) ($usedPortMap[$p]->gedung ?? $record->gedung ?? '')); $childBaseUrl = isset($gedungAliasMap[$childGedungKey]) ? url($gedungAliasMap[$childGedungKey]) : url($url_menu); $portUrl = $childBaseUrl . '/show/' . encrypt($usedPortMap[$p]->id); } elseif ($isRusak) { $stateTitle .= ' - Rusak'; $rusakGedungKey = strtoupper((string) ($rusakPortMap[$p]->gedung ?? $record->gedung ?? '')); $rusakBaseUrl = isset($gedungAliasMap[$rusakGedungKey]) ? url($gedungAliasMap[$rusakGedungKey]) : url($url_menu); $portUrl = $rusakBaseUrl . '/show/' . encrypt($rusakPortMap[$p]->id); } else { $stateTitle .= ' - Kosong'; $portUrl = $topologyBackUrl . '/add?gedung=' . urlencode($record->gedung ?? '') . '&parent=' . $record->id . '&port=' . $i; } @endphp @if ($portUrl)
@if ($isUplink) @else
Port {{ $i }}
{{ $stateText }}
@endif
@else
@if ($isUplink) @else
Port {{ $i }}
{{ $stateText }}
@endif
@endif @endfor
Kosong Terisi Rusak Uplink/Sumber
@endif {{-- Connected Devices --}} @if ($connectedDevices->count() > 0)
Perangkat Terhubung ({{ $connectedDevices->count() }})
@foreach ($connectedDevices as $device) @php $connectionType = $device->connection_type ?? 'downlink'; $isUplinkConnection = $connectionType === 'uplink'; $typeBadgeClass = $isUplinkConnection ? 'bg-success' : 'bg-info'; $typeLabel = $isUplinkConnection ? 'Uplink' : 'Downlink'; $typeIcon = $isUplinkConnection ? 'fa-arrow-down' : 'fa-arrow-up'; $localPort = trim((string) ($device->local_port ?? $device->port_terpakai ?? '')); $remotePort = trim((string) ($device->remote_port ?? '')); $deviceStatusLabel = $device->status_label ?? 'Aktif'; $statusTextUpper = strtoupper((string) $deviceStatusLabel); $statusColor = strtolower((string) $deviceStatusLabel) === 'aktif' ? '#2dce89' : '#f5365c'; $rowClass = $device->row_class ?? ''; @endphp @endforeach
Tipe Koneksi Port Lokal Perangkat Terhubung Port Lawan Kategori Status Aksi
{{ $typeLabel }}
@if ($localPort !== '') Port {{ $localPort }} @if ($isUplinkConnection) (Sumber) @endif @else - @endif {{ $device->connected_name ?? $device->nama_perangkat ?? '-' }} {{ $remotePort !== '' ? 'Port ' . $remotePort : '-' }} {{ $device->kategori_name ?? $device->nama_kategori ?? '-' }} {{ $statusTextUpper }} @if (!empty($device->id)) @php $deviceGedungKey = strtoupper((string) ($device->gedung ?? $record->gedung ?? '')); $deviceBaseUrl = isset($gedungAliasMap[$deviceGedungKey]) ? url($gedungAliasMap[$deviceGedungKey]) : url($url_menu); @endphp @else - @endif
@endif {{-- Audit Info --}}
{{ $record->user_create ?? '-' }} — {{ $record->created_at ?? '-' }}
{{ $record->user_update ?? '-' }} — {{ $record->updated_at ?? '-' }}
@if ($authorize->delete == '1')
@csrf @method('DELETE')
@endif @endsection @push('js') @endpush