<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>

<div class="content_wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>小丑卡统计</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#statistics/jokerCardSta" name="stanpform">
		                                <input type="hidden" value="1" name="payuserpost"/>
		                                <span class="gap"></span>
		                                <div class="form-group">
		                                    <label>统计时间</label>
		                                    <input type="text" class="form-control datetimepicker" value="<?php if($date) echo $date;?>" placeholder="统计时间" name="date" />
		                                </div>
		                                
		                                <button type="submit" class="btn btn-primary">查询</button>
		                            </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
        	<div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>小丑卡统计</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-12">
                <div class="table-responsive">
                    <table id="reportTable" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                        <thead>
                            <tr>
	                            <th style="text-align: center;vertical-align: middle;width:100px;">ID</th>
                                <th style="text-align: center;vertical-align: middle;">UID</th>
                                <th style="text-align: center;vertical-align: middle;">兑换的卡片</th>
                                <th style="text-align: center;vertical-align: middle;">兑换时间</th>
                            </tr>
                        	
                        </thead>
                        <tbody id="reportBody">
                        	<?php foreach($data['log'] as $key => $row){ ?>
                        	<tr>
                        		<td style="text-align: center;vertical-align: middle;"><?php echo $key+1; ?></td>
								<td style="text-align: center;vertical-align: middle;"><?php echo $row['uid']; ?></td>
								<td style="text-align: center;vertical-align: middle;"><?php echo $card[$row['reason']]['ci_name_zh']; ?></td>
								<td style="text-align: center;vertical-align: middle;"><?php echo date("Y-m-d H:i:s",$row['time']); ?></td>
                        	</tr>
                        	<?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
            
        </div>
        
    </div>
</div>
</div>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript">
//设置图表导出格式选项
Highcharts.setOptions({
    lang: {
        printChart: '打印图表',
        downloadJPEG: '下载 JPEG 文件',
        downloadPDF: '下载 PDF   文件',
        downloadPNG: '下载 PNG  文件',
        downloadSVG: '下载 SVG  文件',
        downloadCSV: '下载 CSV  文件',
        downloadXLS: '下载 XLS   文件',
        viewData: '查看数据表格'
    },
    navigation: {
        menuItemStyle: {
            padding: '6px 14px'
        }
    },
    exporting: {
        url: ''
    },
    credits: {
        text: '',
        url: ''
    }
});

    Highcharts.chart('container', {
        chart: {
            type: 'column'
        },
        title: {
            text: '小丑卡统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php 
            	foreach($data['list'] as $key => $row){
            		echo "'".$props[$key]['name']."',";
            	}
            ?>]
        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: '数值',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: '百分比',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            labels: {
                format: '{value} %',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }],
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [{
            name: '数量',
            data: [<?php 
            	foreach($data['list'] as $key => $row){
            		echo $row.",";
            	}
            ?>]
        }
        ]
    });

</script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
</script>