
<?php $__env->startSection('content'); ?>
<main id="main" class="main">

    <div class="pagetitle">
      <h1>Peserta</h1>
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a>Dashboard</a></li>
          <li class="breadcrumb-item"><a>Master Data</a></li>
          <li class="breadcrumb-item active">Peserta</li>
        </ol>
      </nav>
    </div><!-- End Page Title -->

    <section class="section dashboard">
      <?php if(Session::get('msg')): ?>
      <div class="alert alert-success alert-dismissible fade show" role="alert">
          <i class="bi bi-check-circle me-1"></i>
                <?php echo e(Session::get('msg')); ?>

          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
      </div>
      <?php endif; ?>


      <div class="row">
        <div class="col-lg-12">
          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Data Peserta</h5>
              <Button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addModal">
                <i class="bi bi-plus"></i>
                  Tambah Data  
              </Button>
              <br>
              <br>
              <!-- Default Table -->
              <table class="table" id="table">
                <thead>
                  <tr>
                    <th scope="col">#</th>
                    <th scope="col">Foto Profil</th>
                    <th scope="col">Nama</th>
                    <th scope="col">TTL</th>
                    <th scope="col">Usia</th>
                    <!-- <th scope="col">Ortu</th> -->
                    <th scope="col">Action</th>
                  </tr>
                </thead>
                <tbody>
                  <?php 
                    $i = 1;
                  ?>
                  <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $datas): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <tr>
                    <th scope="row"><?php echo e($i++); ?></th>
                    <td><img src="/<?php echo e($datas->image); ?>" alt="" title="" style="width:50px" /></td>
                    <td><?php echo e($datas->name); ?></td>
                    <td><?php echo e($datas->birthplace); ?>,<?php echo e($datas->birthdate); ?></td>

                   <!--  <?php if($datas->child == 0): ?>
                    <td><span class="badge bg-success">Dewasa</span> <?php echo e($datas->usia); ?> th</td>
                    <?php endif; ?>
                    <?php if($datas->child == 1): ?>
                    <td><span class="badge bg-warning">Anak</span> <?php echo e($datas->usia); ?> th</td>
                    <?php endif; ?> -->

                    <td><?php echo e($datas->usia); ?> th</td>
                    <!-- <?php if($datas->Parent): ?>
                      <td scope="col"><?php echo e($datas->Parent->name); ?></td>  
                    <?php endif; ?>
                    <?php if(!$datas->Parent): ?>
                      <td scope="col"></td>  
                    <?php endif; ?> -->
                    
                    <td>
                      <a href="" class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#editPackageModal<?php echo e($datas->id); ?>" >
                        <i class="bi bi-card-list" data-bs-toggle="tooltip" data-bs-placement="top" title="Detail Paket Latihan"></i>
                      </a>
                      <a href="" class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#editModal<?php echo e($datas->id); ?>" >
                        <i class="bi bi-pencil-square" data-bs-toggle="tooltip" data-bs-placement="top" title="Detail Data Peserta"></i>
                      </a>
                      <?php if($datas->child == 0): ?>
                      <a href="/dashboard/student/reset/<?php echo e($datas->id); ?>" class="btn btn-danger btn-sm" 
                        onclick="return confirm('Anda yakin ingin reset password akun?')" 
                        data-bs-toggle="tooltip" data-bs-placement="top" title="Reset Password">
                        <i class="bi bi-key"></i>
                      </a>
                      <?php endif; ?>
                      <a href="/dashboard/student/delete/<?php echo e($datas->id); ?>" class="btn btn-danger btn-sm" 
                        onclick="return confirm('Anda yakin ingin menghapus data?')" 
                        data-bs-toggle="tooltip" data-bs-placement="top" title="Hapus">
                        <i class="bi bi-trash"></i>
                      </a>
                    </td>
                  </tr>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>  
                </tbody>
              </table>
              <!-- End Default Table Example -->
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- Modal -->
    <div class="modal fade" id="addModal" tabindex="-1">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Tambah Data</h5>

              <!-- Floating Labels Form -->
              <form class="row g-3" method="POST" action="/dashboard/student/add" enctype="multipart/form-data">
              <?php echo csrf_field(); ?>

