Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b3eb1a4cc | |||
| c7109b1017 |
+48
-40
@@ -1386,26 +1386,26 @@ function buildConfirmHTML(data) {
|
|||||||
<title>Fechamento de Caixa</title>
|
<title>Fechamento de Caixa</title>
|
||||||
<style>
|
<style>
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
body { font-family: 'Courier New', monospace; font-size: 13px; width: 80mm; margin: 0 auto; padding: 8px; font-weight: bold; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
body { font-family: 'Courier New', monospace; font-size: 15px; width: 80mm; margin: 0 auto; padding: 8px; font-weight: bold !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
||||||
.header { text-align: center; margin-bottom: 8px; }
|
.header { text-align: center; margin-bottom: 8px; }
|
||||||
.header h1 { font-size: 18px; font-weight: bold; }
|
.header h1 { font-size: 20px; font-weight: bold !important; }
|
||||||
.header h2 { font-size: 14px; font-weight: normal; }
|
.header h2 { font-size: 16px; font-weight: bold !important; }
|
||||||
hr { border: none; border-top: 1px dashed #000; margin: 5px 0; }
|
hr { border: none; border-top: 2px solid #000; margin: 6px 0; }
|
||||||
.section-title { font-weight: bold; font-size: 13px; border-top: 1px dashed #000; padding-top: 3px; margin-top: 6px; }
|
.section-title { font-weight: bold !important; font-size: 14px; border-top: 2px solid #000; padding-top: 4px; margin-top: 8px; }
|
||||||
.row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 12px; font-weight: bold; }
|
.row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 14px; font-weight: bold !important; }
|
||||||
.row.total-row { font-weight: bold; }
|
.row.total-row { font-weight: bold !important; }
|
||||||
.cart-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; font-weight: bold; }
|
.cart-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; font-weight: bold !important; }
|
||||||
.cart-table th { font-weight: bold; border-bottom: 1px solid #000; padding: 2px; }
|
.cart-table th { font-weight: bold !important; border-bottom: 2px solid #000; padding: 3px; font-size: 13px; }
|
||||||
.cart-table td { padding: 2px 4px; text-align: right; font-weight: bold; }
|
.cart-table td { padding: 3px 5px; text-align: right; font-weight: bold !important; font-size: 13px; }
|
||||||
.cart-table td:first-child { text-align: left; }
|
.cart-table td:first-child { text-align: left; }
|
||||||
.cart-table tr.total-row { font-weight: bold; border-top: 1px dashed #000; }
|
.cart-table tr.total-row { font-weight: bold !important; border-top: 2px solid #000; }
|
||||||
.subtotal { font-size: 12px; margin-top: 4px; }
|
.subtotal { font-size: 13px; margin-top: 4px; }
|
||||||
.subtotal .row { padding: 1px 0; }
|
.subtotal .row { padding: 1px 0; font-weight: bold !important; }
|
||||||
.diff-ok { color: #2e7d32; font-weight: bold; }
|
.diff-ok { color: #2e7d32; font-weight: bold !important; }
|
||||||
.diff-bad { color: #c0272d; font-weight: bold; }
|
.diff-bad { color: #c0272d; font-weight: bold !important; }
|
||||||
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; font-weight: normal; }
|
.obs { font-size: 12px; color: #555; margin-top: 6px; white-space: pre-wrap; font-weight: bold !important; }
|
||||||
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
.footer { text-align: center; font-size: 12px; color: #555; margin-top: 8px; font-weight: bold !important; }
|
||||||
@media print { body { background: #fff; font-weight: bold !important; } }
|
@media print { body { background: #fff; font-weight: bold !important; font-size: 15px !important; } }
|
||||||
</head><body>
|
</head><body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>${data.loja}</h1>
|
<h1>${data.loja}</h1>
|
||||||
@@ -1604,26 +1604,26 @@ function buildPrintHTML(data) {
|
|||||||
<title>Fechamento de Caixa</title>
|
<title>Fechamento de Caixa</title>
|
||||||
<style>
|
<style>
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
body { font-family: 'Courier New', monospace; font-size: 13px; width: 80mm; margin: 0 auto; padding: 8px; font-weight: bold; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
body { font-family: 'Courier New', monospace; font-size: 15px; width: 80mm; margin: 0 auto; padding: 8px; font-weight: bold !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
|
||||||
.header { text-align: center; margin-bottom: 8px; }
|
.header { text-align: center; margin-bottom: 8px; }
|
||||||
.header h1 { font-size: 18px; font-weight: bold; }
|
.header h1 { font-size: 20px; font-weight: bold !important; }
|
||||||
.header h2 { font-size: 14px; font-weight: normal; }
|
.header h2 { font-size: 16px; font-weight: bold !important; }
|
||||||
hr { border: none; border-top: 1px dashed #000; margin: 5px 0; }
|
hr { border: none; border-top: 2px solid #000; margin: 6px 0; }
|
||||||
.section-title { font-weight: bold; font-size: 13px; border-top: 1px dashed #000; padding-top: 3px; margin-top: 6px; }
|
.section-title { font-weight: bold !important; font-size: 14px; border-top: 2px solid #000; padding-top: 4px; margin-top: 8px; }
|
||||||
.row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 12px; font-weight: bold; }
|
.row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 14px; font-weight: bold !important; }
|
||||||
.row.total-row { font-weight: bold; }
|
.row.total-row { font-weight: bold !important; }
|
||||||
.cart-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; font-weight: bold; }
|
.cart-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; font-weight: bold !important; }
|
||||||
.cart-table th { font-weight: bold; border-bottom: 1px solid #000; padding: 2px; }
|
.cart-table th { font-weight: bold !important; border-bottom: 2px solid #000; padding: 3px; font-size: 13px; }
|
||||||
.cart-table td { padding: 2px 4px; text-align: right; font-weight: bold; }
|
.cart-table td { padding: 3px 5px; text-align: right; font-weight: bold !important; font-size: 13px; }
|
||||||
.cart-table td:first-child { text-align: left; }
|
.cart-table td:first-child { text-align: left; }
|
||||||
.cart-table tr.total-row { font-weight: bold; border-top: 1px dashed #000; }
|
.cart-table tr.total-row { font-weight: bold !important; border-top: 2px solid #000; }
|
||||||
.subtotal { font-size: 12px; margin-top: 4px; }
|
.subtotal { font-size: 13px; margin-top: 4px; }
|
||||||
.subtotal .row { padding: 1px 0; }
|
.subtotal .row { padding: 1px 0; font-weight: bold !important; }
|
||||||
.diff-ok { color: #2e7d32; font-weight: bold; }
|
.diff-ok { color: #2e7d32; font-weight: bold !important; }
|
||||||
.diff-bad { color: #c0272d; font-weight: bold; }
|
.diff-bad { color: #c0272d; font-weight: bold !important; }
|
||||||
.obs { font-size: 11px; color: #555; margin-top: 6px; white-space: pre-wrap; font-weight: normal; }
|
.obs { font-size: 12px; color: #555; margin-top: 6px; white-space: pre-wrap; font-weight: bold !important; }
|
||||||
.footer { text-align: center; font-size: 11px; color: #555; margin-top: 8px; }
|
.footer { text-align: center; font-size: 12px; color: #555; margin-top: 8px; font-weight: bold !important; }
|
||||||
@media print { body { background: #fff; font-weight: bold !important; } }
|
@media print { body { background: #fff; font-weight: bold !important; font-size: 15px !important; } }
|
||||||
</style>
|
</style>
|
||||||
</head><body>
|
</head><body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@@ -2389,6 +2389,10 @@ window.abrirFechamentoEdicao = function(full) {
|
|||||||
const dados = full.dados || full;
|
const dados = full.dados || full;
|
||||||
if (!dados) { alert('Dados detalhados não encontrados neste registro.'); return; }
|
if (!dados) { alert('Dados detalhados não encontrados neste registro.'); return; }
|
||||||
|
|
||||||
|
// IDs do registro — CRÍTICO para o salvamento via Supabase
|
||||||
|
estado.uuid = full.uuid || null;
|
||||||
|
estado.id = full.id || full.uuid || null;
|
||||||
|
|
||||||
// Preenche o estado global com todos os campos do JSONB
|
// Preenche o estado global com todos os campos do JSONB
|
||||||
estado.loja = dados.loja || full.loja || '';
|
estado.loja = dados.loja || full.loja || '';
|
||||||
estado.data = dados.data || full.data || '';
|
estado.data = dados.data || full.data || '';
|
||||||
@@ -2463,7 +2467,7 @@ window.abrirFechamentoEdicao = function(full) {
|
|||||||
renderTable('tbl-cartao-pix', estado.cartoes.pix);
|
renderTable('tbl-cartao-pix', estado.cartoes.pix);
|
||||||
|
|
||||||
// Recalcula totais
|
// Recalcula totais
|
||||||
calcAll();
|
updateTotals();
|
||||||
|
|
||||||
// Rola para o topo do formulário
|
// Rola para o topo do formulário
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
@@ -2479,11 +2483,15 @@ window.toggleEditConsulta = async function() {
|
|||||||
// Se já está editando, apenas fecha
|
// Se já está editando, apenas fecha
|
||||||
if (window._editModalOpen) { closeEditModal(); return; }
|
if (window._editModalOpen) { closeEditModal(); return; }
|
||||||
|
|
||||||
// Pede senha admin primeiro (se configurada)
|
// Pede senha admin primeiro — sempre, para proteger edições
|
||||||
const pw = config.admin_password;
|
const pw = config.admin_password;
|
||||||
if (pw) {
|
if (pw) {
|
||||||
const ok = await askPassword();
|
const ok = await askPassword();
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
} else {
|
||||||
|
// Sem senha configurada — avisa e abre mesmo assim (primeiro uso)
|
||||||
|
const ok = await askPassword(); // mostra diálogo vazio para o admin configurar mentalmente
|
||||||
|
if (!ok) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditModal(full);
|
openEditModal(full);
|
||||||
@@ -2991,7 +2999,7 @@ window.salvarEdicaoModal = async function() {
|
|||||||
if (!uuid) { alert('UUID do registro não encontrado.'); return; }
|
if (!uuid) { alert('UUID do registro não encontrado.'); return; }
|
||||||
console.log('[DEBUG] salvarEdicaoModal uuid:', uuid, 'updates:', JSON.stringify(updates));
|
console.log('[DEBUG] salvarEdicaoModal uuid:', uuid, 'updates:', JSON.stringify(updates));
|
||||||
|
|
||||||
await window.__TAURI__.core.invoke('sb_atualizar_fechamento', { uuid, updates: JSON.stringify(updates) });
|
await window.__TAURI__.core.invoke('sb_atualizar_fechamento', { id: uuid, updates: JSON.stringify(updates) });
|
||||||
closeEditModal();
|
closeEditModal();
|
||||||
closeRelatorioModal();
|
closeRelatorioModal();
|
||||||
alert('✅ Atualizado com sucesso!');
|
alert('✅ Atualizado com sucesso!');
|
||||||
@@ -3252,7 +3260,7 @@ async function salvarEdicaoSupabase() {
|
|||||||
const id = estado.id || estado.uuid;
|
const id = estado.id || estado.uuid;
|
||||||
console.log('[DEBUG] salvando id:', id, 'data:', JSON.stringify(data));
|
console.log('[DEBUG] salvando id:', id, 'data:', JSON.stringify(data));
|
||||||
const result = await window.__TAURI__.core.invoke('sb_atualizar_fechamento', {
|
const result = await window.__TAURI__.core.invoke('sb_atualizar_fechamento', {
|
||||||
uuid: id,
|
id: id,
|
||||||
updates: JSON.stringify(data)
|
updates: JSON.stringify(data)
|
||||||
});
|
});
|
||||||
console.log('[DEBUG] sb_atualizar_fechamento result:', result);
|
console.log('[DEBUG] sb_atualizar_fechamento result:', result);
|
||||||
|
|||||||
Reference in New Issue
Block a user