<!DOCTYPE html>
<html lagn="ko" xmlns:th="http://www.thymeleaf.org">
<th:block th:fragment="layout_rightMenu">
<script>
	$(function(){
		fn_rightSelectListRecommendFollow();
	});
</script>
		<!-- 우측 메뉴 -->
		<div class="right_wrap">
			<div class="right_box">
				<div id="rightMenu" style="display:none">
					
					<ul class="follow_box" id="rightFollowBox">
						
					</ul>
	
					<div class="company" id="rightFooter">
						<ul class="footerList">
							<li><a href="#" onClick="fn_selectPolicyIntro('B');">개인정보처리방침</a></li>
							<li><a href="#" onClick="fn_selectPolicyIntro('A');">이용약관</a></li>
							<li><a href="#" onClick="fn_selectListInquiryIntro();">고객센터</a></li>
						</ul>
			
						<div class="footerCompany">
							<span>주식회사 그늘</span>
			
							<span>서울특별시 마포구 월드컵북로5가길 8-17, 2층(서교동)</span>
			
							<p>대표이사 <span>오 범 진</span></p>
							
							<p>사업자등록번호 <span>811-87-02127</span></p>
							
							<p class="last">EMAIL <span>playentree@play-gnl.kr</span></p>
							
							<span class="reserved">ⓒ그늘 CORP ALL RIGHTS RESERVED.</span>
						</div>
					</div>
				</div>
			</div>
		</div>
<script>

/****************************************************************************
* 고갠센터 화면 이동
****************************************************************************/
function fn_selectListInquiryIntro(){
	fn_leftFormAction2("Setting", "/webinquiry/selectListInquiryIntro.do");
}

/****************************************************************************
* 추천 팔로우 목록 이동
****************************************************************************/
function fn_snsFollowIntro(){
	fn_leftFormAction2(menuClass, "/webuserfollow/selectListFollowRecommendIntro.do");
}

/****************************************************************************
* 추천 팔로우 리스트 조회
****************************************************************************/
function fn_rightSelectListRecommendFollow(){
	let formData = new FormData();
	formData.append("start",'0');
	formData.append("limit",'5');
	
	$.ajax({
		url: encodeURI('/webuserfollow/selectListRecommendFollow.do'),
		data: formData,
		dataType: "json",
		processData: false,
		contentType: false,
		type: 'POST',
		async: true,
		success: function(data){
			if('0'==data.msgCode){
				if(0<data.rows.length){
					let followListBoxHTML = '';
					followListBoxHTML += '<p class="title">추천 팔로우</p>';
					
					for(let i=0; i<data.rows.length; i++){
						followListBoxHTML += '<li>';
						if('Y'==data.rows[i].userBranchYn){
							followListBoxHTML += '	<div class="image_box green_line" onClick="fn_userProfileIntro(\''+data.rows[i].userName+'\',\''+data.rows[i].loginId+'\');">';
						}
						else{
							followListBoxHTML += '	<div class="image_box" onClick="fn_userProfileIntro(\''+data.rows[i].userName+'\',\''+data.rows[i].loginId+'\');">';
						}
						followListBoxHTML += '		<img src=\''+data.rows[i].profileUrl+'\'>';	
						followListBoxHTML += '	</div>';
						
						followListBoxHTML += '	<div class="text_box">';
						followListBoxHTML += '		<p class="user">'+data.rows[i].userName+'</p>';
						followListBoxHTML += '	</div>';
						
						followListBoxHTML += '	<img class="right_icon" id="rightFollowBtn'+data.rows[i].ntUserId+'" onClick="javascript:fn_rightInsertFollow(\''+data.rows[i].ntUserId+'\');" src="/image/web/sns_follow.svg">';	
						followListBoxHTML += '	<img class="right_icon" id="rightFollowingBtn'+data.rows[i].ntUserId+'" style="display:none" onClick="javascript:fn_rightDeleteFollow(\''+data.rows[i].ntUserId+'\');" src="/image/web/sns_follow_gray.svg">';	
						
						followListBoxHTML += '</li>';
					}
					followListBoxHTML += '	<a href="javascript:fn_snsFollowIntro();">더보기<img class="arrow" src="/image/web/sns_more_arrow.svg"></a>';
					
					$("#rightFollowBox").empty().html(followListBoxHTML).trigger("create");
					
					
					$(".right_icon").css("cursor", "pointer");
				}
				else{
					$("#rightFollowBox").empty();
				}
			}
			else{
				modalEvent.danger("조회 오류", data.msgDesc);
			}
		},
		error : function(xhr, status, error) {
			modalEvent.danger("조회 오류", "정상적으로 수행되지 않았습니다. 관리자에게 문의하시기 바랍니다.");
		},
		beforeSend:function(){
			
		},
		complete:function(){
			
		}
	});
}


/****************************************************************************
* 팔로워 등록
****************************************************************************/
function fn_rightInsertFollow(param){
	let formData = new FormData();
	formData.append("ntFollowUserId", param);
	
	$.ajax({
		url: encodeURI('/webuserfollow/insertFollow.do'),
		data: formData,
		dataType: "json",
		processData: false,
		contentType: false,
		type: 'POST',
		async: true,
		success: function(data){
			if('0'==data.msgCode){
				$("#rightFollowBtn"+param).css("display", "none");
				$("#rightFollowingBtn"+param).css("display", "");
			}
			else{
				modalEvent.danger("조회 오류", data.msgDesc);
			}
		},
		error : function(xhr, status, error) {
			modalEvent.danger("조회 오류", "정상적으로 수행되지 않았습니다. 관리자에게 문의하시기 바랍니다.");
		},
		beforeSend:function(){
			
		},
		complete:function(){
			
		}
	});
}


/****************************************************************************
* 팔로워 해제
****************************************************************************/
function fn_rightDeleteFollow(param){
	let formData = new FormData();
	formData.append("ntFollowUserId", param);
	
	$.ajax({
		url: encodeURI('/webuserfollow/deleteFollow.do'),
		data: formData,
		dataType: "json",
		processData: false,
		contentType: false,
		type: 'POST',
		async: true,
		success: function(data){
			if('0'==data.msgCode){
				$("#rightFollowBtn"+param).css("display", "");
				$("#rightFollowingBtn"+param).css("display", "none");
			}
			else{
				modalEvent.danger("조회 오류", data.msgDesc);
			}
		},
		error : function(xhr, status, error) {
			modalEvent.danger("조회 오류", "정상적으로 수행되지 않았습니다. 관리자에게 문의하시기 바랍니다.");
		},
		beforeSend:function(){
			
		},
		complete:function(){
			
		}
	});
}

</script>
</th:block>
</html>