<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>修改机构信息</title>
</head>
<body>
<div class="pd-20">
	<form action="${pageContext.request.contextPath }/admin/channel/updateChannel" method="post" class="form form-horizontal" id="form-admin-add">
		<input type="hidden" value="${addChannelToken }" name="addChannelToken">
		<input type="hidden" value="${channel.channelId }" name="channelId">
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>渠道名称：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="${channel.channelName }" placeholder="" id="channel-name" name="channelName" nullmsg="渠道名称不能为空">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>渠道登陆用户名：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="${channel.channelAdminUserName }" placeholder="" id="channel-login-name" name="channelAdminUserName" nullmsg="渠道登陆用户名不能为空">
			</div>
			<div class="col-4"><span class="Validform_checktip Validform_wrong" style="display: none" id="channel-login-name-input">长度6-10位</span> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>初始密码(不设置代表不修改)：</label>
			<div class="formControls col-5">
				<input type="password" name="channelAdminPwd" id="newpassword" placeholder="密码" autocomplete="off" value="" class="input-text" nullmsg="密码不能为空">
			</div>
			<div class="col-4"><span class="Validform_checktip Validform_wrong" style="display: none" id="re-pwd-input">两次密码不一致</span>  </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>确认密码：</label>
			<div class="formControls col-5">
				<input type="password" placeholder="确认新密码" autocomplete="off" class="input-text" id="newpassword2" name="channelReAdminPwd">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red"></span>用户状态：</label>
			<div class="formControls col-5 skin-minimal">
				<c:choose>
					<c:when test="${channel.channelStatus == 1 }">
						<div class="radio-box">
							<input type="radio" value="1" id="sex-1" checked="checked" name="channelStatus" datatype="*" nullmsg="请选择用户状态！">
							<label for="sex-1">启用</label>
						</div>
						<div class="radio-box">
							<input type="radio" value="2" id="sex-2" name="channelStatus">
							<label for="sex-2">不启用</label>
						</div>
					</c:when>
					<c:otherwise>
						<div class="radio-box">
							<input type="radio" value="1" id="sex-1" name="channelStatus" datatype="*" nullmsg="请选择用户状态！">
							<label for="sex-1">启用</label>
						</div>
						<div class="radio-box">
							<input type="radio" value="2" id="sex-2" checked="checked" name="channelStatus">
							<label for="sex-2">不启用</label>
						</div>
					</c:otherwise>
				</c:choose>
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-3">渠道类型：</label>
			<div class="formControls col-5"> <span class="select-box" style="width:150px;">
				<select class="select" name="channelType" id="channel-type-select" size="1">
					<option value="0">其他渠道</option>
					<option value="1">电视渠道</option>
					<option value="2">传单渠道</option>
					<option value="3">活动渠道</option>
				</select>
				</span> </div>
		</div>
		<div class="row cl">
	      <div class="col-9 col-offset-3">
	        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
	      </div>
	    </div>
	</form>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script> 
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	// 此处自动选择
	$("#channel-type-select").val("${channel.channelType}");
	
	$("#form-admin-add").Validform({
		tiptype:2,
		callback:function(form){
			var newpassword2 = $("#newpassword2").val();
			var newpassword = $("#newpassword").val();
			var channelName = $("#channel-login-name").val();
			if (!(channelName.length >= 6 && channelName.length <= 10)) {
				$("#channel-login-name-input").show();
				return false;
			}
			if (newpassword != "") {
				// js校验，正则
				if (!(/^[A-Za-z]+$/.test(newpassword) && newpassword.length >= 6 && newpassword.length <= 20)) {
					$("#re-pwd-input").html("密码为6-16位字母或者数字组合");
					$("#re-pwd-input").show();
					return false;
				}
				if (newpassword2 != newpassword) {
					// 手动触发校验
					$("#re-pwd-input").show();
					return false;
				} else {
					$("#re-pwd-input").hide();
				}
				
				form[0].submit();
			}
			// form[0].submit();
		}
	});
});
</script>
</body>
</html>