<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="mob/common/layout/MypageLayoutMob">
<!--
 *******************************************************************************
 * @source  : MypageWishListFormMob.html
 * @desc    : 마이페이지 > 위시리스트 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.04.08   sowon     최초 작성
 *******************************************************************************
 -->
<body>
<!-- 상단헤드 //? -->
<th:block layout:fragment="content">
	<main role="" id="" class="container my">
			<section class="content my_wishlist">
				<div class="inner">
					<div class="wishlist" id="wishList">
					</div>
				</div>
			</section>
		</main>
<script th:inline="javascript">
/*<![CDATA[*/
let month = [[${wishMonth}]];

var wishlistDelete = function(obj) {
	cfnMoPutWishList(obj);

	ajaxWishList();
}
//마이페이지 위시리스트
var ajaxWishList = function () {
	 $.getJSON('/mypage/wish/list', function(result, status) {
		if (status == 'success') {
			$('#wishList').html('');
			html = '';
			if (result.length>0) {
				for (var i = 0; i < month.length; i++) {
					html += '<div class="monthly_wish_wrap">\n';
					html += '	<div class="date">\n';
					html += '		<span>'+month[i].regDt+'</span>\n';
					html += '	</div>\n';
					html += '	<div class="itemsGrp">\n';

					$.each(result, function (idx, item) {
						if (item.regDtMonth == month[i].regDt) {
							html += '		<div class="item_prod">\n';
							html += '			<div class="item_state">\n';
							html += '				<button type="button" class="itemLike likeit" goodsCd=\''+item.goodsCd+'\' goodsNm="'+ item.goodsNm+'" ithrCd="" contentsLoc="IN17_01" planDtlSq="" onclick="wishlistDelete(this)">관심상품 추가</button>\n';
							html += '				<a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.goodsCd+'\',\'\',\'IN17_01\')">\n';
							html += '					<div class="itemPic">\n';
							html += '						<img class="vLHTC pd_img"  src="' + _uploadGoodsUrl + '/' + item.sysImgNm + '">\n';
							html += '					</div>\n';
							html += '					<p class="itemBrand">'+item.brandGroupNm+'</p>\n';
							if (item.goodsTnm != null && item.goodsTnm != '') {
								html+='					<div class="itemComment">'+item.goodsTnm+'</div>\n';
							}
							html += '					<div class="itemName">'+item.goodsNm+'</div>\n';
							html += '					<p class="itemPrice">\n';

							if (item.currPrice != item.listPrice) {
								html+='						<span class="itemPrice_original">'+item.listPrice.addComma()+'</span>\n';
							}
							html += item.currPrice.addComma();
							if (item.dcRate>0) {
								html+='						<span class=" itemPercent">'+item.dcRate+'%</span>\n';
							}
							html += '					</p>\n';
							html += '					<div class="itemcolorchip">\n';
							if(!gagajf.isNull(item.colorChips)){
								var colorArr = item.colorChips.split(",");
								var colorCd = '';
								var rgbColor = '';
								for(let i=0; i<colorArr.length; i++){
									var colorInfo = colorArr[i].split(":");
									colorCd = colorInfo[0];
									rgbColor = colorInfo[1];
									if(rgbColor=='#FFFFFF'){
										html += '	<span class="chip_color" style="background-color: '+rgbColor+';border:1px solid #aaa;" value="'+colorCd+'">'+colorCd+'</span>';
									}else{
										html += '	<span class="chip_color" style="background-color: '+rgbColor+'" value="'+colorCd+'">'+colorCd+'</span>';
									}
								}
							}
							html += '					</div>\n';
							if(!gagajf.isNull(item.icon)){
								var iconArr = item.icon.split(",");
								var iconGb = '';
								var iconNm = '';
								html += '	<p class="itemBadge wish_itemBadge">';
								let arrCnt;
								if(iconArr.length > 2){
									arrCnt = 3;
								}else{
									arrCnt = iconArr.length;
								}
								for(let i=0; i<arrCnt; i++){
									var iconInfo = iconArr[i].split(":");
									iconGb = iconInfo[0];
									iconNm = iconInfo[1];
									html += '	<span class="badge13" value="'+iconGb+'">'+iconNm+' </span>';
								}
								html += '	</p>';
							}

							html += '				</a>\n';
							html += '			</div>\n';
							html += '		</div>\n';

						}
					});

					html += '	</div>\n';
					html += '</div>\n';
					$('#wishList').html(html);
				}
			}
			else{
				html += ' <div class="nodata">';
				html += '	<div class="txt_box">';
				html += '		<p>';
				html += '			등록된 위시리스트가 없습니다.<br>';
				html += '			';
				html += '		</p>';
				html += '	</div>';
				html += '</div>';

				$('#wishList').html(html);
			}

		}
	});
}
$(document).ready(function() {
	$('#htopTitle').text('위시리스트');
	ajaxWishList();
});
/*]]>*/
</script>
	</th:block>

</body>
</html>