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

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

            <div class="row">

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

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

                </div>
            </div>

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

            <br>
            <br>

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

                    <div class="panel panel-fb">

                        <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($schedule_groups['data'])) { ?>
                            <?php foreach($schedule_groups['data'] as $group) { ?>
                                <tr>
                                    <td class="user-page">
                                        <img alt="" src="https://graph.facebook.com/<?php echo $group['id'];?>/picture" class="user-pic">
                                        <span class="user-name"><?php echo $group['name'];?> <?php echo ($group['closed']) ? '(Closed Group)' : ''?></span>
                                            <span class="user-info">
                                                <!--<span class="user-num"><?php echo $group['likes'];?> Fans</span>-->
                                                <a target="_blank" href="https://facebook.com/<?php echo $group['id'];?>" class="user-link"> <i class="fa fa-facebook"></i>View group </a>
                                            </span>
                                    </td>


                                    <td class="text-right">
                                        <?php if(!$group['closed']) { ?>
                                        <a data-id="<?php echo $group['id'];?>" type="button" class="choose_page btn btn-gray btn-sm">
                                            SELECT GROUP <i class="fa fa-arrow-right"></i>
                                        </a>
                                        <?php } ?>
                                    </td>
                                </tr>
                            <?php } } ;?>
                            </tbody>
                        </table>


                    </div>

                </div>
            </div>
            <br>
            <br>
            <?php if(!empty($schedule_groups['data']) && count($schedule_groups['data']) >= LOAD_GROUPS) { ?>
                <div class="row">
                    <div class="col-sm-3">
                        <a id="load_more_groups" href="#" class="btn btn-info" data-id="<?php echo LOAD_GROUPS?>">Load more...</a>
                    </div>
                </div>
            <?php } ?>
            <br>
            <br>

            <div class="row">

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

                </div>

                <div class="col-md-2 col-sm-4 text-right">
                    <a href="#" id="next_step1" 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');?>