
<?php $__env->startSection('content'); ?>
    
 <!-- SOUND TRACK -->
 <?php if($spin=="false"): ?>

  <embed src="<?php echo e(Fibonanci::content()['music']); ?>" loop="true" autostart="true" width="2" height="0" hidden>
    <audio controls autoplay hidden id="my_audio" loop="loop">
        <source src="<?php echo e(Fibonanci::content()['music']); ?>" type="audio/mpeg">
        Your browser does not support the audio element.
    </audio>

  <?php endif; ?>
        	
    <div id="popup-container-history" class="popup-container" style="display: none;">
      <div id="popup-body" class="popup-body" style="height: 563px;">
          <div class="popup-close" onclick="close_popup_history()"><center><b>x</b></center></div>
          <div id="popup-header" class="popup-header">
              <center><h6 id="title-popup-win" style="padding: 10px;"><b>RIWAYAT SPIN</b></h6></center>
          </div>
          
          <div style="overflow-y: scroll;height: 91.5%;width: 100%;">
              <div style="padding: 5px;">
                <table style="width: 100%;">
                  <thead>
                    <tr>
                      <th align="center" valign="center" style="width: 10%; text-align: center;">NO</th>
                      <th align="center" valign="center" style="width: 50%;">NAME</th>
                      <th align="center" valign="center" style="width: 40%; text-align: center;">PRIZE</th>
                    </tr>
                  </thead>
                  <tbody id="history-container">
                  <?php
                      $n = 1;
                  ?>
                  <?php $__currentLoopData = $history; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $his): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        if($his['member']){
                            $name = $his['member'];
                        }else{
                          $name = Fibonanci::randomName();
                        }
                    ?>
                    <tr>
                      <td style="width: 10%; padding: 5px; text-align: center;"><?php echo e($n++); ?></td>
                      <td style="width: 50%; padding: 5px;"><?php echo e(Fibonanci::replace_last_character($name)); ?></td>
                      <td style="width: 40%; padding: 5px; text-align: center;"><?php echo e($his['prize']); ?></td>
                    </tr>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </tbody>
                </table>
              </div>
          </div>
      </div>
    </div>

      <div class="container mt-20">
        <div class="row">
            <div class="col-sm-12">
          <?php if(session()->has('message')): ?>
  
                <?php $__env->startPush('js'); ?>
                <script>
                  Swal.fire({
                    position: 'center',
                    icon: 'error',
                    title: "<?php echo e(session('message')); ?>",
                    showConfirmButton: false,
                    timer: 3000
                  })
                </script>
            <?php $__env->stopPush(); ?>
  
          <?php else: ?>
  
              <?php if($spin=="false"): ?>
  
                    <?php $__env->startPush('js'); ?>
                        <script>
                              let music_home = document.getElementById("my_audio"); 
                              document.addEventListener("DOMContentLoaded", function(){
                                $(".swal2-modal").css('background-color', '#000');
                                Swal.fire({
                                      title: '<?php echo e(str_replace(array("\r", "\n"), '', Nfs::content("welcome")["title"])); ?>',
                                      html: '<p><?php echo e(str_replace(array("\r", "\n"), '', Nfs::content("welcome")["description"])); ?></p>',
                                      confirmButtonText:
                                      '<i class="fa fa-like"></i>Thank You',
                                      confirmButtonColor: 'goldenrod',
                                    }).then((result) => {
                                /* Read more about isConfirmed, isDenied below */
                                if (result.isConfirmed) {
                                    music_home.play(); 
                                  }})
                              });
                        </script>                  
                    <?php $__env->stopPush(); ?>
  
                <?php endif; ?>
  
          <?php endif; ?>
            </div>
        </div>
      </div>

      
  <?php if($spin=="false"): ?>
      <p class="h4 mb-4 font-weight-normal" id="headerTitle">Masukkan Kode Tiket:</p>
      <form class="form-signin" method="POST" action="<?php echo e(url('spin')); ?>">
        <?php echo csrf_field(); ?>

        <div class="form-group row">
          <div class="col-sm-12">
            <input type="text" name="name" placeholder="username" class="form-control form-control-lg" id="id_name" required>
          </div>
        </div>

        <div class="form-group row">
          <div class="col-sm-12">
            <input type="text" name="voucher" placeholder="code / voucher" class="form-control form-control-lg" id="id_voucher" required>
          </div>
        </div>

        <div class="row">
          <div class="col-md-6" style="margin-top: 20px;">
              <button type="submit" class="submit">
                <b>SPIN</b>
              </button>
          </div>
          <div class="col-md-6" style="margin-top: 20px;">
            <input type="button" value="RIWAYAT" class="submit" onclick="getHistory()" return false;></input>
          </div>
        </div>
      </form>

      <div class="row">

          <div class="col-md-12" style="margin-top: 20px;">
                <input type="button" value="Syarat & Ketentuan" class="submit" onclick="syarat()"return false;></input>
          </div>

          <div class="col-md-12" style="margin-top: 20px;">
            <input type="button" value="Whatsapp Admin" class="btn-back" 
            onClick="location.href='<?php echo e(Nfs::content('whatsapp')); ?>'"></input>
         </div>

          <div class="col-md-12" style="margin-top: 20px;">
            <input type="button" value="KEMBALI KE SITUS" class="btn-back" 
            onClick="location.href='<?php echo e(Nfs::content('link_home')); ?>'"></input>
         </div>

      </div>
  <?php endif; ?>

