<?php $__env->startSection('title'); ?>
    STAKEGAINS | Blogs
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page'); ?>
    All Blog Posts
    <button class="btn btn-sm btn-success pull-right" id="exportbtn"><span class="fa fa-download"></span> DOWNLOAD AS SPREADSHEET</button>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <div class="col" style="min-height: 323px;;">
        <br><br>
        <?php
        $date = new dateTime();
        $d = $date->format('j F, Y');
        ?>
        <?php if(isset($success)): ?>
            <script>
                alert('<?php echo e($success); ?>');
            </script>
        <?php endif; ?>
        <table id="datatable" class="table table-striped table-bordered nowrap" cellspacing="0" width="100%">
            <thead>
            <tr>
                <th>REL</th>
                <th>CREATOR</th>
                <th>TITLE</th>
                <th>CATEGORY</th>
                <th>EXCERPT</th>

                <th>Details</th>
                <th>Controls</th>
            </tr>
            </thead>
            <tbody>
            <?php
                    $sn = 0;
            ?>
            <?php foreach($blogs->all() as $blog): ?>
                <?php
                $sn++;
                $creator = App\System::find($blog->creator);
                ?>
                <tr id="d<?php echo e($blog->id); ?>">
                    <td class="red"><?php echo e($sn); ?></td>
                    <td><a class="creatorview" href="<?php echo e($creator['id']); ?>" data-target="#creator" data-toggle="modal"><span style="color: brown;"><?php echo e($creator['name']); ?></span></a></td>
                    <td><?php echo e($blog->title); ?></td>
                    <td><?php echo e($blog->category); ?></td>
                    <td><?php echo str_limit($blog->content, $limit=50, $end='...'); ?></td>

                    <td><a class="blogview" href="<?php echo e($blog->id); ?>" data-target="#blogdetail" data-toggle="modal"><span style="color: green;"><span class="fa fa-eye"></span> VIEW</span></a></td>
                    <td>
                        <div class="btn-group">
                            <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
                                Actions
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu pull-right" role="menu" style="background: whitesmoke; -webkit-box-shadow: inset 0px 0px 10px grey;-moz-box-shadow: inset 0px 0px 10px grey;box-shadow: inset 0px 0px 10px grey;">
                                <li style="cursor: pointer;"><a class="updateblog" href="<?php echo e($blog->id); ?>" data-target="#updateblog" data-toggle="modal">EDIT/UPDATE</a>


                                <?php if($blog->status=='Publish'): ?>
                                    <li style="cursor: pointer;"><a class="hidethis" href="<?php echo e($blog->id); ?>" id="h<?php echo e($blog->id); ?>">UNPUBLISH THIS</a>
                                <?php else: ?>
                                    <li style="cursor: pointer;"><a class="unhidethis" href="<?php echo e($blog->id); ?>" id="h<?php echo e($blog->id); ?>"><span style="color: green;">PUBLISH THIS</span></a>
                                <?php endif; ?>

                                <li style="cursor: pointer;"><a class="blogdelete" href="<?php echo e($blog->id); ?>" data-target="#blogdelete" data-toggle="modal">DELETE</a>
                                </li>
                            </ul>
                        </div>
                    </td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
    <div class="row" id="excon">
        <table class="table" id="exportthis">
            <thead>
            <tr>
                <th>S/N</th>
                <th>DATE CREATED</th>
                <th>TIME CREATED</th>
                <th>TITLE</th>
                <th>CATEGORY</th>
                <th>CONTEXT</th>
                <th>STATUS AT PRESENT</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($blogs->all() as $b): ?>
                <tr>
                    <td><?php echo e($b->id); ?></td>
                    <td><?php echo e($b->post_date); ?></td>
                    <td><?php echo e($b->post_time); ?></td>
                    <td><?php echo e($b->title); ?></td>
                    <td><?php echo e($b->category); ?></td>
                    <td><?php echo $b->content; ?></td>
                    <td><?php echo e($b->status); ?></td>               </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>