EvoBal/app/views/filters/index.html.erb

59 lines
3.3 KiB
Plaintext

<% content_for :main_header do %>
<h1>Filters</h1>
<% end %>
<%= render(FlashNoticeComponent.new) { notice } if notice.present? %>
<div class="shadow overflow-hidden border-b border-gray-200 rounded-lg">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Description</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Enabled</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Operator</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Inverted</th>
<th scope="col" class="relative px-6 py-3"><span class="sr-only">Show, Edit, Destroy</span></th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<% @filters.each do |filter| %>
<tr class="<%= cycle('bg-white', 'bg-gray-50', :name => 'zebra') %>">
<td class="px-6 py-4 whitespace-nowrap">
<%= filter.description %>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<% if filter.enabled? %>
<!-- Enabled: "bg-indigo-600", Not Enabled: "bg-gray-200" -->
<%= link_to disable_filter_path(filter), data: { method: :patch, confirm: 'Are you sure you want to disable this filter?' }, class: "bg-green-400 relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", "aria-pressed":"false" do %>
<span class="sr-only">Disable</span>
<!-- Enabled: "translate-x-5", Not Enabled: "translate-x-0" -->
<span aria-hidden="true" class="translate-x-5 pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200"></span>
<% end %>
<% else %>
<%= link_to enable_filter_path(filter), data: { method: :patch, confirm: 'Are you sure you want to disable this filter?' }, class: "bg-gray-200 relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", "aria-pressed":"false" do %>
<span class="sr-only">Enable</span>
<!-- Enabled: "translate-x-5", Not Enabled: "translate-x-0" -->
<span aria-hidden="true" class="translate-x-0 pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200"></span>
<% end %>
<% end %>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<%= filter.operator %>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<%= filter.inverted %>
</td>
<td>
<%= link_to 'Show', filter %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<br>
<%= link_to 'New Filter', new_filter_path %>