@if ($addProjectCategoryPermission == 'all' || $addProjectCategoryPermission == 'added')
@endif
@if (!in_array('client', user_roles()) && ($editProjectMembersPermission == 'all' || $editPermission == 'all'))
@endif
{{-- @if ($addClientPermission == 'all' || $addClientPermission == 'added')--}}
{{-- --}}
{{-- --}}
{{-- --}}
{{-- @endif--}}
@if ($project->public == 1 && $createPublicProjectPermission == 'all')
@endif
@if ($project->public == 0 && $createPublicProjectPermission == 'all')
@endif
@if ($editProjectMembersPermission == 'all' || $editPermission == 'all')
@php
// Retrieve selected employee IDs and their statuses
$selectedEmployeeIds = $project->members->pluck('user_id')->toArray();
$selectedEmployees = $employees->filter(function ($employee) use ($selectedEmployeeIds) {
return in_array($employee->id, $selectedEmployeeIds);
});
// Get the active employees list
$activeEmployees = $employees->filter(function ($employee) {
return $employee->status === 'active';
});
$employeesToShow = $activeEmployees->merge($selectedEmployees->filter(function ($employee) {
return !$employee->is_active;
}));
@endphp
@if ($addEmployeePermission == 'all' || $addEmployeePermission == 'added')
@endif
@endif
@if ($project->public == 1 && $editProjectMembersPermission || $editPermission == 'all')
@if ($addEmployeePermission == 'all' || $addEmployeePermission == 'added')
@endif
@elseif(in_array('employee', user_roles()))
@endif
@foreach ($projectStatus as $status)
@endforeach
@foreach ($currencies as $currency)
@endforeach
@if ($editPermission == 'all')
@php
$activeEmployees = $employees->filter(function ($employee) {
return $employee->status !== 'deactive';
});
$selectedEmployee = $employees->firstWhere('id', $project->added_by);
if ($selectedEmployee && $selectedEmployee->status === 'deactive') {
$employeesToShow = $activeEmployees->push($selectedEmployee);
} else {
$employeesToShow = $activeEmployees;
}
@endphp
@foreach ($employeesToShow as $item)
@endforeach
@endif