diff --git a/app/Http/Controllers/Web/Dashboard/SummaryController.php b/app/Http/Controllers/Web/Dashboard/SummaryController.php
index 7ff615d..427c19e 100644
--- a/app/Http/Controllers/Web/Dashboard/SummaryController.php
+++ b/app/Http/Controllers/Web/Dashboard/SummaryController.php
@@ -233,14 +233,14 @@ class SummaryController extends Controller
$aksesPasar = $this->filteredAksesPasar($request);
$kpiCards = [
- [
- 'value' => number_format($totalPetani, 0, ',', '.'),
- 'unit' => 'orang',
- 'label' => 'Jumlah Petani',
- 'description' => 'Petani sesuai filter yang dipilih',
- 'icon' => 'tabler-users',
- 'variant' => 'primary',
- ],
+ // [
+ // 'value' => number_format($totalPetani, 0, ',', '.'),
+ // 'unit' => 'orang',
+ // 'label' => 'Jumlah Petani',
+ // 'description' => 'Petani sesuai filter yang dipilih',
+ // 'icon' => 'tabler-users',
+ // 'variant' => 'primary',
+ // ],
[
'value' => number_format($totalLuasLahan, 2, ',', '.'),
'unit' => 'ha',
@@ -418,6 +418,7 @@ class SummaryController extends Controller
return [
'jumlah_petani' => $petaniIds->count(),
+ 'jumlah_lahan' => $mapLahanRows->count(),
'total_luas_lahan' => (float) $mapLahanRows->sum('luas_lahan'),
'petani_per_komoditas' => $commodityRows,
'opt' => collect($optCounts)
diff --git a/resources/views/dashboard/produktivitas.blade.php b/resources/views/dashboard/produktivitas.blade.php
index 2833828..c1b7c21 100644
--- a/resources/views/dashboard/produktivitas.blade.php
+++ b/resources/views/dashboard/produktivitas.blade.php
@@ -752,7 +752,7 @@
Peta Sebaran
-
Lahan, tanaman, OPT, dan praktik budidaya berdasarkan filter wilayah.
+
Lahan, tanaman, dan OPT berdasarkan filter wilayah.
@@ -764,61 +764,55 @@
-
-
-
-
-
-
Peta Sebaran Lahan & Tanaman
- Lahan dan tanaman berdasarkan filter wilayah, komoditas, dan segmen
-
-
-
-
-
-
-
-
-
-
Belum ada poligon lahan untuk filter ini.
-
-
-
+
+
+
Peta Sebaran Lahan & Tanaman
+ Lahan dan tanaman berdasarkan filter wilayah, komoditas, dan segmen
+
+
+
+
+
+
+
+
+
+
Belum ada poligon lahan untuk filter ini.
+
+
+
+
+
-
-
-
-
Peta Praktik Budidaya
- Intensitas pemangkasan, pemupukan, dan kebiasaan praktik baik
-
-
-
-
-
-
-
-
-
-
Belum ada poligon lahan untuk filter ini.
-
-
-
+
+
+
+
+
+
Peta Praktik Budidaya
+ Intensitas pemangkasan, pemupukan, dan kebiasaan praktik baik
+
+
+
+
+
+
+
+
+
+
Belum ada poligon lahan untuk filter ini.
+
@@ -1079,7 +1073,11 @@ document.addEventListener('DOMContentLoaded', function () {
const mapData = @json($mapData);
const dashboardFilters = @json($dashboardFilters);
const mapInformationUrl = @json(route('dashboard.produktivitas.map-information'));
- const mapInformation = mapData.information || {};
+ const initialMapInformation = mapData.information || {};
+ const mapInformation = {
+ production: { ...initialMapInformation },
+ cultivation: { ...initialMapInformation },
+ };
const wilayah = @json($wilayah);
const headingColor = config.colors.headingColor;
const legendColor = config.colors.bodyColor;
@@ -1092,7 +1090,7 @@ document.addEventListener('DOMContentLoaded', function () {
let productionMapRendered = false;
let cultivationMapRendered = false;
let actualProductivityRendered = false;
- let mapInformationRequestId = 0;
+ const mapInformationRequestIds = { production: 0, cultivation: 0 };
function hasData(data) {
return data && Array.isArray(data.series) && data.series.some(function (value) {
@@ -1110,18 +1108,18 @@ document.addEventListener('DOMContentLoaded', function () {
});
}
- function renderProductionMapInformation(elementId, includeOpt = true) {
+ function renderProductionMapInformation(elementId, information, includeOpt = true) {
const element = document.getElementById(elementId);
if (!element) return;
- const commodityRows = Array.isArray(mapInformation.petani_per_komoditas)
- ? mapInformation.petani_per_komoditas
+ const commodityRows = Array.isArray(information.petani_per_komoditas)
+ ? information.petani_per_komoditas
: [];
- const optRows = Array.isArray(mapInformation.opt) ? mapInformation.opt : [];
- const indexValue = mapInformation.indeks === null || mapInformation.indeks === undefined
+ const optRows = Array.isArray(information.opt) ? information.opt : [];
+ const indexValue = information.indeks === null || information.indeks === undefined
? '-'
- : `${formatNumber(mapInformation.indeks, 2)} / 5`;
+ : `${formatNumber(information.indeks, 2)} / 5`;
const renderBars = function (rows, emptyLabel, unitLabel) {
if (!rows.length) {
return `
${emptyLabel}
`;
@@ -1152,14 +1150,21 @@ document.addEventListener('DOMContentLoaded', function () {
+
@@ -1171,11 +1176,11 @@ document.addEventListener('DOMContentLoaded', function () {
Segmen
- ${escapeHtml(mapInformation.segmen || 'Belum Lengkap')}
+ ${escapeHtml(information.segmen || 'Belum Lengkap')}
Segmen Dominan
- ${escapeHtml(mapInformation.segmen_dominan || 'Belum Lengkap')}
+ ${escapeHtml(information.segmen_dominan || 'Belum Lengkap')}
@@ -1191,8 +1196,8 @@ document.addEventListener('DOMContentLoaded', function () {
`;
}
- async function loadProductionMapInformation(level = null, id = null) {
- const requestId = ++mapInformationRequestId;
+ async function loadProductionMapInformation(mapType, level = null, id = null) {
+ const requestId = ++mapInformationRequestIds[mapType];
const params = new URLSearchParams();
Object.entries(dashboardFilters || {}).forEach(function ([key, value]) {
@@ -1214,11 +1219,14 @@ document.addEventListener('DOMContentLoaded', function () {
if (!response.ok) return;
const information = await response.json();
- if (requestId !== mapInformationRequestId) return;
+ if (requestId !== mapInformationRequestIds[mapType]) return;
- Object.assign(mapInformation, information);
- renderProductionMapInformation('produksi-map-information');
- renderProductionMapInformation('produksi-budidaya-map-information', false);
+ Object.assign(mapInformation[mapType], information);
+ if (mapType === 'production') {
+ renderProductionMapInformation('produksi-map-information', mapInformation.production);
+ } else {
+ renderProductionMapInformation('produksi-budidaya-map-information', mapInformation.cultivation, false);
+ }
} catch (error) {
console.error('Gagal memuat informasi wilayah pada peta.', error);
}
@@ -1487,7 +1495,7 @@ document.addEventListener('DOMContentLoaded', function () {
renderProductionMapLevel(previous.level, previous.parentId);
productionMapState.informationLevel = previous.informationLevel;
productionMapState.informationId = previous.informationId;
- loadProductionMapInformation(previous.informationLevel, previous.informationId);
+ loadProductionMapInformation('production', previous.informationLevel, previous.informationId);
if (previous.bounds?.isValid()) {
productionMapState.map.fitBounds(previous.bounds, { padding: [30, 30] });
@@ -1580,7 +1588,7 @@ document.addEventListener('DOMContentLoaded', function () {
});
productionMapState.informationLevel = nextLevel;
productionMapState.informationId = item.id;
- loadProductionMapInformation(nextLevel, item.id);
+ loadProductionMapInformation('production', nextLevel, item.id);
renderProductionMapLevel(nextProductionMapLevel(nextLevel), item.id, event.target.getBounds());
});
}
@@ -1714,7 +1722,7 @@ document.addEventListener('DOMContentLoaded', function () {
renderCultivationMapLevel(previous.level, previous.parentId);
cultivationMapState.informationLevel = previous.informationLevel;
cultivationMapState.informationId = previous.informationId;
- loadProductionMapInformation(previous.informationLevel, previous.informationId);
+ loadProductionMapInformation('cultivation', previous.informationLevel, previous.informationId);
if (previous.bounds?.isValid()) {
cultivationMapState.map.fitBounds(previous.bounds, { padding: [30, 30] });
@@ -1807,7 +1815,7 @@ document.addEventListener('DOMContentLoaded', function () {
});
cultivationMapState.informationLevel = nextLevel;
cultivationMapState.informationId = item.id;
- loadProductionMapInformation(nextLevel, item.id);
+ loadProductionMapInformation('cultivation', nextLevel, item.id);
renderCultivationMapLevel(nextProductionMapLevel(nextLevel), item.id, event.target.getBounds());
});
}
@@ -2249,8 +2257,8 @@ document.addEventListener('DOMContentLoaded', function () {
cultivationMapRendered = true;
}
- renderProductionMapInformation('produksi-map-information');
- renderProductionMapInformation('produksi-budidaya-map-information', false);
+ renderProductionMapInformation('produksi-map-information', mapInformation.production);
+ renderProductionMapInformation('produksi-budidaya-map-information', mapInformation.cultivation, false);
if (typeof L === 'undefined') {
const mapEmpty = document.getElementById('produksi-map-empty');
@@ -2338,9 +2346,10 @@ document.addEventListener('DOMContentLoaded', function () {
const control = document.querySelector('.chart-group-header-toggle[aria-controls="' + panel.id + '"]');
if (!control) return;
const icon = control.querySelector('.chart-group-icon-toggle i');
+ const groupLabel = panel.id === 'peta-sebaran-panel' ? 'peta' : 'chart';
const syncState = function () {
const expanded = panel.classList.contains('show');
- const label = expanded ? 'Sembunyikan chart' : 'Tampilkan chart';
+ const label = expanded ? `Sembunyikan ${groupLabel}` : `Tampilkan ${groupLabel}`;
control.setAttribute('aria-expanded', String(expanded));
control.setAttribute('aria-label', label);
control.title = label;