saucy/app/views/members/index.html.erb
Hugo Peixoto e9318b23d8 Small UI improvements
- Don't show dead ifthenpay link if there isn't one
- Remove actions from members#index in favor of members#show
- Display result count in members#index
- Increase table width in members#index
2023-02-26 13:03:36 +00:00

101 lines
3.6 KiB
Plaintext

<p style="color: green"><%= notice %></p>
<h1><%= t 'members.index.title' %></h1>
<p><%= link_to t('members.index.actions.new'), new_member_path %></p>
<%= form_with url: members_path, method: :get do |form| %>
<fieldset>
<legend>Filtrar</legend>
<table class='noborder lined'>
<tr>
<td><%= t 'members.attributes.display_name' %></td>
<td><%= form.text_field :display_name, value: params[:display_name] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.email' %></td>
<td><%= form.text_field :email, value: params[:email] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.identification_number' %></td>
<td><%= form.text_field :identification_number, value: params[:identification_number] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.status' %></td>
<td><%= form.select :status, %w[ any active passive pending expired cancelled ], { selected: params[:status] }, { multiple: true } %></td>
</tr>
<tr>
<td><%= t 'members.attributes.category' %></td>
<td>
<%= form.select :category, %w[ any student employed unemployed retired ], { selected: params[:category] }, { multiple: true } %>
</td>
</tr>
<tr>
<td><%= t 'members.attributes.prefers_postal' %></td>
<td>
<%= form.select :prefers_postal, %w[ any yes no ], selected: params[:prefers_postal] %>
</td>
</tr>
</td>
</tr>
</table>
<p><%= form.submit 'Search', name: '' %></p>
<% if params[:q].present? || params[:status].present? || params[:category].present? %>
<%= link_to t('members.index.actions.clear_search'), members_path %>
<% end %>
</fieldset>
<% end %>
<br>
<%= form_with url: letters_path do |form| %>
<fieldset>
<legend>Gerar PDF</legend>
<% (params.fetch(:status, []) - ['any', '']).each do |status| %>
<%= form.hidden_field 'status[]', value: status %>
<% end %>
<% (params.fetch(:category, []) - ['any', '']).each do |category| %>
<%= form.hidden_field 'category[]', value: category %>
<% end %>
<%= form.hidden_field :display_name, value: params[:display_name] %>
<%= form.hidden_field :email, value: params[:email] %>
<%= form.hidden_field :identification_number, value: params[:identification_number] %>
<%= form.hidden_field :prefers_postal, value: params[:prefers_postal] %>
<%= form.file_field :template, required: true %>
<%= form.submit 'Generate PDF' %>
</fieldset>
<% end %>
<p><%= t('members.index.results_count', count: @members.size) %></p>
<table class='zebra'>
<tr>
<th><%= link_to_current_with_sort t('members.attributes.number'), 'number.asc' %></th>
<th><%= link_to_current_with_sort t('members.attributes.status'), 'status.asc' %></th>
<th><%= link_to_current_with_sort t('members.attributes.email'), 'email.asc' %></th>
<th><%= link_to_current_with_sort t('members.attributes.display_name'), 'display_name.asc' %></th>
<th><%= link_to_current_with_sort t('members.attributes.joined_on'), 'joined_on.asc' %></th>
<th><%= link_to_current_with_sort t('members.attributes.expires_on'), 'expires_on.asc' %></th>
<th><%= t('members.index.actions.title') %></th>
</tr>
<% @members.each do |member| %>
<tr id="<%= dom_id member %>">
<td><%= member.number %></td>
<td><%= member_status(member.status) %></td>
<td><%= member.email %></td>
<td><%= member.display_name %></td>
<td><%= member.joined_on %></td>
<td><%= member.expires_on %></td>
<td>
<%= link_to t('members.index.actions.show'), member %>
</td>
</tr>
<% end %>
</table>