<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="web/common/layout/DefaultLayoutWeb">
<!--
 *******************************************************************************
 * @source  : OutletMainFormWeb.html
 * @desc    : 아울렛메인 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.04.20   bin2107     최초 작성
 *******************************************************************************
 -->
<body>

<th:block layout:fragment="content">

	<div id="container" class="container dp">
		<div class="breadcrumb">
			<ul>
				<li class="bread_home"><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MAIN);">홈</a></li>
				<li class="bread_2depth">아울렛</li>
			</ul>
		</div>

		<div class="wrap">
			<th:block th:if="${outletMainLayoutList}" th:each="mainLayoutData, mainStat : ${outletMainLayoutList}" th:with="contentsLoc=${#strings.replace(mainLayoutData.contentsLoc,'SOM','')},contentsTitle=${mainLayoutData.contentsTitle}">
			<!-- 상단 스크롤 슬라이드 배너 -->
			<th:block th:if="${contentsLoc=='001'}">
			<div class="content dp_submain">
				<div class="cont_head">
					<div>
						<h3>아울렛</h3>
					</div>
				</div>
				<div class="cont_body" th:if="${planningList != null and !planningList.empty}">
					<div class="swiper-container">
						<div class="swiper-wrapper">
							<div class="swiper-slide" th:each="item, status : ${planningList}">
								<a th:href="${item.strVar1}">
									<div class="img">
										<img th:src="${@environment.getProperty('domain.image') + item.imgPath1}" alt="서브메인 썸네일">
									</div>
									<div class="txt">
										<p class="subject">
											<input type="hidden" name="mainTitle" th:value="${item.strTitle1}"/>
										</p>
										<span th:text="${item.subText1}"></span>
									</div>
								</a>
							</div>
						</div>
						<div class="swiper-controls">
							<div class="swiper-scrollbar"></div>
						</div>
					</div>
				</div>
			</div>
			</th:block>
			<!-- //상단 스크롤 슬라이드 배너 -->

			<th:block th:if="${contentsLoc=='004'}">
				<!-- 카테고리 바로가기 -->
				<div class="content wide dp_category">
					<div class="cont_head">
						<h4 th:text="${contentsTitle!=null and contentsTitle!=''}?${contentsTitle}:'카테고리 바로가기'"></h4>
					</div>
					<div class="cont_body">
						<div class="dp_cate_list">
