<div class="content-header">
    <div class="row">
        <div class="col-md-8">
            <h2>{{::vm.translate.get('Woo Products')}}</h2>
        </div>
        <div class="col-md-4 text-right">
            
        </div>
    </div>
</div>

<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card" st-pipe="vm.getProducts" st-table="vm.products">
                    <div class="card-header">
                        <h3 class="card-title">{{::vm.translate.get('Woo Products')}}</h3>
                        <div class="card-tools">
                        </div>
                    </div>
                    <div class="card-body p-0 table-responsive">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>{{::vm.translate.get('Thumbnail')}}</th>
                                    <th st-sort="Id" class="sortable">{{::vm.translate.get('Id')}}</th>
                                    <th st-sort="Name" class="sortable">{{::vm.translate.get('Name')}}</th>
                                    <th st-sort="Name" class="sortable">{{::vm.translate.get('Sku')}}</th>
                                    <th class="text-center">{{::vm.translate.get('Is Featured')}}</th>
                                    <th st-sort="IsPublished" class="text-center sortable">{{::vm.translate.get('Is Published')}}</th>
                                    <th st-sort="CreatedOn" class="text-center sortable">{{::vm.translate.get('Created On')}}</th>
                                    <th class="text-center">{{::vm.translate.get('Actions')}}</th>
                                </tr>
                                <tr>
                                    <th></th>
                                    <th></th>
                                    <th>
                                        <div class="form-group">
                                            <input class="form-control" st-search="Name" />
                                        </div>
                                    </th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody ng-show="!vm.isLoading">
                                <tr ng-repeat="product in vm.products">
                                    <td>
                                        <img ng-src="{{product.thumbnailUrl}}" class="img" style="max-height: 80px"/>
                                    </td>
                                    <td>{{product.id}}</td>
                                    <td>{{product.name}}</td>
                                    <td>{{product.sku}}</td>
                                    <td class="text-center"><i ng-attr-class="{{product.isFeatured && 'fa fa-circle' || 'fa fa-circle-o'}}"></i></td>
                                    <td class="text-center"><i ng-attr-class="{{product.isPublished && 'fa fa-circle' || 'fa fa-circle-o'}}"></i></td>
                                    <td class="text-center">{{product.createdOn | date:'medium'}}</td>
                                    <td class="text-center">
                                        <!--<a ui-sref="product-edit({id: product.id})" title="Edit" class="btn btn-primary btn-xs"> <i class="fa fa-pen"></i></a>-->
                                        <button class="btn btn-success" ng-click="vm.save(product)" title="Save"><span class="fa fa-save"></span></button>
                                    </td>
                                </tr>
                            </tbody>
                            <tbody ng-show="vm.isLoading">
                                <tr>
                                    <td colspan="8" class="text-center">Loading ... </td>
                                </tr>
                            </tbody>
                            <!--<tfoot>
                                <tr>
                                    <td class="text-center" st-pagination="" st-items-by-page="50" st-displayed-pages="10" colspan="8"></td>
                                </tr>
                            </tfoot>-->
                        </table>
                    </div>
                    <div class="card-footer">
                        <div class="row">
                            <div class="col" ng-show="!vm.isLoading" colspan="3">{{vm.tableStateRef.pagination.totalItemCount | number:0}} {{::vm.translate.get('records found')}}</div>
                            <div class="col Page navigation" st-pagination="" st-items-by-page="10" st-displayed-pages="10"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>