<?php $__env->startPush('js'); ?>
  <script type="text/javascript">
    function getCurrentURL () {
      return window.location.href
    }
    const url = getCurrentURL();
    const sp = url.split('/')[3];
    if (sp != 'draw') {
      introRotation(3600);
    }
  </script>
  <script type="text/javascript">
    $('button[type="submit"]').click(function() {
      document.getElementById('id_name').required = true;
      document.getElementById('id_voucher').required = true;
    });
    function getHistory(){
        document.getElementById('id_name').required = false;
        document.getElementById('id_voucher').required = false;
        $("#popup-container-history").fadeIn(1000);
    }
    
    function syarat(){
      Swal.fire({
        html:
          '<div style="border:solid black 1px">'+
          '<strong><?php echo e(Fibonanci::content()["name"]); ?></strong> <br>'+
          '<p style="text-align: center;font-size: 14px">Syarat dan ketentuan</p>' +
          '<ol>'+
            <?php $__currentLoopData = $faq->toArray(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $f): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              '<li style="text-align: left;font-size: 12px;margin-top: 0px;"><?php echo e($f["content"]); ?></li>'+
           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
		  '</ol>'+
          '</div>'+
          '<table class="table table-bordered" style="margin-top:10px">'+
          '<tr><th style="text-align: center;font-size: 16px">Hadiah lucky <?php echo e(Fibonanci::content()["name"]); ?></th></tr>'+
          <?php $__currentLoopData = $prize; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            '<tr><td style="text-align: center;font-size: 12px"><?php echo e($key->label); ?></td></tr>'+
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          '</table>',
          showCloseButton: true,
          confirmButtonText:
          '<i class="fa fa-thumbs-up"></i> saya setuju!',
          confirmButtonColor: '#be4d25',
      })
    }
  </script>
  <script type="text/javascript">
    function close_popup_history() {
      $("#popup-container-history").fadeOut(500);
      document.getElementById('id_name').required = true;
      document.getElementById('id_voucher').required = true;
		}
  </script>
  <?php if($spin == "true"): ?>
    <script type="text/javascript">
        spin("<?php echo e(url('result/'.$draw_id.'/'.$result)); ?>", <?php echo e($rotation); ?>);
    </script>
  <?php else: ?>
    <script type="text/javascript">
         introRotation("<?php echo e(Fibonanci::rumus_rotasi_start()); ?>")
    </script>

  <?php endif; ?>

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

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

<?php echo $__env->make('web.base', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\SPIN\SPIN-WHEEL-LARAVEL9\resources\views/web/index.blade.php ENDPATH**/ ?>