<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : MypageOrderListWeb.html
 * @desc    : 마이페이지 > 주문확인/배송조회 주문리스트 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2021 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.02.18   card007     최초 작성
 *******************************************************************************
 -->
<th:block th:if="${orderList}" th:each="oneData, status : ${orderList}">
	<input type="hidden" th:value="${orderInfo.pageNo}" id="pageNo"/>
	<div class="part_deliver">
		<div class="tbl_tit">
			<!-- 주문일/선물일 설정 -->
			<span class="start_t" th:unless="${oneData.giftPackYn == 'Y'}">주문일</span>
			<span class="gift_t" th:if="${oneData.giftPackYn == 'Y'}">선물일</span>
			<!-- //주문일/선물일 설정 -->

			<span class="order_date" th:text="${oneData.ordDt}"></span>

			<!-- 배송구분 설정 -->
			<span class="order_label02" th:if="${oneData.shotDelv}">총알배송</span>
			<span class="order_label01" th:if="${oneData.selfMall}">STYLE24 일반배송</span>
			<span class="order_label01" th:if="${oneData.supplyMall}">업체직배송</span>
			<!-- //배송구분 설정 -->
			<a href="javascript:void(0)" class="detail_btn" th:attr="ordNo=${oneData.ordNo}" onclick="fnGoToOrderDetail(this)">주문상세보기</a>
		</div>
		<th:block th:if="${oneData.orderList}" th:each="order, status : ${oneData.orderList}">
			<div class="tbl type2">
				<table>
					<colgroup>
						<col width="1020">
						<col width="180">
					</colgroup>
					<tbody>
						<th:block th:if="${order.ordDtlList}" th:each="ordDtl, status : ${order.ordDtlList}" th:with="imageUrl=${@environment.getProperty('upload.goods.view')}">
						<input type="hidden" name="ordDtlNo" th:value="${ordDtl.ordDtlNo}"/>
						<input type="hidden" name="ordDtlStat" th:value="${ordDtl.ordDtlStat}"/>
						<input type="hidden" name="reviewSq" th:value="${ordDtl.reviewSq}"/>
						<tr class="bundle_row">
							<td>
								<div class="info_item">
									<div class="thumb_box">
										<a href="">
											<img th:src="${imageUrl + '/' + ordDtl.sysImgNm}" width="100%" alt="">
										</a>
									</div>
									<div class="info_box">
										<p class="od_name">
											<a href="">
												<span class="brand" th:text="${ordDtl.brandNm}"></span>
												<span class="name" th:text="${ordDtl.goodsNm}"></span>
											</a>
										</p>
										<p class="od_opt">
											<span class="option"><em th:text="${ordDtl.optCd1}"></em><em th:text="${ordDtl.optCd2}"></em></span>
											<span class="count">수량 <em th:text="${ordDtl.ordQty}"></em>개</span>
										</p>
									</div>
									<div class="info_calc">
										<p class="price">
											<span class="selling_price" th:text="|${#numbers.formatInteger(ordDtl.ordAmt, 1, 'COMMA')}원|"></span>
										</p>
										<p class="point"><span th:text="${#numbers.formatInteger(ordDtl.savePntAmt, 1, 'COMMA')}"></span>p</p>
									</div>
								</div>
							</td>
							<!-- 주문 -->
							<td class="merge_row" th:unless="${oneData.giftPackYn == 'Y'}">
								<div class="delivery">
									<p class="dlvr_staus" th:text="${ordDtl.ordDtlStatNm}"></p>
									<p class="dlvr_desc" th:if="${ordDtl.delvEddt}" th:text="|${ordDtl.delvEddt}일 도착|"></p>
								</div>
								<div class="tbl_btn_wrap case02">
									<button type="button" class="btn btn_default btn_sm" th:attr="ordNo=${oneData.ordNo}" onclick="fnCreateChange(this, 'exchange');"><span>교환</span></button>
									<button type="button" class="btn btn_default btn_sm" th:attr="ordNo=${oneData.ordNo}" onclick="fnCreateChange(this, 'cancel');"><span>반품/취소</span></button>
