<h1><%= t(:order) + " #{@order.number}" %></h1>

<% content_for :sidebar do %>
  <div id="order_tab_summary" data-hook>
    <h3 id="order_number" data-hook><%= "#{t(:order)} ##{@order.number} " %></h3>
    <h5 id="order_status" data-hook><%= "#{t(:status)}: #{t("order_state.#{@order.state}")}" %></h5>
    <h5 id="order_total" data-hook><%= "#{t(:total)}: #{number_to_currency @order.total}" %></h5>
    <% if @order.completed? %>
      <h5 id="shipment_status"><%= "#{t(:shipment)}: #{t("shipment_states.#{@order.shipment_state}")}" %></h5>
      <h5 id="payment_status"><%= "#{t(:payment)}: #{t("payment_states.#{@order.payment_state}")}" %></h5>
    <% end %>
    <br class="clear" />
  </div>
  <br class="clear" />

  <ul class="sidebar" data-hook="admin_order_tabs">
    <% unless @order.completed? %>
      <li<%== ' class="active"' if current == 'Order Details' %>>
        <%= link_to t(:order_details), edit_admin_order_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Customer Details' %>>
          <%= link_to t(:customer_details), admin_order_customer_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Shipments' %>>
         <%= link_to t(:shipment), @order.line_items.empty? || !@order.completed? ? 'javascript:$("form").submit();' : edit_admin_order_shipment_url(@order, @order.shipment) %>
      </li>
      <li<%== ' class="active"' if current == 'Adjustments' %>>
         <%= link_to t(:adjustments), @order.line_items.empty? || !@order.completed? ? 'javascript:$("form").submit();' : admin_order_adjustments_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Payments' %>>
         <%= link_to t(:payment), @order.line_items.empty? || !@order.completed? ? 'javascript:$("form").submit();' : new_admin_order_payment_url(@order) %>
      </li>

    <% else %>
      <li<%== ' class="active"' if current == 'Order Details' %>>
        <%= link_to t(:order_details), admin_order_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Customer Details' %>>
        <%= link_to t(:customer_details), admin_order_customer_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Adjustments' %>>
         <%= link_to t(:adjustments), admin_order_adjustments_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Payments' %>>
         <%= link_to t(:payments), admin_order_payments_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Shipments' %>>
         <%= link_to t(:shipments), admin_order_shipments_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'Return Authorizations' %>>
         <%= link_to t(:return_authorizations), admin_order_return_authorizations_url(@order) %>
      </li>
      <li<%== ' class="active"' if current == 'History' %>>
         <%= link_to t(:history), history_admin_order_url(@order) %>
      </li>
    <% end %>
  </ul>

<% end %>
