update jumlah lahan

This commit is contained in:
2026-07-22 16:40:24 +07:00
parent bd05fc7f0f
commit 7af7e1bdaf
5 changed files with 9 additions and 7 deletions
@@ -92,6 +92,7 @@
? $petani->lahans()->get()
: collect();
$totalLuasLahan = $petani ? $lahanPetani->where('komoditas_id', $petani->komoditas_id)->sum('luas_lahan') : 0;
$totalLuasLahanHa = $totalLuasLahan / 10000;
$totalTanaman = $petani ? $lahanPetani->where('komoditas_id', $petani->komoditas_id)->sum('jumlah_tanaman') : 0;
$pendidikanLabel = isset($petani) ? $petani->pendidikan_terakhir?->label() : null;
@@ -126,7 +127,7 @@
<p class="mb-0 text-muted" style="font-size: 0.75rem;">Lahan & Tanaman</p>
<h5 class="mb-0">
@if($lahanPetani->isNotEmpty())
{{ number_format($totalLuasLahan, 0, ',', '.') }} ha
{{ number_format($totalLuasLahanHa, 2, ',', '.') }} ha
@else
-
@endif
@@ -15,7 +15,7 @@
<div class="w-25">
<x-summary-card
title="Lahan & Tanaman"
count="{{ number_format($lahan?->sum('luas_lahan'), 0, ',', '.') }}ha"
count="{{ number_format(($lahan?->sum('luas_lahan') ?? 0) / 10000, 2, ',', '.') }} ha"
subtitle="{{ $tanaman?->count() }} tanaman dari {{ $komoditas?->count() }} komoditas utama"
icon="trees"
color="success"
@@ -824,7 +824,8 @@
});
document.getElementById('path').value = JSON.stringify(pathData);
let area = L.GeometryUtil.geodesicArea(latlngs);
$('#luas_lahan').val(area.toFixed(2));
let areaHa = area / 10000;
$('#luas_lahan').val(areaHa.toFixed(4));
}
const previewTemplate = `