From 1c028749822a230862fbc23f1991f67189affdf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Mon, 2 Feb 2026 14:42:05 +0900 Subject: [PATCH] =?UTF-8?q?feat:=EC=9C=A0=EC=B9=98=20=ED=8C=8C=ED=8A=B8?= =?UTF-8?q?=EB=84=88=20=ED=98=84=ED=99=A9=EC=97=90=20=EB=A7=A4=EB=8B=88?= =?UTF-8?q?=EC=A0=80=20=EC=A7=84=ED=96=89=20=EA=B1=B4=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 파트너가 매니저로 지정된 가망고객 조회 로직 추가 - 파트너 헤더에 매니저 진행 건수 표시 - 펼침 영역에 "매니저로 진행 중" 섹션 추가 - 등록 영업권이 없어도 매니저 진행 건이 있으면 표시 Co-Authored-By: Claude Opus 4.5 --- .../Sales/SalesDashboardController.php | 22 ++++- .../partials/partner-activity.blade.php | 93 ++++++++++++++++++- 2 files changed, 113 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Sales/SalesDashboardController.php b/app/Http/Controllers/Sales/SalesDashboardController.php index 59bf8e53..a35a6ece 100644 --- a/app/Http/Controllers/Sales/SalesDashboardController.php +++ b/app/Http/Controllers/Sales/SalesDashboardController.php @@ -617,12 +617,31 @@ private function getPartnerActivitiesDetail($recruitedPartners, int $currentUser ->limit(5) ->get(); - // 파트너의 모든 가망고객 (진행률 조회용) + // 파트너의 모든 가망고객 (진행률 조회용) - 직접 등록한 건 $allProspects = TenantProspect::where('registered_by', $partner->id) ->whereIn('status', [TenantProspect::STATUS_ACTIVE, TenantProspect::STATUS_EXPIRED]) ->orderBy('created_at', 'desc') ->get(); + // 파트너가 매니저로 참여하는 가망고객 (다른 사람이 등록, 이 파트너가 매니저) + $managerProspects = collect(); + $managerManagements = SalesTenantManagement::where('manager_user_id', $partner->id) + ->whereNotNull('tenant_prospect_id') + ->with(['tenantProspect.registeredBy']) + ->get(); + + foreach ($managerManagements as $mgmt) { + $prospect = $mgmt->tenantProspect; + // 본인이 등록한 건은 제외 (이미 allProspects에 포함됨) + if ($prospect && $prospect->registered_by !== $partner->id) { + $managerProspects->push([ + 'prospect' => $prospect, + 'management' => $mgmt, + 'registeredBy' => $prospect->registeredBy, + ]); + } + } + // 활동 상태 판단 $lastActivity = TenantProspect::where('registered_by', $partner->id) ->orderBy('updated_at', 'desc') @@ -652,6 +671,7 @@ private function getPartnerActivitiesDetail($recruitedPartners, int $currentUser 'status' => $status, 'recent_tenants' => $recentTenants, 'all_prospects' => $allProspects, + 'manager_prospects' => $managerProspects, // 매니저로만 참여하는 건 ]; } diff --git a/resources/views/sales/dashboard/partials/partner-activity.blade.php b/resources/views/sales/dashboard/partials/partner-activity.blade.php index 6dc68cd5..a3da4a02 100644 --- a/resources/views/sales/dashboard/partials/partner-activity.blade.php +++ b/resources/views/sales/dashboard/partials/partner-activity.blade.php @@ -229,6 +229,12 @@

영업권

{{ $activity['prospect_count'] }}

+ @if(isset($activity['manager_prospects']) && count($activity['manager_prospects']) > 0) +
+

매니저

+

{{ count($activity['manager_prospects']) }}

+
+ @endif

진행중

{{ $activity['active_prospects'] }}

@@ -251,7 +257,10 @@ {{-- 가망고객 목록 (펼침 영역) --}}
- @if($activity['all_prospects']->isEmpty() && $activity['recent_tenants']->isEmpty()) + @php + $hasManagerProspects = isset($activity['manager_prospects']) && count($activity['manager_prospects']) > 0; + @endphp + @if($activity['all_prospects']->isEmpty() && $activity['recent_tenants']->isEmpty() && !$hasManagerProspects)
@@ -260,6 +269,88 @@
@else
+ {{-- 매니저로 진행 중인 건 (다른 사람이 등록, 이 파트너가 매니저) --}} + @if($hasManagerProspects) +
+
+ 매니저로 진행 중 + {{ count($activity['manager_prospects']) }}건 +
+
+ @foreach($activity['manager_prospects'] as $item) + @php + $mProspect = $item['prospect']; + $mManagement = $item['management']; + $mRegisteredBy = $item['registeredBy']; + $mProgress = \App\Models\Sales\SalesScenarioChecklist::getProspectProgress($mProspect->id); + $mHqStatuses = \App\Models\Sales\SalesTenantManagement::$hqStatusLabels; + $mHqStatusOrder = \App\Models\Sales\SalesTenantManagement::$hqStatusOrder; + $mCurrentHqStep = $mHqStatusOrder[$mManagement->hq_status ?? 'pending'] ?? 0; + $isMHqEnabled = $mProgress['sales']['percentage'] >= 100 && $mProgress['manager']['percentage'] >= 100; + @endphp +
+
+
+

{{ $mProspect->company_name }}

+

{{ $mProspect->business_number ?? '-' }}

+
+
+ + 매니저만 진행 + +
+
+ {{-- 등록자 정보 --}} +
+ 등록자: + {{ $mRegisteredBy?->name ?? '-' }} +
+ {{-- 영업/매니저 진행률 --}} +
+
+
+ 영업 + ({{ $mProgress['sales']['percentage'] }}%) +
+
+
+
+
+
+
+ 매니저 + {{ $mProgress['manager']['percentage'] }}% +
+
+
+
+
+
+ {{-- 개발 진행 상태 (100% 완료 시) --}} + @if($isMHqEnabled) +
+
+ 개발 +
+ @foreach($mHqStatuses as $statusKey => $statusLabel) + @php + $stepNum = $mHqStatusOrder[$statusKey]; + $isCompleted = $stepNum < $mCurrentHqStep; + $isCurrent = $stepNum === $mCurrentHqStep; + @endphp +
+ @endforeach +
+ {{ $mManagement->hq_status_label }} +
+
+ @endif +
+ @endforeach +
+
+ @endif + {{-- 진행 중인 가망고객 --}} @if($activity['all_prospects']->isNotEmpty())