{{ auth()->user()->tenant_name }} - Dashboard
@if (auth()->user()->hasRole('HOD/checker')) @endif
@if (auth()->user()->hasRole('HOD/checker')) @foreach ($departments as $department) @php $currentDeptData = $todayPunchData->where(fn($item) => $item->user?->department_id == $department->id)->where(fn($item) => $item->user->employee_type == $employeeType); @endphp
{{ ucwords($department->first()['name']) }}
Total
{{ $department->users_count }}
Present
{{ $currentDeptData->count() }}
Absent
{{ abs($department->users_count - $currentDeptData->count()) }}
@endforeach @endif
@if ($is_admin)
Total Employees

{{ $totalEmployees }}

Total Department

{{ $totalDepartments }}

Total Holidays

{{ $totalHolidays }}

Total Office

{{ $totalWards->count() }}

@endif
@if ($is_admin)
{{-- Todays present --}}
Today's Present
@php $todaysPresentCount = $todayPunchData->where('check_in', '!=', '0000-00-00 00:00:00')->count(); $todaysPresentPercent = $totalEmployees ? round(($todaysPresentCount / $totalEmployees) * 100) : '0'; $todaysAbsentCount = $totalEmployees - $todaysPresentCount; @endphp
{{-- Todays absent --}}
Today's Absent
{{-- Leave bifurcation --}} {{-- --}}
{{-- Repeatedly latemark / absent --}} {{--
@php $repeatedlyLateMark = $punchData->groupBy('emp_code')->countBy( fn($item) => $item->where('is_latemark', '>', '0')->count() > 1 ); $repeatedlyLateMark = array_key_exists('1', $repeatedlyLateMark->toArray()) ? $repeatedlyLateMark['1'] : 0; @endphp
Repeatedly Late Mark
{{ $repeatedlyLateMark }} ({{ $totalEmployees ? round(($repeatedlyLateMark/$totalEmployees)*100) : '0' }}%)
Repeatedly Late Mark
@php $regularEmployeeCount = $punchData->groupBy('emp_code')->count(); $repeatedlyAbsent = $totalEmployees-$regularEmployeeCount; @endphp
Repeatedly Absent
{{ max($repeatedlyAbsent, 0) }} ({{ $totalEmployees ? round(($repeatedlyAbsent/$totalEmployees)*100) : '0' }}%)
Repeatedly Absent
--}}
{{-- Side recent 6 attendance list --}}
Today's Latest 6 Records
{{-- @php $latestFives = $todayPunchData->where('punch_by', '0')->reverse()->take(6); @endphp --}} @foreach ($todayPunchData->sortByDesc('check_in')->take(6) as $latest)
{{ Str::limit(ucwords($latest['user']['name'] ?? ''), 25) }}
#{{ $latest['emp_code'] }}    {{ Carbon\Carbon::parse($latest['check_in'])->format('d-m-Y h:i A') }}

{{ Str::limit(ucfirst($latest['user']?->department['name'] ?? ''), 25) }}

@endforeach
{{-- Contractor wise details --}}
@if ($is_admin && request()->department && !$totalContractors->isEmpty())
Contractor Wise Details
{{-- --}} @php $i = 1; @endphp @foreach ($totalContractors as $key => $totalContractor) @foreach ($designations as $val => $designation) @php $usersWithDesignation = $totalContractor->users->where('designation_id', $designation->id)->where('department_id', request()->department); $usersCountWithDesignation = $usersWithDesignation->count(); // Filter punch data for current contractor, department, and employee type $currentContractorData = $todayPunchData->filter(function ($item) use ($totalContractor, $designation, $employeeType) { return $item->user->contractor_id == $totalContractor->id && $item->user->department_id == request()->department && $item->user->employee_type == $employeeType && $item->user->designation_id == $designation->id; }); $presentCount = $currentContractorData->count(); $absentCount = $usersCountWithDesignation - $presentCount; @endphp @if ($usersCountWithDesignation > 0) {{-- --}} @php ++$i; @endphp @endif @endforeach @endforeach
Sr NoDepartmentContractor Designation Total Employee Today's Present Today's Absent Progress Bar
{{ $i }}{{ $totalContractor?->users?->department?->name }} {{ Str::limit(ucwords($totalContractor->name), 25) }} {{ $designation->name }} {{ $usersCountWithDesignation }} {{ $presentCount }} {{ $absentCount }}
   {{ $usersCountWithDesignation ? floor(($presentCount / $usersCountWithDesignation) * 100) : ' 0' }}%
{{-- @foreach ($totalContractors as $totalContractor) @php $currentContractorData = $todayPunchData->where( fn($item) => $item->user->contractor_id == $totalContractor->id ); $currentContractorData = $currentContractorData->where( fn($item) => $item->user->department_id == request()->department ); $currentContractorData = $currentContractorData->where( fn($item) => $item->user->employee_type == $employeeType ); @endphp @endforeach --}}
@endif
{{--
@if ($is_admin && request()->department && !$totalContractors->isEmpty())
Contractor Wise Details
@foreach ($totalContractors as $totalContractor) @php $currentContractorData = $todayPunchData->where( fn($item) => $item->user->contractor_id == $totalContractor->id ); $currentContractorData = $currentContractorData->where( fn($item) => $item->user->department_id == request()->department ); $currentContractorData = $currentContractorData->where( fn($item) => $item->user->employee_type == $employeeType ); @endphp @endforeach
@endif
--}} {{-- Office/Ward wise details --}}
@if ($is_admin && request()->department)
Office Wise Details
@foreach ($totalWards as $totalWard) @php $currentWardData = $todayPunchData->where(fn($item) => $item->user->ward_id == $totalWard->id); $currentWardData = $currentWardData->where(fn($item) => $item->user->department_id == request()->department); $currentWardData = $currentWardData->where(fn($item) => $item->user->employee_type == $employeeType); @endphp
{{ Str::limit(ucwords($totalWard->name), 25) }} Office
Total
{{ $totalWard->users_count }}
Present
{{ $currentWardData->count() }} ({{ $totalWard->users_count ? round(($currentWardData->count() / $totalWard->users_count) * 100) : '0' }}%)
Absent
{{ abs($totalWard->users_count - $currentWardData->count()) }} ({{ $totalWard->users_count ? round((($totalWard->users_count - $currentWardData->count()) / $totalWard->users_count) * 100) : '0' }}%)
{{-- --}}
@endforeach
@endif
{{-- Department wise details --}}
@if ($is_admin && !request()->department)
Department Wise Details
@foreach ($departments as $department) @php $currentDeptData = $todayPunchData // ->where( fn($item) => $item->user->ward_id == request()->ward ) ->where(fn($item) => $item->user?->department_id == $department->id) ->where(fn($item) => $item->user->employee_type == $employeeType); @endphp
{{ Str::limit(ucwords($department['name']), 25) }}
Total
{{ $department['users_count'] }}
Present
{{ $currentDeptData->count() }} ({{ $department['users_count'] ? round(($currentDeptData->count() / $department['users_count']) * 100) : '0' }}%)
Absent
{{ abs($department['users_count'] - $currentDeptData->count()) }} ({{ $department['users_count'] ? round((($department['users_count'] - $currentDeptData->count()) / $department['users_count']) * 100) : '0' }}%)
{{-- --}}
@endforeach
@endif
@endif
@if ($isHigherAuthority)
@endif
@push('scripts') @endpush