@extends('Admin.layout') @section('content') @php $selectedMonth = $selectedMonth ?? request('month', now()->format('Y-m')); $displayMonth = $displayMonth ?? now()->format('F Y'); $selectedStaffId = $selectedStaffId ?? null; $certRef = 'TB-' . ($selectedStaffId ?: 'ALL') . '-' . str_replace('-', '', $selectedMonth); @endphp
{{-- Filters (screen only) --}} {{-- ================= TABLE PAGE ================= --}}
{{-- Letterhead --}}
Logo
Staff Attendance Register

Monthly Staff Report Table

Reference {{ $certRef }}
Issued {{ now()->format('d M Y') }}
{{-- Subject line --}}
{{ $selectedStaff?->name ?? 'All Staff — Combined Register' }}
@if (!empty($selectedStaffId)) Employee ID {{ $selectedStaff?->user_id }} · {{ $selectedStaff?->designation ?? 'Unknown Position' }} @else One row per active staff member @endif
Reporting period {{ $displayMonth }}
{{-- Table --}}
Attendance Register
@foreach ($reports as $r) {{-- 1 --}} {{-- 2 --}} {{-- 3 --}} {{-- 4 --}} {{-- 5 --}} {{-- 6 --}} {{-- 7 --}} {{-- 8 --}} {{-- 9 --}} {{-- 10 --}} @endforeach
Month Staff Name / Employee ID Department / Designation Joining Date / Current Timeline Working Days / Present Leave WFH Late Entries Permission Loss of Pay (LOP)
{{ $r->month }}
{{ $r->name }}
{{ $r->emp_id }}
{{ $r->type }}
{{ $r->designation }}
{{ $r->joining }}
{{ $r->timeline }}
Working Days {{ $r->working }}
Present {{ $r->present }}
{{ $r->leave }} Days
Advance CRM Update {{ $r->leave_crm['advance'] }}
Same-Day CRM Update {{ $r->leave_crm['same'] }}
Late CRM Update {{ $r->leave_crm['late'] }}
{{ $r->wfh }} Days
Advance CRM Update {{ $r->wfh_crm['advance'] }}
Same-Day CRM Update {{ $r->wfh_crm['same'] }}
Late CRM Update {{ $r->wfh_crm['late'] }}
No Request WFH {{ $r->wfh_crm['none'] }}
Report generated on {{ now()->format('d M Y, h:i A') }} · Reference {{ $certRef }} · This is a system-generated record.
@php $exportRows = $reports->map(function ($r) { return [ 'Month' => $r->month, 'Staff Name' => $r->name, 'Employee ID' => $r->emp_id, 'Department' => $r->type, 'Designation' => $r->designation, 'Joining Date' => $r->joining, 'Current Timeline' => $r->timeline, 'Working Days' => $r->working, 'Present' => $r->present, 'Leave Total' => $r->leave, 'Leave Advance CRM Update' => $r->leave_crm['advance'], 'Leave Same-Day CRM Update' => $r->leave_crm['same'], 'Leave Late CRM Update' => $r->leave_crm['late'], 'WFH Total' => $r->wfh, 'WFH Advance CRM Update' => $r->wfh_crm['advance'], 'WFH Same-Day CRM Update' => $r->wfh_crm['same'], 'WFH Late CRM Update' => $r->wfh_crm['late'], 'No Request WFH' => $r->wfh_crm['none'], 'Late Entries' => $r->late, 'Permission Hours' => $r->permission_hours, 'Permission Days' => trim($r->permission_days, '()'), 'Loss of Pay (Days)' => $r->lop, ]; })->values(); @endphp @endsection