diff --git a/app/Services/DashboardCeoService.php b/app/Services/DashboardCeoService.php index d021e4c..1dccd32 100644 --- a/app/Services/DashboardCeoService.php +++ b/app/Services/DashboardCeoService.php @@ -364,7 +364,7 @@ private function getProductionProcesses(int $tenantId, string $today): array ->leftJoin('processes as p', 'wo.process_id', '=', 'p.id') ->select( 'p.id as process_id', - 'p.name as process_name', + 'p.process_name as process_name', DB::raw('COUNT(*) as total_work'), DB::raw("SUM(CASE WHEN wo.status = 'pending' OR wo.status = 'unassigned' OR wo.status = 'waiting' THEN 1 ELSE 0 END) as todo"), DB::raw("SUM(CASE WHEN wo.status = 'in_progress' THEN 1 ELSE 0 END) as in_progress"), @@ -376,8 +376,8 @@ private function getProductionProcesses(int $tenantId, string $today): array ->where('wo.is_active', true) ->whereNull('wo.deleted_at') ->whereNotNull('wo.process_id') - ->groupBy('p.id', 'p.name') - ->orderBy('p.name') + ->groupBy('p.id', 'p.process_name') + ->orderBy('p.process_name') ->get(); return $processData->map(function ($process) use ($tenantId, $today) { @@ -676,13 +676,17 @@ public function attendanceSummary(): array // 오늘 근태 기록 $attendances = DB::table('attendances as a') ->leftJoin('users as u', 'a.user_id', '=', 'u.id') - ->leftJoin('departments as d', 'u.department_id', '=', 'd.id') + ->leftJoin('tenant_user_profiles as tup', function ($join) use ($tenantId) { + $join->on('tup.user_id', '=', 'u.id') + ->where('tup.tenant_id', '=', $tenantId); + }) + ->leftJoin('departments as d', 'tup.department_id', '=', 'd.id') ->select([ 'a.id', 'a.status', 'u.name', 'd.name as department', - 'u.position', + 'tup.position_key as position', ]) ->where('a.tenant_id', $tenantId) ->where('a.base_date', $today)