<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : GoodsSizeStockForm.html
 * @desc    : 상품 옵셥/재고 화면
 *============================================================================
 * SISUN
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2020.10.26   eskim       수정
 *******************************************************************************
 -->
	<table class="frmStyle" th:with="uploadGoodsUrl=${@environment.getProperty('upload.goods.view')},uxImgUrl=${@environment.getProperty('domain.uximage')}">
		<colgroup>
			<col width="100px"/>
			<col width="100px"/>
			<col width="10%"/>
			<col width="100px"/>
			<col width="100px"/>
			<col/>
		</colgroup>
		<tr>
			<th>번호</th>
			<th>대표색상</th>
			<th>이미지</th>
			<th>색상코드</th>
			<th>색상</th>
			<th>이미지관리</th>
		</tr>
		<tbody id="colorList" >
		<th:block  th:if="${goodsColorList}" th:each="goodsColor, sizeStatus : ${goodsColorList}">
		<tr>
			<td class="aC" th:text="${sizeStatus.count}">1</td>
			<td class="aC"><label class="rdoBtn"><input type="radio" name="basicColor" th:value="${goodsColor.optCd1}"  th:checked="${goodsColor.mainColorYn =='Y'}" /></label></td>
			<td class="aC">
				<img width="60" th:src="${uploadGoodsUrl+'/'+goodsColor.sysImgNm}" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/image/no.gif'}+'\';'" alt="">
				<input type="hidden" name="sysImgNmOrg" id="sysImgNmOrg" th:value="${goodsColor.sysImgNm}"/>
			</td>	
			<td class="aC" ><th:block th:text="${goodsColor.optCd1}">BK</th:block> 
				<input type="hidden" name="colorCd" id="colorCd" th:value="${goodsColor.optCd1}"/>
			</td>
			<td class="aC" ><th:block th:text="${goodsColor.colorEnm}">BLACK</th:block>  
				<input type="hidden" name="colorNm" id="colorNm" th:value="${goodsColor.colorEnm}"/>
			</td>
			<td><button type="button" class="btn btn-base btn-lg" onclick="fnGoodsDetailImg(this)" th:text="${#strings.isEmpty(goodsColor.sysImgNm) ?'등록':'수정'}">등록</button></td>
		</tr>
		</th:block>
		</tbody>
	</table>

	<table class="frmStyle">
		<colgroup>
			<col width="10%"/>
			<col width="15%"/>
			<col/>
			<col width="10%"/>
			<col width="7%"/>
			<col width="7%"/>
			<col width="7%"/>
			<col width="7%"/>
			<col width="7%"/>
			<col width="7%"/>
			<col width="7%"/>
		</colgroup>
		<tr th:if="${goods.selfGoodsYn == 'Y' and goods.goodsType == 'G056_N'}">
			<th colspan="2">ERP재고연동여부<i class="star"></i></th>
			<td colspan="2">
				<label class="rdoBtn"><input type="radio" name="erpStockLinkYn" id="erpStockLinkYnY" value="Y" th:checked="${goods.erpStockLinkYn == 'Y'}"/>Y</label>
				<label class="rdoBtn"><input type="radio" name="erpStockLinkYn" id="erpStockLinkYnN" value="N" th:checked="${goods.erpStockLinkYn == 'N'}"/>N</label>
				<input type="hidden" id="erpStockLinkYnOrg" name="erpStockLinkYnOrg" th:value="${goods.erpStockLinkYn}"/>
			</td>
			<td colspan="7"></td>
		</tr>
		<th:block th:if="${goods.selfGoodsYn == 'N' or goods.goodsType != 'G056_N'}">
			<input type="hidden" id="erpStockLinkYnOrg" name="erpStockLinkYnOrg" th:value="${goods.erpStockLinkYn}"/>
			<input type="hidden" id="erpStockLinkYn" name="erpStockLinkYn"  th:value="${goods.erpStockLinkYn}"/>
		</th:block>
		<tr>
			<th>상품코드</th>
			<th>옵션1(색상)</th>
			<th>옵션2(사이즈)</th>
			<th>추가가격</th>
			<th>노출순서</th>
			<th>노출여부</th>
			<th>가용재고</th>
			<th>안전재고</th>
			<th>출고대기</th>
			<th>판매가능재고</th>
			<th>품절여부</th>
		</tr>
		<tbody id="optionList" >
		<th:block  th:if="${goodsSizeList}" th:each="goodsSize, sizeStatus : ${goodsSizeList}">
		<tr>
			<td th:rowspan="${goodsSize.rcount}" th:text="${goodsSize.compsGoodsCd}" th:if="${goodsSize.rnum == 1}"></td>
			<td><th:block th:text="${goodsSize.optCd1}"></th:block>
				<input type="hidden" name="compsGoodsCd" th:value="${goodsSize.compsGoodsCd}" />
				<input type="hidden" name="optCd" th:value="${goodsSize.optCd}" />
				<input type="hidden" name="optCd1" th:value="${goodsSize.optCd1}" />
			</td>
			<td><th:block th:text="${goodsSize.optCd2}"></th:block>
				<input type="hidden" name="optCd2" th:value="${goodsSize.optCd2}" />
			</td>
			<td><input type="text" class="w100p aR" name="addPrice" th:value="${goodsSize.addPrice}"  maxlength="7"  data-valid-type="numeric"/>
				<input type="hidden" name="hidAddPrice" th:value="${goodsSize.addPrice}" />
			</td>
			<td><input type="text" class="w100p aC" name="dispOrd" th:value="${goodsSize.dispOrd}"  maxlength="7" data-valid-type="integer"/>
				<input type="hidden" name="hidDispOrd" th:value="${goodsSize.dispOrd}" />
			</td>
			<td><select name="dispYn" class="w100p aC">
					<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}" th:selected="${goodsSize.dispYn == oneData.cd}"></option>
				</select>
				<input type="hidden" name="hidDispYn" th:value="${goodsSize.dispYn}"/>
			</td>
			<td><input type="text" class="w100p aC" name="editCurrStockQty" th:value="${goodsSize.currStockQty}" maxlength="10" data-valid-type="numeric" th:disabled="${goods.selfGoodsYn == 'Y'}"/>
				<input type="hidden" name="currStockQty" th:value="${goodsSize.currStockQty}"/>
			</td>
			<td><input type="text" class="w100p aC"  name="baseStockQty" th:value="${goodsSize.baseStockQty}" maxlength="7" data-valid-type="integer">
				<input type="hidden" name="hidBaseStockQty" th:value="${goodsSize.baseStockQty}"/>
			</td>
			<td><input type="text" class="w100p aC" name="saleStockQty" th:value="${goodsSize.saleStockQty}" maxlength="17" data-valid-type="numeric" th:disabled="disabled"/>
			</td>
			<td><input type="text" class="w100p aC"  name="ableStockQty" maxlength="7" data-valid-type="numeric" th:disabled="disabled" th:value="${goodsSize.ableStockQty}" /></td>
			<td><select name="soldoutYn" class="w100p aC" >
					<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}" th:selected="${goodsSize.soldoutYn == oneData.cd}"></option>
				</select>
				<input type="hidden" name="hidSoldoutYn" th:value="${goodsSize.soldoutYn}"/>
			</td>	
		</tr>
		</th:block>
	</table>
<script th:inline="javascript">
/*<![CDATA[*/
	
	var fnGoodsDetailImg = function(obj){
		var mode= 'U';
		var goodsCd = $('#goodsDetailForm input[name=goodsCd]').val();
		var colorCd = $(obj).parent().parent().find("input[name=colorCd]").val();
		var colorNm = $(obj).parent().parent().find("input[name=colorNm]").val();
		
		if (gagajf.isNull($(obj).parent().parent().find("input[name=sysImgNmOrg]").val())){
			mode = "C";
		}
		
		cfnOpenGoodsImagePopup(goodsCd, colorCd, colorNm, mode);
		
	}
	$(document).ready(function() {
		
		//옵션/재곡 변경여부
		$('#goodsDetailForm').find('#goodstab2').find("input, select, textarea").on('change', function() {
			$('#goodsDetailForm').find('.tabs .tabsNav li:eq(1) a').attr("style", "color:red;");
		});
		
	});
	
/*]]>*/
</script>
</html>