Compare commits
4 Commits
6378ba0f98
...
6cf4432642
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cf4432642 | ||
|
|
7c5202021f | ||
|
|
e8a735e977 | ||
|
|
1c5b48ff1b |
@@ -302,9 +302,20 @@
|
||||
});
|
||||
|
||||
// Tambahkan event listener untuk currency format
|
||||
newNPWRow.querySelectorAll('.currency-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatCurrency(this);
|
||||
newNPWRow.querySelectorAll('.currency').forEach(input => {
|
||||
input.addEventListener('change', function() {
|
||||
window.IMask(this, {
|
||||
mask: Number, // enable number mask
|
||||
// other options are optional with defaults below
|
||||
scale: 0, // digits after point, 0 for integers
|
||||
thousandsSeparator: ".", // any single char
|
||||
padFractionalZeros: false, // if true, then pads zeros at end to the length of scale
|
||||
normalizeZeros: true, // appends or removes zeros at ends
|
||||
radix: ",", // fractional delimiter
|
||||
mapToRadix: ["."], // symbols to process as radix
|
||||
|
||||
autofix: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -355,7 +366,7 @@
|
||||
class="w-full currency"
|
||||
name="nilai_npw_${npwCounter}_1"
|
||||
placeholder="Harga per meter"
|
||||
value="${npw.nilai_1 || ''}"
|
||||
value="${npw.nilai_1 || '0'}"
|
||||
oninput="calculateTotal()">
|
||||
</label>
|
||||
</div>
|
||||
@@ -387,10 +398,36 @@
|
||||
calculateTotal();
|
||||
});
|
||||
|
||||
// Tambahkan event listener untuk currency format
|
||||
newNPWRow.querySelectorAll('.currency-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatCurrency(this);
|
||||
// Initialize currency formatting for existing values
|
||||
newNPWRow.querySelectorAll('.currency').forEach(input => {
|
||||
// Apply IMask immediately for existing values
|
||||
if (input.value && input.value !== '0') {
|
||||
window.IMask(input, {
|
||||
mask: Number,
|
||||
scale: 0,
|
||||
thousandsSeparator: ".",
|
||||
padFractionalZeros: false,
|
||||
normalizeZeros: true,
|
||||
radix: ",",
|
||||
mapToRadix: ["."],
|
||||
autofix: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Also add blur event for future editing
|
||||
input.addEventListener('blur', function() {
|
||||
if (!this.imask) {
|
||||
window.IMask(this, {
|
||||
mask: Number,
|
||||
scale: 0,
|
||||
thousandsSeparator: ".",
|
||||
padFractionalZeros: false,
|
||||
normalizeZeros: true,
|
||||
radix: ",",
|
||||
mapToRadix: ["."],
|
||||
autofix: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -406,7 +443,7 @@
|
||||
|
||||
// Panggil fungsi load NPW saat halaman dimuat
|
||||
loadSavedNPW();
|
||||
document.querySelectorAll('.currency-format').forEach(input => {
|
||||
document.querySelectorAll('.currency').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatCurrency(this);
|
||||
});
|
||||
@@ -492,7 +529,7 @@
|
||||
const outputElement = row.querySelector('input[id^="nilai_npw_"][id$="_2"]');
|
||||
|
||||
if (luasInput && nilaiInput && outputElement) {
|
||||
const luas = parseInput(luasInput.value);
|
||||
const luas = parseFloat(luasInput.value.replace(/[^0-9.]/g, '')) || 0;
|
||||
const nilai = parseInput(nilaiInput.value);
|
||||
const hasil = luas * nilai;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<td style="padding: 2px; vertical-align: top;">{{ $lingkungan['jarak_jalan_utama'] ?? '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 2px; vertical-align: top;">Jalan Lingkungan</td>
|
||||
<td style="padding: 2px; vertical-align: top;">Jalan Utama</td>
|
||||
<td style="padding: 2px; vertical-align: top;">:</td>
|
||||
<td style="padding: 2px; vertical-align: top;">{{ $lingkungan['jalan_linkungan'] ?? '-' }}</td>
|
||||
|
||||
|
||||
@@ -582,16 +582,14 @@
|
||||
</td>
|
||||
<td width="5%" style="padding: 3px; text-align: center;">X</td>
|
||||
<td width="25%" style="padding: 3px; text-align:right">
|
||||
{{ formatRupiah($npw['nilai_1'] ?? 0, 0, false) ?? '' }}
|
||||
</td>
|
||||
<td width="5" style="padding: 3px; text-align: center;">
|
||||
=
|
||||
{{ number_format((float) str_replace(['Rp', '.', ','], '', $npw['nilai_1'] ?? 0), 0, ',', '.') }}
|
||||
</td>
|
||||
<td width="5" style="padding: 3px; text-align: center;">=</td>
|
||||
<td width="25%" style="padding: 3px; text-align: left; text-align: right;">
|
||||
{{ formatRupiah($npw['nilai_2'] ?? 0, 0, false) ?? '' }}
|
||||
{{ number_format((float) str_replace(['Rp', '.', ','], '', $npw['nilai_2'] ?? 0), 0, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@php $totalNilaiPasarWajar += str_replace(['Rp', '.'], '', $npw['nilai_2']); @endphp
|
||||
@php $totalNilaiPasarWajar += str_replace(['Rp', '.', ','], '', $npw['nilai_2'] ?? 0); @endphp
|
||||
@endforeach
|
||||
@endif
|
||||
<tr>
|
||||
|
||||
@@ -370,7 +370,6 @@
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if (isset($lpjData['npw_tambahan']))
|
||||
@foreach ($lpjData['npw_tambahan'] as $npw)
|
||||
<tr>
|
||||
@@ -382,15 +381,14 @@
|
||||
</td>
|
||||
<td width="5%" style="padding: 3px; text-align: center;">X</td>
|
||||
<td width="25%" style="padding: 3px; text-align:right">
|
||||
{{ number_format($npw['nilai_1'], 0, ',', '.') ?? '' }}
|
||||
{{ number_format((float) str_replace(['Rp', '.', ','], '', $npw['nilai_1'] ?? 0), 0, ',', '.') }}
|
||||
</td>
|
||||
<td width="5" style="padding: 3px; text-align: center;">=</td>
|
||||
<td width="25%" style="padding: 3px; text-align: left; text-align: right;">
|
||||
{{ number_format($npw['nilai_2'], 0, ',', '.') ?? '' }}
|
||||
{{ number_format((float) str_replace(['Rp', '.', ','], '', $npw['nilai_2'] ?? 0), 0, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@php $totalNilaiPasarWajar += $npw['nilai_2']; @endphp
|
||||
|
||||
@php $totalNilaiPasarWajar += str_replace(['Rp', '.', ','], '', $npw['nilai_2'] ?? 0); @endphp
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
@php
|
||||
$statusKey = isset($forminspeksi['asset']['alamat']['sesuai']) ? 'sesuai' : 'tidak sesuai';
|
||||
$address = $forminspeksi['asset']['alamat'][$statusKey] ?? null;
|
||||
|
||||
$cekAlamat = $address ?? '';
|
||||
@endphp
|
||||
|
||||
<div id="alamat_form" class="grid gap-2 mt-5" style="display: none;">
|
||||
|
||||
Reference in New Issue
Block a user