<style>
    .fontInput {
        font-size: 11px;
        font-family: arial;
    }

    .judul {
        font-size: 15px;
        font-family: arial;
    }
</style>

<div class="content-wrapper">

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

    <div class="container col-12 mb-4 pb-5">
        <div class="row  mx-3 pr-3">
            <div class="col-12">
                <div class="col-12 ">
                    <div class="card  mx-3">
                        <div class="timeline-header bg-primary py-2 pl-2">
                            <b class="text-light judul"><span class="bi bi-credit-card-2-front"></span> Daftar Rekening Sekolah </b>
                        </div>

                        <div class="row col-md-12">
                            <div class="col-md-9">
                                <div class="card-body mt-4 px-1 mx-2">

                                    <div class="row">
                                        <div class="col-12 col-sm-6 col-md-12">





                                            <form action="" method="post">
                                                <table id="example" class="table table-bordered table-striped table-hover table-sm  mb-4">
                                                    <thead>
                                                        <tr>
                                                            <th><input type="checkbox" class="small check_all"></th>
                                                            <th>Edit</th>
                                                            <th>No. Rekening</th>
                                                            <th>Nama Rekening</th>
                                                            <th>Bank</th>
                                                            <th>Konfirmasi</th>


                                                        </tr>
                                                    </thead>
                                                    <tbody>

                                                        <?php
                                                        $user_admin = new crudData();
                                                        $showUser = $user_admin->showTable('tb_rekening order by no asc');
                                                        while ($data = $showUser->fetch(PDO::FETCH_OBJ)) {
                                                            $link = new linkpage;
                                                            echo "
                                                    <tr>
                                                        <td width='5px'>
                                                            <input type='checkbox' class='d-inline small chk_boxes1' name='id_rek[]' value='$data->id'> 
                                                        </td>
                                                        <td width='75px' align='center'>
                                                        <a " . $link->pageID($data->id, 'seting/rekening/edit') . " class='badge badge-primary  px-1 py-1 d-inline''> <i class='bi bi-pencil-square'></i> EDIT</a>
                                                        </td>
                                                        <td>$data->rekening</td>
                                                        <td>$data->an</td>
                                                        <td>$data->bank</td>
                                                        <td>$data->wa</td>
                                                        </tr>";
                                                        };
                                                        ?>
                                                    </tbody>
                                                </table>
                                                <div class="div d-inline">
                                                    <a <?php echo $link->page('seting/rekening/create'); ?> class="btn btn-primary btn-xs mb-2 btn-rounded small px-2"> <i class="bi bi-file-earmark-plus"></i> TAMBAH</a>
                                                    <button type="submit" name="submitDel" class="btn btn-primary btn-xs mb-2 btn-rounded small px-2"> <i class="bi bi-trash"></i> HAPUS</button>
                                                </div>

                                            </form>



                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="card-body mt-4 px-1 mx-2">

                                    <div class="row">
                                        <div class="col-12 col-sm-6 col-md-12">
                                            <div class="info-box mb-3">


                                                <div class="info-box-content">
                                                    <div class="relative mb-0 pb-3">
                                                        <input name="judul" value="INFO REKENING" style="background-color: gainsboro;" class="form-control-sm col-sm-6 fontInput small bg-default mt-3 text-center" disabled>
                                                    </div>

                                                    <div class="col-sm-12 invoice-col pt-0">

                                                        <p>Daftar Rekening adalah Rekening Sekolah yang diinformasikan pada Login Siswa untuk melakukan pembayaran ke Sekolah.</p>





                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>



                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



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

<?php
if (isset($_POST['submitDel']) && isset($_POST['id_rek'])) {
    foreach ($_POST['id_rek'] as $id) {
        $user_admin = new crudData();
        $delete = $user_admin->deleteData('tb_rekening', 'id', $id);
    };

    $direct = new toast();
    echo  $direct->redirect('toast', 'delete', 'seting/rekening/index');
}
