<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-md-12">
                    <table id="listTable">
                        <thead>
                        <tr>
                            <th data-field="id">ID</th>
                            <th data-field="car_man">车主</th>
                            <th data-field="car_no">车牌号</th>
                            <th data-field="total1_clear">商业总净保费</th>
                            <th data-field="total1_real">折扣后商业净保费</th>
                            <th data-field="total1_dis">减免金额</th>
                            <th data-field="total1_percent">商业折扣率</th>
                            <th data-field="status_name">状态</th>
                            <th data-formatter="opFormatter">操作</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>


<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/assets/js/plugins/layer/laydate/laydate.js"></script>
<script>
    var o = {};
    function opFormatter(value, row, index) {
        var opStr = [];
        if(row.op == 1) {
            opStr.push('<a href="javascript:void(0);" onclick="view(' + row.id + ')">');
            opStr.push('<i class="fa fa-file-o" title="查看"></i>');
            opStr.push('</a>');
        }

        return opStr.join(' ');
    }
    function view(id) {
        window.open('/insurer/info?id=' + id);
    }

    function refreshList() {
        $('#listTable').bootstrapTable('refresh');
    }

    function search() {
        $('#listTable').bootstrapTable('destroy');
        $('#listTable').bootstrapTable({
            url: "/statistics/work-info-json",
            pagination: true,
            sidePagination: 'server',
            queryParams: function(params) {
                o['user_id'] = '<?=$user_id?>';
                o['offset'] = params['offset'];
                o['limit'] = params['limit'];
                return o;
            }
        });
        return false;
    }

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