<?php
$table='school_staff';
// $this->session->userdata('user_name');
$user_id=$this->session->userdata('tid');
$acedemic_session=$this->session->userdata('acedemic_session');
$active_acedemic_session=$this->session->userdata('active_acedemic_session');
$ac_year=$this->session->userdata('ac_year');

// $fee_permission=$this->session->userdata('fee_permission');
// $school_management=$this->session->userdata('school_management');
// $all_permission=$this->session->userdata('all_permission');
// $attendence=$this->session->userdata('attendence');
// $doc_permission=$this->session->userdata('documents');
// $admin=$this->session->userdata('admin');

$user=$this->session->userdata('user');
$teacher_name=$this->session->userdata('teacher_name');
$tid=$this->session->userdata('tid');
$class_teacher=$this->session->userdata('class_teacher');
$class_teacher_section=$this->session->userdata('class_teacher_section');
$y1=$this->session->userdata('y1');
$y2=$this->session->userdata('y2');
                                    
// $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'];
//     }
// }
            

$this->load->view('newtheme/navbar'); 


$staff_permission_table="staff_permissions";
$get_staff_permissions=$this->NewFeeModel->get_staff_permissons($tid,$staff_permission_table);
        
        
$accounts=0;
$student_attendance=0;
$staff_attendance=0;
$courses=0;
$enquiry=0;
$admission=0;
$fee_structure=0;
$exam=0;
$fee=0;
$documents=0;
$staff=0;
$transport=0;
$students=0;
$fee_defaulter=0;
$delete_fee_invoice=0;
$delete_student=0;
$acedemic_session_permission=0;
$circular=0;
$admin=0;
$time_table=0;
if($get_staff_permissions){
    foreach($get_staff_permissions as $per_data){
        $accounts= $per_data['accounts'];
        $student_attendance	=$per_data['student_attendance'];
        $staff_attendance	=$per_data['staff_attendance'];
        $courses    = $per_data['courses'];
        $enquiry    = $per_data['enquiry'];
        $admission  = $per_data['admission'];
        $fee_structure	= $per_data['fee_structure'];
        $exam	=$per_data['exam'];
        $fee=$per_data['fee'];
        $documents=$per_data['documents'];
        $staff	=$per_data['staff'];
        $transport	=$per_data['transport'];
        $students	=$per_data['students'];
        $fee_defaulter	=$per_data['fee_defaulter'];
        $delete_fee_invoice	=$per_data['delete_fee_invoice'];
        $delete_student=$per_data['delete_student'];
        
        $acedemic_session_permission=$per_data['acedemic_session'];
        $circular=$per_data['circular'];
        $admin=$per_data['admin'];
        $time_table=$per_data['time_table'];
    }
}
?>
 <!-- partial:partials/_sidebar.html -->
