<style>
    .form-outer{
        display:inline-block;
        width:100%;
    }
    
    .w-20{
        float:left;
        padding:10px;
        width:20%;
    }
    
    .w-25{
        float:left;
        padding:10px 10px 0px 10px;
        width:25%;
        height:90px;
    }
    
    .form-group{
        margin-bottom:0px !important;
    }
</style>

<?php
$exam_head_id=$this->uri->segment("3");
$academic_session=$this->session->userdata("acedemic_session");
$y1=$this->session->userdata("y1");
$y2=$this->session->userdata("y2");
$table="exam_head_master_".$academic_session;

$get_exam_head_data=$this->ExamManagementModel->get_item_data($exam_head_id,$table);
if($get_exam_head_data){
    foreach($get_exam_head_data as $eh_data){
?>
<div class="container-fluid 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(); ?>ExamManagement/exam_head_master">Exam Head Master</a></li>
                <li class="breadcrumb-item">Update Exam Head</li>
            </ul>
            
            <div class="form-outer">
                <form method="post" action="#">
                    <h1 class="main-heading text-center">Update Exam Head</h1><hr>
                    <div class="w-100">
                        <?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
                        }
                        ?>
                    </div>
                    <div class="form-group w-25">
                        <label>Academic Session</label>
                        <select class="form-control" name="academic_session" required>
                            <option value="">--- Select Academic Session ---</option>
                            <?php
                            $ac_sess_table="academic_session_details";
                            $all_academic_sessions=$this->ExamManagementModel->get_data($ac_sess_table);
                            if($all_academic_sessions){
                                foreach($all_academic_sessions as $ac_sess_data){
                                    if($ac_sess_data['id'] == $eh_data['academic_session']){
                            ?>
                            <option value="<?php echo $ac_sess_data['id']; ?>" selected><?php echo $ac_sess_data['year_long']; ?></option>
                            <?php            
                                    }else{
                            ?>
                            <option value="<?php echo $ac_sess_data['id']; ?>"><?php echo $ac_sess_data['year_long']; ?></option>
                            <?php                                                    
                                    }
                                }
                            }
                            ?>
                            
                        </select>
                    </div>
                    <input type="hidden" name="exam_head_id" value="<?php echo $exam_head_id; ?>">
                    <div class="form-group w-25">
                        <label>Class</label>
                        <select class="form-control" name="class" required>
                            <option value="">--- Select Class ---</option>
                            <?php
                            $courses_table="courses";
                            $all_classes=$this->NewFeeModel->get_class_list($courses_table);
                            if($all_classes){
                                foreach($all_classes as $courses){
                            ?>
                            <option value="<?php echo $courses['course']; ?>" <?php if($eh_data['class'] == $courses['course']){ echo "selected"; } ?>><?php echo $courses['course']; ?></option>
                            <?php
                                }
                            }
                            ?>
                        </select>
                    </div>
                    
                    <div class="for-group w-25">
                        <label>Exam Head</label>
                        <input type="text" name="exam_head" class="form-control" placeholder="Exam Head" value="<?php echo $eh_data['exam_head']; ?>" required>
                    </div>
                    
                    <div class="for-group w-25">
                        <label>Exam Head Order</label>
                        <input type="number" name="exam_head_order" class="form-control" placeholder="Exam Head Order" value="<?php echo $eh_data['head_order']; ?>" min="1" required>
                    </div>
                    
                    
                    
                    
                    <div class="form-group w-25">
                        <label>MM</label>
                        <input type="number" class="form-control" name="max_marks" placeholder="Max Marks" value="<?php echo $eh_data['mm']; ?>">
                    </div>
                    <div class="form-group w-25">
                        <label>Status</label>
                        <select class="form-control" name="status" required>
                            <option value="">--- Status ---</option>
                            <option value="active" <?php if($eh_data['status'] == "active"){ echo "selected"; }?>>Active</option>
                            <option value="inactive" <?php if($eh_data['status'] == "inactive"){ echo "selected"; }?>>Inactive</option>
                        </select>
                    </div>
                    <div class="form-group w-25">
                        <label>Exam </label>
                        <select class="form-control" name="exam_id" required>
                            <option value="">--- Exam Mode ---</option>
                            <?php
                            $exams_table="all_exams";
                            $academic_session=$this->session->userdata("acedemic_session");
                            $all_exams=$this->ExamManagementModel->get_exams($academic_session,$exams_table);
                            if($all_exams){
                                foreach($all_exams as $exams){
                            ?>
                            <option value="<?php echo $exams['id']; ?>" <?php if($eh_data['exam_id'] == $exams['id']){ echo "selected"; } ?>><?php echo $exams['exam_title']; ?></option>
                            <?php
                                }
                            }
                            ?>
                        </select>
                    </div>
                    
                    <div class="form-group w-25">
                        <label>Freeze</label>
                        <select class="form-control" name="freeze_status" required>
                            <option value="">--- Select Freeze Status ---</option>
                            <option value="Yes" <?php if($eh_data['freeze'] == "Yes"){ echo "selected"; } ?>>Yes</option>
                            <option value="No" <?php if($eh_data['freeze'] == "No"){ echo "selected"; } ?>>No</option>
                        </select>
                    </div>
                    
                    
                    
                    <div class="form-group w-25">
                        <!--<label>&nbsp;</label><br>-->
                        <button class="btn btn-sm btn-success" name="update_exam_head" type="submit">Submit</button>
                    </div>
                    
                    
                    <!--id 	 	subject 	status 	created_at 	created_by 	updated_at 	updated_by 	-->
                </form>
            </div>
            
            
        </div>
    </div>
</div>
<?php
    }
}
?>