<%--
  - FileName   : SuppSearchId.jsp
  - Author(s)  : 이성민
  -
  - Description: 계정 찾기
  --%>
  
<%@ 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.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="kr.co.hsnc.common.config.WAFConfig"%>
<%@ 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();
    ValueObject user = storage.getUser();
    String event = storage.getEvent();
    
    ValueObject Order = storage.getValueObject("Order");
    SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd");
	String nowTime = sd.format(new Date());
   
%>

<script type="text/javascript">


function doSetPop(signeddata){
	$("#fevent").val("GET_EMAIL");
	$("#signeddata").val(signeddata);
	var url = Modular.model.PageContext.CONTEXT_ROOT + "/supplier/portal/join/SuppSearchId_sheet.screen";
	Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
}

function SignData()
{
	// 환경설정 함수 콜
	var ret;
	var corp_reg_no = $.trim($("#p_corp_reg_no").val());
	var sCurrYmd = $("#hdn_cur_ymd").val();
	
	if($(':radio[name="p_job_div"]:checked').val() == undefined)
    {
	    alert("구분을 선택해 주세요.");
	    return;
    }
	else
    {
	    $("#p_job_div_gubun").val($(':radio[name="p_job_div"]:checked').val());
    }
	
	 if(corp_reg_no == "" || corp_reg_no.length != 10)
    {
	    alert("사업자 번호를 정확히 입력해 주세요");
	    return  $("#corp_reg_no").focus();
    }
 
	 
	 window.parent.doSignData(corp_reg_no, $(':radio[name="p_job_div"]:checked').val());
	
}
<!--
//-->
</script>

