header skor

This commit is contained in:
2026-07-14 10:44:35 +07:00
parent 5b776b2ae8
commit fcc5d7dcc5
4 changed files with 385 additions and 0 deletions
@@ -0,0 +1,76 @@
<?php
namespace App\Http\Controllers\Web\Produktivitas;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use App\Models\Pertanian\SkorPetani;
use App\Models\Pertanian\Petani;
class SkorPetaniController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(string $petaniId)
{
if (!Gate::any(['super_admin', 'admin', 'fasilitator'])) {
abort(403);
}
$petani = Petani::findOrFail($petaniId);
$skor = $petani->skor;
return view('produktivitas.petani.skor.index', compact('petani', 'skor'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $petaniId, string $id)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
+23
View File
@@ -368,4 +368,27 @@ class Petani extends Model
return 'Belum tersegmentasi';
}
public function keteranganSegmen(): ?string
{
$skor = $this->skor;
if (!$skor) {
return null;
}
if ($skor->skor_kesiapan_adopsi >= 4.0) {
return 'Siap menjadi peserta agrolab utama dan panutan bagi petani lain';
} elseif ($skor->skor_kesiapan_adopsi >= 3.0) {
return 'Berpotensi berkembang menjadi Penggerak dengan dukungan yang tepat';
} elseif ($skor->skor_kesiapan_adopsi >= 2.0) {
return 'Perlu melihat bukti hasil nyata dari Penggerak sebelum mau bergerak';
} elseif ($skor->skor_kesiapan_adopsi >= 1.0) {
return 'Butuh penanganan hambatan dasar terlebih dahulu sebelum intervensi teknis';
} else {
return 'Belum tersegmentasi, data belum lengkap';
}
return 'Belum tersegmentasi, data belum lengkap';
}
}