<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>

<script src="IDC/js/setToken.js"></script>
<script>
$(function(){	
	$("form[name='form1']").submit(function(){
		var client_phone1 = $("#client_phone1").val();
		var client_email1 = $("#client_email1").val();				
		
	});
	$("#client_name").bind("input",function()
	{
		var b = $(this).val();
		var d = "?&client_name="+b;
		$.get("IdcCheckClientName.jso",d,function(j)
		{
			var data = j.a;
			if(b.toUpperCase()==data.toUpperCase())
				$("#checkName").val("사용불가");
			else
				$("#checkName").val("사용가능");
		});	
	});
	$("#mySub").click(function()
	{
		if($("#checkName").val()=="사용불가")
			alert("고객명이 중복됩니다.");
		else
			$("#cform1").submit();
	});
});
</script>


<!-- 여기가 본 페이지이다 -->
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4><i class="fa fa-desktop fa-fw"></i>신규 고객 등록</h4>
			</div>
			<div class="panel-body">
	   			<div class="table-responsive">
		   			<form id="cform1" name="form1" class="form-inline" role="form" action="IdcClientDBWrite.cli" method="POST">
						<input type="hidden" id="token" name="token">
						<table class="table table-bordered table-hover table-striped" id="table1">
							<!-- 이곳에 테이블을 넣으시오 -->
							<thead>
							</thead>
							<tbody>
								<tr>
									<td>고객명</td>
									<td>
										<input type="text" id="client_name" name="client_name">
										사용여부 : <input type="text" id="checkName" readonly="readonly"> ( 중요 ! <font color=red>공백(띄어쓰기) 사용 금지</font> : 고객명 입력시 스페이스바 입력을 하지마세요! )
									</td>
								</tr>
								<tr>
									<td>리셀러 할인</td>
									<td>										
										<select name="client_reseller">
											<option value="0">0</option>
											<option value="5">5</option>
											<option value="10">10</option>
											<option value="15">15</option>
											<option value="20">20</option>
											<option value="25">25</option>
											<option value="30">30</option>																	
										</select>
										%
									</td>
								</tr>
								<tr>
									<td>연락처1</td>
									<td><input type="text" name="client_phone1" id="client_phone1" size="60"> ( 숫자 or - (하이픈) 이외 문자 사용금지 )</td>
								</tr>
								<tr>
									<td>연락처2</td>
									<td><input type="text" name="client_phone2" id="client_phone2" size="60"> ( 숫자 or - (하이픈) 이외 문자 사용금지 )</td>
								</tr>
								<tr>
									<td>E-mail1</td>
									<td><input type="text" name="client_email1" id="client_email1" size="60"></td>
								</tr>
								<tr>
									<td>E-mail2</td>
									<td><input type="text" name="client_email2" id="client_email2" size="60"></td>
								</tr>
								<tr>
									<td>등록일</td>
									<td><input type="date" name="client_receive_date" id="client_receive_date" value="${curdate}"></td>
								</tr>
								<tr>
								</tr>								
								<tr>
									<td>비  고</td>
									<td>
										<textarea name="client_note" rows="8" cols="100"></textarea>
									</td>
								</tr>
								<tr>
									<td colspan="2" align="center">
										<div class="input-group-btn">
											<input class="btn btn-outline btn-primary" id="mySub" type="button" value="등록하기">
											<a class="btn btn-outline btn-default" href="IdcClientDBList.cli">취소</a>
										</div>
									</td>
								</tr>
							</tbody>
						</table>
					</form>
				</div><!-- table-responsive -->
			</div>
			<!-- panel-body -->
		</div>
		<!-- panel panel-default -->
	</div>
	<!-- col-lg-12 -->
</div>
<!-- row -->
<!-- /#page-wrapper -->
