<style type="text/css">
.contact-info-w-3{width:33.33%;float:left;height:90px;padding:10px;}
.personal-info-w-5{padding:10px;float:left;width:50%;height:90px;}
.form-group label{font-weight:600 !important;}
.w100{width:100%;float:left;padding:10px;}
h1{font-weight: 700;font-size: 22px;padding:10px;}
h3{font-size:18px;font-weight:700;padding:10px;}
body{background:#EAEDED;}


input[type=radio]{width:12%;margin-right: 15px;}
@media only screen and (max-width:767px){
    .contact-info-w-3{width:100%;float:left;height:90px;padding:10px;}
    .personal-info-w-5{padding:10px;float:left;width:100%;height:auto;}
    .form-group label{font-weight:600 !important;}
}
</style>



<?php 
$id='';
$student_name = '';
$gender = '';
$father_name ='';
$mother_name = '';
$residence_address = '';
$office_name_address ='';
$table = 'student';
$phone_resi = '';
$phone_office = '';
$admission_for_class = '';
$year = '';
$previous_school= '';
$previous_examination_appeared='';
$previous_exam_result = '';
$d_o_b='';
$nationality = '';
$religion ='';
$caste = ''; 
$date = '';
$email = '';
$slug = '';
$scholar_no='';
$section='';
$student_class='';
$bill_book_no='';
$course_id='';
$title='';
$admission_date="";
// $sid=$this->uri->segment(3);
if(isset($data)){ 
    // echo "yes";echo $data;
     
    $get_table_list = $this->StudentModel->check_student($data,$table);
    if($get_table_list){
            $title='Edit Profile';
        foreach($get_table_list as $records){
                
            $bill_book_no=$records['bill_book_number'];
            $student_name = htmlspecialchars($records['student_name']); 
            $gender = htmlspecialchars($records['gender']);
            $father_name = htmlspecialchars($records['father_name']);
            $mother_name = htmlspecialchars($records['mother_name']);
            $residence_address =htmlspecialchars($records['address']);
            $id= $records['id'];
            $office_name_address=htmlspecialchars($records['office_address']);
            $phone_resi =htmlspecialchars($records['contact_no']);
            $slug =htmlspecialchars($records['slug']);
            $phone_office =htmlspecialchars($records['alternate_no']);
            $acedemic_session=$this->session->userdata('acedemic_session');
            $get_student_info=$this->WelcomeModel->get_student_in_acedemic_session($data,$acedemic_session);
            if($get_student_info){
               foreach($get_student_info as $student_info){
               $student_class =$student_info['class'];   
               $course_id=$student_info['course_id'];
               }
           }
           
           $admission_for_class =htmlspecialchars($records['admission_class']);
           $section =htmlspecialchars($records['section']);
           $previous_school =htmlspecialchars($records['previous_school']);
           $previous_examination_appeared =htmlspecialchars($records['previous_exam']);
           $previous_exam_result =htmlspecialchars($records['previous_exam_result']);
           $d_o_b =htmlspecialchars($records['dob']);
           $scholar_no =htmlspecialchars($records['sch_no']);
           $religion =htmlspecialchars($records['religion']);
           $caste =htmlspecialchars($records['caste']);
           $email =htmlspecialchars($records['email']);
           $admission_date =$records['admission_date'];
        }
    }
}else{
        $title='Add New Student';    
}
?>


<div class="container-fluid bg-white mt-3 mb-3">
    <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();?>Student/my_class_students">Students</a></li>
                <li class="breadcrumb-item"><?php echo $student_name; ?></li>
            </ul>
            
            <h1 class=""><?php  echo $title;  ?></h1>
            
            <hr>
        <!--</div>-->

        <!--<div class="col-sm-12">-->
            <form  method="post" enctype="multipart/form-data">
                <h4>                      
                    <?php if($success){ ?>
                        <p style='color:green;font-weight:bolder;'> <?php echo $success; ?></p>
                    <?php } ?>
                    <?php if($error){ ?>
                        <p style='color:red;font-weight:bolder;'> <?php echo $error; ?></p>
                    <?php } ?>
        
                    <?php
                    if($student_course_data_status_1){
                    ?>
                        <div class="alert alert-success"><?php echo $student_course_data_status_1;?></div>
                    <?php
                    }
        
                    if($student_course_data_status_2){
                    ?>
                    <div class="alert alert-danger"><?php echo $student_course_data_status_2;?></div>
                    <?php
                    }
                    ?>
                </h4>
  

                <!--<div class="w50">    -->
                <!--<div class="form-group">-->
                <h3>Personal Information</h3>
                    <hr>
                    <!--</div>-->
                    <div class="form-group personal-info-w-5">
                        <label>Scholar Number:</label> 
                        <input type="number" name="scholar_no" class="form-control" placeholder="Scholar Number" value="<?php if($scholar_no){echo $scholar_no;} else{} ?>" > 
                    </div>

                    <div class="form-group personal-info-w-5">
                        <label>Bill Book Number</label>
                        <input type="number" class="form-control" name="bill_book_number" placeholder="Bill book number" value="<?php echo $bill_book_no; ?>">
                    </div>

                    <div class="form-group personal-info-w-5">
                        <label for="Name">Student Name:</label>
                        <input type="hidden" name="id" value="<?php if($id){ echo $id; }else { }?>">
                        <input type="text" class="form-control" id="name" placeholder="Enter Student Name" name="student_name" value="<?php if($student_name){ echo $student_name; }else { }?>" >
                    </div>

                    <div class="form-group personal-info-w-5">
                        <label for="Gender">Gender:</label><br>
                        <label for="male">Male</label>
                        <input type="radio" id="male" name="gender" value="male" <?php if($gender=='male'){echo "checked";} else{} ?> >
                        <label for="female">Female</label>
                        <input type="radio" id="female" name="gender" value="female" <?php if($gender=='female'){echo "checked";} else{} ?> >
                        <label for="other">Other</label> 
                        <input type="radio" id="other" name="gender" value="other" >
                    </div>


                    <div class="form-group personal-info-w-5">
                        <label for="Event Title">Father Name :</label>
                        <input type="text" class="form-control" id="title" placeholder="Father Name" name="father_name" value="<?php if($father_name){echo $father_name;} else{} ?>" required>
                    </div>


                    <div class="form-group personal-info-w-5">
                        <label for="Event Title">Mother Name:</label>
                        <input type="text" class="form-control" id="title" placeholder="Mother Name" name="mother_name" value="<?php if($mother_name){echo $mother_name;} else{} ?>" >
                    </div>
                    <div class="form-group personal-info-w-5">
                        <label for="Event Date"> Date of Birth: </label>
                        <input class="form-control"   name="d_o_b" type="date" value="<?php if($d_o_b){echo $d_o_b;} else{} ?>"  >
                    </div>

                    <div class="form-group personal-info-w-5">
                        <label>Current Class:</label> 
                        <select name="course_id" class="form-control">
                        <option value=''>Select Student Current Class</option>    
                        <?php 
                        $courses_table='courses';
                        $all_courses=$this->StudentModel->get_table_data($courses_table);
                        if($all_courses){
                            foreach($all_courses as $courses){
                        ?>
                            <option value="<?php echo $courses['id']; ?>" <?php if($course_id == $courses['id']){echo "selected";}?> ><?php echo $courses['course'];echo " "; echo $courses['subject_stream']; ?></option>
                        <?php
                            }
                        }
                        ?>
                        </select>
                    </div>      



                    <div class="form-group personal-info-w-5">
                        <label>Admission to Class:</label> 
                        <select name="admission_for_class" class="form-control">
                            <option value=''>Select Student Admission Class</option>    
                            <?php 
                            $courses_table='courses';
                            $all_courses=$this->StudentModel->get_table_data($courses_table);
                            if($all_courses){
                                foreach($all_courses as $courses){
                            ?>
                            <option value="<?php echo $courses['course']; ?>" <?php if($admission_for_class == $courses['course']){ echo "selected"; } ?>><?php echo $courses['course'];echo " "; echo $courses['subject_stream']; ?></option>
                            <?php
                                }
                            }
                            ?>
                        </select>
                    </div>

                    <div class="form-group personal-info-w-5">
                        <label>Admission Date :</label>    
                        <input type="date" class="form-control" value="<?php echo $admission_date;?>" name="admission_date">
                    </div>
                    <div class="form-group personal-info-w-5">
                        <label>Section:</label> 
                        <select class="form-control" name="section">
                            <option value="A" <?php if($section == "A" ){ echo "selected"; } ?>>A</option>
                            <option value="B" <?php if($section == "B" ){ echo "selected"; } ?>>B</option>
                            <option value="C" <?php if($section == "C" ){ echo "selected"; } ?>>C</option>
                            <option value="D" <?php if($section == "D" ){ echo "selected"; } ?>>D</option>
                            <option value="E" <?php if($section == "E" ){ echo "selected"; } ?>>E</option>
                            <option value="E" <?php if($section == "F" ){ echo "selected"; } ?>>F</option>
                        </select>
                        <!--<input type="text" name="section" class="form-control" placeholder="Section" value="<?php if($section){echo $section;} else{} ?>" > -->
                    </div>
                    <div class="form-group personal-info-w-5">
                        <label for="caste">Caste:</label><br>
                        <label for="general">General</label>
                        <input type="radio" id="general" name="caste" value="general" <?php if($caste=='general'){echo "checked";} else{} ?> >
                        <label for="sc">SC</label>
                        <input type="radio" id="sc" name="caste" value="sc" <?php if($caste=='sc'){echo "checked";} else{} ?> >
                        <label for="obc">OBC</label> 
                        <input type="radio" id="obc" name="caste" value="obc" <?php if($caste=='obc'){echo "checked";} else{} ?> >
                        
                        <label for="st">ST</label> 
                        <input type="radio" id="st" name="caste" value="st" <?php if($caste=='st'){echo "checked";} else{} ?> >
                        
                        <label for="MIN">OBC</label> 
                        <input type="radio" id="MIN" name="caste" value="MIN" <?php if($caste=='MIN'){echo "checked";} else{} ?> >
                    </div> 
    

                    <div class="form-group personal-info-w-5">
                        <label>Religion:</label> 
                        <input type="text" name="religion" class="form-control" placeholder="Religion" value="<?php if($religion){echo $religion;} else{} ?>" > 
                    </div>   
 
                    <div class="form-group personal-info-w-5">
                        <label>Previous School:</label> 
                        <input type="text" name="previous_school" class="form-control" placeholder="Previous School" value="<?php if($previous_school){echo $previous_school;} else{} ?>" > 
                    </div>
                    <div class="form-group personal-info-w-5">
                        <label>Previous Examination Appeared:</label> 
                        <input type="text" name="previous_examination_appeared" class="form-control" placeholder="Previous Exam Appeared" value="<?php if($previous_examination_appeared){echo $previous_examination_appeared;} else{} ?>" > 
                    </div>
                    <div class="form-group personal-info-w-5">
                        <label>Previous Exam Result:</label> 
                        <select  name="previous_exam_result" class="form-control" > 
                        <option>Select Result</option> 
                        <option value="<?php if($previous_exam_result=='pass'){echo $previous_exam_result; } else{echo 'pass';} ?>"<?php if($previous_exam_result=='pass'){echo 'selected'; } ?>  >Pass</option>
                        <option value="<?php if($previous_exam_result=='fail'){echo $previous_exam_result; } else{echo 'fail';} ?>"<?php if($previous_exam_result=='fail'){echo 'selected'; } ?>  >Fail</option></select>
                    </div>
                    <h3>Contact Information</h3>
                    <hr>
                    <div class="form-group contact-info-w-3">
                        <label>Email:</label> 
                        <input type="email" name="email" class="form-control" placeholder="Enter Your Email" value="<?php if($email){echo $email;} else{} ?>" > 
                    </div> 
                    <div class="form-group contact-info-w-3">
                        <label>Contact Number:</label> 
                        <input type="tel" name="phone_resi" class="form-control" placeholder="Enter Residential Contact Number" value="<?php if($phone_resi){echo $phone_resi;} else{} ?>" > 
                    </div>
                    <div class="form-group contact-info-w-3">
                        <label>Alternate Contact Number:</label> 
                        <input type="tel" name="phone_office" class="form-control" placeholder="Enter Office Contact Number" value="<?php if($phone_office){echo $phone_office;} else{} ?>" > 
                    </div>
                    <div class="form-group  w100">
                        <label for="Event Place">Residence Address: </label>
                        <textarea class="form-control" name="residence_address" rows="2" placeholder="Enter Residence Address" ><?php if($residence_address){echo $residence_address;} else{} ?></textarea>   
                    </div>
                    <div class="form-group w100">
                        <label for="Event Place">Parent Office Name And Address: </label>
                        <textarea name="office_name_address" class="form-control" placeholder="Parent Office Name And Address" row="2" ><?php if($office_name_address){echo $office_name_address;} else{} ?></textarea>
                    </div>
        

                    <!--</div>-->

        



                <div class="w100">
                    <div class="form-group">
                        <button type="submit" name="add_student" class="btn btn-success mr-2">Submit</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>