<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>系统用户管理</title>
<meta
	content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
	name='viewport'>

<!-- Theme style -->
<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/scripts/lib/layui/layui.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/userForm/userForm.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/scripts/zTree/css/zTreeStyle/zTreeStyle.css'/>" rel="stylesheet"
	type="text/css" />

<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/zTree/js/jquery.ztree.core-3.5.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/zTree/js/jquery.ztree.excheck-3.5.js'/>"></script>

<script type="text/javascript" src="<c:url value='/scripts/lib/layui/layui.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/lib/template-native.js'/>"></script>

</head>
<!-- <style>.row{height:auto;overflow: hidden;}.box .box-header{padding-bottom: 0px;}</style> -->
<body>
	<div class="bread-wp">
			系统管理  >  用户管理配置
	</div>
	<div class="right-content">
		  <input type="password" class="hidden" style="display: none"/>
	<input type="hidden" name="actType" value="save" id="actType">
	 <input type="hidden" name="id" value="${id}" id="id" >
	<input type="hidden" name="funcid" value="${funcid}" id="funcid">
	<input type="hidden" value="${ctx}" id="contextPath">
	<input type="hidden" value="${user.userType}" id="userType_">
		<div class="main-content-mode-wp" >
			<h1 class="form-title">用户基本信息</h1>
			<div class="main-content clearfloat">
				<div class="main-content-left">
					<div class="form-item">
						<span class="tip required">用 户 名:</span>

						<input type="text" class="hidden" style="width: 1px; height: 1px; position: absolute; border: 0px; padding: 0px;"/>
						<c:if test="${not empty id}"><input class="item-input user-name" type="text" placeholder="请输入用户名"  AUTOCOMPLETE="off" /></c:if>
						<c:if test="${empty id}"><input class="item-input user-name" type="text" placeholder="请输入用户名"  AUTOCOMPLETE="off" /></c:if>
						<input type="text" class="hidden" style="width: 1px; height: 1px; position: absolute; border: 0px; padding: 0px;"/>

					</div>
					<div class="form-item ">
						<span class="tip required">登录密码:</span>

						<input type="password" class="hidden" style="width: 1px; height: 1px; position: absolute; border: 0px; padding: 0px;"/>
						<input class="item-input user-psd"  type="password" placeholder="请输入登录密码" AUTOCOMPLETE="new-password" />
					</div>
					<div class="form-item">
						<span class="tip required">姓      名:</span>
						<input class="item-input user-nm"   type="text"  placeholder="请输入姓名" AUTOCOMPLETE="off"/>
					</div>
					<div class="form-item">
						<span class="tip required">账号类型:</span>
						<select class="item-input" id="userType" name="userType" disabled="disabled" style="cursor: not-allowed;">
							<option value="">请选择类型</option>
							<%-- 新增 --%>
							<c:if test="${empty id}">
								<c:if test="${user.userType eq 1}"><option value="2" selected="selected">系统管理员</option></c:if>
								<c:if test="${user.userType eq 2}"><option value="3" selected="selected">校区管理员</option></c:if>
								<c:if test="${user.userType ge 3}"><option value="4" selected="selected">普通管理员</option></c:if>
							</c:if>
							<%-- 修改 --%>
							<c:if test="${not empty id}">
								<option value="1" >超级管理员</option>
								<option value="2" >系统管理员</option>
								<option value="3" >校区管理员</option>
								<option value="4" >普通管理员</option>
							</c:if>
						</select>
					</div>
					<div class="form-item phone-item">
						<span class="tip">手机号码:</span>
						<input class="item-input user-phone"  type="text" placeholder="请输入手机号码" AUTOCOMPLETE="off"/>
						<div class="phone-tip">注：录入后可用手机号码登录</div>
					</div>
					<div class="form-item" style="display: none;">
						<span class="tip">选择职位:</span>
						<select class="item-input position-select">
							<option value="">请选择职位</option>
						</select>
					</div>
				</div>

				<c:choose>
					<%-- 新增 并且 新增用户不为admin显示--%>
					<c:when test="${empty id && user.userType ne 1}">
						<div id="companyDiv" class="main-content-right">
					</c:when>
					<%-- 其它情况隐藏 --%>
					<c:otherwise>
						<div id="companyDiv" class="main-content-right"  style="display: none;">
					</c:otherwise>
				</c:choose>
					<c:choose>
						<c:when test="${user.userType == 3}">
							<div class="form-item " id="company" style="display: none">
								<span class="tip">所属运营中心:</span>
								<select class="item-input" name="companyid" id="companyid" >
									<c:forEach items="${companyList}" var="obj">
										<option value="${obj.id }" selected>${obj.name}</option>
									</c:forEach>
								</select>
							</div>
						</c:when>
						<c:otherwise>
							<div class="form-item " id="company">
								<span class="tip">所属运营中心:</span>
								<select class="item-input" name="companyid" id="companyid">
									<option value="">请选择运营中心</option>
									<c:forEach items="${companyList}" var="obj">
										<option value="${obj.id }">${obj.name}</option>
									</c:forEach>
								</select>
							</div>
						</c:otherwise>
					</c:choose>

						<div class="form-item"  id="dept" style="display: none;">
							<span class="tip">部      门:</span>
							<select class="item-input" id="deptid">
								<option value="">请选择部门</option>
							</select>
						</div>
					<c:choose>
						<c:when test="${user.userType == 3}">
							<div class="form-item" id="project" style="display: none;">
								<span class="tip">选择管辖校区</span>
								<div class="box-body" style="height:auto;overflow:auto;">
									<ul id="tree" class="ztree">
									</ul>
								</div>
							</div>
						</c:when>
						<c:otherwise>
							<div class="form-item" id="project">
								<span class="tip">选择管辖校区</span>
								<div class="box-body" style="height:auto;overflow:auto;">
									<ul id="tree" class="ztree">
									</ul>
								</div>
							</div>
						</c:otherwise>
					</c:choose>
					<c:choose>
						<%-- 新增 并且 新增用户为普通管理员类型 显示角色--%>
						<c:when test="${empty id && user.userType ge 3}">
							<div id="role" class="form-line role-wp clearfloat">
						</c:when>
						<%-- 其它情况隐藏角色 --%>
						<c:otherwise>
							<div id="role" class="form-line role-wp clearfloat" style="display: none;">
						</c:otherwise>
					</c:choose>
							<span class="tip">系统角色</span>
							<div class="role-con">
								<div class="role-list">
								</div>
								<div class="add-role-btn">添加系统角色 +</div>
							</div>
						</div>

				</div>
			</div>
			<div class="operate-btn-wp">
				<button class="btn-red-width90 sure-btn">确定保存</button>
				<button class="btn-white-width90 cancel-btn" onclick="window.location.href='<c:url value='/admin/users/list?funcid=${funcid}' />'">取消</button>
			</div>
	    </div>
	</div>
	<script type="text/javascript" src="<c:url value='/scripts/admin/usersform.js'/>"></script>
</body>
</html>
