From b4163d6ffdd80e263e4e8a1d22b2ebf1b09402c0 Mon Sep 17 00:00:00 2001 From: pro Date: Thu, 29 Jan 2026 06:47:37 +0900 Subject: [PATCH] =?UTF-8?q?fix:=EC=98=81=EC=97=85=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EB=8C=80=EC=8B=9C=EB=B3=B4=EB=93=9C=EC=97=90=20=EA=B0=80?= =?UTF-8?q?=EB=A7=9D=EA=B3=A0=EA=B0=9D=20=EC=A0=84=ED=99=98=20=ED=85=8C?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EB=A7=8C=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 기존: 로그인 사용자의 모든 테넌트 표시 (HQ 제외) - 변경: 가망고객(tenant_prospects)에서 전환된 테넌트만 표시 - TenantProspect.STATUS_CONVERTED 상태의 tenant_id만 조회 Co-Authored-By: Claude Opus 4.5 --- .../Controllers/Sales/SalesDashboardController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Sales/SalesDashboardController.php b/app/Http/Controllers/Sales/SalesDashboardController.php index 289f15ed..a857427a 100644 --- a/app/Http/Controllers/Sales/SalesDashboardController.php +++ b/app/Http/Controllers/Sales/SalesDashboardController.php @@ -4,6 +4,7 @@ use App\Http\Controllers\Controller; use App\Models\Sales\SalesTenantManagement; +use App\Models\Sales\TenantProspect; use App\Models\Tenants\Tenant; use App\Models\User; use Illuminate\Http\JsonResponse; @@ -97,10 +98,15 @@ private function getDashboardData(Request $request): array 'confirmed_commission' => 0, // 확정 가입비 수당 ]; - // 테넌트 목록 (현재 로그인한 사용자가 속한 테넌트만, HQ 제외) - $currentUser = auth()->user(); - $tenants = $currentUser->tenants() - ->where('tenant_type', '!=', 'HQ') + // 테넌트 목록 (가망고객에서 전환된 테넌트만) + // 전환된 가망고객의 tenant_id 목록 조회 + $convertedTenantIds = TenantProspect::whereNotNull('tenant_id') + ->where('status', TenantProspect::STATUS_CONVERTED) + ->pluck('tenant_id') + ->toArray(); + + // 전환된 테넌트만 조회 + $tenants = Tenant::whereIn('id', $convertedTenantIds) ->orderBy('created_at', 'desc') ->get();