<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-if="vm.view.type=='grid'" ng-click="vm.actions.showForm('')" ng-show="vm.privilege.IsCreate">
				<i class="fa fa-plus"></i> 新建
			</button>
			<button class="btn btn-link" ng-click="vm.actions.del()" ng-show="vm.privilege.IsDelete">
				<i class="fa fa-trash"></i> 删除
			</button>
			<button class="btn btn-link" ng-show="vm.privilege.IsExport" ng-click='vm.actions.export({
					"name":"活动名称",
					"OwnerIdName":"负责人",
					"BusinessUnitIdName":"部门",
					"campaign_typeName":"活动类型",
					"starttime":"活动开始时间",
					"endtime":"活动截止时间",
					"action_statusName":"活动状态",
					"budget":"预算金额",
					"actual_expense":"实际费用",
					"plan_attendance":"期望出席人数",
					"actual_attendance":"实际出席人数",
					"purpose":"活动目的",
					"CreatedOn":"创建时间",
                        },vm.exportExcelId ,vm.attactingSelected.name)'>
				<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="dropdownMenuBuSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					{{vm.attactingSelected.name}}
					<span class="caret"></span>
				</button>
				<ul class="dropdown-menu" aria-labelledby="dropdownMenuBuSelect">
					<li ng-repeat="item in vm.attactingFilter" ng-click="vm.attactingSelected = item;vm.view.search(1);">
						<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.statusSelected.Name}}
					<span class="caret"></span>
				</button>
				<ul class="dropdown-menu" aria-labelledby="dropdownMenuBigDepartSelect">
					<li ng-repeat="item in vm.statusFilter" ng-click="vm.statusSelected = item;vm.view.search(1);"><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 ng-model="vm.timeSelected.sYm" rt-type="date" rt-title="开始时间" rt-required="false" rt-col="3"></rt-datetime>
					<rt-datetime ng-model="vm.timeSelected.eYm" rt-type="date" rt-title="结束时间" rt-required="false" rt-col="3"></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">
					<rt-datetime ng-model="vm.timeSelected.CreatedOnsYm" rt-type="date" rt-title="创建时间-从" rt-required="false" rt-col="3"></rt-datetime>
					<rt-datetime ng-model="vm.timeSelected.CreatedOneYm" rt-type="date" rt-title="到" rt-required="false" rt-col="3"></rt-datetime>
				</div>
				<div class="form-group">
					<rt-picklist ng-model="vm.campaign_type" rt-title="活动类型" rt-col="3" rt-options="vm.picklist.campaign_type"></rt-picklist>
				</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>
								<rt-header-checkbox></rt-header-checkbox>
							</th>
							<th rt-field-code="name">活动名称</th>
							<th rt-field-code="OwnerId">负责人</th>
							<th rt-field-code="BusinessUnitId">部门</th>
							<th rt-field-code="campaign_type">活动类型</th>
							<th rt-field-code="starttime">活动开始时间</th>
							<th rt-field-code="endtime">活动截止时间</th>
							<th rt-field-code="action_status">活动状态</th>
							<th>预算金额</th>
							<th>实际费用</th>
							<th>期望出席人数</th>
							<th>实际出席人数</th>
							<th>活动目的</th>
							<th rt-field-code="CreatedOn">创建时间</th>
							<th>照片</th>
						</tr>
					</thead>
					<tbody>
						<tr ng-repeat="row in vm.data track by row.Id">
							<td>
								<rt-data-checkbox value="{{row.Id}}" />
							</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}">{{row.name}}</a>
							</td>
							<td ng-if="vm.view.type=='grid'">
								<a href="javascript:;" ng-click="vm.actions.showForm(row.Id)">{{row.name}}</a>
							</td>
							<td> {{row.OwnerId.Name}}</td>
							<td> {{row.BusinessUnitId.Name}}</td>
							<td> {{row.campaign_type.Name}}</td>
							<td> {{row.starttime | date:'yyyy-MM-dd HH:mm'}} </td>
							<td> {{row.endtime | date:'yyyy-MM-dd HH:mm'}} </td>
							<td> {{row.action_status.Name}}</td>
							<td> {{row.budget}}</td>
							<td> {{row.actual_expense}}</td>
							<td> {{row.plan_attendance}}</td>
							<td> {{row.actual_attendance}}</td>
							<td> {{row.purpose}}</td>
							<td> {{row.CreatedOn | date:'yyyy-MM-dd HH:mm'}}</td>
							<td>
								<a href="javascript:;" ng-click="vm.showImage(row.Id)">浏览</a>
							</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>