<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : GoodsPopupListForm.html
 * @desc    : 상품 조회 팝업
 *============================================================================
 * SISUN
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2020.10.26   eskim       최초 작성
 *******************************************************************************
 -->
	<div class="modalPopup" data-width="1700">
	<div class="panelStyle">
		<!-- TITLE -->
		<div class="panelTitle">
			<h2>상품조회</h2>
			<button type="button" class="close" onclick="uifnPopupClose('popupGoods')"><i class="fa fa-times"></i></button>
		</div>
		<!-- //TITLE -->
		<form id="goodsPopupForm" name="goodsPopupForm" action="#" th:action="@{'/goods/popup/list'}">
		<div class="panelContent">
			<ul class="notice">
				<li>아래 검색조건 중 <font color="red">업체, 키워드, 발생일</font>중 하나를 꼭 입력해 주세요.</li>
			</ul>
			<table class="frmStyle">
				<colgroup>
					<col style="width: 7%;"/>
					<col style="width: 21%;"/>
					<col style="width: 7%;"/>
					<col style="width: 18%;"/>
					<col style="width: 7%;"/>
					<col style="width: 18%;"/>
					<col style="width: 7%;"/>
					<col/>
				</colgroup>
				<tr>
					<th>업체/브랜드<em class="required" title="필수"></em></th>
					<td colspan="3">
						<select name="supplyCompCd" id="supplyCompCd">
							<option value="" >[전체]</option>
							<option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
						<span id="multiBrand"></span>
					</td>
					<th>상품타입</th>
					<td>
						<select name="goodsType" id="goodsType">
							<option value="">[전체]</option>
							<option th:if="${goodsTypeList}" th:each="oneData, status : ${goodsTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
					</td>
					<th rowspan="4">키워드<em class="required" title="필수"></em></th>
					<td rowspan="4">
						<select name="search" id="search">
							<option value="searchGoodsCd">상품코드</option>
							<option value="searchGoodsNm">상품명</option>
							<option value="searchGoodsNum">품번</option>
							<option value="searchSupplyGoodsCd">업체상품코드</option>
						</select>
						<!-- <input type="text" class="w40p" name="condition" id="condition" maxlength="50"/> -->
						<textarea class="textareaR3 w70p" name="condition" id="condition"></textarea>
					</td>
				</tr>
				<tr>
					<th>품목</th>
					<td>
						<div class="multiCheckBox"  style="width:300px">
							<button type="button" class="sltBtn">[전체]</button>
							<ul style="overflow:auto; height:170px;">
								<li><label class="chkBox"><input type="checkbox" name="전체선택" id="multiItemkindCd" onclick="uifnAllCheck('multiItemkindCd')">전체선택</label></li>
								<li th:if="${itemkindList}" th:each="oneData, status : ${itemkindList}"><label class="chkBox"><input type="checkbox" name="multiItemkindCd" th:id="${'itemkindCd' + oneData.cd}" th:value="${oneData.cd}" ><th:block th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></th:block></label></li>
							</ul>
						</div>
					</td>
					<th>상품상태</th>
					<td>
						<div class="multiCheckBox"  style="width:200px">
							<button type="button" class="sltBtn">[전체]</button>
							<ul style="overflow:auto; height:170px">
								<li><label class="chkBox"><input type="checkbox" name="전체선택" id="multiGoodsStat" onclick="uifnAllCheck('multiGoodsStat')">전체선택</label></li>
								<li th:if="${goodsStatList}" th:each="oneData, status : ${goodsStatList}"><label class="chkBox"><input type="checkbox" name="multiGoodsStat" th:id="${'goodsStat' + oneData.cd}" th:value="${oneData.cd}" ><th:block th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></th:block></label></li>
							</ul>
						</div>
					</td>
					<th>정상/이월 구분</th>
					<td>
						<select  name="formalGb" id="formalGb">
							<option value="">[전체]</option>
							<option th:if="${formalGbList}" th:each="oneData, status : ${formalGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
					</td>
					
				</tr>
				<tr>
					<th>년도/시즌</th>
					<td>
						<!-- <select  name="styleYear" id="styleYear">
							<option value="">[전체]</option>
							<option th:if="${styleYearList}" th:each="oneData, status : ${styleYearList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
						<select  name="seasonCd" id="seasonCd">
							<option value="">[전체]</option>
							<option th:if="${seasonList}" th:each="oneData, status : ${seasonList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select> -->
						<div class="multiCheckBox" style="width:140px;">
							<button type="button" class="sltBtn">[전체]</button>
							<ul style="overflow:auto; height:140px">
								<li><label class="chkBox"><input type="checkbox" name="전체선택" id="multiStyleYear" onclick="uifnAllCheck('multiStyleYear')">전체선택</label></li>
								<li th:if="${styleYearList}" th:each="oneData, status : ${styleYearList}"><label class="chkBox"><input type="checkbox" name="multiStyleYear" th:id="${'styleYear' + oneData.cd}" th:value="${oneData.cd}" ><th:block th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></th:block></label></li>
							</ul>
						</div>
						<div class="multiCheckBox" style="width:170px;">
							<button type="button" class="sltBtn">[전체]</button>
							<ul style="overflow:auto; height:170px">
								<li><label class="chkBox"><input type="checkbox" name="전체선택" id="multiSeasonCd" onclick="uifnAllCheck('multiSeasonCd')">전체선택</label></li>
								<li th:if="${seasonList}" th:each="oneData, status : ${seasonList}"><label class="chkBox"><input type="checkbox" name="multiSeasonCd" th:id="${'seasonCd' + oneData.cd}" th:value="${oneData.cd}" ><th:block th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></th:block></label></li>
							</ul>
						</div>
					</td>
					<th>연령대</th>
					<td>
						<select  name="ageGrpCd" id="ageGrpCd">
							<option value="">[전체]</option>
							<option th:if="${ageGrpCdList}" th:each="oneData, status : ${ageGrpCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
					</td>
					<th>성별</th>
					<td>
						<select  name="sexGb" id="sexGb">
							<option value="">[전체]</option>
							<option th:if="${sexGbList}" th:each="oneData, status : ${sexGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
					</td>
				</tr>
				<tr>
					<th>재고연동여부</th>
					<td>
						<select  name="erpStockLinkYn" id="erpStockLinkYn">
							<option value="">[전체]</option>
							<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
					</td>
					<th>자사몰노출여부</th>
					<td>
						<select  name="dispYn" id="dispYn">
							<option value="">[전체]</option>
							<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
					</td>
					<th>품절여부</th>
					<td>
						<select  name="soldOutYn" id="soldOutYn">
							<option value="">[전체]</option>
							<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
					</td>
				</tr>
				<tr>
					<th>반품가능여부</th>
					<td>
						<select  name="returnableYn" id="returnableYn">
							<option value="">[전체]</option>
							<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
						</select>
						<!-- <label class="chkBox"><input type="checkbox" name="returnableYn" value="Y"/>반품가능</label>
						<label class="chkBox"><input type="checkbox" name="changeableYn" value="Y"/>교환가능</label>
						<label class="chkBox"><input type="checkbox" name="returnFeeFreeYn" value="Y"/>무료반품</label>
						<label class="chkBox"><input type="checkbox" name="changeFeeFreeYn" value="Y"/>무료교환</label> -->
					</td>
					<th>담당MD</th>
					<td>
						<select  name="mdId" id="mdId">
							<option value="">[전체]</option>
							<option th:if="${brandMdList}" th:each="oneData, status : ${brandMdList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}"></option>
						</select>
					</td>
					<th>판매가</th>
					<td>
						<input type="text" class="w90" name="currPriceSt" id="currPriceSt" maxlength="10" data-valid-type="numeric"/>원 ~ <input type="text" class="w90" name="currPriceEd" id="currPriceEd" maxlength="10" data-valid-type="numeric"/>원
					</td>
					<th>할인율</th>
					<td>
						<input type="text" class="w70" name="dcRateSt" id="dcRateSt" maxlength="3" data-valid-type="numeric"/> ％ ~ <input type="text" class="w70" name="dcRateEd" id="dcRateEd" maxlength="3" data-valid-type="numeric"/> ％
					</td>
				</tr>
				<tr>
					<th>발생일<em class="required" title="필수"></em></th>
					<td colspan="7" id="sellTermsP"></td>
				</tr>
			</table>
			<ul class="panelBar">
				<li class="center">
					<button type="button" class="btn btn-gray btn-lg" id="btnPopupGoodsInit" >초기화</button>
					<button type="button" class="btn btn-info btn-lg" id="btnPopupGoodsSearch" >조회</button>
				</li>
			</ul>
		</div>	
			
			<ul class="panelBar">
				<li>검색 결과 : <em><span id="gridRowTotalCount">0</span></em>개가 검색되었습니다.
				<input type="hidden" name="pageNo" id="pageNo" value ="1"/>
				</li>
				<li class="right">
					<select class="w100" name="pageSize" id="pageSize">
						<option value="50" selected>50개</option>
						<option value="100">100개</option>
						<option value="500">500개</option>
					</select>
					<span class="btnRight" style="margin-top: 4px;">쪽번호 <span id="pgNo">0</span>/ <strong id="endPgNo">0</strong>&nbsp;&nbsp;</span>
				</li>
			</ul>
			<div id="gridPopupGoodsList" style="width: 100%; height: 400px;" class="ag-theme-balham lh60"></div>
			<!-- 버튼 배치 영역 -->
			<ul class="panelBar">
				<li class="center">
					<div class="tablePaging" id="goodsPopupListPagination"></div>
				</li>
			</ul>
			<ul class="panelBar">
				<li class="right">
					<button type="button" class="btnRight btn btn-base btn-lg" id="btnPopupGoodsApply">적용</button>
				</li>
			</ul>
			</form>
			<!-- //버튼 배치 영역 -->
		</div>
	</div>
