solve dashboard indikator pertanian

This commit is contained in:
2026-08-13 16:31:11 +07:00
parent 6830142a82
commit b96de514e3
2 changed files with 157 additions and 55 deletions
@@ -26,7 +26,8 @@ class IndikatorPertanianController extends Controller
{
public function index(Request $request)
{
$initialFilters = $this->selectedFilters($request, $this->defaultKabupatenId());
$defaultKabupatenId = $this->defaultKabupatenId();
$initialFilters = $this->selectedFilters($request, $defaultKabupatenId);
$payload = $this->dashboardPayload($initialFilters);
$filterOptions = [
@@ -40,22 +41,22 @@ class IndikatorPertanianController extends Controller
[
'key' => 'kecamatan',
'label' => 'Kecamatan',
'options' => $this->kecamatanOptions(),
'options' => $this->withAllOption('Semua Kecamatan', []),
],
[
'key' => 'desa',
'label' => 'Desa',
'options' => $this->desaOptions(),
'options' => $this->withAllOption('Semua Desa', []),
],
[
'key' => 'komoditas',
'label' => 'Komoditas',
'options' => $this->komoditasOptions(),
'options' => $this->withAllOption('Semua Komoditas', []),
],
[
'key' => 'segmentasi',
'label' => 'Segmentasi',
'options' => $this->segmentasiOptions(),
'options' => $this->withAllOption('Semua Segmentasi', []),
],
];
@@ -68,6 +69,13 @@ class IndikatorPertanianController extends Controller
public function data(Request $request)
{
if ($request->query('mode') === 'filter-options') {
return response()->json([
'komoditas' => $this->komoditasOptions(),
'segmentasi' => $this->segmentasiOptions(),
]);
}
$filters = $this->selectedFilters($request, $this->defaultKabupatenId());
return response()->json([