<style>
    .close:focus {
        outline: none;
    }

    .top-right {
        top: 20px;
        right: 20px;
    }

    .toast {
        border: 1px solid coral
    }
</style>
<div class="content-wrapper">

    <?php require('./layout/headerpage.php'); ?>

    <div class="container col-12 mb-4 pb-5">
        <div class="row">
            <div class="col-12">
                <div class="col-12">
                    <div class="card  mx-3">
                        <div class="card-header bg-primary">
                            <b class="card-title text-light judul"><span class="bi bi-people"></span> Rekam Transaksi </b>
                        </div>

                        <!-- /.card-header -->
                        <div class="card-body my-0 mx-4">

                            <form action="" method="post">
                                <table id="example15" class="table table-bordered table-striped table-hover table-sm small mb-4">
                                    <thead>
                                        <tr>
                                            <th>NIS</th>
                                            <th>Nama User</th>
                                            <th>L/P</th>
                                            <th>Telpon</th>
                                            <th>Kelas</th>
                                            <th>Pilih</th>

                                        </tr>
                                    </thead>
                                    <tbody>

                                        <?php
                                        $datatabel = new cekTabel;
                                        $cekTabel = $datatabel->cek($db_name, $tb_siswa);

                                        if ($cekTabel > 0) {

                                            $crud = new crudData();
                                            $showSiswa = $crud->showTable($tb_siswa);
                                            while ($data = $showSiswa->fetch(PDO::FETCH_OBJ)) {

                                                // $linkID = new linkpageID;
                                                $link = new linkpage;

                                                echo "<a " . $link->pageID($data->nis, 'transaksi/transaksi_create') . "><button class='btn btn-sm'>
                                                    <tr>
                                                     
                                                       
                                                        <td>$data->nis</td>
                                                        <td>$data->nama</td>
                                                        <td>$data->kelamin</td>
                                                        <td>$data->hp</td>
                                                        <td>$data->jenjang - $data->paralel</td>
                                                        <td width='50px' align='center'>
                                                        <a " . $link->pageID($data->id, 'transaksi/transaksi_create') . " class='badge badge-primary  px-1 py-1 d-inline'> <i class='bi bi-pencil-square'></i> PILIH</a>
                                                        </td>
                                                    </tr></button></a>";
                                            }
                                        } else {
                                            echo "<tr>
                                                <td width='5px' colspan='7'>
                                                    TIDAK ADA TABEL / DATA TAHUN $tahun
                                                </td>
                                            </tr>";
                                        }


                                        ?>

                                    </tbody>
                                </table>
                                <div class="div d-inline">
                                    <a <?php echo $link->page('seting/siswa/siswa_create'); ?> class="btn btn-primary btn-xs mb-2 btn-rounded small px-2"> <i class="bi bi-person-plus"></i> TAMBAH</a>
                                    <button type="submit" name="submit" class="btn btn-primary btn-xs mb-2 btn-rounded small px-2"> <i class="bi bi-trash"></i> HAPUS</button>
                                </div>

                            </form>


                            <?php
                            //  include "layout/toastr.php";
                            ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--/. container-fluid -->
        </section>
        <!-- /.content -->
    </div>
</div>

<?php
//include "layout/toastr.php";
?>


<!-- /.content-wrapper -->
<script type="text/javascript">
    $(function() {
        $('.check_all').click(function() {
            $('.chk_boxes1').prop('checked', this.checked);
        });
    });
</script>

<?php
if (isset($_POST['submit'])) {
    foreach ($_POST['nis_del'] as $id) {
        $delSiswa = new crudData();
        $delete = $delSiswa->deleteData($tb_siswa,  'nis',  $id);
    }

    $direct = new toast();
    echo  $direct->redirect('toast', 'delete', 'seting/siswa/siswa_read');
} else {
    echo "";
}

?>