From 1c5b48ff1b16540f0572809716665e1447c7e3bc Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 15 Dec 2025 11:08:42 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(lpj-form-penilai):=20gunakan?= =?UTF-8?q?=20IMask=20untuk=20formatting=20currency=20dinamis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ganti formatter manual formatCurrency dengan library IMask pada input class currency - Terapkan thousand separator titik (.) dan radix koma (,) sesuai format lokal - Gunakan mask Number tanpa desimal (scale 0) untuk nilai harga - Pindahkan trigger event dari input ke change untuk efisiensi performa - IMask otomatis menolak karakter non-numerik dan menormalkan nilai - Thousand separator muncul otomatis saat input nilai besar - Format angka menjadi konsisten dan standar di seluruh form penilaian - Kurangi potensi error input akibat formatting manual --- .../views/component/form-penilai.blade.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/resources/views/component/form-penilai.blade.php b/resources/views/component/form-penilai.blade.php index 148682d..4008502 100644 --- a/resources/views/component/form-penilai.blade.php +++ b/resources/views/component/form-penilai.blade.php @@ -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, + }); }); });