<!--							<a href="">전체</a>-->
<!--							<a href="">여성</a>-->
<!--							<a href="">남성</a>-->
<!--							<a href="">유아동</a>-->
<!--							<a href="">골프</a>-->
<!--							<a href="">라이프</a>-->
						</div>
					</div>
				</div>
			</th:block>

			<!-- MD 추천 아이템 -->
			<th:block th:if="${contentsLoc=='002'}">
			<div class="content md_item" th:if="${mdPickGoodsList != null and !mdPickGoodsList.empty}">
				<div class="cont_head">
					<h4 th:text="${contentsTitle}">MD가 추천하는 아울렛 아이템</h4>
				</div>
				<div class="cont_body">
					<div class="swiper-container">
						<div class="swiper-wrapper">
							<div class="swiper-slide" th:each="item, status : ${mdPickGoodsList}">
								<div class="item_prod">
									<div class="item_state">
										<button type="button" class="itemLike" th:classappend="${item.likeIt == 'likeit'}? 'likeit' : ''"  onclick="cfnPutWishList(this);" th:attr="goodsCd=${item.goodsCd}, goodsNm=${item.goodsFullNm}, ithrCd='', contentsLoc='SOM002', planDtlSq=''">관심상품 추가</button>
										<a href="javascript:void(0);" class="itemLink" th:onclick="cfnGoToGoodsDetail([[${item.goodsCd}]], '', '', 'SOM002');">
											<div class="itemPic">
												<th:block th:each="option,idx:${item.videos}" th:with="videoArr=${#strings.arraySplit(idx.current,':')}">
													<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
													<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
												</th:block>
												<img alt="BLUE-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + item.sysImgNm.replace('https:', '').replace('//image.istyle24.com/Upload/ProductImage/','')}" th:alt="${item.goodsCd}"/>
											</div>
											<p class="itemBrand" th:text="${item.brandGroupNm}">BRAND NAME</p>
											<div class="itemComment" th:if="${not #strings.isEmpty(item.goodsTnm)}" th:text="${item.goodsTnm}">#주문 폭주 상품</div>
											<div class="itemName" th:text="${item.goodsFullNm}">남성 헤링본 기모 팬츠 헤링본 기모 팬츠</div>
											<p  th:unless="${item.goodsType=='G056_D'}" class="itemPrice">[[${#numbers.formatInteger(item.currPrice,0,'COMMA')} + 원]]
												<span class="itemPrice_original" th:if="${item.currPrice != item.listPrice}" th:text="${#numbers.formatInteger(item.listPrice,3,'COMMA')}">89,000</span>
												<span class=" itemPercent" th:if="${item.currPrice != item.listPrice}" th:text="${(item.listPrice == 0 ? 0 : #numbers.formatDecimal((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100, 1, 0)) + '%'}">10%</span>
											</p>
											<p  th:if="${item.goodsType=='G056_D'}" class="itemPrice">[[${#numbers.formatInteger(item.currPrice,0,'COMMA')} + '원 ~']]</p>
										</a>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="swiper-pagination"></div>
					<div class="swiper-button-prev"></div>
					<div class="swiper-button-next"></div>
				</div>
			</div>
			</th:block>
			<!-- //MD 추천 아이템 -->
			<!-- 베스트 상품 리스트 -->
			<th:block th:if="${contentsLoc=='003'}">
			<div class="content dp_best_list" th:if="${bestGoodsList != null and !bestGoodsList.empty}">
				<div class="cont_head">
					<div>
						<h4 th:text="${contentsTitle}">베스트</h4>
					</div>
				</div>
				<div class="cont_body">
					<div class="list_content">
						<div class="itemsGrp"> <!-- itemsGrp rank hot deal -->
							<div class="item_prod" th:each="item, status : ${bestGoodsList}">
								<div class="item_state">
									<button type="button" class="itemLike" th:classappend="${item.likeIt == 'likeit'}? 'likeit' : ''"  onclick="cfnPutWishList(this);" th:attr="goodsCd=${item.goodsCd}, goodsNm=${item.goodsFullNm}, ithrCd='', contentsLoc='SOM003', planDtlSq=''">관심상품 추가</button>
									<a href="javascript:void(0);" class="itemLink" th:onclick="cfnGoToGoodsDetail([[${item.goodsCd}]], '', '', 'SOM003');">
										<div class="shape" th:classappend="${status.count==1}?'ranker'"><span th:text="${status.index+1}">1</span></div>
										<div class="itemPic">
											<th:block th:each="option,idx:${item.videos}" th:with="videoArr=${#strings.arraySplit(idx.current,':')}">
												<iframe th:if="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${'https://www.youtube.com/embed/'+videoArr[1]+'?autoplay=1&mute=1'}"></iframe>
												<iframe th:unless="${videoArr[0]=='Y'}" id="pdThumbVideo" class="pd_mov" th:src="${kollusMediaUrl+'/'+videoArr[1]+'?enable_initialize_focus=false&autoplay&mute&controls_activation=none'}" allow="fullscreen" allowFullScreen></iframe>
											</th:block>
											<img alt="BLUE-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + item.sysImgNm.replace('https:', '').replace('//image.istyle24.com/Upload/ProductImage/','')}">
										</div>
										<p class="itemBrand" th:text="${item.brandGroupNm}">BRAND NAME</p>
										<div class="itemComment" th:if="${not #strings.isEmpty(item.goodsTnm)}" th:text="${item.goodsTnm}">#주문 폭주 상품</div>
										<div class="itemName" th:text="${item.goodsFullNm}">남성 헤링본 기모 팬츠 헤링본 기모 팬츠</div>
										<p th:unless="${item.goodsType=='G056_D'}" class="itemPrice">[[${#numbers.formatInteger(item.currPrice,0,'COMMA')} + 원]]
											<span class="itemPrice_original" th:if="${item.currPrice != item.listPrice}" th:text="${#numbers.formatInteger(item.listPrice,3,'COMMA')}">89,000</span>
											<span class=" itemPercent" th:if="${item.currPrice != item.listPrice}" th:text="${(item.listPrice == 0 ? 0 : #numbers.formatDecimal((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100, 1, 0)) + '%'}">10%</span>
										</p>
										<p th:if="${item.goodsType=='G056_D'}" class="itemPrice">[[${#numbers.formatInteger(item.currPrice,0,'COMMA')} + '원 ~']]</p>
										<div class="itemcolorchip">
											<th:block th:each="option, idx : ${item.colorArr}" th:with="colorArray=${#strings.arraySplit(idx.current,':')}">
												<span th:if="${colorArray[1]=='#FFFFFF'}" th:style="${'background-color:'+colorArray[1]+';border:1px solid #aaa;'}" class="chip_color" th:value="${colorArray[0]}"></span>
												<span th:if="${colorArray[1]!='#FFFFFF'}" th:style="${'background-color:'+colorArray[1]+';'}" class="chip_color" th:value="${colorArray[0]}"></span>
											</th:block>
										</div>
										<p class="itemBadge">
											<th:block th:each="option, idx : ${item.benefitArr}" th:with="iconArray=${#strings.arraySplit(idx.current,':')}" >
												<span class="badge13" th:if="${idx.index<3}" th:value="${iconArray[0]}" th:text="${iconArray[1]}"></span>
											</th:block>
										</p>
									</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			</th:block>
			</th:block>
			<!-- //베스트 상품 리스트 -->
		</div>
	</div>

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

		//210624_ 수정 : 옵션 수정.
		/* SLIDE - 상단 스크롤 슬라이드 배너 */
		var submain_slide = new Swiper('.dp_submain .swiper-container', {
			slidesPerView: 4,
			spaceBetween: 20,
			spped:1000,
			watchOverflow:true,
			freeMode:true,
			autoplay: {
				delay: 3000,
				disableOnInteraction: false,
			},
			scrollbar: {
				el: '.dp_submain .swiper-scrollbar',
				hide: false,
			},
		});

		/* SLIDE - MD ITEMS */
		var mdPickCont = $('.dp .md_item .swiper-container');
		var mdPickLength = mdPickCont.length;
		if(mdPickLength < 6){
			var dp_submain_mditem = new Swiper('.dp .md_item .swiper-container', {
				initialSlide: 0,
				slidesPerView: 5,
				// slidesPerGroup: 5,
				spaceBetween: 20,
				loop: false,
				watchSlidesProgress: true,
				watchSlidesVisibility: true,
				allowTouchMove: false,
				speed : 1000,
				// autoplay: {
				//     delay: 3000,
				//     disableOnInteraction:false,
				// },
				a11y: {
					enabled: true,
					notificationClass: 'swiper-notification',
					prevSlideMessage: '이전 슬라이드',
					nextSlideMessage: '다음 슬라이드',
					paginationBulletMessage: '슬라이드 {{index}}로 이동',
				},
				navigation: {
					nextEl: '.dp .md_item .swiper-button-next',
					prevEl: '.dp .md_item .swiper-button-prev',
				},
				pagination: {
					el: '.dp .md_item .swiper-pagination',
					clickable: true,
				},
			});
		}else{
			var dp_submain_mditem = new Swiper('.dp .md_item .swiper-container', {
				slidesPerView: 5,
				slidesPerGroup: 5,
				spaceBetween: 20,
				loop: true,
				watchSlidesProgress: true,
				watchSlidesVisibility: true,
				allowTouchMove: false,
				speed : 1000,
				// autoplay: {
				//     delay: 3000,
				//     disableOnInteraction:false,
				// },
				a11y: {
					enabled: true,
					notificationClass: 'swiper-notification',
					prevSlideMessage: '이전 슬라이드',
					nextSlideMessage: '다음 슬라이드',
					paginationBulletMessage: '슬라이드 {{index}}로 이동',
				},
				navigation: {
					nextEl: '.dp .md_item .swiper-button-next',
					prevEl: '.dp .md_item .swiper-button-prev',
				},
				pagination: {
					el: '.dp .md_item .swiper-pagination',
					clickable: true,
				},
			});
		}

	});

// 카테고리1Depts 설정
	var fnSetCategory1Depts = function() {
		let allCate = [[${allCateList}]];
		let cateGb = 'G032_101';
		let formalGb = 'G009_20';
		let tag = '';
		tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cateGb + '\',\'\',\'\',\'\',\'\',\'\',\'' + formalGb + '\');">전체</a>\n';
		$.each(allCate, function(allCateIdx, allCateItem) {
			console.log('param::'+[[${params.cate1No}]]);
			//console.log('cate1.cate1No::'+cate1.cate1No);
			//if ([[${params.cate1No}]] == cate1.cate1No) {
			//	let tag = '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate1.cateGb + '\', ' + cate1.cate1No + ',\'\',\'\',\'\',\'\','+formalGb+');">전체</a>\n';
			//	if (cate1.leafYn == 'N' && cate1.cate2List.length > 0) {
			//		$.each(cate1.cate2List, function(idx2, cate2) {
			//			tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate2.cateGb + '\',' + cate2.cate1No + ',' + cate2.cate2No + ',\'\',\'\',\'\','+formalGb+');">' + cate2.cate2Nm + '</a>\n';
			//		});
			//	}
			//	$('.dp_cate_list').html(tag);
			//	$('.cate1Nm').html(cate1.cate1Nm);
			//}
			// tag += '					<li id="cate'+allCateItem.cate1No+'">\n';
			tag += '						<a id="cate'+allCateItem.cate1No+'" href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + allCateItem.cateGb + '\',' + allCateItem.cate1No + ',\'\',\'\',\'\',\'\',\'' + formalGb + '\');">' + allCateItem.cate1Nm + '</a>\n';
			// tag += '					</li>\n';
			
		});
		$('.dp_cate_list').html(tag);
		// $('.cate1Nm').html(cate1.cate1Nm);

		// 스크립트 제거
		function fnRemoveHTML(text){
			var reText = text.replace(/(<br>|<br\/>|<br \/>)/g, "\n");
			reText = reText.replace(/<(\/)?([a-zA-Z]*)(\s[a-zA-Z]*=[^>]*)?(\s)*(\/)?>/ig, "");
			reText = reText.replace(/(?:\r\n|\r|\n)/g, '<br/>');
			return reText;
		}

		$('.subject').each(function (){
			let tag = '';
			if(!gagajf.isNull($(this).find("input[name=mainTitle]").val())) {
				var brText = $(this).find("input[name=mainTitle]").val();
				tag = fnRemoveHTML(brText);
				$(this).append(tag);
			}
		});
	}
/*]]>*/
</script>

</th:block>

</body>
</html>
