@php $violationStatusOptions = collect(\App\Models\Violation::statusOptions())->pluck('name', 'id')->toArray(); $hasActiveFilters = filled($filterEmployee) || filled($filterReason) || filled($filterPenalty) || filled($filterStatus) || filled($filterFrom) || filled($filterTo); @endphp

{{ __('Violations') }}

@can('employees Excel')
@endcan @can('employees pdf')
@endcan @can('violations create') @endcan
@if($ShowEmployeeInForm)
{{ __('Total Violations') }}
{{ $violations->total() }}
{{ __('Most Common Reason') }}
{{ \App\Models\Violation::where('company_id', session('active_company_id')) ->where('branch_id', session('active_branch_id')) ->select('reason', \DB::raw('count(*) as total')) ->groupBy('reason')->orderByDesc('total')->first()->reason ?? '-' }}
{{ __('Most Frequent Employee') }}
{{ optional(\App\Models\Violation::where('company_id', session('active_company_id')) ->where('branch_id', session('active_branch_id')) ->select('employee_id', \DB::raw('count(*) as total')) ->groupBy('employee_id')->orderByDesc('total')->first()?->employee)->name ?? '-' }}
{{ __('Most Common Penalty') }}
{{ \App\Models\Violation::where('company_id', session('active_company_id')) ->where('branch_id', session('active_branch_id')) ->select('penalty', \DB::raw('count(*) as total')) ->groupBy('penalty')->orderByDesc('total')->first()->penalty ?? '-' }}
@endif @if(session()->has('message'))
{{ session('message') }}
@endif
@if($ShowEmployeeInForm)
@endif
@forelse ($violations as $violation) @empty @endforelse
# {{ __('Employee') }} {{ __('Reason') }} {{ __('Date') }} {{ __('Repeat') }} {{ __('Penalty') }} {{ __('Status') }} {{ __('Attachment') }} {{ __('Actions') }}
{{ $loop->iteration + ($violations->currentPage() - 1) * $violations->perPage() }} {{ $violation->employee->name ?? '-' }} {{ $violation->reason }} {{ $violation->violation_date }} {{ $violation->repeat_count }} {{ $violation->penalty }} {{ __($violation->status ?? 'active') }} @if($violation->attachment_url) {{ __('View') }} @else — @endif @can('violations edit') @endcan @can('violations delete') @endcan {{ __('View') }}
{{ __('No violations found.') }}
{{ $violations->links() }}

{{ __('Confirm Deletion') }}

{{ __('Are you sure you want to delete this violation?') }}