Remove top save button from luz_camara page
This commit is contained in:
@@ -35,20 +35,6 @@ endfor; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php if (Auth::isCapturist()): ?>
|
||||
<button onclick="saveChanges()" id="btnSaveTop" class="btn btn-warning position-relative" disabled>
|
||||
<i class="bi bi-save"></i> Guardar Cambios
|
||||
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger"
|
||||
id="changesBadge" style="display: none;">
|
||||
0
|
||||
<span class="visually-hidden">cambios pendientes</span>
|
||||
</span>
|
||||
</button>
|
||||
<?php
|
||||
endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Configuración de Recibos Bimestrales -->
|
||||
@@ -434,22 +420,8 @@ endforeach; ?>
|
||||
|
||||
function updateSaveButton() {
|
||||
const count = Object.keys(pendingChanges).length;
|
||||
const btnTop = document.getElementById('btnSaveTop');
|
||||
const btnTable = document.getElementById('btnSaveTable');
|
||||
const btnBottom = document.getElementById('btnSaveBottom');
|
||||
const badge = document.getElementById('changesBadge');
|
||||
|
||||
if (btnTop) {
|
||||
btnTop.disabled = count === 0;
|
||||
// Duplicar comportamiento: mostrar texto con conteo
|
||||
if (count > 0) {
|
||||
btnTop.innerHTML = `<i class="bi bi-save"></i> Guardar ${count} Cambios`;
|
||||
btnTop.classList.remove('btn-outline-secondary');
|
||||
btnTop.classList.add('btn-warning');
|
||||
} else {
|
||||
btnTop.innerHTML = `<i class="bi bi-save"></i> Guardar Cambios`;
|
||||
}
|
||||
}
|
||||
|
||||
if (btnTable) {
|
||||
btnTable.disabled = count === 0;
|
||||
@@ -473,18 +445,12 @@ endforeach; ?>
|
||||
if (Object.keys(pendingChanges).length === 0) return;
|
||||
|
||||
const changes = Object.values(pendingChanges);
|
||||
const btnTop = document.getElementById('btnSaveTop');
|
||||
const btnTable = document.getElementById('btnSaveTable');
|
||||
const btnBottom = document.getElementById('btnSaveBottom');
|
||||
|
||||
const originalTextTop = btnTop ? btnTop.innerHTML : '';
|
||||
const originalTextTable = btnTable ? btnTable.innerHTML : '';
|
||||
const originalTextBottom = btnBottom ? btnBottom.innerHTML : '';
|
||||
|
||||
if (btnTop) {
|
||||
btnTop.disabled = true;
|
||||
btnTop.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Guardando...';
|
||||
}
|
||||
if (btnTable) {
|
||||
btnTable.disabled = true;
|
||||
btnTable.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Guardando...';
|
||||
@@ -508,11 +474,6 @@ endforeach; ?>
|
||||
alert('Cambios guardados exitosamente');
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Error al guardar: ' + (result.message || result.error));
|
||||
if (btnTop) {
|
||||
btnTop.disabled = false;
|
||||
btnTop.innerHTML = originalTextTop;
|
||||
}
|
||||
if (btnTable) {
|
||||
btnTable.disabled = false;
|
||||
btnTable.innerHTML = originalTextTable;
|
||||
@@ -525,9 +486,9 @@ endforeach; ?>
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
alert('Error de conexión');
|
||||
if (btnTop) {
|
||||
btnTop.disabled = false;
|
||||
btnTop.innerHTML = originalTextTop;
|
||||
if (btnTable) {
|
||||
btnTable.disabled = false;
|
||||
btnTable.innerHTML = originalTextTable;
|
||||
}
|
||||
if (btnBottom) {
|
||||
btnBottom.disabled = false;
|
||||
@@ -601,7 +562,7 @@ endif; ?>
|
||||
@media print {
|
||||
|
||||
.btn-group,
|
||||
#btnSaveTop,
|
||||
#btnSaveTable,
|
||||
#btnSaveBottom,
|
||||
.card-header,
|
||||
.form-label,
|
||||
|
||||
Reference in New Issue
Block a user