<!--上传签约清单-->
<div class="modal fade" id="upload-deal" data-backdrop="static" enctype="multipart/form-data">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">上传签约清单</h5>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="exampleFormControlFile1">Excel模板</label>
                    <div class="form-control"><a id="downloadDealTemplate" href="/deal/download/template.xls" class="btn btn-sm btn-link">下载</a></div>
                </div>
                <div class="form-group">
                    <label for="exampleFormControlFile1">上传签约清单Excel文件</label>
                    <div class="form-control"><input type="file" class="form-control-file" id="deal-bills-file"></div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="upload-deal-bills">确认上传</button>
            </div>
        </div>
    </div>
</div>
<!--批量添加子项弹窗-->
<div class="modal fade" id="batch" data-backdrop="static">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">批量插入子项</h5>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-6">
                        <h6 class="row"><span class="col">部位数量复合表</span>
                            <div class="input-group input-group-sm col-5 align-self-end">
                                <div class="input-group-prepend">
                                    <span class="input-group-text" id="basic-addon1">起始编号</span>
                                </div>
                                <input type="num" class="form-control form-control-sm"  step="1" value="1">
                            </div></h6>
                        <div class="batch-l-t">
                        </div>
                        <h6>清单编号</h6>
                        <div class="batch-l-b">
                        </div>
                    </div>
                    <div class="col-6">
                        <h6>签约清单</h6>
                        <div id="batch-deal-spread" class="batch-r">
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" id="batch-ok">确定</button>
            </div>
        </div>
    </div>
</div>
<% if (tenderData.ledger_status === auditConst.status.uncheck) { %>
<!--上报审批-->
<div class="modal fade" id="sub-sp" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">上报审批</h5>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label>搜索审批人</label>
                    <div class="input-group">
                        <input class="form-control" placeholder="请输入姓名进行检索" type="text" id="searchName">
                        <div class="input-group-append">
                            <button class="btn btn-outline-secondary" type="button" id="searchAccount"><i class="fa fa-search"></i></button>
                        </div>
                    </div>
                </div>
                <div class="card border-primary" id="searchResult" style="display: none">
                    <div class="card-body">
                        <h5 class="card-title">
                            <a href="javascript: void(0)" class="btn btn-primary btn-sm pull-right" id="addAuditor">添加</a>
                            <span>张三</span>
                        </h5>
                        <h6 class="card-subtitle mb-2 text-muted">监理</h6>
                        <p class="card-text">XXXXX公司</p>
                    </div>
                </div>
                <div class="card mt-3">
                    <div class="card-header">
                        审批流程
                    </div>
                    <ul class="list-group list-group-flush" id="auditors">
                        <% for (let i = 0, iLen = auditors.length; i < iLen; i++) { %>
                        <li class="list-group-item" auditorId="<%- auditors[i].audit_id %>">
                            <a href="javascript: void(0)" class="text-danger pull-right">移除</a>
                            <%- auditors[i].audit_order %> <%- auditors[i].name %>
                            <small class="text-muted"><%- auditors[i].role %></small>
                        </li>
                        <% } %>
                    </ul>
                </div>
            </div>
            <form class="modal-footer" method="post" action="/ledger/audit/start">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
                <button class="btn btn-primary" type="submit">确认上报</button>
            </form>
        </div>
    </div>
</div>
<% } %>
<% if (tenderData.ledger_status === auditConst.status.checkNo) { %>
<!--重新审批-->
<div class="modal fade" id="sub-sp2" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">重新上报</h5>
            </div>
            <div class="modal-body">
                <div class="alert alert-primary" role="alert">
                    重新上报后，将由 <%- auditors[0].name %> 继续审批
                </div>
                <div class="card mt-3">
                    <div class="card-header">
                        审批流程
                    </div>
                    <ul class="list-group list-group-flush">
                        <% for (let i = 0, iLen = auditors.length; i < iLen; i++) { %>
                        <li class="list-group-item" auditorId="<%- auditors[i].audit_id %>">
                            <% if (auditors[i].status !== auditConst.status.uncheck) { %>
                            <span class="<%- auditConst.statusClass[auditors[i].status] %> pull-right"><%- auditConst.statusString[auditors[i].status] %></span>
                            <% } %>
                            <h5 class="card-title"><%- auditors[i].audit_order %> <%- auditors[i].name %> <small class="text-muted"><%- auditors[i].role %></small></h5>
                            <p class="card-text"><%- auditors[i].opinion %> <%- auditors[i].end_time ? auditors[i].end_time.toLocaleString() : '' %></p>
                        </li>
                        <% } %>
                    </ul>
                </div>
            </div>
            <form class="modal-footer" action="/ledger/audit/start" method="post">
                <button type="submit" class="btn btn-primary">确认上报</button>
                <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </form>
        </div>
    </div>
</div>
<% } %>
<% if (tenderData.status !== auditConst.status.unCheck) { %>
<!--审批流程/结果-->
<div class="modal fade" id="sp-list" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">审批流程</h5>
            </div>
            <div class="modal-body">
                <div class="card mt-3">
                    <ul class="list-group list-group-flush">
                        <% for (let i = 0, iLen = auditors.length; i < iLen; i++) { %>
                        <li class="list-group-item" auditorId="<%- auditors[i].audit_id %>">
                            <% if (auditors[i].status !== auditConst.status.uncheck) { %>
                            <span class="<%- auditConst.statusClass[auditors[i].status] %> pull-right"><%- auditConst.statusString[auditors[i].status] %></span>
                            <% } %>
                            <h5 class="card-title"><%- auditors[i].audit_order %> <%- auditors[i].name %> <small class="text-muted"><%- auditors[i].role %></small></h5>
                            <p class="card-text"><%- auditors[i].opinion %> <%- auditors[i].end_time ? auditors[i].end_time.toLocaleString() : '' %></p>
                        </li>
                        <% } %>
                    </ul>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<% } %>