<template include="./plugin/haya_follow/view/htm/my_follow.template.htm">
	<slot name="my_body">
		<ul class="list-unstyled postlist mb-0">
			<?php if (!empty($haya_follow_followeds)) { foreach ($haya_follow_followeds as $haya_follow_fans_user) { ?>
				<li class="media post haya-follower-<?php echo $haya_follow_fans_user['follow_uid'];?>" data-uid="<?php echo $haya_follow_fans_user['follow_uid'];?>">
					<div class="media-body">
						<div class="d-flex justify-content-between text-muted">
							<div class="media">
								<a target="_blank" href="<?php echo url("user-$haya_follow_fans_user[follow_uid]");?>" title="<?php echo $haya_follow_fans_user['follower_user']['username'];?>" class="mr-2 mt-1">
									<img class="avatar-3" src="<?php echo $haya_follow_fans_user['follower_user']['avatar_url'];?>">
								</a>
								
								<div class="media-body">
									<div>
										<!--{hook plugin_haya_follow_my_follow_fans_username_before.htm}-->
										<a target="_blank" href="<?php echo url("user-$haya_follow_fans_user[follow_uid]");?>" title="<?php echo $haya_follow_fans_user['follower_user']['username'];?>" class="text-info mt-1">
											<?php echo $haya_follow_fans_user['follower_user']['username'];?>
										</a>
										
										<?php if ($haya_follow_fans_user['status'] == 2) { ?>
											<i class="icon icon-user" title="双向关注"></i>
										<?php } ?>
										<!--{hook plugin_haya_follow_my_follow_fans_username_after.htm}-->
									</div>
									
									<!--{hook plugin_haya_follow_my_follow_fans_body_username_after.htm}-->
									
									<div class="mt-1 haya-follow-follower-fans">
										<!--{hook plugin_haya_follow_my_follow_fans_fans_before.htm}-->
										<span class="small haya-follower-fans">
											粉丝：<?php echo intval($haya_follow_fans_user['follower_user']['followeds']); ?>
										</span>
										<!--{hook plugin_haya_follow_my_follow_fans_fans_after.htm}-->
									</div>
									
									<!--{hook plugin_haya_follow_my_follow_fans_body_fans_after.htm}-->									
								</div>
								
							</div>
							<div class="text-right haya-follow-user-setting">
								<span class="haya-follow-user-settings d-none d-md-block">
									<?php 
									if ($haya_follow_fans_user['follow_uid'] != $uid) { 
										$haya_follow_check_user = haya_follow_find_by_uid_and_follow_uid($haya_follow_fans_user['follow_uid'], $uid);
									?>
										<!--{hook plugin_haya_follow_my_follow_fans_following_before.htm}-->
										<?php if (!empty($haya_follow_check_user)) { ?>
											<button class="btn btn-sm btn-outline-secondary mt-2 js-haya-follow-del" data-uid="<?php echo $haya_follow_fans_user['follow_uid'];?>" title="已关注">
												<i class="icon icon-check" aria-label="已关注"></i>
												<span class="haya-follow-btn">已关注</span>
											</button>
										<?php } else { ?>
											<button class="btn btn-sm btn-outline-secondary mt-2 js-haya-follow-add" data-uid="<?php echo $haya_follow_fans_user['follow_uid'];?>" title="关注">
												<i class="icon icon-plus" aria-label="关注"></i>
												<span class="haya-follow-btn">关注</span>
											</button>
										<?php } ?>
										<!--{hook plugin_haya_follow_my_follow_fans_following_after.htm}-->
									<?php } else { ?>
										<!--{hook plugin_haya_follow_my_follow_fans_mine_before.htm}-->
										<button class="btn btn-sm btn-outline-secondary mt-2 js-haya-follow-me" data-uid="<?php echo $haya_follow_fans_user['follow_uid'];?>" title="自己">
											<i class="icon icon-check" aria-label="自己"></i>
											<span class="haya-follow-btn">自己</span>
										</button>
										<!--{hook plugin_haya_follow_my_follow_fans_mine_after.htm}-->
									<?php } ?>
							
									<?php if ($haya_follow_config['delete_follower'] == 1) { ?>
										<!--{hook plugin_haya_follow_my_follow_fans_remove_before.htm}-->
										<button class="btn btn-sm btn-outline-danger mt-2 ml-1 js-haya-follow-remove" data-uid="<?php echo $haya_follow_fans_user['follow_uid'];?>" title="移除该用户">
											<i class="icon icon-remove" aria-label="移除该用户"></i>
											<span class="haya-follow-btn">移除</span>
										</button>
										<!--{hook plugin_haya_follow_my_follow_fans_remove_after.htm}-->
									<?php } ?>
								</span>
								
								<!-- 手机端显示 -->
								<span class="d-md-none">
									<button class="btn btn-sm btn-outline-secondary mt-2 ml-1 dropdown-toggle js-haya-follow-user-setting" type="button">
										操作
									</button>
								</span>
							</div>
						</div>
					</div>
				</li>
			<?php }} else { ?>
				<li class="media haya-follower-empty">
					<div class="text-muted small">还没有关注我的~</div>
				</li>
			<?php } ?>
		</ul>
		
		<?php if (!empty($haya_follow_post_pagination)) { ?>
			<nav><ul class="pagination justify-content-center"><?php echo $haya_follow_post_pagination; ?></ul></nav>
		<?php } ?>
	</slot>
</template>

<script>
$(function() {

	$(document).on("click", ".js-haya-follow-user-setting", function() {
		var settings = $(".haya-follow-user-settings");
		if (settings.hasClass("d-none")) {
			settings.removeClass("d-none");
		} else {
			settings.addClass("d-none");
		}
	});

});
	
$('a[data-active="my-follow-fans"]').addClass('active');
</script>
