userView.php 4.84 KB
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminUser.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftUserManage.php" ?>
<?
	$obj		= new AdminUser($_REQUEST, "");
	//$userInfo	= $obj->getInfoOfUser();
	
	$rurl		= pack("H*", $_REQUEST["rurl"]) ;
?>
<script language="javascript">
	var _rurl = "<?=$rurl != "" ? $rurl : 0?>";
	var _no = "<?=$_REQUEST[no] != "" ? $_REQUEST[no] : 0?>";


	$(document).ready(function(){

		$(".jCancel").click2(function(){
			location.href = _rurl;
		});


		$(".jDelUser").click2(function(){
			var noArr = new Array(_no);

			if(confirm("정말 삭제하시겠습니까?"))
			{
				deleteUser(noArr);
			}
		});
	
		$( '[name=userID]' ).live("blur keyup", function() {
			  $(this).val( $(this).val().replace( /[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/g, '' ) );
			});
		
		$( '[name=userPwd]' ).live("blur keyup", function() {
			  $(this).val( $(this).val().replace( /[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/g, '' ) );
			});


		
		$(".jAdd").click2(function(){
			var data = $("#jData").serialize();

			var userID=$("[name=userID]").val();
			var userPwd=$("[name=userPwd]").val();
			var userName=$("[name=userName]").val();
			var nickName=$("[name=nickName]").val();
			var userTel1=$("[name=userTel1]").val();
			var userTel2=$("[name=userTel2]").val();
			var userTel3=$("[name=userTel3]").val();
			if(userID=="" || userPwd=="" || userName=="" || nickName=="" || userTel1=="" || userTel1=="" || userTel1==""){
				alert(" 항목을 모두 입력해 주십시오");
				return;
			}

			if(userID.length<6){
				alert("아이디는 영문+숫자조합 6자리 이상이어야 합니다");
				return;
			}

			if(userPwd.length<4){
				alert("비밀번호는 영문+숫자조합 4자리 이상이어야 합니다");
				return;
			}
			
			if(confirm("직원회원 계정을 등록하시겠습니까?")){
				$.ajax({
					url : "/action_front.php?cmd=AdminUser.saveManager",
					async : false,
					cache : false,
					dataType : "json",
					data : data,
					success : function(data){
						alert(data.returnMessage);
						if(data.returnCode == "1")
							location.href=_rurl;
						
						/*
						if(_no != "")
							location.reload();
						else
							location.href = _rurl;
						*/
					}
				});
			}
			
			
		});

		$(".jCheckIDRedundancy").click2(function(){
			var data = $("#jData").serialize();
			$.ajax({
				url : "/action_front.php?cmd=AdminUser.checkIDRedundancy",
				async : false,
				cache : false,
				dataType : "json",
				data : data,
				success : function(data){
					alert(data.returnMessage);
				}
			});
			
		});

		$(".jCheckNickRedundancy").click2(function(){
			var data = $("#jData").serialize();
			$.ajax({
				url : "/action_front.php?cmd=AdminUser.checkNickRedundancy",
				async : false,
				cache : false,
				dataType : "json",
				data : data,
				success : function(data){
					alert(data.returnMessage);
				}
			});
			
		});

		

	}) ;



	function deleteUser(noArr)
	{
		$.ajax({
			url : "/action_front.php?cmd=AdminUser.deleteUser",
			async : false,
			cache : false,
			dataType : "json",
			data : {
				"no"	: noArr
			},
			success : function(data){
				//alert("삭제되었습니다");
				location.href = _rurl;
			}
		});
	}

</script>

<div id="Contents"  class="notice">

	<h1>직원 등록</h1>

	<!-- location area -->
	<h2>
		회원 관리 > 직원  > <span>등록</span>
	</h2>
	<!-- location area -->

	<form id="jData">
	<div class="jData"  style="width:50%;">
		<table class="datav" style="width:100%;">
			<colgroup>
				<col width="30%" />
				<col width="70%" />
			</colgroup>
			<tr>
				<th style="height:25px;">아이디</th>
				<td >
					<input name="userID" type="text" style="width:200px"/>
					<span class="button bigrounded blue jCheckIDRedundancy" style="color:white; width:70px">&nbsp;중복확인&nbsp;</span> 
				</td>
			</tr>
			<tr>
				<th style="height:25px;">비밀번호</th>
				<td >
				<input name="userPwd" type="text" style="width:200px"/>
				</td>
			</tr>
			<tr>
				<th style="height:25px;">직원명</th>
				<td class="l">
				<input name="userName" type="text" style="width:200px" />
				</td>
			</tr>
			<tr>
				<th style="height:25px;">닉네임</th>
				<td class="l">
				<input name="nickName" type="text" style="width:200px" />
				<span class="button bigrounded blue jCheckNickRedundancy" style="color:white; width:70px">&nbsp;중복확인&nbsp;</span> 
				</td>
			</tr>
			<tr>
				<th style="height:25px;">전화번호</th>
				<td class="l">
				<input name="userTel1" type="text" style="width:50px"/>&nbsp;  -  &nbsp;<input name="userTel2" type="text" style="width:50px"/>&nbsp;  -  &nbsp;<input name="userTel3" type="text" style="width:50px"/>
				</td>
			</tr>
			
		</table>

		<div class="btngroupcenter">
			<span class="button bigrounded blue jAdd">등록</span>
		</div>

	</div>
	</form>
</div>