<!--									<button type="button" class="btn btn_default btn_sm" th:if="${ordDtl.reviewSq == 0}" th:attr="ordNo=${oneData.ordNo}" onclick="fnCreateReview(this);"><span>리뷰작성</span></button>-->
									<button type="button" class="btn btn_default btn_sm" th:if="${!order.review}" th:attr="ordNo=${oneData.ordNo}" onclick="fnCreateReview(this);"><span>리뷰작성</span></button>
								</div>
							</td>
							<td class="merge_row" th:if="${oneData.giftPackYn == 'Y' and #strings.isEmpty(ordDtl.recipBaseAddr)}">
								<div class="delivery">
									<p class="dlvr_staus c_primary">주소 입력 대기</p>
									<p class="dlvr_desc" th:text="|남은 기간 ${ordDtl.giftLimitDay}일|"></p>
									<p class="dlvr_desc" th:text="|(${ordDtl.giftLimitDt}까지)|"></p>
								</div>
								<div class="tbl_btn_wrap case02">
									<button type="button" class="btn btn_dark btn_sm" th:attr="ordNo=${oneData.ordNo}" onclick="fnReSendSms(this);"><span>SMS 재전송</span></button>
								</div>
							</td>
							<td class="merge_row" th:if="${oneData.giftPackYn == 'Y' and !#strings.isEmpty(ordDtl.recipBaseAddr)}">
								<div class="delivery">
									<p class="dlvr_staus c_primary">선물 완료</p>
									<p class="dlvr_desc" th:text="|(${ordDtl.giftCompleteDt})|"></p>
								</div>
								<div class="tbl_btn_wrap case02">
								</div>
							</td>
						</tr>
						</th:block>
					</tbody>
				</table>
			</div>
			<!-- 주문 -->
			<th:block th:unless="${oneData.giftPackYn == 'Y'}">
				<div class="order_confirm" th:if="${order.ordDtlStat == 'G013_00' or order.ordDtlStat == 'G013_10' or order.ordDtlStat == 'G013_11'}">
					<span class="cf_txt">주문 완료 / 결제를 기다리고 있습니다.</span>
				</div>
				<div class="order_confirm" th:if="${order.ordDtlStat == 'G013_20' or order.ordDtlStat == 'G013_30' or order.ordDtlStat == 'G013_35'}">
					<span class="cf_txt">배송할 상품을 준비 중입니다.</span>
				</div>
				<div class="order_confirm" th:if="${order.ordDtlStat == 'G013_40'}">
					<span class="cf_txt">상품준비가 완료되어 곧 배송될 예정입니다.</span>
				</div>
				<div class="order_confirm" th:if="${order.ordDtlStat == 'G013_50' or order.ordDtlStat == 'G013_55'}">
					<span class="cf_txt" th:text="|${order.shipCompNm} / ${order.invoiceNo}|"></span>
					<button type="button" class="btn btn_primary" th:attr="ordNo=${order.ordNo}, ordDtlNo=${order.ordDtlNo}, invoiceNo=${order.invoiceNo}, shipCompCd=${order.shipCompCd}" onclick="fnGetDeliveryInfo(this)">배송조회</button>
				</div>
				<div class="order_confirm" th:if="${order.ordDtlStat == 'G013_60'}">
					<span class="cf_txt" th:text="|${order.purchaseConfirmDay}일 후 자동으로 구매확정|"></span>
					<button type="button" class="btn btn_primary" onclick="fnDecideOrder(this);">구매확정 하기</button>
				</div>
				<div class="order_confirm" th:if="${order.ordDtlStat == 'G013_70' and !order.review}">
					<span class="cf_txt">리뷰를 작성하면 다른 구매자에게 도움이 될 수 있습니다.</span>
					<button type="button" class="btn btn_primary" onclick="fnCreateReview(this, 'Y');">리뷰작성</button>
				</div>
				<div class="order_confirm" th:if="${order.ordDtlStat == 'G013_70' and order.review}">
					<span class="cf_txt">주문내역 다시 구매하기 위해</span>
					<button type="button" class="btn btn_primary" onclick="fnCreateCart(this, 'Y');">장바구니 담기</button>
				</div>
			</th:block>

			<!-- 선물 -->
			<th:block th:if="${oneData.giftPackYn == 'Y'}">
				<div class="order_confirm" th:if="${#strings.isEmpty(order.recipBaseAddr) and order.giftLimitDay >= 0}">
					<span class="cf_txt" th:text="|${order.recipNm}님이 주소를 입력하기 전입니다. (입력기한 ${order.giftLimitDt})|"></span>
				</div>
				<div class="order_confirm" th:unless="${#strings.isEmpty(order.recipBaseAddr)}">
					<span class="cf_txt" th:text="|${order.recipNm}님께 선물이 발송되었습니다.|"></span>
				</div>
				<div class="order_confirm" th:if="${#strings.isEmpty(order.recipBaseAddr) and order.giftLimitDay < 0}">
					<span class="cf_txt">주소입력 기한이 경과되어 선물이 취소 되었습니다.</span>
				</div>
			</th:block>
		</th:block>
	</div>
</th:block>

<!-- 주문 없을 때 -->
<th:block th:unless="${orderList}" th:each="oneData, status : ${orderList}">

</th:block>

<script th:inline="javascript">
/*<![CDATA[*/
	$(document).ready(function() {
	});
/*]]>*/
</script>

</html>
