fix: modal limpar proprio + remove hint senha dinamica
This commit is contained in:
+17
-6
@@ -2105,9 +2105,22 @@ document.getElementById('btn-recibo').addEventListener('click', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('btn-limpar').addEventListener('click', () => {
|
document.getElementById('btn-limpar').addEventListener('click', () => {
|
||||||
try {
|
const overlay = document.createElement('div');
|
||||||
if (!confirm('Tem certeza? Irá apagar todas as informações para iniciar uma nova.')) return;
|
overlay.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:999999;display:flex;align-items:center;justify-content:center;';
|
||||||
} catch(e) { return; }
|
overlay.id = 'clear-modal';
|
||||||
|
overlay.innerHTML = `
|
||||||
|
<div style="background:#fff;border-radius:10px;padding:28px;width:340px;text-align:center">
|
||||||
|
<div style="font-size:20px;margin-bottom:12px">⚠️ Limpar Rascunho</div>
|
||||||
|
<div style="font-size:13px;color:#555;margin-bottom:20px;line-height:1.5">Tem certeza?<br>Irá <strong>apagar todas as informações</strong> lançadas para iniciar uma nova.</div>
|
||||||
|
<div style="display:flex;gap:10px;justify-content:center">
|
||||||
|
<button id="clear-cancel-btn" style="padding:9px 20px;background:#888;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px">Cancelar</button>
|
||||||
|
<button id="clear-ok-btn" style="padding:9px 20px;background:#c0272d;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:13px">Apagar tudo</button>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
document.body.appendChild(overlay);
|
||||||
|
document.getElementById('clear-cancel-btn').addEventListener('click', () => overlay.remove());
|
||||||
|
document.getElementById('clear-ok-btn').addEventListener('click', () => {
|
||||||
|
overlay.remove();
|
||||||
localStorage.removeItem(LS_KEY);
|
localStorage.removeItem(LS_KEY);
|
||||||
estado = {
|
estado = {
|
||||||
uuid: crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(),
|
uuid: crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(),
|
||||||
@@ -2118,12 +2131,10 @@ document.getElementById('btn-limpar').addEventListener('click', () => {
|
|||||||
fechamento_contado: { dinheiro: 0, cartoes: 0, receber: 0 },
|
fechamento_contado: { dinheiro: 0, cartoes: 0, receber: 0 },
|
||||||
observacoes: '', id_local: null, sync_status: 'local'
|
observacoes: '', id_local: null, sync_status: 'local'
|
||||||
};
|
};
|
||||||
// Limpa arrays
|
|
||||||
estado.sangrias = []; estado.despesas = []; estado.pixcnpj = [];
|
estado.sangrias = []; estado.despesas = []; estado.pixcnpj = [];
|
||||||
estado.vales = []; estado.receber = []; estado.cancelamentos = [];
|
estado.vales = []; estado.receber = []; estado.cancelamentos = [];
|
||||||
estado.cartoes = { credito: [], debito: [], alimentacao: [], pix: [] };
|
estado.cartoes = { credito: [], debito: [], alimentacao: [], pix: [] };
|
||||||
estado.fechamento_contado = { dinheiro: 0, cartoes: 0, receber: 0 };
|
estado.fechamento_contado = { dinheiro: 0, cartoes: 0, receber: 0 };
|
||||||
// Limpa todos os campos do formulário principal
|
|
||||||
setVal('f-operador', ''); setVal('f-turno', '');
|
setVal('f-operador', ''); setVal('f-turno', '');
|
||||||
setVal('f-fech-dinheiro', ''); setVal('f-fech-cartoes', ''); setVal('f-fech-receber', '');
|
setVal('f-fech-dinheiro', ''); setVal('f-fech-cartoes', ''); setVal('f-fech-receber', '');
|
||||||
setVal('f-saldo-esperado', ''); setVal('f-obs', '');
|
setVal('f-saldo-esperado', ''); setVal('f-obs', '');
|
||||||
@@ -2135,6 +2146,7 @@ document.getElementById('btn-limpar').addEventListener('click', () => {
|
|||||||
updateTotals();
|
updateTotals();
|
||||||
syncUI();
|
syncUI();
|
||||||
showToast('Rascunho limpo.', 'info');
|
showToast('Rascunho limpo.', 'info');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ─── Dia Anterior — seleção + consulta + edição de registros do Supabase ───
|
// ─── Dia Anterior — seleção + consulta + edição de registros do Supabase ───
|
||||||
@@ -2669,7 +2681,6 @@ function askPassword() {
|
|||||||
overlay.innerHTML = `
|
overlay.innerHTML = `
|
||||||
<div style="background:#fff;border-radius:10px;padding:24px;width:300px;text-align:center">
|
<div style="background:#fff;border-radius:10px;padding:24px;width:300px;text-align:center">
|
||||||
<div style="font-size:18px;margin-bottom:16px">🔐 Senha Admin</div>
|
<div style="font-size:18px;margin-bottom:16px">🔐 Senha Admin</div>
|
||||||
<div style="font-size:11px;color:#888;margin-bottom:12px">Dinâmica hoje: <strong>${getDynamicPw()}</strong></div>
|
|
||||||
<input type="password" id="pw-input" placeholder="Digite a senha..." style="width:100%;padding:10px;font-size:14px;border:1px solid #ccc;border-radius:6px;box-sizing:border-box;margin-bottom:12px" />
|
<input type="password" id="pw-input" placeholder="Digite a senha..." style="width:100%;padding:10px;font-size:14px;border:1px solid #ccc;border-radius:6px;box-sizing:border-box;margin-bottom:12px" />
|
||||||
<div id="pw-error" style="color:#c0272d;font-size:12px;margin-bottom:8px;display:none">Senha incorreta</div>
|
<div id="pw-error" style="color:#c0272d;font-size:12px;margin-bottom:8px;display:none">Senha incorreta</div>
|
||||||
<div style="display:flex;gap:8px;justify-content:center">
|
<div style="display:flex;gap:8px;justify-content:center">
|
||||||
|
|||||||
Reference in New Issue
Block a user