<section ng-controller="InfrastructureRequestsController" ng-init="find()">
    <div class="page-header">
        <h2>Infrastructure Request 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-2">
                        <a href="#" ng-click="sortType = ['requestSource', 'requestID'] | uppercase; sortReverse = !sortReverse">
                            <b>Request Source</b>
                            <span ng-show="!(sortType.indexOf('requestSource')) && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="!(sortType.indexOf('requestSource')) && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                    <div class="col-lg-2">
                        <a href="#" ng-click="sortType = ['requestID'] | uppercase; sortReverse = !sortReverse">
                            <b>Request ID</b>
                            <span ng-show="(sortType.indexOf('requestSource')) && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="(sortType.indexOf('requestSource')) && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                    <div class="col-lg-2">
                        <b>Request Notes</b>
                    </div>
                    <div class="col-lg-2 text-center">
                        <b># Hosting Requests</b>
                    </div>
                    <div class="col-lg-2 text-center">
                        <b># Other Requests</b>
                    </div>
                </div>
            </div>
        </div>

        <div class="panel panel-body">            
            <div ng-repeat="infrastructureRequest in infrastructureRequests| orderBy:sortType:sortReverse | filter:Pattern1 | filter:Pattern2"
                 ui-sref="infrastructureRequests.view({infrastructureRequestId: infrastructureRequest._id})">
                <div class="row" ng-class-odd="'alt'">
                    <div class="col-lg-2">
                        {{infrastructureRequest.requestSource| uppercase}}
                    </div>
                    <div class="col-lg-2">
                        {{infrastructureRequest.requestID| uppercase}}
                    </div>
                    <div class="col-lg-2">
                        {{infrastructureRequest.note| uppercase}}
                    </div>                    
                    <div class="col-lg-2 text-center">
                        {{infrastructureRequest.hostings.length}}
                    </div>
                    <div class="col-lg-2 text-center">
                        {{infrastructureRequest.otherRequests.length}}
                    </div>
                </div>
            </div>
        </div>

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