<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ page import="java.io.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page import="com.eactive.eai.rms.common.login.SessionManager"%>
<%@ page import="com.eactive.eai.common.util.SystemUtil"%>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setHeader("Expires", "0");
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="/jsp/common/include/css.jsp"/>
<jsp:include page="/jsp/common/include/script.jsp"/>
<script language="javascript" >

var roleString	= "<%=SessionManager.getRoleIdString(request)%>";
var devSvr		= <%=SystemUtil.isDevServer()%>;
var prdSvr		= <%=SystemUtil.isProdServer()%>;
var stgSvr		= <%=SystemUtil.isStagingServer()%>;
var svrType		= '';

$(document).ready(function() {	
	
 	var url = '<c:url value="/bap/admin/adapter/adapterMan.json" />';
	var url_view = '<c:url value="/bap/admin/adapter/adapterMan.view" />';
    var gridPostData = getSearchForJqgrid("cmd","LIST"); //jqgrid에서는 object 로 
    
    /* if(devSvr) {
		svrType = "stg";
	} else if (stgSvr){
		svrType = "prod";
	} else if (!prdSvr){
		svrType = "dev";
	}*/
    
    $('#grid').jqGrid({
		datatype:"json",
		mtype: 'POST',
		url: '<c:url value="/bap/admin/adapter/adapterMan.json" />',
		postData : gridPostData,
		colNames:['어댑터 그룹명',
                  '어댑터 그룹설명',
                  '어댑터 사용여부'
                  ],
		colModel:[
				{ name : 'ADPTRBZWKGROUPNAME'  , align:'left'	,sortable:false  },
				{ name : 'ADPTRBZWKGROUPDESC'  , align:'left'  },
				{ name : 'ADPTRUSEYN'          , align:'center',
				          formatter: function (cellvalue) {
				              if ( cellvalue == '1' ) {
				                  return '사용';
                              } else {
                                  return '<span style="color:red">사용안함</span>';
                              }
                          }
				}],
        jsonReader: {
             repeatitems:false
        },	          
		pager : $('#pager'),
		page : '${param.page}',
		rowNum : '${rmsDefaultRowNum}',
	    autoheight: true,
	    height: $("#container").height(),
		autowidth: true,
		viewrecords: true,
		/* multiselect: true,
		multiboxonly: false, */
		rowList : eval('[${rmsDefaultRowList}]'),
		gridComplete:function (d){
			var colModel = $(this).getGridParam("colModel");
			for(var i = 0 ; i< colModel.length; i++){
				$(this).setColProp(colModel[i].name, {sortable : false});	//그리드 헤더 화살표 삭제(정렬X)		
			}
		},			
		ondblClickRow: function(rowId) {
			var rowData = $(this).getRowData(rowId); 
            var adptrBzwkGroupName = rowData['ADPTRBZWKGROUPNAME'];
            var url = '<c:url value="/bap/admin/adapter/adapterMan.view" />';
            url = url + '?cmd=DETAIL';
            url = url + '&page='+$(this).getGridParam("page");
            url = url + '&returnUrl='+getReturnUrl();
            url = url + '&menuId='+'${param.menuId}';
			//검색값
            url = url + '&'+getSearchUrl();
            //key값
            url = url + '&adptrBzwkGroupName='+adptrBzwkGroupName;
            goNav(url);
        }      
	});
	
	
	resizeJqGridWidth('grid','content_middle','1000');

	$("#btn_search").click(function(){
		var postData = getSearchForJqgrid("cmd","LIST"); //jqgrid에서는 object 로 
		$("#grid").setGridParam({ postData: postData ,page : "1" }).trigger("reloadGrid");
	});
	$("#btn_new").click(function(){
		var url = '<c:url value="/bap/admin/adapter/adapterMan.view"/>';
		url = url + '?cmd=DETAIL';
		url = url + '&page='+$("#grid").getGridParam("page");
		url = url + '&returnUrl='+getReturnUrl();
        url = url + '&menuId='+'${param.menuId}';
		//검색값
        url = url + '&'+getSearchUrl();

        goNav(url);
	});
	
	$("input[name^=search]").keydown(function(key){
		if (key.keyCode == 13){
			$("#btn_search").click();
		}
	});
	
	buttonControl();
});
 
</script>
</head>
	<body>		
		<div class="right_box">
			<div class="content_top">
				<ul class="path">
					<li><a href="#">${rmsMenuPath}</a></li>					
				</ul>					
			</div><!-- end content_top -->
			<div class="content_middle" id="content_middle">
				<div class="search_wrap">
					<!--  <img src="<c:url value="/img/btn_clone.png"/>" alt="" id="btn_clone_stg" level="W" /> -->
					<!--  <img src="<c:url value="/img/btn_clone_prod.png"/>" alt="" id="btn_clone_prod" level="W" /> -->
					<!--  <img src="<c:url value="/img/btn_clone_dev.png"/>" alt="" id="btn_clone_dev" level="W" /> -->
					<img src="<c:url value="/img/btn_new.png"/>" alt="" id="btn_new" level="W" />
					<%-- <img src="<c:url value="/img/btn_delete.png"/>" alt="" id="btn_delete" level="W" /> --%>
					<img src="<c:url value="/img/btn_search.png"/>" alt="" id="btn_search" level="R" />		
				</div>
				<div class="title">어댑터 관리<span class="tooltip">일괄전송에서 사용하는 어댑터 목록(Server/Non-permanent Client)</span></div>
				
				<table class="search_condition" cellspacing=0;>
					<tbody>	
						<tr>
							<th style="width:100px;">어댑터 그룹명</th>
							<td><input type="text" name="searchAdptrBzwkGroupName" value="${param.searchAdptrBzwkGroupName}"></td>					
							<th style="width:100px;">어댑터 그룹설명</th>
							<td><input type="text" name="searchAdptrBzwkGroupDesc" value="${param.searchAdptrBzwkGroupDesc}"></td>
						</tr>	
					</tbody>
				</table>
				
				<table id="grid" ></table>
				<div id="pager"></div>
				
			</div><!-- end content_middle -->
		</div><!-- end right_box -->				
	</body>	
</html>

