{{> partials/menu}}
<div class="col-sm-9">
    <div class="col-sm-12">
        <h2>Products</h2>
    </div>
    <div class="col-sm-12 search_bar">
        <div class="input-group">
            <input type="text" name="product_filter" id="product_filter" class="form-control" placeholder="Filter products">
            <div class="input-group-append">
                <button class="btn btn-outline-success" id="btn_product_filter">Filter</button>
                <a href="/admin/products" class="hidden-xs btn btn-outline-warning"><i class="fa fa-times" aria-hidden="true"></i></a>
            </div>
        </div>
        <p class="text-warning top-pad-10">{{ @root.__ "Products can be filtered by: product title or product description keywords" }}</p>
    </div>
    <div class="col-sm-12">
        <ul class="list-group">
            <li class="list-group-item">
                <span class="float-right"><strong>{{ @root.__ "Published" }}</strong></span>
                {{#ifCond resultType '==' 'filtered'}}
                <strong>{{ @root.__ "Products" }} - <span class="text-danger">{{ @root.__ "Filtered term" }}: {{searchTerm}} </span></strong>
                {{else}}
                <strong>{{ @root.__ "Recent products" }}</strong>
                {{/ifCond}}
            </li>
            {{#each results}}
                <li class="list-group-item">
                    <button class="float-right btn text-danger btn-delete-product" data-id="{{this._id}}"> <i class="far fa-trash-alt"></i></button>
                    <h4 class="float-right"><input id="{{this._id}}" class="published_state" type="checkbox" {{checkedState this.productPublished}}></h4>
                    <div class="top-pad-8"><a href="/admin/product/edit/{{this._id}}">{{this.productTitle}}</a></div>
                </li>
            {{/each}}
        </ul>
    </div>
</div>