<div class="dropdown d-grid">
  <button type="button" data-bs-toggle="dropdown" class="btn btn-lg btn-inverse btn-block dropdown-toggle"><i class="fa-solid fa-cart-shopping"></i> {{ text_items }}</button>
  <ul class="dropdown-menu dropdown-menu-end p-2">
    {% if products or vouchers %}
      <li>
        <table class="table table-striped mb-2">
          {% for product in products %}
            <tr>
              <td class="text-center">{% if product.thumb %}<a href="{{ product.href }}"><img src="{{ product.thumb }}" alt="{{ product.name }}" title="{{ product.name }}" class="img-thumbnail"/></a>{% endif %}</td>
              <td class="text-start"><a href="{{ product.href }}">{{ product.name }}</a>
                {% if product.option %}
                  {% for option in product.option %}
                    <br/>
                    <small> - {{ option.name }}: {{ option.value }}</small>
                  {% endfor %}
                {% endif %}
                {% if product.reward %}
                  <br/>
                  <small> - {{ text_points }}: {{ product.reward }}</small>
                {% endif %}
                {% if product.subscription %}
                  <br/>
                  <small> - {{ text_subscription }}: {{ product.subscription }}</small>
                {% endif %}
              </td>
              <td class="text-end">x {{ product.quantity }}</td>
              <td class="text-end">{{ product.total }}</td>
              <td class="text-end">

                <form action="{{ product_remove }}" method="post" data-oc-toggle="ajax" data-oc-load="{{ list }}" data-oc-target="#header-cart">
                  <input type="hidden" name="key" value="{{ product.cart_id }}">
                  <button type="submit" data-bs-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa-solid fa-circle-xmark"></i></button>
                </form>
              </td>
            </tr>
          {% endfor %}

          {% for voucher in vouchers %}
            <tr>
              <td class="text-center"></td>
              <td class="text-start">{{ voucher.description }}</td>
              <td class="text-end">x&nbsp;1</td>
              <td class="text-end">{{ voucher.amount }}</td>
              <td class="text-end">
                <form action="{{ voucher_remove }}" method="post" data-oc-toggle="ajax" data-oc-load="{{ list }}" data-oc-target="#header-cart">
                  <input type="hidden" name="key" value="{{ voucher.key }}"/>
                  <button type="submit" data-bs-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa-solid fa-circle-xmark"></i></button>
                </form>
              </td>
            </tr>
          {% endfor %}

        </table>

        <div>
          <table class="table table-sm table-bordered mb-2">
            {% for total in totals %}
              <tr>
                <td class="text-end"><strong>{{ total.title }}</strong></td>
                <td class="text-end">{{ total.text }}</td>
              </tr>
            {% endfor %}
          </table>
          <p class="text-end"><a href="{{ cart }}"><strong><i class="fa-solid fa-cart-shopping"></i> {{ text_cart }}</strong></a>&nbsp;&nbsp;&nbsp;<a href="{{ checkout }}"><strong><i class="fa-solid fa-share"></i> {{ text_checkout }}</strong></a></p>
        </div>
      </li>
    {% else %}
      <li class="text-center p-4">{{ text_no_results }}</li>
    {% endif %}
  </ul>
</div>
