<style>
    .main-heading{font-size:26px;font-weight:600;}
    form{box-shadow:0 0 4px silver;padding:15px;margin-bottom:15px;}
    .w-25{
        float:left;
        padding:5px 10px;
    }
</style>
<div class="container-fluid bg-white mt-3">
    <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">ExamManagement</a></li>
                <li class="breadcrumb-item">Add Working Days</li>
            </ul>
            
            <form method="post" action="#" class="form-outer">
                
                <div class="w-100" style="display:inline-block;">
                    <h1 class="main-heading">Add Working Days</h1><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 w-25">
                    <label>Exam</label>
                    <select class="form-control" name="exam">
                        <option value="">-- Select Exam --</option>
                        <?php 
                        $exam_table='all_exams';
                        $all_exams=$this->ExamManagementModel->get_data($exam_table);
                        if($all_exams){
                            foreach($all_exams as $exams){
                                if($exams['acedemic_session'] == $this->session->userdata('acedemic_session')){
                        ?>
                        <option value="<?php echo $exams['id']; ?>"><?php echo $exams['exam_title']; ?></option>
                        <?php
                                }
                            }
                        }
                        ?>
                    </select>
                </div>
                <div class="form-group w-25">
                    <label>Course</label>
                    <select class="form-control" name="course" required>
                        <option value="">--Select Course--</option>
                        <?php
                        $courses_table='courses';
                        $all_courses=$this->ExamManagementModel->get_data($courses_table);
                        if($all_courses){
                            foreach($all_courses as $course_data){
                        ?>
                        <option value="<?php echo $course_data['id']; ?>"><?php echo $course_data['course'].' '.$course_data['subject_stream']; ?></option>
                        <?php
                            }
                        }
                        ?>
                    </select>
                </div>
                
                <div class="form-group w-25">
                    <label>Working Days</label>
                    <input type="number" name="working_days" class="form-control" placeholder="Working Days">
                </div>
                <div class="form-group w-25">
                    <label>Academic Session</label>
                    <select class="form-control" name="academic_session">
                        <option value="<?php echo $this->session->userdata('acedemic_session'); ?>"><?php echo $this->session->userdata('y1')."-".$this->session->userdata('y2'); ?></option>
                    </select>
                </div>
                <div class="form-group w-25">
                    <!--<br><br>-->
                    <button type="submit" name="add_working_days" class="btn btn-sm btn-success">Submit</button>
                </div>
                
                </div>
            </form>
            
            <div class="table-responsive mt-3">
                <table class="table table-bordered table-striped" id="mytable">
                    <thead>
                        <tr>
                            <th class="sl_no">Sl.No.</th>
                            <th>Exam</th>
                            <th>Course</th>
                            <th>Working Days</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $i=0;
                        $academic_session=$this->session->userdata("acedemic_session");
                        $get_session_exam_working_days=$this->ExamManagementModel->get_session_exam_courses_data($academic_session);
                        if($get_session_exam_working_days){
                            foreach($get_session_exam_working_days as $working_days){
                                $i=$i + 1;
                        ?>
                        <tr>
                            <td><?php echo $i; ?></td>
                            <td><?php echo $working_days['exam_title']; ?></td>
                            <td><?php echo $working_days['course']." ".$working_days['subject_stream']; ?></td>
                            <td><?php echo $working_days['working_days']; ?></td>
                            <td></td>
                        </tr>
                        <?php
                            }
                        }
                        ?>
                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
</div>