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 {
|
try {
|
||||||
const fixa = await window.__TAURI__.core.invoke('get_loja_fixa');
|
const fixa = await window.__TAURI__.core.invoke('get_loja_fixa');
|
||||||
if (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;
|
window.__LOJA_FIXA__ = fixa;
|
||||||
|
estado.loja = fixa;
|
||||||
|
|
||||||
const sel = document.getElementById('f-loja');
|
const sel = document.getElementById('f-loja');
|
||||||
if (sel) {
|
if (sel) {
|
||||||
sel.value = fixa;
|
sel.value = fixa;
|
||||||
sel.disabled = true;
|
sel.disabled = true;
|
||||||
sel.style.display = 'none';
|
sel.style.display = 'none';
|
||||||
}
|
}
|
||||||
// Esconde também o label "Loja"
|
// Esconde o label "Loja" (procura pelo texto, não pela posição)
|
||||||
const label = document.querySelector('.meta-label');
|
document.querySelectorAll('.meta-label').forEach(l => {
|
||||||
if (label && label.textContent.trim() === 'Loja') {
|
if (l.textContent.trim() === 'Loja') l.style.display = 'none';
|
||||||
label.style.display = 'none';
|
});
|
||||||
}
|
|
||||||
estado.loja = fixa;
|
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.warn('get_loja_fixa não disponível:', e);
|
console.warn('get_loja_fixa não disponível:', e);
|
||||||
@@ -3693,6 +3693,14 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
loadConfig();
|
loadConfig();
|
||||||
buildDatalists();
|
buildDatalists();
|
||||||
if (!loadState()) init();
|
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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user