<style>
    .listview table {
        white-space: initial !important;
    }
 /*   .col-sm-2 {
         width: initial!important;
       !* padding-left: 0px;*!
    }*/
</style>
<div  style="border-bottom:none;">
    <div class="btn-toolbar">
        <div class="btn-group pull-left">
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuGradeLevelSelect" data-toggle="dropdown"
                        aria-haspopup="true" aria-expanded="false">
                    {{vm.account_grade_level.Name+"级别门店"}}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuGradeLevelSelect">
                    <li ng-repeat="item in vm.account_grade_levelPickList"
                        ng-click="vm.account_grade_level = item;vm.actions.filterRetailList();"><a
                            href="javascript:void(0)">{{item.Name+"级别门店"}}</a></li>
                </ul>
            </div>
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuVisitStatusSelect"
                        data-toggle="dropdown"
                        aria-haspopup="true" aria-expanded="false">
                    {{vm.visitStatus.Name}}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuVisitStatusSelect">
                    <li ng-repeat="item in vm.visitStatusPickList"
                        ng-click="vm.visitStatus = item;vm.actions.isAllowFilter();"><a
                            href="javascript:void(0)">{{item.Name}}</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="listview" style="margin-bottom:10px;margin-top: 20px;">
    <div class="viewlist">
        <div class="row" style="padding-top:15px;border-bottom:1px solid #f0f0f0;margin-left:5px;margin-right:5px;"
             ng-if="vm.visitStatus.Value==5">
            <form class="form-horizontal">
                <div class="form-group">
                    <rt-datetime rt-title="开始时间"
                                 rt-type="date"
                                 rt-col="3"
                                 ng-model="vm.startTime"></rt-datetime>
                    <rt-datetime rt-title="结束时间"
                                 rt-type="date"
                                 rt-col="3"
                                 ng-model="vm.endTime"></rt-datetime>
                    <div class="col-sm-1">
                        <button class="btn btn-primary" ng-click="vm.actions.filterRetailList()">筛选</button>
                    </div>
                </div>
            </form>
        </div>
   <!--     <rt-data-grid rt-page-record-count="vm.recordCount" rt-page-index="vm.pageIndex" rt-page-size="vm.pageSize"
                      rt-get-data="vm.actions.filterRetailList()" id="rt-report-header"
                      rt-rows="vm.data"
                      rt-auto-height="{{tableMaxHeight}}"
                      style="min-height: 150px;padding-bottom: 20px">-->
            <table class="table table-condensed table-hover" style="margin-bottom: 0px;">
                <thead>
                <tr style="background-color: #f8f8f8;">
                    <th style="vertical-align: inherit;width:10%">门店名称</th>
                    <th style="vertical-align: inherit;width:5%">门店分级</th>
                    <th style="vertical-align: inherit;width:15%">本次计划时间</th>
                    <th style="padding-left: 80px;vertical-align: inherit;width:25%">本次拜访目的</th>
                    <th style="padding-left: 80px;vertical-align: inherit;width:25%">协访人</th>
                    <th style="width:10%">上次拜访时间<br/>（点击查看上次拜访详情）</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="row in vm.data track by row.trackById">
                    <td style="vertical-align: inherit;">
                        {{row.name}}
                    </td>
                    <td style="vertical-align: inherit;">
                        {{row.account_grade_levelName}}
                    </td>
                    <td style="vertical-align: inherit ">
                        <rt-datetime-no-label rt-type="datetime"
                                              rt-col="2"
                                              ng-model="row.planTime"></rt-datetime-no-label>
                    </td>
                    <td style="vertical-align: inherit;">
                      <!--  <ui-select class="form" multiple allow-clear sortable="true" theme="bootstrap"
                                   close-on-select="false" ng-model="row.VisitPurpose" style="height: auto;">
                            <ui-select-match>{{$item.Name}}</ui-select-match>
                            <ui-select-choices repeat="item in _visitpurpose|filter:$select.search">
                                <span ng-bind-html="item.Name | highlight: $select.search"></span>
                            </ui-select-choices>
                        </ui-select>-->
                        <rt-lookup2
                                rt-multiple="true"
                                ng-model="row.VisitPurpose"
                                rt-params="{'@code':'retail_visit_purpose'}"
                                rt-get-data-name="VisitPurpose.GetVisitPurpose"
                                rt-col-list="[{Code:'name',Name:'拜访目的'}]"
                                rt-col="10"></rt-lookup2>
                    </td>
                    <td style="vertical-align: inherit;">
                            <rt-lookup2
                                        rt-multiple="true"
                                        rt-disabled="vm.form.data.StateCode.Value == 1"
                                        ng-model="row.assister"
                                        rt-get-data-name="UserInfo.GetAllUser"
                                        rt-order-by="name asc"
                                        rt-col-list="[{Code:'name',Name:'名字'},{Code:'code',Name:'编号'}]"
                                        rt-filtered="false"
                                        rt-col="10"></rt-lookup2>
                       <!-- <ui-select class="form" multiple allow-clear sortable="true" theme="bootstrap"
                                   close-on-select="false" ng-model="row.assister">
                            <ui-select-match>{{$item.Name}}</ui-select-match>
                            <ui-select-choices repeat="item in OwnerList|filter:$select.search">
                                <span ng-bind-html="item.Name | highlight: $select.search"></span>
                            </ui-select-choices>
                        </ui-select>-->
                    </td>
                    <td style="vertical-align: inherit;">
                        <a id="{{row.visit_recordId}}"
                           data-toggle="sidebar"
                           data-target=".sidebar-right"
                           ui-sref=".edit({id:row.visit_recordId})"
                           ui-sref-opts="{location:true}">{{row.end_time| date:'yyyy-MM-dd' }}</a>

                    </td>
                </tr>
                </tbody>
            </table>
            <button class="btn btn-primary" ng-click="vm.actions.savePlan()"
                    style="float: right; margin: 10px;">生成草稿
            </button>
            <!--</rt-data-grid>&lt;!&ndash; rt-data-grid  &ndash;&gt;-->
    </div><!-- div[.panel-default] -->

