<%@ 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-tab-content">
            <div class="layui-row">
                <table class="layui-table">
                    <thead>
                    <th>序号</th>
                    <th>物料代码</th>
                    <th>物料名称</th>
                    <th>物料类型</th>
                    <th>物料品牌</th>
                    <th>物料规格</th>
                    <c:if test="${tyoeor eq '1'}">
                        <th>计划数量</th>
                    </c:if>
                    <c:if test="${tyoeor ne '1'}">
                        <th>发货数量</th>
                    </c:if>
<%--                    <c:if test="${user.userType ne '6' && user.userType ne '7'}">--%>
<%--                        <th>采购单价</th>--%>
<%--                    </c:if>--%>
                    <c:if test="${user.userType ne '8'}">
                        <th>销售价</th>
                    </c:if>
                    <th>单位</th>
                    </thead>
                    <tbody id="materialTbody">
                    <c:forEach items="${details}" var="applyDetail" varStatus="vs">
                        <tr data-id="${applyDetail.columns.id}"
                            data-materialId="${applyDetail.columns.material_id}"
                            data-applyAmount="${applyDetail.columns.apply_amount}">
                            <td>${vs.count}</td>
                            <td>${applyDetail.columns.code}</td>
                            <td>${applyDetail.columns.material_name}</td>
                            <td>${applyDetail.columns.material_type}</td>
                            <td>${applyDetail.columns.material_brand}</td>
                            <td>${applyDetail.columns.material_spec}</td>
                            <c:if test="${tyoeor eq '1'}">
                                <td>${applyDetail.columns.apply_amount}</td>
                            </c:if>
                            <c:if test="${tyoeor ne '1'}">
                                <td>${applyDetail.columns.out_amount}</td>
                            </c:if>

<%--                            <c:if test="${user.userType ne '6' && user.userType ne '7'}">--%>
<%--                                <td>${applyDetail.columns.purchase_price}</td>--%>
<%--                            </c:if>--%>
                            <c:if test="${user.userType ne '8'}">
                                <td>${applyDetail.columns.sales_price}</td>
                            </c:if>
                            <td>${applyDetail.columns.material_unit}</td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            <c:if test="${'purchase' eq from}">
                <div class="layui-row">
                    <div class="layui-form-mid layui-word-aux" style="color: #0099cc !important;"><span>采购总额：</span><span class="red">${total}</span>元</div>
                </div>
            </c:if>

        </div>
    </div>
    <div class="operate-footer">
        <button type="button" class="layui-btn layui-btn-primary " onclick="closeDiv();">取消</button>
    </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', 'upload'], 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>
