<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.css" media="all">
    <style>html {background-color: #fff;padding-bottom: 50px;}td, th {text-align: center !important;}</style>
</head>

<body>
<div class="layui-form">
    <div class="layui-card">
        <div class="layui-col-xs12 mt-10 mb-10 pr-30">
            <div class="layui-inline layui-col-xs3">
                <label class="layui-form-label w-130">产品编号：</label>
                <div class="layui-input-block ">
                    <input type="text" disabled name="projectCode" readonly autocomplete="off"
                           class="layui-input layui-bg-gray" value="${apply.columns.project_code}">
                </div>
            </div>
            <div class="layui-inline layui-col-xs3">
                <label class="layui-form-label w-130">入库仓库：</label>
                <div class="layui-input-block ">
                    <input type="text" disabled name="inWarehouseName" readonly autocomplete="off" placeholder="请输入"
                           class="layui-input layui-bg-gray" value="${apply.columns.inWarehouseName}">
                </div>
            </div>
            <div class="layui-inline layui-col-xs3">
                <label class="layui-form-label w-130">下单人：</label>
                <div class="layui-input-block ">
                    <input type="text" disabled name="creator" readonly autocomplete="off" placeholder="请输入"
                           class="layui-input layui-bg-gray" value="${apply.columns.creator}">
                </div>
            </div>
            <div class="layui-inline layui-col-xs3">
                <label class="layui-form-label w-130">下单时间：</label>
                <div class="layui-input-block ">
                    <input type="text" disabled name="createTime" readonly autocomplete="off" placeholder="请输入"
                           class="layui-input layui-bg-gray" value="<fmt:formatDate value="${apply.columns.create_time}" pattern="yyyy-MM-dd HH:mm"/>">
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 mb-10 pr-30">
            <div class="layui-form-item">
                <label class="layui-form-label w-130">订单备注：</label>
                <div class="layui-input-block ">
                    <textarea readonly class="layui-textarea layui-bg-gray">${apply.columns.remark}</textarea>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 mb-10 pr-30 pl-30">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <c:choose>
                        <c:when test="${apply.columns.status eq '1' || apply.columns.status eq '2' || apply.columns.status eq '3' || apply.columns.status eq '4'}">
                            <li class="layui-this">物料汇总</li>
                            <li>物料明细</li>
                        </c:when>
                        <c:otherwise>
                            <li class="layui-this">物料明细</li>
                        </c:otherwise>
                    </c:choose>
                    <li>过程记录</li>
                </ul>
                <div class="layui-tab-content">
                    <c:if test="${apply.columns.status eq '1' || apply.columns.status eq '2' || apply.columns.status eq '3' || apply.columns.status eq '4'}">
                        <div class="layui-tab-item layui-show">
                            <table class="layui-table">
                                <thead>
                                <th>序号</th>
                                <th>物料/BOM代码</th>
                                <th>物料/BOM类型</th>
                                <th>物料组</th>
                                <th>物料/BOM描述</th>
                                <th>申请数量</th>
                                </thead>
                                <tbody>
                                <c:forEach items="${gatherDetails}" var="gatherDetail" varStatus="vs">
                                    <tr>
                                        <td>${vs.count}</td>
                                        <td>${gatherDetail.columns.code}</td>
                                        <td>${gatherDetail.columns.materialTypeName}</td>
                                        <td>${gatherDetail.columns.materialGroupName}</td>
                                        <td>${gatherDetail.columns.remarks}</td>
                                        <td>${gatherDetail.columns.amount}</td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </c:if>
                    <div class="layui-tab-item ${apply.columns.status eq '1' || apply.columns.status eq '2' || apply.columns.status eq '3' || apply.columns.status eq '4'? '': 'layui-show'}">
                        <table class="layui-table">
                            <thead>
                            <th>序号</th>
                            <th>物料代码</th>
                            <th>物料类型</th>
                            <th>物料组</th>
                            <th>单位</th>
                            <th>物料描述</th>
                            <th>申请数量</th>
                            </thead>
                            <tbody>
                            <c:forEach items="${applyDetails}" var="applyDetail" varStatus="vs">
                                <tr>
                                    <td>${vs.count}</td>
                                    <td>${applyDetail.columns.code}</td>
                                    <td>${applyDetail.columns.materialTypeName}</td>
                                    <td>${applyDetail.columns.materialGroupName}</td>
                                    <td>${applyDetail.columns.unit_name}</td>
                                    <td>${applyDetail.columns.remarks}</td>
                                    <td>${applyDetail.columns.apply_amount}</td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-tab-item">
                        <c:forEach items="${msgList}" var="msg" varStatus="vs">
                            <div class="mb-10">
                                <fmt:formatDate value="${msg.operateTime}" pattern="yyyy-MM-dd HH:mm"/>
                                    ${msg.content}
                            </div>
                        </c:forEach>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="operate-footer">
        <input type="button" value="取消" class="layui-btn layui-btn-primary " onclick="closeDiv();">
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
    //初始数据
    var $form;
    var form;
    var $;
    var imgs = '';
    var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['form', 'layedit', 'laydate', 'jquery', 'layer', 'element'], function () {
        $ = layui.jquery;
        form = layui.form;
        var element = layui.element;
        $form = $('form');


    })

    function closeDiv() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }


</script>
</body>
</html>
