<?php include('header.php');?>

    <main id="dashboard">
        <div class="container">
            <div class="row">

                <div class="col-md-10 col-sm-8">

                    <div class="page-title">
                        <h1><strong> Select Post </strong> </h1>
                    </div>

                </div>
<!--
                <div class="col-md-2 col-sm-4 text-right">
                    <a href="<?php echo baseUrl('addnew.php');?>" class="btn btn-lg btn-success btn-block">Add New <i class="fa fa-plus"></i> </a>
                </div>
-->
            </div>
            <br>

            <div class="row">
                <div class="col-sm-12 errors_block">
                </div>
            </div>

            <br>

            <div class="row">
                <div class="col-sm-12">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th class="col-xs-8 col-sm-9"></th>
                                <th class="col-xs-4 col-sm-3"></th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php if(!empty($pages_posts)) { ?>
                            <?php foreach($pages_posts as $post) { ?>
                                <tr>
                                    <td class="user-post">
                                        <img src="<?php echo $post['picture'];?>" alt="" class="post-img">
                                        <span class="post-title"><?php echo strlenchar($post['message'],80);?></span>
                                        <span class="post-info">
                                            <span class="post-comments"> <i class="fa fa-comments"></i> <?php echo $post['comments'];?> </span>
                                            <span class="post-links"> <i class="fa fa-thumbs-up"></i> <?php echo $post['likes'];?> </span>
                                            <span class="post-date"> <?php echo empty($post['created']) ? '' : date('m/d/Y h:i A',strtotime($post['created']));?> </span>
                                            <a href="https://facebook.com/<?php echo $post['id'];?>" target="_blank" class="user-link"> <i class="fa fa-facebook"></i>View post </a>
                                        </span>
                                    </td>
                                    <td class="text-right">
                                        <a data-id="<?php echo $post['id'];?>" href="#" class="select_post btn btn-gray btn-sm"> SELECT POST <i class="fa fa-arrow-right"></i></a>
                                    </td>
                                </tr>
                            <?php } ?>
                        <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <?php if(!empty($pages_posts) && count($pages_posts) >= LOAD_POSTS) { ?>
                <div class="row">
                    <div class="col-sm-3">
                        <a id="load_more_posts" href="#" class="btn btn-info" data-id="<?php echo LOAD_POSTS?>">Load more...</a>
                    </div>
                </div>
            <?php } ?>
            <br>
            <br>

            <div class="row">

                <div class="col-md-10 col-sm-8">

                </div>

                <div class="col-md-2 col-sm-4 text-right">
                    <a id="next_step_31" href="#" class="btn btn-lg btn-success btn-block">Next <i class="fa fa-hand-o-right"></i> </a>
                </div>
            </div>
        </div>
    </main>

<?php include('footer.php');?>