Remove top save button from luz_camara page
This commit is contained in:
@@ -35,20 +35,6 @@ endfor; ?>
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</div>
|
||||||
|
|
||||||
<!-- Configuración de Recibos Bimestrales -->
|
<!-- Configuración de Recibos Bimestrales -->
|
||||||
@@ -434,22 +420,8 @@ endforeach; ?>
|
|||||||
|
|
||||||
function updateSaveButton() {
|
function updateSaveButton() {
|
||||||
const count = Object.keys(pendingChanges).length;
|
const count = Object.keys(pendingChanges).length;
|
||||||
const btnTop = document.getElementById('btnSaveTop');
|
|
||||||
const btnTable = document.getElementById('btnSaveTable');
|
const btnTable = document.getElementById('btnSaveTable');
|
||||||
const btnBottom = document.getElementById('btnSaveBottom');
|
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) {
|
if (btnTable) {
|
||||||
btnTable.disabled = count === 0;
|
btnTable.disabled = count === 0;
|
||||||
@@ -473,18 +445,12 @@ endforeach; ?>
|
|||||||
if (Object.keys(pendingChanges).length === 0) return;
|
if (Object.keys(pendingChanges).length === 0) return;
|
||||||
|
|
||||||
const changes = Object.values(pendingChanges);
|
const changes = Object.values(pendingChanges);
|
||||||
const btnTop = document.getElementById('btnSaveTop');
|
|
||||||
const btnTable = document.getElementById('btnSaveTable');
|
const btnTable = document.getElementById('btnSaveTable');
|
||||||
const btnBottom = document.getElementById('btnSaveBottom');
|
const btnBottom = document.getElementById('btnSaveBottom');
|
||||||
|
|
||||||
const originalTextTop = btnTop ? btnTop.innerHTML : '';
|
|
||||||
const originalTextTable = btnTable ? btnTable.innerHTML : '';
|
const originalTextTable = btnTable ? btnTable.innerHTML : '';
|
||||||
const originalTextBottom = btnBottom ? btnBottom.innerHTML : '';
|
const originalTextBottom = btnBottom ? btnBottom.innerHTML : '';
|
||||||
|
|
||||||
if (btnTop) {
|
|
||||||
btnTop.disabled = true;
|
|
||||||
btnTop.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Guardando...';
|
|
||||||
}
|
|
||||||
if (btnTable) {
|
if (btnTable) {
|
||||||
btnTable.disabled = true;
|
btnTable.disabled = true;
|
||||||
btnTable.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Guardando...';
|
btnTable.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Guardando...';
|
||||||
@@ -508,11 +474,6 @@ endforeach; ?>
|
|||||||
alert('Cambios guardados exitosamente');
|
alert('Cambios guardados exitosamente');
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
alert('Error al guardar: ' + (result.message || result.error));
|
|
||||||
if (btnTop) {
|
|
||||||
btnTop.disabled = false;
|
|
||||||
btnTop.innerHTML = originalTextTop;
|
|
||||||
}
|
|
||||||
if (btnTable) {
|
if (btnTable) {
|
||||||
btnTable.disabled = false;
|
btnTable.disabled = false;
|
||||||
btnTable.innerHTML = originalTextTable;
|
btnTable.innerHTML = originalTextTable;
|
||||||
@@ -525,9 +486,9 @@ endforeach; ?>
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
alert('Error de conexión');
|
alert('Error de conexión');
|
||||||
if (btnTop) {
|
if (btnTable) {
|
||||||
btnTop.disabled = false;
|
btnTable.disabled = false;
|
||||||
btnTop.innerHTML = originalTextTop;
|
btnTable.innerHTML = originalTextTable;
|
||||||
}
|
}
|
||||||
if (btnBottom) {
|
if (btnBottom) {
|
||||||
btnBottom.disabled = false;
|
btnBottom.disabled = false;
|
||||||
@@ -601,7 +562,7 @@ endif; ?>
|
|||||||
@media print {
|
@media print {
|
||||||
|
|
||||||
.btn-group,
|
.btn-group,
|
||||||
#btnSaveTop,
|
#btnSaveTable,
|
||||||
#btnSaveBottom,
|
#btnSaveBottom,
|
||||||
.card-header,
|
.card-header,
|
||||||
.form-label,
|
.form-label,
|
||||||
|
|||||||
Reference in New Issue
Block a user