 <div data-hook="admin_order_form_fields">
  <% if @line_item.try(:errors).present? %>
    <%= render partial: 'spree/shared/error_messages', locals: { target: @line_item } %>
  <% end %>

  <%= render :partial => "spree/admin/orders/carton", collection: @order.cartons.order(:shipped_at), locals: { order: order } %>
  <%= render :partial => "spree/admin/orders/shipment", collection: @order.shipments.order(:created_at), locals: { order: order } %>

  <%= render "spree/admin/orders/order_details", { order: order } %>

  <script>
    var order_number = '<%= @order.number %>';
    var shipments = [];

    <% @order.shipments.each do |shipment| %>
            shipments.push(<%== shipment.as_json(root: false, only: [:id, :tracking, :number, :state, :stock_location_id], include: [:inventory_units, :stock_location]).to_json %>);
    <% end %>
  </script>
</div>
