diff --git a/app/Http/Controllers/Web/Dashboard/ProfilPetaniController.php b/app/Http/Controllers/Web/Dashboard/ProfilPetaniController.php index 6d88699..8e25ae8 100644 --- a/app/Http/Controllers/Web/Dashboard/ProfilPetaniController.php +++ b/app/Http/Controllers/Web/Dashboard/ProfilPetaniController.php @@ -17,7 +17,7 @@ class ProfilPetaniController extends Controller { public function index() { - if (!Gate::allows('super_admin') && !Gate::allows('admin')) { + if (!Gate::any(['super_admin', 'admin', 'fasilitator'])) { abort(403); } $title = 'Dashboard Profil Petani'; @@ -35,8 +35,8 @@ class ProfilPetaniController extends Controller ->get(); $lahanSummary = Lahan::select( 'komoditas_id', - DB::raw('COUNT(*) as total', - DB::raw('SUM(luas_lahan) as luas_lahan')) + DB::raw('COUNT(*) as total'), + DB::raw('SUM(luas_lahan) as luas_lahan') ) ->whereIn('petani_id', $petani) ->groupBy('komoditas_id') diff --git a/resources/views/dashboard/petani.blade.php b/resources/views/dashboard/petani.blade.php index 3cc247b..649aa99 100644 --- a/resources/views/dashboard/petani.blade.php +++ b/resources/views/dashboard/petani.blade.php @@ -31,7 +31,7 @@ -

{{ $lahanSummary->sum('luas_lahan') }}m2

+

{{ number_format($lahanSummary->sum('luas_lahan'), 0, ',', '.') }}m2

Lahan

@@ -91,10 +91,10 @@ - {{ $skorSummary->where('segmentasi', 'Penggerak')->sum('total') }} petani + {{ $skorSummary->where('segmen', 'Penggerak')->sum('total') }} petani - {{ number_format(($skorSummary->where('segmentasi', 'Penggerak')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% + {{ number_format(($skorSummary->where('segmen', 'Penggerak')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% @@ -110,10 +110,10 @@ - {{ $skorSummary->where('segmentasi', 'Perintis')->sum('total') }} petani + {{ $skorSummary->where('segmen', 'Perintis')->sum('total') }} petani - {{ number_format(($skorSummary->where('segmentasi', 'Perintis')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% + {{ number_format(($skorSummary->where('segmen', 'Perintis')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% @@ -129,10 +129,10 @@ - {{ $skorSummary->where('segmentasi', 'Pemerhati')->sum('total') }} petani + {{ $skorSummary->where('segmen', 'Pemerhati')->sum('total') }} petani - {{ number_format(($skorSummary->where('segmentasi', 'Pemerhati')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% + {{ number_format(($skorSummary->where('segmen', 'Pemerhati')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% @@ -148,10 +148,10 @@ - {{ $skorSummary->where('segmentasi', 'Pemula')->sum('total') }} petani + {{ $skorSummary->where('segmen', 'Pemula')->sum('total') }} petani - {{ number_format(($skorSummary->where('segmentasi', 'Pemula')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% + {{ number_format(($skorSummary->where('segmen', 'Pemula')->sum('total') / $petaniSummary->sum('total')) * 100, 2) }}% @@ -173,6 +173,7 @@ @foreach ($komoditas as $k) where('komoditas_id', $k->id) + ->whereIn('segmen', ['Penggerak', 'Perintis', 'Pemerhati', 'Pemula']) ->sortByDesc('total') ->first(); ?> @@ -182,19 +183,19 @@ @if(isset($max)) - @if($max->segmentasi == 'Penggerak') + @if($max->segmen == 'Penggerak') Petani Penggerak - @elseif($max->segmentasi == 'Perintis') + @elseif($max->segmen == 'Perintis') Petani Perintis - @elseif($max->segmentasi == 'Pemerhati') + @elseif($max->segmen == 'Pemerhati') Petani Pemerhati - @elseif($max->segmentasi == 'Pemula') + @elseif($max->segmen == 'Pemula') Petani Pemula @else Belum Lengkap @endif @else - Belum Ada + Belum Tersegmentasi @endif