<!--                 <div class="col-md-12">
                  <select name="parent_id" style="width: 100%">
                    <option value="">-- Pilih Orang Tua --</option>
                    <?php $__currentLoopData = $parent; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $parents): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($parents->id); ?>"><?php echo e($parents->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                  <p style="color: orange; font-size: 10px">Kosongi jika peserta dewasa</p>
                </div> -->
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingName" placeholder="Nama Siswa" name="name">
                    <label for="floatingName">Nama Peserta</label>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingEmail" placeholder="Your Email" name="email">
                    <label for="floatingEmail">Username</label>
                    <!-- <p style="color: orange; font-size: 10px">Kosongi USERNAME jika peserta anak - anak</p> -->
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="birthplace">
                    <label for="floatingPassword">Tempat</label>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-floating">
                    <input type="date" class="form-control" id="floatingPassword" placeholder="Tanggal Lahir" name="birthdate">
                    <label for="floatingPassword">Tanggal Lahir</label>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="usia">
                    <label for="floatingPassword">Usia</label>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="address">
                    <label for="floatingPassword">Alamat</label>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-floating">
                    <center><h5>Paket Latihan</h5></center>
                  </div>
                </div>
                <div class="col-md-6">
                  <select class="js-ortu-select2" name="training_type_id" style="width: 100%">
                    <option value="">-- Tipe Latihan --</option>
                    <?php $__currentLoopData = $training_type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tra): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($tra->id); ?>"><?php echo e($tra->training_type); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                </div>
                <div class="col-md-6">
                  <select class="js-ortu-select2" name="kategori_usia_id" style="width: 100%">
                    <option value="">-- Kategori Usia --</option>
                    <?php $__currentLoopData = $kategori_usia; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $kat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($kat->id); ?>"><?php echo e($kat->usia); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                </div>
                <div class="col-md-6">
                  <select class="js-ortu-select2" name="group_type" style="width: 100%">
                    <option value="">-- Kategori Latihan --</option>
                    <option value="0">Tunggal</option>
                    <option value="1">Grup</option>
                  </select>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="session">
                    <label for="floatingPassword">Jumlah Pertemuan</label>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="price">
                    <label for="floatingPassword">Harga</label>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="register_fee">
                    <label for="floatingPassword">Biaya Pendaftaran</label>
                  </div>
                </div>
                <div>
                  <button type="submit" class="btn btn-primary" >Save</button>
                  <button type="reset" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                </div>
              </form><!-- End floating Labels Form -->

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

    <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $datas): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <div class="modal fade" id="editModal<?php echo e($datas->id); ?>" tabindex="-1">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Edit Data</h5>

              <!-- Floating Labels Form -->
              <form class="row g-3" method="POST" action="/dashboard/student/update" enctype="multipart/form-data">
              <?php echo csrf_field(); ?>

              <input type="hidden" name="id" value="<?php echo e($datas->id); ?>">
               <!--  <div class="col-md-12">
                  <select class="js-ortu-select2" id="ortu" name="parent_id" style="width: 100%" >
                    <option value="">-- Pilih Orang Tua --</option>
                    <?php $__currentLoopData = $parent; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $parents): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                      <?php if($datas->parent_id == $parents->id): ?>
                        <option value="<?php echo e($parents->id); ?>" selected=""><?php echo e($parents->name); ?></option>
                      <?php endif; ?>
                      <?php if($datas->parent_id != $parents->id): ?>
                        <option value="<?php echo e($parents->id); ?>"><?php echo e($parents->name); ?></option>
                      <?php endif; ?>

                    
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                  <p style="color: orange; font-size: 10px">Kosongi jika peserta dewasa</p>
                </div> -->
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingName" placeholder="Nama Siswa" name="name" value="<?php echo e($datas->name); ?>">
                    <label for="floatingName">Nama Peserta</label>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingEmail" placeholder="Your Email" name="email" value="<?php echo e($datas->email); ?>">
                    <label for="floatingEmail">Username</label>
                    <!-- <p style="color: orange; font-size: 10px">Kosongi USERNAME jika peserta anak - anak</p> -->
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="birthplace" value="<?php echo e($datas->birthplace); ?>">
                    <label for="floatingPassword">Tempat</label>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-floating">
                    <input type="date" class="form-control" id="floatingPassword" placeholder="Tanggal Lahir" name="birthdate" value="<?php echo e($datas->birthdate); ?>">
                    <label for="floatingPassword">Tanggal Lahir</label>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="usia" value="<?php echo e($datas->usia); ?>">
                    <label for="floatingPassword">Usia</label>
                  </div>
                </div>
                <div class="col-md-12">
                  <div class="form-floating">
                    <input type="text" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="address" value="<?php echo e($datas->address); ?>">
                    <label for="floatingPassword">Alamat</label>
                  </div>
                </div>
                <div>
                  <button type="submit" class="btn btn-primary" >Update</button>
                  <button type="reset" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                </div>
              </form><!-- End floating Labels Form -->

            </div>
          </div>
        </div>
      </div>
    </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

     <?php $__currentLoopData = $training_package; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <div class="modal fade" id="editPackageModal<?php echo e($tr->student_id); ?>" tabindex="-1">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Detail Paket Latihan</h5>

              <!-- Floating Labels Form -->
              <form class="row g-3" method="POST" action="/dashboard/student/updatePackage" enctype="multipart/form-data">
              <?php echo csrf_field(); ?>

              <input type="hidden" name="id" value="<?php echo e($tr->id); ?>">
                <div class="col-md-6">
                  <select class="js-ortu-select2" name="training_type_id" style="width: 100%">
                    <option value="">-- Tipe Latihan --</option>
                    <?php $__currentLoopData = $training_type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tra): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if($tr->training_type_id == $tra->id): ?>
                    <option value="<?php echo e($tra->id); ?>" selected><?php echo e($tra->training_type); ?></option>
                    <?php endif; ?>
                    <?php if($tr->training_type_id != $tra->id): ?>
                    <option value="<?php echo e($tra->id); ?>"><?php echo e($tra->training_type); ?></option>
                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                </div>
                <div class="col-md-6">
                  <select class="js-ortu-select2" name="kategori_usia_id" style="width: 100%">
                    <option value="">-- Kategori Usia --</option>
                    <?php $__currentLoopData = $kategori_usia; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $kat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if($tr->kategori_usia_id == $kat->id): ?>
                    <option value="<?php echo e($kat->id); ?>" selected=""><?php echo e($kat->usia); ?></option>
                    <?php endif; ?>
                    <?php if($tr->kategori_usia_id != $kat->id): ?>
                    <option value="<?php echo e($kat->id); ?>" ><?php echo e($kat->usia); ?></option>
                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                </div>
                <div class="col-md-6">
                  <select class="js-ortu-select2" name="group_type" style="width: 100%">
                    <option value="">-- Kategori Latihan --</option>
                    <?php if($tr->group_type == 0): ?>
                    <option value="0" selected="">Tunggal</option>
                    <option value="1">Grup</option>
                    <?php endif; ?>
                    <?php if($tr->group_type == 1): ?>
                    <option value="0">Tunggal</option>
                    <option value="1" selected="">Grup</option>
                    <?php endif; ?>
                  </select>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="session" value="<?php echo e($tr->session); ?>">
                    <label for="floatingPassword">Jumlah Pertemuan</label>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="price" value="<?php echo e($tr->price); ?>">
                    <label for="floatingPassword">Harga</label>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-floating">
                    <input type="number" class="form-control" id="floatingPassword" placeholder="Tempat Lahir" name="register_fee" value="<?php echo e($tr->register_fee); ?>">
                    <label for="floatingPassword">Biaya Pendaftaran</label>
                  </div>
                </div>
                <div>
                  <button type="submit" class="btn btn-primary" >Update</button>
                  <button type="reset" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                </div>
              </form><!-- End floating Labels Form -->

            </div>
          </div>
        </div>
      </div>
    </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>




  </main><!-- End #main -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('dashboard.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/tpsa4296/public_html/tpscmalang/resources/views/dashboard/student.blade.php ENDPATH**/ ?>