filter fasil
This commit is contained in:
@@ -27,6 +27,10 @@ class PetaniController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
|
if (!Gate::any(['super_admin', 'admin', 'fasilitator'])) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
$provinsi = Provinsi::orderBy('kode', 'asc')->get();
|
$provinsi = Provinsi::orderBy('kode', 'asc')->get();
|
||||||
|
|
||||||
$query = Petani::with('desakelurahan')
|
$query = Petani::with('desakelurahan')
|
||||||
@@ -39,6 +43,10 @@ class PetaniController extends Controller
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auth()->user()->role->value === 'fasilitator') {
|
||||||
|
$query->where('created_by', auth()->user()->id);
|
||||||
|
}
|
||||||
|
|
||||||
$petani = $query->paginate($request->per_page ?? 10);
|
$petani = $query->paginate($request->per_page ?? 10);
|
||||||
|
|
||||||
return view('produktivitas.petani.index', compact('petani', 'provinsi'));
|
return view('produktivitas.petani.index', compact('petani', 'provinsi'));
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<th>Jenis Kelamin</th>
|
<th>Jenis Kelamin</th>
|
||||||
<th>Usia</th>
|
<th>Usia</th>
|
||||||
<th>Desa/Kelurahan</th>
|
<th>Desa/Kelurahan</th>
|
||||||
|
<th>Segmentasi</th>
|
||||||
<th>Aksi</th>
|
<th>Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -51,7 +52,17 @@
|
|||||||
<td><span class="text-muted">{{ $item->jenis_kelamin ? 'Laki-laki' : 'Perempuan' }}</span></td>
|
<td><span class="text-muted">{{ $item->jenis_kelamin ? 'Laki-laki' : 'Perempuan' }}</span></td>
|
||||||
<td><span class="text-muted">{{ $item->umur }} tahun</span></td>
|
<td><span class="text-muted">{{ $item->umur }} tahun</span></td>
|
||||||
<td><span class="text-muted">{{ $item->desaKelurahan?->nama }}, {{ $item->desaKelurahan?->kecamatan?->nama }}, {{ $item->desaKelurahan?->kecamatan?->kabupatenKota?->nama }}, {{ $item->desaKelurahan?->kecamatan?->kabupatenKota?->provinsi?->nama }}</span></td>
|
<td><span class="text-muted">{{ $item->desaKelurahan?->nama }}, {{ $item->desaKelurahan?->kecamatan?->nama }}, {{ $item->desaKelurahan?->kecamatan?->kabupatenKota?->nama }}, {{ $item->desaKelurahan?->kecamatan?->kabupatenKota?->provinsi?->nama }}</span></td>
|
||||||
|
<td>
|
||||||
|
@if($item->segmen() == 'Penggerak')
|
||||||
|
<span class="badge bg-label-success">Penggerak</span>
|
||||||
|
@elseif($item->segmen() == 'Perintis')
|
||||||
|
<span class="badge bg-label-info">Perintis</span>
|
||||||
|
@elseif($item->segmen() == 'Pemerhati')
|
||||||
|
<span class="badge bg-label-warning">Pemerhati</span>
|
||||||
|
@elseif($item->segmen() == 'Pemula')
|
||||||
|
<span class="badge bg-label-danger">Pemula</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<!-- <a href="{{ route('petani.show', $item->id) }}" class="btn btn-icon btn-text-secondary rounded-pill view-record"><i class="ti tabler-eye ti-md"></i></a> -->
|
<!-- <a href="{{ route('petani.show', $item->id) }}" class="btn btn-icon btn-text-secondary rounded-pill view-record"><i class="ti tabler-eye ti-md"></i></a> -->
|
||||||
|
|||||||
Reference in New Issue
Block a user