<?php
include_once '../session/admin-session.php';
include_once '../classes/class_admin.php';
include_once '../classes/validation.php';
include_once '../classes/common.php';
include_once 'read-configration.php';

ob_start();

$ObjDB = new class_db();
$objadm = new class_admin();
$val = new validation();

$qqsel = "select a.*, b.name from isr_summer_stay_tbl a, isr_stu_main_tbl b where a.roll = b.roll order by a.roll";
$ObjDB->sproc_name = $qqsel;
$res_sel = $ObjDB->SelectQuery();
?>
<div class="container-fluid">
    <div class="row">
        <div class="col-xl-12 col-xxl-12 col-sm-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title">Summer Stay</h5>
                </div>
                <div class="card-body">

                    <div class="row">
                        <br/>
                        <div class="table-responsive">
                            <table class="table table-bordered align-middle" id="summer_stay_list">
                                <thead class="table" style="background: #f3e4c1;" >
                                    <tr>
                                        <th>#</th>
                                        <th>Roll Number</th>
                                        <th>Name</th>
                                        <th>Supervisor</th>
                                        <th>Date From</th>
                                        <th>Date Upto</th>
                                        <th>Status</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                    $sub_sr = 1;
                                    while ($rowsel = mysqli_fetch_array($res_sel)) {
                                        $roll = $rowsel['roll'];
                                        $name = $rowsel['name'];
                                        $sup = $rowsel['sup'];

                                        $objadm->roll = $roll;
                                        $FacList = $objadm->GetFacultyList();
                                        while ($rowres = mysqli_fetch_array($FacList)) {
                                            $fac_name = $row['name'];
                                        }

                                        $datefrom = $rowsel['stay_from'];
                                        $dateupto = $rowsel['stay_upto'];

                                        $datefrom = date("d/m/Y", strtotime($datefrom));
                                        $dateupto = date("d/m/Y", strtotime($dateupto));

                                        $status = $rowsel['status'];
                                        ?>

                                        <tr>
                                            <td align=center><?php echo $sub_sr; ?></td>
                                            <td align=left><?php echo $roll; ?></td>
                                            <td align=left><?php echo $name; ?></td>
                                            <td align=left><?php echo $fac_name; ?></td>
                                            <td align=left><?php echo $datefrom; ?></td>
                                            <td align=left><?php echo $dateupto; ?></td>
                                            <td align=left><?php echo $status; ?></td>
                                        </tr>

                                        <?php $sub_sr = $sub_sr + 1;
                                    }
                                    ?>
                                </tbody>
                            </table>
                            <BR>
                            <H4><FONT COLOR="blue">Status :: A = Approved; P = Pending; R = Rejected</FONT></H4>
                        </div>
                    </div>

                </div>

            </div>
        </div>
    </div>
</div>
<?php
$pagemaincontent = ob_get_contents();
ob_clean();
$PAGENAME = 'registration-summer-stay';
$HTMLTITLE = '';
$HTMLDESCRIPTION = '';
$HTMLKEYWORDS = '';
include("admin-master.php");
?>
<script type="text/javascript">
    $("#summer_stay_list").DataTable({
        dom: '<"top"lBf>rt<"bottom"ip><"clear">',
        buttons: [
            {
                extend: 'excelHtml5',
                text: 'Download Excel',
                title: 'Data Export',
                className: 'btn btn-success'
            }
        ]
    });
</script>
