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

  <embed src="<?php echo e(Helper::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(Helper::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(); ?>
                <tr>
                  <td style="width: 10%; padding: 5px; text-align: center;"><?php echo e($n++); ?></td>
                  <td style="width: 50%; padding: 5px;"><?php echo e(Helper::replace_last_character($his['nama'])); ?></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($errors->any()): ?>
                  <div class="alert alert-danger">
                      <ul>
                          <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                              <li><?php echo e($error); ?></li>
                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                      </ul>
                  </div>
                <?php endif; ?>

              <?php if(session()->has('message')): ?>

                <div class="alert alert-<?php echo e(session('message_type')); ?> alert-dismissible fade show" role="alert">
                    <strong><?php echo e(session('message')); ?></strong>
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                      <span aria-hidden="true">&times;</span>
                    </button>
                </div>

              <?php endif; ?>
            </div>
        </div>
      </div>

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

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

        <div class="form-group row">
          <div class="col-sm-12">
            <input type="text" name="code" placeholder="Code / Voucher" class="form-control form-control-lg" id="id_code" 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="KEMBALI KE SITUS" class="btn-back" 
            onClick="location.href='https://langkah4d.net/'"></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_nama').required = true;
      document.getElementById('id_code').required = true;
    });
    function getHistory(){
        document.getElementById('id_nama').required = false;
        document.getElementById('id_code').required = false;
        $("#popup-container-history").fadeIn(1000);
    }
    
    function syarat(){
      Swal.fire({
        html:
          '<div style="border:solid black 1px">'+
          '<strong><?php echo e(Helper::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(Helper::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_nama').required = true;
      document.getElementById('id_code').required = true;
		}
  </script>
  <?php if($spin == "true"): ?>
    <script type="text/javascript">
        console.log("Spin the Wheel!", <?php echo e($result); ?>);
        spin("<?php echo e(url('draw_result/'.$id_draw.'/'.$result)); ?>", <?php echo e($rotation); ?>);
    </script>
  <?php else: ?>
    <script type="text/javascript">
         introRotation("<?php echo e(Helper::rumus_rotasi_start()); ?>")
    </script>

  <?php endif; ?>

  <?php if($spin=="false"): ?>
  <script type="text/javascript">
    let music_home = document.getElementById("my_audio"); 
    document.addEventListener("DOMContentLoaded", function(){
       $(".swal2-modal").css('background-color', '#000');
       Swal.fire({
            title: 'Selamat Datang di Lucky Spin Wheels!!!',
            html: '<p>Kami selaku pihak Lucky Spin Wheels terlebih dahulu mengucapkan selamat kepada setiap member yang</p>'+
                  '<p>memiliki tiket untuk berkesempatan memenangkan hadiah menarik yang ditawarkan di Lucky Spin Wheels</p>'+
                  '<p>Lucky Spin ini, Untuk kalian yang memiliki tiket silahkan masukkan ke kolom kode yang disediakan dan klik</p>'+
                  '<p>tombol spin untuk memulai peruntungan anda.!!!</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 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\wheel\resources\views/web/index.blade.php ENDPATH**/ ?>