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

    <div class="pagetitle">
      <h1>Progress Peserta</h1>
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a>Dashboard</a></li>
          <li class="breadcrumb-item"><a>Presensi</a></li>
          <li class="breadcrumb-item active">Progress 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" style="overflow-x: auto">
              <h5 class="card-title">Data Progress Peserta</h5>
              
              <form method="GET" action="<?php echo e(url('dashboard/progress')); ?>" class="row g-3 mt-1 mb-1">
                <?php echo csrf_field(); ?>
                <div class="col-auto">
                  <select name="year" id="year" class="form-select" required>
                    <?php
                      $currentYear = $year ?? now()->format('Y');
                      $startYear = 2020; // Change as per your requirement
                      $endYear = $currentYear + 5; // Future years range
                    ?>
                    <?php for($year = $startYear; $year <= $endYear; $year++): ?>
                      <option value="<?php echo e($year); ?>" <?php echo e($currentYear == $year ? 'selected' : ''); ?>><?php echo e($year); ?></option>
                    <?php endfor; ?>
                  </select>
                </div>
                <div class="col-auto">
                  <button type="submit" class="btn btn-primary">Filter</button>
                </div>
              </form>
              
              
              <!-- Default Table -->
              <table class="table table-responsive mt-1" id="table" >
                <thead>
                  <tr>
                    <th scope="col">#</th>
                    <th scope="col">Foto</th>
                    <th scope="col">Siswa</th>
                    <th scope="col">Usia</th>
                    <th scope="col">Paket Latihan</th>
                    <th scope="col">Jml Pertemuan</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->usia); ?> th
                    <?php if($datas->TrainingPackage->kategori_usia_id == 1): ?>
                    <span class="badge bg-warning">Anak</span>
                    <?php endif; ?>
                    <?php if($datas->TrainingPackage->kategori_usia_id == 2): ?>
                    <span class="badge bg-success">Dewasa</span>
                    <?php endif; ?>
                    <?php if($datas->TrainingPackage->kategori_usia_id == 3): ?>
                    <span class="badge bg-primary">Bebas</span>
                    <?php endif; ?>
                    </td>
                    <td><?php echo e($datas->TrainingPackage->TrainingType->training_type); ?></td>
                    <td><?php echo e($datas->TrainingPackage->session); ?> x</td>
                    <td>
                      <a href="" class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#detailModal<?php echo e($datas->id); ?>" >
                        <i class="bi bi-card-list" data-bs-toggle="tooltip" data-bs-placement="top" title="Detail Progress Peserta"></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>


   <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $datas): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="modal fade" id="detailModal<?php echo e($datas->id); ?>" tabindex="-1">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="card">
        <div class="card-body" style="overflow-x: auto;">
          <h5 class="card-title">Detail Progress <?php echo e($datas->name); ?></h5>

          <table class="table" id="table2" >
            <thead>
              <tr>
                <th scope="col">Pertemuan</th>
                <th scope="col">Waktu Latihan</th>
                <th scope="col">Venue</th>
                <th scope="col">Trainer</th>
                <th scope="col">Penilaian</th>
                <th scope="col">Action</th>
              </tr>
            </thead>
            <tbody>
              <?php 
                $i = 1;
              ?>
              <?php $__currentLoopData = $datas->progress; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $progress): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <tr>
                <!--<td scope="row"><?php echo e($progress->session_number); ?></td>-->
                <td scope="row"><?php echo e($i++); ?></td>
                <?php if($progress->absensi): ?>
                  <td><?php echo e($progress->absensi->date); ?> <?php echo e($progress->absensi->time); ?></td>
                  <td><?php echo e($progress->absensi->Venue ? $progress->absensi->Venue->name : ''); ?></td>
                <?php else: ?>
                  <td colspan="2">Absensi data not available</td>
                <?php endif; ?>
                <td><?php echo e($progress->Trainer->name ?? 'Trainer data not available'); ?></td>
                <td><?php echo e($progress->trainer_notes ?? 'No notes'); ?></td>
                <td><a href="/dashboard/progress/delete/<?php echo e($progress->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>
        
        </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/tpsm5646/public_html/tpscmalang.com/tpscmalang/resources/views/dashboard/progress.blade.php ENDPATH**/ ?>