</div><!-- div[.listview] -->

<ul class="nav nav-tabs" ng-if="vm.isShow">
    <li class="active" ng-click="selectTab('tab1')">
        <a href="#c1" onclick="return false;" data-toggle="tab">计划拜访门店清单</a>
    </li>
    <!--  <li ng-click="selectTab('tab2')">
          <a href="#addressMap" onclick="return false;" data-toggle="tab">拜访计划轨迹</a>
      </li>-->
</ul>
<ion-content>
    <div class="listview" ng-if="vm.isShowTab==1" id="c1">
        <div class="viewlist">
            <table class="table table-condensed table-hover" style="margin-bottom: 0px;">
                <thead>
                <tr style="background-color: #f8f8f8;">
                    <th>门店名称</th>
                    <th>门店分级</th>
                    <th>本次计划时间</th>
                    <th>本次拜访目的</th>
                    <th>协访人</th>
                    <th>上次拜访时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="row in vm.showData">
                    <td>
                        {{row.name}}
                    </td>
                    <td>
                        {{row.account_grade_levelName}}
                    </td>
                    <td>
                        {{row.planTime}}
                    </td>
                    <td>
                            <span ng-repeat="visit in row.VisitPurpose track by visit.Id">
                                {{visit.Name}}&nbsp;&nbsp;
                            </span>
                    </td>
                    <td>
                     <span ng-repeat="ass in row.assister track by ass.Id">
                                {{ass.Name}}&nbsp;&nbsp;
                      </span>
                    </td>
                    <td>
                        {{row.end_time| date:'yyyy-MM-dd' }}
                    </td>
                    <td>
                        <a href="javascript:" ng-show="row.isShow" ng-click="vm.actions.deletePlan(row,$index)">移除</a>
                    </td>
                </tr>

                </tbody>
            </table>

        </div>
    </div>

    <div ng-show=false>
        <button class="btn btn-primary" style=" margin: 10px;" ng-repeat="row in vm.PlanTime">{{row.time}}</button>
    </div>
    <div id="addressMap" class="view"
         style=" margin-top: 50px;width:{{vm.windowWh}}px;height: 600px;overflow: hidden;margin:0;position:absolute;"
         ng-show=false>
    </div>
</ion-content>
<!--</rt-data-grid>-->
<ion-footer-bar class="bar-assertive" ng-show="vm.isShow">
    <div class="buttons" ng-click="send()" style="height:100px">
        <button class="btn btn-primary" style=" float: right; margin: 10px;margin-bottom: 50px;">发送给
            {{vm.managerName}}
        </button>
    </div>
</ion-footer-bar>
<!--
</div>-->
