<style>
    .w-50{
        float:left;
        padding:0px 10px;
    }
</style>
<?php
$sid=$this->uri->segment('3');
?>
<div class="container-fluid mt-3 mb-3 bg-white">
    <div class="row">
        <div class="col-sm-12  pt-3 pb-3">
            <?php 
            if($success){
            ?>
            <div class="alert alert-success"><?php echo $success;?></div>
            <?php
            }
            if($error){
            ?>
            <div class="alert alert-danger"><?php echo $error;?></div>
            <?php 
            }
            $acedemic_session=$this->session->userdata('acedemic_session');
            $check_rte_status=$this->NewFeeModel->check_student_rte_status($sid,$acedemic_session);
            if ($check_rte_status) {
            ?>
    
                
            
            <table class="table table-bordered table-striped">
                <tr>
                    <th>R.T.E. Status </th>
                    <th class="text-success">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-lg" viewBox="0 0 16 16">
                            <path d="M13.485 1.431a1.473 1.473 0 0 1 2.104 2.062l-7.84 9.801a1.473 1.473 0 0 1-2.12.04L.431 8.138a1.473 1.473 0 0 1 2.084-2.083l4.111 4.112 6.82-8.69a.486.486 0 0 1 .04-.045z"/>
                        </svg>
                    </th>
                </tr>
            </table>

            
            <?php 
            }else{

            ?>
            <!--<div class="mt-3 mb-3 pt-3 pb-3" style="border: 1px solid silver;width: 50%;padding: 15px;">-->
                <h3 style="font-weight:600;font-size:18px;">Add as R.T.E. Student </h3><hr>
                <form method="post" action="#">
                    <div class="form-group w-50">
                        <input type="hidden" name="sid" value="<?php echo $sid; ?>">
                        <label>Acedemic Session</label>
                        <select class="form-control" name="acedemic_session" readonly>
                            
                            <?php
                            $table1='academic_session_details';
                            $get_ac_sessions=$this->NewFeeModel->get_data($table1);
                            if($get_ac_sessions){
                                foreach($get_ac_sessions as $sessions){
                                    if($sessions['status'] == 1){
                                        $active_acedemic_session= $sessions['id'];  
                            ?>
                            <option value="<?php echo $sessions['id'] ?>" <?php if($sessions['status'] == 1){echo "selected";} ?> class="<?php if($sessions['status'] == 1){echo "text-success";} ?>" >
                            <?php echo $sessions['y1']; echo "-";  echo $sessions['y2'];?></option>
                            <?php 
                                    }
                                    

                                }
                            }
                            ?>
                        </select>
                    </div>

                    <div class="form-group w-50">
                        <label>Class</label>
                        <?php 
                        $get_active_course_data=$this->NewFeeModel->get_studdents_current_course_data($sid,$active_acedemic_session);
                        if ($get_active_course_data) {
                            foreach($get_active_course_data as $active_course_data){
                                $active_course_id=$active_course_data['course_id'];
                                $courses_table='courses';
                                $get_course_info=$this->NewFeeModel->get_item_data($active_course_id,$courses_table);
                                if ($get_course_info) {
                                    foreach($get_course_info as $course_info){
                        ?>
                        <input type="hidden" name="course_id" class="form-control" value="<?php echo $active_course_id;?>">
                        <input type="text" name="course_info" class="form-control" value="<?php echo $course_info['course']; echo " "; echo $course_info['subject_stream'];?>" readonly>
                        <?php                
                                    }
                                }
                        ?>

                        <?php        
                            }
                        }

                        ?>
                    </div>

                    <div class="form-group w-50">
                        <button type="submit" name="add_rte_student" class="btn btn-sm btn-success">Add as RTE Student</button>
                    </div>
                </form>
                
        <?php 

            }
        ?>
        </div>
    </div>
</div>