<?php $__env->startSection('content'); ?>
<section class="section">
          <div class="section-header">
            <h1>Kelola Kode Undangan </h1>
            <div class="section-header-breadcrumb">
              <div class="breadcrumb-item active"><a href="#">Dashboard</a></div>
              <div class="breadcrumb-item"><a href="#">Developer</a></div>
              <div class="breadcrumb-item">Kode Undangan</div>
            </div>
          </div>

          <div class="section-body">
          
          	<div class="row">
          		<div class="col-md-12">
          			<div class="card">
		              <div class="card-header">
		                <h4><span>Kelola Kode Undangan</span></h4>
                  </div>
                  <div class="card-body">
                     <?php if(session('success')): ?>

                        <div class="alert alert-success" role="alert">
                            <i class="fa fa-check-circle"></i> <?php echo e(session('success')); ?>

                        </div>

                    <?php endif; ?>
  		              <div class="card-body-header text-right" style="display: flex; justify-content: flex-end;">
                      <form method="POST" class="mr-2" action="invitation_code/random">
                        <?php echo csrf_field(); ?>
                        <button class="btn btn-info" type="submit">Tambah kode acak</button>
                      </form>
  		                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
                        Tambah kode baru
                      </button>
  		              </div>
                    <div class="clearfix mb-3"></div>
                    <div class="table-responsive">
                      <table class="table table-striped table-md">
                          <tr>
                            <th>#</th>
                            <th>Kode</th>
                            <th>Sisa penggunaan</th>
                            <th>Status</th>
                            <th>Dibuat pada</th>
                          </tr>
                          <?php $__currentLoopData = $code; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                              <td><?php echo e($data->id); ?></td>
                              <td><?php echo e($data->code); ?></td>
                              <td><?php echo e($data->remains); ?></td>
                              <td>
                                <span class="badge badge-<?php echo e(($data->status == 'Redeemed') ? 'danger' : 'success'); ?>">
                                <?php echo e($data->status); ?>

                                </span>
                              </td>
                              <td><?php echo e($data->created_at); ?></td>
                              <td>
                                <form method="POST">
                                  <?php echo csrf_field(); ?>
                                  <?php echo method_field('delete'); ?>
                                  <input type="hidden" value="<?php echo e($data->id); ?>" name="id">
                                  <button type="submit" class="btn btn-danger"><i class="fa fa-trash"></i></button>
                                </form>
                              </td>
                            </tr>
                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                          <?php $__empty_1 = true; $__currentLoopData = $code; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                              <td colspan="5" class="text-center">No data</td>
                            </tr>
                          <?php endif; ?>
                      </table>
                    </div>
                  </div>
		            </div>
          		</div>
          	</div>
            
          </div>
        </section>
        <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Tambah kode undangan</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
            <form method="POSt">
              <?php echo csrf_field(); ?>
              <div class="modal-body">
                  <div class="form-group">
                    <label>Kode</label>
                    <input type="text" name="code" class="form-control">
                  </div>
                  <div class="form-group">
                    <label>Jumlah batas penggunaan</label>
                    <input type="number" name="max" class="form-control">
                  </div>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-primary">Tambah</button>
              </div>
            </form>
            </div>
          </div>
        </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\Berkc\OneDrive\Masaüstü\smm\zoopedia-master\resources\views\developer\invitation_code\index.blade.php ENDPATH**/ ?>