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

<style type="text/css">
    .main-table  td, .main-table  th{ vertical-align: middle !important;  }
</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>
                <span class="kt-subheader__desc"><?php echo $this->lang->line('points'); ?></span>
            </div>

        </div>
    </div>
    <div class="kt-portlet kt-portlet--mobile">
        <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 $title ?>
                </h3>
            </div>
        </div>
        <div class="kt-portlet__body">
            <div class="table-responsive">

                <?php if ($this->session->userdata('message')) { ?>
                    <div class="alert alert-success alert-dismissible">
                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                        <?php echo $this->session->userdata('message'); ?>
                    </div>
                <?php } ?>

                <table class=" table table-striped table-bordered" id="datatable">
                    <thead>
                        <tr>
                            <th><?php echo $this->lang->line('sno'); ?></th>
                            <th><?php echo $this->lang->line('student'); ?></th>
                            <th><?php echo $this->lang->line('award'); ?></th>
                            <th><?php echo $this->lang->line('points'); ?></th>
                            <th><?php echo $this->lang->line('notes'); ?></th>
                            <th><?php echo $this->lang->line('approved_by'); ?></th>
                            <th><?php echo $this->lang->line('status'); ?></th>
                            <th><?php echo $this->lang->line('action'); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        if ($results) {
                            $s = 1;
                            foreach ($results as $result) {

                                if ($result->award_status == 0) {
                                    $status_btn = 'warning';
                                    $award_status = "Pending";
                                }
                                if ($result->award_status == 1) {
                                    $status_btn = 'success';
                                    $award_status = "Accepted";
                                }
                                if ($result->award_status == 2) {
                                    $status_btn = 'danger';
                                    $award_status = "Reject";
                                }
                                ?>
                                <tr>
                                    <td><?php echo $s++; ?></td>
                                    <td><?php echo $result->student_name; ?></td>
                                    <td><?php echo $result->award_name; ?></td>
                                    <td><?php echo $result->award_history_point; ?></td>
                                    <td><?php echo $result->memo; ?></td>
                                    <td><?php echo $result->memeber_name; ?></td>
                                    <td><span class='btn btn-<?php echo $status_btn; ?> btn-sm'><?php echo $award_status; ?></span></td>
                                    <td>
                                        <?php if ($result->award_status == 0) { ?>
                                            <a href="<?php echo base_url(); ?>points/award/accpect/<?php echo $result->id; ?>" class="btn btn-success btn-sm" onclick="return  confirm('are you sure?');"><i class="fa fa-check"></i></a>

                                            <a href="<?php echo base_url(); ?>points/award/reject/<?php echo $result->id; ?>" class="btn btn-danger btn-sm" onclick="return  confirm('are you sure?');"><i class="fa fa-times"></i></a>
                                            <?php } ?>
                                    </td>
                                </tr>
                            <?php }
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<?php $this->load->view('site/footer_2'); ?>
<script type="text/javascript">

                                    $(document).ready(function() {
                                    $('#datatable').DataTable(<?php if ($this->session->userdata('language') == "arabic") { ?>{
                                        "language": {
                                        "url": "<?php echo admin_url('js/Arabic.json'); ?>"
                                        }
                                        } <?php } ?>);
                                    });
</script>

