<?php $__env->startSection('title'); ?>
Input Nilai <?php echo e($dataajar->mapel->nama); ?> - <?php echo e($dataajar->kelas->tingkatan); ?> <?php echo e($dataajar->kelas->jurusan); ?> <?php echo e($dataajar->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('penilaian')); ?>">Penilaian</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 class="d-flex bd-highlight mb-0 align-items-center">

                    <div class="ml-auto p-2 bd-highlight">
                        
                          

                    </div>


                </div>

                <?php if (isset($component)) { $__componentOriginal7f6fe7bbf5512b742c0bcffa8025ccbaf91ac921 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\Jsmultidel::class, ['link' => ''.e(route('mapel.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): ?>
                    <?php if (isset($component)) { $__componentOriginalbea8fd2875612672ec60fa7e39941fa4202cfa75 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\Jsdatatable::class, []); ?>
<?php $component->withName('jsdatatable'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalbea8fd2875612672ec60fa7e39941fa4202cfa75)): ?>
<?php $component = $__componentOriginalbea8fd2875612672ec60fa7e39941fa4202cfa75; ?>
<?php unset($__componentOriginalbea8fd2875612672ec60fa7e39941fa4202cfa75); ?>
<?php endif; ?>
                <?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" rowspan="2"  style="vertical-align: middle;"> No</th>
                            <th rowspan="2"  style="vertical-align: middle;">Nama</th>
                            <?php $__empty_1 = true; $__currentLoopData = $datakd; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dk): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <?php
                                    if($dk->tipe==1){
                                        $preffix='3.';
                                    }else{
                                        $preffix='4.';
                                    }
                                ?>
                            <th colspan="<?php echo e($dk->materipokok!=null?$dk->materipokok->count()+1:1); ?>"  class="text-center">KD <?php echo e($dk->kode!=null? $preffix.$dk->kode : ' - '); ?></th>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <th>-</th>
                            <?php endif; ?>
                        </tr>
                        <tr style="background-color: #F1F1F1">
                            <?php $__empty_1 = true; $__currentLoopData = $datakd; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dk): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <?php
                                    if($dk->tipe==1){
                                        $preffix='3.';
                                    }else{
                                        $preffix='4.';
                                    }
                                ?>
                               <?php $__empty_2 = true; $__currentLoopData = $dk->materipokok; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_2 = false; ?>
                               
                                    <td class="text-center"><?php echo e($dm->nama!=null? $preffix.$dk->kode.".".$loop->index+1 : ' - '); ?></td>
                                    <?php if($loop->index+1==$dk->materipokok->count()): ?>
                                    <td  class="text-center text-warning"><b>Avg <?php echo e($preffix.$dk->kode); ?></b></td>
                                    <?php endif; ?>

                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_2): ?>
                                    <td class="text-center"> - </td>
                                <?php endif; ?>

                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <td> - </td>
                            <?php endif; ?>
                        </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($data->nama!=null ? $data->nomerinduk.' - '.$data->nama : 'Data tidak ditemukan'); ?>

                                </td>
                                <?php $__empty_2 = true; $__currentLoopData = $datakd; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dk): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_2 = false; ?>
                                    <?php
                                    // dd($mapel->kkm);
                                    $jmlnilai=0;
                                    $jml=0;
                                    $avg=0;
                                    // dd($dk->materipokok->avg('nilai'));
                                    // $avg=$dk->materipokok->avg('nilai');
                                        if($dk->tipe==1){
                                            $preffix='3.';
                                        }else{
                                            $preffix='4.';
                                        }
                                    ?>
                                       <?php $__empty_3 = true; $__currentLoopData = $dk->materipokok; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_3 = false; ?>
                                       <?php
                                            $datasnilai=DB::table('inputnilai')->whereNull('deleted_at')->where('siswa_id',$data->id)->where('materipokok_id',$dm->id)->first();
                                            // dd($datasnilai->nilai);
                                            if($datasnilai!=null){
                                                $jml+=1;
                                                $jmlnilai+=$datasnilai->nilai;
                                                $avg=number_format(($jmlnilai/$jml),2);
                                            }
                                        ?>

                                            <td class="text-center" id="td_<?php echo e($data->id); ?>_<?php echo e($dm->id); ?>">
                                                <?php
                                                    if($datasnilai!=null){
                                                            if($datasnilai->nilai >= $mapel->kkm){
                                                                $warna='success';
                                                                $hasil=$datasnilai->nilai;
                                                                $icon='<i class="far fa-check-circle"></i>';
                                                            }else{
                                                                $warna='danger';
                                                                $hasil=$datasnilai->nilai;
                                                                $icon='<i class="far fa-times-circle"></i>';
                                                            }
                                                    }else{
                                                        $hasil='Belum diisi ';
                                                        $warna='dark';
                                                        $icon='';

                                                    }
                                                ?>
                                                <div class="text-<?php echo e($warna); ?>">
                                                        <?php echo e($hasil); ?> <?php echo $icon; ?>

                                                </div>
                                                
                                            </td>
                                            <?php if($loop->index+1==$dk->materipokok->count()): ?>
                                            <td class="text-center">
                                                
                                            
                                            <?php
                                                    if($avg >= $mapel->kkm){
                                                        $warna='success';
                                                        $icon='<i class="far fa-check-circle"></i> Tuntas';
                                                    }else{
                                                        $warna='danger';
                                                        $icon='<i class="far fa-times-circle"></i> Belum Tuntas';
                                                    }

                                        ?>
                                        <div class="text-<?php echo e($warna); ?>">
                                                <?php echo e($avg); ?> <?php echo $icon; ?>

                                        </div>
                                            
                                            </td>
                                            <?php endif; ?>

                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_3): ?>
                                            <td class="text-center"> - </td>
                                        <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_2): ?>
                                        <td> - </td>
                                <?php endif; ?>
                            </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>

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

    </div>
    <div>

    </div>

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


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

<?php $__empty_1 = true; $__currentLoopData = $datakd; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dk): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<?php
    if($dk->tipe==1){
        $preffix='3.';
    }else{
        $preffix='4.';
    }
?>
   <?php $__empty_2 = true; $__currentLoopData = $dk->materipokok; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_2 = false; ?>

    <!-- Import Excel -->
    <div class="modal fade" id="importExcel<?php echo e($dk->id); ?>_<?php echo e($dm->id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
          <form method="post" action="<?php echo e(route('penilaian.inpunilai.importnilaipermateri',[$dataajar->id,$dm->id])); ?>" enctype="multipart/form-data">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Import Nilai Siswa <?php echo e(Fungsi::ambilkdmateripokok($dm->id,$dataajar->id)); ?></h5>
              </div>
              <div class="modal-body">

                <?php echo e(csrf_field()); ?>


                <label>Pilih file excel(.xlsx)</label>
                <div class="form-group">
                  <input type="file" name="file" required="required">
                </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">Import</button>
              </div>
            </div>
          </form>
        </div>
      </div>


    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_2): ?>
    <?php endif; ?>

<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<?php endif; ?>

<?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/siswa/dataajar/detailpenilaian.blade.php ENDPATH**/ ?>