per-row buttons locking, progress
This commit is contained in:
@@ -1550,6 +1550,14 @@ function fixedDefaultValue(array $f): string
|
||||
const rowIndex = btn.dataset.row;
|
||||
const row = btn.closest('.grid-row');
|
||||
const iddatadb = row.getAttribute('data-id');
|
||||
|
||||
// Show spinner on save button
|
||||
const origHtml = btn.innerHTML;
|
||||
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i>';
|
||||
btn.disabled = true;
|
||||
row.style.opacity = '0.6';
|
||||
row.style.pointerEvents = 'none';
|
||||
|
||||
const formData = new FormData();
|
||||
|
||||
const inputs = row.querySelectorAll(`input[name^="rows[${rowIndex}][details]"], select[name^="rows[${rowIndex}][details]"]`);
|
||||
@@ -1638,6 +1646,12 @@ function fixedDefaultValue(array $f): string
|
||||
})
|
||||
.catch(error => {
|
||||
alert('Errore durante il salvataggio: ' + error.message);
|
||||
})
|
||||
.finally(() => {
|
||||
btn.innerHTML = origHtml;
|
||||
btn.disabled = false;
|
||||
row.style.opacity = '';
|
||||
row.style.pointerEvents = '';
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user