<%inherit file="base.html"/>

<%def name="head()">
<script src="/static/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="/static/js/datepicker.css"> 
   <script>
    $(document).ready(function(){
        $("#query_begin_time").datepicker();
        $("#query_end_time").datepicker();
    });
    function do_submit(){
        $("#query_form").attr("action", "/bus/acceptlog");
        $("#query_form").submit();
    }
    function do_export(){
        $("#query_form").attr("action", "/bus/acceptlog/export");
        $("#query_form").submit();
    }
   </script>
</%def>

<%def name="body()">
<div class="panel panel-default">
    <div class="panel-heading"><span class="glyphicon glyphicon-th"></span> 用户受理查询</div>
    <div class="panel-body">
        <form id="query_form" class="form-horizontal form-well" role="form" method="post" action="/bus/acceptlog">
            <div class="form-group">

                <label for="node_id" class="col-md-2 control-label">区域</label>

                <div class="col-md-3">
                    <select id="node_id" name="node_id" class="form-control">
                        <option></option>
                        % for node in node_list:
                          <option value="${node.id}" ${str(node.id)==node_id and "selected" or ""}>${node.node_desc}</option>
                        % endfor
                    </select>
                </div>
                <label for="account_number" class="col-md-2 control-label">用户账号</label>
                <div class="col-md-3">
                    <input type="text" id="account_number" name="account_number" value="${account_number or ''}" class="form-control">
                </div>
            </div>
            <div class="form-group">
                <label for="accept_type" class="col-md-2 control-label">受理类型</label>

                <div class="col-md-3">
                    <select id="accept_type" name="accept_type" class="form-control">
                        <option></option>
                        % for value,name in type_map.items():
                          <option value="${value}" ${value==accept_type and "selected" or ""}>${name}</option>
                        % endfor
                    </select>
                </div>            
                <label for="operator_name" class="col-md-2 control-label">操作员</label>

                <div class="col-md-3">
                    <input type="text" id="operator_name" name="operator_name" value="${operator_name or ''}" class="form-control" placeholder="">
                </div>
            </div>    
            <div class="form-group">
                <label for="query_begin_time" class="col-md-2 control-label">开始时间</label>

                <div class="col-md-3">
                    <input type="text" id="query_begin_time" name="query_begin_time" value="${query_begin_time or ''}" class="form-control form_datetime"  >
                </div>
                 <label for="query_end_time" class="col-md-2 control-label">结束时间</label>
                <div class="col-md-3">
                    <input type="text" id="query_end_time" name="query_end_time" value="${query_end_time or ''}"  class="form-control form_datetime">
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-offset-5 col-md-7">
                    <button type="button" onclick="do_submit();" class="btn btn-primary">查询</button>
                    % if permit.match('/bus/acceptlog/export'):
                    <a href="javascript:do_export();" class="btn btn-md btn-default"><span class="glyphicon glyphicon-arrow-down"></span>导出数据</a>
                    % endif
                </div>
            </div>
        </form>

        <table class="table table-hover">
            <thead>
            <tr>
                <th>用户账号</th>
                <th>受理类型</th>
                <th>操作员</th>
                <th>受理时间</th>
                <th>订单号</th>
                <th>受理描述</th>
            </tr>
            </thead>
            <tbody>
            % for alog in page_data.result:
            <tr>
                <td><a href="/bus/member/detail?account_number=${alog.account_number}">${alog.account_number}</a></td>
                <td>${type_map[alog.accept_type]}</td>
                <td>${alog.operator_name}</td>
                <td>${alog.accept_time}</td>
                <td>${get_orderid(alog.id) or ''}</td>
                <td>${alog.accept_desc or ''}</td>
            </tr>
            % endfor
            </tbody>
        </table>
        ${page_data.render(form_id="query_form")}
    </div>
</div>


</%def>
