<style>
    body{background:#EAEDED;}
    h1{font-size:18px;}
</style>

<?php
$enq_id=$this->uri->segment('3');
$table='enquiry';
$get_enquiry_data=$this->EnquiryModel->get_item_info($enq_id,$table);
if($get_enquiry_data){
    foreach($get_enquiry_data as $data){
        
?>
<div class="container bg-white mt-3">
    <div class="row">
        <div class="col-sm-12">
            <div class="p-3">
                <h1 class="text-center">Convert enquiry to admission</h1>
                <form method="post" action="#">
                    <?php
                    if($success){
                        ?>
                        <p class="alert alert-success"><?php echo $success;?></p>
                        <?php
                    }
                    
                    if($error){
                        ?>
                        <p class="alert alert-danger"><?php echo $error;?></p>
                        <?php
                    }
                    
                    ?>
                    <div class="form-group">
                        <label>Name</label>
                        <input type="text" class="form-control" value="<?php echo $data['first_name']; echo " "; echo $data['last_name']; ?>" readonly>
                    </div>
                    <div class="form-group">
                        <label>Father Name</label>
                        <input type="text" name="father_name" class="form-control" placeholder="" value="<?php echo $data['father_name'];?>">
                    </div>
                    <div class="form-group">
                        <label>Class</label>
                        <select class="form-control" name="course_id" required>
                            <option value="">-- select course --</option>
                            <?php
                            $table='courses';
                            $get_courses=$this->EnquiryModel->get_table_data($table);
                            if($get_courses){
                                foreach($get_courses as $courses){
                                    ?>
                                    <option value="<?php echo $courses['id'];?>"  <?php if($data['course_id'] == $courses['id']){echo "selected";} ?> ><?php echo $courses['course']; echo " "; echo $courses['subject_stream'];?></option>
                                    <?php
                                }
                            }
                            ?>
                            
                            
                        </select>
                    </div>
                        <div class="form-group">
                            <label>Section</label>
                            <select class="form-control" name="section" >
                                <option value="A" <?php if($data['section'] == 'A'){echo "selected";} ?>>A</option>
                                <option value="B" <?php if($data['section'] == 'B'){echo "selected";} ?>>B</option>
                                <option value="C" <?php if($data['section'] == 'C'){echo "selected";} ?>>C</option>
                                <option value="D" <?php if($data['section'] == 'D'){echo "selected";} ?>>D</option>
                            </select>
                    </div>
                    
                    <div class="form-group">
                        <label>Add Student to acedemic session</label>
                        <select class="form-control" name="acedemic_session" required>
                            <option value="">-- select acedemic session --</option>
                            <?php 
                            $acd_table='academic_session_details';
                            $get_session_data=$this->EnquiryModel->get_table_data($acd_table);
                            if($get_session_data){
                                foreach($get_session_data as $session_data){
                                    ?>
                                    <option value="<?php echo $session_data['id'];?>" <?php if($session_data['status'] == 1){echo "Selected";}?>><?php echo $session_data['year_long'];?></option>
                                    <?php
                                }
                            }
                            ?>
                            
                        </select>
                    </div>
                    <div class="form-group">
                        <input type="hidden" value="<?php echo $data['id'];?>" name="enquiry_id">
                    </div>
                    
                    <div class="form-group">
                        <input type="submit" name="convert_to_admission" class="btn btn-sm btn-success" value="Add Student">
                    </div>
                    
                </form>
                
            </div>
        </div>
    </div>
</div>

<?php
    }
}
?>