<%= flash[:message] -%>

<%= t('page.listing', :model => t('activerecord.models.reserve')) -%>

<%= form_for :reserves, :url => reserves_path, :html => {:method => 'get'} do -%>

<%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
<%= t('activerecord.attributes.reserve.created_at') %>: <%= t('reserve.reserved_from') %>: <%= text_field_tag 'reserved_from', @reserved_from, {:class => 'date_field', :placeholder => "#{t('page.example')}: 2012-04-12"} -%> <%= t('reserve.reserved_to') %>: <%= text_field_tag 'reserved_to', @reserved_to, {:class => 'date_field', :placeholder => "#{t('page.example')}: 2012-05-11"} -%> <%= submit_tag t('page.search') -%>

<%- end -%>

<%= t('page.sort_by') -%>: <%- if @sort_by == :created_at -%> <%= t('activerecord.attributes.reserve.created_at') -%> <%- else -%> <%= link_to t('activerecord.attributes.reserve.created_at'), url_for(params.merge(:sort_by => nil, :only_path => true)) -%> <% end %> <%- if @sort_by == :title -%> <%= t('page.title') -%> <%- else -%> <%= link_to t('page.title'), url_for(params.merge(:sort_by => 'title', :only_path => true)) -%> <%- end -%>

<%- if can? :update, @reserves.first -%> <% end %> <%- @reserves.each_with_index do |reserve, i| -%> "> <%- if can? :destroy, reserve -%> <%- end -%> <%- end -%>
ID <%= t('activerecord.models.manifestation') -%> <%= t('activerecord.attributes.reserve.state') -%>
<%= link_to reserve.id, reserve -%> <%= render 'title', :reserve => reserve -%>
<%= t('activerecord.models.user') -%>: <%= link_to reserve.user.username, reserve.user -%> <%= t('activerecord.attributes.reserve.created_at') %>: <%= l(reserve.created_at, :format => :short) -%>
<%= t('activerecord.attributes.reserve.expired_at') %>: <%= l(reserve.expired_at, :format => :short) -%>
<%= i18n_state(reserve.state) -%> <% if reserve.item %>
(<%= link_to reserve.item.item_identifier, reserve.item %>) <% end %>
<%= link_to t('page.edit'), edit_reserve_path(reserve) -%> <%- if reserve.user.reserves.waiting.include?(reserve) -%>
<%= link_to t('page.cancel'), reserve_path(reserve, :mode => 'cancel'), :data => {:confirm => t('page.are_you_sure')}, :method => :put -%> <%- else -%>
<%= link_to t('page.destroy'), reserve, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%> <%- end -%>
<%= paginate(@reserves) -%>