@if(in_array('client',user_roles()) || (!in_array('admin',user_roles()) && in_array('employee',user_roles()) && $viewEmployeePermission != 'all'))
@foreach ($userIds as $user)
@endforeach
@else
@php
// Retrieve selected employee IDs and their statuses
$selectedEmployeeIds = $employees->pluck('id')->toArray();
$selectedEmployees = $employees->filter(function ($employee) use ($selectedEmployeeIds) {
return in_array($employee->id, $selectedEmployeeIds);
});
$hasDeactivatedSelected = $selectedEmployees->contains(function ($employee) {
return $employee->status === 'deactive';
});
// Get the active employees list
$activeEmployees = $employees->filter(function ($employee) {
return $employee->status === 'active';
});
if ($hasDeactivatedSelected) {
$deactivatedSelectedEmployees = $selectedEmployees->filter(function ($employee) use ($attendeeArray) {
return in_array($employee->id, $attendeeArray) && $employee->status === 'deactive';
});
$employeesToShow = $activeEmployees->merge($deactivatedSelectedEmployees);
} else {
$employeesToShow = $activeEmployees;
}
@endphp
@endif
@if(!in_array('client', user_roles()) && in_array('clients', user_modules()))
@if((!in_array('admin',user_roles()) && in_array('employee',user_roles()) && $viewClientPermission != 'all'))
@foreach ($clientIds as $client)
@endforeach
@else
@endif
@endif
@if(in_array('client',user_roles()) || (!in_array('admin',user_roles()) && in_array('employee',user_roles()) && $viewEmployeePermission != 'all'))
@else
@php
$activeEmployees = $employees->filter(function ($employee) {
return $employee->status !== 'deactive';
});
$selectedEmployee = $employees->firstWhere('id', $event->host);
if ($selectedEmployee && $selectedEmployee->status === 'deactive') {
$employeesToShow = $activeEmployees->push($selectedEmployee);
} else {
$employeesToShow = $activeEmployees;
}
@endphp
@endif
@forelse($event->files as $file)
@empty
@endforelse