<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : PlanCornerCopyForm.html
 * @desc    : 기획전 템플릿  화면 Page
 *============================================================================
 * SISUN
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.02.18   sowon 		  최초 작성
 *******************************************************************************
 -->
<div class="modalPopup" data-width="1200" data-height="730" id="popupPlanTemplate">
	<div class="panelStyle" style="height: 750px;">
		<div class="panelTitle">
			<strong>기획전 템플릿</strong>
			<button type="button" class="close"	onclick="uifnPopupClose('popupPlanTemplate')">
				<i class="fa fa-times"></i>
			</button>
		</div>
		
	<form id="planTemplateForm" name="planTemplateForm" action="#" th:method="post">
			<input type="hidden" name="planSq" th:value="*{planSq}"/>
			<input type="hidden" name="mode" th:value="*{mode}"/>
			<input type="hidden" name="rePlanContSq">
			<input type="hidden" name="cuPlanContSq">
			<input type="hidden" name="filePlanContSq">
			<input type="hidden" name="noticePlanContSq">
			<input type="hidden" name="goodsPlanContSq1">
			<input type="hidden" name="goodsPlanContSq2">
			<input type="hidden" name="goodsPlanContSq3">
			<input type="hidden" name="goodsPlanContSq4">
			<input type="hidden" name="goodsPlanContSq5">
			<input type="hidden" name="goodsPlanContSq6">
			<input type="hidden" name="goodsPlanContSq7">
			<input type="hidden" name="goodsPlanContSq8">
			<input type="hidden" name="goodsPlanContSq9">
			<input type="hidden" name="goodsPlanContSq10">
			<div class="cardArea" style="height: 700px; margin: 3px;">

				<div class="panelContent">
					<div class="panelStyle" style="margin: unset;">
						<!-- TITLE -->
						<div class="panelTitle">
							<h2>HTML [상단]</h2>
							<span class="panelControl"> <i
								class="fa inner-fa-chevron-up"></i> <!-- 열림/닫힘 화살표 -->
							</span>
						</div>
						<!-- //TITLE -->
						<div class="inner-panelContent">
							<div class="panelContent">
								<table class="frmStyle">
									<colgroup>
										<col width="10%" />
										<col width="90%" />
									</colgroup>
									<tr>
										<th>[전시여부<label class="chkBox"><input type="checkbox" name="topFsrcDispYn" value="Y" checked/></label>]</th>	
										<!-- <td><input type="text" name ="topFsrcDispOrd" value="" class="w100 aR" data-valid-type="numeric"></td> -->
									</tr>
									<tr>
										<th>웹용소스</th>
										<td colspan="5">
											<div style="margin-top: 5px;">
												<textarea class="textareaR4 summernote" name="fsrcPcTop" id="fsrcPcTop" rows="15" cols="95" style="width: 1280px;"></textarea>
											</div>
										</td>
									</tr>
									<tr>
										<th>모바일용소스</th>
										<td colspan="5">
											<div style="margin-top: 5px;">
												<textarea class="textareaR4 summernote" name="fsrcMobileTop" id="fsrcMobileTop" rows="15" cols="95" style="width: 1280px;"></textarea>
											</div>
										</td>
									</tr>

								</table>
							</div>
						</div>
					</div>
				</div>

				<div class="panelContent">
					<div class="panelStyle" style="margin: unset;">
						<!-- TITLE -->
						<div class="panelTitle">
							<h2>리뷰 조회</h2>
							<span class="panelControl"> <i
								class="fa inner-fa-chevron-up"></i> <!-- 열림/닫힘 화살표 -->
							</span>
						</div>
						<!-- //TITLE -->
						<div class="inner-panelContent">
							<div class="panelContent">
								<table class="frmStyle">
									<colgroup>
										<col width="10%" />
										<col width="90%" />
									</colgroup>
									<tr>
										<th>리뷰<br/>[전시여부<label class="chkBox"><input type="checkbox" name="reDispYn" onclick="fnAttachYnClick('reDispYn')" value="Y" checked/></label>]</th>
										<td>
											<table class="frmStyle">
												<tr>
													<th>리뷰 타이틀</th>
													<td><input type="text" name="reTitle" class="w300 aL"/>
													</td>
												</tr>
												<tr>
													<th>전시순서</th>
													<td><input type="text" name="reDispOrd" class="w100 aL" data-valid-type="numeric"></td>
												</tr>
											</table>
											<div class="padding10">
												<span class="buttonSpan">
													<button type="button" class="btn btnRight btn-success btn-lg" onclick="cfnOpenGoodsPopup('reviewGoodsList')">상품 조회</button>
													<button type="button" class="btn btnRight btn-success btn-lg" id="btnReviewDelete">행 삭제</button>
												</span> <br />
												<div id="gridListPlanReview" style="width: 100%; height: 200px;" class="ag-theme-balham"></div>
											</div>
										</td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>

				<div class="panelContent">
					<div class="panelStyle" style="margin: unset;">
						<!-- TITLE -->
						<div class="panelTitle">
							<h2>쿠폰 조회</h2>
							<span class="panelControl"> <i
								class="fa inner-fa-chevron-up"></i> <!-- 열림/닫힘 화살표 -->
							</span>
						</div>
						<!-- //TITLE -->
						<div class="inner-panelContent">
							<div class="panelContent">
								<table class="frmStyle">
									<colgroup>
										<col width="10%" />
										<col width="90%" />
									</colgroup>
									<tr>
										<th>쿠폰<br/>[전시여부<label class="chkBox"><input type="checkbox" name="cuDispYn" id="cuDispYn" value="Y" checked/></label>]</th>
										<td>
											<table class="frmStyle">
												<tr>
													<th>쿠폰 타이틀</th>
													<td><input type="text" name="cuTitle" class="w300 aL">
													</td>
												</tr>
												<tr>
													<th>전시순서</th>
													<td><input type="text" name="cuDispOrd" class="w100 aL" data-valid-type="numeric"></td>
												</tr>
												<tr>
													<th>쿠폰 유의사항</th>
													<td colspan="5">
														<div id="registeredFile"></div>
														<div style="display: block">
															<select name="couponCnt" id="couponCnt">
																<th:block th:each="num: ${#numbers.sequence(1,10)}">
																	<option th:value="${num}" th:text="${num}"></option>
																</th:block>
															</select>* 쿠폰 유의사항 개수 선택(10개까지 가능)
														</div> 
														<th:block th:each="num: ${#numbers.sequence(1,10)}">
															<div>
																<table>
																	<tr th:id="${'coupon'+num}">
																		<th th:text="${'유의사항' + num}"></th>
																		<td>
																			<input type="text"	th:id="${'cpnNote' + (num-1)}" th:name="${'cpnNote' + (num-1)}" class="w300 aL" maxlength="500">
																		</td>
																	</tr>
																</table>
															</div>
														</th:block>
													</td>
												</tr>
											</table>
											<div class="padding10">
												<span class="buttonSpan">
													<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnAddCoupone()">쿠폰 추가</button>
												</span> <br />
											<table class="frmStyle" id="couponTable">
												
											</table>
											</div>
										</td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>

				<div class="panelContent">
					<div class="panelStyle" style="margin: unset;">
						<!-- TITLE -->
						<div class="panelTitle">
							<h2>이미지 첨부</h2>
							<span class="panelControl"> <i
								class="fa inner-fa-chevron-up"></i> <!-- 열림/닫힘 화살표 -->
							</span>
						</div>
						<!-- //TITLE -->
						<div class="inner-panelContent">
							<div class="panelContent">
								<table class="frmStyle">
									<colgroup>
										<col width="10%" />
										<col width="90%" />
									</colgroup>
									<tr>
										<th>이미지 첨부<br/>[전시여부<label class="chkBox"><input type="checkbox" name="fileDispYn" value="Y" checked/></label>]</th>
										<td colspan="5">
											<div id="registeredFile"></div>
											<div style="display: block">
												<select name="fileCnt" id="fileCnt">
													<th:block th:each="num: ${#numbers.sequence(1,10)}">
														<option th:value="${num}" th:text="${num}"></option>
													</th:block>
												</select>* 이미지 개수 선택(10개까지 가능)
											</div> 
											<th:block th:each="num: ${#numbers.sequence(1,10)}">
												<div>
													<div class="uFile w500">
														<input type="file" th:id="${'file' + num}" th:name="${'file' + num}" class="uFileInput w500" accept="image/*"/> 
														<label th:for="${'file' + num}" class="uFileLabel" th:id="${'file_' + num}">파일선택</label>
														<input type="hidden" name="fileItemVal"	th:id="${'fileItemVal' + num}" /> 
														<input type="hidden" name="sysFileNms" th:id="${'sysFileNm' + num}" />
														<input type="text" th:name="${'linkUrl' + num}" th:id="${'linkUrl' + num}" class="w300 aL">
													</div>
													<br />
													<table>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" th:name="${'fileLinkOpenGb' + num}" value="M" checked/>현재창</label>   
														     <label class="rdoBtn"><input type="radio" th:name="${'fileLinkOpenGb' + num}" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>        
														<tr>
															<th>이미지 링크</th>
															<td><input type="text" th:name="${'fileLinkUrl' + num}" class="w300 aL">
															</td>
														</tr>
														</table>
												</div>
											</th:block>
										</td>

										<th>전시순서</th>
										<td><input type="text" name="fileDispOrd" class="w100 aL" data-valid-type="numeric"></td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>
				
				<div class="panelContent">
					<div class="panelStyle" style="margin: unset;">
						<!-- TITLE -->
						<div class="panelTitle">
							<h2>유의사항</h2>
							<span class="panelControl"> <i
								class="fa inner-fa-chevron-up"></i> <!-- 열림/닫힘 화살표 -->
							</span>
						</div>
						<!-- //TITLE -->
						<div class="inner-panelContent">
							<div class="panelContent">
								<table class="frmStyle">
									<colgroup>
										<col width="10%" />
										<col width="90%" />
									</colgroup>
									<tr>
										<th>유의사항<br/>[전시여부<label class="chkBox"><input type="checkbox" name="noticeDispYn" value="Y" checked/></label>]</th>
										<td colspan="5">
											<div id="registeredFile"></div>
											<div style="display: block">
												<select name="noticeCnt" id="noticeCnt">
													<th:block th:each="num: ${#numbers.sequence(1,10)}">
														<option th:value="${num}" th:text="${num}"></option>
													</th:block>
												</select>* 유의사항 개수 선택(10개까지 가능)
											</div> 
											<th:block th:each="num: ${#numbers.sequence(1,10)}">
												<div>
													<table>
														<tr th:id="${'notice'+num}">
															<th th:text="${'유의사항' + num}"></th>
															<td><input type="text" th:id="${'noticeItemVal' + num}" th:name="${'noticeItemVal' + num}" class="w300 aL" maxlength="500">
															</td>
														</tr>
													</table>
												</div>
											</th:block>
										</td>

										<th>전시순서</th>
										<td><input type="text" name="noticeDispOrd" class="w100 aL" data-valid-type="numeric"></td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>

				<div class="panelContent">
					<div class="panelStyle" style="margin: unset;">
						<!-- TITLE -->
						<div class="panelTitle">
							<h2>HTML [하단]</h2>
							<span class="panelControl"> <i
								class="fa inner-fa-chevron-up"></i> <!-- 열림/닫힘 화살표 -->
							</span>
						</div>
						<!-- //TITLE -->
						<div class="inner-panelContent">
							<div class="panelContent">
								<table class="frmStyle">
									<colgroup>
										<col width="10%" />
										<col width="90%" />
									</colgroup>
									<tr>
										<th>[전시여부<label class="chkBox"><input type="checkbox" name="btmFsrcDispYn" value="Y" checked/></label>]</th>	
										<!-- <td><input type="text" name ="btmFsrcDispOrd" value="" class="w100 aR" data-valid-type="numeric"></td> -->
									</tr>
									<tr>
										<th>웹용소스</th>
										<td colspan="5">
											<div style="margin-top: 5px;">
												<textarea class="textareaR4 summernote" name="fsrcPcBtm" id="fsrcPcBtm" rows="15"	cols="95" style="width: 1280px;"></textarea>
											</div>
										</td>
									</tr>
									<tr>
										<th>모바일용소스</th>
										<td colspan="5">
											<div style="margin-top: 5px;">
												<textarea class="textareaR4 summernote" name="fsrcMobileBtm" id="fsrcMobileBtm" rows="15" cols="95" style="width: 1280px;"></textarea>
											</div>
										</td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>

				<!-- 팝업창 하단부분 시작 -->

				<div class="panelStyle" style="margin: unset;">
					<!-- TITLE -->
					<div class="panelTitle">
						<h2>상품 등록</h2>
						<span class="panelControl"> <i
							class="fa inner-fa-chevron-up"></i> <!-- 열림/닫힘 화살표 -->
						</span>
					</div>
					<!-- //상품 전시 설정 -->
					<div class="inner-panelContent">
						<div class="panelContent">
							<ul class="panelBar">
								<li class="left">
									<p>최대 10개 까지 상품을 추가하실 수 있습니다.</p>
								</li>
								<li class="right">
									<button type="button" class="btn btnRight btn-success btn-lg" id="btnAddGrid">구분추가하기</button>
								</li>
							</ul>
							<!-- 구분 1 -->
							<div class="inner-panelContent" id="btnAddGridNum1"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum1UseYn" value="Y">
								<input type="hidden" name="mailtcSq">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 1<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn1" value="Y" checked></label>]<br>
												<button type="button" class="btn btn-danger btn-lg" id="" onclick="btnDeleteGridNum1('gridOptions_c1');">구분 삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType1" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType1" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType1" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle1" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb1" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb1" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>        
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl1" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd1" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p1');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p1');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList1" style="width: 100%; height: 200px;" class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분 1 -->

							<!-- 구분2 -->
							<div class="inner-panelContent" id="btnAddGridNum2"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum2UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 2<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn2" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum2('gridOptions_c2');">구분 삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType2" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType2" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType2" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle2" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb2" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb2" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl2" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd2" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p2');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p2');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList2" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분2  -->

							<!-- 구분3 -->
							<div class="inner-panelContent" id="btnAddGridNum3"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum3UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 3<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn3" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum3('gridOptions_c3');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType3" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType3" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType3" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle3" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb3" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb3" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl3" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd3" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p3');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p3');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList3" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분3 -->

							<!-- 구분4 -->
							<div class="inner-panelContent" id="btnAddGridNum4"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum4UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 4<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn4" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum4('gridOptions_c4');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType4" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType4" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType4" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle4" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb4" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb4" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>                                                                                                                       
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl4" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd4" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p4');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p4');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList4" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분4 -->

							<!-- 구분5 -->
							<div class="inner-panelContent" id="btnAddGridNum5"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum5UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 5<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn5" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum5('gridOptions_c5');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType5" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType5" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType5" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle5" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb5" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb5" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl5" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd5" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p5');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p5');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList5" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분5 -->

							<!-- 구분6 -->
							<div class="inner-panelContent" id="btnAddGridNum6"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum6UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 6<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn6" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum6('gridOptions_c6');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType6" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType6" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType6" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle6" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb6" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb6" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl6" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd6" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p6');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p6');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList6" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분6 -->

							<!-- 구분7 -->
							<div class="inner-panelContent" id="btnAddGridNum7"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum7UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 7<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn7" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum7('gridOptions_c7');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType7" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType7" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType7" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle7" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb7" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb7" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl7" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd7" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p7');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p7');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList7" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분7 -->

							<!-- 구분8 -->
							<div class="inner-panelContent" id="btnAddGridNum8"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum8UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 8<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn8" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum8('gridOptions_c8');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType8" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType8" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType8" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle8" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb8" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb8" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl8" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd8" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p8');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p8');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList8" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분8 -->

							<!-- 구분9 -->
							<div class="inner-panelContent" id="btnAddGridNum9"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum9UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 9<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn9" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum9('gridOptions_c9');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType9" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType9" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType9" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle9" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb9" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb9" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl9" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd9" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p9');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p9');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList9" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분9 -->

							<!-- 구분10 -->
							<div class="inner-panelContent" id="btnAddGridNum10"
								style="display: none;">
								<input type="hidden" name="btnAddGridNum10UseYn" value="Y">
								<div class="panelContent">
									<table class="frmStyle">
										<colgroup>
											<col width="10%" />
											<col width="90%" />
										</colgroup>
										<tr>
											<th>상품 구분 10<br/>[전시여부<label class="chkBox" style="padding-left: 0px;"><input type="checkbox" name="goodsDispYn10" value="Y" checked></label>]<br>
											<br>
												<button type="button" class="btn btn-danger btn-lg" id=""
													onclick="btnDeleteGridNum10('gridOptions_c10');">구분
													삭제</button>
											</th>
											<td>
												<div class="">
													<table class="frmStyle">
														<tr>
															<th>상품 노출 기준</th>
															<td>
																<label class="rdoBtn"><input type="radio" name="goodsType10" value="G082_50" checked/>1개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType10" value="G082_51" />2개</label> 
																<label class="rdoBtn"><input type="radio" name="goodsType10" value="G082_52" />4개</label>
															</td>
														</tr>
														<tr>
															<th>상품 타이틀</th>
															<td><input type="text" name="goodsTitle10" class="w300 aL">
															</td>
														</tr>
														<tr>                                                                                                     
															<th>클릭시 페이지창</th>                                                                                                     
															<td>                                                                                                         
															<label class="rdoBtn"><input type="radio" name="linkOpenGb10" value="M" checked="checked"/>현재창</label>   
															<label class="rdoBtn"><input type="radio" name="linkOpenGb10" value="N" />새창</label>                    
															</td>                                                                                                                    
														</tr>   
														<tr>
															<th>상품 링크</th>
															<td><input type="text" name="goodsUrl10" class="w300 aL">
															</td>
														</tr>
														<tr>
															<th>전시 순서</th>
															<td><input type="text" name="goodsDispOrd10" class="w300 aL" data-valid-type="numeric">
															</td>
														</tr>
													</table>
													<ul class="panelBar">
														<li class="left">
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnOpenGoodsPopup('gridOptions_p10');">상품 조회</button>
															<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGoodsDeleteRow('gridOptions_p10');">행 삭제</button>
														</li>
													</ul>
													<!-- Agrid -->
													<div id="gridTempGbList10" style="width: 100%; height: 200px;"	class="ag-theme-balham"></div>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div>
							<!-- 구분10 -->

						</div>
						<!-- panelContent -->
					</div>
					<!-- end of inner-panelContent -->
				</div>
			</div>
			<br><br>
			<!-- 버튼 배치 영역 -->
			<ul class="panelBar">
				<li class="right">
					<button type="button" class="btn btn-danger btn-lg"
						id="btndeleteTemplate">닫기</button>
					<button type="button" class="btn btn-info btn-lg"
						id="btnSaveTemplate">저장</button>
				</li>

			</ul>
			<!-- //버튼 배치 영역 -->
		</form>
	</div>
