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

    <div class ="container">
        <div class ="row">
            <div class="col-sm-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>

        <!-- Bootstrap Grid System -->
        <div class="panel panel-group panel-default">
            <div class="panel-heading">
                <div class ="row">
                    <div class="col-sm-2">
                        <a href="#" ng-click="sortType = 'originating_system_name'; sortReverse = !sortReverse">
                            Originating Source Name<br>
                            <span ng-show="sortType == 'originating_system_name' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'originating_system_name' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                    <div class="col-sm-2">
                        <a href="#" ng-click="sortType = 'originating_system_id'; sortReverse = !sortReverse">
                            Originating Source ID<br>
                            <span ng-show="sortType == 'originating_system_id' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'originating_system_id' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                    <div class="col-sm-8">
                        <b>Attestation<br>Statement</b>
                    </div>
                </div>
            </div>
            <div class="panel panel-body">
                <div ng-repeat="attestation in attestations| orderBy:sortType:sortReverse | filter:Pattern1 | filter:Pattern2"
                   ui-sref="attestations.view({attestationId: attestation._id})">
                    <div class="row" ng-class-odd="'alt'">
                        <div class="col-sm-2">
                            <span ng-bind="attestation.originating_system_name"></span>
                        </div>
                        <div class="col-sm-2">
                            <span ng-bind="attestation.originating_system_id"></span>
                        </div>
                        <div class="col-sm-8">
                            <span ng-bind="attestation.statement"></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

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

</section>