Modificando o Filtro de Operação

This commit is contained in:
2026-06-17 17:56:48 -03:00
parent b86105d1e4
commit 4b728c0c4d
4 changed files with 69 additions and 10 deletions

View File

@@ -37,14 +37,26 @@
<summary class="cursor-pointer list-none pl-4 pr-4 py-2.5 bg-[#1a1a1a] border border-white/10 rounded-xl text-white text-sm whitespace-nowrap hover:border-orange-500">
🗂️ <%= @operacao_filtro.present? ? "#{@operacao_filtro.size} operação(ões)" : 'Todas as operações' %>
</summary>
<div class="absolute right-0 mt-2 z-30 w-72 max-h-72 overflow-y-auto bg-[#1a1a1a] border border-white/10 rounded-xl p-2 shadow-xl">
<% @operacoes.each do |op| %>
<label class="flex items-center gap-2 text-white text-sm hover:bg-[#0a0a0a] rounded px-2 py-2 cursor-pointer">
<input type="checkbox" name="operacoes[]" value="<%= op[:tabela] %>"
<%= 'checked' if @operacao_filtro.include?(op[:tabela]) %>
class="op-filtro rounded text-orange-500 bg-[#0a0a0a] border-white/10">
<%= op[:label] %>
</label>
<div class="absolute right-0 mt-2 z-30 w-72 max-h-80 overflow-y-auto bg-[#1a1a1a] border border-white/10 rounded-xl p-2 shadow-xl">
<%# Limpar seleção — recarrega o dashboard sem filtro de operação %>
<div class="flex items-center justify-between px-2 pb-2 mb-1 border-b border-white/10">
<span class="text-xs uppercase tracking-wider text-gray-400">Operações</span>
<% if @operacao_filtro.present? %>
<%= link_to '✕ Limpar', dashboard_path(inicio: @periodo_inicio.strftime('%Y-%m-%d'), fim: @periodo_fim.strftime('%Y-%m-%d')),
data: { turbo: false }, class: 'text-xs text-orange-400 hover:text-orange-300 font-semibold' %>
<% end %>
</div>
<% @operacoes_agrupadas.each do |titulo, ops| %>
<p class="px-2 pt-2 pb-1 text-xs font-bold uppercase tracking-wider text-gray-400"><%= titulo %></p>
<% ops.each do |op| %>
<label class="flex items-center gap-2 text-white text-sm hover:bg-[#0a0a0a] rounded px-2 py-2 cursor-pointer">
<input type="checkbox" name="operacoes[]" value="<%= op[:tabela] %>"
<%= 'checked' if @operacao_filtro.include?(op[:tabela]) %>
class="op-filtro rounded text-orange-500 bg-[#0a0a0a] border-white/10">
<%= op[:label] %>
</label>
<% end %>
<% end %>
</div>
</details>