<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : BasicEnvsetForm.html
 * @desc    : 기본환경설정 Page
 *============================================================================
 * Wivismall
 * Copyright(C) 2019 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2020.03.13   gagamel     최초 작성
 *******************************************************************************
 -->

	<div id="main">
		<!-- 메인타이틀 영역 -->
		<div class="main-title">
		</div>
		<!-- //메인타이틀 영역 -->

		<!-- 검색조건 영역 -->
		<div class="panelStyle2">
			<table class="frmStyle" aria-describedby="검색조건">
				<colgroup>
					<col style="width:10%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>사이트</th>
						<td>
							<select name="siteCd" class="w150" onchange="fnSearch();">
								<option th:if="${siteList}" th:each="oneData, status : ${siteList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
							</select>
						</td>
					</tr>
				</tbody>
			</table>
			<div class="panelBtnB"></div>
		</div>
		<!-- //검색조건 영역 -->
		<!-- 테이블 영역 -->
		<div class="panelStyle2">
			<h4>쇼핑몰Meta정보</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B10');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B10', '쇼핑몰Meta정보');">이력보기</button>
			<table class="frmStyle" aria-describedby="쇼핑몰Meta정보">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>웹브라우저Title</th>
						<td>
							<input name="b10StrSetVal1" type="text" class="w500" maxlength="200"/>
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>웹 브라우저 상단에 노출되는 사이트 소개 문구입니다.</span>
						</td>
					</tr>
					<tr>
						<th>쇼핑몰Title(og:title)</th>
						<td>
							<input name="b10StrSetVal2" type="text" class="w500" maxlength="200"/>
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>오픈그래프 Title입니다. 영문/한글/숫자만 입력하세요.</span>
						</td>
					</tr>
					<tr>
						<th>쇼핑몰설명(og:description)</th>
						<td>
							<input name="b10StrSetVal3" type="text" class="w500" maxlength="200"/>
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>오픈그래프 Description입니다. 200자 이내의 영문/한글/숫자만 입력하세요.</span>
						</td>
					</tr>
					<tr>
						<th>쇼핑몰이미지(og:image)</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b10StrSetVal4" name="b10StrSetVal4" class="uFileInput"/>
								<label for="b10StrSetVal4" class="uFileLabel">쇼핑몰이미지 선택</label>
								<input type="hidden" name="b10StrSetVal4OrgFileNm"/>
								<input type="hidden" name="b10StrSetVal4SysFileNm"/>
							</div>
							<a id="b10StrSetVal4FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b10StrSetVal4');"></a>
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>오픈그래프 Image입니다</span>
						</td>
					</tr>
					<tr>
						<th>키워드(Keywords)</th>
						<td>
							<input name="b10StrSetVal5" type="text" class="w500" maxlength="70"/>
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>70자 이내로 작성하시고 같은 단어는 3회 이상 반복하시면 안 됩니다.</span>
						</td>
					</tr>
					<tr>
						<th>파비콘이미지</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b10StrSetVal6" name="b10StrSetVal6" class="uFileInput"/>
								<label for="b10StrSetVal6" class="uFileLabel">파비콘이미지 선택</label>
								<input type="hidden" name="b10StrSetVal6OrgFileNm"/>
								<input type="hidden" name="b10StrSetVal6SysFileNm"/>
							</div>
							<a id="b10StrSetVal6FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b10StrSetVal6');"></a>
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>16x16 사이즈의 아이콘 이미지(확장자:ico)</span>
						</td>
					</tr>
				</tbody>
			</table>

			<h4>기본설정</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B11');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B11', '기본설정');">이력보기</button>
			<table class="frmStyle" aria-describedby="기본설정">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>탈퇴후재가입불가기간(월)</th>
						<td><input name="b11NumSetVal1" type="text" class="w50 aR" maxlength="2" data-valid-type="integer" data-valid-name="탈퇴후재가입불가기간"/><span class="cRed">개월</span> 동안 탈퇴 후 재가입 불가합니다.</td>
					</tr>
					<tr>
						<th>휴면회원선정기간(일)</th>
						<td><input name="b11NumSetVal2" type="text" class="w50 aR" maxlength="3" data-valid-type="integer" data-valid-name="휴면회원선정기간"/><span class="cRed">일</span> 동안 사이트에 로그인 하지 않은 회원을 휴면회원으로 선정합니다.</td>
					</tr>
					<tr>
						<th>휴면회원전환기간(일)</th>
						<td><input name="b11NumSetVal3" type="text" class="w50 aR" maxlength="3" data-valid-type="integer" data-valid-name="휴면회원전환기간"/><span class="cRed">일</span> 동안 사이트에 로그인 하지 않은 회원을 휴면회원으로 전환합니다.</td>
					</tr>
					<tr>
						<th>회원등급산정기간</th>
						<td>직전월 이전 <input name="b11NumSetVal4" type="text" class="w50 aR" maxlength="3" data-valid-type="integer" data-valid-name="회원등급산정기간"/><span class="cRed">개월</span> 기간동안의 매출금액을 기준으로 월초에 산정합니다. <span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>0으로 설정하면 회원별등급산정을 하지 않습니다.</span></td>
					</tr>
					<tr>
						<th>무료배송비최소주문금액</th>
						<td>최소주문금액이 <input name="b11NumSetVal5" type="text" class="w100 aR" maxlength="6" data-valid-type="integer" data-valid-name="무료배송비최소주문금액"/> 이상이면 배송비가 무료입니다. <span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>이 값은 기본값이며 공급업체별로 다르게 설정할 수도 있습니다.</span></td>
					</tr>
				</tbody>
			</table>

			<h4>회원혜택안내(PC)</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B12');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B12', '회원혜택안내');">이력보기</button>
			<table class="frmStyle" aria-describedby="회원혜택안내(PC)">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>가입혜택안내배너(A)</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b12StrSetVal1" name="b12StrSetVal1" class="uFileInput"/>
								<label for="b12StrSetVal1" class="uFileLabel">가입혜택안내배너 선택</label>
								<input type="hidden" name="b12StrSetVal1OrgFileNm"/>
								<input type="hidden" name="b12StrSetVal1SysFileNm"/>
							</div>
							<a id="b12StrSetVal1FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b12StrSetVal1');"></a>
						</td>
					</tr>
					<tr>
						<th>가입혜택안내배너(B)</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b12StrSetVal2" name="b12StrSetVal2" class="uFileInput"/>
								<label for="b12StrSetVal2" class="uFileLabel">가입혜택안내배너 선택</label>
								<input type="hidden" name="b12StrSetVal2OrgFileNm"/>
								<input type="hidden" name="b12StrSetVal2SysFileNm"/>
							</div>
							<a id="b12StrSetVal2FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b12StrSetVal2');"></a>
						</td>
					</tr>
					<tr>
						<th>회원혜택안내배너</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b12StrSetVal3" name="b12StrSetVal3" class="uFileInput"/>
								<label for="b12StrSetVal3" class="uFileLabel">회원혜택안내배너 선택</label>
								<input type="hidden" name="b12StrSetVal3OrgFileNm"/>
								<input type="hidden" name="b12StrSetVal3SysFileNm"/>
							</div>
							<a id="b12StrSetVal3FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b12StrSetVal3');"></a>
						</td>
					</tr>
					<tr>
						<th>상품평혜택안내배너(상품상세)</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b12StrSetVal4" name="b12StrSetVal4" class="uFileInput"/>
								<label for="b12StrSetVal4" class="uFileLabel">상품평혜택안내배너 선택(상품상세페이지)</label>
								<input type="hidden" name="b12StrSetVal4OrgFileNm"/>
								<input type="hidden" name="b12StrSetVal4SysFileNm"/>
							</div>
							<a id="b12StrSetVal4FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b12StrSetVal4');"></a>
						</td>
					</tr>
					<tr>
						<th>상품평혜택안내배너(마이페이지)</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b12StrSetVal5" name="b12StrSetVal5" class="uFileInput"/>
								<label for="b12StrSetVal5" class="uFileLabel">상품평혜택안내배너 선택(마이페이지)</label>
								<input type="hidden" name="b12StrSetVal5OrgFileNm"/>
								<input type="hidden" name="b12StrSetVal5SysFileNm"/>
							</div>
							<a id="b12StrSetVal5FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b12StrSetVal5');"></a>
						</td>
					</tr>
				</tbody>
			</table>
			<h4>회원혜택안내(MOBILE)</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B16');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B16', '회원혜택안내');">이력보기</button>
			<table class="frmStyle" aria-describedby="회원혜택안내(MOBILE)">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>가입혜택안내배너(A)</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b16StrSetVal1" name="b16StrSetVal1" class="uFileInput"/>
								<label for="b16StrSetVal1" class="uFileLabel">가입혜택안내배너 선택</label>
								<input type="hidden" name="b16StrSetVal1OrgFileNm"/>
								<input type="hidden" name="b16StrSetVal1SysFileNm"/>
							</div>
							<a id="b16StrSetVal1FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b16StrSetVal1');"></a>
						</td>
					</tr>
					<tr>
						<th>가입혜택안내배너(B)</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b16StrSetVal2" name="b16StrSetVal2" class="uFileInput"/>
								<label for="b16StrSetVal2" class="uFileLabel">가입혜택안내배너 선택</label>
								<input type="hidden" name="b16StrSetVal2OrgFileNm"/>
								<input type="hidden" name="b16StrSetVal2SysFileNm"/>
							</div>
							<a id="b16StrSetVal2FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b16StrSetVal2');"></a>
						</td>
					</tr>
					<tr>
						<th>회원혜택안내배너</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b16StrSetVal3" name="b16StrSetVal3" class="uFileInput"/>
								<label for="b16StrSetVal3" class="uFileLabel">회원혜택안내배너 선택</label>
								<input type="hidden" name="b16StrSetVal3OrgFileNm"/>
								<input type="hidden" name="b16StrSetVal3SysFileNm"/>
							</div>
							<a id="b16StrSetVal3FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b16StrSetVal3');"></a>
						</td>
					</tr>
					<tr>
						<th>상품평혜택안내배너</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="b16StrSetVal4" name="b16StrSetVal4" class="uFileInput"/>
								<label for="b16StrSetVal4" class="uFileLabel">상품평혜택안내배너 선택(상품상세, 마이페이지)</label>
								<input type="hidden" name="b16StrSetVal4OrgFileNm"/>
								<input type="hidden" name="b16StrSetVal4SysFileNm"/>
							</div>
							<a id="b16StrSetVal4FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('b16StrSetVal4');"></a>
						</td>
					</tr>
				</tbody>
			</table>

			<h4>상품노출</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B13');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B13', '상품노출');">이력보기</button>
			<table class="frmStyle" aria-describedby="상품노출">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>상품평노출여부</th>
						<td>
							<label class="rdoBox"><input type="radio" name="b13StrSetVal1" value="Y" checked="checked"/>노출</label>
							<label class="rdoBox"><input type="radio" name="b13StrSetVal1" value="N">미노출</label>
							<span class="infoTxt cBlue"><i class="fa fa-info-circle" aria-hidden="true"></i>미노출로 설정 시 상품상세의 상품평 영역이 노출되지 않습니다.</span>
						</td>
					</tr>
					<tr>
						<th>품절상품노출여부</th>
						<td>
							<label class="rdoBox"><input type="radio" name="b13StrSetVal2" value="Y"/>노출</label>
							<label class="rdoBox"><input type="radio" name="b13StrSetVal2" value="N" checked="checked">미노출</label>
							<span class="infoTxt cBlue"><i class="fa fa-info-circle" aria-hidden="true"></i>품절된 상품을 사이트에 노출할지 말지를 설정합니다.</span>
						</td>
					</tr>
					<tr>
						<th>특가세일노출기준</th>
						<td>
							상품 썸네일 리스트의 가격은 할인율이 <input name="b13NumSetVal1" type="text" class="w20 aR" maxlength="3" data-valid-type="integer" data-valid-name=""/><span class="cRed">%</span> 이상일 경우 TAG가와 할인율 대신 <span class="infoTxt cBlue">'특가세일'</span>로 표기됩니다.
						</td>
					</tr>
				</tbody>
			</table>

			<h4>상품보관</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B17');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B17', '상품보관');">이력보기</button>
			<table class="frmStyle" aria-describedby="상품보관">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>장바구니보관기간(일)</th>
						<td>
							장바구니 보관기간은 <input name="b17NumSetVal1" type="text" class="w20 aR" maxlength="3" data-valid-type="integer" data-valid-name="장바구니보관기간"/><span class="cRed">일</span> 입니다. 보관기간 경과 시 자동 삭제됩니다.
							<span class="infoTxt cBlue"><i class="fa fa-info-circle marL20" aria-hidden="true"></i>0으로 설정하면 자동으로 삭제 처리를 하지 않습니다.</span>
						</td>
					</tr>
					<tr>
						<th>위시리스트보관기간(일)</th>
						<td>
							위시리스트 보관기간은 <input name="b17NumSetVal2" type="text" class="w20 aR" maxlength="3" data-valid-type="integer" data-valid-name="위시리스트보관기간"/><span class="cRed">일</span> 입니다. 보관기간 경과 시 자동 삭제됩니다.
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>0으로 설정하면 자동으로 삭제 처리를 하지 않습니다.</span>
						</td>
					</tr>
				</tbody>
			</table>

			<h4>품절안내</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B14');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B14', '품절안내');">이력보기</button>
			<table class="frmStyle" aria-describedby="품절안내">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>품절안내방법</th>
						<td>
							<label class="rdoBox"><input type="radio" name="b14StrSetVal1" value="A" checked="checked"/>발송</label>
							<label class="rdoBox"><input type="radio" name="b14StrSetVal1" value="M">미발송</label>
							<p>결제완료 후 <input name="b14NumSetVal1" type="text" class="w20 aR" maxlength="3" data-valid-type="integer" data-valid-name="품절안내메시지발송기간"/><span class="cRed">일</span> 동안 출고되지 않으면 품절안내 메시지를 발송합니다.</p>
						</td>
					</tr>
				</tbody>
			</table>

			<h4>배송/구매확정</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('B15');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('B15', '배송/구매확정');">이력보기</button>
			<table class="frmStyle" aria-describedby="배송/구매확정">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>배송완료처리기간(일)</th>
						<td>
							주문상세상태가 배송중 이후 <input name="b15NumSetVal1" type="text" class="w20 aR" maxlength="3" data-valid-type="integer" data-valid-name="배송완료처리기간"/><span class="cRed">일</span> 경과한 기간동안 배송완료로 처리하지 않으면 자동으로 배송완료로 처리합니다.
							<span class="infoTxt cBlue"><i class="fa fa-info-circle marL20" aria-hidden="true"></i>0으로 설정하면 자동으로 배송완료 처리를 하지 않습니다.</span>
						</td>
					</tr>
					<tr>
						<th>구매확정처리기간(일)</th>
						<td>
							주문상세상태가 배송완료 후 <input name="b15NumSetVal2" type="text" class="w20 aR" maxlength="3" data-valid-type="integer" data-valid-name="구매확정처리기간"/><span class="cRed">일</span> 경과한 기간동안 구매확정으로 처리를 하지 않으면 자동으로 구매확정으로 처리합니다.
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>0으로 설정하면 자동으로 구매확정 처리를 하지 않습니다.</span>
						</td>
					</tr>
					<tr>
						<th>반품가능기간(일)</th>
						<td>
							주문상세상태가 배송완료 후 <input name="b15NumSetVal3" type="text" class="w20 aR" maxlength="3" data-valid-type="integer" data-valid-name="반품가능기간"/> <span class="cRed">일</span> 동안 반품요청할 수 있습니다.
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>0으로 설정하면 언제든 반품요청을 할 수 있습니다.</span>
						</td>
					</tr>
				</tbody>
			</table>

			<h4>모바일앱</h4>
			<button type="button" class="btn btn-success btn-ssm" onclick="fnSave('M10');">저장</button>
			<button type="button" class="btn btn-info btn-ssm" onclick="fnOpenEnvsetPopup('M10', '모바일앱');">이력보기</button>
			<table class="frmStyle" aria-describedby="모바일앱">
				<colgroup>
					<col style="width: 15%;"/>
					<col style="width: 85%;"/>
				</colgroup>
				<tbody>
					<tr>
						<th>AOS앱버전</th>
						<td>
							<input name="m10StrSetVal1" type="text" class="w100" maxlength="20" data-valid-name="AOS앱버전"/>
						</td>
					</tr>
					<tr>
						<th>IOS앱버전</th>
						<td>
							<input name="m10StrSetVal2" type="text" class="w100" maxlength="20" data-valid-name="IOS앱버전"/>
						</td>
					</tr>
					<tr>
						<th>스플래시이미지</th>
						<td>
							<div class="uFile w500">
								<input type="file" id="m10StrSetVal3" name="m10StrSetVal3" class="uFileInput"/>
								<label for="m10StrSetVal3" class="uFileLabel">스플래시 이미지 선택</label>
								<input type="hidden" name="m10StrSetVal3OrgFileNm"/>
								<input type="hidden" name="m10StrSetVal3SysFileNm"/>
							</div>
							<a id="m10StrSetVal3FileDownload" href="#" style="display: none;" onclick="fnDownloadFile('m10StrSetVal3');"></a>
							<span class="infoTxt cBlue marL20"><i class="fa fa-info-circle" aria-hidden="true"></i>스플래시 이미지입니다</span>
						</td>
					</tr>
				</tbody>
			</table>
			<div class="panelBtnB"></div>
		</div>
	</div>

