<?php $segment = $this->uri->segment(2) ?>

<div class="content-body">
    <!-- row -->
    <div class="container-fluid">


        <?php if ($this->session->flashdata('alert_success')) {
        ?>
            <div class="alert alert-success alert-dismissible fade show" role="alert">
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                <strong>Success!</strong> <?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="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                <strong>Error!</strong> <?php echo $this->session->flashdata('alert_danger'); ?>
            </div>
        <?php
        }

        if ($this->session->flashdata('alert_warning')) {
        ?>
            <div class="alert alert-warning alert-dismissible fade show" role="alert">
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                <strong>Warning!</strong> <?php echo $this->session->flashdata('alert_warning'); ?>
            </div>
        <?php  } ?>
        <!-- Row -->
        <div class="row">
            <div class="col-xl-12">
                <div class="row">
                    <div class="col-xl-12">

                        <div class="page-title flex-wrap">
                            <div class="input-group search-area mb-md-0 mb-3">
                                <input type="text" class="form-control" placeholder="Search here...">
                                <span class="input-group-text"><a href="javascript:void(0)">
                                        <svg width="15" height="15" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
                                            <path d="M17.5605 15.4395L13.7527 11.6317C14.5395 10.446 15 9.02625 15 7.5C15 3.3645 11.6355 0 7.5 0C3.3645 0 0 3.3645 0 7.5C0 11.6355 3.3645 15 7.5 15C9.02625 15 10.446 14.5395 11.6317 13.7527L15.4395 17.5605C16.0245 18.1462 16.9755 18.1462 17.5605 17.5605C18.1462 16.9747 18.1462 16.0252 17.5605 15.4395V15.4395ZM2.25 7.5C2.25 4.605 4.605 2.25 7.5 2.25C10.395 2.25 12.75 4.605 12.75 7.5C12.75 10.395 10.395 12.75 7.5 12.75C4.605 12.75 2.25 10.395 2.25 7.5V7.5Z" fill="#01A3FF" />
                                        </svg>
                                    </a></span>
                            </div>
                            <div>
                                <!-- Button trigger modal -->
                                <a href="<?php echo base_url(); ?>QuestionController/questionAdd" type="button" class="btn btn-primary" id="open-modal">
                                    + New Question
                                </a>

                            </div>
                        </div>
                    </div>
                    <!--column-->
                    <div class="col-xl-12 wow fadeInUp" data-wow-delay="1.5s">
                        <div class="table-responsive full-data">
                            <table class="table-responsive-lg table display dataTablesCard student-tab dataTable no-footer" id="example-student">
                                <thead>

                                    <tr>
                                        <th class="wd-20p">S.No</th>
                                        <th class="wd-25p">Academic Year</th>
                                        <th class="wd-15p">Question Category</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 ($question_category as $qc) {  ?>
                                                    <?= ($row->question_category == $qc->id) ? $qc->question_category : '' ?>
                                                <?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('QuestionController/questionEdit/' . $row->id) ?>" data-toggle="tooltip" id="edit" data-placement="top" title="Edit" data-original-title="Edit" class="btn btn-sm btn-info"><i class="ti ti-pencil"></i></a>
                                                <a href="<?= base_url('QuestionController/deleteQuestion/' . $row->id) ?>" data-toggle="tooltip" id="delete" data-placement="top" title="Delete" data-original-title="Edit" class="btn btn-sm btn-danger"><i class="ti ti-trash"></i></a>
                                            </td>
                                        </tr>

                                    <?php  }

                                    ?>
                                </tbody>
                            </table>
                        </div>
                    </div>

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

    </div>
</div>



<script>


</script>