@php use Carbon\Carbon; @endphp @extends('admin.layouts.app') @section('title', get_setting('site_name').' | Attendance Report') @push('css') @endpush @section('content')

{{ __('Attendance Report') }}

{{ __('Staff, department, branch, and date-wise attendance reporting with export.') }}

{{ __('Filters') }} {{ __('Clear Filters') }}
{{ __('Staff wise report only') }}
{{ __('Specific date report only') }}
@if(!empty($reportStats))
{{ (int) ($reportStats['staff_count'] ?? 0) }}
{{ __('Staff') }}
{{ (int) ($reportStats['present'] ?? 0) }}
{{ __('Present') }}
{{ (int) ($reportStats['late'] ?? 0) }}
{{ __('Late') }}
{{ (int) ($reportStats['absent'] ?? 0) }}
{{ __('Absent') }}
@endif @if(($report ?? 'staff') === 'staff' && ! $staffReport)
{{ __('Select an employee, year, and month, then click Generate to view the staff monthly report.') }}
@endif @if(($report ?? '') === 'date' && empty($daily))
{{ __('Select a specific date and click Generate to view the daily attendance report.') }}
@endif @if(in_array($report ?? '', ['department_grid', 'branch_grid', 'department_summary', 'branch_summary'], true) && empty($monthly) && empty($monthlyGrid))
{{ __('Select year and month, then click Generate to view the monthly report.') }}
@endif @if(($report ?? 'staff') === 'staff' && !empty($staffReport) && $staff_details)
{{ __('Staff Monthly Report') }}
{{ Carbon::create($year, $month, 1)->format('F Y') }}
{{ __('Export CSV') }}
{{ __('Employee') }}
{{ $staff_details->user?->name ?? '—' }} ({{ $staff_details->user_id }})
{{ $staff_details->designation?->name ?? '—' }} · {{ $staff_details->warehouse?->name ?? '—' }}
@if(get_setting('system_logo_white')) {{ get_setting('site_name') }} @endif
{{ get_setting('site_name') }}
@foreach($staffReport['rows'] as $row) @endforeach
{{ __('Date') }} {{ __('Status') }} {{ __('In Time') }} {{ __('Out Time') }} {{ __('Remarks') }}
{{ $row['date'] }} ({{ $row['day_name'] }}) {{ $row['status'] }} {{ $row['sign_in'] ?? '—' }} {{ $row['sign_out'] ?? '—' }} {!! $row['remarks'] ?? '—' !!}
@endif @if((($report ?? '') === 'department_summary' || ($report ?? '') === 'branch_summary') && !empty($monthly))
{{ __('Monthly Attendance Summary') }}
{{ Carbon::create($monthly['year'], $monthly['month'], 1)->format('F Y') }}
{{ __('Export CSV') }}
@forelse($monthly['rows'] as $k => $r) @empty @endforelse
# {{ __('Employee') }} {{ __('Department') }} {{ __('Branch') }} {{ __('Present') }} {{ __('Late') }} {{ __('Absent') }} {{ __('Leave') }} {{ __('Half') }} {{ __('Holiday') }} {{ __('Weekend') }} {{ __('Total') }}
{{ $k + 1 }} {{ $r['staff']->user?->name ?? '—' }} ({{ $r['staff']->user_id }}) {{ $r['staff']->department?->name ?? '—' }} {{ $r['staff']->warehouse?->name ?? '—' }} {{ $r['present'] }} {{ $r['late'] }} {{ $r['absent'] }} {{ $r['leave'] }} {{ $r['half'] }} {{ $r['holiday'] }} {{ $r['weekend'] }} {{ $r['total_days'] }}
{{ __('No records found') }}
@endif @if((($report ?? '') === 'department_grid' || ($report ?? '') === 'branch_grid') && !empty($monthlyGrid))
{{ __('Monthly Attendance Grid') }}
{{ Carbon::create($monthlyGrid['year'], $monthlyGrid['month'], 1)->format('F Y') }} — {{ __('Legend') }}: P={{ __('Present') }}, L={{ __('Late') }}, A={{ __('Absent') }}, H={{ __('Holiday') }}, W={{ __('Weekend') }}, LV={{ __('Leave') }}, HL={{ __('Half Leave') }}
{{ __('Export CSV') }}
@foreach($monthlyGrid['dayNumbers'] as $d) @endforeach @forelse($monthlyGrid['rows'] as $k => $r) @foreach($r['cells'] as $c) @php $cls = strtolower($c); @endphp @endforeach @empty @endforelse
# {{ __('Employee') }} {{ __('Department') }} {{ __('Branch') }}{{ $d }}P L A LV HL H W
{{ $k + 1 }} {{ $r['staff']->user?->name ?? '—' }} ({{ $r['staff']->user_id }}) {{ $r['staff']->department?->name ?? '—' }} {{ $r['staff']->warehouse?->name ?? '—' }}{{ $c }}{{ $r['totals']['P'] }} {{ $r['totals']['L'] }} {{ $r['totals']['A'] }} {{ $r['totals']['LV'] }} {{ $r['totals']['HL'] }} {{ $r['totals']['H'] }} {{ $r['totals']['W'] }}
{{ __('No records found') }}
@endif @if(($report ?? '') === 'date' && !empty($daily))
{{ __('Daily Attendance Report') }}
{{ $daily['date'] }} ({{ date('l', strtotime($daily['date'])) }})
{{ __('Export CSV') }}
@forelse($daily['rows'] as $k => $r) @php $code = strtolower((string) $r['status']); if ($code === 'half leave') $code = 'hl'; @endphp @empty @endforelse
# {{ __('Employee') }} {{ __('Department') }} {{ __('Branch') }} {{ __('Status') }} {{ __('In') }} {{ __('Out') }} {{ __('Remarks') }}
{{ $k + 1 }} {{ $r['staff']->user?->name ?? '—' }} ({{ $r['staff']->user_id }}) {{ $r['staff']->department?->name ?? '—' }} {{ $r['staff']->warehouse?->name ?? '—' }} {{ $r['status'] }} {{ $r['signIn'] ? date('h:i A', strtotime($r['signIn'])) : '—' }} {{ $r['signOut'] ? date('h:i A', strtotime($r['signOut'])) : '—' }} {!! $r['remarks'] ?? '—' !!}
{{ __('No records found') }}
@endif
@endsection @push('css') @endpush @section('script') @endsection