fix: seletor loja药业 - forçar valor após init(), esconder label pelo texto
This commit is contained in:
+15
-7
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user