<section ng-controller="AttestmentsController" ng-init="find()">
    <div class="page-header">
        <h2>Attestment List</h2>
        Click on a row to edit or delete that item
    </div>

    <!-- Bootstrap Grid System with panels -->
    <div class ="container">
        <div class ="row">
            <div class="col-lg-12">
                <form>
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon"><i class="glyphicon glyphicon-search"></i></div>

                            <input type="text" class="form-control" placeholder="Search Pattern 1" ng-model="Pattern1">
                            <input type="text" class="form-control" placeholder="Search Pattern 2" ng-model="Pattern2">
                        </div>      
                    </div>
                </form>
            </div>
        </div>

        <div class="panel panel-group panel-default">
            <div class="panel-heading">
                <div class ="row">
                    <div class="col-lg-1">.</div>
                    <div class="col-lg-2">
                        <a href="#" ng-click="sortType = 'consumer_ID'; sortReverse = !sortReverse">
                            Consuming ID<br>
                            <span ng-show="sortType == 'consumer_ID' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'consumer_ID' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>                    
                        </a> 
                    </div>            
                    <div class="col-lg-2">
                        Consuming<br>Description
                    </div>
                    <div class="col-lg-2">
                        <a href="#" ng-click="sortType = 'page_ID'; sortReverse = !sortReverse">
                            Page ID<br>
                            <span ng-show="sortType == 'page_ID' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'page_ID' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>                    
                        </a>           
                    </div>            
                    <div class="col-lg-5">
                        Page<br>Description
                    </div>
                </div>

                <div class="panel panel-body">
                    <div ng-repeat="attestment in attestments| orderBy:sortType:sortReverse | filter:Pattern1 | filter:Pattern2" 
                       ui-sref="attestments.view({attestmentId: attestment._id})">                        
                        <div class="row" ng-class-odd="'alt'">
                            <div class="col-lg-1">
                                <div class="handpointer glyphicon glyphicon-chevron-right"
                                     data-ng-click="collapse($event)" data-target="#view_{{attestment.consumer_ID}}"
                                     data-toggle="collapse" aria-expanded="false"
                                     aria-controls="view_{{attestment.consumer_ID}}"
                                     data-ng-if="attestment.items != null">
                                </div>
                            </div>

                            <div class="col-lg-2">
                                {{attestment.consumer_ID}}
                            </div>
                            <div class="col-lg-2">
                                {{attestment.consumer_description}}
                            </div>
                            <div class="col-lg-2">
                                {{attestment.page_ID}}
                            </div>
                            <div class="col-lg-5">
                                {{attestment.page_description}}
                            </div>
                        </div>
                    </div> 
                </div>
            </div>
        </div>
    </div>

    <div class="alert alert-warning text-center" ng-if="attestments.$resolved && attestments.length < 1">               
        No attestments yet, why don't you <a ui-sref="attestments.create">create one</a>?
    </div>

</section>