<?php 
$exam_head_id=$this->uri->segment('3');
$acedemic_session=$this->session->userdata('acedemic_session');
$ace_session_table='academic_session_details';
$get_acedemic_session_info=$this->NewExamModel->get_item_data($acedemic_session,$ace_session_table);
$year_long='';
$y1='';
$y2='';
if($get_acedemic_session_info){
    foreach($get_acedemic_session_info as $acedemic_session_info){
        $year_long=$acedemic_session_info['year_long'];
        $y1=$acedemic_session_info['y1'];
        $y2=$acedemic_session_info['y2'];
    }
}

$exam_head_table='exam_heads_'.$acedemic_session.'';
$get_exam_head_info=$this->NewExamModel->get_item_data($exam_head_id,$exam_head_table);
if($get_exam_head_info){
    foreach($get_exam_head_info as $exam_head_info){
?>

<div class="container-fluid mt-3 mb-3 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();?>Examination/Welcome">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Examination/dashboard">Exam</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Examination/course_exam_heads/<?php echo $exam_head_info['course_id']; ?>">Exam Head</a></li>
                <li class="breadcrumb-item">Update Exam Head</li>
            </ul>
            
            <form method="post" action="#">
                <h2 class="main-heading text-center">Update Exam Head</h2><hr>
                <?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 class="form-group">
                    <label>Acedemic Session</label>
                    <input type="hidden" name="acedemic_session" value="<?php echo $acedemic_session;?>" class="form-control">
                    <input type="text" name="acedemic_session_info" value="<?php echo $year_long;?>" class="form-control" readonly>
                </div>
                <div class="form-group">
                    <label>Exam Head</label>
                    <input type="hidden" name="exam_head_id" value="<?php echo $exam_head_id?>">
                    <input type="text" name="exam_head" class="form-control" value="<?php echo $exam_head_info['exam_head'];?>">
                </div>
                
                <div class="form-group">
                    <label>MM</label>
                    <input type="number" name="mm" class="form-control" value="<?php echo $exam_head_info['mm'];?>">
                </div>
                <div class="form-group">
                    <label>Exam Head Order</label>
                    <input type="number" name="exam_head_order" class="form-control" value="<?php echo $exam_head_info['head_order'];?>">
                </div>
                
                <div class="form-group">
                    <label>Exam Mode</label>
                    <select class="form-control" name="exam_mode">
                        <?php
                        $exam_table='all_exams';
                        $all_exams=$this->NewExamModel->get_data($exam_table);
                        if($all_exams){
                            foreach($all_exams as $exams){

                        ?>
                        <option value="<?php echo $exams['exam_type'];?>" <?php if($exam_head_info['exam_mode'] == $exams['exam_type']){echo "selected";}?>><?php echo $exams['exam_title'];?></option>
                        <?php
                            }
                        }
                        ?>
                        
                    </select>
                    
                </div>
                
                <div class="form-group">
                    <label>Freeze Column</label>
                    <select class="form-control" name="freeze">
                        <option value="1" <?php if($exam_head_info['freeze'] == 1){ echo "selected"; }?>>Yes</option>
                        <option value="0" <?php if($exam_head_info['freeze'] == 0){ echo "selected"; }?>>No</option>
                    </select>
                </div>
                
                <div class="form-group">
                    <button class="btn btn-sm btn-success" type="submit" name="update_fee_head_info">Update Exam Head</button>
                </div>
                
                
            </form>
            
        </div>
    </div>
</div>

<?php
    }
}
?>