<% include ../tender/tender_sub_menu.ejs %>
<div class="panel-content">
    <div class="panel-title">
        <div class="title-main  d-flex justify-content-between"><!--工具-->
            <div>
                <div class="d-inline-block">
                    <div class="input-group input-group-sm">
                        <input class="datepicker-here form-control mt-0" placeholder="按时间筛选" data-range="true" data-multiple-dates-separator=" - " data-language="zh" type="text" style="width:190px">
                        <div class="input-group-append">
                            <button class="btn btn-outline-secondary" type="button" title="筛选"><i class="fa fa-filter"></i></button>
                        </div>
                    </div>
                </div>
            </div>
            <div>
                <% if (addValid) { %>
                <div class="d-inline-block">
                    <a href="#add-bg" data-toggle="modal" data-target="#add-bg" class="btn btn-primary btn-sm pull-right">新建修订</a>
                </div>
                <% } %>
            </div>
        </div>
    </div>
    <div class="content-wrap">
        <div class="c-body">
            <!--修订中-->
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th></th>
                    <th>创建时间</th>
                    <th>提交人</th>
                    <th>状态</th>
                    <th>完成时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <% for (const lr of ledgerRevise) { %>
                <tr>
                    <td><%- lr.corder %></td>
                    <td><%- lr.in_time ? lr.in_time.toLocaleDateString() : '' %></td>
                    <td><%- lr.user_name %></td>
                    <td <% if (!lr.valid) {%>class="text-danger"<% } %>>
                        <% if (lr.valid) { %>
                        <%- auditConst.statusString[lr.status] %>
                        <% } else { %>
                        作废
                        <% } %>
                    </td>
                    <td><%- lr.end_time ? lr.end_time.toLocaleDateString() : '' %></td>
                    <td>
                        <% if (lr.valid) { %>
                        <% if (lr.status === auditConst.status.uncheck) { %>
                        <a href="<%- preUrl + '/revise/info' %>" class="btn btn-primary btn-sm">修订</a>
                        <a href="#remove" data-toggle="modal" data-target="#remove" class="btn btn-secondary btn-sm">作废</a>
                        <% } else if (lr.status === auditConst.status.checking) { %>
                        <a href="<%- preUrl + '/revise/info' %>" class="btn btn-success btn-sm">审批</a><
                        <% } else if (lr.status === auditConst.status.checkNo) { %>
                        <a href="<%- preUrl + '/revise/info' %>" class="btn btn-primary btn-sm">重新上报</a>
                        <a href="#remove" data-toggle="modal" data-target="#remove" class="btn btn-secondary btn-sm">作废</a>
                        <% } else if (ledgerRevise.indexOf(lr) === ledgerRevise.length - 1) { %>
                        <a href="<%- preUrl + '/revise/info' %>">查看修订内容</a>
                        <% } %>
                        <% } %>
                    </td>
                </tr>
                <% } %>
            </table>
            <!--翻页-->
            <% include ../layout/page.ejs %>
        </div>
    </div>
</div>