fix: seletor loja药业 - forçar valor após init(), esconder label pelo texto
Build Fechamento de Caixa / build (macos-14, app) (push) Has been cancelled
Build Fechamento de Caixa / build (ubuntu-22.04, deb) (push) Has been cancelled
Build Fechamento de Caixa / build (windows-2022, msi) (push) Has been cancelled

This commit is contained in:
root
2026-07-03 13:02:32 +00:00
parent 2bfbf29ccb
commit 65c444ad09
+15 -7
View File
@@ -3672,20 +3672,20 @@ document.addEventListener('DOMContentLoaded', async () => {
try {
const fixa = await window.__TAURI__.core.invoke('get_loja_fixa');
if (fixa) {
// Build fixa: desabilita e esconde o seletor de loja
// Build fixa: marca global, esconde e bloqueia o seletor de loja
window.__LOJA_FIXA__ = fixa;
estado.loja = fixa;
const sel = document.getElementById('f-loja');
if (sel) {
sel.value = fixa;
sel.disabled = true;
sel.style.display = 'none';
}
// Esconde também o label "Loja"
const label = document.querySelector('.meta-label');
if (label && label.textContent.trim() === 'Loja') {
label.style.display = 'none';
}
estado.loja = fixa;
// Esconde o label "Loja" (procura pelo texto, não pela posição)
document.querySelectorAll('.meta-label').forEach(l => {
if (l.textContent.trim() === 'Loja') l.style.display = 'none';
});
}
} catch(e) {
console.warn('get_loja_fixa não disponível:', e);
@@ -3693,6 +3693,14 @@ document.addEventListener('DOMContentLoaded', async () => {
loadConfig();
buildDatalists();
if (!loadState()) init();
// ⚠️ Segurança extra: se build fixa, garante que o valor do select está correto
// e que estado.loja nunca fica vazio (independentemente do que init() fez)
if (window.__LOJA_FIXA__) {
const sel = document.getElementById('f-loja');
if (sel) sel.value = window.__LOJA_FIXA__;
estado.loja = window.__LOJA_FIXA__;
}
});
</script>
</body>