<%--
  - FileName   : GongCategoryAddPopup.jsp
  - Author(s)  : 
  - Date       : 2011-12-23
  - Copyright  : Copyright (c) 2002-2003 www.hwenc.com, Inc.
  -
  - Description: ASP Sync List 팝업
  --%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ include file="/jsp/work/taglib.jsp" %>

<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
<%
	ctx.init(request, response);
	HandlerStorage storage = ctx.getHandlerStorage();
	ValueObject params	= storage.getParams();
	
	String cate_gubun =   (String) storage.getObject("cate_gubun");
	
	
	String depth =   (String) storage.getObject("depth"); 
	String item_cd =   (String) storage.getObject("item_cd"); 
	
	String returnMessage = storage.getMessage();
%>

<script type="text/javascript">
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/gi, "");
};
</script>

<script type="text/javascript">


$(function(){
    
    $("#btn_close").click(function(){
        winClose();
    });
    
    $("#btn_save").click(function(){
		var f = document.form1;
		
		if(f.levelDepth.value.trim() == "")
		{
			alert("Level Depth를 입력해 주세요");
			return f.levelDepth.focus();
		}
		else if(f.categoryCode.value == "")
		{
			alert("그룹코드를 입력해 주세요");
			return f.categoryCode.focus();
		}
		else if(f.categoryNm.value == "")
		{
			alert("그룹명을 입력해 주세요");
			return f.categoryNm.focus();
		}
		
		if ( stringByteSize4UTF($("#categoryCode").val()) > 4 ) {
			alert("그룹코드는 4자리까지 입력할 수 있습니다.");
	    	return;
		}
		
		
		f.fevent.value = "SAVE_CATEGORY";
		
		submitXmlRequest("/common/GongCategoryAddPopup_form.screen", "SAVE_CATEGORY", f);
		
    });
    
    
});
	
	
	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "SAVE_CATEGORY" ) {
				if( resultObj.getSuccess() ) {
					alert("저장되었습니다.");
				}
				else {
					alert(resultObj.getMessage());
				}
				document.form1.isSubmit = false;
				winClose();
			}
		}
		catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}
	
</script>


<form name="form1" method="post">
<input type="hidden" name="fevent" id="fevrnt" value="">

<INPUT type="hidden" name="depth" value="<%=depth%>">
<INPUT type="hidden" name="item_cd" value="<%=item_cd%>">


<table border="0" cellspacing="0" cellpadding="0" width="90%" id="search-table">
	<!-- 검색조건 영역 : 시작 -->
	<tr>
		<td height="1">
			<table cellspacing="1" cellpadding="0" class="search-form-table">
				<col width="20%">
				<col width="50%">
				<col width="30%">

				<tr height="25"> 
    			<!-- 검색조건 타이틀 1 -->
    				<th>
    					그룹코드
    				</th>
   					<td>
  						<input type="text" class="input" style="width: 98%;" name="categoryCode" value="<%=depth.equals("1") ?  "00" : item_cd + "00"%>" readonly/>
					</td>
				    <td rowspan="3" class="search_button" align="center"> 
				    	<span class="btnSearch center"><a href="javascript:void(0);" id="btn_save">저장</a></span>
       					<span class="btnSearch center"><a href="javascript:void(0);" id="btn_close">닫기</a></span>
    				</td>
  				</tr>
  				<tr height="25"> 
  					<th>
    					그룹명
    				</th>
    				<td>
  						<input type="text" class="input" style="width: 98%;" name="categoryNm" value=""  />
					</td>
  				</tr>
  				<tr height="25">
  					<th>
    					Level Depth
    				</th>
  					<td>
  						<input type="text" class="input" style="width: 98%;" name="levelDepth" value="<%=depth %>" readonly="readonly"/>
  					</td> 
  				</tr>
			</table>
		</td>
	</tr>
	<!-- 검색조건 영역 : 종료 -->

	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
	<tr>
		<td height="1">
		</td>
	</tr>
	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 종료 -->
</table>
</form>