
<?php $__env->startSection('content'); ?>
<?php $__env->startSection('title','Dashboard'); ?>
<style>
    .box {
        position: relative;
        background: #ffffff;
        width: 100%;
    }
    .box-body {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-right-radius: 3px;
        border-bottom-left-radius: 3px;
        padding: 10px;
    }
    .profile-user-img {
        margin: 0 auto;
        width: 100px;
        padding: 3px;
        border: 3px solid #d2d6de;
    }
    <?php if(count($attendanceData) >= 6): ?>
        tbody {
            display:block;
            height:320px;
            overflow:auto;
        }
        thead, tbody tr {
            display:table;
            width:100%;
            table-layout:fixed;
        }
        thead {
            width: calc( 100% - 1em )
        }
    <?php endif; ?>
     <?php if(count($leaveApplication) >= 1): ?>
        .leaveApplication{
            overflow-x: hidden;
            height: 210px;
        }
    <?php endif; ?>
    <?php if(count($notice) >= 1): ?>
        .noticeBord{
            overflow-x: hidden;
            height: 210px;
        }
    <?php endif; ?>
    <?php if(count($warning) >= 1): ?>
        .warning{
            overflow-x: hidden;
            height: 210px;
        }
    <?php endif; ?>
</style>

<div class="container-fluid">
    <div class="row bg-title">
        <div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
            <ol class="breadcrumb">
                <li class="active breadcrumbColor"><a href="#"><i class="fa fa-home"></i> Dashboard</a></li>
            </ol>
        </div>
    </div>
    <div class="row">
        
        <?php if($ip_attendance_status == 1): ?>
        <!-- employe attendance  -->
        <?php 
          $logged_user = employeeInfo();
         ?>
        <div class="col-md-6">
            <div class="white-box">
                <h3 class="box-title">Hey <?php echo $logged_user[0]->user_name; ?> please Check in/out your attendance</h3>
                <hr>
                <div class="noticeBord">
                      <?php if(session()->has('success')): ?>
                            <div class="alert alert-success alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <i class="cr-icon glyphicon glyphicon-ok"></i>&nbsp;<strong><?php echo e(session()->get('success')); ?></strong>
                            </div>
                        <?php endif; ?>
                        <?php if(session()->has('error')): ?>
                            <div class="alert alert-danger alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <strong><?php echo e(session()->get('error')); ?></strong>
                            </div>
                        <?php endif; ?>
                   <form action="<?php echo e(route('ip.attendance')); ?>" method="POST">
                    <?php echo e(csrf_field()); ?>

                       <p>Your IP is   <?php echo e(\Request::ip()); ?></p>
                       <input type="hidden" name="employee_id" value="<?php echo e($logged_user[0]->user_name); ?>">  

                       <input type="hidden" name="ip_check_status" value="<?php echo e($ip_check_status); ?>">                       
                       <input type="hidden" name="finger_id" value="<?php echo e($logged_user[0]->finger_id); ?>">
                     <?php if($count_user_login_today > 0): ?>
                       <button class="btn btn-danger">
                        <i class="fa fa-clock-o"> </i>
                       Check Out
                      </button>                       
                     <?php else: ?>
                      <button class="btn btn-primary">
                        <i class="fa fa-clock-o"> </i>
                       Check In
                      </button>
                    <?php endif; ?>

                   </form>
                </div>
            </div>
        </div>

        <!-- end attendance  -->
        <?php endif; ?>

        <div class="col-md-6">
            <div class="panel">
                <div class="p-30">
                    <div class="row">
                        <?php if($employeeInfo->photo !=''): ?>
                            <div class="col-xs-4 col-sm-4"><img src="<?php echo asset('uploads/employeePhoto/'.$employeeInfo->photo); ?>" alt="varun" class="img-circle img-responsive"></div>
                        <?php else: ?>
                            <div class="col-xs-4 col-sm-4"><img src="<?php echo asset('admin_assets/img/profilePic.png'); ?>" alt="varun" class="img-circle img-responsive"></div>
                        <?php endif; ?>
                        <div class="col-xs-12 col-sm-8">
                            <h2 class="m-b-0"><?php echo e($employeeInfo->first_name); ?> <?php echo e($employeeInfo->last_name); ?></h2>
                            <h4><?php echo e($employeeInfo->designation->designation_name); ?></h4><a href="<?php echo e(url('profile')); ?>" class="btn btn-rounded btn-success"><i class="ti-user m-r-5"></i> PROFILE </a></div>
                    </div>
                    <div class="row text-center m-t-30">
                        <div class="col-xs-6 b-r">
                            <h2><?php echo e($employeeTotalLeave->totalNumberOfDays); ?></h2>
                            <h4>LEAVE CONSUME</h4>
                        </div>

                        <div class="col-xs-6">
                            <h2><?php echo e($employeeTotalAward->totalAward); ?></h2>
                            <h4>AWARD</h4>
                        </div>
                    </div>
                </div>
                <hr class="m-t-10" />
            </div>
        </div>

        <div class="col-md-6 col-sm-12 col-lg-6">
            <div class="panel">
                <div class="panel-heading" style="text-transform: uppercase"><?php echo e(date('F Y')); ?>, Attendance </div>
                <div class="table-responsive">
                    <table class="table table-hover manage-u-table">
                        <thead>
                        <tr>
                            <th  class="text-center"> # </th>
                            <th> <?php echo app('translator')->getFromJson('common.date'); ?> </th>
                            <th> <?php echo app('translator')->getFromJson('dashboard.in_time'); ?> </th>
                            <th> <?php echo app('translator')->getFromJson('dashboard.out_time'); ?></th>
                            <th> <?php echo app('translator')->getFromJson('dashboard.late'); ?> </th>
                            <th> <?php echo app('translator')->getFromJson('common.status'); ?> </th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php if(count($attendanceData) > 0): ?>
                            <?php echo e($dailyAttendanceSl =null); ?>

                            <?php $__currentLoopData = $attendanceData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dailyAttendance): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td class="text-center"><?php echo e(++$dailyAttendanceSl); ?></td>


                                    <td><?php echo e($dailyAttendance['date']); ?> </td>
                                    <td>
                                        <?php if($dailyAttendance['in_time'] !=''): ?>
                                            <?php echo e(date('h:i a', strtotime($dailyAttendance['in_time']))); ?>

                                        <?php else: ?>
                                            <?php echo e("--"); ?>

                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <?php 
                                            if($dailyAttendance['out_time'] !=''){
                                               echo date('h:i a', strtotime($dailyAttendance['out_time']));
                                            }else{
                                                echo "--";
                                            }
                                        ?>
                                    </td>

                                    <td>
                                         <?php 
                                            if($dailyAttendance['totalLateTime'] !=''){
                                                if (date('H:i', strtotime($dailyAttendance['totalLateTime'])) != '00:00') {
                                                    echo "<b style='color: red;'>".date('H:i', strtotime($dailyAttendance['totalLateTime']))."</b>";
                                                }else{
                                                    echo "<b style='color: green'><i class='cr-icon glyphicon glyphicon-ok'></i></b>";
                                                }
                                            }else{
                                                echo "--";
                                            }
                                          ?>
                                    </td>
                                    <td>
                                        <?php 
                                            if($dailyAttendance['action'] =='Absence'){
                                                echo "<span class='label label-danger'>Absence</span>";
                                            }elseif($dailyAttendance['action'] =='Leave'){
                                                echo "<span class='label label-info'>Leave</span></p>";
                                            }else{
                                                echo "<span class='label label-success'>Present</span>";
                                            }
                                         ?>
                                    </td>

                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php else: ?>
                            <tr>
                                <td colspan="8"><?php echo app('translator')->getFromJson('common.no_data_available'); ?></td>
                            </tr>
                        <?php endif; ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <?php if(count($leaveApplication) > 0): ?>
            <div class="col-md-12 col-lg-6 col-sm-12">
                <div class="white-box">
                    <h3 class="box-title"><?php echo app('translator')->getFromJson('dashboard.recent_leave_application'); ?></h3>
                    <hr>
                    <div class="leaveApplication">
                        <?php $__currentLoopData = $leaveApplication; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $leaveApplication): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="comment-center p-t-10 <?php echo e($leaveApplication->leave_application_id); ?>">
                                <div class="comment-body">
                                    <?php if($leaveApplication->employee->photo !=''): ?>
                                        <div class="user-img"> <img src="<?php echo asset('uploads/employeePhoto/'.$leaveApplication->employee->photo); ?>" alt="user" class="img-circle"></div>
                                    <?php else: ?>
                                        <div class="user-img"> <img src="<?php echo asset('admin_assets/img/default.png'); ?>" alt="user" class="img-circle"></div>
                                    <?php endif; ?>
                                    <div class="mail-contnet" >
                                        <?php 
                                            $d = strtotime($leaveApplication->created_at);
                                         ?>
                                        <h5><?php echo e($leaveApplication->employee->first_name); ?> <?php echo e($leaveApplication->employee->last_name); ?></h5><span class="time"><?php echo e(date(" d M Y h:i: a", $d)); ?></span> <span class="label label-rouded label-info">PENDING</span>
                                        <br/><span class="mail-desc" style="max-height: none">
                                    <?php echo app('translator')->getFromJson('leave.leave_type'); ?> : <?php echo e($leaveApplication->leaveType->leave_type_name); ?><br>
                                    <?php echo app('translator')->getFromJson('leave.request_duration'); ?> : <?php echo e(dateConvertDBtoForm($leaveApplication->application_from_date)); ?> To <?php echo e(dateConvertDBtoForm($leaveApplication->application_to_date)); ?><br>
                                    <?php echo app('translator')->getFromJson('leave.number_of_day'); ?> : <?php echo e($leaveApplication->number_of_day); ?> <br>
                                    <?php echo app('translator')->getFromJson('leave.purpose'); ?> : <?php echo e($leaveApplication->purpose); ?>

                                </span>

                                        <a href="javacript:void(0)" data-status=2 data-leave_application_id="<?php echo e($leaveApplication->leave_application_id); ?>" class="btn remarksForLeave btn btn-rounded btn-success btn-outline m-r-5"><i class="ti-check text-success m-r-5"></i><?php echo app('translator')->getFromJson('common.approve'); ?></a>
                                        <a href="javacript:void(0)"  data-status=3 data-leave_application_id="<?php echo e($leaveApplication->leave_application_id); ?>" class="btn-rounded remarksForLeave btn btn-danger btn-outline"><i class="ti-close text-danger m-r-5"></i> <?php echo app('translator')->getFromJson('common.reject'); ?></a> </div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                </div>
            </div>
        <?php endif; ?>
       <?php if(count($notice) > 0): ?>
        <div class="col-md-12 col-lg-6 col-sm-12">
            <div class="white-box">
                <h3 class="box-title"><?php echo app('translator')->getFromJson('common.notice_board'); ?></h3>
                <hr>
                <div class="noticeBord">
                    <?php $__currentLoopData = $notice; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php 
                            $noticeDate=strtotime($row->publish_date);
                         ?>
                        <div class="comment-center p-t-10">
                            <div class="comment-body">
                                <div class="user-img"> <i style="font-size: 31px" class="icon-folder-alt text-danger"></i></div>
                                <div class="mail-contnet">
                                    <h5><?php echo e(substr($row->title,0,70)); ?>..</h5><span class="time">Published Date: <?php echo e(date(" d M Y ", $noticeDate)); ?></span>
                                    <br/><span class="mail-desc">
                                    <?php echo app('translator')->getFromJson('notice.pulished_by'); ?>: <?php echo e($row->createdBy->first_name); ?> <?php echo e($row->createdBy->last_name); ?><br>
                                    <?php echo app('translator')->getFromJson('notice.description'); ?>: <?php echo substr($row->description,0,80); ?>..
                                </span>
                                    <a href="<?php echo e(url('notice/'.$row->notice_id)); ?>" class="btn m-r-5 btn-rounded btn-outline btn-danger"><?php echo app('translator')->getFromJson('common.read_more'); ?></a> </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
      <?php endif; ?>

    <?php if(count($warning) > 0): ?>
        <div class="col-md-12 col-lg-6 col-sm-12">
            <div class="white-box">
                <h3 class="box-title"><?php echo app('translator')->getFromJson('warning.warning'); ?></h3>
                <hr>
                <div class="warning">
                    <?php $__currentLoopData = $warning; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php 
                            $warning_date = strtotime($row->warning_date);
                         ?>
                        <div class="comment-center p-t-10">
                            <div class="comment-body">
                                <div class="user-img"> <i style="font-size: 31px" class="fa fa-exclamation-triangle text-danger"></i></div>
                                <div class="mail-contnet">
                                    <h5><?php echo e(substr($row->subject,0,70)); ?>..</h5><span class="time">Warning Date: <?php echo e(date(" d M Y ", $warning_date)); ?></span>
                                    <br/><span class="mail-desc">
                                <?php echo app('translator')->getFromJson('warning.waring_by'); ?>: <?php echo e($row->warningBy->first_name); ?> <?php echo e($row->warningBy->last_name); ?><br>
                                <?php echo app('translator')->getFromJson('warning.description'); ?>: <?php echo substr($row->description,0,80); ?>..
                        </span>
                                    <a href="<?php echo e(url('warning/'.$row->warning_id)); ?>" class="btn m-r-5 btn-rounded btn-outline btn-danger"><?php echo app('translator')->getFromJson('common.read_more'); ?></a> </div>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <?php if($terminationData): ?>
        <div class="col-md-12 col-lg-6 col-sm-12">
            <div class="white-box">
                <h3 class="box-title"><?php echo app('translator')->getFromJson('menu.termination'); ?></h3>
                <hr>
                <div class="terminationData">

                        <?php 
                            $notice_date = strtotime($terminationData->notice_date);
                            $termination_date = strtotime($terminationData->termination_date);
                         ?>
                        <div class="comment-center p-t-10">
                            <div class="comment-body">
                                <div class="user-img"> <i style="font-size: 31px" class="fa fa-exclamation-triangle text-danger"></i></div>
                                <div class="mail-contnet">
                                    <h5>
                                        <?php echo e(substr($terminationData->subject,0,70)); ?>..</h5>
                                        <span class="time">Notice Date: <?php echo e(date(" d M Y ", $notice_date)); ?></span>
                                    <br>
                                        <span class="time">Termination Date: <?php echo e(date(" d M Y ", $termination_date)); ?></span>
                                    <br/><span class="mail-desc">
                                            <?php echo app('translator')->getFromJson('termination.terminated_by'); ?>: <?php echo e($terminationData->terminateBy->first_name); ?> <?php echo e($terminationData->terminateBy->last_name); ?><br>
                                            <?php echo app('translator')->getFromJson('terminate.description'); ?>: <?php echo substr($terminationData->description,0,80); ?>..
                                        </span>
                                    <a href="<?php echo e(url('termination/'.$terminationData->termination_id)); ?>" class="btn m-r-5 btn-rounded btn-outline btn-danger">Read More</a> </div>
                            </div>
                        </div>
                </div>
            </div>
        </div>
    <?php endif; ?>

    </div>

    <div class="row">
        <!-- up comming birthday  -->
     <div class="row">
          <?php if(count($upcoming_birtday) > 0): ?>
            <div class="col-md-6 col-lg-6 col-sm-12">
                <div class="white-box">
                    <h3 class="box-title"><?php echo app('translator')->getFromJson('dashboard.upcoming_birthday'); ?></h3>
                    <hr>
                    <div class="leaveApplication">
                    <?php $__currentLoopData = $upcoming_birtday; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $employee_birthdate): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="comment-center p-t-10">
                        <div class="comment-body">
                            <?php if($employee_birthdate->photo !=''): ?>
                                <div class="user-img"> <img src="<?php echo asset('uploads/employeePhoto/'.$employee_birthdate->photo); ?>" alt="user" class="img-circle"></div>
                            <?php else: ?>
                                <div class="user-img"> <img src="<?php echo asset('admin_assets/img/default.png'); ?>" alt="user" class="img-circle"></div>
                            <?php endif; ?>
                            <div class="mail-contnet" > 

                                <?php  
                                   $date_of_birth = $employee_birthdate->date_of_birth;
                                   $separate_date = explode('-',$date_of_birth);

                                   $date_current_year = date('Y').'-'.$separate_date[1].'-'.$separate_date[2];

                                   $create_date = date_create($date_current_year);
                                 ?>
                             
                                <h5><?php echo e($employee_birthdate->first_name); ?> <?php echo e($employee_birthdate->last_name); ?></h5><span class="time"><?php echo e(date_format(date_create($employee_birthdate->date_of_birth),"D dS F Y")); ?></span> 
                                <br/>

                                <span class="mail-desc">
                                    <?php if($date_current_year == date('Y-m-d')): ?>
                                      <b>Today is 
                                       <?php if($employee_birthdate->gender == 'Male'): ?>
                                        His <?php else: ?> 
                                        Her 
                                        <?php endif; ?> 
                                        Birtday Wish 
                                     <?php if($employee_birthdate->gender == 'Male'): ?>
                                          Him 
                                      <?php else: ?> Her 
                                      <?php endif; ?></b>

                                    <?php else: ?> 
                                     
                                       Wish 
                                       <?php if($employee_birthdate->gender == 'Male'): ?>
                                        Him <?php else: ?> 
                                        Her 
                                        <?php endif; ?>
                                        on <?php echo e(date_format($create_date,"D dS F Y")); ?> 
                                        


                                    <?php endif; ?>
                                </span>
                            </div>
                        </div>
                    </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                </div>
            </div>
        <?php endif; ?> 
     </div>
    </div>
    


