{{ header }}
<div id="checkout-cart" class="container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  {% if attention %}
  <div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ attention }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}

        {% for key,message in eligibleoffers.success %}
          <div class="alert messagestripsuccess"><i class="fa fa-check-circle"></i> {{ message }}
          <button type="button" class="close" data-dismiss="alert">&times;</button>
        </div>
        {% endfor %}
         {% for key,message in eligibleoffers.warning %}
          <div class="alert messagestripwarning"><i class="fa fa-check-circle"></i> {{ message }}
          <button type="button" class="close" data-dismiss="alert">&times;</button>
          </div>
        {% endfor %}
        
  {% if success %}
  <div class="alert alert-success alert-dismissible alert-ch"><i class="fa fa-check-circle"></i> {{ success }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  {% if error_warning %}
  <div class="alert alert-danger alert-dismissible alert-ch"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
    <button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
  {% endif %}
  <div class="row">{{ column_left }}
    {% if column_left and column_right %}
    {% set class = 'col-sm-6' %}
    {% elseif column_left or column_right %}
    {% set class = 'col-sm-9' %}
    {% else %}
    {% set class = 'col-sm-12' %}
    {% endif %}
    <div id="content" class="{{ class }}">{{ content_top }}
      <h1>{{ heading_title }}
        {% if weight %}
        &nbsp;({{ weight }})
        {% endif %} </h1>
      <form action="{{ action }}" method="post" enctype="multipart/form-data">
        <div class="table-responsive">
          <table class="table table-bordered cart-tbl">
            <thead>
              <tr>
                <td class="text-center">{{ column_image }}</td>
                <td class="text-left">{{ column_name }}</td>
                {# <td class="text-left">{{ column_model }}</td> #}
                <td class="text-left">{{ column_price }}</td>
                <td class="text-left">{{ column_quantity }}</td>
                <td class="text-right">{{ column_total }}</td>
              </tr>
            </thead>
            <tbody>

            {% 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-left"><a href="{{ product.href }}">{{ product.name }}</a> {% if not product.stock %} <span class="text-danger">***</span> {% endif %}
                {% if product.option %}
                {% for option in product.option %} <br />
                <small>{{ option.name }}: {{ option.value }}</small> {% endfor %}
                {% endif %}

                {% if product.recurring %} <br />
                <span class="label label-info">{{ text_recurring_item }}</span> <small>{{ product.recurring }}</small> {% endif %}
                <div class="cart-term">
                  <div class="">
                    <small>{{ text_item_bv }}{{ product.model }}</small>
                  </div>
                  {% if logged %}
                  <div class="cart-term-mid">
                    |
                  </div>
                  <div class="">
                  {% if product.rewardori %}
                  <small>{{ text_item_bv_text }}{{ product.rewardori }}</small>
                  {% endif %}
                  </div>
                  {% endif %}
                </div>
                <div class="coupon-life" style="display:none;">
                  {% for total in totals %}
                  {{ total.title }}: {{ total.text }}
                  {% endfor %}
                </div>
              </td>
              {# <td class="text-left">{{ product.model }}</td> #}
              <td class="text-left">
              {{ product.price }}
              </td>
              <td class="text-left"><div class="input-group btn-block" style="max-width: 200px;">

                  <div class="form-group product-quantity">
                    <label class="control-label" for="input-quantity">{{ entry_qty }}</label>
                    <div class="input-group number-spinner-cart">
                      <span class="input-group-btn">
                           <a class="btn btn-default" data-dir="dwn"><i class="fa fa-minus"></i></a>
                      </span>
                      <!-- <input type="text" name="quantity[{{ product.cart_id }}]" value="{{ product.quantity }}" id="input-quantity" class="form-control text-center input-cat-quantity" data-dir="ctr" /> -->
                      <input type="text" name="quantity[{{ product.cart_id }}]" value="{{ product.quantity }}" size="2" class="form-control" data-dir="ctr" />
                      <span class="input-group-btn">
                           <a class="btn btn-default" data-dir="up"><i class="fa fa-plus"></i></a>
                      </span>
                      <span class="input-group-btn btn-dangerous">
                        <button type="submit" data-toggle="tooltip" title="{{ button_update }}" class="btn btn-primary update-cart-ch" style="display:none;"><i class="fa fa-refresh"></i></button>
                        <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="cart.remove('{{ product.cart_id }}');"><i class="fa fa-trash"></i>
                        </button>
                      </span>
                    </div>
                    <input type="hidden" name="product_id" value="{{ product_id }}" />
                  </div>
                  {# <div class="number-spinner-cart">
                    <span class="input-group-btn">
                    <button type="submit" id="shopping-cart-minus" data-dir="dwn" data-toggle="tooltip" title="{{ button_update }}" class="btn btn-primary">-</button>
                    </span>
                    <input type="text" name="quantity[{{ product.cart_id }}]" value="{{ product.quantity }}" size="1" class="form-control input-cat-quantity" />
                    <span class="input-group-btn">
                    <button type="submit" data-toggle="tooltip" title="{{ button_update }}" onclick="cart.add('{{ product.cart_id }}');" class="btn btn-primary">+</button>

                    <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="cart.remove('{{ product.cart_id }}');"><i class="fa fa-times-circle"></i></button>
                    </span>
                  </div> #}
                  </div></td>

              <td class="text-right cart-price-bv">
                <div class="">
                  {{ product.total }}
                </div>
                {% if logged %}
                <div class="cart-term-mid">
                  |
                </div>
                <div class="">
                  {{ text_item_bv_text }}{{ product.reward_single_product }}
                </div>
                {% endif %}
             </td>
            </tr>
            {% endfor %}
            {% for voucher in vouchers %}
            <tr class="voucher">
              <td></td>
              <td class="text-left">{{ voucher.description }}</td>
              <td class="text-left"></td>
              <td class="text-left"><div class="input-group btn-block" style="max-width: 200px;">
                  <input type="text" name="" value="1" size="1" disabled="disabled" class="form-control" />
                  <span class="input-group-btn">
                  <button type="button" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger" onclick="voucher.remove('{{ voucher.key }}');"><i class="fa fa-times-circle"></i></button>
                  </span></div></td>
              <td class="text-right">{{ voucher.amount }}</td>
              <td class="text-right">{{ voucher.amount }}</td>
            </tr>
            {% endfor %}
              </tbody>

          </table>
        </div>
      </form>
      {% if modules %}
      {# <h2>{{ text_next }}</h2> #}
      {# <p>{{ text_next_choice }}</p> #}
      <div class="panel-group cart-panel" id="accordion"> {% for module in modules %}
        {{ module }}
        {% endfor %} </div>
      {% endif %} <br />
      <div class="row">
        <div class="col-sm-4 col-sm-offset-8">
          <table class="table table-bordered">
            {% for total in totals %}
            <tr>
              <td class="text-right"><strong>{{ total.title }}:</strong></td>
              <td class="text-right">{{ total.text }}</td>
            </tr>
            {% endfor %}
            <tr style="display:none;">
              <td class="text-right"><strong>Total BV:</strong></td>
              <td class="text-right">{{ product.reward_ori}}</td>
            </tr>
          </table>
        </div>
      </div>

      <div class="price-appear hide-function">
        {{ price_appear }}
      </div>



      <div class="buttons clearfix" style="display:flex;">
        <div class="pull-left" style="text-align:center;margin:auto;"><a href="{{ continue }}" class="btn btn-default">{{ button_shopping }}</a></div>
        <div class="pull-right"><a href="{{ checkout }}" class="btn btn-primary">{{ button_checkout }}</a></div>
      </div>
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>

{% if ax_popup %}
<div id="axPopup" class="modal fade" role="dialog">
  <div class="modal-dialog">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">You are eligible to these offers</h4>
      </div>
      <div class="modal-body">
         <div id="product-category">
            <div class="row product-center"> {% for axproduct in ax_products %}
              <div class="product-layout product-list col-xs-12">
                 <div class="promotion-title">
                    {{ axproduct.promotion_title }}
                 </div>
                <div class="product-thumb">
                  <div class="image"><a href="{{ axproduct.href }}"><img src="{{ axproduct.thumb }}" alt="{{ axproduct.name }}" title="{{ axproduct.name }}" class="img-responsive" /></a></div>
                  <div>
                    <div class="caption">
                      <h4><a href="{{ axproduct.href }}">{{ axproduct.name }}</a></h4>
                      <p>{{ axproduct.description }}</p>
                      {% if axproduct.price %}

                      {% if logged %}
                        <p class="price">
                           <span>{{ text_retail }}</span>
                           {{ axproduct.price }}
                        </p>

                        <p class="price">
                          <span>{{ text_retail_bv }}</span> {{ axproduct.reward }}
                        </p>

                      {% else %}
                        <p class="price"><span>{{ text_retail }}</span> {{ axproduct.new_price }}</p>


                      {% endif %}



                      {% endif %}
                      {% if axproduct.rating %}
                      <div class="rating"> {% for i in 1..5 %}
                        {% if axproduct.rating < i %} <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span> {% else %} <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>{% endif %}
                        {% endfor %} </div>
                      {% endif %} </div>



                    <div class="button-group">
                       <input type="hidden" name="product_id" value="{{ product_id }}" />
                      <button type="button" onclick="cart.add_promotion('{{ axproduct.product_id }}', '{{ axproduct.minimum }}');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md hidden-lg">{{ button_cart }}</span></button>
                    </div>
                  </div>
                </div>
              </div>
              {% endfor %} </div>
         </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-success" data-dismiss="modal">{{ offerclose }}</button>
      </div>
    </div>

  </div>
</div>

<script type="text/javascript">
  $(document).ready( function() {
    $('.alert-ch').delay(5000).fadeOut('slow');

    function updateCart(){
    	$('.my-update').trigger();
    }
    //$('#axPopup').modal('show');
  });
</script>
{% endif %}

        {% if offerpopup is defined %}
         {{ offerpopup }}
        {% endif %}
         
{{ footer }}
