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


<div class="mb-3">
  <nav class="navbar navbar-example navbar-expand-lg navbar-light bg-light">
      <div class="container-fluid" style="justify-content: start">
        <button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#create">
            <i class='bx bx-plus'></i>
            &nbsp;add data
        </button>
        </div>
    </nav>
  </div>

    <div class="row">
        <div class="col-sm-12">
                <div class="card">
                  <div class="card-body">
                    <h4 class="card-title"><?php echo e($title); ?></h4>
                    <div class="table-responsive">
                      <table class="table">
                        <thead>
                          <tr>
                            <th>label</th>
                            <th>sorter</th>
                            <th>presentase</th>
                            <th>status</th>
                            <th>Action</th>
                          </tr>
                        </thead>
                        <tbody>
                          <?php $__currentLoopData = $row; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                          <tr>
                            <td><?php echo e($key->label); ?></td>
                            <td><?php echo e($key->sorter); ?></td>
                            <td><?php echo e($key->presentase); ?></td>
                            <td><?php echo Fibonanci::status($key->status); ?></td>
                            <td>
                                <button type="button" class="btn btn-warning btn-sm" 
                                data-bs-toggle="modal" data-bs-target="#edit<?php echo e($key->id); ?>">
                                    edit
                                </button>
                                <a href="javascript:void(0)" onclick="hapus('<?php echo e(url('admin/prize/destroy/'.$key->id)); ?>')" class="btn btn-sm btn-danger">delete</a>
                            </td>
                          </tr>

                          <div class="modal fade" id="edit<?php echo e($key->id); ?>" tabindex="-1" aria-labelledby="create" aria-hidden="true">
                            <div class="modal-dialog">
                              <div class="modal-content">
                                <div class="modal-header">
                                  <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
                                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                </div>
                        
                                <form action="<?php echo e(url('admin/prize/update')); ?>" method="POST">
                                    <?php echo csrf_field(); ?>

                                    <input type="hidden" value="<?php echo e($key->id); ?>" name="id">
                        
                                <div class="modal-body">

                                    <div class="form-group">
                                        <label for="label">label</label>
                                        <input type="text" value="<?php echo e($key->label); ?>" name="label" class="form-control" id="label" placeholder="label">
                                      </div>
                        
                                      <div class="form-group">
                                        <label for="sorter">sorter</label>
                                        <input type="number" value="<?php echo e($key->sorter); ?>" name="sorter" class="form-control" id="sorter" placeholder="sorter">
                                      </div>
                        
                                      <div class="form-group">
                                        <label for="presentese">presentese</label>
                                        <input type="number" name="presentase" value="<?php echo e($key->presentase); ?>" class="form-control" id="presentese" placeholder="presentese pastikan total 100 dari semua data">
                                      </div>
                        
                                      <div class="mb-3">
                                        <label for="users" class="form-label">status</label>
                                        <select class="form-select" name="status" aria-label="Default select example">
                                          <option value="<?php echo e($key->status); ?>" selected><?php echo e($key->status); ?></option>
                                          <option value="win">win</option>
                                          <option value="lose">lose</option>
                                        </select>
                                      </div>
                                    
                                </div>

                                <div class="modal-footer">
                                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                                  <button type="submit" class="btn btn-primary">Update changes</button>
                                </div>
                        
                                </form>
                        
                        
                              </div>
                            </div>
                          </div>

                            <?php
                                $n += $key->presentase;
                            ?>
                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                        <thead>
                            <tr>
                              <th>label</th>
                              <th>sorter</th>
                              <th><?php echo e($n); ?> % </th>
                              <th>status</th>
                              <th>Action</th>
                            </tr>
                          </thead>
                      </table>
                    </div>
                  </div>
                </div>
        </div>
    </div>


    <!-- Modal -->
<div class="modal fade" id="create" tabindex="-1" aria-labelledby="create" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>

        <form action="<?php echo e(url('admin/prize/store')); ?>" method="POST">
            <?php echo csrf_field(); ?>

        <div class="modal-body">

            <div class="form-group">
                <label for="label">label</label>
                <input type="text" name="label" class="form-control" id="label" placeholder="label">
              </div>

              <div class="form-group">
                <label for="sorter">sorter</label>
                <input type="number" name="sorter" class="form-control" id="sorter" placeholder="sorter">
              </div>

              <div class="form-group">
                <label for="presentese">presentase</label>
                <input type="number" name="presentase" class="form-control" id="presentese" placeholder="presentese pastikan total 100 dari semua data">
              </div>

              <div class="mb-3">
                <label for="users" class="form-label">status</label>
                <select class="form-select" name="status" aria-label="Default select example">
                  <option value="win">win</option>
                  <option value="lose">lose</option>
                </select>
              </div>
           

        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
          <button type="submit" class="btn btn-primary">Save changes</button>
        </div>

        </form>


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

<?php $__env->startPush('js'); ?>
    <script>
      $(document).ready( function () {
        $('#tabel').DataTable({
          "pageLength": 25,
             searching: true,
             ordering:  true,
             paging: true,   
             "order": [[1, 'desc']],
             "columnDefs": [
                { "type": "date", "targets": [1] }//date column formatted like "03/23/2018 10:25:13 AM".
              ],     
        });
    });
    </script>
<?php $__env->stopPush(); ?>

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