<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/todayStockSta" name="stanpform">
                                        <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="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="etime" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>开始等级</label>
                                            <input type="text" class="form-control" value="<?php if($start_level) echo $start_level;?>" placeholder="开始等级" name="start_level" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>结束等级</label>
                                            <input type="text" class="form-control" value="<?php if($end_level) echo $end_level;?>" placeholder="结束等级" name="end_level" />
                                        </div>
                                        <button type="submit" class="btn btn-primary">查询</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        
        <div class="row">
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>金币存量</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="Money" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>体力存量</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="Spins" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>盾牌存量</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="Shield" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
            <div class="col-sm-6">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>钻石存量</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div id="Diamond" style="min-width: 310px; height: 400px; margin: 0 auto"></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">
    <?php foreach(['金币'=>'Money','体力'=>'Spins','盾牌'=>'Shield','钻石'=>'Diamond'] as $name => $type){ ?>
    Highcharts.chart('<?php echo $type; ?>', {
        chart: {
            type: 'line'
        },
        title: {
            text: '<?php echo $name; ?>存量'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: ['<?php echo implode("','",$date); ?>']
        },
        yAxis: {
            title: {
                text: '数值'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
            {
                name:'数值',
                data:[<?php foreach ($date as $key=>$row){ echo empty($data[$row]['sum'.$type])?'0,':$data[$row]['sum'.$type].',';}?>]
            },
            {
                name:'人均',
                data:[<?php foreach ($date as $key=>$row){ echo empty($data[$row]['avg'.$type])?'0,':$data[$row]['avg'.$type].',';}?>]
            }
        ]
    });
    <?php } ?>

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