fix(surveyor/so): perbaikkan back di surveyor, luas denah decimal dan revisi di so
This commit is contained in:
@@ -27,19 +27,27 @@
|
||||
|
||||
|
||||
function formatNumber(input) {
|
||||
// Ambil posisi kursor saat ini
|
||||
const cursorPosition = input.selectionStart;
|
||||
const cursorPosition = input.selectionStart;
|
||||
|
||||
// Ambil nilai input tanpa "m²" dan karakter non-angka
|
||||
let value = input.value.replace(/[^\d]/g, '');
|
||||
let value = input.value.replace(/[^0-9,]/g, '');
|
||||
|
||||
// Update nilai input dengan format angka dan "m²"
|
||||
input.value = value ? value + ' m²' : 'm²';
|
||||
|
||||
// Atur posisi kursor di depan "m²"
|
||||
input.setSelectionRange(cursorPosition, cursorPosition);
|
||||
if ((value.match(/,/g) || []).length > 1) {
|
||||
value = value.replace(/,/g, (match, offset) => (offset === value.indexOf(',') ? ',' : ''));
|
||||
}
|
||||
|
||||
if (value.includes(',')) {
|
||||
const [beforeComma, afterComma] = value.split(',');
|
||||
value = `${beforeComma},${afterComma.substring(0, 2)}`;
|
||||
}
|
||||
|
||||
input.value = value ? value + ' m²' : 'm²';
|
||||
|
||||
|
||||
input.setSelectionRange(cursorPosition, cursorPosition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function formatCurrency(value, isDiskon = false) {
|
||||
|
||||
Reference in New Issue
Block a user