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
|
||||
|
||||
@@ -291,7 +291,6 @@
|
||||
acceptedFiles: 'image/*',
|
||||
uploadMultiple: false,
|
||||
parallelUploads: 1,
|
||||
maxFiles: 10,
|
||||
autoProcessQueue: true,
|
||||
dictDefaultMessage: 'Seret foto atau klik untuk unggah',
|
||||
|
||||
@@ -430,28 +429,34 @@
|
||||
function showLoadingOverlay() {
|
||||
const overlay = document.querySelector('.loading-overlay');
|
||||
if (!overlay) {
|
||||
const dropzoneElement = document.querySelector('#upload-dropzone');
|
||||
// Buat elemen overlay
|
||||
const loadingOverlay = document.createElement('div');
|
||||
loadingOverlay.className = 'loading-overlay';
|
||||
loadingOverlay.style.cssText = `
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(255,255,255,0.7);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
`;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 9999;
|
||||
`;
|
||||
|
||||
// Tambahkan loader di dalam overlay
|
||||
loadingOverlay.innerHTML = '<div class="loader"></div>';
|
||||
dropzoneElement.appendChild(loadingOverlay);
|
||||
|
||||
// Tambahkan overlay ke dalam <body>
|
||||
document.body.appendChild(loadingOverlay);
|
||||
} else {
|
||||
// Tampilkan overlay jika sudah ada
|
||||
overlay.style.display = 'flex';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function hideLoadingOverlay() {
|
||||
const overlay = document.querySelector('.loading-overlay');
|
||||
if (overlay) overlay.style.display = 'none';
|
||||
|
||||
@@ -391,7 +391,7 @@
|
||||
value="{{ $inspectionData['asset']['harga'] ?? '' }}">
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
<input type="text" name="harga_pembanding[]" class="input currency">
|
||||
<input type="text" name="harga_pembanding[]" class="input currency-format">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user