
<?php $__env->startSection('content'); ?>
<?php $__env->startSection('title'); ?>
<?php echo app('translator')->getFromJson('attendance.daily_attendance'); ?>
<?php $__env->stopSection(); ?>
<script>
    jQuery(function (){
        $("#dailyAttendanceReport").validate();
    });

</script>
	<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="<?php echo e(url('dashboard')); ?>"><i class="fa fa-home"></i> <?php echo app('translator')->getFromJson('dashboard.dashboard'); ?></a></li>
					<li><?php echo $__env->yieldContent('title'); ?></li>
				</ol>
			</div>
		</div>
					
		<div class="row">
			<div class="col-sm-12">
				<div class="panel panel-info">
					<div class="panel-heading"><i class="mdi mdi-table fa-fw"></i><?php echo $__env->yieldContent('title'); ?></div>
					<div class="panel-wrapper collapse in" aria-expanded="true">
						<div class="panel-body">
							<div id="searchBox" >
                            <div class="col-md-1"></div>
                            <?php echo e(Form::open(array('route' => 'dailyAttendance.dailyAttendance','id'=>'dailyAttendanceReport','class'=>'form-horizontal'))); ?>

                                <div class="form-group">
                                    <label class="control-label col-sm-2" for="email"><?php echo app('translator')->getFromJson('common.date'); ?><span class="validateRq">*</span>:</label>
                                    <div class="col-sm-4">
                                        <input type="text" class="form-control dateField" required readonly placeholder="<?php echo app('translator')->getFromJson('common.date'); ?>" id="date" name="date" value="<?php if(isset($formData)): ?> <?php echo e($formData); ?><?php else: ?> <?php echo e(dateConvertDBtoForm(date('Y-m-d'))); ?> <?php endif; ?>">
                                    </div>
                                    <div class="col-sm-3">
                                        <input type="submit" id="filter" style="margin-top: 2px; width: 100px;" class="btn btn-info " value="<?php echo app('translator')->getFromJson('common.filter'); ?>">
                                    </div>
                                </div>
                            <?php echo e(Form::close()); ?>

                        </div>
                        <hr>
							<?php if(count($results) > 0): ?>
								<h4 class="text-right">
									<?php if(isset($formData)): ?>
										<a target="_blank" class="btn btn-success" style="color: #fff" href="<?php echo e(URL('downloadDailyAttendance/'.dateConvertFormtoDB($formData))); ?>"><i class="fa fa-download fa-lg" aria-hidden="true"></i> <?php echo app('translator')->getFromJson('common.download'); ?> PDF</a>
									<?php else: ?>
										<a class="btn btn-success" style="color: #fff" href="<?php echo e(URL('downloadDailyAttendance/'.date('Y-m-d') )); ?>"><i class="fa fa-download fa-lg" aria-hidden="true"></i> <?php echo app('translator')->getFromJson('common.download'); ?> PDF</a>
									<?php endif; ?>
								</h4>
							<?php endif; ?>
							<div class="table-responsive">
								<table id="" class="table table-bordered">
									<thead class="tr_header">
										<tr>
											<th style="width:100px;"><?php echo app('translator')->getFromJson('common.serial'); ?></th>
											<th><?php echo app('translator')->getFromJson('common.date'); ?></th>
											<th><?php echo app('translator')->getFromJson('common.employee_name'); ?></th>
											<th><?php echo app('translator')->getFromJson('attendance.in_time'); ?></th>
											<th><?php echo app('translator')->getFromJson('attendance.out_time'); ?></th>
											<th><?php echo app('translator')->getFromJson('attendance.working_time'); ?></th>
											<th><?php echo app('translator')->getFromJson('attendance.late'); ?></th>
											<th><?php echo app('translator')->getFromJson('attendance.late_time'); ?></th>
											<th><?php echo app('translator')->getFromJson('attendance.over_time'); ?></th>
										</tr>
									</thead>
									<tbody>
									<?php if(count($results) > 0): ?>
										<?php $__currentLoopData = $results; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
											<tr>
												<td colspan="9"><strong><?php echo e($key); ?></strong></td>
											</tr>
											<?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key1=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
												<tr>
													<td><?php echo e(++$key1); ?></td>
													<td><?php echo e($value->date); ?></td>
													<td><?php echo e($value->fullName); ?></td>
													<td><?php echo e($value->in_time); ?></td>
													<td>
														<?php 
															if ($value->out_time != '') {
																echo $value->out_time;
															} else {
																echo "--";
															}
														 ?>
													</td>

													<td>
														 <?php 
															if ($value->working_time != '00:00:00') {
																echo date('H:i', strtotime($value->working_time));
															} else {
																echo 'One Time Punch';
															}
														  ?>
													</td>
													<td>
														<?php 
															if($value->ifLate == "Yes"){
																echo "<b style='color: red'>".$value->ifLate."</b>";
															}else{
																echo "No";
															}
														 ?>
													</td>
													<td>
														<?php 
															if (date('H:i', strtotime($value->totalLateTime)) != '00:00') {
																echo date('H:i', strtotime($value->totalLateTime));
															}else{
															   echo "--";
															}
														 ?>
													</td>
													<td>
														<?php 
															$workingHour = new DateTime($value->workingHour);
															$workingTime = new DateTime($value->working_time);
															if($workingHour < $workingTime){
																$interval = $workingHour->diff($workingTime);
																echo $interval->format('%H:%I');
															}else{
																echo "00:00";
															}
														 ?>
													</td>
												</tr>
											<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
										<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
									<?php else: ?>
										<tr>
											<td colspan="9"><?php echo app('translator')->getFromJson('common.no_data_available'); ?> !</td>
										</tr>
                                	<?php endif; ?>
                            </tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<?php $__env->stopSection(); ?>

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