<ion-view hide-nav-bar="searching" view-direction="none">
	<ion-nav-title>
		<h1 class="title">联系人</h1>
	</ion-nav-title>
	<ion-nav-buttons side="left">
		<i class="button button-icon icon ion-ios-reloading" ng-show="loading"></i>
	</ion-nav-buttons>

	<linker-nav class="has-header has-footer"
		scrollview-name="linkerListScrollView"
		item-config="itemConfig"
		letter-begin-position="190"
		item-height="53.03"></linker-nav>
	<linker-nav-info></linker-nav-info>
<ion-content class="has-footer" scroll="true" on-scroll="onScroll()" delegate-handle="linkerListScrollView" scrollbar-y="false" has-bouncing="false">
	<ion-refresher on-refresh="onRefresh()"></ion-refresher>
		<div class="search-page" ng-class="{searching:searching}" on-end="onEndEvent">
			<div class="bar item-input-inset">
				<div class="item-input-wrapper">
					<i class="icon ion-ios-search placeholder-icon"></i>
					<div class="search-input-btn" ng-click="openSearch()">从全部联系人中搜索...</div>
				</div>
			</div>

			<div class="list" ng-class="{searchopen: searchopen}">
				<a sino-nav-direction="forward" class="item item-icon-left"
				 ng-click="goSelfDept()">
					<i class="icon ion-person-stalker"></i>本部门联系人
				</a>
				<a sino-nav-direction="forward" class="item item-icon-left"
				 ng-click="goAllDept()">
					<i class="icon ion-ios-people"></i>所有联系人
				</a>
				<div class="item item-divider">常用联系人</div>
				<div>
          <div ng-if="favoriteLinkerLoading != 2" style="margin-top: 16px;">
            <span  ng-show="favoriteLinkerLoading === 1" class="linker-import linker-import-first">联系人正在加载中...
            </span>
            <span  ng-show="favoriteLinkerLoading === 3 " class="linker-import linker-import-first">联系人加载失败，请下滑刷新
            </span>
          </div>
					<div
            class="item item-icon-left sino-user-item"
            ng-repeat="linker in favoriteLinker.items track by linker.userId"
            view-linker-detail="{{linker.userId}}"
            view-linker-detail-user="linker">
            <sino-person-photo user-id="{{linker.userId}}" size="32x32"></sino-person-photo>
						{{linker.userName}}
					</div>
					<span class="item item-icon-left linkerNum" ng-if="favoriteLinker.favoriteNum">
						{{favoriteLinker.favoriteNum}}位联系人
					</span>

					<div ng-if="favoriteLinker.favoriteNum == 0 && inited && favoriteLinkerLoading === 2"><br>
						<span class="linker-import linker-import-first">当前没有常用联系人
						</span>
						<span class="linker-import">您可以通过以下方式导入常用联系人</span>
						<button class="button button-block button-positive" ng-click="favoritedSameDept()">
							导入本部门
						</button>
					</div>
				</div>
			</div>
		</div>
	</ion-content>
	<div mission-tabs></div>

	<div class="sino-search-modal" ng-show="searchopen" ng-class="{open: searchopen}">
		<div class="bar item-input-inset">
			<label class="item-input-wrapper">
				<i class="icon ion-ios-search placeholder-icon"></i>
				<input type="search" placeholder="从全部联系人中搜索..." ng-model="search.text">
			</label>
			<button class="button button-clear cancel" ng-click="closeSearch()">
				取消
			</button>
		</div>

		<ion-content class="card has-search-header" ng-show="search.text !== ''" scroll="true" on-touch="closeKeyBoard()" delegate-handle="searchLinkerScroll" ng-click="closeSearch()">
		<ul class="list" ng-show="searchItems.length > 0">
			<li
        class="item"
        ng-class="{'item-checkbox': canCheck}"
        ng-repeat="item in searchItems track by item.userId | orderBy:'orderNo'"
        view-linker-detail="{{item.userId}}"
        view-linker-detail-user="item">
				{{item.userName}} {{item.fullDeptName}}
			</li>
		</ul>
    <div >
      <span class="search-none" ng-show="search_loading === 1">搜索中...</span>
      <span class="search-none" ng-show="search_loading === 3">可供查询的单词太少，请继续输入...</span>
      <span class="search-none" ng-show="searchItems.length === 0 && search.text !== '' && search_loading === 2">无结果</span>
      <span class="search-none" ng-show="search_loading === 4">搜索失败，请重新搜索</span>
    </div>
		</ion-content>
	</div>
</ion-view>
