Update Demografi Petani
This commit is contained in:
@@ -233,7 +233,7 @@ class DemografiPetaniController extends Controller
|
||||
};
|
||||
|
||||
return [
|
||||
'id' => $petani->kode ?? $petani->id,
|
||||
'id' => $petani->id,
|
||||
'nama' => $petani->nama ?? '-',
|
||||
'jenis_kelamin' => $petani->jenis_kelamin,
|
||||
'gender' => $petani->jenis_kelamin == 1 ? 'Laki-laki' : 'Perempuan',
|
||||
|
||||
@@ -431,6 +431,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
const fontFamily = config.fontFamily;
|
||||
|
||||
const farmerDataUrl = @json(route('dashboard.demografi-petani.data'));
|
||||
const farmerProfileUrl = @json(url('/dashboard/profil/petani'));
|
||||
|
||||
let activeFilters = {
|
||||
gender: null,
|
||||
@@ -542,7 +543,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
const umur = (petani.umur !== null && petani.umur !== undefined) ? `${petani.umur} tahun` : '-';
|
||||
|
||||
return `
|
||||
<tr>
|
||||
<tr class="farmer-row" data-id="${petani.id}" style="cursor: pointer;">
|
||||
<td><span class="text-heading fw-medium">${rowNumber}</span></td>
|
||||
<td><span class="text-heading fw-medium">${escapeHtml(petani.nama)}</span></td>
|
||||
<td>${genderBadge}</td>
|
||||
@@ -1319,7 +1320,20 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
|
||||
loadFarmerTable(1);
|
||||
|
||||
document.addEventListener(
|
||||
'click',
|
||||
function (event) {
|
||||
const row = event.target.closest('.farmer-row');
|
||||
if (!row) { return; }
|
||||
const petaniId = row.dataset.id;
|
||||
if (!petaniId) { return; }
|
||||
window.location.href = `${farmerProfileUrl}/${petaniId}`;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
Reference in New Issue
Block a user