<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<link rel="stylesheet" href="/lib/app/css/app.min.css">
<link rel="stylesheet" href="/lib/simple-line-icons/css/simple-line-icons.css">
<link rel="stylesheet" href="/lib/bootable/bootstrap-table.css">
<link rel="stylesheet" href="/lib/webo/css/ui.css">
<link rel="stylesheet" href="/lib/toastr/toastr.css">
<link rel="stylesheet" href="/lib/app/css/site.min.css">
<style>
    .app-content, .app-footer {
        margin-left: 0px;
    }
    .app-content {
        position: absolute;
        top: 42px;
        height: auto;
        width: 100% !important;
    }
    @media (min-width: 768px) {
        .navbar {
            min-height: 40px
        }

        .navbar-nav > li > a {
            font-size: 14px;
            padding-top: 11px;
            padding-bottom: 11px
        }
        .navbar-brand {
            padding-top: 0;
            padding-bottom: 0;
            line-height: 42px;
            height: 42px
        }
    }
    @media (min-width: 1200px){
        .col-lg-3 {
            width: 20%;
        }
    }
    .odoo{
        border: 1px solid #ced4da;
        height: 71px;
        margin: 8px 8px;
        padding: 0 15px 0 0
    }
    .padd10{
        padding-top: 10px;
    }
    #type .form-control{
        border-top-style: none;
        border-right-style: none;
        border-left-style: none;
        border-bottom: 2px solid #cacaca;
        border-radius:0;
    }
</style>
<body>
<div class="app app-header-fixed app-aside-fixed">
    <header id="header" class="app-header navbar" role="menu">
        {{template "com/nav.tpl" .}}
    </header>
    <div>
        <div class="toolbar">
            <div class="btn-group">
                <a id="add_item" class="create btn btn-primary">新建</a>
            </div>
        </div>
        <table id="item_table"
               data-show-refresh="false"
               data-show-columns="false"
               data-show-export="false"
               data-search="false"
               data-page-size="100"
               data-filter-control="true"
               data-query-params="queryParams"
               data-show-footer="true"
               data-width="100px"
               data-toolbar=".toolbar">
            <thead>
            <tr>
                <th data-field="action"
                    data-align="center"
                    data-formatter="actionFormatter"
                    data-events="actionEvents"
                    data-sortable="false"
                    data-width="200px"> &nbsp[&nbsp&nbsp操作&nbsp&nbsp]&nbsp
                </th>
                <th data-field="transtype" data-filter-control="input" data-align="left" data-sortable="false" data-width="100px">编号</th>
                <th data-field="bank" data-filter-control="input" data-align="left" data-sortable="false" data-width="100px">产品</th>
                <th data-field="acctid" data-filter-control="input" data-align="left" data-sortable="false" data-width="100px">BOM类型</th>
                <th data-field="acctname" data-filter-control="input" data-align="left" data-sortable="false">数量</th>
                <th data-field="version" data-filter-control="input" data-align="left" data-sortable="false">版本</th>
            </tr>
            </thead>
        </table>
    </div>
    <!-- /content -->
</div>
<script src="/lib/app/js/app.min.js"></script>
<script src="/lib/bootable/bootstrap-table.js"></script>
<script src="/lib/webo/js/ui.js"></script>
<script src="/lib/toastr/toastr.js"></script>
<script src="/lib/jquery/jquery/validate/jquery.metadata.js"></script>
<script src="/lib/jquery/jquery/jquery.form.js"></script>
<script src="/lib/jquery/jquery-ui/jquery-ui.min.js"></script>
<script src="/lib/webo/js/validate.js"></script>
<script>
    var $table = $("#item_table");
    $(function () {
        $table.bootstrapTable({
            url: "/product/item/list",
            method: "post",
            sidePagination: "server",
            pagination: true,
            height: getTableHeight(),
            fixedColumns: true,
            fixedNumber: 1
        });
        $("#add_item").on("click", function () {
            window.location.href = "/product/ui/bom/add"
        });
        $(window).resize(function () {
            $table.bootstrapTable('resetView', {
                height: getTableHeight()
            });
        });
    });
    function getTableHeight() {
        return 800;
        var window_height = $(window).height();
        var obj_off_y = $(".fit-body").offset().top();
        var result_height = window_height - obj_off_y;
        return result_height;
    }
    function refreshContent(options) {
        $table.bootstrapTable("refresh")
    }
    function actionFormatter(value, row) {
        str ='<a class ="update text-primary" href="javascript:" title="修改" style="margin-right: 5px;">修改</a>';
        return str
    }
    window.actionEvents = {
        'click .update': function (e, value, row) {
            window.location = "/product/ui/update?sn=" + row.sn
        }
    }
</script>
</body>
</html>