Staff Allocation Report
Active projects only
@if($staffFilter !== 'unallocated' && (int)$totalAllocatedRows > 0) @endif
@if($showDepartmentTotals && $staffFilter !== 'unallocated') @php $departmentWiseProjects = []; foreach ($departmentColumns as $deptKey => $deptLabel) { $departmentWiseProjects[$deptKey] = [ 'label' => $deptLabel, 'projects' => 0, 'incharges' => 0, ]; } foreach ($employees as $employee) { foreach ($departmentColumns as $deptKey => $deptLabel) { $departmentWiseProjects[$deptKey]['projects'] += (int)($countsByEmployee[$employee->id][$deptKey]['projects'] ?? 0); $departmentWiseProjects[$deptKey]['incharges'] += (int)($countsByEmployee[$employee->id][$deptKey]['incharges'] ?? 0); } } @endphp
Department-wise Project Totals
@forelse($departmentWiseProjects as $row) @empty @endforelse
# Department / Ministry Projects Center Incharges
{{ $loop->iteration }} {{ $row['label'] }} {{ $row['projects'] }} {{ $row['incharges'] }}
No data available.
@endif
@php $assignYear = request()->year ?: date('Y'); $showAssignColumn = $canAssignProject && $staffFilter !== 'unallocated'; @endphp
@if($showZoneFilter)
@elseif($fixedZoneLabel)
@endif @if($showMinistryFilter)
@elseif($fixedMinistryLabel)
@endif
‹
›
@if(count($departmentColumns) > 0) @endif @foreach($departmentColumns as $deptKey => $deptLabel) @endforeach @forelse($employees as $i => $employee) @php // Red row: employee is no longer active but still has project allocations left on record (data needs cleanup). $isInactiveWithProjects = strtolower((string) ($employee->status ?? '')) !== 'active' && (int) ($totalsByEmployee[$employee->id]['projects'] ?? 0) > 0; $employeeStatus = trim((string) ($employee->status ?? '')); $employeeStatusLabel = $employeeStatus !== '' ? ucwords(str_replace('_', ' ', $employeeStatus)) : 'Unknown'; // Yellow row: employee has at least one allocated project more than 500km from their base location. $hasLongDistanceAllocation = (int) ($distanceRangeByEmployee[$employee->id]['max'] ?? 0) > 500; @endphp @php $totalProjectsCount = (int) ($totalsByEmployee[$employee->id]['projects'] ?? 0); $totalInchargesCount = (int) ($totalsByEmployee[$employee->id]['incharges'] ?? 0); @endphp @foreach($departmentColumns as $deptKey => $deptLabel) @php $deptCount = (int) ($countsByEmployee[$employee->id][$deptKey]['projects'] ?? 0); $deptInchargeCount = (int) ($countsByEmployee[$employee->id][$deptKey]['incharges'] ?? 0); @endphp @endforeach @if(isset($expanded[$employee->id])) @php $selectedType = $expanded[$employee->id]; $projectsToShow = collect($projectDetails[$employee->id][$selectedType] ?? []); @endphp @endif @empty @endforelse
# Employee Name Zone Map/Distance Projects
Allocated
Project Allocation Breakup
{{ strtolower(str_replace('_', ' ', $deptKey)) }}
{{ $i + 1 }} @if($canOpenEmployee) {{ $employee->name }} @else {{ $employee->name }} @endif
{{ AppHelper::dropdown($employee->designation, 'employee_designations') }} @if($isInactiveWithProjects) @php $inactiveFlagTitle = 'Row highlighted red: employee status is "'.$employeeStatusLabel.'" but still has '.((int) ($totalsByEmployee[$employee->id]['projects'] ?? 0)).' project allocation(s) on record.'; @endphp {{ $employeeStatusLabel }} ! @endif
{{ AppHelper::dropdown($employee->department, 'zones') ?: AppHelper::dropdown($employee->department, 'departments') }}
@if(isset($distanceRangeByEmployee[$employee->id]['label']))
{{ $distanceRangeByEmployee[$employee->id]['label'] }} @if($hasLongDistanceAllocation) ! @endif
@else
N/A
@endif
@if($totalProjectsCount > 0)
@endif
@if($deptCount > 0)
@endif
Project Details {{ strtoupper($selectedType) }}
Projects: {{ $projectsToShow->count() }} | Centers: {{ $projectsToShow->sum(function($p){ return (int)($p['total_centers'] ?? 0); }) }}
@forelse($projectsToShow as $project) @empty @endforelse
# Project Code Ministry Zone Start Date End Date Centers
{{ $loop->iteration }} {{ $project['code'] }} {{ AppHelper::dropdown($project['project_name'], 'all_new_programs') ?: strtoupper($project['project_name']) }} {{ AppHelper::dropdown($project['zone'], 'zones') ?: $project['zone'] }} {{ AppHelper::date($project['start_date']) }} {{ AppHelper::date($project['end_date']) }} {{ (int)($project['total_centers'] ?? 0) }}
No projects available for this selection.
No records found.