<div class="page-margin">
	<div class="row">
		<div class="col-md-2 leftcol"><?php echo Wo_LoadPage("sidebar/left-sidebar"); ?></div>
		<div class="col-md-7 profile-lists middlecol">
			<div class="wo_my_pages">
                <div class="my_pages_header row" style="margin: 0px 0px 20px;">
					<ul class="<?php echo Wo_RightToLeft('pull-left'); ?>">
						<li class="active"><a href="<?php echo Wo_SeoLink('index.php?link1=poke'); ?>" data-ajax="?link1=poke"><?php echo $wo['lang']['my_pokes'] ?></a></li>
					</ul>
				</div>
				<div id="poke_content">
					<?php
                        $pokes = $wo['poke'];
						if (count($pokes) > 0) {
                            ?>
                            <?php
							foreach ($pokes as $key => $wo['poke']) {
								echo "<div class='wo_pokes_cont'>" . Wo_LoadPage('poke/poke-list') . "</div>";
                            }
                            ?>
                            <?php
						} else {
							echo '<h5 class="search-filter-center-text empty_state"><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-flag"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"></path><line x1="4" y1="22" x2="4" y2="15"></line></svg> ' . $wo['lang']['no_pokes_found'] . '</h5>';
						}
					?>
				    <div class="clear"></div>
				</div>
                <div class="clear"></div>
                <?php  if (count($pokes) > 8): ?>
                <div class="load-more">
                    <button class="btn btn-default text-center pointer load-more-pokes">
                    <svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather"><polyline points="6 9 12 15 18 9"></polyline></svg>
                    <?php echo $wo['lang']['load_more'] ?>
                    </button>
                </div>
                <?php endif ?>
			</div>
		</div>
		<?php echo Wo_LoadPage('sidebar/content');?>
	</div>
</div>
<script>
    function Wo_RegisterPokeBack(received_user_id ,self,  send_user_id, poke_id){
        if (!received_user_id || !self || !send_user_id || !poke_id ) {
            return false;
        }
        $(self).attr('disabled',true);
        $(self).find('.button-text').html("<?php echo $wo['lang']['txt_poked'];?>");

        $.ajax({
            url: Wo_Ajax_Requests_File(),
            type: 'GET',
            dataType: 'json',
            data: {f: 'poke',received_user_id:received_user_id,send_user_id:send_user_id,poke_id:poke_id},
        })
        .done(function(data) {
            if (data.status == 200) {
                Wo_Delay(function(){
                    $('#pokeuser_' + received_user_id).remove();
                },2000);
            }else{
                $(self).attr('disabled',false);
                $(self).find('.button-text').html("<?php echo $wo['lang']['poke_back'];?>");
            }
        })
        .fail(function() {
            $(self).attr('disabled',false);
            $(self).find('.button-text').html("<?php echo $wo['lang']['poke_back'];?>");
            console.log("error");
        })
    }
    $(document).on('click', '.load-more-pokes', function(event) {
        var id = $('.wo_poke_users').last().attr('id');
        $.post(Wo_Ajax_Requests_File()+"?f=load_poke", {id: id}, function(data, textStatus, xhr) {
            if (data.status == 200 && data.html != '') {
                $('#poke_content').append(data.html);
            }
            else{
                $('.load-more-pokes').remove();
            }
        });
    });
</script>