diff --git a/fechamento-caixa-latest.tar.gz b/fechamento-caixa-latest.tar.gz
new file mode 100644
index 0000000..c6df5dc
Binary files /dev/null and b/fechamento-caixa-latest.tar.gz differ
diff --git a/fechamento-caixa.exe b/fechamento-caixa.exe
index f2294da..7ee857e 100755
Binary files a/fechamento-caixa.exe and b/fechamento-caixa.exe differ
diff --git a/src/index.html b/src/index.html
index 2300f66..4fea608 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1284,11 +1284,37 @@ ${data.observacoes ? `
Obs: ${data.observacoes}
` : ''}
}
function openPrintPreview(data) {
+ // Gera HTML e injeta no body de uma div temporária para window.print()
const html = buildPrintHTML(data);
- const win = window.open('', 'print_preview', 'width=400,height=700,scrollbars=yes,resizable=yes');
- if (!win) { alert('Bloqueador de pop-up impediu abrir a pré-visualização.'); return; }
- win.document.write(html);
- win.document.close();
+ const style = document.createElement('style');
+ style.textContent = `
+ @media print {
+ body { width: 80mm; margin: 0 auto; font-family: 'Courier New', monospace; font-size: 13px; }
+ .no-print { display: none !important; }
+ }
+ .print-actions { position: fixed; top: 10px; right: 10px; z-index: 9999; }
+ .print-actions button { padding: 8px 16px; cursor: pointer; background: #2563eb; color: #fff; border: none; border-radius: 4px; font-size: 14px; }
+ .print-actions button:hover { background: #1d4ed8; }
+ `;
+ const actions = document.createElement('div');
+ actions.className = 'print-actions no-print';
+ actions.innerHTML = '';
+
+ // Guarda conteúdo original
+ const originalBody = document.body.innerHTML;
+
+ document.body.innerHTML = html;
+ document.head.appendChild(style);
+ document.body.insertBefore(actions, document.body.firstChild);
+
+ // Quando fechar print dialog, restaura
+ const onAfterPrint = () => {
+ document.body.innerHTML = originalBody;
+ window.removeEventListener('afterprint', onAfterPrint);
+ // Re-carrega scripts essenciais
+ location.reload();
+ };
+ window.addEventListener('afterprint', onAfterPrint);
}
function triggerWindowPrint() {
@@ -1453,10 +1479,17 @@ document.getElementById('confirm-send').addEventListener('click', async () => {
const r = await tauriEnviar();
estado.sync_status = 'synced';
saveState();
- alert('✅ Enviado com sucesso!');
+ alert('✅ Enviado com sucesso!\n\n📋 Tabela: fechamentos_web\n🌐 Servidor: supabase.ofrangao.com.br\n\nAbra o Supabase Studio para verificar.');
} catch(e) {
await tauriSaveLocal();
- alert('Erro ao enviar: ' + (e.message || e) + '\n(Dados salvos localmente)');
+ const msg = e?.message || e?.toString?.() || String(e);
+ alert(
+ '⚠️ Erro ao enviar para o Supabase.\n\n' +
+ '📋 Tabela: fechamentos_web\n' +
+ '🌐 Servidor: supabase.ofrangao.com.br\n\n' +
+ 'O servidor pode estar offline. Dados salvos localmente.\n\n' +
+ 'Erro: ' + msg
+ );
} finally {
btn.disabled = false;
btn.textContent = '💾 Enviar Fechamento';