<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>选择资方</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/lib/font/iconfont.css" />
    <style>
        html{
            background-color: #fff;
        }
    </style>
</head>
<body>
<div class="layui-form mb-0 pr-30" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin">
    <div id="textDiv" class="layui-card-body">
        <div class="layui-col-xs12 mb-10">
            <label class="layui-form-label"><i class="mark">*</i>资方名称：</label>
            <div class="layui-input-block">
                <select name="capitalId">
                    <option value="">请选择</option>
                    <c:forEach items="${capital}" var="pj">
                        <option value="${pj.id}">${pj.name}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item text-c operate-footer" >
        <button class="layui-btn " lay-submit lay-filter="component-form-element">确定</button>
        <button class="layui-btn layui-btn-primary" onclick="cancel()">取消</button>
    </div>
</div>

<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/font/iconfont.js"></script>
<script>
    layui.use(['form','jquery','layedit'], function () {
        $ = layui.$,
            form = layui.form,
            layer = layui.layer;
        form.on('submit(component-form-element)', function (data) {
            console.log(data.field);
            let capitalId = data.field.capitalId;
            if (isBlank(capitalId)) {
                layer.msg("请选择资方");
                return;
            }
            parent.layer.open({
                type: 2,
                content: '${ctx}/customerEntry/platform/addNewCustomerEntry?capitalId=' + capitalId,
                title: '信息登记',
                area: ['100%', '100%']
            })
            cancel();
        })
    });

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

    function cancel() {
        let index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
</body>
</html>
