<?php $__env->startSection('content'); ?>
    <div class="container-fluid px-xxl-65 px-xl-20 mt-20">
        <?php if(session('success')): ?>
            <div class="alert alert-success alert-wth-icon fade show" role="alert">
                <span class="alert-icon-wrap"><i class="zmdi zmdi-check-circle"></i></span>
                <?php echo e(session('success')); ?>

            </div>
        <?php endif; ?>
        <div class="row">
            <div class="col-xl-12">
                <div class="row">
                    <?php $__currentLoopData = $siswa; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $siswa): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="col-md-6">
                            <div class="card text-white">
                                <div class="card-body bg-white" style="color:black">
                                    <div class="row">
                                        <div class="col-4">
                                            <?php if($siswa->foto == null): ?>
                                                <img src="/perpus/default.jpg" height="100" width="100" alt="">
                                            <?php else: ?>
                                                <img src="/foto_siswa/<?php echo e($siswa->foto); ?>" height="100" width="100"
                                                    alt="">
                                            <?php endif; ?>
                                        </div>
                                        <div class="col-8">
                                            <table border="0">
                                                <thead>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td style="padding: 3px"><b>Nama Lengkap</b></td>
                                                        <td><b>&nbsp;: </b></td>
                                                        <td>
                                                            &nbsp;<?php echo e(Str::upper($siswa->nama_siswa)); ?>

                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding: 3px"><b>NIS</b></td>
                                                        <td><b>&nbsp;: </b></td>
                                                        <td>
                                                            &nbsp;<?php echo e(Str::upper($siswa->nis)); ?>

                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding: 3px"><b>Kelas</b></td>
                                                        <td><b>&nbsp;: </b></td>
                                                        <td>
                                                            &nbsp;<?php echo e(Str::upper($siswa->jenis_kelas)); ?>

                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="padding: 3px"><b>Jenis Kelamin</b></td>
                                                        <td><b>&nbsp;: </b></td>
                                                        <td>
                                                            <?php if($siswa->jenis_kelamin == 'l'): ?>
                                                                &nbsp;Laki - Laki
                                                            <?php else: ?>
                                                                &nbsp;Perempuan
                                                            <?php endif; ?>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <div class="row mt-2">
                                        <div class="col-6">
                                            <span>
                                                <?php echo DNS1D::getBarcodeHTML($siswa->barcode, 'C39'); ?>

                                            </span>
                                        </div>
                                    </div>
                                    <p class="card-title"><?php echo e($siswa->barcode); ?></p>
                                </div>
                            </div>
                        </div>
                        
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <section class="hk-sec-wrapper">
                            <h5 class="hk-sec-title">Daftar Buku Yang Di Pinjam</h5>
                            <div class="row">
                                <div class="col-sm">
                                    <div class="table-wrap">
                                        <div class="table-responsive">
                                            <table class="table table-hover table-bordered mb-0">
                                                <thead>
                                                    <tr>
                                                        <th>ID Buku</th>
                                                        <th>Judul Buku</th>
                                                        <th>Penerbit</th>
                                                        <th>Foto</th>
                                                        <th>Tanggal Pinjam</th>
                                                        <th>Tanggal Kembali</th>
                                                        <th>Keterlambatan</th>
                                                        <th>Denda</th>
                                                        <th>Action</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php
                                                        function rupiah($angka)
                                                        {
                                                            $hasil_rupiah = 'Rp ' . number_format($angka, 2, ',', '.');
                                                            return $hasil_rupiah;
                                                        }
                                                    ?>
                                                     <?php
                                                     $cek_denda = DB::Table('denda')->get();
                                                    ?>
                                                    <?php $__empty_1 = true; $__currentLoopData = $cek_denda; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cek_denda): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                                        <?php $nominal = $cek_denda->nominal_denda; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                                         <?php $nominal = 1000; ?>
                                                    <?php endif; ?>

                                                    <?php $__empty_1 = true; $__currentLoopData = $pinjam; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                                        <tr>
                                                            <td><?php echo e($data->kode_buku); ?></td>
                                                            <td><?php echo e(Str::title($data->nama_buku)); ?></td>
                                                            <td><?php echo e(Str::upper($data->penerbit)); ?></td>
                                                            <td>
                                                                <img src="/foto_buku/<?php echo e($data->foto_buku); ?>" height="60"
                                                                    width="60" alt="">
                                                            </td>
                                                            <td>
                                                                <?php echo e(date('d/F/Y', strtotime($data->created_at))); ?>

                                                            </td>
                                                            <td>
                                                                <?php echo e(date('d/F/Y', strtotime($data->tanggal_kembali))); ?>

                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $t = date_create($data->tanggal_kembali);
                                                                    $n = date_create(date('Y-m-d'));
                                                                    $terlambat = date_diff($t, $n);
                                                                    $hari = $terlambat->format('%a');

                                                                    if ($n <= $t) {
                                                                        $denda = 0;
                                                                        echo 'tidak denda';
                                                                    } else {
                                                                        $denda = $hari;
                                                                        echo '<span class="badge badge-danger"> Terlambat ' . $hari . ' Hari </span>';
                                                                    }
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php echo e(rupiah($denda * $nominal)); ?>

                                                            </td>
                                                            <td>
                                                                <form action="<?php echo e(route('pengembalian.proses')); ?>" method="post">
                                                                    <?php echo csrf_field(); ?>
                                                                    <?php echo method_field('post'); ?>
                                                                    <input type="text" name="denda" value="<?php echo e($denda); ?>" hidden>
                                                                    <input type="text" name="nominal" value="<?php echo e($nominal); ?>" hidden>
                                                                    <input type="text" name="id" value="<?php echo e($data->id_pinjam); ?>" hidden>
                                                                    <button type="submit" href="" class="btn btn-success btn-sm btn-rounded" onclick="return confirm('Apakah Buku dan Denda Telah Sesuai Dengan Sistem ?')">Proses Buku</button>
                                                                </form>
                                                            </td>
                                                        </tr>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                                    <tr>
                                                        <td colspan="8" class="text-center">Siswa Tidak Memiliki Peminjaman Buku</td>
                                                    </tr>
                                                    <?php endif; ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </section>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('css'); ?>
    <!-- select2 CSS -->
    <link href="/theme/vendors/select2/dist/css/select2.min.css" rel="stylesheet" type="text/css" />
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
    <!-- Select2 JavaScript -->
    <script src="/theme/vendors/select2/dist/js/select2.full.min.js"></script>
    <script src="/theme/dist/js/select2-data.js"></script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('petugas.theme.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\perpustakaan\resources\views/petugas/pengembalian/pengembalian_cek.blade.php ENDPATH**/ ?>