<script type="text/javascript">
/*예약함수*/
var sheet1;
var sheet1Row;
var sheet1PageNo = 1;
var pageLastRowIndex = 1;
var validationResult = false;
var filterShow = false;
	
	$(function(){
	    
	     
	    
	    $.gridInit = function(sheetName)
		{
	        var init_sheet = {};
			
			init_sheet.Cfg = {SearchMode:2, Page:30, MergeSheet:msHeaderOnly};
			init_sheet.Cols = [
										{Header:"Status",												Type:"Status", 		SaveName:"STATUS", 					Width:0, 		Align:"Center",		Hidden:"True"},
										{Header:"아이디",												Type:"Text", 			SaveName:"USER_ID_GET",			Width:100, 		Align:"Center", Edit:"false"},
										{Header:"담당자명",												Type:"Text", 			SaveName:"USER_NAME",				Width:100, 		Align:"Center", Edit:"false"},
										{Header:"핸드폰",												Type:"Text", 			SaveName:"HP",							Width:100, 		Align:"Center", Edit:"false"},
										{Header:"이메일",												Type:"Text", 			SaveName:"EMAIL",						Width:100, 		Align:"Center", Edit:"false"},
										{Header:"선택",													Type:"Text", 			SaveName:"SELECT_MAIL",			Width:100,	 	Align:"Center", Edit:"false"},
										{Header:"CORP_ID",											Type:"Text", 			SaveName:"CORP_ID",					Width:0,	 		Align:"Left", Edit:"false", Hidden:"True"},
										{Header:"USER_ID",											Type:"Text", 			SaveName:"USER_ID",					Width:0,	 		Align:"Left", Edit:"false", Hidden:"True"}
			                   		];			
			
			init_sheet.HeaderMode = {Sort:1};
			IBS_InitSheet(sheetName, init_sheet);
			sheetName.SetDataAutoTrim(0);
			sheetName.SetDataLinkMouse("SELECT_MAIL", 1);
// 			sheetName.SetEditable(false);
			
			sheetName.FitColWidth();
		}
	    
	  	//숫자만
	    $(document).on("keyup", "input:text[numberOnly]", function() {$(this).val( $(this).val().replace(/[^0-9]/gi,"") );});
	  	
	  	
	  	$("#btnSearch").click(function(){
	  	  	SignData();
	  	});
	  	
	  	$(document).on("keyup", "input:text", function(e) {
		    if (e.keyCode == 13)
	        {
		    	$("#btnSearch").click();    
	        }
		    
		});
	    
	});
	
	
	
	$(document).ready(function(){
	    
	    
	    $.gridInit(sheet1);
	    
	    if($("#fevent").val() == "")
        {
	        $("#sheet_area").css("display", "none");
        }
	    
	    
// 		autoResize();
	});
	
	
	function autoResize(){
		var t1_height = document.getElementById("search-table").scrollHeight + 24;
		var iframeHeight= document.body.scrollHeight - t1_height;   
		var iframeWidth= document.body.scrollWidth;   
		
		sheet1.SetSheetHeight(iframeHeight); 
	}
	
	
	function sheet1_OnSearchEnd(code, message)
	{
// 	    window.parent.$("#_searchId_iframe").animate({height: "+=150px"}, 500);

//  		window.parent.$("#_searchId_iframe").height("340");

		document.form1.isSubmit = false;
	    
	    $("#sheet_area").css("display", "");
	    
	    for(var i=1; i<=sheet1.LastRow(); i++)
    	{
	        sheet1.SetCellImage(i ,"SELECT_MAIL", "/img/buyer/btn/btn_mailto.gif");
    	}
	    
	    if($("#p_reSizeGubun").val() == "N")
        {
	        $("#p_reSizeGubun").val("Y");
	        window.parent.$("#_searchId").animate({top : "140px", height: "+=200px"}, 500);
	        window.parent.$("#_searchId_divcontent").animate({top : "140px", height: "+=200px"}, 500);
        }
	}
	
	function sheet1_OnClick(Row, Col, Value)
	{
	    var s_name = sheet1.ColSaveName(Col);
	    var f = document.form1;
	    
	    if(s_name == "SELECT_MAIL")
        {
	        $("#p_email").val(sheet1.GetCellValue(Row, "EMAIL"));
	        $("#p_corp_id").val(sheet1.GetCellValue(Row, "CORP_ID"));
	        $("#p_user_id").val(sheet1.GetCellValue(Row, "USER_ID"));
	        $("#p_hp").val(sheet1.GetCellValue(Row, "HP"));
	        $("#fevent").val("SEND_EMAIL");
	        
	        submitXmlRequest("/supplier/portal/join/SuppSearchId_form.screen", "SEND_EMAIL", f);
        }
	}
	
	function doResult(resultObj) 
	{
		try 
		{
		    if( resultObj.getRequestEvent() == "SEND_EMAIL") 
		    {
		        document.form1.isSubmit = false;
		        
		        alert("SMS,메일이 발송되었습니다.");
		        window.parent.location.reload();
// 		        winClose();
		    }
		}
		catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
	
</script>

<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>
<form id="form1" name="form1" method="post" modular:type="search" action="">
<INPUT type="hidden" name="fevent" id="fevent" value="">
<input type="hidden" name="signeddata" id="signeddata" value="" />
<input type="hidden" name="ESTI_SIGNDATA" id="ESTI_SIGNDATA" value="" />
<INPUT type='hidden' name="sItemInfo" value="">
<input type="hidden" name="p_job_div_gubun" id="p_job_div_gubun" value="" />
<input type="hidden" name="p_email" id="p_email" value="" />
<input type="hidden" name="p_corp_id" id="p_corp_id" value="" />  
<input type="hidden" name="p_user_id" id="p_user_id" value="" />
<input type="hidden" name="p_hp" id="p_hp" value="" />
<input type="hidden" name="hdn_cur_ymd"	value="<%=nowTime%>">
<input type="hidden" name="p_reSizeGubun" id="p_reSizeGubun" value="N" />    

	<div style="width: 100%; height: 100%; margin-top: 5px; margin-bottom: 15px;">
		<div style="margin-bottom: 5px;"><span style="text-align: center;">※ ID/PW 찾기 절차 ※ </span></div>
		<div><span style="text-align: center;"><b>1)사업자등록번호 입력 -> 2)공인인증서 확인 -> 3)담당자 이메일로 ID/PW 발송</b></span></div>
	</div>
	
	<table id="search-table" class="search-form-table">
	<colgroup>
		<col width="15%" />
		<col width="25%" />
		<col width="15%" />
		<col width="35%" />
		<col width="10%" />
	</colgroup>
	
	<tr>
		<th>구분</th>
		<td style="text-align: center;">
				<div style="float: left; margin-left: 15px;"><input type="radio" name="p_job_div" id="p_job_div_1" value="P"> 구매</div>
				<div style="float: right; margin-right: 15px;"><input type="radio" name="p_job_div" id="p_job_div_2" value="O"> 외주</div>
		</td>
		<th>사업자 번호</th>
		<td><input type="text" id="p_corp_reg_no" name="p_corp_reg_no" maxlength="10" numberOnly="true" style="width: 99%;"></td>
		<td style="text-align: center;"><span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">확인</a></span></td>
	</tr>
	
	</table>
	
	
	
	<div style="width: 600px; height:200px; margin-top: 5px;" id="sheet_area">
		<!-- 데이터 영역 : 시작 -->
		<!-- ibsheet7 그리드 생성 -->
			<script>createIBSheet("sheet1","600px", "200px");</script>
		<!-- 데이터 영역 : 종료 -->
	</div>

</form>
</div>

<div id="CONTROL_LAYER" style="position:absolute; z-index:10; visibility:hidden;">

</div>

