<?php
if($this->session->userdata('fee')==1 && $this->session->userdata('user')==1){
    $this->load->view('erp/welcome/management-welcome');
}else{
?>



<style>
.glance1{
font-weight:900 !important;font-size:18px;background-color:#28A745; 
}    
table {font-size:13px !important;}    

.dash-div{
box-shadow: 2px 2px 8px #EAEDED;
border-left:5px solid #F05A59;
border-bottom:5px solid #F05A59;
border-radius:15px;
/*min-height:100px;*/
height:auto !important;
/*width:100%;*/
padding:10px;
float:left;
margin-right:15px;
float:left;
}

.dash-row{
min-height:45px;
padding:2px;
}
.dash-item a{
text-decoration:none;font-weight:400 !important;color:#ccc;
}
.dash-row .dash-item{
float:left;
width:50%;
/*margin-right:1%;*/
/*box-shadow:0 0 5px silver;*/
color:#ccc;
padding:5px;
min-height:55px;
}

.dash-item:hover{background:silver;color:red;}
.dash-item a:hover{background:silver;color:red;}

 @media screen and (max-width: 767px) {
     .dash-div{width:100%;}
 }

</style>

<div class="container-fluid mt-3 mb-3 bg-white">
    <div class="row">
        <div class="col-sm-12 pt-3 pb-3">
            <?php $cdate =date('d/m/y,h:i:s'); ?>      
            <p style="text-align:right;">Welcome <b>&nbsp; 
            <?php
            if($this->session->userdata('teacher_name')){
                $teacher_name=$this->session->userdata('teacher_name');
                echo $teacher_name; 
            }
            ?>
            </b> | <?php echo "Your Last Login at :&nbsp;"; echo $cdate; ?></p>
            <p style="text-align:right;"><a href="<?php echo base_url();?>school/profile">Profile</a> | <a href="<?php echo base_url();?>login/change_password">Change Password</a> | <a href="<?php echo base_url();?>Logout">Logout</a></p>
        </div>    
        
        <div class="col-sm-12 pt-3 pb-3">
            <p class="text-center  text-center p-2 glance1">
                <span class="text-white">Executive Information Panel </span>
            </p>

            <?php
            $table='circular';
            $latest_single_circular=$this->SchoolModel->latest_single_circular($table);
            if($latest_single_circular){
                foreach($latest_single_circular as $circular){
                    if($circular['status'] ==1){
            ?>
            <div class=" p-2 bg-success">
                <span class="text-white">
                    <b><?php echo $circular['subject']; ?> : <?php echo $circular['message'];?> .<br>
                    <span style='text-align:right; width:100%;'><?php echo date('d-M-Y',strtotime($circular['cat']));?></span>
                    </b>
                </span>
            </div>
            <?php

            }
            }    
            }
            ?>     
                
                
            <?php 
            if($this->session->userdata('class_teacher')!=''){
            ?>    
            <ul class="list-group">
            <?php
                $acedemic_session=$this->session->userdata('acedemic_session');
                $class=$this->session->userdata('class_teacher');
                $section=$this->session->userdata('class_teacher_section');
                $date=date('y-m-d');
            ?>
                <li class="list-group-item d-flex justify-content-between align-items-center">
                    My Class 
                    <span class="badge badge-primary badge-pill"><?php echo $this->session->userdata('class_teacher');?>-<?php echo $this->session->userdata('class_teacher_section'); ?></span>
                </li>
            <?php  ?>    
                <li class="list-group-item d-flex justify-content-between align-items-center">
                Today's Attendance
                <?php 
                
                $present_count=0;
                $absent_count=0;
                $today_strength=$this->AttendenceModel->class_attendance_data($date,$class,$section);
                if($today_strength){
                    foreach($today_strength as $strength){
                        if($strength['status'] == 'p'){
                            $present_count = $present_count + 1;            
                        }else if($strength['status']=='a'){
                            $absent_count=$absent_count + 1;    
                        }
                    }    
                }
                ?>
                    <span class="badge badge-primary badge-pill">
                        <?php echo $present_count;?>  /     
                        <?php 
                        $my_class=$this->session->userdata('class_teacher');
                        $my_class_section=$this->session->userdata('class_teacher_section');
        
                        $my_class_students=$this->AttendenceModel->student_by_class($acedemic_session,$my_class,$my_class_section);
                        $count_strength=0;
                        if($my_class_students){
                            foreach($my_class_students as $students){
                                $count_strength=$count_strength + 1;
                            }    
                        }

                        echo $count_strength;
                        ?>
                    </span>
                </li>
                <li class="list-group-item d-flex justify-content-between align-items-center">
                    Leave Applications
                    <span class="badge badge-success badge-pill">#</span>
                </li>
            </ul>
            <?php } ?>

            <!--<div class="list-group mt-3 mb-3">-->
            <!--<a href="#" class="list-group-item list-group-item-action">My Workspace</a>-->


                <!--<a href="#" class="list-group-item list-group-item-success">Online Education</a>-->
                <!--<a href="#" class="list-group-item list-group-item-success">Examination</a>-->
        <!--<a href="#" class="list-group-item list-group-item-success">Documentation</a>-->
        <!--  </div>-->
    
            </div>    

        <!--<div class="col-sm-12">-->
        <!--    <div class="dash-div mt-3 mb-3">-->
        <!--        <div class="p-2" style="border-bottom:1px solid;font-weight:600;"><b>Attendance</b></div>-->
        <!--        <div class="dash-row">-->
        <!--            <div class="dash-item"><a href="<?php echo base_url();?>Teacher/daily_attendence">Attendance</a></div>-->
        <!--            <div class="dash-item"><a href="<?php echo base_url();?>Teacher/attendance_history">Attendance History</a></div>-->
        <!--        </div>-->
        <!--    </div>-->
        <!--    <div class="dash-div mt-3 mb-3">-->
        <!--        <div class="p-2" style="border-bottom:1px solid;font-weight:600;"><b>Exam</b></div>-->
        <!--        <div class="dash-row">-->
        <!--            <div class="dash-item"><a href="<?php echo base_url();?>Examination/my_class_students">Exam</a></div>-->
        <!--            <div class="dash-item"><a href="#">Exam Result</a></div>-->
        <!--        </div>-->
        <!--    </div>-->
            
            
        <!--</div>-->

    </div>
</div>

<?php
}
?>