<div class="prof-active">
<h2 class="user_sttng_panel_hd">{{LANG follow_requests}}</h2>
<div class="user-profile-page-content settings_page_requests">
<?php if ($context['requests']) { ?>
<div class="row followers--ls">
<?php foreach ($context['requests'] as $key => $udata) {
?>
<div class="followers--ls__item col-xs-6 col-sm-6 col-md-4" id="ls_item_<?php echo($udata['user_id']) ?>">
<div class="avatar text-center">
<img src="<?php echo(media($udata['avatar'])) ?>" alt="Picture" class="img-circle img-res">
</div>
<div class="user__info">
<h5><a href="<?php echo(un2url($udata['username'])) ?>" data-ajax="ajax_loading.php?app=profile&apph=profile&uname=<?php echo($udata['username']) ?>"><?php echo($udata['username']) ?></a></h5>
<!--<p>{{LANG last_seen}}: <?php echo(time2str($udata['last_seen'])) ?></p>-->
<?php if (IS_LOGGED && $udata['user_id'] != $context['user']['user_id']) { ?>
<div class="request-opts">
<button type="button" onclick="accept_follow(this,<?php echo($udata['user_id']) ?>)" class="btn accept_follow_btn accept_req" title="{{LANG accept}}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>
</button>
<button type="button" onclick="delete_follow(this,<?php echo($udata['user_id']) ?>)" class="btn accept_follow_btn decline_req" title="{{LANG delete}}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
<?php } else{ ?>
<div class="empty_state">
<span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M6,10V7H4V10H1V12H4V15H6V12H9V10M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12Z" /></svg></span>
<p>{{LANG u_dont_have_requests}}</p>
</div>
<?php } ?>
</div>
</div>
<script type="text/javascript">
function accept_follow(self,user_id) {
$('.accept_follow_btn').attr('disabled', 'true');
$.post(xhr_url() + 'main/accept_requests', {user_id: user_id}, function(data, textStatus, xhr) {
if (data.status == 200) {
$('#ls_item_'+user_id).remove();
$.toast(data.message,{
duration: 5000,
type: '',
align: 'bottom',
singleton: true
});
}
else{
$.toast(data.message,{
duration: 5000,
type: '',
align: 'bottom',
singleton: true
});
}
});
}
function delete_follow(self,user_id) {
$('.accept_follow_btn').attr('disabled', 'true');
$.post(xhr_url() + 'main/delete_requests', {user_id: user_id}, function(data, textStatus, xhr) {
if (data.status == 200) {
$('#ls_item_'+user_id).remove();
// $.toast(data.message,{
// duration: 5000,
// type: '',
// align: 'bottom',
// singleton: true
// });
}
else{
$.toast(data.message,{
duration: 5000,
type: '',
align: 'bottom',
singleton: true
});
}
});
}
</script>