<div class="col-md-12" ng-controller="ClientController">
    <ul class="breadcrumb">
        <li class="active">{{'label.anchor.clients' | translate}}</li>
    </ul>
    <api-validate></api-validate>

    <a href="#/createclient" class="btn btn-primary pull-right" has-permission='CREATE_CLIENT'><i class="icon-plus icon-white"></i>{{'label.button.createclient' | translate}}</a>
    <div class="clearfix"></div>
    <form ng-submit="search()" class="form-horizontal">
        <div class="form-group">
            <div class="col-md-4">
                <input ng-autofocus="true" ng-model="filterText" ng-keyup="onFilter()" type="text" class="form-control" placeholder="{{'label.input.filterbynameaccno' | translate}}">
            </div>
            <div class="col-lg-6 col-md-4">
                <div class="input-group">
                    <input  data-ng-model="searchText" type="text" placeholder="{{'label.input.searchByNameAccNo' | translate}}" class="form-control"/>
                    <span class="input-group-btn">
                        <button class="btn btn-primary form-control">
                            <span class="icon-search"></span>
                        </button>
                    </span>
                </div>
            </div>
        </div>
    </form>

    <table class="table">
        <thead>
        <tr class="graybg">
            <th>{{'label.heading.name' | translate}}</th>
            <th>{{'label.heading.clientno' | translate}}</th>
            <th>{{'label.heading.clientexternalid' | translate}}</th>
            <th>{{'label.heading.status' | translate}}</th>
            <th>{{'label.heading.office' | translate}}</th>
            <th>{{'label.heading.staff' | translate}}</th>
        </tr>
        </thead>

        <tbody>
        <tr class="pointer-main" dir-paginate="client in clients | orderBy:'displayName':reverse  | filter:filterText | itemsPerPage: clientsPerPage" total-items="totalClients">
            <td class="pointer" data-ng-click="routeTo(client.id)">{{client.displayName}}</td>
            <td class="pointer" data-ng-click="routeTo(client.id)">{{client.accountNo}}</td>
            <td class="pointer" data-ng-click="routeTo(client.id)">{{client.externalId}}</td>
            <td class="pointer" data-ng-click="routeTo(client.id)">
                <i class="icon-stop {{client.status.code | StatusLookup}}"></i>&nbsp;{{client.status.value}}
                <small ng-if="client.subStatus.description">[{{client.subStatus.description}}]</small>
            </td>
            <td class="pointer" data-ng-click="routeTo(client.id)">{{client.officeName}}</td>
            <td class="pointer" data-ng-click="routeTo(client.id)">{{client.staffName}}</td>
        </tr>
        </tbody>

    </table>
    <dir-pagination-controls boundary-links="true" template-url="bower_components/angular-utils-pagination/dirPagination.tpl.html" on-page-change="getResultsPage(newPageNumber)"></dir-pagination-controls>
</div>