<div class="toolbar" data-hook="toolbar">
  <ul class="actions" data-hook="admin_shipment_edit_buttons">
    <li>
      <% if @shipment.can_ship? %>
        <%= button_link_to t(:ship), fire_admin_order_shipment_path(@order, @shipment, :e => 'ship'), :method => :put, :confirm => t(:are_you_sure) %>
      <% end %>
    </li>
  </ul>
  <br class="clear" />
</div>

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

<div data-hook="admin_shipment_edit_header">
  <h2><%= t(:shipment) %> #<%= @shipment.number%> (<%= t(@shipment.state.to_sym, :scope => :state_names, :default => @shipment.state.to_s.humanize) %>)</h2>
  <% if @shipment.cost %>
    <h3><%= t(:charges) %> <%= number_to_currency @shipment.cost %></h3>
  <% end %>

  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @shipment } %>
</div>

<div data-hook="admin_shipment_edit_form">
  <%= form_for @shipment, :url => admin_order_shipment_path(@order, @shipment), :method => :put do |shipment_form| %>
      <%= render :partial => 'form', :locals => { :shipment_form => shipment_form } %>

      <div data-hook="admin_shipment_edit_form_buttons">
        <p class="form-buttons">
          <% if self.respond_to?(:current_user) && @shipment.editable_by?(current_user) %>
            <%= button @order.cart? ? t(:continue) : t(:update) %>
            <%= t(:or) %> <%= link_to t(:cancel), admin_order_shipments_path(@order) %>
          <% else %>
            <%= link_to raw("&laquo; #{t(:back)}"), edit_admin_order_shipment_path(@order) %>
          <% end %>
        </p>
      </div>
  <% end %>
</div>
