<link rel="stylesheet" href="/public/node_modules/bootstrap-select/dist/css/bootstrap-select.min.css">
<script src="/public/node_modules/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<!--<script type="text/javascript" src="/public/node_modules/bootstrap-multiselect/dist/js/bootstrap-multiselect.js"></script>-->
<!--<link rel="stylesheet" href="/public/node_modules/bootstrap-multiselect/dist/css/bootstrap-multiselect.css" type="text/css"/>-->

<link rel="stylesheet" href="<?php echo base_url();?>public/css/vendor/bootstrap/bootstrap-table.css">
<link rel="stylesheet" href="<?php echo base_url();?>public/css/vendor/bootstrap/table-fix-column.css">

<script src="<?php echo base_url();?>public/js/vendor/bootstrap/src/bootstrap-table.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap/src/table-fix-column.js"></script>

<style type="text/css">
    table {
        table-layout:fixed !important;
    }

    th{
        background: rgb(146, 208, 80);
    }

    td,th{
        /*max-width: 400px;*/
        word-wrap: break-word;
    }
    /*
    .fixed-table-header .table{
        height: 100px;
    }
    */

    table{
        table-layout:auto !important;
    }

    .table-hover > tbody > tr:hover {
        background-color: #c8bd6d;
    }

    input {
        width:60px;
    }

    #roleTable tr:nth-child(5n){
        /*background:rgb(198, 239, 206);*/
    } /**隔五行*/

    .fixed-table-toolbar {
        display: none;
    }
    .fileinput-button {
        position: relative;
        top: -5px;
    }

    .fileinput-button input{
        position:absolute;
        right: 0px;
        top: 0px;
        opacity: 0;
        -ms-filter: 'alpha(opacity=0)';
    }
    /*#reportBody tr td:nth-child(6),#reportBody tr td:nth-child(11),#reportBody tr td:nth-child(12),#reportBody tr td:nth-child(15){*/
    /*    color:red !important;*/
    /*}*/
    .fixed-table-body{
        /*overflow-x: visible;*/
        /*overflow-y: visible;*/
        /*height: auto;*/
    }
    .fixed-table-header{
        /*display: none;*/
        /*overflow:visible;*/
    }
    #roleTable{
        margin-top: -41px !important;
    }
</style>

<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><?php echo $title; ?></header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#adjuststa/iosDayReport" 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>
                                            <select class="form-control" name="user_os">
                                                <option value="0" <?php echo $user_os == 0?"selected":""; ?> >all</option>
                                                <option value="1" <?php echo $user_os == 1?"selected":""; ?> >android</option>
                                                <option value="2" <?php echo $user_os == 2?"selected":""; ?> >ios</option>
<!--                                                <option value="windows" --><?php //echo $user_os == "windows"?"selected":""; ?><!-- >windows</option>-->
                                            </select>
                                        </div>

                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>国家</label>
                                            <!--                                            <select class="multiselect" multiple data-live-search="false" name="address" id="address">-->
                                            <select class="selectpicker bla bla bli" multiple data-live-search="true" id="addressTemp" name="country[]">
                                                <option value="ALL" <?php echo in_array('ALL', $country) ? "selected":""; ?> >all</option>
                                                <?php
                                                foreach($addressList as $row){
                                                    $addressTempL = strtoupper($row['code']);
                                                    $name = $row["country_name"];
                                                    echo '<option value="'.($addressTempL).'" '.(in_array($addressTempL, $country)?"selected":"").'>'.$row['code'].'('.$name.')</option>';
                                                }
                                                ?>
                                            </select>
                                            <input type="hidden" name="address" value="">
                                        </div>
                                        <span class="gap"></span>
                                        <button type="submit" class="btn btn-primary">查询</button>
                                        <button type="button" class="btn btn-success" onclick="show(1)">导出</button>
                                    </form>

                                </div>
                            </div>

                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <a href="#adjuststa/iosDayReport/DESC" class="btn btn-success" target="_self">日期降序</a>
                    <a href="#adjuststa/iosDayReport/ASC" class="btn btn-success" target="_self">日期升序</a>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <div class="table-responsive">
                        <table  class="table table-bordered table-hover"
                               data-toggle="table"
                               data-classes="table table-hover"
                               data-show-columns="true"
                               data-striped="true"
                               data-height="700">
                            <thead>
                            <tr>
                                <?php
                                    foreach($headerTable as $key => $name){
                                        echo '<th>'.$name.'</th>';
                                    }
                                ?>
                            </tr>
                            </thead>
                            <tbody id="reportBody">
                            <?php foreach ( $list as $data => $row) { ?>
                            <tr  >
                                <?php foreach ( $headerTable as $key => $name) {?>
                                    <td style="text-align: center;vertical-align: middle;width:200px;" data-key="<?=$key?>"><?=$row[$key] ?? '-'?></td>
                                <?php }?>
                            </tr>
                            <?php }?>
                            </tbody>
                        </table>
                    </div>
                </aside>
            </div>
        </div>


    </div>
</div>
</div>
<!--select2-->
<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">
<script src="<?php echo base_url();?>public/js/vendor/select2/select2.full.min.js"></script>
<script src="<?php echo base_url();?>public/js/common.js"></script>
<script>
    $(document).ready(function() {
        $('.selectpicker').selectpicker({
            'selectedText': 'cat'
        });
        $('#addressTemp').selectpicker('val',['<?php echo is_array($country)?implode("','",$country):$country;?>']);
    });
    $('.selectpicker').on('changed.bs.select',function(e){
       $("input[name='address']").val($(this).val());
    });

    function show(){
        var stime = $('input[name=stime]').val()
        var etime = $('input[name=etime]').val()
        var address = $('input[name=address]').val()
        var exportUrl = "/adjuststa/exportIosDayReport?country=" + address + "&stime=" + stime + "&etime=" + etime;
        window.open(exportUrl);
    }
</script>
<script type="text/javascript">

        //选择日期
        $('.datetimepicker').datepicker({
            language:'zh-CN',
            format:'yyyy-mm-dd',
            autoclose:true,
            zIndexOffset:906  //控制z-index
        });


</script>
