<?php $__env->startSection('title'); ?>
Absensi <?php echo e($kelas->tingkatan); ?> <?php echo e($kelas->jurusan); ?> <?php echo e($kelas->suffix); ?>

<?php $__env->stopSection(); ?>

<?php $__env->startPush('before-script'); ?>

<?php if(session('status')): ?>
<?php if (isset($component)) { $__componentOriginal6bb91b748cddfa526a1e6a6c5efd3ee0dde567e5 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\Sweetalertsession::class, ['tipe' => ''.e(session('tipe')).'','status' => ''.e(session('status')).'']); ?>
<?php $component->withName('sweetalertsession'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal6bb91b748cddfa526a1e6a6c5efd3ee0dde567e5)): ?>
<?php $component = $__componentOriginal6bb91b748cddfa526a1e6a6c5efd3ee0dde567e5; ?>
<?php unset($__componentOriginal6bb91b748cddfa526a1e6a6c5efd3ee0dde567e5); ?>
<?php endif; ?>
<?php endif; ?>
<?php $__env->stopPush(); ?>


<?php $__env->startSection('content'); ?>
<section class="section">
    <div class="section-header">
        <h1><?php echo $__env->yieldContent('title'); ?></h1>
        <div class="section-header-breadcrumb">
            <div class="breadcrumb-item active"><a href="<?php echo e(route('dashboard')); ?>">Dashboard</a></div>
            <div class="breadcrumb-item"><a href="<?php echo e(route('absensi')); ?>">Absensi</a></div>
            <div class="breadcrumb-item"><?php echo $__env->yieldContent('title'); ?></div>
        </div>
    </div>

    <div class="section-body">
        <div class="card">
            <div class="card-body" >

                <div id="babeng-bar" class="text-center mt-2">

                    <div id="babeng-row ">

                        <form action="<?php echo e(route('siswa.cari')); ?>" method="GET">
                            <input type="text" class="babeng babeng-select  ml-0" name="cari" autocomplete="off">

                            <span>
                                <input class="btn btn-info ml-1 mt-2 mt-sm-0" type="submit" id="babeng-submit"
                                    value="Cari">
                            </span>

                         </form>

                    </div>
                </div>
                <div class="row" id="babengcardDate" >

                    <?php if (isset($component)) { $__componentOriginal7f6fe7bbf5512b742c0bcffa8025ccbaf91ac921 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\Jsmultidel::class, ['link' => ''.e(route('siswa.multidel')).'']); ?>
<?php $component->withName('jsmultidel'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7f6fe7bbf5512b742c0bcffa8025ccbaf91ac921)): ?>
<?php $component = $__componentOriginal7f6fe7bbf5512b742c0bcffa8025ccbaf91ac921; ?>
<?php unset($__componentOriginal7f6fe7bbf5512b742c0bcffa8025ccbaf91ac921); ?>
<?php endif; ?>

                <?php if($datas->count()>0): ?>
                    
                    <script>
                        $(document).ready(function() {
                            $('#example').DataTable({
                                paging: false,
                                info: false,
                                searching: false,
                                columnDefs: [
                                    { orderable: false, targets: [
                                    <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php echo e($loop->index+2); ?>,
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    ]
                                 }
                                ]
                            });
                        } );
                    </script>

                <?php endif; ?>

                <table id="example" class="table table-striped table-bordered mt-1 table-sm" style="width:100%" >
                    <thead>
                        <tr style="background-color: #F1F1F1">
                            <th width="8%" class="text-center py-2">
                                No</th>
                            <th >Nama</th>
                            <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php
                            $i=$loop->index;
                            $tgl=$dates[$i]->format('d');
                            $tgl2=$dates[$i]->format('Y-m-d');
                            $isWeekend=Fungsi::isWeekend($tgl2);
                            if($isWeekend!==false){
                                $warna='danger';
                            }else{
                                $warna='dark';
                            }
                        ?>

                                    <th class="text-center text-<?php echo e($warna); ?> px-2" >
                                       <?php echo e($tgl); ?>

                                    </th>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $datas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr id="sid<?php echo e($data->id); ?>">
                                <td class="text-center">
                                    <?php echo e(((($loop->index)+1)+(($datas->currentPage()-1)*$datas->perPage()))); ?></td>
                                <td>
                                    <?php echo e(Str::limit($data->nama,25,' ...')); ?>

                                </td>

                    <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php
                                $i=$loop->index;
                                  $tgl=$dates[$i]->format('Y-m-d');

                                  $tgl2=$dates[$i]->format('d');
                                  $isWeekend=Fungsi::isWeekend($tgl);
                                //   dd(Fungsi::isWeekend($tgl));
                                  $ket='-';
                                  $ambildata=DB::table('absensi')->where('siswa_id',$data->id)->where('tgl',$tgl)->first();
                                  if($ambildata!=null){
                                      $ket=$ambildata->ket;
                                  }

                            if($isWeekend!==false){
                                $warna='danger';
                                $style="background-color: rgba(210, 77, 87, 0.8)";
                                $target='#';
                            }else{
                                $warna='dark';
                                $target='modal';
                                $style='';
                            }
                            ?>
                            <td class="text-center text-<?php echo e($warna); ?>" data-toggle="<?php echo e($target); ?>" data-target="#modal<?php echo e($data->id); ?>-<?php echo e($tgl); ?>" style="<?php echo e($style); ?>">
                               <?php if($isWeekend==false): ?>
                                    <?php echo e(Str::limit($ket,1,'')); ?>

                                    <?php else: ?>

                               <?php endif; ?>
                            </td>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="5" class="text-center">Data tidak ditemukan</td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>

            </div>
            <div class="d-flex justify-content-between mt-3">
                <div>
                    <?php
                    $cari=$request->cari;
                    ?>
                    <?php echo e($datas->onEachSide(1)
                      ->links()); ?>

                </div>

              <div>
                <p>N.B : <i>Warna merah hari sabtu dan minggu</i>.</p>
              </div>
                                </div>

            </div>



        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('containermodal'); ?>
              
              <?php $__currentLoopData = $datas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                              <?php
                                  $i=$loop->index;
                                  $tgl=$dates[$i]->format('Y-m-d');
                                  $tgl2=$dates[$i]->format('d');
                              ?>

              <div class="modal fade" id="modal<?php echo e($data->id); ?>-<?php echo e($tgl); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                  <form method="post" action="<?php echo e(route('guru.absensi.store',$kelas->id)); ?>" enctype="multipart/form-data">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel"> <?php echo e($data->nama); ?> - <?php echo e(Fungsi::tanggalindo($tgl)); ?></h5>
                      </div>
                      <div class="modal-body">
                        <?php echo e(csrf_field()); ?>

                        <div class="form-group col-md-12 col-12 mt-0">
                            <label for="nama">Pilih Absensi </label>
                        <input type="hidden" name="siswa_id" value="<?php echo e($data->id); ?>">
                        <input type="hidden" name="tgl" value="<?php echo e($tgl); ?>">
                        <select class="form-control form-control-sm" name="ket">
                            <option selected>-</option>
                            <option>Ijin</option>
                            <option>Sakit</option>
                            <option>Tanpa Keterangan</option>


                        </select>
                        </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">Simpan</button>
                      </div>
                    </div>
                  </form>
                </div>
              </div>



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

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

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.default', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Xampp 8.2\htdocs\sim\resources\views/pages/guru/absensi/detail.blade.php ENDPATH**/ ?>