@extends('adminlte::page')
@section('title', 'Dashboard | ' . Config::get('adminlte.title'))
@php
use Carbon\Carbon;
use Illuminate\Support\Str;
$selectedMonthDate = Carbon::parse($selectedMonth . '-01');
$daysInMonth = $selectedMonthDate->daysInMonth;
$presentDays = $selectedUserMonthlyStats['present_days'] ?? 0;
$absentDays = max($daysInMonth - $presentDays, 0);
$lateDays = $selectedUserMonthlyStats['late_days'] ?? 0;
$overtimeDays = $selectedUserMonthlyStats['overtime_days'] ?? 0;
$monthlyTotal = max($presentDays + $absentDays, 1);
$presentPct = round(($presentDays / $monthlyTotal) * 100);
$absentPct = round(($absentDays / $monthlyTotal) * 100);
$latePct = round(($lateDays / $monthlyTotal) * 100);
$weeklyBuckets = collect(range(1, 5))->map(function ($week) use ($selectedUserMonthlyAttendances) {
$records = $selectedUserMonthlyAttendances->filter(function ($attendance) use ($week) {
$date = $attendance->date;
if (!$date) {
return false;
}
return (int) ceil($date->day / 7) === $week;
});
return [
'label' => 'Week ' . $week,
'present' => $records->count(),
'late' => $records->filter(fn ($attendance) => ($attendance->late_time ?? '00:00:00') > '00:00:00')->count(),
'overtime' => $records->filter(fn ($attendance) => ($attendance->over_time ?? '00:00:00') > '00:00:00')->count(),
];
});
$yearLabels = $selectedUserYearlyCards->pluck('label')->values();
$yearPresent = $selectedUserYearlyCards->pluck('present_days')->values();
$yearLate = $selectedUserYearlyCards->pluck('late_days')->values();
$yearOvertime = $selectedUserYearlyCards->pluck('overtime_days')->values();
@endphp
@section('content_header')
Dashboard
@stop
@section('content')
Operations dashboard
Welcome back, {{ Str::of(Auth::user()->name)->before(' ') ?: Auth::user()->name }}.
Monitor attendance, review staff trends, and jump into the most common admin tasks from one screen.
{{ Carbon::parse($today)->format('d M Y, l') }}
{{ $selectedUserLabel }}
@if(Auth::user()->hasRole('administrator'))
Total Users
{{ $userCount }}
Registered staff in system
@endif
Present Today
{{ $attendaceToday }}
{{ $attendanceCheckedOutToday }} checked out
Late Today
{{ $attendanceLateToday }}
{{ $latePct }}% of monthly records
On Leave Today
{{ $leaveTodayCount }}
{{ $areaCount }} active areas
Attendance Overview
Monthly attendance pattern for {{ $selectedUserLabel }}
{{ $selectedMonth }}
Attendance Summary
{{ $selectedMonthDate->format('F Y') }}
Present
{{ $presentPct }}% ({{ $presentDays }})
Absent Estimate
{{ $absentPct }}% ({{ $absentDays }})
Late Days
{{ $latePct }}% ({{ $lateDays }})
Monthly Trend
Weekly movement inside {{ $selectedMonth }} for {{ $selectedUserLabel }}
Recent Activity
Latest attendance entries
Live snapshot
| Employee |
Date |
Check In |
Check Out |
Late |
Status |
@forelse($recentAttendances as $attendance)
|
{{ optional($attendance->user)->name ?? 'Unknown user' }}
|
{{ optional($attendance->date)->format('Y-m-d') }} |
{{ optional($attendance->in_time)->format('H:i:s') ?? '--' }} |
{{ optional($attendance->out_time)->format('H:i:s') ?? '--' }} |
{{ optional($attendance->late_time)->format('H:i:s') ?? '--' }} |
@if($attendance->out_time)
Completed
@else
Checked In
@endif
|
@empty
| No recent attendance data. |
@endforelse
Selected Employee
{{ $selectedUserLabel }}
{{ $selectedUser ? $selectedUser->email : 'Aggregated team attendance view' }}
Avg In
{{ $selectedUserMonthlyStats['avg_check_in'] }}
Avg Out
{{ $selectedUserMonthlyStats['avg_check_out'] }}
Present Days
{{ $selectedUserMonthlyStats['present_days'] }}
Early Out
{{ $selectedUserMonthlyStats['early_out_days'] }}
Quick Actions
Common admin shortcuts
Events This Month
Operational calendar
@forelse ($events as $event)
{{ $event->start_date->format('d M Y') }}
{{ $event->title }}
{{ $event->desc }}
@empty
There is no event this month.
@endforelse
Yearly Snapshot
{{ $selectedYear }} attendance map
@foreach($selectedUserYearlyCards as $month)
{{ $month['label'] }}
{{ $month['present_days'] }}
L {{ $month['late_days'] }} | O {{ $month['overtime_days'] }}
@endforeach
@stop
@section('css')
@stop
@section('js')
@stop