<{include file="./admin/header.html"}>
<{include file="./admin/left.html"}>
<{include file="./admin/nav.html"}>
<{include file="get_kindeditor.html"}>

<div id="activity_container">

<div class="activity_center">
<{include file="./admin/activity/common_nav.html"}>


	查看:
	<{if $action == 'all'}>
	<span class="text-muted">全部</span> &nbsp;
	<{else}>
	<a href="<{$web_cfg.domain}>/?c=Admin_Activity_UserParticipateLog&a=PageList&events_id=<{$eventData.id}>&action=all">全部</a> &nbsp;
	<{/if}>
	<{if $action == 'member'}>
	<span class="text-muted">用户</span> &nbsp;
	<{else}>
	<a href="<{$web_cfg.domain}>/?c=Admin_Activity_UserParticipateLog&a=PageList&groupByUid=true&events_id=<{$eventData.id}>&action=member">用户</a> &nbsp;
	<{/if}>
	<{if $action == 'form'}>
	<span class="text-muted">表单</span> &nbsp;
	<{else}>
	<a href="<{$web_cfg.domain}>/?c=Admin_Activity_UserParticipateLog&a=PageEventFormData&events_id=<{$eventData.id}>&action=form">表单</a> &nbsp;
	<{/if}>
	<{if $isPrizes}>
	<{if $action == 'win'}>
	<span class="text-muted">中奖</span> &nbsp;
	<{else}>
	<a href="<{$web_cfg.domain}>/?c=Admin_Activity_UserParticipateLog&a=PageLotteryDataList&events_id=<{$eventData.id}>&action=win">中奖</a> &nbsp;
	<{/if}>
	<{/if}>

	<{if $eventData.type == 4}>
	<a href="<{$web_cfg.domain}>/?c=Admin_Activity_UserHelp&a=PageList&events_id=<{$eventData.id}>">助力排行</a> &nbsp;
	<{/if}>
	
	<{if $download_url}>
	<a href="<{$download_url}>" target="_blank" class="" style="padding:0 10px;margin-left:10px;"><i class="fa fa-download"></i> 导出数据</a>
	<{/if}>
	<{*
	<a href="" target="_blank" class="button button-primary button-small" style="width:; float:right" ><i class="fa fa-download"></i> 导出数据报表 </a>
	*}>
	
	<div class="block_10"></div>
	
	<div  class="panel panel-default">
		<div class="panel-body">	
			<div class="form-group">
				<div>
					<table class="table table-hover">
						<thead>
							<tr>
								<th>参与人</th>
								<th>UID</th>
								<th>时间</th>
								<th>行为</th>
								<{if $audit}>
								<th>审核状态</th>
								<{/if}>
							</tr>
						</thead>
						<tbody>
							<{if $formData}>
							<{foreach from=$formData item=data}>
							<tr>
								<td>
								
									<{if $userData[$data.uid].headimgurl}>
									<img class="img-rounded" width="48" height="48" src="<{$userData[$data.uid].headimgurl}>" />
									<{else}>
									<img class="img-rounded" width="48" height="48" src="http://news.mydrivers.com/Img/20110518/04481549.png" />
									<{/if}>
									<{if $userData[$data.uid].nickname}><{$userData[$data.uid].nickname}><{else}>游客<{/if}></td>
								<td><{$data.uid}></td>
								<td><{"Y-m-d H:i:s"|date:$data.create_time}></td>
								<td>
								<{foreach from=$formType item=name}>
									<{$name}>:<span class="text-muted"><{$data.$name}></span>&nbsp;  
								<{/foreach}>
								</td>
								<{if $audit}>
								<th><input type="checkbox" class="audit" name="audit[<{$data.id}>]" value="<{$data.id}>" <{if $data.audit == 2}>checked<{/if}>/></th>
								<{/if}>
							</tr>
							<{/foreach}>
							<{else}>
							<tr>
								<td colspan="3" align="center" class="text-muted">无表单数据</td>
							</tr>
							<{/if}>
						</tbody>
					</table>
					<{if $audit}>
					
					<div style="float:right" ><input type="checkbox" id="audit" value="2" />全选&nbsp;&nbsp;&nbsp;&nbsp;

					<a id="audit_submit" href="javascript:;" class="button button-default button-rounded">更新状态</a>

					</div>

					<br /><br /><br />
					<{/if}>
					<div class="page"><{$page_html}></div><p  style="float:right" >参与人数:<{$total_num}></p>
				</div>
			</div>
		</div>
	</div>
</div>

<{include file="./admin/activity/common_right.html"}>
<div style="clear:both;"></div>
</div>


<script>
KISSY.use('node, io, event', function (S, Node, IO, Event) {
	var $ = S.all;
	
});


function checkAll()
{
	$("#audit").click(function(){
		if ($(this).prop('checked')) {
			$(".audit").prop('checked',true);
		} else {
			$(".audit").prop('checked',false);
		}
	})
}

function submit()
{
	$("#audit_submit").click(function()
	{
		var yes = [];
		var no = [];
		$(".audit").each(function(){
			if ($(this).prop('checked')) {
				yes.push($(this).val());
			} else {
				no.push($(this).val());
			}
		});

		var state = true;
		if (state) {
			var id = '<{$eventData.id}>';
			var url = '<{$web_cfg.domain}>/?c=Admin_Activity_UserParticipateLog&a=Audit';
			$.post(url, {id:id,yes:yes.join(','),no:no.join(',')}, function(res) {
				alert('更新成功');
			});
		} else {
			alert('请选择一个选项');
		}
	})
}
checkAll();
submit();
</script>

<{include file="./admin/bottom.html"}>