<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/inviteSta" 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($stime) echo $stime;?>" placeholder="开始时间" name="payuserindex_stime" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>结束时间</label>
                                            <input type="text" class="form-control datetimepicker" value="<?php if($etime) echo $etime;?>" placeholder="结束时间" name="payuserindex_etime" />
                                        </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>FB邀請统计</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>

        <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="table-responsive">
                                    <table id="reportTable" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                        <thead>
                                        <tr>
                                            <th rowspan="2" style="text-align: center;vertical-align: middle;">日期</th>
                                            <th colspan="3" style="text-align: center;vertical-align: middle;">打分享</th>
                                            <th colspan="3" style="text-align: center;vertical-align: middle;">偷分享</th>
                                            <th colspan="3" style="text-align: center;vertical-align: middle;">卡片索取分享</th>
                                            <th colspan="3" style="text-align: center;vertical-align: middle;">世界通关分享</th>
                                            <th colspan="3" style="text-align: center;vertical-align: middle;">点击打链接</th>
                                            <th colspan="3" style="text-align: center;vertical-align: middle;">点击偷链接</th>
                                        </tr>
                                        <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>
                                            <th>获得人数</th>
                                            <th>每日点击总获得的体力</th>
                                        </tr>
                                        </thead>
                                        <tbody id="reportBody">
                                        <?php
                                         if(is_array($shareData['data'])){
                                            foreach($shareData['data'] as $k => $val){
                                                ?>
                                                <tr>
                                                	<td style="white-space: nowrap" rowspan="1"><?php echo $val['date'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['attackDefense']['selfType']['total']+$val['data']['attackDamaged']['selfType']['total'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['attackDefense']['selfType']['successNumber']+$val['data']['attackDamaged']['selfType']['successNumber'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['attackDefense']['selfType']['spins']+$val['data']['attackDamaged']['selfType']['spins'];?></td>
                                                	
                                                	<td style="white-space: nowrap"><?php echo $val['data']['raidGood']['selfType']['total']+$val['data']['raidPerfect']['selfType']['total'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['raidGood']['selfType']['successNumber']+$val['data']['raidPerfect']['selfType']['successNumber'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['raidGood']['selfType']['spins']+$val['data']['raidPerfect']['selfType']['spins'];?></td>
                                                	
                                                	<td style="white-space: nowrap"><?php echo $val['data']['askforCard']['selfType']['total'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['askforCard']['selfType']['successNumber'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['askforCard']['selfType']['spins'];?></td>
                                                	
                                                	<td style="white-space: nowrap"><?php echo $val['data']['passLevel']['selfType']['total'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['passLevel']['selfType']['successNumber'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['passLevel']['selfType']['spins'];?></td>
                                                	
                                                	<td style="white-space: nowrap"><?php echo $val['data']['attackDefense']['otherType']['total']+$val['data']['attackDamaged']['otherType']['total'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['attackDefense']['otherType']['successNumber']+$val['data']['attackDamaged']['otherType']['successNumber'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['attackDefense']['otherType']['spins']."/".$val['data']['attackDamaged']['otherType']['money'];?></td>
                                                	
                                                	<td style="white-space: nowrap"><?php echo $val['data']['raidGood']['otherType']['total']+$val['data']['raidPerfect']['otherType']['total'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['raidGood']['otherType']['successNumber']+$val['data']['raidPerfect']['otherType']['successNumber'];?></td>
                                                	<td style="white-space: nowrap"><?php echo $val['data']['raidGood']['otherType']['spins']+$val['data']['raidPerfect']['otherType']['spins'];?></td>
                                                </tr>
                                                <?php
                                            }
                                         }
                                        ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </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.chart('container', {
        chart: {
            type: 'line'
        },
        title: {
            text: 'FB邀請统计'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php foreach ($data as $row){ echo '"'.$row['date'].'",';}?>]
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [{
            name:'邀請量',
            data:[<?php foreach ($data as $row){ echo $row['invite'].',';}?>]
        },{
            name:'邀請成功量',
            data:[<?php foreach ($data as $row){ echo $row['success'].',';}?>]
        }]
    });
</script>
<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });
</script>