<?php
    $cryptos = App\Models\CryptoCurrency::active()->get();
?>
<div class="row">
    <div class="col-lg-12">
        <ul class="nav nav-tabs custom--style-two justify-content-center bg-transparent">
            <?php $__currentLoopData = $cryptos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cryptoData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <li class="nav-item goto-more-<?php echo e($type); ?>">
                    <a class="nav-link crypto-currency-<?php echo e($type); ?> <?php if($loop->first): ?> active <?php endif; ?>" data-bs-toggle="tab" data-code="<?php echo e($cryptoData->code); ?>" href="#<?php echo e($cryptoData->code); ?>-<?php echo e($type); ?>" id="<?php echo e($cryptoData->code); ?>-<?php echo e($type); ?>-tab" role="tab"><?php echo e(__($cryptoData->code)); ?></a>
                </li>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </ul>
        <div class="tab-content mt-4">
            <?php $__currentLoopData = $cryptos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cryptoData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div aria-labelledby="<?php echo e($cryptoData->code); ?>-<?php echo e($type); ?>-tab" class="tab-pane bg-transparent fade content-load-<?php echo e($type); ?> <?php if($loop->first): ?> show active <?php endif; ?>" id="<?php echo e($cryptoData->code); ?>-<?php echo e($type); ?>" role="tabpanel">
                    <div class="d-flex justify-content-center align-items-center currency-loading">
                        <h4><i class="fa fa-spinner fa-spin text-muted"></i></h4>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
        <div class="btn-group mt-4 justify-content-center">
            <a  class="btn--base btn-sm" id="<?php echo e($type); ?>-more"><?php echo app('translator')->get('More'); ?></a>
        </div>
    </div>
</div>

<?php $__env->startPush('script'); ?>
    <script>
        'use strict';

        (function($) {
            let cryptoCount = '<?php echo e($cryptos->count()); ?>';
            let type        = `<?php echo e($type); ?>`
            if (parseInt(cryptoCount) > 0) {
                getAds(`<?php echo e($cryptos->first()->code ?? 0); ?>`);
            }

            $(`.crypto-currency-${type}`).on('click', function() {
                $(`.content-load-${type}`).html(
                    `<div class="d-flex justify-content-center align-items-center currency-loading">
                        <h4><i class="fa fa-spinner fa-spin text-muted"></i></h4>
                    </div>`
                );
                getAds($(this).data('code'));
            });

            function getAds(code) {
                let url=`<?php echo e(route('advertisement.all', ['type' => ':type','crypto' => ':crypto'])); ?>`;
                url=url.replace(":type",type).replace(':crypto',code)
                $("#<?php echo e($type); ?>-more").attr('href',url)
                $.get(url,
                    function(data, status) {
                        if (status == 'success') {
                            $(`.content-load-${type}`).html(data.html);
                            tableResponsive();
                        }
                    }
                );
            }
            $(`#${type}-more`).on('click', function() {
                if ($(`.crypto-currency-${type}`).hasClass('active')) {
                    var cryptoCode = $(`.goto-more-${type}`).find('.active').data('code');
                    $(`.${type}-submit`).find('input[name="crypto_code"]').val(cryptoCode);
                }
            });
        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>


<?php $__env->startPush('style'); ?>
    <style>
        .currency-loading {
            height: 400px;
            background-color: #fca12038
        }
    </style>
<?php $__env->stopPush(); ?>
<?php /**PATH C:\xampp\htdocs\bitpeak\core\resources\views/templates/basic/partials/ads_table.blade.php ENDPATH**/ ?>