<table class="index" data-hook="order_details">
  <tbody id="line-items" data-hook>
    <tr data-hook="order_details_line_items_headers">
      <th><%= t(:item_description) %></th>
      <th class="price"><%= t(:price) %></th>
      <th class="qty"><%= t(:qty) %></th>
      <th class="total"><span><%= t(:total) %></span></th>
    </tr>

    <% @order.line_items.each do |item| %>
      <tr data-hook="order_details_line_item_row">
        <td width="300"><%= item.variant.product.name %> <%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? %></td>
        <td class="price"><%= number_to_currency item.price %></td>
        <td class="qty"><%= item.quantity %></td>
        <td class="total"><span><%= number_to_currency (item.price * item.quantity) %></span></td>
      </tr>
    <% end %>
  </tbody>
  <tbody id="subtotal" data-hook="order_details_subtotal">
    <tr class="total" id="subtotal-row">
      <td colspan="3"><b><%= t(:subtotal) %>:</b></td>
      <td class="total"><span><%= number_to_currency @order.item_total %></span></td>
    </tr>
  </tbody>
  <tbody id="order-charges" data-hook="order_details_adjustments">
    <% @order.adjustments.eligible.each do |adjustment| %>
    <% next if (adjustment.originator_type == 'Spree::TaxRate') and (adjustment.amount == 0) %>
      <tr class="total">
        <td colspan="3"><strong><%= adjustment.label %></strong></td>
        <td class="total"><span><%= number_to_currency adjustment.amount %></span></td>
      </tr>
    <% end %>
  </tbody>
  <tbody id="order-total" data-hook="order_details_total">
    <tr class="total">
      <td colspan="3"><b><%= t(:order_total) %>:</b></td>
      <td class="total"><span id="order_total"><%= number_to_currency @order.total %></span></td>
    </tr>
  </tbody>
  <% if order.price_adjustment_totals.present? %>
    <tbody id="price-adjustments" data-hook="order_details_price_adjustments">
      <% @order.price_adjustment_totals.keys.each do |key| %>
        <tr class="total">
          <td colspan="3"><strong><%= key %></strong></td>
          <td class="total"><span><%= number_to_currency @order.price_adjustment_totals[key] %></span></td>
        </tr>
      <% end %>
    </tbody>
  <% end %>
</table>