</div>

<?php $__env->stopSection(); ?>


<?php $__env->startSection('page_scripts'); ?>
<link href="<?php echo asset('admin_assets/plugins/bower_components/news-Ticker-Plugin/css/site.css'); ?>" rel="stylesheet" type="text/css" />
<script src="<?php echo asset('admin_assets/plugins/bower_components/news-Ticker-Plugin/scripts/jquery.bootstrap.newsbox.min.js'); ?>"></script>

    <script type="text/javascript">
        (function() {

            $(".demo1").bootstrapNews({
                newsPerPage: 2,
                autoplay: true,
                pauseOnHover:true,
                direction: 'up',
                newsTickerInterval: 4000,
                onToDo: function () {
                    //console.log(this);
                }
            });

        })();


        $(document).on('click', '.remarksForLeave', function () {

            var actionTo = "<?php echo e(URL::to('approveOrRejectLeaveApplication')); ?>";
            var leave_application_id = $(this).attr('data-leave_application_id');
            var status = $(this).attr('data-status');

            if(status == 2){
                var statusText = "Are you want to approve leave application?";
                var btnColor = "#2cabe3";
            }else{
                var statusText = "Are you want to reject leave application?";
                var btnColor = "red";
            }

            swal({
                    title: "",
                    text: statusText,
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: btnColor,
                    confirmButtonText: "Yes",
                    closeOnConfirm: false
                },
                function (isConfirm) {
                    var token = '<?php echo e(csrf_token()); ?>';
                    if (isConfirm) {
                        $.ajax({
                            type: 'POST',
                            url:actionTo,
                            data: {leave_application_id:leave_application_id,status:status,_token:token},
                            success: function (data) {
                                if (data == 'approve') {
                                    swal({
                                            title: "Approved!",
                                            text: "Leave application approved.",
                                            type: "success"
                                        },
                                        function (isConfirm) {
                                            if (isConfirm) {
                                                $('.' + leave_application_id).fadeOut();
                                            }
                                        });

                                }else{
                                    swal({
                                            title: "Rejected!",
                                            text: "Leave application rejected.",
                                            type: "success"
                                        },
                                        function (isConfirm) {
                                            if (isConfirm) {
                                                $('.' + leave_application_id).fadeOut();
                                            }
                                        });
                                }
                            }

                        });
                    } else {
                        swal("Cancelled", "Your data is safe .", "error");
                    }
                });
            return false;

        });

    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>