<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : ExtmallNotiinfoForm.html
 * @desc    : 제휴몰고시정보관리 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2020.11.06   gagamel     최초 작성
 *******************************************************************************
 -->
	<div id="main">
		<!-- 메인타이틀 영역 -->
		<div class="main-title">
		</div>
		<!-- //메인타이틀 영역 -->
		
		<!-- 메뉴 설명 -->
		<div class="infoBox menu-desc">
		</div>
		<!-- //메뉴 설명 -->
		
		<!-- 검색조건 영역 -->
		<div class="panelStyle">
			<form id="searchForm" name="searchForm" action="#" th:action="@{'/ocm/extmall/notiinfo/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
				<table class="frmStyle" aria-describedby="검색조건">
					<colgroup>
						<col style="width:10%;"/>
						<col/>
					</colgroup>
					<tr>
						<th>제휴몰벤더</th>
						<td>
							<select name="vendorId">
								<option th:if="${vendorList}" th:each="oneData, status : ${vendorList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
							</select>
						</td>
					</tr>
				</table>
				
				<ul class="panelBar">
					<li class="center">
						<button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
						<button type="button" class="btn btn-gray btn-lg" onclick="$('#searchForm')[0].reset();">초기화</button>
					</li>
				</ul>
			</form>
		</div>
		<!-- 검색조건 영역 -->

		<!-- 리스트 영역 -->
		<div class="panelStyle">
			<!-- 버튼 배치 영역 -->
			<ul class="panelBar">
				<li class="right">
					<button type="button" class="btn btn-default btn-lg" id="btnExcel">엑셀다운로드</button>
				</li>
			</ul>
			<!-- //버튼 배치 영역 -->
			
			<div id="gridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
		</div>
		<!-- //리스트 영역 -->
	</div>

<script th:inline="javascript">
/*<![CDATA[*/
	let vendorList = gagajf.convertToArray([[${vendorList}]]);

	let columnDefs = [
		{
			headerName: "제휴몰벤더", field: "vendorId", width: 200, cellClass: 'text-center',
			valueGetter: function (params) { return gagaAgGrid.lookupValue(vendorList, params.data.vendorId); }
		},
		{headerName: "제휴몰고시분류코드", field: "extmallNiClsfCd", width: 200, cellClass: 'text-center'},
		{headerName: "제휴몰고시분류명", field: "extmallNiClsfNm", width: 200, cellClass: 'text-center'},
		{headerName: "제휴몰고시항목코드", field: "extmallNiItemCd", width: 200, cellClass: 'text-center'},
		{headerName: "제휴몰고시항목명", field: "extmallNiItemNm", width: 300},
		{headerName: "자사몰고시분류", field: "selfmallNiClsfNm", width: 200, cellClass: 'text-center'},
		{headerName: "자사몰고시항목", field: "selfmallNiItemNm", width: 300}
	];

	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);

	// 검색
	$('#btnSearch').on('click', function() {
		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
	});
	
	// 엑셀다운로드
	$('#btnExcel').on('click', function() {
		gagaAgGrid.exportToExcel('제휴몰고시정보 목록', gridOptions);
	});

	$(document).ready(function() {
		// Create a agGrid
		gagaAgGrid.createGrid('gridList', gridOptions);
	});
/*]]>*/
</script>

</html>
