@extends('layouts.dashboard') @section('title', $reportData['title']) @section('content')
Back to Reports

{{ $reportData['title'] }}

Period: {{ $reportData['period'] }} Generated: {{ now()->format('M d, Y h:i A') }}

@php $stats = $reportData['stats'] ?? []; $statColors = ['blue', 'emerald', 'amber', 'purple', 'red', 'indigo']; $statIcons = ['users', 'check-circle', 'calendar-alt', 'money-bill-wave', 'handshake', 'chart-line']; @endphp @foreach($stats as $key => $value) @if(is_numeric($value))

{{ ucfirst(str_replace('_', ' ', $key)) }}

{{ number_format($value) }}

@endif @endforeach
@if($reportData['type'] == 'users')

User Statistics Report

@if(isset($stats['by_department']) && count($stats['by_department']) > 0)

Department Distribution

@foreach($stats['by_department'] as $dept => $count)
{{ $dept ?: 'No Department' }}
{{ $count }} users
@endforeach
@endif
@foreach($reportData['data'] as $user) @endforeach
Employee Department Role Status Join Date
{{ $user->name }}
{{ $user->email }}
{{ $user->department->name ?? 'N/A' }} {{ ucfirst($user->role) }} @if($user->status == 'active') Active @else Inactive @endif {{ $user->created_at->format('M d, Y') }}
@elseif($reportData['type'] == 'visits')

Visit Analytics Report

@foreach(['scheduled', 'in_progress', 'completed', 'cancelled'] as $status)
{{ $stats[$status . '_visits'] ?? 0 }}
{{ str_replace('_', ' ', $status) }}
@endforeach
{{ $stats['avg_completion_time'] ?? 0 }} min
Avg. Duration
@foreach($reportData['data'] as $visit) @endforeach
Employee Client Location Date & Time Status Duration
{{ $visit->employee->name }}
{{ $visit->employee->employee_id }}
{{ $visit->client->name }}
{{ $visit->client->company_name }}
{{ $visit->governorate->name ?? '' }}
{{ $visit->city->name ?? '' }}
{{ $visit->scheduled_date->format('M d, Y') }}
{{ $visit->scheduled_time }}
@php $statusColors = [ 'scheduled' => 'bg-amber-100 text-amber-800', 'in_progress' => 'bg-blue-100 text-blue-800', 'completed' => 'bg-emerald-100 text-emerald-800', 'cancelled' => 'bg-red-100 text-red-800' ]; @endphp {{ ucfirst(str_replace('_', ' ', $visit->status)) }} @if($visit->status == 'completed' && $visit->started_at && $visit->completed_at)
{{ $visit->started_at->diffInMinutes($visit->completed_at) }} min
@else
-
@endif
@elseif($reportData['type'] == 'leaves')

Leave Management Report

{{ $stats['approved_leaves'] ?? 0 }}
Approved
{{ $stats['pending_leaves'] ?? 0 }}
Pending
{{ $stats['rejected_leaves'] ?? 0 }}
Rejected
{{ $stats['total_days'] ?? 0 }}
Total Days
@foreach($reportData['data'] as $leave) @endforeach
Employee Leave Type Period Days Status Reason
{{ $leave->employee->name }}
{{ $leave->employee->department->name ?? 'N/A' }}
{{ ucfirst($leave->type) }}
{{ $leave->start_date->format('M d') }} - {{ $leave->end_date->format('M d, Y') }}
{{ $leave->total_days }}
@php $statusColors = [ 'pending' => 'bg-amber-100 text-amber-800', 'approved' => 'bg-emerald-100 text-emerald-800', 'rejected' => 'bg-red-100 text-red-800' ]; @endphp {{ ucfirst($leave->status) }}
{{ $leave->reason }}
@elseif($reportData['type'] == 'payroll')

Payroll Management Report

