fix: id do registro em campo oculto, fallback chain no salvar
This commit is contained in:
+2
-1
@@ -2324,6 +2324,7 @@ function buildRelatorioModal(full) {
|
|||||||
${obs ? `<div style="background:#fff8e1;border-radius:6px;padding:8px;margin-bottom:10px;font-size:12px"><strong>Obs:</strong> ${obs}</div>` : ''}
|
${obs ? `<div style="background:#fff8e1;border-radius:6px;padding:8px;margin-bottom:10px;font-size:12px"><strong>Obs:</strong> ${obs}</div>` : ''}
|
||||||
|
|
||||||
<div id="edit-section" style="display:none;margin-bottom:10px">
|
<div id="edit-section" style="display:none;margin-bottom:10px">
|
||||||
|
<input type="hidden" id="edit-id" value="${full.id || ''}" />
|
||||||
<div style="font-size:12px;color:#666;margin-bottom:6px">Editar campos (requer senha admin):</div>
|
<div style="font-size:12px;color:#666;margin-bottom:6px">Editar campos (requer senha admin):</div>
|
||||||
<div style="margin-bottom:6px">
|
<div style="margin-bottom:6px">
|
||||||
<label style="font-size:11px;color:#555">Saldo Esperado:</label><br>
|
<label style="font-size:11px;color:#555">Saldo Esperado:</label><br>
|
||||||
@@ -2427,7 +2428,7 @@ window.salvarEdicaoConsulta = async function() {
|
|||||||
if (!hasTauri) { alert('Tauri não disponível.'); return; }
|
if (!hasTauri) { alert('Tauri não disponível.'); return; }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const id = window._currentConsultaId;
|
const id = document.getElementById('edit-id').value || window._currentConsultaId || full.id;
|
||||||
if (!id) { alert('ID do registro não encontrado. Não é possível atualizar.'); return; }
|
if (!id) { alert('ID do registro não encontrado. Não é possível atualizar.'); return; }
|
||||||
|
|
||||||
await window.__TAURI__.core.invoke('sb_atualizar_fechamento', { id, updates });
|
await window.__TAURI__.core.invoke('sb_atualizar_fechamento', { id, updates });
|
||||||
|
|||||||
Reference in New Issue
Block a user