<?php
    $popupData = popup(); 
?>

<?php if(!empty($popupData)): ?>
    
    <div id="g8-popup-wrapper" style="display: none;">
        <div id="popup_overlay" style="position: fixed; z-index: 99998; top: 0px; left: 0px; width: 100vw; height: 100vh; opacity: 0.6;"></div>
        
        <div id="popup_container" class="alert alert-danger" style="position: fixed; z-index: 99999; padding: 15px; margin: 0px; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 90%; max-height: 90vh; overflow-y: auto; border-radius: 8px;">
          <h4 id="popup_title"></h4>
          <div id="popup_content" class="alert home-popup" style="margin-bottom: 0;">
            <div id="popup_message">
              
              <div style="text-align:center; width: 100%;">
                <img src="<?php echo e(asset('uploads/'.$popupData->gambar)); ?>" alt="Informasi Penting" style="width: 100%; height: auto; max-height: 60vh; object-fit: contain; border-radius: 6px;">
              </div>

            </div>
            
            <div id="popup_panel" style="text-align: center; margin-top: 15px;">
              <input type="button" value="OK" id="popup_ok" class="btn btn-default" style="cursor:pointer; padding: 8px 30px; color: #fff; border: none; border-radius: 4px;">
            </div>
          </div>
        </div>
    </div>

    <?php $__env->startPush('scripts'); ?>
    <script type="text/javascript">
        $(document).ready(function() {
            // Cek apakah player sudah pernah melihat popup di sesi ini
            let hasSeenPopup = sessionStorage.getItem('mantra_popup_seen');

            if (!hasSeenPopup) {
                // Jika belum pernah lihat, munculkan popupnya
                $('#g8-popup-wrapper').fadeIn(300);
            }

            // Fungsi untuk menutup dan menandai sudah dilihat
            function closeAndSave() {
                $('#g8-popup-wrapper').fadeOut(300);
                // Simpan tanda di session browser agar tidak muncul lagi
                sessionStorage.setItem('mantra_popup_seen', 'true');
            }

            $('#popup_ok').on('click', function() {
                closeAndSave();
            });

            $('#popup_overlay').on('click', function() {
                closeAndSave();
            });
        });
    </script>
    <?php $__env->stopPush(); ?>

<?php endif; ?><?php /**PATH /www/wwwroot/website/sewa/zonahoki77/resources/views/frontend/partials/modals/popup-info.blade.php ENDPATH**/ ?>