<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>

<div class="wrapper wrapper-content animated fadeInRight">
    <div id="type1" class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>更换清单</h5>
        </div>
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <table id="type1ListTable">
                        <thead>
                        <tr>
                            <th data-field="id">ID</th>
                            <th data-field="name">名称</th>
                            <th data-field="price">价格</th>
                            <th data-field="count">数量</th>
                            <th data-field="total">合计</th>
                            <th data-field="">结算方式</th>
                            <th data-field="">实收</th>
                            <th data-field="type">分类</th>
                            <th data-field="">维修人</th>
                            <th data-field="fix_remark">备注</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div id="type2" class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>维修清单</h5>
        </div>
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <table id="type2ListTable">
                        <thead>
                        <tr>
                            <th data-field="id">ID</th>
                            <th data-field="name">名称</th>
                            <th data-field="price">价格</th>
                            <th data-field="count">数量</th>
                            <th data-field="total">合计</th>
                            <th data-field="">结算方式</th>
                            <th data-field="">实收</th>
                            <th data-field="type">分类</th>
                            <th data-field="">维修人</th>
                            <th data-field="fix_remark">备注</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div id="type3" class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>待定清单</h5>
        </div>
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <table id="type3ListTable">
                        <thead>
                        <tr>
                            <th data-field="id">ID</th>
                            <th data-field="name">名称</th>
                            <th data-field="price">价格</th>
                            <th data-field="count">数量</th>
                            <th data-field="total">合计</th>
                            <th data-field="">结算方式</th>
                            <th data-field="">实收</th>
                            <th data-field="type">分类</th>
                            <th data-field="">维修人</th>
                            <th data-field="fix_remark">备注</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div id="type4" class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>配件清单</h5>
        </div>
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <table id="type4ListTable">
                        <thead>
                        <tr>
                            <th data-field="id">ID</th>
                            <th data-field="name">名称</th>
                            <th data-field="price">价格</th>
                            <th data-field="count">数量</th>
                            <th data-field="total">合计</th>
                            <th data-field="">结算方式</th>
                            <th data-field="">实收</th>
                            <th data-field="type">分类</th>
                            <th data-field="">维修人</th>
                            <th data-field="fix_remark">备注</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div id="type5" class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>工时清单</h5>
        </div>
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <table id="type5ListTable">
                        <thead>
                        <tr>
                            <th data-field="id">ID</th>
                            <th data-field="name">名称</th>
                            <th data-field="price">价格</th>
                            <th data-field="count">数量</th>
                            <th data-field="total">合计</th>
                            <th data-field="">结算方式</th>
                            <th data-field="">实收</th>
                            <th data-field="type">分类</th>
                            <th data-field="">维修人</th>
                            <th data-field="fix_remark">备注</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
    var items = {
        type1: <?=json_encode($type1_items)?>,
        type2: <?=json_encode($type2_items)?>,
        type3: <?=json_encode($type3_items)?>,
        type4: <?=json_encode($type4_items)?>,
        type5: <?=json_encode($type5_items)?>,
    };

    $.each(items,function(i,d)){
        var $table = $('#'+i+'ListTable');
        $table.hide();
        if(d.length>0){
            loadData($table.d);
            $table.show();
        }
    }

    function loadData(target,data) {
        target.bootstrapTable('destroy');
        target.bootstrapTable({
            data: data,
            pagination: true,
            sidePagination: 'server',
            queryParams: function(params) {
                return params;
            }
        });
        return false;
    }
</script>
<?php $this->endBlock('footer_js'); ?>