<?php
$tid=$this->uri->segment('3');
$class=$this->uri->segment('4');
$section=$this->uri->segment('5');
?>

<div class="container-fluid mt-3 mb-3 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">
                    <a href="<?php echo base_url(); ?>Management/all_active_staff">All Classes & Sections</a>
                </li>
                <li class="breadcrumb-item"><?php echo $class."-".$section; ?></li>
            </ul>
            
            
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                <thead>
                    <tr>
                        <th>Count</th>
                        <th>Sch. No.</th>
                        <th>Name</th>
                        <th>Father's Name</th>
                        <th>D.O.B.</th>
                        <th>Contact No.</th>
                        <th>Alt. No.</th>
                        <th>View</th>
                        <th>Update</th>
                        <th>Docs</th>
                    </tr>    
                </thead>    
                <tbody>
                <?php 
                $acedemic_session=$this->session->userdata('acedemic_session');
                $all_students=$this->WelcomeModel->get_students_ac_session_by_class($acedemic_session,$class,$section);
                $count=0;
                if($all_students){
                    foreach($all_students as $data){
                        $student_table='student';
                        $get_student_data=$this->WelcomeModel->get_item_data($data['sid'],$student_table);
                        if($get_student_data ){
                            foreach($get_student_data as $students){
                                if($students['status'] ==1){
                                    $count++;    
                ?>
                        <tr>
                            <td><?php echo $count; ?></td>
                            <td><?php echo $students['sch_no']; ?></td>
                            <td><?php echo $students['student_name']; ?></td>
                            <td><?php echo $students['father_name']; ?></td>
                            <td><?php echo date('d-m-Y',strtotime($students['dob'])); ?></td>
                            <td><?php echo $students['contact_no']; ?></td>
                            <td><?php echo $students['alternate_no']; ?></td>
                            <td>
    
                                <a href="<?php echo base_url(); ?>Student/profile/<?php echo$students['id'];?>" target="_blank"><button class="btn btn-outline-info btn-sm">View</button></a>  


                            </td>
                            <td>
                                <form style="" id="myForm" action="<?php echo base_url();?>student/add_new_student/<?php echo $students['id'];?>" method="post">
                                        <button class="btn btn-warning btn-sm edit" name="edit" value="<?php echo $students['id']; ?>" type="submit">Edit</button>
                                </form>
                            </td>
                            <td><a href="<?php echo base_url();?>Student/documentation/<?php echo $students['id'];?>" target="_blank" class="btn btn-sm btn-outline-info">Doc.</td>
                        </tr>


                    <?php
                                    }

                                }    
                            }

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