@extends('layouts.template.main') @section('content')
{{-- ----------------------------- attendance grace time setup ----------------------------- --}} @if (auth()->user()->hasRole('admin') || auth()->user()->hasRole('hr'))
Thời hạn chấm công
@if (session('success')) @endif
@csrf @method('put')
@endif {{-- ----------------------------- attendance grace time setup ----------------------------- --}}
Danh sách chấm công
@foreach ($attendances as $attendance) {{-- -------------------------- Natural hour to minuite convertion -------------------------- --}} {{-- -------------------------- Natural hour to minuite convertion -------------------------- --}} @if (auth()->user()->hasRole('manager') || auth()->user()->hasRole('employee')) @else @endif @endforeach
Name Email Ngày Checked in Checked out Trạng thái Giờ làm việc Hành động
{{ $attendance->employee->name ?? '' }} {{ $attendance->employee->email ?? '' }} {{ $attendance->date ?? '' }} {{ $attendance->check_in_time ? \Carbon\Carbon::parse($attendance->check_in_time)->format('h:i A') : '' }} {{ $attendance->check_out_time ? \Carbon\Carbon::parse($attendance->check_out_time)->format('h:i A') : '' }} {{ $attendance->status ?? '' }} @php $hours = floor($attendance->working_hours); $minutes = round(($attendance->working_hours - $hours) * 60); $parts = []; if ($hours > 0) { $parts[] = $hours . ' ' . ($hours === 1 ? 'hr' : 'hrs'); } if ($minutes > 0) { $parts[] = $minutes . ' ' . ($minutes === 1 ? 'min' : 'mins'); } $formattedTime = count($parts) ? implode(' ', $parts) : '0 min'; @endphp {{ $formattedTime }}
@endsection