<?php $__env->startSection('maincontent'); ?>
    <style type="text/css">
        .btn-simple.btn-icon{
            padding: 1px !important;
        }
    </style>
    <div class="card col-md-6 col-md-offset-3">
        <div class="content">
            <div class="row">
                <?php echo Form::open(['url'=>'my-report']); ?>

                <?php echo Form::hidden('search','yes'); ?>

                <div class="col-md-5">
                    <label>FROM</label>
                    <div class="form-group">
                        <input type="text" name="from_date" class="form-control fromdatepicker" placeholder="From Date here"/>
                    </div>
                </div>
                <div class="col-md-5">
                    <label>TO</label>
                    <div class="form-group">
                        <input type="text" name="to_date" class="form-control todatepicker" placeholder="To Date Here"/>
                    </div>
                </div>
                <div class="col-md-2">
                    <label>&nbsp;</label>
                    <div class="form-group">
                        <button class="btn btn-info btn-fill" type="submit">Search</button>
                    </div>
                </div>
                <?php echo Form::close(); ?>

            </div>
        </div>
    </div>
    <div class="card col-md-12">
        <div class="header text-center">
            <h4 class="title">Report: <strong><?php echo e(Helper::onlyDMY($from_date)); ?></strong> to <strong><?php echo e(Helper::onlyDMY($to_date)); ?></strong></h4>
            <div class="report-box">
                <div>
                    <div class="suc"><span><?php echo e($attendanceSummary['present']); ?></span> days</div>
                    Present
                </div>
                <div>
                    <div class="dan"><span><?php echo e($attendanceSummary['absent']); ?></span> days</div>
                    Absent
                </div>
                <div>
                    <div class="pri"><span><?php echo e($attendanceSummary['close']); ?></span> days</div>
                    Close
                </div>
                <div>
                    <div class="war"><span><?php echo e($attendanceSummary['leave']); ?></span> days</div>
                    Leave
                </div>
                <div>
                    <div class="suc"><span><?php echo e($attendanceSummary['holiday_spent']); ?></span> days</div>
                    Holiday
                </div>
                <div>
                    <div class="inf"><span><?php echo e($holidayLeft); ?></span> days</div>
                    Holiday left
                </div>
                <div>
                    <div class="dan"><span><?php echo e($attendanceSummary['late_count']); ?></span> days</div>
                    Late
                </div>
            </div>
        </div>
        <div class="content">
            <div class="fresh-datatables">
                <table id="datatable-report" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%" style="width:100%">
                    <thead>
                    <tr>
                        <th>Date</th>
                        <th>IN</th>
                        <th>Out</th>
                        <th>Works</th>
                        <th>Task</th>
                        <th>Status</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php $totalWorks=0; rsort($result); ?>
                    <?php $__currentLoopData = $result; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php
                                $minTime= $data['in_out']['min_time'];
                                $maxTime= $data['in_out']['max_time'];
                                $timeCalc= $data['in_out']['time_calc'];
                        ?>
                        <?php if($data['in_out']['date']==date('Y-m-d')): ?>
                            <tr style="background-color:#D7F4D1">
                        <?php else: ?>
                            <tr>
                        <?php endif; ?>

                            <td><?php echo e(Helper::onlyDMY($data['in_out']['date'])); ?></td>
                            <td><?php if($minTime!=0): ?> <?php echo e(Helper::onlyTime($minTime)); ?> <?php endif; ?></td>
                            <td><?php if($maxTime!=0): ?> <?php echo e(Helper::onlyTime($maxTime)); ?> <?php endif; ?></td>
                            <td><?php if($timeCalc!=0): ?> <?php echo e(Helper::secondsToTime($timeCalc)); ?> <?php endif; ?></td>
                            <td><?php if($data['todayTask']!=null): ?> <?php echo e(strip_tags(substr($data['todayTask']->details,0,60))); ?>... <?php endif; ?></td>
                            <?php $totalWorks+=$timeCalc; ?>
                            <td>
                                <?php if($data['status']=='Present'): ?>
                                    <label class="label label-success my-present"><?php echo e($data['status']); ?></label>
                                <?php elseif($data['status']=='Closed'): ?>
                                    <label class="label label-primary my-close">Close</label>
                                <?php elseif($data['status']=='Absent'): ?>
                                    <label class="label label-danger my-absent"><?php echo e($data['status']); ?></label>
                                <?php elseif($data['status']=='Exchanged'): ?>
                                    <label class="label label-default" title="Exchanged with <?php echo e($data['exchangeDate']); ?>"><?php echo e($data['status']); ?> with <?php echo e($data['exchangeDate']); ?></label>
                                <?php elseif($data['status']=='Applied for leave'): ?>
                                    <label class="label label-warning"><?php echo e($data['status']); ?></label>
                                <?php elseif($data['status']=='Leave'): ?>
                                    <label class="label label-info my-leave"><?php echo e($data['status']); ?></label>
                                <?php elseif($data['status']=='Future'): ?>
                                    <label class="label label-default" style="opacity:0.2"> - - - - - - </label>
                                <?php endif; ?>
                            </td>

                            <td>
                                <a href="#" data-toggle="modal" data-target="#modal" onclick="loadModalEdit('details-view-report','<?php echo e($data['in_out']['date']); ?>','details')" title="Detail" class="btn btn-simple btn-info btn-icon"><i class="fa fa-search-plus" style="font-size: 20px;"></i></a>
                            </td>

                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                    <tfoot>
                    <tr>
                        <td colspan="2"></td>
                        <th>Total</th>
                        <td><?php echo e(Helper::secondsToTime($totalWorks)); ?></td>
                        <td colspan="3"></td>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>

    <script>
        $().ready(function(){

            $("#present").text($('.my-present').length);
            $("#absent").text($('.my-absent').length);
            $("#leave").text($('.my-leave').length);
            $("#close").text($('.my-close').length);

            var table= $('#datatable-report').DataTable({
                "pagingType": "full_numbers",
                "lengthMenu": [[31, 60, 120, -1], [31, 60, 120, "All"]],
                responsive: true,
                language: {
                    search: "_INPUT_",
                    searchPlaceholder: "Search records",
                },
                "aaSorting": []
            });
        });
    </script>
    <script src="<?php echo e(asset('public/vendor/unisharp/laravel-ckeditor/ckeditor.js')); ?>"></script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend._partials.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>