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

<% admin_breadcrumb(t('spree.confirm_order')) %>

<%= render partial: 'spree/admin/orders/confirm/customer_details', locals: {order: @order} %>

<% if Spree::Order.checkout_step_names.include?(:delivery) %>
  <%= render partial: 'spree/admin/orders/confirm/shipment', collection: @order.shipments, locals: {order: @order} %>
<% else %>
  <%= render partial: 'spree/admin/orders/confirm/line_items', locals: {order: @order} %>
<% end %>

<%=
  render(
    partial: 'spree/admin/orders/adjustments',
    locals: {
      adjustments: @order.line_item_adjustments,
      order: @order,
      title: t('spree.line_item_adjustments'),
    }
  ) if @order.line_item_adjustments.eligible.any?
%>

<%=
  render(
    partial: 'spree/admin/orders/adjustments',
    locals: {
      adjustments: @order.shipment_adjustments,
      order: @order,
      title: t('spree.shipment_adjustments'),
    }
  ) if @order.shipment_adjustments.eligible.any?
%>

<%=
  render(
    partial: 'spree/admin/orders/adjustments',
    locals: {
      adjustments: @order.adjustments,
      order: @order,
      title: t('spree.order_adjustments'),
    }
  ) if @order.adjustments.eligible.any?
%>

<% if @order.line_items.exists? %>
  <fieldset class="no-border-bottom" id="order-total" data-hook="order_details_total">
    <legend><%= t('spree.order_total') %></legend>
    <span class="order-total"><%= @order.display_total %></span>
  </fieldset>
<% end %>

<%= render partial: 'spree/admin/orders/confirm/payments', locals: {payments: @order.payments} %>

<div class="form-buttons filter-actions actions" data-hook="complete-order-button">
  <%= button_to [:complete, :admin, @order], { class: 'button', method: 'put' } do %>
    <%= t('spree.complete_order') %>
  <% end %>
</div>
