<div class="row">
    <div class="col-xs-12 col s12">
        {{#if pageCloseBtn}}
        <div class="row {{checkout}}">
            <div class="col-lg-12 col l12 text-right">
                <button class="pushy-link btn btn-primary" type="button">X</button>
            </div>
        </div>
        {{/if}}
        <div class="panel panel-default" style="margin-top: 30px;">
            <div class="panel-heading">Cart contents</div>
            <div class="panel-body cart-body">
                <div class="container-fluid">
                    {{#each session.cart}}
                    <div class="row cart-row">
                        <div class="col-xs-4 col-md-2 col s4 m2">
                            {{#if productImage}}
                            <img class="img-responsive" src="{{this.productImage}}" alt="{{this.title}} product image"> {{else}}
                            <img class="img-responsive" src="/uploads/placeholder.png" alt="{{this.title}} product image"> {{/if}}
                        </div>
                        <div class="cart-item-row text-left col-xs-12 col-md-7 col s12 m7">
                            <p>
                                <a class="cart-link" href="/product/{{this.link}}">{{this.title}}</a>
                            </p>
                            <p>
                                &nbsp;
                                {{#each this.options}} 
                                    {{#if @last}} 
                                        {{@key}}: {{this}} 
                                        {{else}} 
                                        {{@key}}: {{this}} / 
                                    {{/if}} 
                                {{/each}}
                            </p>
                            <p>
                                <div class="form-group">
                                    <div class="col-lg-5 col l5 no-pad-left">
                                        <div class="input-group">
                                            <span class="input-group-btn">
                                                <button class="btn btn-sm btn-primary btn-qty-minus" type="button">-</button>
                                            </span>
                                            <input type="number" class="form-control cart-product-quantity input-sm text-center" data-id="{{this.productId}}" id="{{@key}}"
                                                maxlength="2" value="{{this.quantity}}">
                                            <span class="input-group-btn">
                                                <button class="btn btn-sm btn-primary btn-qty-add" type="button">+</button>
                                            </span>
                                        </div>
                                    </div>
                                    <span class="pull-right">
                                        <button class="btn btn-sm btn-danger btn-delete-from-cart" data-id="{{this.productId}}" type="button"><i class="fa fa-trash" data-id="{{this.productId}}" aria-hidden="true"></i></button>
                                    </span>
                                </div>
                            </p>
                        </div>
                        <div class="col-xs-12 col-lg-4 col s12 l4 cart-item-row text-right no-pad-right">
                            <strong>{{currencySymbol ../config.currencySymbol}}{{formatAmount this.totalItemPrice}}</strong>
                        </div>
                    </div>
                    {{/each}}
                </div>
                <div class="container-fluid">
                    {{#if session.cart}}
                    <div class="row">
                        <div class="cart-contents-shipping col-md-12 col m12 no-pad-right">
                            {{#ifCond session.shippingCostApplied '===' true}}
                            <div class="text-right">
                                Shipping:
                                <strong>{{currencySymbol config.currencySymbol}}{{formatAmount config.flatShipping}}</strong>
                            </div>
                            {{else}}
                            <div class="text-right">
                                Shipping:
                                <strong>FREE</strong>
                            </div>
                            {{/ifCond}}
                            <div class="text-right">
                                Total:
                                <strong>{{currencySymbol config.currencySymbol}}{{formatAmount session.totalCartAmount}}</strong>
                            </div>
                        </div>
                    </div>
                    {{else}}
                    <div class="row">
                        <div class="cart-contents-shipping col-md-12 no-pad-right">
                            Cart empty
                        </div>
                    </div>
                    {{/if}}
                </div>
            </div>
        </div>
        <div class="row">
            {{#if session.cart}}
            <div class="col-xs-6 col s6 text-left align-right">
                <button class="btn btn-danger" id="empty-cart" type="button">Empty cart</button>
            </div>
            {{#ifCond page '!=' 'pay'}}
            <div class="text-right align-right col-xs-6 col s6">
                {{#ifCond page '==' 'checkout'}}
                <a href="/pay" class="btn btn-default">Pay now</a>
                {{else}}
                <a href="/checkout" class="btn btn-default">Checkout</a>
                {{/ifCond}}
            </div>
            {{/ifCond}} {{/if}}
        </div>
    </div>
</div>