This commit is contained in:
rfandawiyah 2025-07-08 10:43:34 +07:00
parent ca7c86db06
commit b56f5da5e5
11 changed files with 189 additions and 153 deletions

View File

@ -15,10 +15,7 @@ public function collection()
$dataUji = DataUji::select([ $dataUji = DataUji::select([
'kecamatan', 'kecamatan',
'data_tahun', 'data_tahun',
'jumlah_penduduk',
'phbs', 'phbs',
'imunisasi_pcv_1',
'imunisasi_pcv_2',
'rata_rata_imunisasi', 'rata_rata_imunisasi',
'perilaku_merokok', 'perilaku_merokok',
'data_kasus', 'data_kasus',
@ -28,11 +25,8 @@ public function collection()
])->get()->map(function ($item) { ])->get()->map(function ($item) {
return [ return [
$item->kecamatan, $item->kecamatan,
$item->jumlah_penduduk,
$item->data_tahun, $item->data_tahun,
$item->phbs, $item->phbs,
$item->imunisasi_pcv_1,
$item->imunisasi_pcv_2,
$item->rata_rata_imunisasi, $item->rata_rata_imunisasi,
$item->perilaku_merokok, $item->perilaku_merokok,
$item->data_kasus, $item->data_kasus,
@ -45,11 +39,8 @@ public function collection()
$hasilPengujian = HasilPengujian::select([ $hasilPengujian = HasilPengujian::select([
'kecamatan', 'kecamatan',
'jumlah_penduduk',
'data_tahun', 'data_tahun',
'phbs', 'phbs',
'pcv1',
'pcv2',
'imunisasi', 'imunisasi',
'merokok', 'merokok',
'jumlah_kasus', 'jumlah_kasus',
@ -60,11 +51,8 @@ public function collection()
])->get()->map(function ($item) { ])->get()->map(function ($item) {
return [ return [
$item->kecamatan, $item->kecamatan,
$item->jumlah_penduduk,
$item->data_tahun, $item->data_tahun,
$item->phbs, $item->phbs,
$item->pcv1,
$item->pcv2,
$item->imunisasi, $item->imunisasi,
$item->merokok, $item->merokok,
$item->jumlah_kasus, $item->jumlah_kasus,
@ -83,11 +71,8 @@ public function headings(): array
{ {
return [ return [
'Kecamatan', 'Kecamatan',
'Jumlah Penduduk',
'Data Tahun', 'Data Tahun',
'PHBS', 'PHBS',
'PCV1',
'PCV2',
'Imunisasi', 'Imunisasi',
'Merokok', 'Merokok',
'Jumlah Kasus', 'Jumlah Kasus',

View File

@ -10,7 +10,21 @@ class DashboardController extends Controller
// Fungsi default, menampilkan data untuk tahun 2023 // Fungsi default, menampilkan data untuk tahun 2023
public function index(Request $request) public function index(Request $request)
{ {
$tahunTerpilih = 2023; // Ambil tahun-tahun yang tersedia dari data_latih
$tahunTersedia = DB::table('data_latih')
->select('data_tahun')
->distinct()
->orderByDesc('data_tahun')
->pluck('data_tahun');
// Ambil tahun dari request (GET), kalau tidak ada pakai yang paling atas (terbaru)
$selectedYear = $request->input('tahun', $tahunTersedia->first());
// Hitung total kasus berdasarkan tahun yang dipilih
$jumlahKasusDataLatih = DB::table('data_latih')
->where('data_tahun', $selectedYear)
->sum('kasus_2023');
$data_latih = DB::table('data_latih')->get(); $data_latih = DB::table('data_latih')->get();
$stats = DB::table('data_latih') $stats = DB::table('data_latih')
->selectRaw(' ->selectRaw('
@ -23,7 +37,10 @@ public function index(Request $request)
') ')
->first(); ->first();
$jumlahKasusDataLatih = DB::table('data_latih')->sum('kasus_2023'); // Ambil semua kolom dari tabel data_latih
$columns = DB::getSchemaBuilder()->getColumnListing('data_latih');
$selectedYear = $request->input('tahun') ?? $tahunTersedia->first();
$kabupatens = DB::table('kabupatens') $kabupatens = DB::table('kabupatens')
->join('data_latih', 'kabupatens.nama', '=', 'data_latih.kecamatan') ->join('data_latih', 'kabupatens.nama', '=', 'data_latih.kecamatan')
@ -44,8 +61,12 @@ public function index(Request $request)
->orderByDesc('tahun') ->orderByDesc('tahun')
->pluck('tahun'); ->pluck('tahun');
// Ambil tahun yang dipilih dari input user (jika ada), jika tidak pakai default if (!$selectedYear) {
$selectedYear = $request->input('year') ?? $tahunTerpilih; $selectedYear = DB::table('data_latih')
->orderByDesc('data_tahun')
->value('data_tahun'); // Ambil 1 nilai tahun terbaru
}
// Data kasus per bulan untuk tahun yang dipilih // Data kasus per bulan untuk tahun yang dipilih
$kasusPerBulan = DB::table('kasus') $kasusPerBulan = DB::table('kasus')
@ -84,7 +105,8 @@ public function index(Request $request)
'kasusPerBulanByYear', 'kasusPerBulanByYear',
'availableYears', 'availableYears',
'selectedYear', 'selectedYear',
'tahunTerpilih' 'tahunTersedia',
'selectedYear'
)); ));
} }
@ -108,7 +130,10 @@ public function dashboard(Request $request)
') ')
->first(); ->first();
$jumlahKasusDataLatih = DB::table('data_latih')->sum('kasus_2023'); $jumlahKasusDataLatih = DB::table('data_latih')
->where('data_tahun', $tahunTerpilih)
->sum('kasus_2023');
$kabupatens = DB::table('kabupatens') $kabupatens = DB::table('kabupatens')
->join('data_latih', 'kabupatens.nama', '=', 'data_latih.kecamatan') ->join('data_latih', 'kabupatens.nama', '=', 'data_latih.kecamatan')

View File

@ -24,23 +24,20 @@ public function import(Request $request)
foreach ($rows as $index => $row) { foreach ($rows as $index => $row) {
if ($index === 0) continue; // skip header if ($index === 0) continue; // skip header
$kecamatan = trim($row[1]); // Kolom ke-1: Kecamatan (index 1 karena id di kolom 0) $kecamatan = trim($row[1]); // Kolom ke-1: Kecamatan
if (empty($kecamatan)) continue; if (empty($kecamatan)) continue;
$dataToInsert[] = [ $dataToInsert[] = [
'kecamatan' => $kecamatan, 'kecamatan' => $kecamatan,
'jumlah_penduduk' => is_numeric($row[2]) ? (int)$row[2] : 0, // kolom 2 'data_tahun' => is_numeric($row[2]) ? (int)$row[2] : 2023, // Data Tahun
'data_tahun' => is_numeric($row[3]) ? (int)$row[3] : 2023, // kolom 3 'phbs' => is_numeric($row[3]) ? (float)$row[3] : 0, // PHBS
'phbs' => is_numeric($row[4]) ? (float)$row[4] : 0, 'imunisasi' => is_numeric($row[4]) ? (float)$row[4] : 0, // Imunisasi
'pcv1' => is_numeric($row[5]) ? (float)$row[5] : 0, 'merokok' => is_numeric($row[5]) ? (float)$row[5] : 0, // Perilaku Merokok
'pcv2' => is_numeric($row[6]) ? (float)$row[6] : 0, 'kasus_2023' => is_numeric($row[6]) ? (int)$row[6] : 0, // Data Kasus
'imunisasi' => is_numeric($row[7]) ? (float)$row[7] : 0, 'latitude' => is_numeric($row[7]) ? (float)($row[7] / 1000000) : 0, // Latitude
'merokok' => is_numeric($row[8]) ? (float)$row[8] : 0, 'longitude' => is_numeric($row[8]) ? (float)($row[8] / 1000000) : 0, // Longitude
'kasus_2023' => is_numeric($row[9]) ? (int)$row[9] : 0, 'prediksi_tahun' => isset($row[9]) && is_numeric($row[9]) ? (int)$row[9] : null, // Prediksi Tahun
'latitude' => is_numeric($row[10]) ? (float)($row[10] / 1000000) : 0, 'hipotesis' => isset($row[10]) && $row[10] !== '' ? trim($row[10]) : null, // Status
'longitude' => is_numeric($row[11]) ? (float)($row[11] / 1000000) : 0,
'prediksi_tahun' => isset($row[12]) && is_numeric($row[12]) ? (int)$row[12] : null,
'hipotesis' => isset($row[13]) && $row[13] !== '' ? trim($row[13]) : null,
'created_at' => now(), 'created_at' => now(),
'updated_at' => now(), 'updated_at' => now(),
]; ];

View File

@ -167,7 +167,7 @@ public function index()
} }
public function proses(Request $request) public function proses(Request $request)
{ {
$dataLatih = DataLatih::all(); $dataLatih = DataLatih::inRandomOrder()->get();
$persentase = (int) $request->input('persentase'); $persentase = (int) $request->input('persentase');
$total = $dataLatih->count(); $total = $dataLatih->count();
@ -203,19 +203,15 @@ public function proses(Request $request)
$hipotesisAsli = ucfirst(strtolower($data->hipotesis)); $hipotesisAsli = ucfirst(strtolower($data->hipotesis));
$prediksi = $this->naiveBayes($data, $dataLatihUpdate); $prediksi = $this->naiveBayes($data, $dataLatihUpdate);
// Prediksi tahun otomatis = data_tahun + 1, jika data_tahun ada $prediksiTahun = ((int)$data->data_tahun <= 2024) ? 2025 : ((int)$data->data_tahun + 1);
$prediksiTahun = $data->data_tahun ? ((int)$data->data_tahun + 1) : null;
$status = $prediksi === $hipotesisAsli ? '✅ Benar' : '❌ Salah'; $status = $prediksi === $hipotesisAsli ? '✅ Benar' : '❌ Salah';
$hasil[] = [ $hasil[] = [
'id' => $data->id, 'id' => $data->id,
'kabupaten' => $data->kecamatan, 'kabupaten' => $data->kecamatan,
'jumlah_penduduk' => $data->jumlah_penduduk,
'data_tahun' => $data->data_tahun, 'data_tahun' => $data->data_tahun,
'phbs' => $data->phbs, 'phbs' => $data->phbs,
'pcv1' => $data->pcv1,
'pcv2' => $data->pcv2,
'imunisasi' => $data->imunisasi, 'imunisasi' => $data->imunisasi,
'merokok' => $data->merokok, 'merokok' => $data->merokok,
'kasus_2023' => $data->kasus_2023, 'kasus_2023' => $data->kasus_2023,
@ -231,11 +227,8 @@ public function proses(Request $request)
if (!$hasilSudahAda) { if (!$hasilSudahAda) {
HasilPengujian::create([ HasilPengujian::create([
'kecamatan' => $data->kecamatan, 'kecamatan' => $data->kecamatan,
'jumlah_penduduk' => $data->jumlah_penduduk,
'data_tahun' => $data->data_tahun, 'data_tahun' => $data->data_tahun,
'phbs' => $data->phbs, 'phbs' => $data->phbs,
'pcv1' => $data->pcv1,
'pcv2' => $data->pcv2,
'imunisasi' => $data->imunisasi, 'imunisasi' => $data->imunisasi,
'merokok' => $data->merokok, 'merokok' => $data->merokok,
'jumlah_kasus' => $data->kasus_2023 ?? 0, 'jumlah_kasus' => $data->kasus_2023 ?? 0,

View File

@ -14,11 +14,8 @@ class DataLatih extends Model
// Tambahkan fillable agar bisa mass assignment tanpa error // Tambahkan fillable agar bisa mass assignment tanpa error
protected $fillable = [ protected $fillable = [
'kecamatan', 'kecamatan',
'jumlah_penduduk',
'data_tahun', 'data_tahun',
'phbs', 'phbs',
'pcv1',
'pcv2',
'imunisasi', 'imunisasi',
'merokok', 'merokok',
'kasus_2023', 'kasus_2023',

View File

@ -14,19 +14,16 @@ public function up()
Schema::create('data_latih', function (Blueprint $table) { Schema::create('data_latih', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('kecamatan'); $table->string('kecamatan');
$table->integer('jumlah_penduduk'); $table->integer('data_tahun')->nullable(); // sesuai: $row[2]
$table->integer('data_tahun')->nullable(); $table->float('phbs'); // sesuai: $row[3]
$table->float('phbs'); $table->float('imunisasi'); // sesuai: $row[4]
$table->float('pcv1'); $table->float('merokok'); // sesuai: $row[5]
$table->float('pcv2'); $table->integer('kasus_2023'); // sesuai: $row[6]
$table->float('imunisasi'); // rata-rata $table->decimal('latitude', 10, 7); // sesuai: $row[7] / 1000000
$table->float('merokok'); $table->decimal('longitude', 10, 7); // sesuai: $row[8] / 1000000
$table->integer('kasus_2023'); $table->integer('prediksi_tahun')->nullable(); // sesuai: $row[9]
$table->decimal('latitude', 10, 7); $table->string('hipotesis')->nullable(); // sesuai: $row[10]
$table->decimal('longitude', 10, 7); $table->timestamps(); // created_at & updated_at
$table->string('hipotesis')->nullable(); // hasil naive bayes
$table->integer('prediksi_tahun')->nullable(); // <--- tambahkan ini
$table->timestamps();
}); });
} }

View File

@ -14,11 +14,8 @@ public function up(): void
Schema::create('hasil_pengujian', function (Blueprint $table) { Schema::create('hasil_pengujian', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('kecamatan'); $table->string('kecamatan');
$table->integer('jumlah_penduduk');
$table->integer('data_tahun')->nullable(); $table->integer('data_tahun')->nullable();
$table->float('phbs'); $table->float('phbs');
$table->float('pcv1');
$table->float('pcv2');
$table->float('imunisasi'); $table->float('imunisasi');
$table->float('merokok'); $table->float('merokok');
$table->integer('jumlah_kasus'); $table->integer('jumlah_kasus');

View File

@ -4,29 +4,31 @@
@section('content') @section('content')
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesom
<!-- Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css"/>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-doughnutlabel"></script> <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-doughnutlabel"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.css" />
<script src="https://unpkg.com/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
<style> <style>
.gradient-orange { .gradient-orange {
background: linear-gradient(135deg, #ff9800, #ff5722), background: linear-gradient(135deg, #ff9800, #ff5722);
url('/assets/bg-wave-orange.svg');
} }
.gradient-blue { .gradient-blue {
background: linear-gradient(135deg, #2196f3, #3f51b5), background: linear-gradient(135deg, #2196f3, #3f51b5);
url('/assets/bgimunisasi.png');
} }
.gradient-green { .gradient-green {
background: linear-gradient(135deg, #4caf50, #009688), background: linear-gradient(135deg, #4caf50, #009688);
url('/assets/bg-wave-green.svg');
} }
.gradient-purple { .gradient-purple {
background: linear-gradient(135deg, #9c27b0, #673ab7), background: linear-gradient(135deg, #9c27b0, #673ab7);
url('/assets/bg-wave-purple.svg');
} }
.card-gradient { .card-gradient {
color: white; color: white;
border-radius: 1rem; border-radius: 1rem;
@ -117,13 +119,20 @@
} }
</style> </style>
@if(session('login_success')) @if(session('login_success'))
<div class="alert alert-success alert-dismissible fade show position-fixed" style="top: 60px; right: 30px; z-index: 1050; min-width: 300px; max-width: 400px;" role="alert">
<strong>🎉 {{ session('login_success') }}</strong>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<script> <script>
Swal.fire({ setTimeout(function () {
title: 'Login Sukses!', const alert = document.querySelector('.alert');
text: '{{ session("login_success") }}', if (alert) {
icon: 'success', alert.classList.remove('show');
confirmButtonText: 'OK' alert.classList.add('fade');
}); setTimeout(() => alert.remove(), 500);
}
}, 3000);
</script> </script>
@endif @endif
@ -186,16 +195,35 @@
</div> </div>
</div> </div>
<!-- Jumlah Kasus --> <!-- Jumlah Kasus -->
<div class="col-md-6 col-xl-3 mb-4"> <div class="col-md-6 col-xl-3 mb-4 position-relative">
<div class="card-gradient gradient-purple h-100 d-flex flex-column justify-content-center"> <div class="card-gradient gradient-purple h-100 d-flex flex-column justify-content-center p-3 position-relative">
{{-- Dropdown Tahun di Pojok Kanan Atas --}}
@if($tahunTersedia->count() > 1)
<div style="position: absolute; top: 0.75rem; right: 0.75rem;">
<form method="GET" action="{{ route('admin.dashboard') }}">
<select name="tahun" id="tahun" class="form-select form-select-sm w-auto" style="font-size: 0.75rem;" onchange="this.form.submit()">
@foreach($tahunTersedia as $tahun)
<option value="{{ $tahun }}" {{ $tahun == $selectedYear ? 'selected' : '' }}>
{{ $tahun }}
</option>
@endforeach
</select>
</form>
</div>
@endif
<div class="mb-3"> <div class="mb-3">
<i class="fas fa-notes-medical fa-2x"></i> <i class="fas fa-notes-medical fa-2x"></i>
</div> </div>
<h5 class="card-title">Jumlah Kasus</h5> <h5 class="card-title">Jumlah Kasus</h5>
<h3>{{ $jumlahKasusDataLatih }}</h3> <h3>{{ $jumlahKasusDataLatih }}</h3>
<p>Total kasus Infeksi Saluran Pernapasan Akut pada balita selama 1 tahun</p> <p>Total kasus Infeksi Saluran Pernapasan Akut pada balita di tahun {{ $selectedYear }}</p>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6 col-lg-4 mb-4"> <div class="col-md-6 col-lg-4 mb-4">
<div class="card shadow-sm border-0 card-custom"> <div class="card shadow-sm border-0 card-custom">
@ -204,7 +232,8 @@
<canvas id="kasusChart"></canvas> <canvas id="kasusChart"></canvas>
</div> </div>
</div> </div>
</div><div class="col-md-6 col-lg-8 mb-4"> </div>
<div class="col-md-6 col-lg-8 mb-4">
<div class="card shadow-sm border-0 card-custom"> <div class="card shadow-sm border-0 card-custom">
<div class="card-body"> <div class="card-body">
<h5 class="card-title d-flex justify-content-between align-items-center"> <h5 class="card-title d-flex justify-content-between align-items-center">
@ -302,6 +331,11 @@
} }
}); });
</script> </script>
<!-- Load CSS & JS Leaflet + Cluster -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.css" />
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
<script> <script>
var map = L.map('situbondo-map').setView([-7.716, 114.016], 10); var map = L.map('situbondo-map').setView([-7.716, 114.016], 10);
@ -311,49 +345,58 @@
var dataLatih = @json($data_latih); var dataLatih = @json($data_latih);
function createSimpleGradientPin(colorStart, colorEnd) { var iconRawan = L.icon({
const svg = ` iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-red.png',
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="32" viewBox="0 0 24 38"> iconSize: [25, 41],
<defs> iconAnchor: [12, 41],
<linearGradient id="grad" x1="0" y1="0" x2="0" y2="1"> popupAnchor: [1, -34],
<stop offset="0%" stop-color="${colorStart}" /> shadowUrl: 'https://unpkg.com/leaflet@1.9.3/dist/images/marker-shadow.png',
<stop offset="100%" stop-color="${colorEnd}" /> shadowSize: [41, 41]
</linearGradient>
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="2" stdDeviation="2" flood-color="#000" flood-opacity="0.15"/>
</filter>
</defs>
<path fill="url(#grad)" filter="url(#shadow)" d="M12 0C7 0 3 6 3 12c0 7.2 9 25 9 25s9-17.8 9-25c0-6-4-12-9-12z"/>
<circle fill="white" cx="12" cy="12" r="4" opacity="0.85"/>
</svg>
`;
return L.icon({
iconUrl: "data:image/svg+xml;base64," + btoa(svg),
iconSize: [20, 32],
iconAnchor: [10, 32],
popupAnchor: [0, -32]
}); });
var iconWaspada = L.icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-green.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowUrl: 'https://unpkg.com/leaflet@1.9.3/dist/images/marker-shadow.png',
shadowSize: [41, 41]
});
var markers = L.layerGroup().addTo(map);
dataLatih.forEach(function(item, index) {
var lat = parseFloat(item.latitude);
var lng = parseFloat(item.longitude);
if (isNaN(lat) || isNaN(lng)) {
console.warn(`Koordinat tidak valid pada index ${index}:`, item);
return;
} }
var iconRawan = createSimpleGradientPin('#e55353', '#b63737'); // merah gradasi console.log(`Menambahkan marker index ${index}:`, {
var iconWaspada = createSimpleGradientPin('#4dbd4d', '#2d7f2d'); // hijau gradasi lat: lat,
lng: lng,
status: item.hipotesis,
kecamatan: item.kecamatan
});
dataLatih.forEach(function(item) { var status = (item.hipotesis || '').toLowerCase();
var statusLabel = (item.hipotesis === 'Naik') ? 'Naik' : 'Turun'; var chosenIcon = (status === 'naik') ? iconRawan : iconWaspada;
var chosenIcon = (item.hipotesis === 'Naik') ? iconRawan : iconWaspada;
var marker = L.marker([item.latitude, item.longitude], { icon: chosenIcon }).addTo(map); var marker = L.marker([lat, lng], { icon: chosenIcon });
var popupContent = ` var popupContent = `
<strong>Nama Lokasi:</strong> ${item.kecamatan || 'Tidak diketahui'}<br> <strong>Nama Lokasi:</strong> ${item.kecamatan || '-'}<br>
<strong>Status:</strong> ${statusLabel}<br> <strong>Status:</strong> ${item.hipotesis || '-'}<br>
<strong>Persentase PHBS Baik:</strong> ${item.phbs !== null ? item.phbs.toFixed(2) : '0'}%<br> <strong>Persentase PHBS Baik:</strong> ${Number(item.phbs || 0).toFixed(2)}%<br>
<strong>Persentase Imunisasi:</strong> ${item.imunisasi !== null ? item.imunisasi.toFixed(2) : '0'}%<br> <strong>Persentase Imunisasi:</strong> ${Number(item.imunisasi || 0).toFixed(2)}%<br>
<strong>Persentase Merokok:</strong> ${item.merokok !== null ? item.merokok.toFixed(2) : '0'}%<br> <strong>Persentase Merokok:</strong> ${Number(item.merokok || 0).toFixed(2)}%<br>
<strong>Jumlah Kasus ISPA:</strong> ${item.kasus_2023 !== null ? item.kasus_2023 : '0'}<br> <strong>Jumlah Kasus ISPA:</strong> ${item.kasus_2023 ?? 0}
`; `;
marker.bindPopup(popupContent); marker.bindPopup(popupContent);
markers.addLayer(marker);
}); });
</script> </script>
<script> <script>

View File

@ -61,13 +61,10 @@
<tr> <tr>
<th>No</th> <th>No</th>
<th>Kecamatan</th> <th>Kecamatan</th>
<th>Jumlah Penduduk</th>
<th>Data Tahun</th> <th>Data Tahun</th>
<th>PHBS</th> <th>Perilaku Hidup Bersih dan Sehat</th>
<th>PCV 1</th> <th>Imunisasi PCV</th>
<th>PCV 2</th> <th>Kebiasaan Merokok Orang Tua</th>
<th>Imunisasi (Rata-rata)</th>
<th>Merokok</th>
<th>Kasus</th> <th>Kasus</th>
<th>Latitude</th> <th>Latitude</th>
<th>Longitude</th> <th>Longitude</th>
@ -80,11 +77,8 @@
<tr> <tr>
<td>{{ $data_latih->firstItem() + $index }}</td> <td>{{ $data_latih->firstItem() + $index }}</td>
<td>{{ $data->kecamatan }}</td> <td>{{ $data->kecamatan }}</td>
<td>{{ $data->jumlah_penduduk }}</td>
<td>{{ $data->data_tahun }}</td> <td>{{ $data->data_tahun }}</td>
<td>{{ $data->phbs }}</td> <td>{{ $data->phbs }}</td>
<td>{{ $data->pcv1 }}</td>
<td>{{ $data->pcv2 }}</td>
<td>{{ $data->imunisasi }}</td> <td>{{ $data->imunisasi }}</td>
<td>{{ $data->merokok }}</td> <td>{{ $data->merokok }}</td>
<td>{{ $data->kasus_2023 }}</td> <td>{{ $data->kasus_2023 }}</td>

View File

@ -29,11 +29,8 @@
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th>Kecamatan</th> <th>Kecamatan</th>
<th>Jumlah Penduduk</th>
<th>Data Tahun</th> <th>Data Tahun</th>
<th>PHBS</th> <th>PHBS</th>
<th>PCV1</th>
<th>PCV2</th>
<th>Imunisasi</th> <th>Imunisasi</th>
<th>Merokok</th> <th>Merokok</th>
<th>Jumlah Kasus</th> <th>Jumlah Kasus</th>
@ -47,17 +44,24 @@
@forelse($dataPrediksi as $data) @forelse($dataPrediksi as $data)
<tr> <tr>
<td>{{ $data->kecamatan }}</td> <td>{{ $data->kecamatan }}</td>
<td>{{ $data->jumlah_penduduk }}</td>
<td>{{ $data->data_tahun }}</td> <td>{{ $data->data_tahun }}</td>
<td>{{ $data->phbs }}</td> <td>{{ $data->phbs }}</td>
<td>{{ $data->pcv1 ?? $data->imunisasi_pcv_1 }}</td>
<td>{{ $data->pcv2 ?? $data->imunisasi_pcv_2 }}</td>
<td>{{ $data->imunisasi ?? $data->rata_rata_imunisasi }}</td> <td>{{ $data->imunisasi ?? $data->rata_rata_imunisasi }}</td>
<td>{{ $data->merokok ?? $data->perilaku_merokok }}</td> <td>{{ $data->merokok ?? $data->perilaku_merokok }}</td>
<td>{{ $data->jumlah_kasus ?? $data->data_kasus }}</td> <td>{{ $data->jumlah_kasus ?? $data->data_kasus }}</td>
<td>{{ $data->latitude }}</td> <td>{{ $data->latitude }}</td>
<td>{{ $data->longitude }}</td> <td>{{ $data->longitude }}</td>
<td>{{ isset($data->data_tahun) ? $data->data_tahun + 1 : '' }}</td> <td>
@if(isset($data->data_tahun))
@if(in_array((int)$data->data_tahun, [2023, 2024]))
2025
@else
{{ (int)$data->data_tahun + 1 }}
@endif
@else
-
@endif
</td>
<td> <td>
<span class="badge {{ $data->status_prediksi == 'Naik' ? 'bg-danger' : 'bg-success' }}"> <span class="badge {{ $data->status_prediksi == 'Naik' ? 'bg-danger' : 'bg-success' }}">
{{ $data->status_prediksi }} {{ $data->status_prediksi }}

View File

@ -213,11 +213,8 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Kecamatan</th> <th>Kecamatan</th>
<th>Jumlah Penduduk</th>
<th>Data Tahun</th> <th>Data Tahun</th>
<th>PHBS</th> <th>PHBS</th>
<th>PCV1</th>
<th>PCV2</th>
<th>Imunisasi</th> <th>Imunisasi</th>
<th>Merokok</th> <th>Merokok</th>
<th>Jumlah Kasus</th> <th>Jumlah Kasus</th>
@ -235,17 +232,24 @@
<tr> <tr>
<td>{{ $item['id'] }}</td> <td>{{ $item['id'] }}</td>
<td>{{ $item['kabupaten'] }}</td> <td>{{ $item['kabupaten'] }}</td>
<td>{{ $item['jumlah_penduduk'] }}</td>
<td>{{ $item['data_tahun'] ?? '-' }}</td> <td>{{ $item['data_tahun'] ?? '-' }}</td>
<td>{{ $item['phbs'] }}</td> <td>{{ $item['phbs'] }}</td>
<td>{{ $item['pcv1'] }}</td>
<td>{{ $item['pcv2'] }}</td>
<td>{{ $item['imunisasi'] }}</td> <td>{{ $item['imunisasi'] }}</td>
<td>{{ $item['merokok'] }}</td> <td>{{ $item['merokok'] }}</td>
<td>{{ $item['kasus_2023'] }}</td> <td>{{ $item['kasus_2023'] }}</td>
<td>{{ $item['latitude'] }}</td> <td>{{ $item['latitude'] }}</td>
<td>{{ $item['longitude'] }}</td> <td>{{ $item['longitude'] }}</td>
<td>{{ isset($item['data_tahun']) ? $item['data_tahun'] + 1 : '-' }}</td> <td>
@if(isset($item['data_tahun']))
@if(in_array((int)$item['data_tahun'], [2023, 2024]))
2025
@else
{{ (int)$item['data_tahun'] + 1 }}
@endif
@else
-
@endif
</td>
@unless ($from_excel) @unless ($from_excel)
<td>{{ $item['hipotesis_asli'] }}</td> <td>{{ $item['hipotesis_asli'] }}</td>
@endunless @endunless