<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:20%;
    }
</style>

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

$table="exam_subject_master_".$academic_session;
$get_subject_information=$this->ExamManagementModel->get_item_data($subject_id,$table);
if($get_subject_information){
    foreach($get_subject_information as $subject_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_subjects_master">Exam Subjet Master</a></li>
                <li class="breadcrumb-item">Update Subject Information</li>
            </ul>
            
            <div class="form-outer">
                <form method="post" action="#">
                    <h1 class="main-heading text-center">Update Subject Information</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>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($subject_data['class'] == $courses['course']){ echo "selected"; }?>><?php echo $courses['course']; ?></option>
                            <?php
                                }
                            }
                            ?>
                        </select>
                    </div>
                    <input type="hidden" name="subject_id" value="<?php echo $subject_id; ?>">
                    <div class="for-group w-25">
                        <label>Subject</label>
                        <input type="text" name="subject" class="form-control" placeholder="Subject" value="<?php echo $subject_data['subject']; ?>" required>
                    </div>
                    
                    <div class="for-group w-25">
                        <label>Subject Order</label>
                        <input type="number" name="subject_order" class="form-control" placeholder="Subject Order" min="1" value="<?php echo $subject_data['subject_order']; ?>" required>
                    </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($subject_data['status'] == "active"){ echo "selected"; }?>>Active</option>
                            <option value="inactive" <?php if($subject_data['status'] == "inactive"){ echo "selected"; }?>>Inactive</option>
                        </select>
                    </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 $subject_data['MM']; ?>">
                    </div>
                    
                    <div class="form-group w-25">
                        <label>Exam Type</label>
                        <select class="form-control" name="exam_type" required>
                            <option value="">--- Select Exam Type ---</option>
                            <option value="Marks" <?php if($subject_data['exam_type'] == "Marks"){ echo "selected"; }?>>Marks</option>
                            <option value="Grade" <?php if($subject_data['exam_type'] == "Grade"){ echo "selected"; }?>>Grade</option>
                        </select>
                    </div>
                    
                    <div class="form-group w-25">
                        <label>Subject Type</label>
                        <select class="form-control" name="subject_type" required>
                            <option value="">--- Select Subject Type ---</option>
                            <option value="Main Subject" <?php if($subject_data['subject_type'] == "Main Subject"){ echo "selected"; }?>>Main Subject</option>
                            <option value="Additional Subject" <?php if($subject_data['subject_type'] == "Additional Subject"){ echo "selected"; }?>>Additional Subject</option>
                        </select>
                    </div>
                    
                    <div class="form-group w-25">
                        <label>Academic Session</label>
                        <select class="form-control" name="academic_session" required>
                            <option value="<?php echo $academic_session; ?>"><?php echo $y1."-".$y2; ?></option>
                        </select>
                    </div>
                    
                    <div class="form-group w-25">
                        <!--<label>&nbsp;</label><br>-->
                        <button class="btn btn-sm btn-success" name="update_subject_information" type="submit">Submit</button>
                    </div>
                    
                    
                    <!--id 	 	subject 	status 	created_at 	created_by 	updated_at 	updated_by 	-->
                </form>
            </div>
            
            
        </div>
    </div>
</div>
<?php
    }
}
?>