
<?php $this->load->view('site/layout'); ?>

<?php $this->load->view('site/navbar'); ?> 
<style>
    @media print {
        .header-print {
            display: table-header-group;
        }
    }
</style>

<div class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" id="kt_content">

    <!-- begin:: Content Head -->
    <div class="kt-subheader  kt-grid__item" id="kt_subheader">
        <div class="kt-container  kt-container--fluid ">
            <div class="kt-subheader__main">
                <h3 class="kt-subheader__title"><a href="<?php echo base_url() ?>Dashboard/"><?php echo $this->lang->line('dashboard'); ?></a></h3>
                <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                <h3 class="kt-subheader__title"><a href="<?php echo base_url() ?>producer/"><?php echo $this->lang->line('products'); ?></a></h3>
                <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                <h3 class="kt-subheader__title"><a href="<?php echo base_url() ?>absent/absent_summary/<?= $product_id ?>"><?php echo $this->lang->line('absent_summary'); ?></a></h3>
                <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                <span class="kt-subheader__desc"><?php echo $this->lang->line('absent'); ?></span>
            </div>

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


<div class="kt-portlet kt-portlet--mobile" style="margin-right: 22px;">
    <div class="kt-portlet__head kt-portlet__head--lg">
        <div class="kt-portlet__head-label">
            <span class="kt-portlet__head-icon">
                <i class="kt-font-brand flaticon2-line-chart"></i>
            </span>
            <h3 class="kt-portlet__head-title">
                <?php echo $this->lang->line('absent'); ?>
            </h3>
        </div>
        <div class="kt-portlet__head-toolbar">
            <div class="kt-portlet__head-wrapper">
                <div class="kt-portlet__head-actions">
                    &nbsp;
                    <!-- <form method="post" action=""> 
                      <button type="submit" name="report" value="<?php echo $start_expiry; ?>"  class="btn btn-brand btn-elevate btn-icon-sm">
                        <i class="la la-download"></i>
                    <?php echo $this->lang->line('report') ?>
                      </button>
                    </form> -->
                </div>
            </div>
        </div>
    </div>
    <div class="kt-portlet__body">
        <h2><?= $this->lang->line('student') ?> : <?php
            if (isset($all_groups[0])) {
                echo $all_groups[0]->username;
            }
            ?></h2>
        <br/>
        <hr/>
        <!--begin: Datatable -->
        <table class="table table-bordered table-hover" id="detailed_table" >
            <thead>
                <tr> 
                    <th class="st_name"><?php
                        if (isset($all_groups[0])) {
                            echo $all_groups[0]->username;
                        }
                        ?></th>
                    <th><?php echo $this->lang->line('sno') ?></th>
                    <th><?php echo $this->lang->line('date') ?></th>
                    <th><?php echo $this->lang->line('type') ?></th>
                </tr>
            </thead>
            <tbody>
                <?php
                $count = 1;
                $attend_status_arr = array($this->lang->line('absent'), $this->lang->line('present'), $this->lang->line('late'));
                foreach ($all_groups as $row) {
                    ?>
                    <tr>
                        <td class="st_name"></td>
                        <td><?php echo $count++; ?></td>
                        <td><?= $row->date ?></td>
                        <td><?= $attend_status_arr[$row->present] ?></td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>

        <!--end: Datatable -->
    </div>

</div><!-- /.row -->
<?php $this->load->view('site/footer_2'); ?> 
<script >
    function clear_date() {
        $("#start_expiry").val('');
    }
    $(function () {
        $(".st_name").hide();
        var table = $("#detailed_table").DataTable({dom: 'Bfrtip',
            aoColumnDefs: [{"aTargets": [0], "bSortable": false}],
            buttons: [
                {
                    extend: 'excelHtml5',
                    charset: 'UTF-16LE',
                    fieldSeparator: '\t',
                    bom: true,
                    customize: function () {
                        $(".st_name").show();
                    }
                },
                {
                    extend: 'csvHtml5',
                    charset: 'UTF-16LE',
                    fieldSeparator: '\t',
                    bom: true,
                    customize: function () {
                        $(".st_name").show();
                    }
                },
                {
                    extend: 'pdfHtml5',
                    charset: 'UTF-16LE',
                    fieldSeparator: '\t',
                    bom: true,
                    customize: function () {
                        $(".st_name").show();
                    }
                },
                {
                    extend: 'print',
                    autoPrint: false,
                    footer: true,
                    customize: function () {
                        $(".st_name").show();
                    }
                }

            ]});
        table.on('buttons-processing', function (e, indicator) {
            $(".st_name").hide();
        });
    });
</script>
