<style>
body{background:#EAEDED;}
.breadcrumb .breadcrumb-item a{text-decoration:none;}
#wrapper {overflow-x: hidden;}
#sidebar-wrapper {min-height: 100vh;margin-left: -15rem;-webkit-transition:margin .25s ease-out;-moz-transition: margin .25s ease-out;-o-transition:margin .25s ease-out;transition: margin .25s ease-out;}
#sidebar-wrapper .sidebar-heading {padding: 0.875rem 1.25rem;font-size: 1.2rem;}
#sidebar-wrapper .list-group {width: 15rem;}
#page-content-wrapper {min-width: 100vw;}
#wrapper.toggled #sidebar-wrapper {margin-left: 0;}
@media (min-width: 768px) {
#sidebar-wrapper {margin-left: 0;}
#page-content-wrapper {min-width: 0;width: 100%;}
#wrapper.toggled #sidebar-wrapper {margin-left: -15rem;}
}
.header-item{width:50%;float:left;text-align:left;}
.header-item-1{width:50%;float:left;text-align:right;}
@media screen and (max-width: 767px){
.header-item{width:40%;float:left;}
.header-item-1{width:30%;float:left;}
}
</style>


<div class="d-flex" id="wrapper">

    <!-- Sidebar -->
    <div class="bg-light border-right" id="sidebar-wrapper">
        <div class="sidebar-heading text-success" style="font-size:16px;font-weight:600;border-bottom:2px solid green;">
            <i class="fa fa-fw fa-user"></i> <?php echo $this->session->userdata('teacher_name'); ?>
        </div>
        <div class="list-group list-group-flush">
            <select name="ac_session" class="list-group-item list-group-item-action bg-light ac_session" style="border-radius:none;box-shadow:unset;outline:0;">    
                <?php 
                $acedemic_session_table='academic_session_details';
                $acedemic_session=$this->session->userdata('acedemic_session');
                $acedemic_session_data=$this->NewFeeModel->get_data($acedemic_session_table);
                if($acedemic_session_data){
                    foreach($acedemic_session_data as $session_data){
                ?>

                <option value="<?php echo $session_data['id']; ?>" <?php if($session_data['id'] == $acedemic_session){ echo "selected";} ?> ><?php echo $session_data['year_long'];?></option>

                <?php
                    }
                }   
                ?>
            </select>    


            <a href="<?php echo base_url();?>Welcome" class="list-group-item list-group-item-action bg-light"><svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-house-door-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
            <path d="M6.5 10.995V14.5a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-7a.5.5 0 0 1 .146-.354l6-6a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 .146.354v7a.5.5 0 0 1-.5.5h-4a.5.5 0 0 1-.5-.5V11c0-.25-.25-.5-.5-.5H7c-.25 0-.5.25-.5.495z"/>
            <path fill-rule="evenodd" d="M13 2.5V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
            </svg> Home</a>

            <a href="<?php echo base_url();?>school/profile" class="list-group-item list-group-item-action bg-light"><svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-person" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
            <path fill-rule="evenodd" d="M10 5a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm6 5c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"/></svg> Profile</a>
            <?php
            $table='school_staff';
            // $this->session->userdata('user_name');
            $user_id=$this->session->userdata('tid');
            $get_user_data=$this->WelcomeModel->get_item_data($user_id,$table);
            if($get_user_data){
                foreach($get_user_data as $data){
                    $admin=$data['admin'];
                    $school_management=$data['school_management'];
                    $all_permission=$data['all_permission'];
                    $fee_permission=$data['fee_permission'];
                    $doc_permission=$data['documents'];

                    if($fee_permission ==1 || $admin == 1 || $all_permission==1 || $school_management==1){
            ?>


            <a href="<?php echo base_url();?>Fee/all_students" class="list-group-item list-group-item-action bg-light">
                <span>Fee</span>	
            </a>

            <a href="<?php echo base_url();?>Fee/defaulters" class="list-group-item list-group-item-action bg-light"><span>Fee Defaulters</span></a>

            <a href="<?php echo base_url();?>Transport/routes" class="list-group-item list-group-item-action bg-light"><span>Transport</span></a>
            <a href="<?php echo base_url();?>Certificate/dashboard" class="list-group-item list-group-item-action bg-light">Documents</a>
            <a href="<?php echo base_url();?>Enquiry/list_enquiry" class="list-group-item list-group-item-action bg-light"><span>Enquiry</span></a>
            <a href="<?php echo base_url();?>School/students" class="list-group-item list-group-item-action bg-light"><span>Student </span></a>
            <?php
                    }
                    if($admin == 1 || $all_permission==1 || $school_management==1 ){
            ?>
            <a href="<?php echo base_url();?>Examination/dashboard" class="list-group-item list-group-item-action bg-light">Exam</a>

            <!--<a href="<?php echo base_url();?>school/schoolprofile" class="list-group-item list-group-item-action bg-light"><svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-person" fill="currentColor" xmlns="http://www.w3.org/2000/svg">-->
            <!--  <path fill-rule="evenodd" d="M10 5a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm6 5c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"/>-->
            <!--</svg>School Profile</a>-->
 
            <a href="<?php echo base_url();?>School/circular" class="list-group-item list-group-item-action bg-light"><span>Circulars </span></a>
            <a href="<?php echo base_url();?>School/courses" class="list-group-item list-group-item-action bg-light"><span>Courses </span></a>


            <a href="<?php echo base_url();?>Management/drop_out_list" class="list-group-item list-group-item-action bg-light text-success"><span>Drop Out List</span></a>


            <a href="<?php echo base_url();?>Management/view_staff" class="list-group-item list-group-item-action bg-light"><span>Staff</span></a>

            <a href="<?php echo base_url();?>Enquiry/all_courses" class="list-group-item list-group-item-action bg-light"><span>New Admissions</span></a>
            <!--<a href="<?php echo base_url();?>School/Staff" class="list-group-item list-group-item-action bg-light"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-diagram-3-fill" viewBox="0 0 16 16">-->
            <!--  <path fill-rule="evenodd" d="M6 3.5A1.5 1.5 0 0 1 7.5 2h1A1.5 1.5 0 0 1 10 3.5v1A1.5 1.5 0 0 1 8.5 6v1H14a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-1 0V8h-5v.5a.5.5 0 0 1-1 0V8h-5v.5a.5.5 0 0 1-1 0v-1A.5.5 0 0 1 2 7h5.5V6A1.5 1.5 0 0 1 6 4.5v-1zm-6 8A1.5 1.5 0 0 1 1.5 10h1A1.5 1.5 0 0 1 4 11.5v1A1.5 1.5 0 0 1 2.5 14h-1A1.5 1.5 0 0 1 0 12.5v-1zm6 0A1.5 1.5 0 0 1 7.5 10h1a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 8.5 14h-1A1.5 1.5 0 0 1 6 12.5v-1zm6 0a1.5 1.5 0 0 1 1.5-1.5h1a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5v-1z"/></svg>  <span>Attendance</span>-->
            <!--</a>-->
            <a href="<?php echo base_url();?>Fee/all_acedemic_sessions" class="list-group-item list-group-item-action bg-light"><span>Academic Sessions</span></a>
            
            <a href="<?php echo base_url();?>Student/view_student" class="list-group-item list-group-item-action bg-light"><span>Others</span></a>
            <a href="<?php echo base_url();?>Settings" class="list-group-item list-group-item-action bg-light"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"/></svg></a>
            <?php 
                }


                if($data['class_teacher'] !=''){
            ?>

            <a href="<?php echo base_url();?>School/circular" class="list-group-item list-group-item-action bg-light"><i class="fas fa-file-alt"></i>  <span>Circulars </span></a>
            <a href="<?php echo base_url();?>Student/my_class_students" class="list-group-item list-group-item-action bg-light">
                <span>Student </span></a>
            <?php
            $acedemic_session_table='academic_session_details';
            $acedemic_session=$this->session->userdata('acedemic_session');
            $active_acedemic_session='';
            $acedemic_session_data=$this->NewFeeModel->get_data($acedemic_session_table);
            if($acedemic_session_data){
                foreach($acedemic_session_data as $session_data){
    
                    if($session_data['status'] ==1){
                        $active_acedemic_session=$session_data['id'];
                    }
                }
            }
            if($active_acedemic_session == $acedemic_session){
            ?>



            <a href="<?php echo base_url();?>Teacher/daily_attendence" class="list-group-item list-group-item-action bg-light"><span>Attendance</span>	</a>
            <?php
            }else{
            ?>
            <a href="<?php echo base_url();?>Teacher/attendance_history" class="list-group-item list-group-item-action bg-light"><span>Attendance</span></a>
        <?php
        }

        ?>




        <a href="<?php echo base_url();?>Fee/my_class_students" class="list-group-item list-group-item-action bg-light"><span>Fee </span></a>
        <a href="#" class="list-group-item list-group-item-action bg-light"><span>Result</span>	</a>    
        <a href="<?php echo base_url();?>Examination/my_class_students" class="list-group-item list-group-item-action bg-light">
            <span>Exam</span>	
        </a>
        <a href="#" class="list-group-item list-group-item-action bg-light">
            <span>Education</span>	
        </a>

        <?php  
                }
            }
        }
        ?>

        <a href="<?php echo base_url();?>Logout" class="list-group-item list-group-item-action bg-light"><span> Logout </span>  <i style="margin-left: 15px;" class="fas fa-sign-out-alt"></i>  </a>
        </div>
</div>

<!-- /#sidebar-wrapper -->

<!-- Page Content -->
<div id="page-content-wrapper">

<nav class="navbar navbar-expand-lg navbar-light" style="background-color:white;">
<button class="btn btn-primary" id="menu-toggle" style="background:white; border-color:white;"><span class="navbar-toggler-icon"></span></button>
<span class=" font-weight-bold p-1  header-item" style="color:#4fa746;"> <?php echo school_full_name;?></span>
<span class="font-weight-bold header-item-1">

</span>
</nav>
<script>

$(document).ready(function(){
    $(".ac_session" ).change(function() {
        var ac_session_id = $(".ac_session").val();
        $.ajax({
            url: '<?php echo base_url() ?>Welcome/change_ac_session',
            type: 'POST', 
            data: {ac_session_id:ac_session_id},
            success: function(data){
                // swal("Changed Successfully");
                location.reload(); 
            }
        });
    });
});

</script>

<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>