diff --git a/app/Services/EmployeeService.php b/app/Services/EmployeeService.php index 1bd132f075..6679e3f0e4 100644 --- a/app/Services/EmployeeService.php +++ b/app/Services/EmployeeService.php @@ -11,7 +11,8 @@ public function index($filters = []) $employees = Employee::applyFilters($filters) ->leftJoin('project_team_members', 'employees.user_id', '=', 'project_team_members.team_member_id') ->leftJoin('projects', 'project_team_members.project_id', '=', 'projects.id') - ->selectRaw('employees.*, team_member_id, count(case when projects.status = "active" and project_team_members.ended_on is null then 1 else null end) as active_project_count') + ->leftJoin('clients', 'projects.client_id', '=', 'clients.id') + ->selectRaw('employees.*, team_member_id, count(case when projects.status = "active" and project_team_members.ended_on is null then 1 else null end) as active_project_count, count(distinct case when clients.status = "active" and project_team_members.ended_on is null then clients.id else null end) as active_clients_count') ->groupBy('employees.user_id') ->orderby('active_project_count', 'desc') ->get(); diff --git a/resources/views/hr/employees/index.blade.php b/resources/views/hr/employees/index.blade.php index d893cbdcca..9272f45d95 100644 --- a/resources/views/hr/employees/index.blade.php +++ b/resources/views/hr/employees/index.blade.php @@ -37,6 +37,7 @@ Name @if($routeName === "employees") Active Projects Count + Active Clients Count Overall FTE @@ -88,6 +89,13 @@ class="{{ config('constants.review-tags.completed.class') }} badge-pill mr-1 mb- {{ $employee->active_project_count }} @endif + + @if ($employee->user == null) + 0 + @else + {{ $employee->active_clients_count }} + @endif + @if(today()==today()->startOfMonth()) {{ 0 }} @else