<style>
    h1{font-size:22px;text-align:center;font-weight:700;}
</style>
<?php


$doc_id=$this->uri->segment('3');
$acedemic_session=$this->session->userdata('acedemic_session');
$tc_table='student_transfer_certificate';
$get_student_info=$this->CertificateModel->get_item_data($doc_id,$tc_table);
if($get_student_info){
    foreach($get_student_info as $student_info){
        $sid=$student_info['sid'];
        $acedemic_session=$student_info['acedemic_session'];
        $active_course_id='';
        // $get_active_course_info=$this->CertificateModel->student_course_data($sid,$acedemic_session);
        // if($get_active_course_info){
        //     foreach($get_active_course_info as $course_info){
        //         $active_course_id=$course_info['course_id'];
        //     }
        // }
$doc_type='Student-Transfer-Certificate';
$doc_table='student_transfer_certificate';
?>
<div class="container mt-3 mb-3 pt-3 pb-3 bg-white">
    <div class="row">
        <div class="col-sm-12">
            
            <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();?>Certificate/dashboard">Certificate</a></li>
                
                <li class="breadcrumb-item"><a href="#">Update Transfer Certificate</a></li>
            </ul>
            
            
            
            <form method="post" action="#">
                <h1>Issue Student Transfer Certificate</h1>
                <?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
                }
                
                ?>
                <hr>
                <div class="form-group">
                    <label>Scholor Number</label>
                    <input type="number" name="sch_no" value="<?php echo $student_info['sch_no']; ?>" class="form-control">
                </div>
                <div class="form-group">
                    <label>Student Name</label>
                    <input type="hidden" name="sid" value="<?php echo $sid;?>">
                    <input type="text" name="student_name" class="form-control" value="<?php echo $student_info['student_name'];?>" readonly>
                </div>
                <div class="form-group">
                    <label>Father's Name</label>
                    <select class="form-control" name="salutation">
                        <option value="Mr.">Mr.</option>
                    </select>
                    <input type="text" name="father_name" class="form-control mt-3" value="<?php echo $student_info['father_name'];?>" readonly>
                </div>
                
                <div class="form-group">
                    <label>Gender</label>
                    <select class="form-control" name="gender" required>
                        <option value="">-- select gender --</option>
                        <option value="male" <?php if($student_info['gender'] =="male"){echo "selected";}?>>Male</option>
                        <option value="female" <?php if($student_info['gender'] =="female"){ echo "selected"; }?> >Female</option>
                    </select>
                </div>
                
                <div class="form-group">
                    <label>Course</label>
                    
                    <input type="text" name="course" class="form-control" value="<?php echo $student_info['course']; ?>">
                </div>
                
                <div class="form-group">
                    <label>Document Type</label>
                    <select class="form-control" name="doc_type">
                        <option value="Student-Transfer-Certificate">Student Transfer Certificate</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>Document Copy</label>
                    <input type="text" name="doc_copy_order" value="<?php echo $student_info['doc_copy_order']; ?>" readonly class="form-control">
                    
                </div>
                    
                <div class="form-group">
                    <label>D.O.B. :</label>
                    <input type="date" name="dob" value="<?php echo date('Y-m-d',strtotime($student_info['dob']));?>" class="form-control" required> 
                    <br>
                    <input type="text" name="dob_in_words" class="form-control" value="<?php echo $student_info['dob_in_words'];?>" placeholder="Date of birth in words">
                </div>
                 
                <div class="form-group">
                    <label>Issuing Date</label>
                    <input type="date" class="form-control" name="issuing_date" value="<?php echo date('Y-m-d',strtotime($student_info['school_leaving_date'])); ?>" required>
                </div> 
             
                <div class="form-group">
                    <label>Acedemic Session</label>
                    <select class="form-control" name="acedemic_session" required>
                        <?php
                        $acedemic_session_table='academic_session_details';
                        $all_ac_sessions=$this->CertificateModel->get_data($acedemic_session_table);
                        if($all_ac_sessions){
                            foreach($all_ac_sessions as $ac_sessions){
                        ?>
                        <option value="<?php echo $ac_sessions['id'];?>" <?php if($ac_sessions['id'] == $acedemic_session){echo "selected";}?>><?php echo $ac_sessions['year_long'];?></option>
                        <?php
                            }
                        }
                        ?>
                        
                        
                    </select>
                </div>
                
                <div class="form-group">
                    <label>Doc. Fee</label>
                    <input type="number" class="form-control" name="doc_fee" placeholder="Doc. Fee" required>
                </div>
                
                <div class="form-group">
                    <label>Admission Date </label>
                    <input type="date" name="admission_date" class="form-control" value="<?php if($student_info['admission_date']){ echo date('Y-m-d',strtotime($student_info['admission_date'])); }?>">
                </div>
                
                <div class="form-group">
                    <label>Previous School</label>
                    <input type="text" name="previous_school" class="form-control" placeholder="Previous School" value="<?php echo $student_info['previous_school'];?>">
                </div>
                
                <div class="form-group">
                    <label>School Leaving Date</label>
                    <input type="date" name="school_leaving_date" class="form-control">
                </div>
                
                <div class="form-group">
                    <label>School Affiliation</label>
                    <input type="text" name="school_stream" class="form-control" value="ICSE" readonly>
                </div>
                
                <div class="form-group">
                    <label>Acedemic Year Start</label>
                    <input type="text" name="ac_year_start" class="form-control" placeholder="Acedemic Year Start">
                </div>
                
                <div class="form-group">
                    <label>Acedemic Year End</label>
                    <input type="text" name="ac_year_end" class="form-control" placeholder="Acedemic Year End">
                </div>
                
                <div class="form-group">
                    <label>Charcter Info</label>
                    <input type="text" name="charcter_info" class="form-control" placeholder="Charcter Info" value="Good">
                </div>
                
                <div class="form-group">
                    <label>Promotion</label>
                    <input type="text" value="Granted" class="form-control" name="promotion">
                </div>
                
                
                
                <div class="form-group">
                    <button type="submit" class="btn btn-sm btn-info" name="issue_transfer_certificate">Issue</button>
                </div>      
            </form>
            
        </div>
    </div>
</div>

<?php
    }
}
?>