Detail Pengelola STS
Informasi Pengelola STS
Kembali
@if(isset($pengelolaSts) && $pengelolaSts)
Nama BUMDES : {{ $pengelolaSts->nama_bumdes ?? '-' }}
Tahun Terbangun : {{ $pengelolaSts->tahun_terbangun ?? '-' }}
Kecamatan : {{ $pengelolaSts->kecamatan->nama_kecamatan ?? '-' }}
Desa : {{ $pengelolaSts->desa->nama_desa ?? '-' }}
Latitude : {{ $pengelolaSts->latitude ?? '-' }}
Longitude : {{ $pengelolaSts->longitude ?? '-' }}
Lokasi Pengelola STS
@else
Data Pengelola STS tidak ditemukan.
@endif @if(session('success')) @endif @if($errors->any()) @endif
Hitungan Penerima Bantuan SPALDS
@php $currentYear = date('Y'); $startYear = 2017; $years = range($startYear, $currentYear); $allKegiatans = isset($kegiatans) && $kegiatans ? $kegiatans->sortBy('nama_kegiatan') : collect(); // Ambil tahun unik dari data SPALDS untuk menentukan range tahun yang ditampilkan if (isset($spalds) && $spalds && $spalds->count() > 0) { $spaldsYears = $spalds->pluck('tahun')->unique()->sort()->values(); if ($spaldsYears->count() > 0) { $minYear = min($spaldsYears->min(), $startYear); $maxYear = max($spaldsYears->max(), $currentYear); $years = range($minYear, $maxYear); } } // Pre-processing: Tentukan kombinasi kegiatan-tahun yang memiliki data > 0 $activeColumns = []; $activeKegiatans = collect(); $kegiatanYearCount = []; if (isset($spalds) && $spalds && $spalds->count() > 0) { foreach ($spalds as $spald) { if ($spald->kegiatan_id && $spald->tahun) { $key = $spald->kegiatan_id . '_' . $spald->tahun; if (!isset($activeColumns[$key])) { $kegiatan = $allKegiatans->firstWhere('id', $spald->kegiatan_id); if ($kegiatan) { $activeColumns[$key] = [ 'kegiatan' => $kegiatan, 'tahun' => $spald->tahun, 'total' => 0 ]; if (!$activeKegiatans->contains('id', $kegiatan->id)) { $activeKegiatans->push($kegiatan); } if (!isset($kegiatanYearCount[$kegiatan->id])) { $kegiatanYearCount[$kegiatan->id] = 0; } $kegiatanYearCount[$kegiatan->id]++; } } $activeColumns[$key]['total']++; } } // Sort activeKegiatans by nama_kegiatan $activeKegiatans = $activeKegiatans->sortBy('nama_kegiatan')->values(); // Sort activeColumns by kegiatan nama then tahun uasort($activeColumns, function($a, $b) { $kegiatanCompare = strcmp($a['kegiatan']->nama_kegiatan, $b['kegiatan']->nama_kegiatan); if ($kegiatanCompare !== 0) { return $kegiatanCompare; } return $a['tahun'] <=> $b['tahun']; }); } @endphp
@if(count($activeColumns) > 0 && $activeKegiatans->count() > 0) @foreach($activeKegiatans as $kegiatan) @php $activeYearsCount = isset($kegiatanYearCount[$kegiatan->id]) ? $kegiatanYearCount[$kegiatan->id] : 0; @endphp @if($activeYearsCount > 0) @endif @endforeach @else @endif @if(count($activeColumns) > 0 && $activeKegiatans->count() > 0) @foreach($activeKegiatans as $kegiatan) @foreach($activeColumns as $key => $column) @if($column['kegiatan']->id == $kegiatan->id) @endif @endforeach @endforeach @else @endif @forelse(isset($spaldsGrouped) && $spaldsGrouped ? $spaldsGrouped : [] as $index => $desa) @php $countMap = []; foreach ($spalds as $spald) { if ($spald->desa_id == $desa->id && $spald->kegiatan_id && $spald->tahun) { $key = $spald->kegiatan_id . '_' . $spald->tahun; if (!isset($countMap[$key])) { $countMap[$key] = 0; } $countMap[$key]++; } } @endphp @if(count($activeColumns) > 0 && $activeKegiatans->count() > 0) @foreach($activeKegiatans as $kegiatan) @foreach($activeColumns as $key => $column) @if($column['kegiatan']->id == $kegiatan->id) @php $jumlah = isset($countMap[$key]) ? $countMap[$key] : 0; @endphp @endif @endforeach @endforeach @else @endif @empty @endforelse @if(isset($spaldsGrouped) && $spaldsGrouped && $spaldsGrouped->count() > 0 && count($activeColumns) > 0) @php // Hitung total per kombinasi kegiatan-tahun yang aktif $totalPerColumn = []; foreach ($activeColumns as $key => $column) { $totalPerColumn[$key] = 0; foreach ($spalds as $spald) { if ($spald->kegiatan_id == $column['kegiatan']->id && $spald->tahun == $column['tahun']) { $totalPerColumn[$key]++; } } } // Hitung total per kegiatan $totalPerKegiatan = []; foreach ($activeKegiatans as $kegiatan) { $totalPerKegiatan[$kegiatan->id] = 0; foreach ($spalds as $spald) { if ($spald->kegiatan_id == $kegiatan->id) { $totalPerKegiatan[$kegiatan->id]++; } } } $grandTotal = 0; foreach ($totalPerKegiatan as $total) { $grandTotal += $total; } @endphp @foreach($activeKegiatans as $kegiatan) @foreach($activeColumns as $key => $column) @if($column['kegiatan']->id == $kegiatan->id) @endif @endforeach @endforeach @foreach($activeKegiatans as $kegiatan) @php $activeYearsCount = isset($kegiatanYearCount[$kegiatan->id]) ? $kegiatanYearCount[$kegiatan->id] : 0; @endphp @if($activeYearsCount > 0) @endif @endforeach @if(count($activeColumns) > 0) @php $totalCols = count($activeColumns); @endphp @endif @endif
No Desa {{ $kegiatan->nama_kegiatan ?? '-' }} Belum ada Data
{{ $column['tahun'] }} -
{{ $index + 1 }} {{ $desa->nama_desa ?? '-' }} {{ number_format($jumlah, 0, ',', '.') }} -
Belum ada data penerima bantuan SPALDS
Jumlah {{ number_format($totalPerColumn[$key] ?? 0, 0, ',', '.') }}
Jumlah Total {{ number_format($totalPerKegiatan[$kegiatan->id] ?? 0, 0, ',', '.') }}
Grand Total {{ number_format($grandTotal, 0, ',', '.') }}
Data Penerima Bantuan SPALDS
@forelse(isset($spalds) && $spalds ? $spalds : [] as $index => $spald) @empty @endforelse
No Tahun Nama NIK Jumlah Anggota Keluarga Kegiatan Desa RW RT Aksi
{{ $index + 1 }} {{ $spald->tahun ?? '-' }} {{ $spald->nama ?? '-' }} {{ $spald->nik ?? '-' }} {{ $spald->jml_agt_klrga ?? '-' }} {{ $spald->kegiatan->nama_kegiatan ?? '-' }} {{ $spald->desa->nama_desa ?? '-' }} {{ $spald->rw ?? '-' }} {{ $spald->rt ?? '-' }}

Belum ada data penerima bantuan SPALDS untuk pengelola STS ini

@push('styles') @endpush @push('scripts') @endpush