<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">

<form class="form_wrap form_full" name="couponApplyForm" id="couponApplyForm">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="couponModifyLabel">할인쿠폰 변경</h5>
			</div>
			<div class="modal-body">
				<div class="pop_cont">
				
					<!-- 상품쿠폰적용 -->
					<th:block th:if="${goodsApplyCpnList.size() > 0}">
						<h6>상품쿠폰</h6>
						<div class="area_item_coupon">
							<th:block th:each="goods, i : ${goodsApplyCpnList}" th:with="imageUrl=${@environment.getProperty('upload.goods.view')}">
								<th:block th:if="${goods.goodsCpnList.size() > 0}">
									<div th:id="|item${i.index}|" class="apply_item goodsCpn goodsCartCpn" th:value="${i.index}+1">
										<div class="item_gd">
											<figure>
												<span class="thumb">
													<img th:src="${imageUrl + '/' + goods.sysImgNm}" src="/" width="100%" alt="">
												</span>
												<figcaption>
													<div class="brand" th:text="${goods.brandGroupNm}"></div>
													<div class="name" th:text="${goods.goodsNm}"></div>
													<div class="option" th:each="colorNm, index : ${goods.colorNmArr}" th:text="${colorNm}+'/'+${goods.optCd2Arr[index.index]}"></div>
												</figcaption>
											</figure>
										</div>
										
										<div class="form_field">
											<div class="select_custom coupon_list" th:value="${i.index}+1">
												<div class="combo">
													<div class="select">
														<div class="item_coupon"><p class="empty">선택</p></div>
													</div>
												</div>
											</div>
										</div>
										
										<input type="hidden" name="cpnType" value="goodsCpn"/>
										<input type="hidden" name="cpnCartSq" th:value="${goods.cartSq}"/>
										<input type="hidden" name="custCpnSq" value="0"/>
										<input type="hidden" name="cpnDcAmt" value="0"/>
									</div>
								</th:block>
							</th:block>
						</div>
					</th:block>
					<!-- //상품쿠폰적용 -->
					
					<!-- 장바구니쿠폰적용 -->
					<th:block th:if="${cartCpnList.size() > 0}">
						<h6>장바구니 쿠폰</h6>
						<div class="area_cart_coupon">
							<div class="form_field">
								<th:block th:each="cartCpn, k : ${cartCpnList}">
									<div class="cartCpn goodsCartCpn" th:value="${cartCpn.custCpnSq}">
										<input type="hidden" name="dcWay" 			th:value="${cartCpn.dcWay}"/>
										<input type="hidden" name="dcVal" 			th:value="${cartCpn.dcVal}"/>
										<input type="hidden" name="buyLimitAmt" 	th:value="${cartCpn.buyLimitAmt}"/>
										<input type="hidden" name="maxDcAmt" 		th:value="${cartCpn.maxDcAmt}"/>
										
										<!-- 장바구니쿠폰 적용 장바구니 시퀀스 -->
										<th:block th:each="cartCpnCartSq, kokok : ${cartCpn.cartCpnCartSqArr}"> 
											<input type="hidden" name="cartCpnCartSq" th:value="${cartCpnCartSq}" />
										</th:block>
										<!-- 장바구니쿠폰 결제가능수단목록조회 -->
										<th:block th:each="payType, kokok : ${cartCpn.payTypeArr}"> 
											<input type="hidden" name="payTypeArr" th:value="${payType}" />
										</th:block>
										
										<input type="radio" name="rdi-cart-coupon" th:id="|rdi-cart-coupon${k.index}|">
										
										<label th:for="|rdi-cart-coupon${k.index}|">
											<div class="cart_coupon">
												<p class="name" th:text="${cartCpn.cpnNm}"></p>
												<p class="txt">
													<th:block th:if="${cartCpn.buyLimitAmt} > 0">
														<span th:text="${#numbers.formatInteger(cartCpn.buyLimitAmt, 1, 'COMMA')}"></span>원 이상 구매시 
													</th:block>
													<th:block th:if="${cartCpn.maxDcAmt} > 0">
														최대 <span th:text="${#numbers.formatInteger(cartCpn.maxDcAmt, 1, 'COMMA')}"></span>원 할인
													</th:block>
												</p>
												<p class="discount">
													<th:block th:if="${cartCpn.dcWay} == 'G240_10'">
														<span th:text="${#numbers.formatInteger(cartCpn.dcVal, 1, 'COMMA')}"></span>원 할인
													</th:block>
													<th:block th:if="${cartCpn.dcWay} == 'G240_11'">
														<span th:text="${#numbers.formatInteger(cartCpn.dcVal, 1, 'COMMA')}"></span>% 할인
													</th:block>
												</p>
											</div>
										</label>
									</div>
								</th:block>
								<div class="cartCpn" value="0">
									<input type="hidden" name="dcWay" 			th:value="0"/>
									<input type="hidden" name="dcVal" 			th:value="0"/>
									<input type="hidden" name="buyLimitAmt" 	th:value="0"/>
									<input type="hidden" name="maxDcAmt" 		th:value="0"/>
										
									<div class="cart_coupon">
										<input type="radio" name="rdi-cart-coupon" id="rdi-cart-coupon00">
										<label for="rdi-cart-coupon00">적용안함</label>
									</div>
								</div>
								<input type="hidden" name="cpnType" value="cartCpn"/>
								<input type="hidden" name="custCpnSq" value="0"/>
								<input type="hidden" name="cpnDcAmt" value="0"/>
							</div>
						</div>
					</th:block>
					<!-- //장바구니쿠폰적용 -->
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn_primary" id="btn_coupon_apply"><span>총 <em class="goodsCartCpnSumAmt">0</em>원 쿠폰 적용</span></button>
			</div>
			
			<!-- 상품쿠폰팝업적용 -->
			<th:block th:if="${goodsApplyCpnList.size() > 0}">
				<th:block th:each="goods, i : ${goodsApplyCpnList}">
					<th:block th:if="${goods.goodsCpnList.size() > 0}">
						<!-- 할인쿠폰 변경_쿠폰선택_팝업 -->
						<div class="popup_box couponSelectPop">
							<div class="lap">
								<div class="popup_close">카테고리닫기</div>
								<div class="popup_head">
									<h2>옵션변경</h2>
								</div>
								<div class="popup_con">
									<ul class="list" style="display: block;">
										<th:block th:each="goodsCpn, k : ${goods.goodsCpnList}">
											<li th:value="${goodsCpn.custCpnSq}" th:data="${goodsCpn.cpnDcAmt}">
												<button type="button" class="dlvr_coupon">
													<p class="name" th:text="${goodsCpn.cpnNm}"></p>
													<p class="txt">
														<th:block th:if="${goodsCpn.buyLimitAmt} > 0">
															<span th:text="${#numbers.formatInteger(goodsCpn.buyLimitAmt, 1, 'COMMA')}"></span>원 이상 구매시
														</th:block>
														<th:block th:if="${goodsCpn.maxDcAmt} > 0"> 
															최대 <span th:text="${#numbers.formatInteger(goodsCpn.maxDcAmt, 1, 'COMMA')}"></span>원 할인
														</th:block>
													</p>
													<p class="discount">
														<th:block th:if="${goodsCpn.dcWay} == 'G240_10'">
															<span th:text="${#numbers.formatInteger(goodsCpn.dcVal, 1, 'COMMA')}"></span>원 할인
														</th:block>
														<th:block th:if="${goodsCpn.dcWay} == 'G240_11'">
															<span th:text="${#numbers.formatInteger(goodsCpn.dcVal, 1, 'COMMA')}"></span>% 할인
														</th:block>
													</p>
												</button>
											</li> 
										</th:block>
										<li value="0" data="0">
											<button type="button" class="dlvr_coupon">
												<p class="empty">적용 안함</p>
											</button>
										</li>
									</ul>
								</div>
							</div>
						</div>
						<!-- //쿠폰선택_팝업 -->
					</th:block>
				</th:block>
			</th:block>
			<!-- //상품쿠폰팝업적용 -->
			
		</div>
	</div>
</form>

<script th:inline="javascript">
//컨텐츠 호출
$(document).ready( function() {
});

// 상품쿠폰, 장바구니쿠폰 팝업 닫기
$("#couponModifyPop_close").on("click", function(){
	$("#couponModifyPop").modal("hide");
});

// 상품상세쿠폰 팝업 닫기
$("#couponModifyPop .lap .popup_close").on("click", function() {
	$('.popup_box').hide();
	$('.popup_box').removeClass('active');
	$("body").css({"overflow":"visible"});
});

//팝업 - 할인혜택 > 상품쿠폰변경 선택           
//var od_coupon_modify_selecter1 = new sCombo('.od_pop.couponModify_pop #item1 .select_custom.coupon_list');
//var od_coupon_modify_selecter2 = new sCombo('.od_pop.couponModify_pop #item2 .select_custom.coupon_list');
</script>

</html>