<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<link rel="stylesheet" href="<?php echo base_url();?>public/plugins/datatables/jquery.dataTables.min.css">
<link rel="stylesheet" href="<?php echo base_url();?>public/plugins/datatables/extensions/Responsive/css/dataTables.responsive.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>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#activitysta/rankTable" id="totalForm">
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>活动ID</label>
                                            <input type="text" class="form-control" value="<?php if($aid) echo $aid;?>" placeholder="活动ID" name="aid" />
                                        </div>
                                        <span class="gap"></span>
                                        <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>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <a href="#activitysta/rankChart/<?php echo $aid ?? 0;?>" class="btn btn-primary">排名图表展示</a>
                                    <a href="#activitysta/rankTable/<?php echo $aid ?? 0;?>" class="btn btn-primary">排名数据来源</a>
                                    <?php
                                    if($config['type'] == "rank"){
                                        ?>
                                        <a href="#activitysta/speedChart/<?php echo $aid ?? 0;?>/rank" class="btn btn-primary">进度图表展示</a>
                                        <a href="#activitysta/speedTable/<?php echo $aid ?? 0;?>/rank" class="btn btn-primary">进度数据来源</a>
                                        <?php
                                    }
                                    ?>
                                </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><?php echo $config['type']?>数据来源</header>
                    <section>
                        <div class="container-fluid">
                            <?php if(empty($config)){
                                echo '没有数据';
                            }else if($config['type'] != 'rank'){
                                echo '不是锦标赛活动';
                            }else{ ?>
                            <?php foreach($rankData['spinsSet'] as $arrId => $number){
                                $arrId = $arrId + 1;
                                ?>
                                <div class="row">
                                    <div class="col-sm-12">
                                        <div class="table-responsive">
                                            <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                                <thead>
                                                <tr>
                                                    <th>体力分块区间</th>
                                                    <th colspan="5"><?php echo ">=".$number; ?></th>
                                                    <th>房间数量</th>
                                                    <th><?php echo $rankData['blockData'][$arrId]['roomNumber'] ?? 0; ?></th>
                                                </tr>
                                                <tr>
                                                    <th>竞标赛名次</th>
                                                    <th>机器人数量</th>
                                                    <th>玩家数</th>
                                                    <th>付费率</th>
                                                    <th>ARPPU(付费金额/付费人数)</th>
                                                    <th>ARPU(付费金额/玩家数)</th>
                                                    <th>活动期间付费总额</th>
                                                    <th>活动期间体力消耗</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php for($i = 1; $i <= 10; $i++){ ?>
                                                    <tr>
                                                        <th><?php echo $i; ?></th>
                                                        <th><?php echo $rankData['blockData'][$arrId]['rankingRobot'][$i] ?? 0; ?></th>
                                                        <th><?php echo $rankData['blockData'][$arrId]['ranking'][$i] ?? 0; ?></th>
                                                        <th><?php echo empty($rankData['blockData'][$arrId]['ranking'][$i]) ? 0 : number_format($rankData['blockData'][$arrId]['payNum'][$i] / $rankData['blockData'][$arrId]['ranking'][$i] * 100,1,'.',''); ?>%</th>
                                                        <th><?php echo empty($rankData['blockData'][$arrId]['payNum'][$i]) ? 0 : number_format($rankData['blockData'][$arrId]['payTotal'][$i] / $rankData['blockData'][$arrId]['payNum'][$i],1,'.',''); ?></th>
                                                        <th><?php echo empty($rankData['blockData'][$arrId]['ranking'][$i]) ? 0 : number_format($rankData['blockData'][$arrId]['payTotal'][$i] / $rankData['blockData'][$arrId]['ranking'][$i],3,'.',''); ?></th>
                                                        <th><?php echo number_format($rankData['blockData'][$arrId]['payTotal'][$i] ?? 0,2,".",""); ?></th>
                                                        <th><?php echo number_format($rankData['blockData'][$arrId]['spinsTotalLow'][$i] ?? 0,2,".",""); ?></th>
                                                    </tr>
                                                <?php } ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            <?php } } ?>
                        </div>
                    </section>
                </aside>
            </div>
        </div>


    </div>

</div>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script src="<?php echo base_url();?>public/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url();?>public/plugins/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
<script src="<?php echo base_url();?>public/plugins/validate/jquery.validate-1.15.0.min.js"></script>
<script>
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });

</script>