Total Salary Paid
{{ number_format($stats['total_salary_paid'] ?? 0, 2) }} EGP
Average Salary
{{ number_format($stats['avg_salary'] ?? 0, 2) }} EGP
Payrolls Generated
{{ $stats['total_payrolls'] ?? 0 }}
@foreach($reportData['data'] as $payroll) @endforeach
Employee Pay Period Basic Salary Allowances Deductions Net Salary Status Payment Date
{{ $payroll->employee->name }}
{{ $payroll->pay_period_start->format('M d') }} - {{ $payroll->pay_period_end->format('M d, Y') }}
{{ number_format($payroll->basic_salary, 2) }} {{ number_format($payroll->allowances, 2) }} {{ number_format($payroll->deductions, 2) }}
{{ number_format($payroll->net_salary, 2) }}
@php $statusColors = [ 'draft' => 'bg-amber-100 text-amber-800', 'processed' => 'bg-blue-100 text-blue-800', 'paid' => 'bg-emerald-100 text-emerald-800' ]; @endphp {{ ucfirst($payroll->status) }} @if($payroll->payment_date)
{{ $payroll->payment_date->format('M d, Y') }}
@else
Not scheduled
@endif
@elseif($reportData['type'] == 'clients')

Client Management Report

@if(isset($stats['by_governorate']) && count($stats['by_governorate']) > 0)

Client Distribution by Governorate

@foreach($stats['by_governorate'] as $gov => $count)
{{ $gov ?: 'Unknown' }}
{{ $count }}
@endforeach
@endif
@foreach($reportData['data'] as $client) @endforeach
Client Company Location Contact Type Status Total Visits
{{ $client->name }}
{{ $client->company_name }}
{{ $client->governorate->name ?? '' }}
{{ $client->city->name ?? '' }}, {{ $client->area }}
{{ $client->phone }}
{{ $client->email }}
{{ ucfirst($client->type) }} @if($client->status == 'active') Active @else Inactive @endif
{{ $client->visits()->count() }}
@elseif($reportData['type'] == 'performance')

Employee Performance Report

@if(isset($stats['top_performers']) && count($stats['top_performers']) > 0)

Top Performers

@foreach($stats['top_performers'] as $performer)
{{ $performer['employee']['name'] }}
{{ $performer['department'] }}
{{ number_format($performer['completion_rate'], 1) }}%
Completion Rate
@endforeach
@endif
@foreach($reportData['data'] as $performance) @endforeach
Employee Department Total Visits Completed Completion Rate Leave Days Avg. Duration
{{ $performance['employee']['name'] }}
{{ $performance['department'] }}
{{ $performance['total_visits'] }}
{{ $performance['completed_visits'] }}
@php $rate = $performance['completion_rate']; if($rate >= 90) { $color = 'bg-emerald-100 text-emerald-800'; } elseif($rate >= 70) { $color = 'bg-amber-100 text-amber-800'; } else { $color = 'bg-red-100 text-red-800'; } @endphp {{ number_format($rate, 1) }}%
{{ $performance['total_leave_days'] }}
{{ $performance['avg_visit_duration'] }} min
@elseif($reportData['type'] == 'summary')

System Summary Report

@foreach($reportData['summary'] as $module => $moduleStats)
@php $moduleIcons = [ 'users' => 'fa-users text-blue-500', 'visits' => 'fa-map-marker-alt text-emerald-500', 'leaves' => 'fa-calendar-alt text-amber-500', 'payroll' => 'fa-money-bill-wave text-purple-500', 'clients' => 'fa-handshake text-red-500' ]; @endphp
{{ $module }}
@foreach($moduleStats as $key => $value) @if(is_numeric($value))
{{ ucfirst(str_replace('_', ' ', $key)) }} {{ number_format($value) }}
@endif @endforeach
@endforeach

Monthly Trends (Last 6 Months)

@foreach($reportData['monthly_trends'] as $month => $trend) @endforeach
Month Visits Leaves Payrolls New Users
{{ $month }} {{ $trend['visits'] }} {{ $trend['leaves'] }} {{ $trend['payroll'] }} {{ $trend['new_users'] ?? 0 }}

System Health Status

Operational
All systems are running normally
Data Integrity
All data is properly synchronized
Security Status
Security protocols are active
@endif
@if($request->format == 'excel')
Excel Export Ready
Your report has been exported to Excel format. The download should start automatically.
@endif

Report generated by {{ auth()->user()->name }} on {{ now()->format('F d, Y \a\t h:i A') }}

Innovaxcess Attendance System - Confidential Report

Report ID: {{ Str::uuid()->toString() }}

@endsection