Correção de responsividade geral
This commit is contained in:
@@ -7,6 +7,7 @@ import { Controller } from "@hotwired/stimulus"
|
||||
export default class extends Controller {
|
||||
static targets = [
|
||||
"linha", "checkbox", "selecionarTodos", "busca", "buscaVazia",
|
||||
"barraSelecao", "contadorSelecao",
|
||||
"resumo", "listaCol", "btnResumoLabel",
|
||||
"toggles", "barra", "barraManuais", "percentual", "chipVeiculo",
|
||||
"consolidarBtn", "consolidarHint",
|
||||
@@ -98,6 +99,22 @@ export default class extends Controller {
|
||||
if (linha && linha.classList.contains("hidden")) return
|
||||
c.checked = marcar
|
||||
})
|
||||
this.atualizarSelecao()
|
||||
}
|
||||
|
||||
// ── Barra de ações em massa: só existe quando há seleção ──
|
||||
// Sem isto os 5 botões de pilar ficavam fixos no topo o tempo todo, comendo
|
||||
// a altura da lista para não fazer nada (clicar sem seleção só alertava).
|
||||
atualizarSelecao() {
|
||||
const n = this.checkboxTargets.filter(c => c.checked).length
|
||||
if (this.hasContadorSelecaoTarget) this.contadorSelecaoTarget.textContent = n
|
||||
if (this.hasBarraSelecaoTarget) this.barraSelecaoTarget.classList.toggle("hidden", n === 0)
|
||||
}
|
||||
|
||||
limparSelecao() {
|
||||
this.checkboxTargets.forEach(c => (c.checked = false))
|
||||
if (this.hasSelecionarTodosTarget) this.selecionarTodosTarget.checked = false
|
||||
this.atualizarSelecao()
|
||||
}
|
||||
|
||||
// O pilar está ativo (ring-2) na entrega indicada?
|
||||
@@ -137,8 +154,7 @@ export default class extends Controller {
|
||||
valor: valor
|
||||
})
|
||||
ids.forEach(id => this.setToggle(id, tipo, !remover))
|
||||
this.checkboxTargets.forEach(c => c.checked = false)
|
||||
if (this.hasSelecionarTodosTarget) this.selecionarTodosTarget.checked = false
|
||||
this.limparSelecao() // some a barra de ações junto com a seleção
|
||||
this.atualizarResumo(resp)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user