</div>
<script type="text/javascript" src="/ux/plugins/summernote/summernote.js?v=2020103001"></script>
<script type="text/javascript" src="/ux/plugins/gaga/gaga.summernote.js?v=2021053101"></script>
<script th:inline="javascript">
/*<![CDATA[*/
	
	let AddgridRow;	
	let goodsStatList = gagajf.convertToArray([[${goodsStatList}]]);
	let reviewList = [[${reviewList}]];
	let couponList = [[${couponList}]];
	let couponNotice = [[${couponNotice}]];
	let fileList = [[${fileList}]];
	let noticeList = [[${noticeList}]];
	let fsrcListTop = [[${fsrcListTop}]];
	let fsrcListBtm = [[${fsrcListBtm}]];
	let goodsList = [[${goodsList}]];
	let goodsDetailList1 = [[${goodsDetailList1}]];
	let goodsDetailList2 = [[${goodsDetailList2}]];
	let goodsDetailList3 = [[${goodsDetailList3}]];
	let goodsDetailList4 = [[${goodsDetailList4}]];
	let goodsDetailList5 = [[${goodsDetailList5}]];
	let goodsDetailList6 = [[${goodsDetailList6}]];
	let goodsDetailList7 = [[${goodsDetailList7}]];
	let goodsDetailList8 = [[${goodsDetailList8}]];
	let goodsDetailList9 = [[${goodsDetailList9}]];
	let goodsDetailList10 = [[${goodsDetailList10}]];
	
	let mode = [[${mode}]]; 
	
	
	// 리뷰 리스트 설정
	var columnReviewList = [
		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
		{headerName: "상품ID", field: "reItemVal", width: 110, cellClass: 'text-center'},
		{headerName: "상품명", field: "reItemNm", width: 200, cellClass: 'text-center'},
		{headerName: "시작일"			, field:'startSearchDate'	, width:110, cellClass: 'text-center',
			cellEditor: 'datePicker',
			cellEditorParams: { maxlength: 10, required: true },
		},
		{headerName: "시작시간"		, field:'startSearchTime'	, width:150, cellClass: 'text-center',
			cellEditor: 'dateTimer',
			cellEditorParams: { maxlength: 8, required: true },
		},
		{headerName: "종료일"			, field:'endSearchDate'		, width:110, cellClass: 'text-center',
			cellEditor: 'datePicker',
			cellEditorParams: { maxlength: 10, required: true }
		},
		{headerName: "종료시간"		, field:'endSearchTime'		, width:150, cellClass: 'text-center',
			cellEditor: 'dateTimer',
			cellEditorParams: { maxlength: 8, required: true },
		},
	];  
	
	//상품 전시 그리드 그리기
	var columnDefs = [
		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
		{headerName: "상품 ID", field: "goodsItemVal" , width: 120, cellClass: 'text-center'},
		{headerName: "브랜드명", field: "brandEnm" , width: 200, cellClass: 'text-center'},
		{headerName: "상품명", field: "goodsNm" , width: 200, cellClass: 'text-center'},
		{headerName: "판매상태", field: "goodsStat" , width: 100, 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: "정상가", field: "listPrice" , width: 120, cellClass: 'text-center'
			, valueFormatter: function(params) { return params.value.addComma(); }
		},
		{headerName: "판매가", field: "currPrice" , width: 120, cellClass: 'text-center'
			, valueFormatter: function(params) { return params.value.addComma(); }
		},
	]
	
	// Add on options
	var gridOptions_p1 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p2 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p3 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p4 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p5 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p6 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p7 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p8 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p9 = gagaAgGrid.getGridOptions(columnDefs);
	var gridOptions_p10 = gagaAgGrid.getGridOptions(columnDefs);
	
	
	// 표시순번 수정가능
	gridOptions_p1.defaultColDef.editable = true;
	gridOptions_p2.defaultColDef.editable = true;
	gridOptions_p3.defaultColDef.editable = true;
	gridOptions_p4.defaultColDef.editable = true;
	gridOptions_p5.defaultColDef.editable = true;
	gridOptions_p6.defaultColDef.editable = true;
	gridOptions_p7.defaultColDef.editable = true;
	gridOptions_p8.defaultColDef.editable = true;
	gridOptions_p9.defaultColDef.editable = true;
	gridOptions_p10.defaultColDef.editable = true;
	            
	gridOptions_p1.suppressRowClickSelection = true;
	gridOptions_p2.suppressRowClickSelection = true;
	gridOptions_p3.suppressRowClickSelection = true;
	gridOptions_p4.suppressRowClickSelection = true;
	gridOptions_p5.suppressRowClickSelection = true;
	gridOptions_p6.suppressRowClickSelection = true;
	gridOptions_p7.suppressRowClickSelection = true;
	gridOptions_p8.suppressRowClickSelection = true;
	gridOptions_p9.suppressRowClickSelection = true;
	gridOptions_p10.suppressRowClickSelection = true;
	
	// 상품 중복선택
	gridOptions_p2.rowSelection = 'multiple';
	gridOptions_p1.rowSelection = 'multiple';
	gridOptions_p3.rowSelection = 'multiple';
	gridOptions_p4.rowSelection = 'multiple';
	gridOptions_p5.rowSelection = 'multiple';
	gridOptions_p6.rowSelection = 'multiple';
	gridOptions_p7.rowSelection = 'multiple';
	gridOptions_p8.rowSelection = 'multiple';
	gridOptions_p9.rowSelection = 'multiple';
	gridOptions_p10.rowSelection = 'multiple';
	
	
	
	// 리뷰 그리드 설정
	var gridOptionsPlanReviewList = gagaAgGrid.getGridOptions(columnReviewList);
	gridOptionsPlanReviewList.stopEditingWhenGridLosesFocus = true;
	gridOptionsPlanReviewList.defaultColDef.editable = true;
	gridOptionsPlanReviewList.rowSelection = "multiple";
	gridOptionsPlanReviewList.suppressRowClickSelection = true;
	
	

	
	//팝업창 닫기버튼
	$('#btndeleteTemplate').on('click', function() {
		mcxDialog.confirm("창을 닫으시겠습니까?<br>닫은 내용은 복원하실 수 없습니다.", {
			cancelBtnText: "취소",
			sureBtnText: "확인",
			sureBtnClick: function() {
				uifnPopupClose('popupPlanTemplate');
			}
		});
	});
 	
	 
	// 상품 구분 추가 버튼 추가 버튼 표시는 1~5까지 순서대로 표시
	$('#btnAddGrid').on('click', function(){
		if($('#btnAddGridNum1').css('display') == 'none'){
			$('#btnAddGridNum1').show();
		}else if($('#btnAddGridNum2').css('display') == 'none' && $('#btnAddGridNum1').css('display') != 'none'){
			$('#btnAddGridNum2').show();
		}else if($('#btnAddGridNum3').css('display') == 'none' && $('#btnAddGridNum2').css('display') != 'none'){
			$('#btnAddGridNum3').show();
		}else if($('#btnAddGridNum4').css('display') == 'none' && $('#btnAddGridNum3').css('display') != 'none'){
			$('#btnAddGridNum4').show();
		}else if($('#btnAddGridNum5').css('display') == 'none' && $('#btnAddGridNum4').css('display') != 'none'){
			$('#btnAddGridNum5').show();
		}else if($('#btnAddGridNum6').css('display') == 'none' && $('#btnAddGridNum5').css('display') != 'none'){
			$('#btnAddGridNum6').show();
		}else if($('#btnAddGridNum7').css('display') == 'none' && $('#btnAddGridNum6').css('display') != 'none'){
			$('#btnAddGridNum7').show();
		}else if($('#btnAddGridNum8').css('display') == 'none' && $('#btnAddGridNum7').css('display') != 'none'){
			$('#btnAddGridNum8').show();
		}else if($('#btnAddGridNum9').css('display') == 'none' && $('#btnAddGridNum8').css('display') != 'none'){
			$('#btnAddGridNum9').show();
		}else if($('#btnAddGridNum10').css('display') == 'none' && $('#btnAddGridNum9').css('display') != 'none'){
			$('#btnAddGridNum10').show();
		}else if($('#btnAddGridNum10').css('display') != 'none'){
			mcxDialog.alertC("구분자는 최대 10개까지 등록가능합니다.", {
				sureBtnText: "확인"
			});
			return false;
		}
	});
	
	
	
	// 상품추가
	var fnFetchPlanGoods = function(goodsData) {
		for(let i = 0 ; i < goodsData.length ; i++) {
			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(AddgridRow);		// 받아온 모든 데이터

			// 받아온 data for
			for(let j = 0 ; j < gridListValue.length ; j++) {
				// 동일한 data는 추가하지 않음
				if(gridListValue[j].goodsItemVal == goodsData[i].goodsCd) {	addChk = false;	}		// 중복체크
			}

			// 중복되지 않은 데이터 리스트에 추가
			if(addChk) {
				gagaAgGrid.addRowData(AddgridRow, {
														"goodsItemVal":goodsData[i].goodsCd
													   ,"brandEnm":goodsData[i].brandEnm
													   ,"goodsNm":goodsData[i].goodsNm
													   ,"goodsStat":goodsData[i].goodsStat
													   ,"listPrice":goodsData[i].listPrice
													   ,"currPrice":goodsData[i].currPrice
														
				});
			}
		}
		
		uifnPopupClose("popupGoods");
	}
	
	// 버튼별 상품추가 팝업
	var fnOpenGoodsPopup = function(param) {
		switch (param){
		case 'gridOptions_p1': 
			AddgridRow = gridOptions_p1;
			break;
		case 'gridOptions_p2' : 
			AddgridRow = gridOptions_p2;
			break;
		case 'gridOptions_p3' : 
			AddgridRow = gridOptions_p3;
			break;
		case 'gridOptions_p4' : 
			AddgridRow = gridOptions_p4;
			break;
		case 'gridOptions_p5' : 
			AddgridRow = gridOptions_p5;
			break;
		case 'gridOptions_p6' : 
			AddgridRow = gridOptions_p6;
			break;
		case 'gridOptions_p7' : 
			AddgridRow = gridOptions_p7;
			break;
		case 'gridOptions_p8' : 
			AddgridRow = gridOptions_p8;
			break;
		case 'gridOptions_p9' : 
			AddgridRow = gridOptions_p9;
			break;
		case 'gridOptions_p10' : 
			AddgridRow = gridOptions_p10;
			break;
		}
		
		cfnOpenGoodsPopup('fnFetchPlanGoods');
	}
	
	// 상품 삭제
	var fnGoodsDeleteRow = function(param) {
		switch (param){
		case 'gridOptions_p1': 
			AddgridRow = gridOptions_p1;
			break;
		case 'gridOptions_p2' : 
			AddgridRow = gridOptions_p2;
			break;
		case 'gridOptions_p3' : 
			AddgridRow = gridOptions_p3;
			break;
		case 'gridOptions_p4' : 
			AddgridRow = gridOptions_p4;
			break;
		case 'gridOptions_p5' : 
			AddgridRow = gridOptions_p5;
			break;
		case 'gridOptions_p6' : 
			AddgridRow = gridOptions_p6;
			break;
		case 'gridOptions_p7' : 
			AddgridRow = gridOptions_p7;
			break;
		case 'gridOptions_p8' : 
			AddgridRow = gridOptions_p8;
			break;
		case 'gridOptions_p9' : 
			AddgridRow = gridOptions_p9;
			break;
		case 'gridOptions_p10' : 
			AddgridRow = gridOptions_p10;
			break;
		}
		
		var selectedData = gagaAgGrid.selectedRowData(AddgridRow);
	
		if (selectedData.length == 0) {
			mcxDialog.alert('선택된 행이 없습니다.');
			return false;
		}		
		//화면에서 삭제
		gagaAgGrid.removeRowData(AddgridRow, false);
	}
	
	// 상품 구분 삭제 버튼  삭제는 해당 하는 폼이 삭제
	function btnDeleteGridNum1(param){
		if($('#btnAddGridNum1').css('display') !='none'){
			$('#btnAddGridNum1').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq1]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle1]").val('');
			$("#planTemplateForm input[name=goodsUrl1]").val('');
			$("#planTemplateForm input[name=goodsDispOrd1]").val('');
			//gagaAgGrid.removeRowData(gridOptions_p1, false);
			gridOptions_p1.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p1)});
		}
	}		
	function btnDeleteGridNum2(param){
		if($('#btnAddGridNum2').css('display') !='none'){
			$('#btnAddGridNum2').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq2]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle2]").val('');
			$("#planTemplateForm input[name=goodsUrl2]").val('');
			$("#planTemplateForm input[name=goodsDispOrd2]").val('');
			gridOptions_p2.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p2)});
		}			
	}			
	function btnDeleteGridNum3(param){
		if ($('#btnAddGridNum3').css('display') !='none'){
			$('#btnAddGridNum3').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq3]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle3]").val('');
			$("#planTemplateForm input[name=goodsUrl3]").val('');
			$("#planTemplateForm input[name=goodsDispOrd3]").val('');
			gridOptions_p3.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p3)});
		}			
	}		
	function btnDeleteGridNum4(param){
		if ($('#btnAddGridNum4').css('display') !='none'){
			$('#btnAddGridNum4').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq4]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle4]").val('');
			$("#planTemplateForm input[name=goodsUrl4]").val('');
			$("#planTemplateForm input[name=goodsDispOrd4]").val('');
			gridOptions_p4.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p4)});
		}			
	}
	function btnDeleteGridNum5(param){
		if ($('#btnAddGridNum5').css('display') !='none'){
			$('#btnAddGridNum5').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq5]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle5]").val('');
			$("#planTemplateForm input[name=goodsUrl5]").val('');
			$("#planTemplateForm input[name=goodsDispOrd5]").val('');
			gridOptions_p5.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p5)});
		}
	} 
	function btnDeleteGridNum6(param){
		if ($('#btnAddGridNum6').css('display') !='none'){
			$('#btnAddGridNum6').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq6]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle6]").val('');
			$("#planTemplateForm input[name=goodsUrl6]").val('');
			$("#planTemplateForm input[name=goodsDispOrd6]").val('');
			gridOptions_p6.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p6)});
		}
	} 
	function btnDeleteGridNum7(param){
		if ($('#btnAddGridNum7').css('display') !='none'){
			$('#btnAddGridNum7').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq7]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle7]").val('');
			$("#planTemplateForm input[name=goodsUrl7]").val('');
			$("#planTemplateForm input[name=goodsDispOrd7]").val('');
			gridOptions_p7.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p7)});
		}
	} 
	function btnDeleteGridNum8(param){
		if ($('#btnAddGridNum8').css('display') !='none'){
			$('#btnAddGridNum8').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq8]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle8]").val('');
			$("#planTemplateForm input[name=goodsUrl8]").val('');
			$("#planTemplateForm input[name=goodsDispOrd8]").val('');
			gridOptions_p8.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p8)});
		}
	} 
	function btnDeleteGridNum9(param){
		if ($('#btnAddGridNum9').css('display') !='none'){
			$('#btnAddGridNum9').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq9]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle9]").val('');
			$("#planTemplateForm input[name=goodsUrl9]").val('');
			$("#planTemplateForm input[name=goodsDispOrd9]").val('');
			gridOptions_p9.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p9)});
		}
	} 
	function btnDeleteGridNum10(param){
		if ($('#btnAddGridNum10').css('display') !='none'){
			$('#btnAddGridNum10').hide();
			var deleteData = [];
			var data = {};
				data.planContSq = $('#planTemplateForm input[name=goodsPlanContSq10]').val();
				deleteData.push(data);
			var jsonData = JSON.stringify(deleteData);
			gagajf.ajaxJsonSubmit('marketing/planning/detail/template/goods/delete', jsonData);
			$("#planTemplateForm input[name=goodsTitle10]").val('');
			$("#planTemplateForm input[name=goodsUrl10]").val('');
			$("#planTemplateForm input[name=goodsDispOrd10]").val('');
			gridOptions_p10.api.updateRowData({remove:gagaAgGrid.getAllRowData(gridOptions_p10)});
		}
	} 	
	
	
	// 첨부파일 개수 선택시
	$("#fileCnt").on("change", function() {
		for (var i = 1; i <= 10; i++) {
			$('#file' + i).parent().parent().show();
		}

		var fileCnt = $(this).val();
		for (var i = 10; i > fileCnt; i--) {
			$('#file' + i).parent().parent().hide();
		}
	});
	
	// 유의사항 개수 선택시
	$("#noticeCnt").on("change", function() {
		for (var i = 1; i <= 10; i++) {
			$('#notice' + i).parent().parent().parent().show();
		}

		var noticeCnt = $(this).val();
		for (var i = 10; i > noticeCnt; i--) {
			$('#notice' + i).parent().parent().parent().hide();
		}
	});
	
	// 쿠폰 개수 선택시
	$("#couponCnt").on("change", function() {
		for (var i = 1; i <= 10; i++) {
			$('#coupon' + i).parent().parent().show();
		}

		var couponCnt = $(this).val();
		for (var i = 10; i > couponCnt; i--) {
			$('#coupon' + i).parent().parent().hide();
		}
	});

	// 파일첨부 선택 시
	$('#file1').on('change', function() { fnChooseFile(this, 1); });
	$('#file2').on('change', function() { fnChooseFile(this, 2); });
	$('#file3').on('change', function() { fnChooseFile(this, 3); });
	$('#file4').on('change', function() { fnChooseFile(this, 4); });
	$('#file5').on('change', function() { fnChooseFile(this, 5); });
	$('#file6').on('change', function() { fnChooseFile(this, 6); });
	$('#file7').on('change', function() { fnChooseFile(this, 7); });
	$('#file8').on('change', function() { fnChooseFile(this, 8); });
	$('#file9').on('change', function() { fnChooseFile(this, 9); });
	$('#file10').on('change', function() { fnChooseFile(this, 10); });
	

	var fnChooseFile = function(obj, fileNo) {
		// multiple 속성이 있으면 files에는 다수의 객체가 할당됨
		var file = obj.files[0];

		// 파일 업로드
		gagajf.ajaxFileUpload('/common/file/upload?subDir=/planning'
				, file
				, function(result) {
					// 업로드한 파일명 설정
					$('#fileItemVal' + fileNo).val(result.oldFileName);
					$('#sysFileNm' + fileNo).val(result.newFileName);
				}
		);
	}
	
	// 리뷰상품 추가 콜백 함수
	var reviewGoodsList = function (result) {
		// 기존 리스트 데이터 for
		for(let i = 0 ; i < result.length ; i++) {
			let addChk = true, gridListValue = gagaAgGrid.getAllRowData(gridOptionsPlanReviewList);		// 받아온 모든 데이터
			// 받아온 data for
			for(let j = 0 ; j < gridListValue.length ; j++) {
				// 동일한 data는 추가하지 않음
				if(gridListValue[j].reItemVal == result[i].goodsCd) {	addChk = false;	}		// 중복체크
			}
			// 중복되지 않은 데이터 리스트에 추가
			if(addChk) {
				gagaAgGrid.addRowData(gridOptionsPlanReviewList, {"reItemVal":result[i].goodsCd , "reItemNm":result[i].goodsNm, "startSearchDate": _today, "startSearchTime": '00:00:00', "endSearchDate":_today, endSearchTime: '23:59:59' });
			}
		}
		
		uifnPopupClose("popupGoods");
	}
	
	// 리뷰 선택삭제 버튼 클릭시
    $('#btnReviewDelete').on('click', function() {
    	gridOptionsPlanReviewList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsPlanReviewList)});
    });
	
	
	// 쿠폰조회 팝업
	var fnOpenCouponRetrievePopup = function(strReturnCode, strReturnName) {
		var oParam = new Object();
		oParam.returnCode = strReturnCode;
		oParam.returnName = strReturnName;
		cfnOpenCouponRetrievePopup($(strReturnName).val(), oParam);
	}
	
	// 쿠폰 추가
	var fnAddCoupone = function() {
		var len =  $('#planTemplateForm').find('#couponTable tr').length;
		
		var html =  '<tr>';
		html += '<td colspan="3">';
		html += '<input type="text" class="w300" id="cuItemNm" name="cuItemNm'+(len+1)+'"/>';
		html += '<button type="button" class="btn icn" id="couponPlusBtn'+(len+1)+'"><i class="fa fa-search cpn" aria-hidden="true"></i></button>';
		html += '<input id="cuItemVal" name="cuItemVal'+(len+1)+'" type="text" class="w100" maxlength="20" readonly="readonly"/>';
		html += '<button type="button" class="btn icn" id="deleteCoupon'+(len+1)+'"><i class="fa fa-eraser" aria-hidden="true"></i></button>';
		html += '</td>';
		html += '</tr>';
			
			
			
		$("#couponTable").append(html);
		
		$('#couponPlusBtn'+(len+1)).attr("onclick","fnOpenCouponRetrievePopup('input[name=cuItemVal"+(len+1)+"]', 'input[name=cuItemNm"+(len+1)+"]');")
		$('#deleteCoupon'+(len+1)).attr("onclick","deleteRowCoupon("+(len+1)+")");
	}
	

	 //삭제 버튼
	var deleteRowCoupon = function(len) {  
		var cnt = len;
	    var html = $("#deleteCoupon"+len).closest('tr');
	    html.remove(); //tr 테그 삭제
	} 
		
	
	// 팝업창 저장
	$('#btnSaveTemplate').on('click', function() {
		
		// 리뷰관련 데이터 담기
		let allReviewData = gagaAgGrid.getAllRowData(gridOptionsPlanReviewList);
		var multiPlanReview = [];
		
		$.each(allReviewData, function(idx, item) {
			multiPlanReview.push(item.reItemVal);
		});
		
		var multiPlanReviewStartD = [];
		$.each(allReviewData, function(idx, item) {
			multiPlanReviewStartD.push(item.startSearchDate);
		});
		
		var multiPlanReviewStartT = [];
		$.each(allReviewData, function(idx, item) {
			multiPlanReviewStartT.push(item.startSearchTime);
		});
		
		var multiPlanReviewEndD = [];
		$.each(allReviewData, function(idx, item) {
			multiPlanReviewEndD.push(item.endSearchDate);
		});
		
		var multiPlanReviewEndT = [];
		$.each(allReviewData, function(idx, item) {
			multiPlanReviewEndT.push(item.endSearchTime);
		});
		
		// 쿠폰관련 데이터 담기
		var multiPlanCoupon = [];
		var len =  $('#planTemplateForm').find('#couponTable tr').length;
		for (var i = 0; i < len; i++) {
			multiPlanCoupon.push($('#planTemplateForm').find('#couponTable tr').children().eq(i).find("#cuItemVal").val());
		}
		
		//파일관련 데이터 담기
		var multiPlanFile = [];
		var multiPlanFile2 = [];
		var multiPlanFile3 = [];
		
		var count = $("#planTemplateForm select[name=fileCnt]").val();
		for (var i = 0; i < count; i++) {
			if($('#fileItemVal'+(i+1)).val() == '' || typeof $('#fileItemVal'+(i+1)).val() == 'undeifined'){
				false;
			}else{
				multiPlanFile.push($('#fileItemVal'+(i+1)).val());
				multiPlanFile2.push($('#planTemplateForm input[name=fileLinkUrl'+(i+1)+']').val());
				multiPlanFile3.push($('#planTemplateForm input:radio[name=fileLinkOpenGb'+(i+1)+']:checked').val());
			}
		}
		
		//유의사항관련 데이터 담기
		var multiPlanNotice = [];
		
		var count = $("#planTemplateForm select[name=noticeCnt]").val();
		for (var i = 0; i < count; i++) {
			if($('#noticeItemVal'+(i+1)).val() == '' || typeof $('#noticeItemVal'+(i+1)).val() == 'undeifined'){
				false;
			}else{
				multiPlanNotice.push($('#noticeItemVal'+(i+1)).val());
			}
		}
		
		//쿠폰 유의사항관련 데이터 담기
		var multiPlanCouponNotice = [];
		
		var count = $("#planTemplateForm select[name=couponCnt]").val();
		for (var i = 0; i < count; i++) {
			if($('#cpnNote'+i).val() == '' || typeof $('#cpnNote'+i).val() == 'undeifined'){
				false;
			}else{
				multiPlanCouponNotice.push($('#cpnNote'+i).val());
			}
		}
		
		// 상품 등록
		let arrayData1 = gagaAgGrid.getAllRowData(gridOptions_p1)
		let arrayData2 = gagaAgGrid.getAllRowData(gridOptions_p2)
		let arrayData3 = gagaAgGrid.getAllRowData(gridOptions_p3)
		let arrayData4 = gagaAgGrid.getAllRowData(gridOptions_p4)
		let arrayData5 = gagaAgGrid.getAllRowData(gridOptions_p5)
		let arrayData6 = gagaAgGrid.getAllRowData(gridOptions_p6)
		let arrayData7 = gagaAgGrid.getAllRowData(gridOptions_p7)
		let arrayData8 = gagaAgGrid.getAllRowData(gridOptions_p8)
		let arrayData9 = gagaAgGrid.getAllRowData(gridOptions_p9)
		let arrayData10 = gagaAgGrid.getAllRowData(gridOptions_p10)
		

		let goodsTemp1 = {};
		let goodsTemp2 = {};
		let goodsTemp3 = {};
		let goodsTemp4 = {};
		let goodsTemp5 = {};
		let goodsTemp6 = {};
		let goodsTemp7 = {};
		let goodsTemp8 = {};
		let goodsTemp9 = {};
		let goodsTemp10 = {};
		goodsTemp1.goodsTitle = $('#planTemplateForm input[name=goodsTitle1]').val();
		goodsTemp1.goodsUrl = $('#planTemplateForm input[name=goodsUrl1]').val();
		goodsTemp1.goodsType = $('#planTemplateForm input:radio[name=goodsType1]:checked').val();
		goodsTemp1.goodsLinkOpenGb = $('#planTemplateForm input[name=linkOpenGb1]:checked').val();
		goodsTemp1.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd1]').val();
		goodsTemp1.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn1]').val();
		goodsTemp1.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq1]').val();
		
		goodsTemp2.goodsTitle = $('#planTemplateForm input[name=goodsTitle2]').val();
		goodsTemp2.goodsUrl = $('#planTemplateForm input[name=goodsUrl2]').val();
		goodsTemp2.goodsType = $('#planTemplateForm input:radio[name=goodsType2]:checked').val();
		goodsTemp2.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb2]:checked').val();
		goodsTemp2.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd2]').val();
		goodsTemp2.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn2]').val();
		goodsTemp2.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq2]').val();
		
		goodsTemp3.goodsTitle = $('#planTemplateForm input[name=goodsTitle3]').val();
		goodsTemp3.goodsUrl = $('#planTemplateForm input[name=goodsUrl3]').val();
		goodsTemp3.goodsType = $('#planTemplateForm input:radio[name=goodsType3]:checked').val();
		goodsTemp3.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb3]:checked').val();
		goodsTemp3.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd3]').val();
		goodsTemp3.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn3]').val();
		goodsTemp3.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq3]').val();
		
		goodsTemp4.goodsTitle = $('#planTemplateForm input[name=goodsTitle4]').val();
		goodsTemp4.goodsUrl = $('#planTemplateForm input[name=goodsUrl4]').val();
		goodsTemp4.goodsType = $('#planTemplateForm input:radio[name=goodsType4]:checked').val();
		goodsTemp4.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb4]:checked').val();
		goodsTemp4.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd4]').val();
		goodsTemp4.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn4]').val();
		goodsTemp4.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq4]').val();
		
		goodsTemp5.goodsTitle = $('#planTemplateForm input[name=goodsTitle5]').val();
		goodsTemp5.goodsUrl = $('#planTemplateForm input[name=goodsUrl5]').val();
		goodsTemp5.goodsType = $('#planTemplateForm input:radio[name=goodsType5]:checked').val();
		goodsTemp5.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb5]:checked').val();
		goodsTemp5.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd5]').val();
		goodsTemp5.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn5]').val();
		goodsTemp5.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq5]').val();
		
		goodsTemp6.goodsTitle = $('#planTemplateForm input[name=goodsTitle6]').val();
		goodsTemp6.goodsUrl = $('#planTemplateForm input[name=goodsUrl6]').val();
		goodsTemp6.goodsType = $('#planTemplateForm input:radio[name=goodsType6]:checked').val();
		goodsTemp6.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb6]:checked').val();
		goodsTemp6.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd6]').val();
		goodsTemp6.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn6]').val();
		goodsTemp6.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq6]').val();
		
		goodsTemp7.goodsTitle = $('#planTemplateForm input[name=goodsTitle7]').val();
		goodsTemp7.goodsUrl = $('#planTemplateForm input[name=goodsUrl7]').val();
		goodsTemp7.goodsType = $('#planTemplateForm input:radio[name=goodsType7]:checked').val();
		goodsTemp7.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb7]:checked').val();
		goodsTemp7.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd7]').val();
		goodsTemp7.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn7]').val();
		goodsTemp7.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq7]').val();
		
		goodsTemp8.goodsTitle = $('#planTemplateForm input[name=goodsTitle8]').val();
		goodsTemp8.goodsUrl = $('#planTemplateForm input[name=goodsUrl8]').val();
		goodsTemp8.goodsType = $('#planTemplateForm input:radio[name=goodsType8]:checked').val();
		goodsTemp8.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb8]:checked').val();
		goodsTemp8.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd8]').val();
		goodsTemp8.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn8]').val();
		goodsTemp8.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq8]').val();
		
		goodsTemp9.goodsTitle = $('#planTemplateForm input[name=goodsTitle9]').val();
		goodsTemp9.goodsUrl = $('#planTemplateForm input[name=goodsUrl9]').val();
		goodsTemp9.goodsType = $('#planTemplateForm input:radio[name=goodsType9]:checked').val();
		goodsTemp9.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb9]:checked').val();
		goodsTemp9.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd9]').val();
		goodsTemp9.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn9]').val();
		goodsTemp9.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq9]').val();
		
		goodsTemp10.goodsTitle = $('#planTemplateForm input[name=goodsTitle10]').val();
		goodsTemp10.goodsUrl = $('#planTemplateForm input[name=goodsUrl10]').val();
		goodsTemp10.goodsType = $('#planTemplateForm input:radio[name=goodsType10]:checked').val();
		goodsTemp10.goodsLinkOpenGb = $('#planTemplateForm input:radio[name=linkOpenGb10]:checked').val();
		goodsTemp10.goodsDispOrd = $('#planTemplateForm input[name=goodsDispOrd10]').val();
		goodsTemp10.goodsDispYn = $('#planTemplateForm input:checkbox[name=goodsDispYn10]').val();
		goodsTemp10.goodsPlanContSq = $('#planTemplateForm input[name=goodsPlanContSq10]').val();
		
		mcxDialog.confirm('기획전 템플릿을 등록 하시겠습니까?', {
			cancelBtnText: "취소",
			sureBtnText: "확인",
			sureBtnClick: function() {
				
				let data = {
							multiPlanReview : multiPlanReview
						   ,allReviewData : allReviewData
						   ,multiPlanReviewStartD : multiPlanReviewStartD
						   ,multiPlanReviewStartT : multiPlanReviewStartT
						   ,multiPlanReviewEndD : multiPlanReviewEndD
						   ,multiPlanReviewEndT : multiPlanReviewEndT
						   ,reTitle : $('#planTemplateForm input[name=reTitle]').val()
						   ,reDispOrd : $('#planTemplateForm input[name=reDispOrd]').val()
						   ,rePlanContSq : $('#planTemplateForm input[name=rePlanContSq]').val()
						   ,reDispYn :  $('#planTemplateForm input:checkbox[name=reDispYn]').val()
						   ,mode :  $('#planTemplateForm input[name=mode]').val()
						   ,planSq : $('#planTemplateForm input[name=planSq]').val()
						   ,multiPlanCoupon : multiPlanCoupon
						   ,cuTitle : $('#planTemplateForm input[name=cuTitle]').val()              
						   ,cuDispOrd : $('#planTemplateForm input[name=cuDispOrd]').val()        
						   ,cuPlanContSq : $('#planTemplateForm input[name=cuPlanContSq]').val()
						   ,cuDispYn :  $('#planTemplateForm input:checkbox[name=cuDispYn]').val()  
						   ,multiPlanCouponNotice : multiPlanCouponNotice
						   ,multiPlanFile : multiPlanFile
						   ,multiPlanFile2 : multiPlanFile2
						   ,multiPlanFile3 : multiPlanFile3
						   ,fileDispYn : $('#planTemplateForm input:checkbox[name=fileDispYn]').val() 
						   ,fileDispOrd : $('#planTemplateForm input[name=fileDispOrd]').val()  
						   ,filePlanContSq : $('#planTemplateForm input[name=filePlanContSq]').val()
						   ,multiPlanNotice : multiPlanNotice
						   ,noticeDispYn : $('#planTemplateForm input:checkbox[name=noticeDispYn]').val() 
						   ,noticeDispOrd : $('#planTemplateForm input[name=noticeDispOrd]').val()  
						   ,noticePlanContSq : $('#planTemplateForm input[name=noticePlanContSq]').val()
						   ,topFsrcDispYn : $('#planTemplateForm input:checkbox[name=topFsrcDispYn]').val() 
						   ,btmFsrcDispYn : $('#planTemplateForm input:checkbox[name=btmFsrcDispYn]').val() 
						   ,topFsrcDispOrd: $('#planTemplateForm input[name=topFsrcDispOrd]').val() 
						   ,btmFsrcDispOrd : $('#planTemplateForm input[name=btmFsrcDispOrd]').val() 
						   ,fsrcPcTop : $('#planTemplateForm textarea[name=fsrcPcTop]').val()      
						   ,fsrcMobileTop: $('#planTemplateForm textarea[name=fsrcMobileTop]').val()      
						   ,fsrcPcBtm: $('#planTemplateForm textarea[name=fsrcPcBtm]').val()      		
						   ,fsrcMobileBtm :  $('#planTemplateForm textarea[name=fsrcMobileBtm]').val()   
						   ,multiPlanGoodsContent1 : goodsTemp1
						   ,multiPlanGoodsContent2 : goodsTemp2
						   ,multiPlanGoodsContent3 : goodsTemp3
						   ,multiPlanGoodsContent4 : goodsTemp4
						   ,multiPlanGoodsContent5 : goodsTemp5
						   ,multiPlanGoodsContent6 : goodsTemp6
						   ,multiPlanGoodsContent7 : goodsTemp7
						   ,multiPlanGoodsContent8 : goodsTemp8
						   ,multiPlanGoodsContent9 : goodsTemp9
						   ,multiPlanGoodsContent10 : goodsTemp10
						   ,multiPlanGoodsContentVal1 : arrayData1
						   ,multiPlanGoodsContentVal2 : arrayData2
						   ,multiPlanGoodsContentVal3 : arrayData3
						   ,multiPlanGoodsContentVal4 : arrayData4
						   ,multiPlanGoodsContentVal5 : arrayData5
						   ,multiPlanGoodsContentVal6 : arrayData6
						   ,multiPlanGoodsContentVal7 : arrayData7
						   ,multiPlanGoodsContentVal8 : arrayData8
						   ,multiPlanGoodsContentVal9 : arrayData9
						   ,multiPlanGoodsContentVal10 : arrayData10
						   
				}
				var jsonData = JSON.stringify(data);
				gagajf.ajaxJsonSubmit('/marketing/planning/detail/template/save', jsonData, fnDetailFormSearch);
			}
		});
	});
	
	
	// 템플릿 등록 후 콜백
	var fnDetailFormSearch = function() {
		uifnPopupClose('popupPlanTemplate');		
	}
	
	// 첨부파일 삭제
	var fnDeleteFile = function(obj, planSq, planContItemSq, fileItemVal) {
		mcxDialog.confirm('정말 삭제하시겠습니까?', {
			cancelBtnText: "취소",
			sureBtnText: "확인",
			sureBtnClick: function(){
				var params = new Object();
				params.planSq = planSq;
				params.planContItemSq = planContItemSq;
				params.fileItemVal = fileItemVal;

				var jsonData = JSON.stringify(params);
				gagajf.ajaxJsonSubmit('/marketing/planning/detail/template/file/delete', jsonData, function() {
					$(obj).parent().remove();
				});
			}
		});
	}
	
	
