feat(dashboard): optimize layout and add village profile header

- Add compact Village Profile (Desa, Kecamatan, Kabupaten) header to Dashboard.
- Move Chart Legend to the right for better space utilization.
- Remove redundant spacing and headers around the Population Chart.
This commit is contained in:
2026-01-18 22:17:18 +08:00
parent 67048eb22e
commit 334d24b6b8
2 changed files with 60 additions and 10 deletions

View File

@@ -58,8 +58,25 @@
$sql_lansia = $koneksi->query("SELECT COUNT(id_pend) as c FROM tb_pdd WHERE TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) >= 60 AND status='Ada'");
if($d = $sql_lansia->fetch_assoc()) $lansia = $d['c'];
// Data Profil
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
$query_profil = mysqli_query($koneksi, $sql_profil);
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
?>
<?php if($data_profil): ?>
<div class="card card-primary card-outline mb-2">
<div class="card-body p-2">
<h5 class="text-center font-weight-bold mb-0">
PEMERINTAH DESA <?php echo strtoupper($data_profil['nama_desa']); ?>
</h5>
<p class="text-center small text-muted mb-0">
Kec. <?php echo $data_profil['kecamatan']; ?>, Kab. <?php echo $data_profil['kabupaten']; ?> | <?php echo $data_profil['alamat']; ?>
</p>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-lg-3 col-6">
<!-- small box -->
@@ -219,11 +236,6 @@
<!-- Left Col: Chart -->
<div class="col-lg-6">
<div class="card card-info h-100">
<div class="card-header">
<h3 class="card-title">
<i class="fas fa-chart-pie"></i> Statistik Penduduk
</h3>
</div>
<div class="card-body">
<canvas id="donutChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
</div>
@@ -320,6 +332,19 @@
var donutOptions = {
maintainAspectRatio : false,
responsive : true,
plugins: {
title: {
display: true,
text: 'Komposisi Penduduk Berdasarkan Usia',
font: {
size: 16
}
},
legend: {
display: true,
position: 'right'
}
}
}
new Chart(donutChartCanvas, {
type: 'doughnut',

View File

@@ -58,8 +58,25 @@
$sql_lansia = $koneksi->query("SELECT COUNT(id_pend) as c FROM tb_pdd WHERE TIMESTAMPDIFF(YEAR, tgl_lh, CURDATE()) >= 60 AND status='Ada'");
if($d = $sql_lansia->fetch_assoc()) $lansia = $d['c'];
// Data Profil
$sql_profil = "SELECT * FROM tb_profil WHERE id_profil='1'";
$query_profil = mysqli_query($koneksi, $sql_profil);
$data_profil = mysqli_fetch_array($query_profil,MYSQLI_BOTH);
?>
<?php if($data_profil): ?>
<div class="card card-primary card-outline mb-2">
<div class="card-body p-2">
<h5 class="text-center font-weight-bold mb-0">
PEMERINTAH DESA <?php echo strtoupper($data_profil['nama_desa']); ?>
</h5>
<p class="text-center small text-muted mb-0">
Kec. <?php echo $data_profil['kecamatan']; ?>, Kab. <?php echo $data_profil['kabupaten']; ?> | <?php echo $data_profil['alamat']; ?>
</p>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-lg-3 col-6">
<!-- small box -->
@@ -219,11 +236,6 @@
<!-- Left Col: Chart -->
<div class="col-lg-6">
<div class="card card-info h-100">
<div class="card-header">
<h3 class="card-title">
<i class="fas fa-chart-pie"></i> Statistik Penduduk
</h3>
</div>
<div class="card-body">
<canvas id="donutChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
</div>
@@ -320,6 +332,19 @@
var donutOptions = {
maintainAspectRatio : false,
responsive : true,
plugins: {
title: {
display: true,
text: 'Komposisi Penduduk Berdasarkan Usia',
font: {
size: 16
}
},
legend: {
display: true,
position: 'right'
}
}
}
new Chart(donutChartCanvas, {
type: 'doughnut',