<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Question</title>
</head>

<body>

    <!-- <div class="page-header mt-5"> -->

    <div class="d-flex justify-content-between mb-2">
        <div>
            <h2 class=" tx-24 mg-b-5">Add New Question</h2>
        </div>
        <a class="btn btn-primary waves-effect waves-light" href="<?php echo base_url(); ?>ApplicationController/questionAdd">
            <i class="mdi mdi-plus mr-2"></i> Add  Question
        </a>
    </div>


    <!-- </div>  -->
    <!-- Row -->

    <div class="row sidemenu-height">
        <div class="col-lg-12">


            <?php
            if ($this->session->flashdata('alert_success')) {
            ?>
                <div class="alert alert-success alert-dismissible fade show" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                    <?php echo $this->session->flashdata('alert_success'); ?>
                </div>
            <?php
            }
            if ($this->session->flashdata('alert_danger')) {
            ?>
                <div class="alert alert-danger alert-dismissible fade show" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                    <?php echo $this->session->flashdata('alert_danger'); ?>
                </div>
            <?php
            }
            ?>


            <div class="card custom-card">
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="dmstable" class="table table-striped table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
                            <thead>
                                <tr>
                                    <th class="wd-20p">S.No</th>
                                    <th class="wd-25p">Academic Year</th>
                                    <th class="wd-15p">Exam Type</th>
                                    <th class="wd-15p">Category</th>
                                   <th class="wd-15p">Question</th>
                                    <th class="wd-15p">Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php


                                foreach ($records as $row) { ?>
                                    <tr>

                                        <td><?= $row->id; ?></td>
                                        <td><?php  foreach ($academic_year as $year ) {  ?>
                                            <?=  ($row->academic==$year->id) ? $year->year : '' ?>
                                            <?php }?></td>
                                        <td> <?php  foreach ($exam_type as $exam ) {  ?>
                                            <?=  ($row->exam_type==$exam->id) ? $exam->exam_type_name : '' ?>
                                            <?php }?></td>
                                        <td>
                                        <?php  foreach ($category as $cat ) {  ?>
                                            <?=  ($row->category==$cat->id) ? $cat->category : '' ?>
                                            <?php }?></td>
                                        <td><?= $row->question; ?></td>
                                        <td>
                                            <a href="<?= base_url('ApplicationController/questionEdit/' . $row->id) ?>" class="btn-sm btn-info"><i class="ti-pencil-alt"></i></a>
                                            <a href="<?= base_url('ApplicationController/delete/' . $row->id) ?>" class="btn-sm btn-danger"><i class="ti-trash"></i></a>

                                        </td>
                                    </tr>

                                <?php  }

                                ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    </div>
    </div>
    <script>
        $(document).ready(function() {
            $('#dmstable').DataTable();
        });
    </script>