<%@ page import="com.lightinit.hsdataplatform.dictionary.DicResourceCatelogType" %>
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String basePath = request.getContextPath();
%>
<jsp:include page="../../../common/admin/modal_content_pre.jsp">
    <jsp:param name="modal_title" value="审核"/>
</jsp:include>
<form>
    <div class="form-group">
        <label for="requirementName">需求名称：</label>
        <label id="requirementName">
            ${model.requirementName}
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <div class="form-group">
        <label for="requirementSummary">需求摘要：</label>
        <label id="requirementSummary">
            ${model.requirementSummary}"
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <div class="form-group">
        <label for="requirementSource">需求来源：</label>
        <label id="requirementSource">
            ${model.requirementSource}
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <div class="form-group">
        <label for="dataUses">数据用途：</label>
        <label id="dataUses">
            ${model.dataUses}
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <div class="form-group">
        <label for="rqrmntSectorName">数据需求部门：</label>
        <label id="rqrmntSectorName">
            ${model.rqrmntSectorName==null?'无':model.rqrmntSectorName}
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <div class="form-group">
        <label for="belongtoSectorName">数据所属部门：</label>
        <label id="belongtoSectorName">
            ${model.belongtoSectorName}
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <div class="form-group">
        <label for="creatAt">创建日期：</label>
        <label id="creatAt">
            <fmt:formatDate value="${model.createdAt}" pattern="yyyy-MM-dd"/>
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <c:choose>
        <c:when test="${dataList!=null&&dataList.size()>0}">
            <div class="form-group">
                所需数据
                <table class="table table-paginate">
                    <thead>
                    <tr>
                        <td>数据资源名称</td>
                        <td>具体数据项</td>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${dataList}" var="item">
                        <tr>
                            <td>${item.dataName}</td>
                            <td>${item.dataItem}</td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </c:when>
    </c:choose>
    <div class="form-group">
        <label for="auditShownName">审核用户：</label>
        <label id="auditShownName">
            ${auditBy}
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
    <div class="form-group">
        <label for="auditDate">审核日期：</label>
        <label id="auditDate">
            <fmt:formatDate value="${auditAt}" pattern="yyyy-MM-dd"/>
        </label>
        <span class="field-validation-valid help-block"></span>
    </div>
</form>
<form id="formAudit" action="<%=basePath%>/admin/data_supply/audit.action" method="post">
    <div class="form-group">
        <input type="hidden" id="id" name="id" value="${model.id}">
        <label for="auditOpinion">审核意见：</label>
        <div>
            <textarea type="text" id="auditOpinion" name="auditOpinion" class="form-control" value=""/>
        </div>
        <span class="field-validation-valid help-block"></span>
    </div>
    <input type="hidden" id="auditType" name="auditType" value="">
</form>
<jsp:include page="../../../common/admin/modal_content_post.jsp"></jsp:include>
<jsp:include page="../../../common/admin/modal_footer_pre.jsp"></jsp:include>
<div class="form-group" style="text-align: center;">
    <button type="button" id="btnPass" class="btn btn-primary"><i class="fa fa-check"></i>通过</button>
    <button type="button" id="btnReject" class="btn btn-danger"><i class="fa fa-close"></i>驳回</button>
</div>
<jsp:include page="../../../common/admin/modal_footer_post.jsp"></jsp:include>
<script type="text/javascript">
    $("#btnPass,#btnReject").click(function () {
        var type = $(this).attr("id");
        if (type == "btnPass") {
            $("#auditType").val("审核通过");
        } else {
            $("#auditType").val("审核不通过");
        }

        $('#formAudit').ajaxSubmit(function () {
            window.parent.location.reload();
            $("#wysharp-default-modal-container").modal('hide');
        });

    });
</script>