<!-- Begin Page Content -->
<div class="container-fluid">

    <!-- Page Heading -->
    <div class="row column_title">
        <div class="col-md-12">
            <div class="page_title">
                <h2><?=ucwords($_SESSION['type'])?> Questions</h2>
                <br>
                <a href="<?=base_url('dashboard/questions/morning')?>" style="color:blue">Morning</a>
                <br><br>
                <a href="<?=base_url('dashboard/questions/evening')?>" style="color:blue">Evening</a>
            </div>
        </div>
    </div>

    <button type="button" style="float: right" onclick="location.href='<?= base_url() . 'dashboard/addQuestion' ?>'" class="btn btn-primary">Add <?=ucwords($_SESSION['type'])?> Question</button>
    <!-- DataTales Example -->
    <br><br><br>
    <div class="card shadow mb-4">

        <div class="card-header py-3 ml-auto">

        </div>

        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="songTable" width="100%" cellspacing="0">
                    <thead class="thead-dark">
                        <tr>
                            <th>Question</th>
                            <th>Type</th>
                            <th>Options</th>
                            <th>Count</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>

                        <?php
                        if (!empty($questions)) {
                        foreach ($questions as $id => $question) {
                            $options = '';
                            foreach($question['options'] as $key => $option){
                                $options .= $key.'<br>';
                            }
                        ?>
                        <tr>
                            <td><?php echo $question['question']; ?></td>
                            <td><?php echo $question['type']; ?></td>
                            <td><?php echo $options ?></td>
                            <td><?php echo $question['count']; ?></td>

                            <td>

                                <!-- <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>Instrumentalist/editPodcast/<?php echo $id; ?>">
                                    <button class="btn btn-info btn-block mt-2">Edit</button>
                                </a> -->
                                <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>dashboard/deleteQuestion/<?php echo $id; ?>">
                                    <button class="btn btn-danger btn-block mt-2">Delete</button>
                                </a>

                            </td>

                        </tr>
                        <?php }
                        } ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>
<!-- /.container-fluid -->