<style>
    .listview table{
         white-space: initial !important;
    }
</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;" >
            <form class="form-horizontal">
                <div class="form-group">
                   <rt-lookup2 
                        rt-title="医院"
                        ng-model="vm.accountId"
                        rt-get-data-name="Account.GetHospital"
                        rt-order-by="accountnumber"
                        rt-col-list="[{Code:'name',Name:'客户名称'},{Code:'accountnumber',Name:'客户编码'}]"
                        rt-filtered="true"
                        rt-col="3"></rt-lookup2>
                    <div class="col-sm-1">
                        <button class="btn btn-primary" ng-click="vm.actions.filterRetailList()">查询</button>
                    </div>
                </div>
                <div class="form-group">
                    <rt-lookup2
                        rt-title="医生"
                        ng-model="vm.contactId"
                        rt-get-data-name="Contact.GetHospitalContact"
                        rt-order-by="name asc"
                        rt-params="{'@accountid':vm.accountId ? vm.accountId.Id :''}"
                        rt-col-list="[{Code:'name',Name:'名字'},{Code:'code',Name:'编号'}]"
                        rt-filtered="true"
                        rt-col="3"></rt-lookup2>
                    <rt-lookup2
                        rt-title="代表"
                        ng-model="vm.visiterId"
                        rt-get-data-name="UserInfo.GetAllUser"
                        rt-order-by="name asc"
                        rt-col-list="[{Code:'name',Name:'名字'},{Code:'code',Name:'编号'}]"
                        rt-filtered="true"
                        rt-col="3"></rt-lookup2>   
                </div>
                <div class="form-group" ng-if="vm.visitStatus.Value==5">
                    <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>
            </form>
        </div>
        <table class="table table-condensed table-hover" style="margin-bottom: 0px;">
            <thead>
                <tr style="background-color: #f8f8f8;">
                    <th style="vertical-align: inherit;width:15%;">医院</th>
                    <th style="vertical-align: inherit;width:5%;">科室</th>
                    <th style="vertical-align: inherit;width:5%;">医生</th>
                    <th style="vertical-align: inherit;width:15%;">本次计划时间</th>
                    <th style="vertical-align: inherit;padding-left: 20px;width:25%;">本次拜访目的</th>
                    <th style="vertical-align: inherit;padding-left: 20px;width:25%;">销售代表</th>
                    <th>上次拜访时间<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.departmentidName}}
                    </td>
                    <td style="vertical-align: inherit;">
                        {{row.doctor}}
                    </td>
                    <td style="vertical-align: inherit; ">
                        <rt-datetime-no-label rt-type="datetime" rt-col="4" ng-model="row.planTime"></rt-datetime-no-label>
                    </td>
                    <td  style="vertical-align: inherit; " >
                        <rt-lookup2-no-label
                                rt-multiple="true"
                                ng-model="row.VisitPurpose"
                                rt-params="{'@code':'hospital_visit_purpose'}"
                                rt-get-data-name="VisitPurpose.GetVisitPurpose"
                                rt-col-list="[{Code:'name',Name:'拜访目的'}]"
                                rt-col="10"></rt-lookup2-no-label>
                        <!--<ui-select class="form" multiple allow-clear sortable="true" theme="bootstrap" close-on-select="false" ng-model="row.VisitPurpose">
                            <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>-->
                    </td>
                    <td style=" vertical-align: inherit;" >
                        <rt-lookup2-no-label
                                ng-model="row.visiter"
                                rt-get-data-name="UserInfo.GetAllUser"
                                rt-order-by="name asc"
                                rt-col-list="[{Code:'name',Name:'名字'},{Code:'code',Name:'编号'}]"
                                rt-filtered="true"
                                rt-col="10"></rt-lookup2-no-label>
                         <!--<ui-select allow-clear ng-model="row.visiter" sortable="true"  theme="bootstrap">
                            <ui-select-match >{{ $select.selected.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>
        <!--</rt-data-grid>&lt;!&ndash; rt-data-grid  &ndash;&gt;-->
    </div>
    <!-- div[.panel-default] -->
</div>
<!-- div[.listview] -->

<button class="btn btn-primary" ng-click="vm.actions.savePlan()" style=" margin: 10px;">生成拜访计划</button>

<div class="sidebar sidebar-right sidebar-animate rt-shadow-border-left content-wrapper" ng-if="vm.view.type=='default'">
    <div ui-view class="content"></div>
</div>

<div class="listview" ng-show="vm.isShow">
    <div class="row">
        <div class="col-sm-13">
            <div>
                <label class="col-sm-3 control-label" style="padding-top: 5px;">已安排拜访的医院：</label>
            </div>
            <!-- div[.btn-group] -->
        </div>
        <!-- div[.col-sm-12]-->
    </div>
    <!-- div[.row]-->

    <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>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="row in vm.showData">
                    <td>
                        {{row.name}}
                    </td>
                    <td>
                        {{row.departmentidName}}
                    </td>
                    <td>
                        {{row.doctor}}
                    </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>{{row.visiter.Name}}</span>
                    </td>
                    <td>
                        {{row.end_time| date:'yyyy-MM-dd' }}
                    </td>
                    <td>
                        <a href="javascript:;" ng-click="vm.actions.deletePlan(row,$index)">删除</a>
                    </td>
                </tr>
            </tbody>
        </table>
        <!--</rt-data-grid>&lt;!&ndash; rt-data-grid  &ndash;&gt;-->
    </div>
    <!-- div[.panel-default] -->
</div>
<!-- div[.listview] -->