<?php if($article['status'] == true): ?>
<?php ($num = 0); ?>
<div class="row">
    <div class="table-responsive">
        <table class="table" style="width: 100%">
            <tbody>
                <?php $__currentLoopData = $article['data']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ad): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php ($num = $num + 1); ?>
                <?php if($num % 5 == 1): ?>
                <tr class="td-hover">
                    <!-- href="<?php echo e(url('aboutKM/display/'.encrypt($ad['id']))); ?>" -->
                    <td style="width: 20%; text-align: center; border-bottom-width: 0px">
                        <a class="p-hover" href="<?php echo e(route('aboutKM.group',$ad['short_url'])); ?>">
                            <div class="box" data-value="<?php echo e($ad['id']); ?>">
                                <div class="box-body">
                                    <img src="<?php echo e(asset('../storage/km/cover/'.$ad['photo'])); ?>"
                                        class="margin content-cover" width="140px" height="210px" />
                                </div>
                                <div class="box-footer" style="text-align: center">
                                    <p class="margin-clear kitem-1"><?php echo e($ad['name']); ?></p>
                                    <small class="text-muted"><?php echo e($ad['author']); ?></small>
                                </div>
                            </div>
                        </a>
                    </td>
                    <?php elseif($num % 5 == 0): ?>
                    <td style="width: 20%; text-align: center; border-bottom-width: 0px">
                        <a class="p-hover" href="<?php echo e(route($ad['type']['route'],$ad['short_url'])); ?>">
                            <div class="box" data-value="<?php echo e($ad['id']); ?>">
                                <div class="box-body">
                                    <img src="<?php echo e(asset('../storage/km/cover/'.$ad['photo'])); ?>"
                                        class="margin content-cover" width="140px" height="210px" />
                                </div>
                                <div class="box-footer" style="text-align: center">
                                    <p class="margin-clear kitem-1"><?php echo e($ad['name']); ?></p>
                                    <small class="text-muted"><?php echo e($ad['author']); ?></small>
                                </div>
                            </div>
                        </a>
                    </td>
                </tr>
                <?php else: ?>
                <td style="width: 20%; text-align: center; border-bottom-width: 0px">
                    <a class="p-hover" href="<?php echo e(route($ad['type']['route'],$ad['short_url'])); ?>">
                        <div class="box" data-value="<?php echo e($ad['id']); ?>">
                            <div class="box-body">
                                <img src="<?php echo e(asset('../storage/km/cover/'.$ad['photo'])); ?>" class="margin content-cover"
                                    width="140px" height="210px" />
                            </div>
                            <div class="box-footer" style="text-align: center">
                                <p class="margin-clear kitem-1"><?php echo e($ad['name']); ?></p>
                                <small class="text-muted"><?php echo e($ad['author']); ?></small>
                            </div>
                        </div>
                    </a>
                </td>
                <?php endif; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                <?php ($mot = count($article['data']) % 5 ); ?>
                <?php if($mot < 5 && $mot != 0): ?>
                <?php for($i=count($article['data']) % 5; $i < 5; $i++): ?> 
                <td style="width: 20%; text-align: center; border-bottom-width: 0px"></td>
                <?php if($i == 5): ?>
                </tr>
                <?php endif; ?>
                <?php endfor; ?>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
    
    <div class="d-flex justify-content-center">
        <?php echo $article['data']->links(); ?>

    </div>
</div>
<?php else: ?>
<p>ไม่พบข้อมูล</p>
<?php endif; ?>

<script>
var selector = '.pageid a';
// var idMenu = $(".list-group .active").attr("data-index");
var idMenu = $(".sidenav a.active").attr("data-index");
$(selector).on('click', function() {
    $(selector).removeClass('active');
    $(this).addClass('txtorange-5 active');
    urlApi = $(this).attr("data-index");
    listPage(idMenu, urlApi);
});

function listPage(idMenu, urlApi) {
    var form_data = new FormData();
    form_data.append('id', idMenu);
    form_data.append('url', urlApi);
    form_data.append('size', 20);

    $.ajax({
        type: "post",
        url: '../page/tableArticle',
        data: form_data,
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        },
        processData: false,
        contentType: false,
        cache: false,
        success: function(html) {
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            });
            $('#blade').html(html);
        }
    });
}
</script><?php /**PATH C:\xampp\htdocs\km-web\resources\views/subpage/tableArticle.blade.php ENDPATH**/ ?>