{include file="templates/html_header.html"}

		<!-- /section:basics/navbar.layout -->
		<div class="main-container ace-save-state" id="main-container">
			<script type="text/javascript">
			{literal}
				try{ace.settings.loadState('main-container')}catch(e){}
			{/literal}
			</script>
			<!-- #section:basics/sidebar -->
			{include file="templates/html_sidebar.html"}
			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<!-- #section:basics/content.breadcrumbs -->
					<div class="breadcrumbs ace-save-state" id="breadcrumbs">
						<ul class="breadcrumb">
							<li>
								<i class="ace-icon fa fa-home home-icon"></i>
								<a href="index.php">首页</a>
							</li>
							<li ><a href="voteconfig.php">投票设置</a></li>

							<li class="active">{$title}</li>
						</ul><!-- /.breadcrumb -->
						<!-- /section:basics/content.searchbox -->
					</div>

					<!-- /section:basics/content.breadcrumbs -->
					<div class="page-content">
					<h3 class="header smaller lighter blue">
						{$title}
						<small>设置投票选项</small>
					</h3>
						<div class="row">
							<div class="col-xs-12">
								
								<!-- PAGE CONTENT BEGINS -->
								<div class="widget-box widget-color-blue" id="widget-box-2">
								<div class="widget-header">
									<h5 class="widget-title bigger lighter">
										<i class="ace-icon fa fa-users"></i>
										{$vote_config['votetitle']}
									</h5>
									<div class="widget-toolbar no-border">
										<label>
										<button class="btn btn-xs btn-warning btn_add" onclick="openstatistics({$vote_config['id']})">统计结果</button>
										</label>
										
									</div>
								</div>
							<div class="widget-body">
								<div class="widget-main no-padding">
									<!-- PAGE CONTENT BEGINS -->
									<table class="table table-striped table-bordered table-hover">
										<thead class="thin-border-bottom">
											<tr>
												<th>序号</th>
												<th>选项名称</th>
												<th>投票人</th>
												<th>时间</th>
											</tr>
										</thead>
										<tbody>
										{foreach $vote_records as $item}
											<tr >
												<td >{$item['id']}</td>
												<td ><img src="{$item['imagepath']}" style="width:80px;height:80px;"/>{$item['voteitem']}</td>
												<td ><img src="{$item['avatar']}" style="width:80px;height:80px;"/>昵称：{$item['nickname']} 姓名：{$item['signname']} 手机号：{$item['phone']}</td>
												<th>{$item['updated_at']}</th>
											</tr>
										{/foreach}
										</tbody>
									</table>
									{$pagehtml}
									</div>
									</div>
								</div>
								
								<div id="statisticsform" class="modal" tabindex="-1">
									<div class="modal-dialog">
										<div class="modal-content" style="width:960px;">
											<div class="modal-header">
												<button type="button" class="close" data-dismiss="modal">&times;</button>
												<h4 class="blue bigger">选项</h4>
											</div>
											<div class="modal-body" >
											<!-- #section:elements.tab -->
											<div id="echart-table" class="echart-table" style="width:800px;height:800px;"></div>
											</div>

											<div class="modal-footer">
												<button class="btn btn-sm" data-dismiss="modal">
													<i class="ace-icon fa fa-times"></i>
													取消
												</button>
											</div>
										</div>
									</div>
								</div>	
								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->
		
{include file="templates/html_footercontent.html"}
<!-- 写每个页面自定的js -->
<script src="assets/ace_v1.4/components/jqGrid/js/jquery.jqGrid.js"></script>
<script src="assets/ace_v1.4/components/jqGrid/js/i18n/grid.locale-cn.js"></script>
<script src="../wall/themes/meepo/assets/js/echarts.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
{literal}

function openstatistics(id){
	if(id>0){
		$.ajax({
			"url":"dovoteconfig.php?action=getvoterecordstatistics",
			'type':'post',
			'data':{"id":id},
			"dataType":"json",
			"success":function(json){
				if(json.code>0){
					var myChart = echarts.init(document.getElementById('echart-table'));
			 		// 指定图表的配置项和数据
			        var option = {
			        	tooltip: {},
					    xAxis: {
					        type: 'category',
					        data: json.echartdata.voteitem,//['鲜花', '星星', '香蕉', '嫌弃'],
					        axisLine:{
					            lineStyle:{
					                color:'black',
					            },
					        },
					    },
					    yAxis: {
					        type: 'value',
					        axisLine:{
					            lineStyle:{
					                color:'black',
					            },
					        },
					    },
					    series: [{
					        data:json.echartdata.votecount,// [120, 200, 150, 80],
					        type: 'bar',
					        //配置样式
					        itemStyle: {
					            //通常情况下：
					            normal: {
					                color: function(params) {
					                    var colorList = ['rgb(164,205,238)', 'rgb(42,170,227)', 'rgb(25,46,94)', 'rgb(195,229,235)'];
					                    return colorList[params.dataIndex];
					                }
					            },
					            //鼠标悬停时：
					            //emphasis: {
					                //shadowBlur: 10,
					                //shadowOffsetX: 0,
					                //shadowColor: 'rgba(0, 0, 0, 0.5)'
					            //}
					        },
					        //设置柱子的宽度
					        // barWidth : 120,
					    }]
					};
					myChart.setOption(option);
				}else{
					alert(json.message);
				}
			}
		})
	}else{

	}
	$('#statisticsform').modal('show');
}

{/literal}
</script>
{include file="templates/html_footer.html"}