<style>
    .w-20{
        width:20%;
        float:left;
        padding:0px 10px;
    }
</style>

<div class="container-fluid 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">Subjects</li>
            </ul>
            <a href="<?php echo base_url(); ?>TimeTableManagement/class_subjects" class="btn btn-sm btn-success mb-3">Add Subject</a>
            <form method="post" action="" class="">
                <div class="form-group w-20">
                    <label>Class</label>
                    <select class="form-control" name="class" required>
                        <option value="">-- Select Class --</option>
                        <?php 
                        $all_classes=$this->TimeTableModel->all_classes();
                        if($all_classes){
                            foreach($all_classes as $courses){
                        ?>
                        <option value="<?php echo $courses['course']; ?>"><?php echo $courses['course']; ?></option>
                        <?php
                            }
                        }
                        ?>
                    </select>
                </div>
                
                <div class="form-group w-20">
                    <label>&nbsp;&nbsp;</label><br>
                    <button class="btn btn-sm btn-success" type="submit" name="search_subjects">Serarch</button>
                </div>
            </form>
            <div class="table-responsive mt-3">
                <table class="table table-bordered table-striped" id="mytable                                                                                                       ">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Subject</th>
                            <th>Class</th>
                            <th>Subject Order</th>
                            <th>Status</th>
                            <!--<th>Action</th>-->
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $count=0;
                        if($all_subjects){
                            foreach($all_subjects as $subject){
                                $count=$count + 1;
                                $status=$subject['status'];
                        ?>
                        <tr>
                            <td><?php echo $count; ?></td>
                            <td><?php echo $subject['subject']; ?></td>
                            <td><?php echo $subject['class']; ?></td>
                            <td><?php echo $subject['subject_order']; ?></td>
                            <td>
                                <?php 
                                if($status == "active"){
                                ?>
                                <button class="btn btn-sm btn-outline-success">Active</button>
                                <?php
                                }else{
                                ?>
                                <button class="btn btn-sm btn-outline-danger">Inactive</button>
                                <?php
                                }
                                ?>
                            </td>
                            <!--<td></td>-->
                        </tr>
                        <?php
                            }
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>