<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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,member-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="lib/html5.js"></script>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<script type="text/javascript" src="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>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 代理商管理 <span class="c-gray en">&gt;</span> 添加代理商 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
	<form method="post" class="form form-horizontal" id="form-agent-add">
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>代理商姓名：</label>
			<div class="formControls col-2">
				<input id="agentName" name="agentName" value="${agentTooth.agentName}" type="text" class="input-text" style="width:90%" placeholder="">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>代理商地址：</label>
			<div class="formControls col-2">
				<input id="agentAaddr" type="text" name="agentAddr" value="${agentTooth.agentAddr}" placeholder="" value="" class="input-text" style="width:90%">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>代理商电话：</label>
			<div class="formControls col-2">
				<input id="agentTel" type="text" name="agentTel" value="${agentTooth.agentTel}" placeholder="" class="input-text" style="width:90%">
			</div>
		</div>

		<div class="row cl">
			<label  class="form-label col-2"><span class="c-red">*</span>角色名称：</label>
			<div  class="formControls col-2">
			<span class="select-box">
			<select id="agentRoleId" name="agentRoleId" class="select">
				<c:if test="${! (empty roleInfoList) }">
					<c:forEach items="${roleInfoList }" var="list">
						<option  <c:if test="${agentTooth.agentRoleId == list.roleId}">selected = "selected"</c:if> value="${list.roleId}">${list.roleName}</option>
					</c:forEach>
				</c:if>
			</select>
			</span>
			</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">
				<div class="radio-box">
					<input type="radio" value="1" id="sex-1" <c:if test="${agentTooth.agentStatus == 1}">checked="checked"</c:if> name="agentStatus" datatype="*" nullmsg="请选择代理商状态！">
					<label for="sex-1">正在使用</label>
				</div>
				<div class="radio-box">
					<input type="radio" value="2" id="sex-2" <c:if test="${agentTooth.agentStatus == 2}">checked="checked"</c:if> name="agentStatus">
					<label for="sex-2">停止使用</label>
				</div>
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-3">
                <input type="hidden" value="${agentTooth.agentId}" name="agentId">
				<input class="btn btn-primary radius" onclick="checkForm()" type="button" id="submitBtn" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>
</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/tips.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/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
<script type="text/javascript">
    $(function(){

    });

    function checkForm(){
        //名称验证
        if(!commonTypeJdg('agentName',null,null,true)){
            layer.msg("代理商名称不能为空",{icon: 2,time:2000});
            return;
        }
        if(!commonLengthJdg('agentAaddr',1,50,null,true)){
            layer.msg("代理商地址不能为空长度为1-50位",{icon: 2,time:2000});
            return;
        }
        //代理商号码
        if(!commonTypeJdg('agentTel','mobile',null,true)){
            layer.msg("代理商号码不能为空!且须为手机号码格式",{icon: 2,time:2000});
            return;
        }

        $.ajax({
            url: '${pageContext.request.contextPath }/admin/agentTooth/update_agentInfo',
            type: "POST",
            dataType: "json",
            data: $("#form-agent-add").serialize(),
            error:function(data){
                layer.msg("修改失败</br>",{icon: 5,time:2000});
            },
            success:  function(data){
                if (data.status) {
                    layer.msg("修改成功</br>",{icon: 1,time:2000},function() {
                        window.location.href = '${pageContext.request.contextPath }/admin/agentTooth/select_agentInfo_list';
                    });
                } else {
                    layer.msg("修改失败</br>",{icon: 5,time:2000});
                }
            }
        });
    }

</script>
</body>
</html>