<script th:inline="javascript">
/*<![CDATA[*/
	// 조회
	var fnSearch = function() {
		var siteCd = $('select[name=siteCd]').val();
		var actionUrl = '/system/envset/' + siteCd;

		// 쇼핑몰Meta정보
		$.getJSON(actionUrl + '/B10'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result)) {
							$('input[name=b10StrSetVal1]').val(result.strSetVal1);
							$('input[name=b10StrSetVal2]').val(result.strSetVal2);
							$('input[name=b10StrSetVal3]').val(result.strSetVal3);
							
							if (!gagajf.isNull(result.strSetVal4)) {
								$('input[name=b10StrSetVal4SysFileNm]').val(result.strSetVal4);
								$('#b10StrSetVal4FileDownload').html(result.strSetVal4);
								$('#b10StrSetVal4FileDownload').show();
							}
							
							$('input[name=b10StrSetVal5]').val(result.strSetVal5);
							
							if (!gagajf.isNull(result.strSetVal6)) {
								$('input[name=b10StrSetVal6SysFileNm]').val(result.strSetVal6);
								$('#b10StrSetVal6FileDownload').html(result.strSetVal6);
								$('#b10StrSetVal6FileDownload').show();
							}
						}
					}
				});

		// 기본설정
		$.getJSON(actionUrl + '/B11'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result)) {
							$('input[name=b11NumSetVal1]').val(result.numSetVal1);
							$('input[name=b11NumSetVal2]').val(result.numSetVal2);
							$('input[name=b11NumSetVal3]').val(result.numSetVal3);
							$('input[name=b11NumSetVal4]').val(result.numSetVal4);
							$('input[name=b11NumSetVal5]').val(result.numSetVal5.addComma());
						}
					}
				});

		// 회원혜택안내
		$.getJSON(actionUrl + '/B12'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result.strSetVal1)) {
							$('input[name=b12StrSetVal1SysFileNm]').val(result.strSetVal1);
							$('#b12StrSetVal1FileDownload').html(result.strSetVal1);
							$('#b12StrSetVal1FileDownload').show();
						}

						if (!gagajf.isNull(result.strSetVal2)) {
							$('input[name=b12StrSetVal2SysFileNm]').val(result.strSetVal2);
							$('#b12StrSetVal2FileDownload').html(result.strSetVal2);
							$('#b12StrSetVal2FileDownload').show();
						}

						if (!gagajf.isNull(result.strSetVal3)) {
							$('input[name=b12StrSetVal3SysFileNm]').val(result.strSetVal3);
							$('#b12StrSetVal3FileDownload').html(result.strSetVal3);
							$('#b12StrSetVal3FileDownload').show();
						}

						if (!gagajf.isNull(result.strSetVal4)) {
							$('input[name=b12StrSetVal4SysFileNm]').val(result.strSetVal4);
							$('#b12StrSetVal4FileDownload').html(result.strSetVal4);
							$('#b12StrSetVal4FileDownload').show();
						}

						if (!gagajf.isNull(result.strSetVal5)) {
							$('input[name=b12StrSetVal5SysFileNm]').val(result.strSetVal5);
							$('#b12StrSetVal5FileDownload').html(result.strSetVal5);
							$('#b12StrSetVal5FileDownload').show();
						}
					}
				});

		// 상품노출
		$.getJSON(actionUrl + '/B13'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result)) {
							$("input:radio[name=b13StrSetVal1]").parents('td').find('label').removeClass('checked');
							if (result.strSetVal1 == 'Y') {
								$("input:radio[name=b13StrSetVal1]").eq(0).prop('checked', true);
								$("input:radio[name=b13StrSetVal1]").eq(0).parent().addClass('checked');
							} else {
								$("input:radio[name=b13StrSetVal1]").eq(1).prop('checked', true);
								$("input:radio[name=b13StrSetVal1]").eq(1).parent().addClass('checked');
							}

							$("input:radio[name=b13StrSetVal2]").parents('td').find('label').removeClass('checked');
							if (result.strSetVal2 == 'Y') {
								$("input:radio[name=b13StrSetVal2]").eq(0).prop('checked', true);
								$("input:radio[name=b13StrSetVal2]").eq(0).parent().addClass('checked');
							} else {
								$("input:radio[name=b13StrSetVal2]").eq(1).prop('checked', true);
								$("input:radio[name=b13StrSetVal2]").eq(1).parent().addClass('checked');
							}
							
							$('input[name=b13NumSetVal1]').val(result.numSetVal1);
						}
					}
				});

		// 상품보관
		$.getJSON(actionUrl + '/B17'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result)) {
							$('input[name=b17NumSetVal1]').val(result.numSetVal1);
							$('input[name=b17NumSetVal2]').val(result.numSetVal2);
						}
					}
				});

		// 품절안내
		$.getJSON(actionUrl + '/B14'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result)) {
							$("input:radio[name=b14StrSetVal1]").parents('td').find('label').removeClass('checked');
							if (result.strSetVal1 == 'A') {
								$("input:radio[name=b14StrSetVal1]").eq(0).prop('checked', true);
								$("input:radio[name=b14StrSetVal1]").eq(0).parent().addClass('checked');
							} else if (result.strSetVal1 == 'M') {
								$("input:radio[name=b14StrSetVal1]").eq(1).prop('checked', true);
								$("input:radio[name=b14StrSetVal1]").eq(1).parent().addClass('checked');
							}

							$('input[name=b14NumSetVal1]').val(result.numSetVal1);
						}
					}
				});

		// 배송/구매확정
		$.getJSON(actionUrl + '/B15'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result)) {
							$('input[name=b15NumSetVal1]').val(result.numSetVal1);
							$('input[name=b15NumSetVal2]').val(result.numSetVal2);
							$('input[name=b15NumSetVal3]').val(result.numSetVal3);
						}
					}
				});

		// 회원혜택안내(MOBILE)
		$.getJSON(actionUrl + '/B16'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result.strSetVal1)) {
							$('input[name=b16StrSetVal1SysFileNm]').val(result.strSetVal1);
							$('#b16StrSetVal1FileDownload').html(result.strSetVal1);
							$('#b16StrSetVal1FileDownload').show();
						}

						if (!gagajf.isNull(result.strSetVal2)) {
							$('input[name=b16StrSetVal2SysFileNm]').val(result.strSetVal2);
							$('#b16StrSetVal2FileDownload').html(result.strSetVal2);
							$('#b16StrSetVal2FileDownload').show();
						}

						if (!gagajf.isNull(result.strSetVal3)) {
							$('input[name=b16StrSetVal3SysFileNm]').val(result.strSetVal3);
							$('#b16StrSetVal3FileDownload').html(result.strSetVal3);
							$('#b16StrSetVal3FileDownload').show();
						}

						if (!gagajf.isNull(result.strSetVal4)) {
							$('input[name=b16StrSetVal4SysFileNm]').val(result.strSetVal4);
							$('#b16StrSetVal4FileDownload').html(result.strSetVal4);
							$('#b16StrSetVal4FileDownload').show();
						}
					}
				});

		// 모바일앱
		$.getJSON(actionUrl + '/M10'
				, function(result, status) {
					if (status === 'success') {
						if (!gagajf.isNull(result)) {
							$('input[name=m10StrSetVal1]').val(result.strSetVal1);
							$('input[name=m10StrSetVal2]').val(result.strSetVal2);
						}
						
						if (!gagajf.isNull(result.strSetVal3)) {
							$('input[name=m10StrSetVal3SysFileNm]').val(result.strSetVal3);
							$('#m10StrSetVal3FileDownload').html(result.strSetVal3);
							$('#m10StrSetVal3FileDownload').show();
						}
					}
				});
	}

	// 파일첨부 선택 시
	$('#b10StrSetVal4').on('change', function() { fnChooseFile(this); });
	$('#b10StrSetVal6').on('change', function() { fnChooseFile(this); });
	$('#b12StrSetVal1').on('change', function() { fnChooseFile(this); });
	$('#b12StrSetVal2').on('change', function() { fnChooseFile(this); });
	$('#b12StrSetVal3').on('change', function() { fnChooseFile(this); });
	$('#b12StrSetVal4').on('change', function() { fnChooseFile(this); });
	$('#b12StrSetVal5').on('change', function() { fnChooseFile(this); });
	$('#b16StrSetVal1').on('change', function() { fnChooseFile(this); });
	$('#b16StrSetVal2').on('change', function() { fnChooseFile(this); });
	$('#b16StrSetVal3').on('change', function() { fnChooseFile(this); });
	$('#b16StrSetVal4').on('change', function() { fnChooseFile(this); });
	$('#m10StrSetVal3').on('change', function() { fnChooseFile(this); });

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

		// 파일 업로드
		gagajf.ajaxFileUpload('/common/file/upload?subDir=/envset'
				, file
				, function(result) {
					// 업로드한 파일명 설정
					$('input[name=' + obj.name + 'OrgFileNm]').val(result.oldFileName);
					$('input[name=' + obj.name + 'SysFileNm]').val(result.newFileName);
				}
		);
	}

	// 파일다운로드
	var fnDownloadFile = function(id) {
		$('#' + id + 'FileDownload').attr({
			href : _uploadDefaultUrl + '/envset/' + $('input[name=' + id + 'SysFileNm]').val(),
			target: '_blank'
		}).get(0).click();
	}

	// 저장 처리
	var fnSave = function(envsetType) {
		var params = new Object();
		params.siteCd = $('select[name=siteCd]').val();
		params.envsetType = envsetType;

		if (envsetType == 'B10') { // 쇼핑몰Meta정보
			params.strSetVal1 = $('input[name=b10StrSetVal1]').val();
			params.strSetVal2 = $('input[name=b10StrSetVal2]').val();
			params.strSetVal3 = $('input[name=b10StrSetVal3]').val();
			params.strSetVal4 = $('input[name=b10StrSetVal4SysFileNm]').val();
			params.strSetVal5 = $('input[name=b10StrSetVal5]').val();
			params.strSetVal6 = $('input[name=b10StrSetVal6SysFileNm]').val();
		} else if (envsetType == 'B11') { // 기본설정
			params.numSetVal1 = $('input[name=b11NumSetVal1]').val();
			params.numSetVal2 = $('input[name=b11NumSetVal2]').val();
			params.numSetVal3 = $('input[name=b11NumSetVal3]').val();
			params.numSetVal4 = $('input[name=b11NumSetVal4]').val();
			params.numSetVal5 = $('input[name=b11NumSetVal5]').val().removeComma();
		} else if (envsetType == 'B12') { // 회원혜택안내
			params.strSetVal1 = $('input[name=b12StrSetVal1SysFileNm]').val();
			params.strSetVal2 = $('input[name=b12StrSetVal2SysFileNm]').val();
			params.strSetVal3 = $('input[name=b12StrSetVal3SysFileNm]').val();
			params.strSetVal4 = $('input[name=b12StrSetVal4SysFileNm]').val();
			params.strSetVal5 = $('input[name=b12StrSetVal5SysFileNm]').val();
		} else if (envsetType == 'B13') { // 상품노출
			params.strSetVal1 = $('input:radio[name=b13StrSetVal1]:checked').val();
			params.strSetVal2 = $('input:radio[name=b13StrSetVal2]:checked').val();
			params.numSetVal1 = $('input[name=b13NumSetVal1]').val();
		} else if (envsetType == 'B17') { // 상품보관
			params.numSetVal1 = $('input[name=b17NumSetVal1]').val();
			params.numSetVal2 = $('input[name=b17NumSetVal2]').val();
		} else if (envsetType == 'B14') { // 품절안내
			params.strSetVal1 = $('input:radio[name=b14StrSetVal1]:checked').val();
			params.numSetVal1 = $('input[name=b14NumSetVal1]').val();
		} else if (envsetType == 'B15') { // 배송/구매확정
			params.numSetVal1 = $('input[name=b15NumSetVal1]').val();
			params.numSetVal2 = $('input[name=b15NumSetVal2]').val();
			params.numSetVal3 = $('input[name=b15NumSetVal3]').val();
		} else if (envsetType == 'B16') { // 회원혜택안내(MOBILE)
			params.strSetVal1 = $('input[name=b16StrSetVal1SysFileNm]').val();
			params.strSetVal2 = $('input[name=b16StrSetVal2SysFileNm]').val();
			params.strSetVal3 = $('input[name=b16StrSetVal3SysFileNm]').val();
			params.strSetVal4 = $('input[name=b16StrSetVal4SysFileNm]').val();
		} else if (envsetType == 'M10') { // 모바일앱
			params.strSetVal1 = $('input[name=m10StrSetVal1]').val();
			params.strSetVal2 = $('input[name=m10StrSetVal2]').val();
			params.strSetVal3 = $('input[name=m10StrSetVal3SysFileNm]').val();
		}

		var jsonData = JSON.stringify(params);
		gagajf.ajaxJsonSubmit('/system/envset/create', jsonData);
	}

	// 환경설정 이력보기 팝업
	var fnOpenEnvsetPopup = function(envsetType, envsetTypeNm) {
		var actionUrl = '/system/envset/history/form'
				+ '?siteCd=' + $('select[name=siteCd]').val()
				+ '&envsetType=' + envsetType
				+ '&envsetTypeNm=' + encodeURIComponent(envsetTypeNm);
		cfnOpenModalPopup(actionUrl, 'popupEnvset');
	}

	$(document).ready(function() {
		fnSearch();
		uifnFitGrid();
	});
/*]]>*/
</script>
</html>