<style>
    body{background:#EAEDED;}
</style>
<div class="container mt-3 bg-white">
    <div class="row">
        <div class="col-sm-12">
            
            <a href="<?php echo base_url();?>Management/view_staff" class="btn btn-warning btn-sm text-white mt-3 mb-3">Class Teachers</a>
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>Count</th>
                            <th>Name</th>
                            <th>Mobile</th>
                            <th>Class Teacher</th>
                            <th>Status</th>
                            <!--<th>View Students</th>-->
                            <th>Profile</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
                        $staff_table='school_staff';
                        $all_staff=$this->WelcomeModel->get_data_in_status_order($staff_table);
                        $count=0;
                        if($all_staff){
                            foreach($all_staff as $staff){
                                $count=$count + 1;
                                ?>
                        <tr>
                            <td><?php echo $count;?></td>
                            <td><?php echo $staff['name'];?></td>
                            <td><?php echo $staff['mobile_number'];?></td>
                            <td><?php
                            $tid=$staff['id'];
                            $acedemic_session=$this->session->userdata('acedemic_session');
                            $teachers_class_info=$this->WelcomeModel->teachers_class_info($tid,$acedemic_session);
                            if($teachers_class_info){
                                foreach($teachers_class_info as $teachers_info){
                                    echo $teachers_info['class']; echo "-"; echo $teachers_info['section']; 
                                }
                            }
                            ?>
                            </td>
                            <td><?php if($staff['user_status']==1){ ?><button class="btn  btn-sm btn-success">Active</button><?php } else{ ?><button class="btn btn-sm btn-danger">Inactive</button> <?php } ?></td>
                            <!--<td></td>-->
                            <td><a href="<?php echo base_url();?>management/staff/<?php echo $staff['id'];?>" class="btn btn-info btn-sm">View</a></td>
                        </tr>
                                <?php
                            }
                        }
                        ?>

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