<?php $__env->startSection('content'); ?>

<?php
    $device = $device ?? request()->route('device') ?? 'mobile';
    
    // Tipe Game dari Controller, diubah huruf pertamanya jadi besar (Contoh: "slot" jadi "Slot")
    $gameType = ucfirst($type ?? 'Slot'); 
    
   
?>

<div class="middlebackground background-design5">
    <div role="main" class="container">
        <div class="row">
            
            <div class="col-xs-12 main-content">
                <div class="content slot-content">
                    
                    
                    <div class="content-header slot-content-header game-content-header">
                        <div class="content-title slot-title game-title-header">
                            <h4 class="game-title"><?php echo e($gameType); ?></h4>
                            
                            <div class="input-form-group search-form">
                                <input type="text" id="inputSearchGame" class="form-control" autocomplete="off" placeholder="Search Provider" onkeypress="return event.keyCode !== 13;">
                                <button id="btnsearchgame" class="btn btn-default" type="button" onclick="updateSearchProvider();">
                                    <span class="fa-solid fa-magnifying-glass"></span>
                                </button>
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="content-body slot-content-body enable-search">
                        
                        
                        <div class="loader loader-d-n">
                            <img src="<?php echo e(asset('assets/images/loading.gif')); ?>" alt="loading"/>
                        </div>
                        
                        <ul class="gamecontent-menu gameprovider-menu" id="providerList">
                            <?php $__empty_1 = true; $__currentLoopData = $providers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $provider): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <li class="gameprovider-d-min-2 gameprovider-item" data-provider-name="<?php echo e(strtolower($provider->provider_name)); ?>">
                                    
                                    <a class="gameprovider-content" href="<?php echo e(url("/{$device}/game/{$type}/{$provider->slug}")); ?>">
                                        
                                        
                                        <img alt="<?php echo e($provider->provider_name); ?> BG" class="img-responsive img-center layer-1" src="<?php echo e(asset('assets/brand/game/2/Color_Gold_ID.webp')); ?>?v=2" />
                                        
                                        
                                        
                                        <img alt="<?php echo e($provider->provider_name); ?>" title="<?php echo e($provider->provider_name); ?>" class="img-responsive img-center layer-2" 
                                             src="<?php echo e(!empty($provider->icon) ? asset($provider->icon) : asset($provider->mt_logo)); ?>" />
                                             
                                    </a>
                                </li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <div class="col-xs-12 text-center" style="padding: 20px; color: #fff;">
                                    Provider untuk kategori ini belum tersedia.
                                </div>
                            <?php endif; ?>
                        </ul>
                        
                        
                        <div id="noProviderFound" style="display: none; text-align: center; padding: 20px; color: #fff;">
                            Provider tidak ditemukan.
                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

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

<?php $__env->startPush('script'); ?>
<script>
    // FUNGSI PENCARIAN PROVIDER
    function updateSearchProvider() {
        let searchQuery = document.getElementById('inputSearchGame').value.toLowerCase();
        let providerItems = document.querySelectorAll('#providerList .gameprovider-item');
        let hasVisibleProvider = false;
        
        providerItems.forEach(function(item) {
            let providerName = item.getAttribute('data-provider-name');
            
            if (providerName.includes(searchQuery)) {
                item.style.display = ""; // Tampilkan jika cocok
                hasVisibleProvider = true;
            } else {
                item.style.display = "none"; // Sembunyikan jika tidak cocok
            }
        });

        // Menampilkan pesan jika tidak ada provider yang cocok dengan pencarian
        document.getElementById('noProviderFound').style.display = hasVisibleProvider ? 'none' : 'block';
    }

    // Event Listener agar pencarian realtime (saat mengetik)
    document.addEventListener("DOMContentLoaded", function() {
        let searchInput = document.getElementById('inputSearchGame');
        if (searchInput) {
            searchInput.addEventListener('keyup', function() {
                updateSearchProvider();
            });
        }
    });
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('frontend.mobile.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /www/wwwroot/website/sewa/dragon158/resources/views/frontend/mobile/pages/game/provider.blade.php ENDPATH**/ ?>