<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
$(function()
{
	$("#getIPList").click(function()
	{
		var s="";
		$(".getIP").each(function()
		{
			s+="Line_ip="+$(this).val()+"&";
		});
		$.ajax(
		{
			url : "IdcLineIPWrite.jso",
			type : "post",
			data : s,
			dataType : "json",
			timeout : "30000",
			cache : false,
			success : function(data)
			{
				var j = data[0].ip;
				for(var i=0;i<j.length;i++)
				{
					var tr = $("<tr>");
					var td = $("<td>");
					var lable = $("<label>");
					
					lable.html(j[i].ip_address);
					td.append(lable);
					td.append($("<br>"));
					tr.append(td);
					$("#ipTable").append(tr);
				}
			},
			error : function()
			{
				alert("실풰")
			}
		});
		$("#myModalBtn").click();
	});
	
});
</script>
<!-- IP가져오기  -->
<script type="text/javascript">
$(function()
{
	//getip에다가 글쓸때
	$("#getIP").on("input",function()
	{	
		var ul=$("#getIPul");
		ul.empty();
		
		$.ajax(
		{
			url:"IdcGetIPList.jso",
			data:"getIP="+$(this).val(),
			dataType:"json",
			type:"post",
			cache:false,
			success:function(data)
			{
				createIPList(data[0].a,ul);
			},
			error:function()
			{
				alert(" 에서의 Error");
			}
		});
		
		ul.show();
	});
	//ip리스트 눌렀을 경우 
	$(document).on("click","#getIPul > li > a",function()
	{
		$("#getIP").val($(this).attr("value"));
		$("#getIPul").hide();
	});
});
var createIPList=function(data,ul)
{
	for(var i=0;i<data.length;i++)
	{
		var li=$("<li>");
		var a=$("<a>");
		a.addClass("btn btn-default").attr("value",data[i]).html(data[i]);
		li.append(a);
		ul.append(li);
	}
}
</script>
<!-- 여기가 본 페이지이다 -->
<div class="row">
	<div class="col-lg-8">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4><i class="fa fa-desktop fa-fw"></i> 회선 등록</h4>
			</div>
			<div class="panel-body">
   				<form action="IdcLineWrite.lin" method="POST">
	   				<div class="table-responsive">
						<table class="table table-bordered table-hover table-striped">
							<thead>
							</thead>
							<tbody>
								<tr>
									<td>회선번호</td>
									<td><input type="text" name="line_code"></td>
								</tr>
								<tr>
									<td>회선구분</td>
									<td>
										<input type="radio" name="line_case" value="일반" checked="checked">일반
										<input type="radio" name="line_case" value="전용">전용
									</td>
								</tr>
								<tr>
									<td>가용여부</td>
									<td>
										<input type="radio" name="line_able" value="사용가능" checked="checked">O
										<input type="radio" name="line_able" value="사용불가">X
									</td>
								</tr>
								<tr>
									<td>차단</td>
									<td>
										<input type="radio" name="line_block" value="정상" checked="checked">정상
										<input type="radio" name="line_block" value="차단">차단
									</td>
								</tr>
								<tr>
									<td>회선 IP</td>
									<td><input type="text" name="line_ip"></td>
								</tr>
								<tr>
									<td>IP할당일/IP해제일</td>
									<td><input type="date" name="line_user_allocatingday">/
											<input type="date" name="line_user_endday">
									</td>
								</tr>
								<tr>
									<td>고객명</td>
									<td><input type="text" name="line_client_name"></td>
								</tr>
								<tr>
									<td>메인IP</td>
									<td><input type="text" name="line_mainip"></td>
								</tr>
								<tr>
									<td>서브IP1</td>
									<td><input type="text" name="line_subip1"></td>
								</tr>
								<tr>
									<td>서브IP2</td>
									<td><input type="text" name="line_subip2"></td>
								</tr>
								<tr>
									<td>서브IP3</td>
									<td><input type="text" name="line_subip3"></td>
								</tr>
								<tr>
									<td colspan="2">
										<input class="btn btn-outline btn-primary" type="submit" value="등록">
										<a class="btn btn-outline btn-default" href="IdcLineList.lin">취소</a>
									</td>
								</tr>
							</tbody>
							<tfoot>
							</tfoot>
						</table>
					</div>
					<!-- table-responsive -->
				</form>
			</div>
			<!-- panel-body -->
		</div>
		<!-- panel panel-default -->
	</div>
	<!-- col-lg-8 -->
	<div class="col-lg-8">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h5><i class="fa fa-desktop fa-fw"></i>라인 입력 창</h5>
			</div>
			<div class="panel-body">
	   			<div class="table-responsive">
					<table class="table table-bordered table-hover table-striped">
						<thead>
						</thead>
						<tbody>
						</tbody>
						<tfoot>
						</tfoot>
					</table>
				</div>
				<!-- table-responsive -->
			</div>
			<!-- panel-body -->
		</div>
		<!-- panel panel-default -->
	</div>
	<!-- col-lg-4 -->
</div>
<!-- row -->
<!-- /#page-wrapper -->
