<%= notice %>

<%= t 'members.index.title' %>

<%= link_to t('members.index.actions.new'), new_member_path %>

<%= form_with url: members_path, method: :get do |form| %>
Filtrar
<%= t 'members.attributes.display_name' %> <%= form.text_field :display_name, value: params[:display_name] %>
<%= t 'members.attributes.email' %> <%= form.text_field :email, value: params[:email] %>
<%= t 'members.attributes.identification_number' %> <%= form.text_field :identification_number, value: params[:identification_number] %>
<%= t 'members.attributes.status' %> <%= form.select :status, %w[ any active passive pending expired cancelled ], { selected: params[:status] }, { multiple: true } %>
<%= t 'members.attributes.category' %> <%= form.select :category, %w[ any student employed unemployed retired ], { selected: params[:category] }, { multiple: true } %>
<%= t 'members.attributes.prefers_postal' %> <%= form.select :prefers_postal, %w[ any yes no ], selected: params[:prefers_postal] %>

<%= form.submit 'Search', name: '' %>

<% if params[:q].present? || params[:status].present? || params[:category].present? %> <%= link_to t('members.index.actions.clear_search'), members_path %> <% end %>
<% end %>
<%= form_with url: letters_path do |form| %>
Gerar PDF <% (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' %>
<% end %>

<%= t('members.index.results_count', count: @members.size) %>

<% @members.each do |member| %> <% end %>
<%= link_to_current_with_sort t('members.attributes.number'), 'number.asc' %> <%= link_to_current_with_sort t('members.attributes.status'), 'status.asc' %> <%= link_to_current_with_sort t('members.attributes.email'), 'email.asc' %> <%= link_to_current_with_sort t('members.attributes.display_name'), 'display_name.asc' %> <%= link_to_current_with_sort t('members.attributes.joined_on'), 'joined_on.asc' %> <%= link_to_current_with_sort t('members.attributes.expires_on'), 'expires_on.asc' %> <%= t('members.index.actions.title') %>
<%= member.number %> <%= member_status(member.status) %> <%= member.email %> <%= member.display_name %> <%= member.joined_on %> <%= member.expires_on %> <%= link_to t('members.index.actions.show'), member %>