<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Open Park</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="<%=path%>/static/css/font.css">
    <link rel="stylesheet" href="<%=path%>/static/css/xadmin.css">
    <script type="text/javascript" src="<%=path%>/static/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="<%=path%>/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=path%>/static/js/xadmin.js"></script>
    <script>
        var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
        $(function () {
            var flag = "${flag }";
            if (flag == 1) {
                parent.layer.alert("修改成功", {icon: 6}, function () {
                    parent.location.reload();
                    parent.layer.close(index); //执行关闭
                });
            }
        });
    </script>
</head>

<body>
<div class="x-body">
    <form class="layui-form" id="editForm" action="<%=path %>/user/update" method="post">
        <input type="hidden" value="${user.id}" name="id">
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>登录名称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userName" name="userName" required="" lay-verify="required"
                       autocomplete="off" value="${user.userName}" class="layui-input" readonly>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>登录密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="userPass" name="userPass" required="" lay-verify="required"
                       autocomplete="off" value="${user.userPass}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>姓名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userReal" name="userReal" required="" lay-verify="required"
                       autocomplete="off" value="${user.userReal}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="x-red">*</span>角色</label>
            <div class="layui-input-block">
                <c:forEach items="${roleList}" var="r">
                    <c:forEach items="${myRoles}" var="my">
                        <input type="checkbox" name="roles" lay-skin="primary" value="${r.id}" title="${r.role}" <c:if test="${r.id == my.roleid}">checked</c:if>>
                    </c:forEach>
                </c:forEach>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>性别
            </label>
            <div class="layui-input-inline">
                <input type="radio" name="userGender" class="layui-input" value="1" title="男" required="" lay-verify="required" <c:if test="${user.userGender == 1}">checked</c:if>>
                <input type="radio" name="userGender" class="layui-input" value="2" title="女" required="" lay-verify="required" <c:if test="${user.userGender == 2}">checked</c:if>>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>联系电话
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userPhone" name="userPhone" required="" lay-verify="required"
                       autocomplete="off" value="${user.userPhone}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>邮箱
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userEmail" name="userEmail" required="" lay-verify="required"
                       autocomplete="off" value="${user.userEmail}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button class="layui-btn" lay-filter="edit" lay-submit="">
                修改
            </button>
        </div>
    </form>
</div>
</body>

</html>