<?php

include '../../config/conn.php';
?>

<!-- page content -->
<div class="col" role="main">
    <div class="">
        <div class="clearfix"></div>

        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title" style="text-transform: capitalize;">

                        <h2 style="color: crimson;">KONFIRMSI DATA TARIK SERENTAK <small></small></h2>

                        <div class="clearfix"></div>






                    </div>

                    <div class="x_content">
                        <form action="?module=tarik-serentak&aksi=tarik" method="POST">
                            <div class="col-md-3">

                                <input style=" color:black;" type="hidden" class="form-control" id="saldo" name="keterangan" value="<?php echo $_POST['keterangan']; ?>">
                                <button onclick="submit()" class='open_modal btn  btn-danger btn-xl'>Konfirmasi</button>
                            </div>



                            <table id="datatable" class="table table-bordered">


                                <thead>
                                    <tr style="color: black;">
                                        <!--<th>Tanggal</th>-->
                                        <!--<th>id transaksi</th> -->
                                        <th width="15px">NO.</th>
                                        <th>Id Santri</th>
                                        <th>Nama Santri</th>
                                        <th>jenkel</th>

                                        <th>Tanggal masuk</th>
                                        <th>Saldo</th>

                                        <th width="100">Status Saldo</th>

                                    </tr>
                                </thead>


                                <tbody>
                                    <input type="hidden" name="selector[]" id="" value="<?php echo  $_POST['selector']; ?>">
                                    <?php
                                    $no = 0;
                                    $id = $_POST['selector'];
                                    $N = count($id);
                                    for ($i = 0; $i < $N; $i++) {

                                        // echo $idtran . "<br>";
                                        $idd = $id[$i];


                                        $query = mysqli_query($conn, "SELECT * FROM santri WHERE id_santri='$idd'");
                                        $row = mysqli_fetch_array($query);

                                        $no++;
                                    ?>



                                        <tr style="background: <?php if ($no % 2 == 1) { ?>
                          #ececec;
                          <?php } else { ?>
                            white;
                            <?php } ?>">

                                            <td style=" color:black"><?php echo $no; ?></td>

                                            <td style=" color:black">

                                                <?php echo $row['id_santri']; ?></td>
                                            <input type="hidden" name="selector[]" value="<?php echo  $row['id_santri']; ?>">
                                            <td style=" color:black"><?php echo $row['nama']; ?></td>
                                            <td style=" color:black"><?php if ($row['jenkel'] == 'l') {
                                                                            echo "Laki-laki";
                                                                        } else {
                                                                            echo "Perempuan";
                                                                        } ?></td>

                                            <td style=" color:black"><?php echo $row['tanggal_masuk'];  ?></td>
                                            <td style="font-weight: bold; color:black;font-size:medium"><?php echo rupiah(saldo($row['id_santri'])); ?></td>

                                            <td><?php



                                                if (saldo($row['id_santri']) <= $aman['isi']) {
                                                    echo "<font color=#f01519><b>Menipis</b></font>";
                                                } else {
                                                    echo "<font color=#0082da><b>aman</b></font>";
                                                }

                                                ?></td>



                                            <?php
                                            $count++

                                            ?>

                                        </tr>

                                    <?php
                                    } ?>





                                </tbody>
                        </form>
                        </table>
                    </div>

                </div>
            </div>

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