Struktur Kepengurusan

IKS.PI Kera Sakti Ranting Dukun • Periode {{ date('Y') }}-{{ date('Y') + 4 }}

Total: {{ $totalMembers }} @can('manage members') Kelola @endcan
{{-- ============================================ --}} {{-- BAGAN STRUKTUR ORGANISASI --}} {{-- ============================================ --}}

Struktur Organisasi

IKS.PI KERA SAKTI · RANTING DUKUN

Periode {{ date('Y') }}-{{ date('Y') + 4 }}

@php $advisor = $orgAdvisor; $top = $orgTop; $deputy = $orgDeputy; $sek1 = optional($membersByRole->get('Sekretaris I'))->first(); $sek2 = optional($membersByRole->get('Sekretaris II'))->first(); $bend = optional($membersByRole->get('Bendahara'))->first(); $bidangColumns = collect($orgColumns)->filter(fn($c) => $c['title'] !== 'Sekretariat')->values(); $hasSekretariat = $deputy || $sek1 || $sek2 || $bend; $activeBidang = $bidangColumns->filter(function($col) use ($membersByRole){ foreach($col['roles'] as $r){ if(($membersByRole->get($r) ?? collect())->isNotEmpty()){ return true; } } return false; })->values(); $activeBidangCount = $activeBidang->count(); $sekActive = []; if($deputy) $sekActive[] = 0; if($sek1 || $sek2) $sekActive[] = 1; if($bend) $sekActive[] = 2; // Line color for clean look $lineClass = 'bg-gradient-to-b from-indigo-400 to-purple-500'; $lineHClass = 'bg-gradient-to-r from-indigo-400 via-purple-400 to-indigo-400'; @endphp {{-- LEVEL 1: Penasehat (top center) --}} @if($advisor)
@include('management.partials.org-card', [ 'role' => 'PENASEHAT', 'name' => $advisor->nama ?? '—', 'noInduk' => $advisor->no_induk ?? null, 'rayon' => $advisor->rayon ?? null, 'photo' => $advisor->photo ?? null, 'variant' => 'header' ])
@if($top)
@endif @endif {{-- LEVEL 2: Ketua Ranting --}} @if($top)
@include('management.partials.org-card', [ 'role' => 'KETUA RANTING', 'name' => $top->nama ?? '—', 'noInduk' => $top->no_induk ?? null, 'rayon' => $top->rayon ?? null, 'photo' => $top->photo ?? null, 'variant' => 'top' ])
@endif {{-- LEVEL 3: Sekretariat --}} @if($hasSekretariat && $top)
@if(count($sekActive) > 1) @php $positions = [16.67, 50, 83.33]; $leftPct = $positions[$sekActive[0]]; $rightPct = $positions[end($sekActive)]; @endphp
@endif
@if($deputy)
@endif
@if($sek1 || $sek2)
@endif
@if($bend)
@endif
@if($deputy) @include('management.partials.org-card', [ 'role' => 'WAKIL KETUA RANTING', 'name' => $deputy->nama, 'noInduk' => $deputy->no_induk ?? null, 'rayon' => $deputy->rayon ?? null, 'photo' => $deputy->photo ?? null, 'variant' => 'sub' ]) @endif
@if($sek1) @include('management.partials.org-card', [ 'role' => 'SEKRETARIS I', 'name' => $sek1->nama, 'noInduk' => $sek1->no_induk ?? null, 'rayon' => $sek1->rayon ?? null, 'photo' => $sek1->photo ?? null, 'variant' => 'sub' ]) @endif @if($sek2) @include('management.partials.org-card', [ 'role' => 'SEKRETARIS II', 'name' => $sek2->nama, 'noInduk' => $sek2->no_induk ?? null, 'rayon' => $sek2->rayon ?? null, 'photo' => $sek2->photo ?? null, 'variant' => 'sub' ]) @endif
@if($bend) @include('management.partials.org-card', [ 'role' => 'BENDAHARA', 'name' => $bend->nama, 'noInduk' => $bend->no_induk ?? null, 'rayon' => $bend->rayon ?? null, 'photo' => $bend->photo ?? null, 'variant' => 'sub' ]) @endif
@endif {{-- LEVEL 4: Bidang-bidang --}} @if($activeBidangCount > 0 && $top)
Bidang
@if($activeBidangCount > 1)
@endif
@foreach($activeBidang as $col)
@endforeach
@foreach($activeBidang as $col) @php $ketuaBidang = null; foreach($col['roles'] as $r){ if(str_starts_with($r, 'Ketua')){ $ketuaBidang = optional($membersByRole->get($r))->first(); break; } } $anggotaList = collect($col['roles']) ->filter(fn($r) => !str_starts_with($r, 'Ketua')) ->flatMap(fn($r) => $membersByRole->get($r) ?? collect()) ->filter() ->values(); @endphp
@if($ketuaBidang) @include('management.partials.org-card', [ 'role' => 'KETUA BIDANG ' . strtoupper($col['title']), 'name' => $ketuaBidang->nama, 'noInduk' => $ketuaBidang->no_induk ?? null, 'rayon' => $ketuaBidang->rayon ?? null, 'photo' => $ketuaBidang->photo ?? null, 'variant' => 'bidang', 'wide' => true, ]) @if($anggotaList->isNotEmpty())
@endif @endif @if($anggotaList->isNotEmpty())
@foreach($anggotaList as $a) @include('management.partials.org-card', [ 'role' => 'ANGGOTA', 'name' => $a->nama ?? '—', 'noInduk' => $a->no_induk ?? null, 'rayon' => $a->rayon ?? null, 'photo' => $a->photo ?? null, 'variant' => 'member', 'wide' => true, ]) @endforeach
@endif
@endforeach
@endif