<div class="row rt-margin-bottom-before-box">
    <div class="col-sm-8">
        <div class="btn-group">
            <button class="btn btn-link" data-toggle="sidebar" data-target=".sidebar-right" ng-if="vm.view.type=='default'" ng-show="vm.privilege.IsCreate"
                ui-sref=".edit({id:''})" ui-sref-opts="{location:true}">
                <i class="fa fa-plus"></i> 新建
            </button>
            <button class="btn btn-link" ng-show="vm.privilege.IsExport" ng-click='vm.actions.export({
                        "CreatedOn":"创建时间",
                        "weeknum":"年度第几周",
                        "buIdName":"事业部",
                        "bigDepIdName":"业务线",
                        "BusinessUnitIdName":"省区",
                        "OwnerIdName":"创建人",
                        "position":"职位",
                        "current_work":"本周计划工作",
                        "finish_work":"本周完成工作",
                        "summary":"本周工作总结",
                        "schedule":"下周工作计划",
                        "coordinate_work":"协调与帮助",
                        "scount":"已评分人数",
                        "remark":"备注"
                        })'>
                <i class="fa fa-download"></i> 导出
            </button>
        </div>
    </div>
    <div class="col-sm-4">
        <form class="input-group">
            <input type="search" placeholder="快速查找已完成工作内容或创建人" class="form-control" ng-model="vm.view.searchText" />
            <span class="input-group-btn" ng-click="vm.view.search(1)">
                <button type="submit" class="btn btn-default">
                    <i class="fa fa-search"></i>
                </button>
            </span>
        </form>
    </div>
</div>

<div class="box box-primary">
    <div class="box-header with-border" style="cursor: move;">
        <div class="pull-left">
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuViewSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {{vm.view.selectedView.ViewName}}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuViewSelect">
                    <li ng-repeat="view in vm.view.list track by view.Id" ng-click="vm.view.select(view)">
                        <a href="javascript:void(0)">{{view.ViewName}}</a>
                    </li>
                </ul>

            </div>
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuBuSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {{vm.buidSelected==null?"所有事业部":vm.buidSelected.name}}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuBuSelect">
                    <li ng-click="vm.buidSelected = null;">
                        <a href="javascript:void(0)">所有事业部</a>
                    </li>
                    <li ng-repeat="item in vm.buidList" ng-click="vm.buidSelected = item;vm.bigDepSelected = null;">
                        <a href="javascript:void(0)">{{item.name}}</a>
                    </li>
                </ul>
            </div>
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuBigDepartSelect" data-toggle="dropdown" aria-haspopup="true"
                    aria-expanded="false">
                    {{vm.bigDepSelected==null?"所有业务线/大区":vm.bigDepSelected.name}}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuBigDepartSelect">
                    <li ng-click="vm.bigDepSelected = null;">
                        <a href="javascript:void(0)">所有业务线/大区</a>
                    </li>
                    <li ng-repeat="item in vm.bigDepList" ng-click="vm.bigDepSelected = item;">
                        <a href="javascript:void(0)">{{item.name}}</a>
                    </li>
                </ul>
            </div>
            <button class="btn btn-default" ng-class="{true:'active',false:'inactive'}[vm.view.isShowSearchList]" ng-click="vm.view.isShowSearchList = !vm.view.isShowSearchList;overHeightTable();">
                <i class="fa fa-filter"></i> 更多筛选
                <i class="fa fa-angle-double-down"></i>
            </button>
        </div>
    </div>
    <div ng-show="vm.view.isShowSearchList" class="box box-widget">
        <!-- form start -->
        <form class="form-horizontal">
            <div class="box-body">
                <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="btn-group" class="col-sm-2">
                        <button class="btn btn-primary" ng-click="vm.view.search(1)">查询</button>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">省区/地区</label>
                    <div class="col-sm-8">
                        <ui-select class="form" multiple allow-clear sortable="true" theme="bootstrap" close-on-select="false" ng-model="vm.businessUnitSelected">
                            <ui-select-match>{{$item.name}}</ui-select-match>
                            <ui-select-choices repeat="item in vm.businessUnitList | filter: {name: $select.search}">
                                <span ng-bind-html="item.name | highlight: $select.search"></span>
                            </ui-select-choices>
                        </ui-select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="nav-tabs-custom">
        <div class="tab-content">
            <rt-data-grid rt-page-record-count="vm.page.recordCount" rt-page-index="vm.page.index" rt-page-size="vm.page.size" rt-get-data="vm.view.search()"
                rt-sort-field="vm.view.sortField" rt-rows="vm.data" rt-selected-ids="vm.view.selectedIds" rt-auto-height="vm.view.autoHeight">
                <table class="table table-condensed table-hover">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>查看</th>
                            <th>创建时间</th>
                            <th>年度第几周</th>
                            <th>事业部</th>
                            <th>业务线</th>
                            <th>省区</th>
                            <th>创建人</th>
                            <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.data track by row.Id">
                            <td>{{ $index+1 }}</td>
                            <td ng-if="vm.view.type=='default'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit({id:row.Id})" ui-sref-opts="{location:true}">查看</a>
                            </td>
                            <td ng-if="vm.view.type=='grid'">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id)">查看</a>
                            </td>
                            <td style="white-space:nowrap;">
                                {{row.CreatedOn| date:'yyyy-MM-dd'}}
                            </td>
                            <td style="text-align:center;">{{row.weeknum}}</td>
                            <td>{{row.buIdName}}</td>
                            <td> {{row.bigDepIdName}}</td>
                            <td style="white-space: nowrap;">
                                {{row.BusinessUnitId.Name}}
                            </td>
                            <td style="white-space: nowrap;">
                                {{row.OwnerId.Name}}
                            </td>
                            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
                                {{row.position}}
                            </td>
                            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
                                {{row.current_work}}
                            </td>
                            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
                                {{row.finish_work}}
                            </td>
                            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
                                {{row.summary}}
                            </td>
                            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
                                {{row.schedule}}
                            </td>
                            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
                                {{row.coordinate_work}}
                            </td>
                            <td>
                                {{row.scount}}
                            </td>
                            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
                                {{row.remark}}
                            </td>
                        </tr>
                    </tbody>
                </table>
            </rt-data-grid>
        </div>
    </div>
</div>

<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>