{% extends "checkout/partials/totals_block.html" %}
{% load i18n currency_filters delivery_time %}

{% block panel_body %}
{% with basket=order %}
<div id="checkouttotal">
    {% delivery_time basket as deliverytime %}
    {% if deliverytime %}
    <div id="basket_totals" class="w-100">
        <div class="delivery_time">
            <i class="fa fa-info-circle"></i>
            <div class="time_wrapper">
            {{ deliverytime|safe }}
            </div>
        </div>
    </div>
    {% endif %}
    <div class="nav-item product-line">
        {% include "oscar/basket/partials/basket_totals.html" %}
    </div>
</div>
{% endwith %}
{% endblock %}

{% block discount_totals %}
    {% if order.basket_discounts %}
        {% for discount in order.basket_discounts %}
            <tr>
                <td>
                    {{ discount.offer_name }}
                </td>
                <td class="text-right">
                - {{ discount.amount|currency:order.currency }}
                </td>
            </tr>
        {% endfor %}
    {% endif %}
{% endblock %}

{% block basket_total %}
{% endblock %}

{% block shipping_totals %}
    <tr>
        <td class="total">
            {{ order.shipping_method }}
        </td>
        <td class="total text-right">
            {% if not show_tax_separately %}
                {{ order.shipping_incl_tax|currency:order.currency }}
            {% else %}
                {{ order.shipping_excl_tax|currency:order.currency }}
            {% endif %}
        </td>
    </tr>
    {% if surcharges %}
      {% for charge in surcharges %}
          <tr>
              <td class="total">{{charge.name}}</td>
              <td class="total text-right">
                  {% if not show_tax_separately %}
                      {{ charge.incl_tax|currency:order.currency }}
                  {% else %}
                      {{ charge.excl_tax|currency:order.currency }}
                  {% endif %}
              </td>
          </tr>
      {% endfor %}
    {% endif %}
{% endblock %}

{% block tax_totals %}
    {% if show_tax_separately %}
        <tr>
            <th colspan="2">
                <h6>{% trans "Tax" %}</h6>
            </th>
        </tr>
        <tr>
            <th class="total">{% trans "Basket" %}</th>
            <th class="total text-right">
                {{ order.total_tax|currency:order.currency }}
            </th>
        </tr>
        <tr>
            <th class="total">{% trans "Shipping" %}</th>
            <th class="total text-right">
                {{ order.shipping_tax|currency:order.currency }}
            </th>
        </tr>
    {% endif %}
{% endblock %}

{% block basketline %}
  {% with warning=False %}
  {{ block.super }}
  {% endwith %}
{% endblock %}

{% block order_total %}
<tr class="border-top">
  <th class="total">
      <b>
          {% trans 'Total incl. tax' %}
      </b>
  </th>
  <td class="total incl-tax text-right">
        <b>{{ order.total_incl_tax|currency:order.currency }}</b>
  </td>
</tr>
<tr>
  <th class="total">
      <b>
          {% trans 'Total excl. tax' %}
      </b>
  </th>
  <td class="total text-right">
        {{ order.total_excl_tax|currency:order.currency }}
  </td>
</tr>
{% endblock %}