saucy/app/views/members/index.html.erb

105 lines
3.9 KiB
Plaintext
Raw Normal View History

2022-06-25 12:48:46 +00:00
<p style="color: green"><%= notice %></p>
<h1><%= t 'members.index.title' %></h1>
2022-07-16 10:27:43 +00:00
<p><%= link_to t('members.index.actions.new'), new_member_path %></p>
2022-06-25 12:48:46 +00:00
<%= form_with url: members_path, method: :get do |form| %>
2022-07-16 10:27:43 +00:00
<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>
2022-06-25 12:48:46 +00:00
<% end %>
2022-07-16 10:27:43 +00:00
<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>
2022-06-25 12:48:46 +00:00
<% @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>
<ul>
<li><%= link_to t('members.index.actions.show'), member %></li>
<li><%= link_to t('members.index.actions.edit'), edit_member_path(member) %></li>
<li><%= link_to t('members.index.actions.new_contribution'), new_member_contribution_path(member) %></li>
<li><%= link_to t('members.index.actions.delete'), delete_member_path(member) %></li>
</ul>
2022-06-25 12:48:46 +00:00
</td>
</tr>
<% end %>
</table>