<%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'History' } %>

<h2><%= t(:history) %></h2>

<table class="index">
  <tr data-hook="history_header">
    <th><%= t(:event) %></th>
    <th><%= t(:from_state) %></th>
    <th><%= t(:to_state) %></th>
    <th><%= t(:user) %></th>
    <th><%= "#{t('spree.date')}/#{t('spree.time')}" %></th>
  </tr>
  <% @order.state_changes.sort.each do |event| %>
    <tr data-hook="history_row">
      <td><%=t("#{event.name}") if event.name.present? %></td>
      <td><%=t("#{event.name}_state#{'s' unless event.name == 'order'}.#{event.previous_state}") %></td>
      <td><%=t("#{event.name}_state#{'s' unless event.name == 'order'}.#{event.next_state}") %></td>
      <td><%=event.user.email if event.user %></td>
      <td><%=event.created_at.to_s(:date_time24) %></td>
    </tr>
  <% end %>
  <% if @order.state_changes.empty? %>
    <tr data-hook="history_none">
      <td colspan="5"><%= t(:none_available) %></td>
    </tr>
  <% end %>
</table>

<%= button_link_to t(:continue), admin_orders_url %>
