{% extends "../basic_layout.html" %}
{% block header %}
<link href="/static/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="/static/css/dataTables.bootstrap.css" rel="stylesheet">
{% endblock %}
{% block body_content %}

    <div class="row">
        <div class="col-lg-12">

        </div>
    </div>
    <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12">
            <div class="panel panel-default hentry">
                <div class="panel-heading center-block">
                    <h1 class="panel-title"><span class="glyphicon glyphicon-pencil"></span> <span class="text-primary">{{title}}</span><span class="sep"></h1>
                </div>
                <div class="panel-body entry-content">
                    <div class="row">
                    {% if msg | length > 0 %}
                    <ul class="alert alert-warning">
                        {% for m in msg %}
                        <li>{{m}}</li>
                        {% endfor %}
                    </ul>
                    {% endif %}
                    {% if results | length > 0 %}
                            <div class="col-lg-12">
                                <table id="table" class="table table-striped table-bordered table-hover table-condensed align-center">
                                    <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>重量</th>
                                            <th>时间</th>
                                            <th>批次</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {%for result in results %}
                                        <tr>
                                            <td>{{forloop.Counter}}</td>
                                            <td>{{result.Weight | floatformat:2}}</td>
                                            <td>{{result.WeighTime | date:"2006-01-02 15:04:05"}}</td>
                                            <td>{{result.BatchNumber}}
                                        </tr>
                                        {% endfor %}
                                    </tbody>
                                    <tfoot>
                                        <tr class="info">
                                            <td>合计</td>
                                            <td></td>
                                            <td></td>
                                            <td></td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div><!--end of -->
                        </div><!--end of row-->
                    {% else %}
                        <p>无对应的结果</p>
                    {% endif %}
                </div><!--end of panel-->
              </div>
        </div>
    </div>
{% endblock %}

{%block afterscript %}
<script src="/static/js/moment-with-langs.min.js"></script>
<script src="/static/js/bootstrap-datetimepicker.min.js"></script>
<script src="/static/js/jquery.dataTables.min.js"></script>
<script src="/static/js/dataTables.bootstrap.js"></script>
<script>
    $(function () {
                    $('#datetimepicker').datetimepicker({
                        pickTime: false,
                        language: 'zh-cn'
                    });

                    $('#table').dataTable({
                        "lengthMenu": [ [20, 25, 50, -1], [20, 25, 50, "全部"] ],
                        "pageLength": 20,
                        language: {
                                processing:     "处理中...",
                                search:         "查找",
                                lengthMenu:    "每页显示 _MENU_ 条数据",
                                info:           "从第 _START_ 条到第_END_条，共 _TOTAL_ 条记录",
                                infoEmpty:      "没有数据",
                                infoFiltered:   "(从_MAX_条数据中检索)",
                                infoPostFix:    "",
                                loadingRecords: "正在加载数据...",
                                zeroRecords:    "抱歉，没有找到",
                                emptyTable:     "表中没有可用的数据",
                                paginate: {
                                    first:      "第一页",
                                    previous:   "前一页",
                                    next:       "后一页",
                                    last:       "最后"
                                },
                                aria: {
                                    sortAscending:  "升序",
                                    sortDescending: "降序"
                                }
                        }, //end language
                    });//end dataTable
                });
</script>
{% endblock %}