$(document).ready(function() {
		//gagaSn.setContents('#fsrcPcBtm', ''); 
		//gagaSn.setContents('#fsrcMobileBtm', '');
		//gagaSn.setContents('#fsrcPcTop', ''); 
		//gagaSn.setContents('#fsrcMobileTop', '');
 		var snOptions1 = gagaSn.getToolbarOptions('media');
		var snOptions2 = gagaSn.getToolbarOptions('media');
		var snOptions3 = gagaSn.getToolbarOptions('media');
		var snOptions4 = gagaSn.getToolbarOptions('media');
		
		// 썸머노트 그리기
		gagaSn.createSummernote(snOptions1, '#fsrcPcTop');
		gagaSn.createSummernote(snOptions2, '#fsrcMobileTop');
		gagaSn.createSummernote(snOptions3, '#fsrcPcBtm');
		gagaSn.createSummernote(snOptions4, '#fsrcMobileBtm');  
		
		// 그리드 그리기
		gagaAgGrid.createGrid("gridListPlanReview", gridOptionsPlanReviewList);
		gagaAgGrid.createGrid("gridTempGbList1", gridOptions_p1);
		gagaAgGrid.createGrid("gridTempGbList2", gridOptions_p2);
		gagaAgGrid.createGrid("gridTempGbList3", gridOptions_p3);
		gagaAgGrid.createGrid("gridTempGbList4", gridOptions_p4);
		gagaAgGrid.createGrid("gridTempGbList5", gridOptions_p5);
		gagaAgGrid.createGrid("gridTempGbList6", gridOptions_p6);
		gagaAgGrid.createGrid("gridTempGbList7", gridOptions_p7);
		gagaAgGrid.createGrid("gridTempGbList8", gridOptions_p8);
		gagaAgGrid.createGrid("gridTempGbList9", gridOptions_p9);
		gagaAgGrid.createGrid("gridTempGbList10", gridOptions_p10);
		
		$("input:checkbox[name=reDispYn]").change(function() {
			if($("input:checkbox[name=reDispYn]").is(":checked")){
				$("input:checkbox[name=reDispYn]").val('Y');
	        }else{
	        	$("input:checkbox[name=reDispYn]").val('N');
	        }
		})
		
		$("input:checkbox[name=cuDispYn]").change(function() {
			if($("input:checkbox[name=cuDispYn]").is(":checked")){
				$("input:checkbox[name=cuDispYn]").val('Y');
	        }else{
	        	$("input:checkbox[name=cuDispYn]").val('N');
	        }
		})
		
		$("input:checkbox[name=fileDispYn]").change(function() {
			if($("input:checkbox[name=fileDispYn]").is(":checked")){
				$("input:checkbox[name=fileDispYn]").val('Y');
	        }else{
	        	$("input:checkbox[name=fileDispYn]").val('N');
	        }
		})
		
		$("input:checkbox[name=noticeDispYn]").change(function() {
			if($("input:checkbox[name=noticeDispYn]").is(":checked")){
				$("input:checkbox[name=noticeDispYn]").val('Y');
	        }else{
	        	$("input:checkbox[name=noticeDispYn]").val('N');
	        }
		})
		
		$("input:checkbox[name=topFsrcDispYn]").change(function() {
			if($("input:checkbox[name=topFsrcDispYn]").is(":checked")){
				$("input:checkbox[name=topFsrcDispYn]").val('Y');
	        }else{
	        	$("input:checkbox[name=topFsrcDispYn]").val('N');
	        }
		})
		
		$("input:checkbox[name=btmFsrcDispYn]").change(function() {
			if($("input:checkbox[name=btmFsrcDispYn]").is(":checked")){
				$("input:checkbox[name=btmFsrcDispYn]").val('Y');
	        }else{
	        	$("input:checkbox[name=btmFsrcDispYn]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn1]").change(function() {
			if($("input:checkbox[name=goodsDispYn1]").is(":checked")){
				$("input:checkbox[name=goodsDispYn1]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn1]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn2]").change(function() {
			if($("input:checkbox[name=goodsDispYn2]").is(":checked")){
				$("input:checkbox[name=goodsDispYn2]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn2]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn3]").change(function() {
			if($("input:checkbox[name=goodsDispYn3]").is(":checked")){
				$("input:checkbox[name=goodsDispYn3]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn3]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn4]").change(function() {
			if($("input:checkbox[name=goodsDispYn4]").is(":checked")){
				$("input:checkbox[name=goodsDispYn4]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn4]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn5]").change(function() {
			if($("input:checkbox[name=goodsDispYn5]").is(":checked")){
				$("input:checkbox[name=goodsDispYn5]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn5]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn6]").change(function() {
			if($("input:checkbox[name=goodsDispYn6]").is(":checked")){
				$("input:checkbox[name=goodsDispYn6]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn6]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn7]").change(function() {
			if($("input:checkbox[name=goodsDispYn7]").is(":checked")){
				$("input:checkbox[name=goodsDispYn7]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn7]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn8]").change(function() {
			if($("input:checkbox[name=goodsDispYn8]").is(":checked")){
				$("input:checkbox[name=goodsDispYn8]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn8]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn9]").change(function() {
			if($("input:checkbox[name=goodsDispYn9]").is(":checked")){
				$("input:checkbox[name=goodsDispYn9]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn9]").val('N');
	        }
		})
		
		$("input:checkbox[name=goodsDispYn10]").change(function() {
			if($("input:checkbox[name=goodsDispYn10]").is(":checked")){
				$("input:checkbox[name=goodsDispYn10]").val('Y');
	        }else{
	        	$("input:checkbox[name=goodsDispYn10]").val('N');
	        }
		})
		
		
		if(mode == 'U'){
			if(typeof reviewList[0] != 'undefined'){
				// 리뷰
				$('#planTemplateForm input[name=reTitle]').val(reviewList[0].title);
				$('#planTemplateForm input[name=reDispOrd]').val(reviewList[0].dispOrd);
				$('#planTemplateForm input[name=rePlanContSq]').val(reviewList[0].planContSq);
				
				if (reviewList[0].dispYn == 'Y') {
					$('#planTemplateForm input:checkbox[name="reDispYn"]').prop('checked', true);
				}
				
				if(typeof reviewList[0].reItemVal != 'undefined' && reviewList[0].reItemVal != null){
					gridOptionsPlanReviewList.api.setRowData(reviewList);	
				}
				
				
			}
			if(typeof couponList[0] != 'undefined'){
				//쿠폰
				$('#planTemplateForm input[name=cuTitle]').val(couponNotice.title);
				$('#planTemplateForm input[name=cuDispOrd]').val(couponNotice.dispOrd);
				$('#planTemplateForm input[name=cuPlanContSq]').val(couponNotice.planContSq);
				if (couponNotice.dispYn == 'Y') {
					$('#planTemplateForm input:checkbox[name="cuDispYn"]').prop('checked', true);
				}
				if (couponNotice.cpnNote0 != null && couponNotice.cpnNote0 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(1);
					$("#cpnNote0").val(couponNotice.cpnNote0);
				}
				if (couponNotice.cpnNote1 != null && couponNotice.cpnNote1 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(2);
					$("#cpnNote1").val(couponNotice.cpnNote1);
				}
				if (couponNotice.cpnNote2 != null && couponNotice.cpnNote2 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(3);
					$("#cpnNote2").val(couponNotice.cpnNote2);
				}
				if (couponNotice.cpnNote3 != null && couponNotice.cpnNote3 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(4);
					$("#cpnNote3").val(couponNotice.cpnNote3);
				}
				if (couponNotice.cpnNote4 != null && couponNotice.cpnNote4 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(5);
					$("#cpnNote4").val(couponNotice.cpnNote4);
				}
				if (couponNotice.cpnNote5 != null && couponNotice.cpnNote5 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(6);
					$("#cpnNote5").val(couponNotice.cpnNote5);
				}
				if (couponNotice.cpnNote6 != null && couponNotice.cpnNote6 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(7);
					$("#cpnNote6").val(couponNotice.cpnNote6);
				}
				if (couponNotice.cpnNote7 != null && couponNotice.cpnNote7 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(8);
					$("#cpnNote7").val(couponNotice.cpnNote7);
				}
				if (couponNotice.cpnNote8 != null && couponNotice.cpnNote8 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(9);
					$("#cpnNote8").val(couponNotice.cpnNote8);
				}
				if (couponNotice.cpnNote9 != null && couponNotice.cpnNote9 != '') {
					$("#planTemplateForm select[name=couponCnt]").val(10);
					$("#cpnNote9").val(couponNotice.cpnNote9);
				}
				
				if(couponList[0].cuItemNm != null && couponList[0].cuItemNm != '')
				{
					for (var i = 0; i <couponList.length; i++) {
						var html =  '<tr>';
						html += '<td colspan="3">';
						html += '<input type="text" class="w300" id="cuItemNm" name="cuItemNm'+(i+1)+'" value="'+ couponList[i].cuItemNm +'"/>';
						html += '<button type="button" class="btn icn" id="couponPlusBtn'+(i+1)+'"><i class="fa fa-search cpn" aria-hidden="true"></i></button>';
						html += '<input id="cuItemVal" name="cuItemVal'+(i+1)+'" type="text" class="w100" maxlength="20" readonly="readonly" value="'+ couponList[i].cuItemVal +'"/>';
						html += '<button type="button" class="btn icn" id="deleteCoupon'+(i+1)+'"><i class="fa fa-eraser" aria-hidden="true"></i></button>';
						html += '</td>';
						html += '</tr>';
							
						$("#couponTable").append(html);
						
						$('#couponPlusBtn'+(i+1)).attr("onclick","fnOpenCouponRetrievePopup('input[name=cuItemVal"+(i+1)+"]', 'input[name=cuItemNm"+(i+1)+"]');")
						$('#deleteCoupon'+(i+1)).attr("onclick","deleteRowCoupon("+(i+1)+")");
					}
				}
			}
			
			if(typeof fileList[0] != 'undefined'){
				//파일
				$('#planTemplateForm input[name=fileDispOrd]').val(fileList[0].dispOrd);
				$('#planTemplateForm input[name=filePlanContSq]').val(fileList[0].planContSq);
				
				if (fileList[0].dispYn == 'Y') {
					$('#planTemplateForm input:checkbox[name="fileDispYn"]').prop('checked', true);
				}
				
				if(fileList.length > 0 && fileList[0].fileItemVal != null)
				{
					$("#planTemplateForm select[name=fileCnt]").val(fileList.length);
					
					for (var i = 0; i <fileList.length; i++) {
						$("#planTemplateForm input[name=fileLinkUrl"+ (i+1) +"]").val(fileList[i].linkUrl);
						$("#planTemplateForm label[id=file_"+ (i+1) +"]").html(fileList[i].fileItemVal);
						$("#planTemplateForm input[id=fileItemVal"+ (i+1) +"]").val(fileList[i].fileItemVal);
						if (fileList[i].linkOpenGb == "M") {
							$('#planTemplateForm input:radio[name=fileLinkOpenGb'+(i+1)+']:radio[value="M"]').prop('checked', true);
						}else if(fileList[i].linkOpenGb == "N"){
							$('#planTemplateForm input:radio[name=fileLinkOpenGb'+(i+1)+']:radio[value="N"]').prop('checked', true);
						}
							
					} 
				}
			}
			
			if(typeof noticeList[0] != 'undefined'){
				//유의사항
				$('#planTemplateForm input[name=noticeDispOrd]').val(noticeList[0].dispOrd);
				$('#planTemplateForm input[name=noticePlanContSq]').val(noticeList[0].planContSq);
				
				if (noticeList[0].dispYn == 'Y') {
					$('#planTemplateForm input:checkbox[name="noticeDispYn"]').prop('checked', true);
				}
				
				if(noticeList.length > 0 && noticeList[0].noticeItemVal != null)
				{
					$("#planTemplateForm select[name=noticeCnt]").val(noticeList.length);
					
					for (var i = 0; i <noticeList.length; i++) {
						$("#planTemplateForm input[id=noticeItemVal"+ (i+1) +"]").val(noticeList[i].noticeItemVal);
							
					} 
				}
			}
			
			//html(하단)
			if(typeof fsrcListBtm[0] != 'undefined'){
				$('#planTemplateForm input[name=btmFsrcDispOrd]').val(fsrcListBtm[0].dispOrd);
				
				if (fsrcListBtm[0].dispYn == 'Y') {
					$('#planTemplateForm input:checkbox[name="btmFsrcDispYn"]').prop('checked', true);
				}
			
				$('#fsrcPcBtm').summernote('code', fsrcListBtm[0].fsrcPc);
				$('#fsrcMobileBtm').summernote('code', fsrcListBtm[0].fsrcMob);
				//gagaSn.setContents('#fsrcPcBtm', fsrcListBtm[0].fsrcPc); 
				//gagaSn.setContents('#fsrcMobileBtm', fsrcListBtm[0].fsrcMob);
			}
			
			//html(상단)
			if(typeof fsrcListTop[0] != 'undefined'){
				$('#planTemplateForm input[name=topFsrcDispOrd]').val(fsrcListTop[0].dispOrd);
				
				if (fsrcListTop[0].dispYn == 'Y') {
					$('#planTemplateForm input:checkbox[name="topFsrcDispYn"]').prop('checked', true);
				}
			
				$('#fsrcPcTop').summernote('code', fsrcListTop[0].fsrcPc);
				$('#fsrcMobileTop').summernote('code', fsrcListTop[0].fsrcMob);
				//gagaSn.setContents('#fsrcPcTop', fsrcListTop[0].fsrcPc); 
				//gagaSn.setContents('#fsrcMobileTop', fsrcListTop[0].fsrcMob);
			}
			
			//상품
			if(typeof goodsList[0] != 'undefined'){
				for (var i = 0; i < goodsList.length; i++) {
					$('#planTemplateForm input[name=goodsTitle'+(i+1)+']').val(goodsList[i].title);						
					$('#planTemplateForm input[name=goodsUrl'+(i+1)+']').val(goodsList[i].linkUrl);
					$('#planTemplateForm input[name=goodsDispOrd'+(i+1)+']').val(goodsList[i].dispOrd);
					$('#planTemplateForm input[name=goodsPlanContSq'+(i+1)+']').val(goodsList[i].planContSq);
					$('#planTemplateForm input[name=goodsPlanContItemSq'+(i+1)+']').val(goodsList[i].planContItemSq);
					
					if (goodsList[i].title != '' || goodsList[i].linkUrl != '' ){
						if (goodsList[i].dispYn == 'Y') {
							$('#planTemplateForm input:checkbox[name=goodsDispYn'+(i+1)+']').prop('checked', true);
						}else{
							$('#planTemplateForm input:checkbox[name=goodsDispYn'+(i+1)+']').prop('checked', false);
						}
						
						if(goodsList[i].tmplType == "G082_50"){
							$('#planTemplateForm input:radio[name=goodsType'+(i+1)+']:radio[value="G082_50"]').prop('checked', true);
						}else if(goodsList[i].tmplType == "G082_51"){
							$('#planTemplateForm input:radio[name=goodsType'+(i+1)+']:radio[value="G082_51"]').prop('checked', true);
						}else if(goodsList[i].tmplType == "G082_52"){
							$('#planTemplateForm input:radio[name=goodsType'+(i+1)+']:radio[value="G082_52"]').prop('checked', true);
						}
						
						if (goodsList[i].linkOpenGb == "M") {
							$('#planTemplateForm input:radio[name=linkOpenGb'+(i+1)+']:radio[value="M"]').prop('checked', true);
						}else if(goodsList[i].linkOpenGb == "N"){
							$('#planTemplateForm input:radio[name=linkOpenGb'+(i+1)+']:radio[value="N"]').prop('checked', true);
						}
						$('#btnAddGridNum' + (i + 1)).show();
						
					}
					
					if(goodsDetailList1.length > 0){
						gridOptions_p1.api.setRowData(goodsDetailList1);
						$('#btnAddGridNum1').show();
					}
					if(goodsDetailList2.length > 0){
						gridOptions_p2.api.setRowData(goodsDetailList2);
						$('#btnAddGridNum2').show();
					}
					if(goodsDetailList3.length > 0){
						gridOptions_p3.api.setRowData(goodsDetailList3);
						$('#btnAddGridNum3').show();
					}
					if(goodsDetailList4.length > 0){
						gridOptions_p4.api.setRowData(goodsDetailList4);
						$('#btnAddGridNum4').show();
					}
					if(goodsDetailList5.length > 0){
						gridOptions_p5.api.setRowData(goodsDetailList5);
						$('#btnAddGridNum5').show();
					}
					if(goodsDetailList6.length > 0){
						gridOptions_p6.api.setRowData(goodsDetailList6);
						$('#btnAddGridNum6').show();
					}
					if(goodsDetailList7.length > 0){
						gridOptions_p7.api.setRowData(goodsDetailList7);
						$('#btnAddGridNum7').show();
					}
					if(goodsDetailList8.length > 0){
						gridOptions_p8.api.setRowData(goodsDetailList8);
						$('#btnAddGridNum8').show();
					}
					if(goodsDetailList9.length > 0){
						gridOptions_p9.api.setRowData(goodsDetailList9);
						$('#btnAddGridNum9').show();
					}
					if(goodsDetailList10.length > 0){
						gridOptions_p10.api.setRowData(goodsDetailList10);
						$('#btnAddGridNum10').show();
					} 
						
				}
			}
			
		}
		

		$("#fileCnt").trigger('change');
		$("#noticeCnt").trigger('change');
		$("#couponCnt").trigger('change');
		
});

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