<ion-view title="客户" class="crm-client crm-bg" hide-nav-bar="true">
  
  <!-- <ion-nav-bar class="bar-crm">
    <ion-nav-back-button default-nav-back-button ng-click="goBack()">{{ backTitle() }}</ion-nav-back-button>
  </ion-nav-bar>

  <ion-nav-buttons side="right">
    <button class="button button-clear header-item button-icon ion-ios-plus-empty" ui-sref="crm.addClient">
    </button>
  </ion-nav-buttons> -->
  
  <ion-header-bar search-tab-bar="tabs" search-modal="search" on-tab="onTab($tab)" no-tap-scroll="true">
  </ion-header-bar>

  <crm-filter filter-groups="filterGroups" on-select="selectFilterItem"></crm-filter>
  
  <ion-content class="crm-filter-header">
    <ion-refresher on-refresh="clientList.reload()"></ion-refresher>

    <!--客户列表-->
    <div class="list">
      <div class="item item-complex item-text-wrap crm-common-item"
        ng-repeat="client in clientList.list"
        ng-include="'templates/crm/client-item.html'"
        ui-sref="crm.clientView(client)">
      </div>
  
      <div ng-if="clientList.hasMore">
        <button class="button button-clear button-positive button-block no-animation" ng-click="clientList.load()" ng-disabled="clientList.loading">
          {{ clientList.loading ? '加载中...' : '加载更多' }}
        </button>
      </div>

      <div class="margin-top margin-bottom padding text-center coyness" ng-if="!clientList.hasMore && clientList.list.length">没有更多了...</div>
    </div>
    
    <crm-empty-tip ng-if="!clientList.list.length && !clientList.loading"></crm-empty-tip>
  </ion-content>

  <div class="fixed-toolbar">
    <button class="fixed-toolbar-btn button button-positive" ui-sref="crm.addClient">
      <i class="ion-ios-plus-empty"></i>
    </button>
  </div>
</ion-view>