<?php
$class=$this->uri->segment('3');
$section=$this->uri->segment('4');
$acedemic_session=$this->session->userdata('acedemic_session');
?>
<style>
    tr td,tr th{
        text-align:center;
    }
</style>
<div class="container mt-3 mb-3 bg-white">
    <div class="row">
        <div class="col-sm-12 pt-3 pb-3">
            
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo base_url(); ?>Welcome">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url(); ?>Examination/all_classes">All Courses</a></li>
                <li class="breadcrumb-item"><?php echo $class; ?></li>
                <li class="breadcrumb-item"><?php echo $section; ?></li>
            </ul>
            <div class="p-3">
                
            <a href="<?php echo base_url(); ?>Examination/exam_list" class="btn btn-sm btn-info" target="_blank">Add New Exam</a>
            
            <a href="<?php echo base_url(); ?>Examination/generate_class_section_admit_card" class="btn btn-sm btn-info" target="_blank">Issue Admit Card</a>
            
            </div>
            <div class="table-responsive mt-3 mb-3">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Exam Title</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $count=0;
                        $table="exam_list";
                        $get_list_data=$this->NewExamModel->get_exams($acedemic_session,$table);
                        // $table="exam_list";
                        // $get_list_data=$this->NewExamModel->get_data($table);
                        if($get_list_data){
                            foreach($get_list_data as $list_data){
                                $count=$count + 1;
                                $status=$list_data['status'];
                        ?>
                        
                        <tr>
                            <td><?php echo $count; ?></td>
                            <td><?php echo $list_data['exam_title']; ?></td>
                            <td><?php echo $list_data['y1']."-".$list_data['y2']; ?></td>
                            <td>
                                <?php
                                if($status == 1){
                                ?>
                                <button class="btn btn-sm btn-outline-success">Active</button>
                                <?php
                                }else if($status == 0){
                                ?>
                                <button class="btn btn-sm btn-outline-danger">Inactive</button>
                                <?php
                                }
                                ?>
                            </td>
                            <td>
                                <a href="<?php echo base_url(); ?>Examination/course_admit_card/<?php echo $class."/".$section."/".$list_data['id']; ?>" target="_blank" class="btn btn-sm btn-outline-info">Admit Cards</a>
                            </td>
                        </tr>
                        <?php
                            }
                        }
                        ?>
                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
</div>