<nav class="sidebar sidebar-offcanvas" id="sidebar">
    <ul class="nav">
        <li class="nav-item">
             
            <a class="nav-link" data-toggle="collapse" href="#acedemic-session" aria-expanded="false" aria-controls="acedemic-session">
                <i class="icon-layout menu-icon"></i>
                <span class="menu-title"><?php echo $this->session->userdata('ac_year'); ?></span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="acedemic-session">
                <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 $data){
                ?>

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

                <?php
                    }
                }   
                ?>
                </select>   
            </div>
        </li>
        
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>Welcome">
              <i class="icon-grid menu-icon"></i>
              <span class="menu-title">Home</span>
            </a>
        </li>
        <?php 
        // if($fee_permission ==1 || $admin == 1 || $all_permission==1 || $school_management==1){
        
        if($accounts == 1){
        ?>  
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Accounts" aria-expanded="false" aria-controls="exam">
              <i class="icon-bar-graph menu-icon"></i>
              <span class="menu-title">Accounts</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Accounts">
              <ul class="nav flex-column sub-menu">
                <li class="nav-item"> <a class="nav-link" href="<?php echo base_url();?>Accounts">Accounts</a></li>
              </ul>
            </div>
        </li>
        <?php 
        }
        
        if($acedemic_session_permission == 1){


        ?>  
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#error" aria-expanded="false" aria-controls="error">
                <i class="icon-ban menu-icon"></i>
                <span class="menu-title">Acedemic Session</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="error">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Fee/add_acedemic_session"> Add New Ac. Session</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Fee/all_acedemic_sessions"> All Ac. Sessions </a></li>
                </ul>
            </div>
        </li>
        <?php 
        }
        
        if($student_attendance== 1 || $staff_attendance == 1){
        ?>
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#auth" aria-expanded="false" aria-controls="auth">
                <i class="icon-head menu-icon"></i>
                <span class="menu-title">Attendance</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="auth">
                <ul class="nav flex-column sub-menu">
                    <?php 
                    if($staff_attendance == 1){
                    ?>
                    <li class="nav-item"> <a class="nav-link" href="#"> Staff Attendance </a></li>
                    <?php 
                    }
                    if($student_attendance== 1){
                    ?>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/attendance">Student Attendance </a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/attendance_history">Student Attendance History</a></li>
                    <?php 
                    }
                    ?>
                </ul>
            </div>
        </li>
        <?php 
        }
        if($circular == 1){
        ?>  
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>School/circular">
                <i class="icon-paper menu-icon"></i>
                <span class="menu-title">Circular</span>
            </a>
        </li>
        <?php 
        }
        if($courses){
        ?>
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#icons" aria-expanded="false" aria-controls="icons">
                <i class="icon-contract menu-icon"></i>
                <span class="menu-title">Courses</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="icons">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>School/add_courses">Add New Courses</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>School/courses">All Courses</a></li>
                </ul>
            </div>
        </li>
        <?php 
        }
        if($documents == 1){
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>Certificate/dashboard">
                <i class="icon-paper menu-icon"></i>
                <span class="menu-title">Documentation</span>
            </a>
        </li>
          
        <?php 
        }
        if($enquiry == 1){
        ?>
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Enquiry" aria-expanded="false" aria-controls="form-elements">
              <i class="icon-columns menu-icon"></i>
              <span class="menu-title">Enquiry</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Enquiry">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Enquiry/new_enquiry">New Enquiry</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url();?>Enquiry/list_enquiry">All Enquiry</a></li>
                </ul>
            </div>
        </li> 
        <?php 
        }
        
        if($exam == 1){
        ?>
        
        <!--<li class="nav-item">-->
        <!--    <a class="nav-link" data-toggle="collapse" href="#exam" aria-expanded="false" aria-controls="exam">-->
        <!--        <i class="icon-bar-graph menu-icon"></i>-->
        <!--        <span class="menu-title">Exam</span>-->
        <!--        <i class="menu-arrow"></i>-->
        <!--    </a>-->
        <!--    <div class="collapse" id="exam">-->
        <!--        <ul class="nav flex-column sub-menu">-->
        <!--            <li class="nav-item"> <a class="nav-link" href="<?php echo base_url();?>Examination/dashboard">Exam</a></li>-->
        <!--            <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Examination/all_classes">I-Term Exam</a></li>-->
        <!--            <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Examination/second_term_exam">II-Term Exam</a></li>-->
        <!--            <li class="nav-item">-->
        <!--                <a class="nav-link" href="<?php echo base_url(); ?>Examination/exam_wise_courses/4">Annual Exam</a>-->
        <!--            </li>-->
        <!--        </ul>-->
        <!--    </div>-->
        <!--</li>-->
        
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Examination" aria-expanded="false" aria-controls="Examination">
                <i class="icon-bar-graph menu-icon"></i>
                <span class="menu-title">Examination</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Examination">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item">
                        <a href="<?php echo base_url(); ?>ExamManagement" class="nav-link">Examination</a>
                    </li>
                    <li class="nav-item">
                        <a href="<?php echo base_url(); ?>ExamManagement/working_days" class="nav-link">Working Days</a>
                    </li>
                    
                    <li class="nav-item">
                        <a href="<?php echo base_url(); ?>ExamManagement/remarks" class="nav-link">Exam Remarks</a>
                    </li>
                    <li class="nav-item">
                        <a href="<?php echo base_url(); ?>ExamManagement/exam_subjects_master" class="nav-link">Subject Master</a>
                    </li>
                    <li class="nav-item">
                        <a href="<?php echo base_url(); ?>ExamManagement/exam_head_master" class="nav-link">Exam Head Master</a>
                    </li>
                </ul>
            </div>
        </li>
        
        
        <?php 
        }
        
        if($fee == 1 || $admin== 1){
        ?>
        
        
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Fee" aria-expanded="false" aria-controls="Fee">
              <i class="icon-columns menu-icon"></i>
              <span class="menu-title">Fee</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Fee">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/open_scanner">Open Scanner</a></li>
                    <!--<li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>OpeningFee">Opening Fee</a></li>-->
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/all_students">Pay Fee</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/defaulters">Fee Defaulters</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>FeeManagement">Fee Collection</a></li>
                    <li class="nav-item">
                        <a class="nav-link" href="<?php echo base_url(); ?>Fee/invoice_filter">Invoice Search <span class="text-danger"><sup>(NEW)</sup></span></a>
                    </li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/cy_invoices">CY Fee Invoices</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/invoices">All Fee Invoices</a></li>
                    <li class="nav-item"><a href="<?php echo base_url(); ?>Enquiry/invoices" class="nav-link">Enquiry Fee Invoices</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>OpeningFee/all_invoices">Opening Fee Invoices</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>Fee/deleted_invoices">Fee Deleted Invoices</a></li>
                    <li class="nav-item"><a class="nav-link" href="<?php echo base_url(); ?>OpeningFee/deleted_invoices">Opening Fee Deleted Invoices</a></li>
                </ul>
            </div>
        </li>
        <?php 
        }
        if($student_attendance== 1 || $staff_attendance == 1){
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>Holiday">
                <i class="icon-columns menu-icon"></i>
                <span class="menu-title">Holiday</span>
            </a>
        </li>
        <?php
        }
        
        if($fee == 1){
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>Fee/rte_students" aria-expanded="false" >
              <i class="icon-columns menu-icon"></i>
              <span class="menu-title">RTE Students</span>
              <!--<i class="menu-arrow"></i>-->
            </a>
        </li> 
        <?php
        }
        if($students == 1){
        ?>
        
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Students" aria-expanded="false" aria-controls="Students">
                <i class="icon-head menu-icon"></i>
                <span class="menu-title">Students</span>
                    <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Students">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url();?>School/students">All Students</a></li>
                </ul>
            </div>
        </li>
        <?php 
        }
        
        
        // }
        // if($admin == 1 || $all_permission==1 || $school_management==1 ){
        
        
        if($staff == 1){
        ?>  
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#tables" aria-expanded="false" aria-controls="tables">
                <!--<i class="icon-grid-2 menu-icon"></i>-->
                <i class="icon-head menu-icon"></i>
                <span class="menu-title">Staff</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="tables">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/view_staff">All Staff</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/add_teacher">Add Staff</a></li>
                
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/all_active_staff">Class Teachers</a></li>
                
                
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/add_class_teacher">Add Class Teachers</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Management/official_permissions">Permissions</a></li>
                </ul>
            </div>
        </li>
        <?php 
        }
        
        
        
        
        
        if($time_table == 1){
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>TimeTableManagement">
                <i class="icon-paper menu-icon"></i>
                <span class="menu-title">Time Table</span>
            </a>
        </li>
        <?php 
        }
        if($transport == 1){
        ?>
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#transport" aria-expended="false" aria-controls="transport">
                <i class="icon-columns menu-icon"></i>
                <span class="menu-title">Transport</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="transport">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/routes">Transport Routes</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/vehicles">Vehicles</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/drivers">Drivers</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/students">Students</a></li>
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/invoices">Invoices</a></li>
                    
                    <li class="nav-item"> <a class="nav-link" href="<?php echo base_url(); ?>Transport/deleted_invoices">Deleted Invoices</a></li>
                    
                </ul>
            </div>
        </li>
        <?php 
        }
        
        // Class Teacher Section
        if($class_teacher !=''){
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url(); ?>Student/my_class_students">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Students</span>
            </a>
         </li>
        <!--<li class="nav-item">-->
        <!--    <a class="nav-link" href="<?php echo base_url(); ?>School/circular">-->
        <!--      <i class="icon-paper menu-icon"></i>-->
        <!--      <span class="menu-title">Circular</span>-->
        <!--    </a>-->
        <!-- </li>-->
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#Attendance" aria-expanded="false" aria-controls="Attendance">
              <i class="icon-head menu-icon"></i>
              <span class="menu-title">Attendance</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="Attendance">
              <ul class="nav flex-column sub-menu">
                <?php 
                if($active_acedemic_session == $acedemic_session){
                ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo base_url();?>Teacher/daily_attendence">
                        
                        <span class="menu-title">Attendance</span>
                    </a>
                </li>
                <?php 
                    }else{
                ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo base_url();?>Teacher/attendance_history">
                        
                        <span class="menu-title">Attendance</span>
                    </a>
                </li>
                <?php 
                    }
                    
                ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo base_url(); ?>Teacher/attendance_history">Attendance History </a></li>
              </ul>
            </div>
          </li> 
         
        
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>Fee/my_class_fee_students">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Fee</span>
            </a>
        </li>
        <!--<li class="nav-item">-->
        <!--    <a class="nav-link" href="<?php echo base_url();?>Examination/my_class_exam_students">-->
        <!--      <i class="icon-paper menu-icon"></i>-->
        <!--      <span class="menu-title">Exam</span>-->
        <!--    </a>-->
        <!--</li>-->
        
        <!--<li class="nav-item">-->
            <!--<a class="nav-link" href="<?php echo base_url();?>ExamManagement/my_class_students">-->
        <!--        <a class="nav-link" href="<?php echo base_url();?>ExamManagement/class_section_students/<?php echo $class_teacher; ?>">-->
        <!--      <i class="icon-paper menu-icon"></i>-->
        <!--      <span class="menu-title">Exam</span>-->
        <!--    </a>-->
        <!--</li>-->
        
        <li class="nav-item">
            <a class="nav-link" data-toggle="collapse" href="#ClassExam" aria-expanded="false" aria-controls="Attendance">
              <i class="icon-head menu-icon"></i>
              <span class="menu-title">Exam</span>
              <i class="menu-arrow"></i>
            </a>
            <div class="collapse" id="ClassExam">
              <ul class="nav flex-column sub-menu">
                <?php 
                $all_exams_table="all_exams";
                $get_current_cedemic_session_exams=$this->WelcomeModel->get_acedemic_session_exams($acedemic_session,$all_exams_table);
                if($get_current_cedemic_session_exams){
                    foreach($get_current_cedemic_session_exams as $exams){
                ?>
                <!--<li class="nav-item">-->
                <!--    <a class="nav-link" href="<?php echo base_url().'ExamManagement/class_section_students/'.$class_teacher.'/'.$class_teacher_section.'/'.$exams['id']; ?>"><?php echo $exams['exam_title']; ?> </a></li>-->
                <?php
                    }
                }
                ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo base_url().'ExamManagement/all_exams'; ?>">Examinations</a>
                </li>
              </ul>
            </div>
          </li> 
        <?php 
        }
        
        if($this->session->userdata('staff_category') == "teaching-staff"){
        ?>
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>TimeTableManagement/teachers_active_time_table">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Time Table</span>
            </a>
        </li>
        <?php
        }
        ?>
        
        <li class="nav-item">
            <a class="nav-link" href="<?php echo base_url();?>Holiday/view">
              <i class="icon-paper menu-icon"></i>
              <span class="menu-title">Holiday Calender</span>
            </a>
        </li>
        
        
    </ul>
</nav>

<!-- partial -->
<div class="main-panel">
    <div class="content-wrapper">