<script type="text/javascript" src="/ux/plugins/gaga/gaga.paging.js?v=2019072202"></script>
<script th:inline="javascript">
/*<![CDATA[*/
	var sessRoleCd = [[${sessionInfo.roleCd}]];
	var goodsStatList = gagajf.convertToArray([[${goodsStatList}]]);
	var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
	var seasonList = gagajf.convertToArray([[${seasonList}]]);
	var uploadGoodsUrl = [[${@environment.getProperty('upload.goods.view')}]];
	
	var popupGoodsColumnDefs = [
		{width: 40, minWidth: 40, cellClass: 'text-right', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
		{headerName: 'No', width: 60, cellClass: 'text-center',
			valueGetter: function(params) { return cfnGridNumner('goodsPopupForm',params.node.rowIndex, 'A');}
		},
		{headerName: "이미지", field: "sysImgNm", width: 100, height: 60, cellClass: 'text-center'
			,cellRenderer: function(params) {
				return '<img width="60" src="'+ _goodsUrl+ "/" + params.value + '" alt="" onerror="this.src=\'/image/no.gif\';"/>';
			}
		},
		{headerName: "브랜드", field: "brandCd", width: 100, cellClass: 'text-center'},
		{headerName: "브랜드명", field: "brandEnm", width: 130, cellClass: 'text-center'},
		{headerName: "상품코드", field: "goodsCd", width: 140, cellClass: 'text-center'},
		{headerName: "상품명", field: "goodsNm", width: 200, cellClass: 'text-left'},
		{headerName: "품목", field: "itemkindNm", width: 150, cellClass: 'text-left'},
		{headerName: "재고", field: "stockQtySum", width: 80, cellClass: 'text-right',
			valueFormatter: function(params) {	return params.value.addComma();}
		},
		{headerName: "상품상태", field: "goodsStat" , width: 120, cellClass: 'text-center',
			cellEditorParams: { values: gagaAgGrid.extractValues(goodsStatList) },
			valueFormatter: function (params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); },
			valueParser: function (params) { return gagaAgGrid.lookupKey(goodsStatList, params.newValue); }
		},
		{headerName: "15일간판매수량", field: "sellDay15Qty", width: 120, cellClass: 'text-right',
			valueFormatter: function(params) {	return params.value.addComma();}
		},
		{headerName: "년도", field: "styleYear" , width: 90, cellClass: 'text-center'},
		{headerName: "시즌", field: "seasonCd" , width: 90, cellClass: 'text-center',
			cellEditorParams: { values: gagaAgGrid.extractValues(seasonList) },
			valueFormatter: function (params) { return gagaAgGrid.lookupValue(seasonList, params.value); },
			valueParser: function (params) { return gagaAgGrid.lookupKey(seasonList, params.newValue); }
		},
		{headerName: "정상가", field: "listPrice" , width: 100, cellClass: 'text-right'
			,valueFormatter: function(params) {return params.value.addComma();},
			cellEditor: 'textCellEditor',
			cellEditorParams: { maxlength: 14, validType: 'numeric'}
		},
		{headerName: "판매가", field: "currPrice" , width: 100, cellClass: 'text-right'
			,valueFormatter: function(params) {return params.value.addComma();},
			cellEditor: 'textCellEditor',
			cellEditorParams: { maxlength: 14, validType: 'numeric'}
		},
		{headerName: "할인율", field: "dcRate" , width: 90, cellClass: 'text-right'},
		{headerName: "가격변경일", field: "priceUpdDt", width: 150, cellClass: 'text-center',
			cellRenderer: function(params) {
				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
			}
		},
		{headerName: "이월구분", field: "formalGb", width: 100, cellClass: 'text-center',
			cellEditorParams: { values: gagaAgGrid.extractValues(formalGbList) },
			valueFormatter: function (params) { return gagaAgGrid.lookupValue(formalGbList, params.value); },
			valueParser: function (params) { return gagaAgGrid.lookupKey(formalGbList, params.newValue); }
		},
		{headerName: "반품가능", field: "returnableYn" , width: 90, cellClass: 'text-center'},
		{headerName: "수정일자", field: "updDt", width: 150, cellClass: 'text-center',
			cellRenderer: function(params) {
				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
			}
		},
		{headerName: "수정자", field: "updNm" , width: 100, cellClass: 'text-center'}
	];

	// Get GridOptions
	var popupGoodsGridOptions = gagaAgGrid.getGridOptions(popupGoodsColumnDefs);

	// Add on options
	popupGoodsGridOptions.suppressRowClickSelection = true;
	popupGoodsGridOptions.rowSelection = 'multiple';

	popupGoodsGridOptions.rowHeight = 60; //이미지가 있을경우 높이 지정해야함.

	popupGoodsGridOptions.getRowStyle = function(params) {
		if ("G008_00" == params.data.goodsStat  || "G008_10" == params.data.goodsStat || "G008_20" == params.data.goodsStat || "G008_30" == params.data.goodsStat) {
			return { background: '#23c6c8' };
		}
	}

	// 초기화클릭시
	$('#btnPopupGoodsInit').on('click', function() {
		$('#goodsPopupForm')[0].reset();
		//$("#goodsPopupForm input[type=radio]").removeClass("checked");
		$("#goodsPopupForm input[type=checkbox]").removeClass("checked");
		//$("#goodsPopupForm input[type=radio]").parent("label").removeClass("checked");
		$("#goodsPopupForm input[type=checkbox]").parent("label").removeClass("checked");
		$("#goodsPopupForm input[type=radio][checked]").parent("label").addClass("checked");
		fnSupplyBrandInit();
	});

	// 조회클릭시
	$('#btnPopupGoodsSearch').on('click', function() {
		fnPopupGoodsSearch();
	});


	// 조회
	var fnPopupGoodsSearch = function() {

		var formId = '#goodsPopupForm';
		// Fetch data
		//gagaAgGrid.fetch($(formId).prop('action'), popupGoodsGridOptions, formId, fnPopupGoodsSearchCallBack);

		if(!fnPopupGoodsConditionCheck()) return;

		gagaPaging.init('goodsPopupForm', fnPopupGoodsSearchCallBack, 'goodsPopupListPagination', $('#goodsPopupForm').find('#pageSize').val());
		gagaPaging.load(1);

	}

	//검색 조건 확인
	var fnPopupGoodsConditionCheck = function(){
		var formId = '#goodsPopupForm';
		var form = document.goodsPopupForm;

		if($("#goodsPopupForm input[name=searchGb]").val() == "EXCEL") return true;

		var searchFlag = false;
		var cnt = 0;

		if( !gagajf.isNull($("#goodsPopupForm select[name=supplyCompCd]").val())
				|| !gagajf.isNull($("#goodsPopupForm textarea[name=condition]").val())
				|| (!gagajf.isNull($("#goodsPopupForm input[name=stDate]").val()) && !gagajf.isNull($("#goodsPopupForm input[name=edDate]").val())
				|| !gagajf.isNull($("#goodsPopupForm select[name=brandGrpNm]").val())

				)
			){
			searchFlag = true;
		}else{
			/* for (i = 0; i < form.elements.length; i++ ) {
				var el = form.elements[i];

				if ((el.getAttribute("type") == "text" || el.getAttribute("type") == "select-one") || el.name== "supplyCompCd") {
					if (!(el.value == null || el.value == "")) {
						cnt++;
					}
				}
			}

			if(cnt > 0) searchFlag = true; */
		}

		if(searchFlag == false){
			mcxDialog.alert("검색조건을 입력하세요.");
			return false;
		}

		if(!gagajf.isNull($("#goodsPopupForm input[name=currPriceSt]").val()) && !gagajf.isNull($("#goodsPopupForm input[name=currPriceEd]").val())){
			if (Number($("#goodsPopupForm input[name=currPriceSt]").val().removeComma()) > Number($("#goodsPopupForm input[name=currPriceEd]").val().removeComma()) ){
				mcxDialog.alertC("판매가를 확인해 주세요.", {
					sureBtnText: "확인",
					sureBtnClick: function() {
						$("#goodsPopupForm input[name=currPriceEd]").focus();
					}
				});
				return false;
			}
		}

		if(!gagajf.isNull($("#goodsPopupForm input[name=dcRateSt]").val()) && !gagajf.isNull($("#goodsPopupForm input[name=dcRateEd]").val())){
			if (Number($("#goodsPopupForm input[name=dcRateSt]").val().removeComma()) > Number($("#goodsPopupForm input[name=dcRateEd]").val().removeComma()) ){
				mcxDialog.alertC("할인율를 확인해 주세요.", {
					sureBtnText: "확인",
					sureBtnClick: function() {
						$("#goodsPopupForm input[name=dcRateEd]").focus();
					}
				});
				return false;
			}
		}

		var fromDate = $('#goodsPopupForm input[name=stDate]').val();
		var toDate = $('#goodsPopupForm input[name=edDate]').val();

		if (!gagajf.isNull(fromDate) || !gagajf.isNull(toDate)) {

			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
				mcxDialog.alertC("등록일 조회시 시작일자와 종료일자를 입력하세요.", {
					sureBtnText: "확인",
					sureBtnClick: function() {
						$('#goodsPopupForm input[name=stDate]').focus();
					}
				});
				return false;
			}

			if (fromDate > toDate) {
				mcxDialog.alertC("노출기간 시작일자는 종료일자 보다 클 수 없습니다.", {
					sureBtnText: "확인",
					sureBtnClick: function() {
						$('#goodsPopupForm input[name=stDate]').focus();
					}
				});
				return false;
			}
		}

		return true;
	}
	var fnPopupGoodsSearchCallBack = function(result) {

		if (!gagajf.isNull(result.couponGoodsList)) {
			PopupCouponGoodsList = result.couponGoodsList;
		}

		$('#goodsPopupForm').find('#gridRowTotalCount').html(result.pageing.pageable.totalCount.addComma());
		$('#goodsPopupForm').find('#pageNo').val(result.pageing.pageable.pageNo.addComma());
		$('#goodsPopupForm').find('#pgNo').html(result.pageing.pageable.pageNo.addComma());
		$('#goodsPopupForm').find('#endPgNo').html(result.pageing.pageable.totalPage.addComma());
		popupGoodsGridOptions.api.setRowData(result.goodsList);
		gagaPaging.createPagination(result.pageing.pageable);

	}

	// 적용버튼 클릭시
	$('#btnPopupGoodsApply').on('click', function() {
		var callback = [[${params.callBackFun}]];
		//console.log(callback);
		var selectedData = popupGoodsGridOptions.api.getSelectedRows();

		if(selectedData.length == 0){
			mcxDialog.alert("선택된 데이터가 없습니다.");
			return false;
		}

		var jsonData = JSON.stringify(selectedData);

		if( typeof callback != 'undefined' && callback){

			if (typeof callback == 'function') {
				callback(jsonData);
			}else{
				if( callback ) {
					if( callback.indexOf("(") == -1 ) eval( callback +"(" + jsonData+")");
					else eval( callback(jsonData) );
				}
			}
			//uiPopupClose('goodsPopupForm');
		}
	});
	
	//업체변경시
	$('#goodsPopupForm select[name=supplyCompCd]').on('change', function() {
		var actionUrl = '/renderer/supplyCompany/brand/list/' + $(this).val();

		if(sessRoleCd == "G001_B000"){
			actionUrl = '/renderer/brand/AuthBrandlist';
		}
		//$("#goodsPopupForm select[name=brandCd] option:gt(0)").remove();
		//cfnCreateCombo(actionUrl, $('#goodsPopupForm select[name=brandCd]'), "[전체]", brandCd);
		
		cfnCreateMultiCombo(actionUrl,"multiBrand",  "[전체]",null, 'Y', null, null, 'goodsPopupForm');
	});
	
	// 업체 브랜드 초기화
	var fnSupplyBrandInit = function(){
		$("#goodsPopupForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
		//$("#goodsPopupForm select[name=supplyCompCd]").attr("disabled", true);
		//$("select[disabled]").addClass("formControl");

		$('#goodsPopupForm').find('#multiBrand').empty();
		var actionUrl = '/renderer/brand/AuthBrandlist';
		cfnCreateMultiCombo(actionUrl,"multiBrand",  "[전체]",null, 'Y', null, null, 'goodsPopupForm');
	}
	
	$(document).ready(function() {
		cfnCreateCalendar('#sellTermsP', 'stDate', 'edDate', true, '등록일', 'X');

		var selectCode = '<select  name="dateGbn" id="dateGbn"  class="w100">';
		selectCode += '<option value="R" seledted>상품등록일</option>';
		selectCode += '<option value="P">가격변경일</option>';
		selectCode += '<option value="S">최초승인일</option>';
		selectCode += '</select>';

		$("#goodsPopupForm").find('#sellTermsP').prepend(selectCode);

		// Create a agGrid
		gagaAgGrid.createGrid('gridPopupGoodsList', popupGoodsGridOptions);
		
		// 입점 사용자 브랜드 조회 처리
		if(sessRoleCd == "G001_B000"){
			fnSupplyBrandInit();
		}

	});

/*]]>*/
</script>
</html>