<?php    
/**
 * Created by PhpStorm.
 * User: chenkuan
 * Date: 2017/12/22
 * Time: 上午11:16
 */
?>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <h2>代理商管理</h2>
        <ol class="breadcrumb">
            <li>
                <a href="/admin/dashboard">管理首页</a>
            </li>
            <li>
                <a href="/admin/ib">代理商管理</a>
            </li>
            <li>
                <a href="/admin/ib/view?id=<?= $id ?>">账户<?= $name ?>基本信息</a>
            </li>
            <li class="active">
                <strong>返佣规则记录</strong>
            </li>
        </ol>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">

                    <div class="table-responsive">
                        <table id="datatables" class="table table-striped table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>LOGIN</th>
                                <th>Member_id</th>
                                <th>返佣类型</th>
                                <th>FOREX</th>
                                <th>METAL</th>
                                <th>CFD</th>
                                <th>黄金(GOLD)</th>
                                <th>白银(SILVER)</th>
                                <th>外佣(wy)</th>
                                <th>股指(STOCK)</th>
                                <th>BTC</th>
                                <th>修改人</th>
                                <th>修改时间</th>
                            </tr>
                            </thead>
                            <tfoot>
                            <tr>
                                <th>ID</th>
                                <th>LOGIN</th>
                                <th>Member_id</th>
                                <th>返佣类型</th>
                                <th>FOREX</th>
                                <th>METAL</th>
                                <th>CFD</th>
                                <th>黄金(GOLD)</th>
                                <th>白银(SILVER)</th>
                                <th>外佣(wy)</th>
                                <th>股指(STOCK)</th>
                                <th>BTC</th>
                                <th>修改人</th>
                                <th>修改时间</th>
                            </tr>
                            </tfoot>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<?php $this->beginBlock('footer_script'); ?>
<script>
    KindEditor.ready(function(K) {});
</script>

<!-- Page-Level Scripts -->
<script>
    var table;
    $(document).ready(function() {
        table = $('#datatables').DataTable({
            "aLengthMenu": [[20,50,100,500], [20,50,100,500]],
            language: {
                "sProcessing": "处理中...",
                "sLengthMenu": "显示 _MENU_ 项结果",
                "sZeroRecords": "没有匹配结果",
                "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                "sInfoPostFix": "",
                "sSearch": "搜索:",
                "sUrl": "",
                "sEmptyTable": "表中数据为空",
                "sLoadingRecords": "载入中...",
                "sInfoThousands": ",",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "上页",
                    "sNext": "下页",
                    "sLast": "末页"
                },
                "oAria": {
                    "sSortAscending": ": 以升序排列此列",
                    "sSortDescending": ": 以降序排列此列"
                }
            },
            "processing": true,
            "serverSide": true,
            "ajax": '/admin/ib/commission-log-ajax?id=<?= $id ?>',
            "order": [[12, "desc"]],
            "columns": [
                {
                    "data": "id"
                },
                {
                    "data": "login"
                },
                {
                    "data": "member_id"
                },
                {
                    "data": "type"
                },
                {
                    "data": "forex"
                },
                {
                    "data": "metal"
                },
                {
                    "data": "cfd"
                },
                {
                    "data": "gold"
                },
                {
                    "data": "silver"
                },
                {
                    "data": "wy"
                },
                {
                    "data": "stock"
                },
                {
                    "data": "btc"
                },
                {
                    "data": "name"
                },
                {
                    "data": "in_time"
                }
            ],
            columnDefs: [{
                targets: 2,
                "orderable": false
            },{
                targets: 3,
                render: function(data, type, row, meta) {
                    if(data=='direct'){
                        return '<span class="label label-danger">直属返佣</span>';
                    }else if(data=='indirect'){
                        return '<span class="label label-danger">差佣</span>';
                    }else if(data=='no'){
                        return '<span class="label label-danger">无</span>';
                    }
                },
                "orderable": true
            },{
                targets: 13,
                render: function(data, type, row, meta) {
                    if(data!=0){
                        return timeStamp2String(parseInt(data));
                    }else{
                        return "";
                    }
                },
                "orderable": true
            }],
            "sPaginationType": "full_numbers",
            dom: '<"html5buttons"B>lTfgitp',
            buttons: [{
                extend: 'copy'
            },
                {
                    extend: 'csv'
                },
                {
                    extend: 'excel'
                },
                {
                    extend: 'pdf'
                },
                {
                    extend: 'print',
                    customize: function(win) {
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');
                        $(win.document.body).find('table').addClass('compact').css('font-size', 'inherit');
                    }
                }]

        });

        $('#datatables tbody').on('click', 'tr',
            function() {
                if ($(this).hasClass('selected')) {
                    $(this).removeClass('selected');
                } else {
                    table.$('tr.selected').removeClass('selected');
                    $(this).addClass('selected');
                }
        });



        $("#modal").on("hidden.bs.modal", function() {
            $(this).removeData("bs.modal");
            KindEditor.remove('#kindeditor');
        });

    });
</script>
<?php $this->endBlock(); ?>





