<section ng-controller="HostNamesController" ng-init="find()">
    <div class="page-header">
        <h2>List Host Names</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 = 'name'; sortReverse = !sortReverse">
                            <span class="label label-primary">Host Name</span>
                            <span ng-show="sortType == 'name' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'name' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                    <div class="col-lg-2">
                        <a href="#" ng-click="sortType = 'hostType'; sortReverse = !sortReverse">
                            <span class="label label-primary">Host Type</span>
                            <span ng-show="sortType == 'hostType' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'hostType' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                    <div class="col-lg-2">
                        <a href="#" ng-click="sortType = 'envType'; sortReverse = !sortReverse">
                            <span class="label label-primary">Env Type</span>
                            <span ng-show="sortType == 'envType' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'envType' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                    <div class="col-lg-2">
                        <a href="#" ng-click="sortType = 'originatingSource'; sortReverse = !sortReverse">
                            <span class="label label-primary">Originating Source</span>
                            <span ng-show="sortType == 'originatingSource' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'originatingSource' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>

                    <div class="col-lg-1">
                        <a href="#" ng-click="sortType = 'originatingID'; sortReverse = !sortReverse">
                            <span class="label label-primary">Originating ID</span>
                            <span ng-show="sortType == 'originatingID' && !sortReverse" class="glyphicon glyphicon-arrow-down"></span>
                            <span ng-show="sortType == 'originatingID' && sortReverse" class="glyphicon glyphicon-arrow-up"></span>
                        </a>
                    </div>
                </div>
            </div>

            <div class="panel panel-body">
                <div ng-repeat="hostName in hostNames| orderBy:sortType : sortReverse | filter:Pattern1 | filter:Pattern2"
                     ui-sref="hostNames.view({hostNameId: hostName._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_{{hostName.name}}"
                                 data-toggle="collapse" aria-expanded="false"
                                 aria-controls="view_{{hostName.name}}"
                                 data-ng-if="hostName.items != null">
                            </div>
                        </div>

                        <div class="col-lg-2">
                            {{hostName.name}}
                        </div>
                        <div class="col-lg-2">
                            {{hostName.hostType}}
                        </div>
                        <div class="col-lg-2">
                            {{hostName.envType}}
                        </div>
                        <div class="col-lg-2">
                            {{hostName.originatingSource}}
                        </div>
                        <div class="col-lg-1">
                            {{hostName.originatingID}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

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

</section>