karakteristik petani
This commit is contained in:
@@ -103,9 +103,21 @@ class IndeksPetaniController extends Controller
|
||||
abort(403);
|
||||
}
|
||||
|
||||
return redirect()->route('dashboard.profil-pertanian', array_merge($request->query(), [
|
||||
'tab' => 'indeks-petani',
|
||||
]));
|
||||
}
|
||||
|
||||
public function contentData(Request $request): array
|
||||
{
|
||||
$filters = $this->filters($request);
|
||||
|
||||
$title = 'Dashboard Profil Petani';
|
||||
$segments = $this->segments();
|
||||
$colors = collect($segments)
|
||||
->pluck('color')
|
||||
->map(fn($c) => "var(--bs-{$c})")
|
||||
->values();
|
||||
|
||||
$komoditas = Komoditas::where('is_utama', true)->get();
|
||||
$petaniQuery = $this->petaniQuery($filters);
|
||||
@@ -125,6 +137,11 @@ class IndeksPetaniController extends Controller
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
$provinsi = $desaKelurahan
|
||||
->unique('provinsi_id')
|
||||
->sortBy('provinsi')
|
||||
->values();
|
||||
|
||||
$wilayah = $desaKelurahan
|
||||
->groupBy('provinsi_id')
|
||||
->map(function ($provinsi) {
|
||||
@@ -157,12 +174,15 @@ class IndeksPetaniController extends Controller
|
||||
];
|
||||
})->values();
|
||||
|
||||
return view('dashboard.indeks-petani', array_merge($filters,
|
||||
return array_merge($filters,
|
||||
compact(
|
||||
'komoditas',
|
||||
'desaKelurahan',
|
||||
'provinsi',
|
||||
'wilayah',
|
||||
)));
|
||||
'segments',
|
||||
'colors',
|
||||
));
|
||||
}
|
||||
|
||||
public function summary(Request $request): JsonResponse
|
||||
@@ -655,4 +675,4 @@ class IndeksPetaniController extends Controller
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user