@extends('layouts.app') @section('content')

Statistik Mutasi Penduduk

Statistik Tahun {{ $tahun }}

Kembali
@foreach($jenisStatistik as $item)
@php $iconClass = [ 'Lahir' => 'mdi-baby-face bg-success-lighten text-success', 'Meninggal' => 'mdi-heart-broken bg-danger-lighten text-danger', 'Pindah Masuk' => 'mdi-login bg-primary-lighten text-primary', 'Pindah Keluar' => 'mdi-logout bg-warning-lighten text-warning', 'Status Update' => 'mdi-update bg-info-lighten text-info' ]; @endphp
{{ $item->jenis_mutasi }}

{{ number_format($item->total) }}

@endforeach

Grafik Mutasi Bulanan {{ $tahun }}

Distribusi Jenis Mutasi

Perbandingan 5 Tahun Terakhir

@foreach($statistikTahunan as $item) @endforeach
Tahun Total
{{ $item->tahun }} {{ number_format($item->total) }}

Detail Mutasi per Bulan {{ $tahun }}

@php $months = [ 1 => 'Januari', 2 => 'Februari', 3 => 'Maret', 4 => 'April', 5 => 'Mei', 6 => 'Juni', 7 => 'Juli', 8 => 'Agustus', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Desember' ]; $totalYearly = [ 'Lahir' => 0, 'Meninggal' => 0, 'Pindah Masuk' => 0, 'Pindah Keluar' => 0, 'Status Update' => 0, 'total' => 0 ]; @endphp @foreach($months as $monthNum => $monthName) @php $monthData = $statistikBulanan->where('bulan', $monthNum)->first(); $counts = [ 'Lahir' => 0, 'Meninggal' => 0, 'Pindah Masuk' => 0, 'Pindah Keluar' => 0, 'Status Update' => 0 ]; if ($monthData && isset($monthData->by_jenis)) { $counts = array_merge($counts, $monthData->by_jenis); } $monthTotal = array_sum($counts); // Add to yearly total foreach ($counts as $jenis => $count) { $totalYearly[$jenis] += $count; } $totalYearly['total'] += $monthTotal; @endphp @endforeach
Bulan Lahir Meninggal Pindah Masuk Pindah Keluar Status Update Total
{{ $monthName }} {{ number_format($counts['Lahir']) }} {{ number_format($counts['Meninggal']) }} {{ number_format($counts['Pindah Masuk']) }} {{ number_format($counts['Pindah Keluar']) }} {{ number_format($counts['Status Update']) }} {{ number_format($monthTotal) }}
TOTAL {{ number_format($totalYearly['Lahir']) }} {{ number_format($totalYearly['Meninggal']) }} {{ number_format($totalYearly['Pindah Masuk']) }} {{ number_format($totalYearly['Pindah Keluar']) }} {{ number_format($totalYearly['Status Update']) }} {{ number_format($totalYearly['total']) }}
@push('scripts') @endpush @endsection