fix(surveyorr): perbaikan upload foto dan pembanding
This commit is contained in:
@@ -125,8 +125,8 @@
|
||||
}
|
||||
} else {
|
||||
// Format currency untuk input harga
|
||||
if (name.includes('harga') || name.includes('total') || name.includes('diskon')) {
|
||||
element.value = value ? value.toString() : '0';
|
||||
if (name.includes('diskon')) {
|
||||
element.value = value || '0';
|
||||
} else {
|
||||
element.value = value || '';
|
||||
}
|
||||
@@ -364,16 +364,16 @@
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
if (input.classList.contains('currency')) {
|
||||
if (input.classList.contains('currency-format')) {
|
||||
input.addEventListener('input', function() {
|
||||
handleCurrencyInput(this);
|
||||
|
||||
|
||||
// Special handling for price-related inputs
|
||||
// Calculate prices if needed
|
||||
if (input.name.includes('harga_pembanding') ||
|
||||
input.name.includes('diskon_pembanding')) {
|
||||
const inputs = document.getElementsByName(input.name);
|
||||
const index = Array.from(inputs).indexOf(this);
|
||||
calculatePrices(index);
|
||||
calculatePrices('pembanding', index);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -382,7 +382,7 @@
|
||||
if (input.name.includes('diskon_pembanding')) {
|
||||
input.addEventListener('input', function() {
|
||||
let value =
|
||||
this.value = value.toString();
|
||||
this.value = value.toString();
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -394,7 +394,10 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleCurrencyInput(input) {
|
||||
const value = input.value.replace(/[^\d]/g, '');
|
||||
input.value = formatCurrency(value);
|
||||
}
|
||||
|
||||
function removeColumn() {
|
||||
if (columnCount > 1) {
|
||||
@@ -445,6 +448,13 @@
|
||||
ensureLocationEventListeners();
|
||||
}
|
||||
|
||||
function initializeCurrencyFormat() {
|
||||
document.querySelectorAll('.currency-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatCurrency(this);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initializeFirstPembandingListeners() {
|
||||
const firstProvinceSelect = document.getElementById('province_code_pembanding');
|
||||
@@ -658,5 +668,18 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Initialize currency format for existing inputs
|
||||
document.querySelectorAll('.currency-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
handleCurrencyInput(this);
|
||||
});
|
||||
|
||||
// Format initial values if they exist
|
||||
if (input.value) {
|
||||
input.value = formatCurrency(input.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user