fix: salvar usa _currentConsultaId (id numerico), nao full.id
This commit is contained in:
+3
-1
@@ -2197,7 +2197,9 @@ window.openConsultaRegistro = async function(idx) {
|
|||||||
|
|
||||||
if (!full) { alert('Registro não encontrado.'); return; }
|
if (!full) { alert('Registro não encontrado.'); return; }
|
||||||
|
|
||||||
|
// Preserva o id numerico (pk da tabela) antes de guardar o registro completo
|
||||||
window._currentConsulta = full;
|
window._currentConsulta = full;
|
||||||
|
window._currentConsultaId = item.id;
|
||||||
buildRelatorioModal(full);
|
buildRelatorioModal(full);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2425,7 +2427,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 = full.id;
|
const id = window._currentConsultaId;
|
||||||
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