diff --git a/app/Http/Controllers/Sales/SalesDashboardController.php b/app/Http/Controllers/Sales/SalesDashboardController.php index 5bdee604..6b698dc7 100644 --- a/app/Http/Controllers/Sales/SalesDashboardController.php +++ b/app/Http/Controllers/Sales/SalesDashboardController.php @@ -500,6 +500,12 @@ 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(); + // 활동 상태 판단 $lastActivity = TenantProspect::where('registered_by', $partner->id) ->orderBy('updated_at', 'desc') @@ -527,6 +533,7 @@ private function getPartnerActivitiesDetail($recruitedPartners, int $currentUser 'manager_commission' => $managerCommission, 'status' => $status, 'recent_tenants' => $recentTenants, + 'all_prospects' => $allProspects, ]; } diff --git a/resources/views/sales/dashboard/partials/partner-activity.blade.php b/resources/views/sales/dashboard/partials/partner-activity.blade.php index 7fd83d2d..d12051b2 100644 --- a/resources/views/sales/dashboard/partials/partner-activity.blade.php +++ b/resources/views/sales/dashboard/partials/partner-activity.blade.php @@ -59,23 +59,9 @@ - {{-- 하위 파트너 활동 테이블 --}} -
직접 유치한 파트너들의 영업 활동을 확인하세요
-| 파트너 | -역할 | -영업권 | -진행중 | -성공 | -예상수당 | -상태 | -
|---|---|---|---|---|---|---|
|
-
-
-
-
-
- {{ $activity['partner']->name }} -{{ $activity['partner']->email }} - |
- - - {{ $activity['role_label'] }} - - | -- {{ $activity['prospect_count'] }} - | -- {{ $activity['active_prospects'] }} - | -- {{ $activity['conversions'] }} - | -- {{ number_format($activity['manager_commission']) }}원 - | -- - {{ $statusLabels[$activity['status']] ?? '비활동' }} - - | -
|
- @if($activity['recent_tenants']->isEmpty())
-
- 아직 계약 성사 내역이 없습니다
-
- @else
-
- 최근 계약 성사 내역 - @foreach($activity['recent_tenants'] as $prospect) -
-
-
-
- {{ $prospect->company_name }} -{{ $prospect->tenant?->company_name ?? '-' }} + {{-- 가망고객 목록 (펼침 영역) --}} +
+ @if($activity['all_prospects']->isEmpty() && $activity['recent_tenants']->isEmpty())
+
+
+
+ @else
+ 등록된 영업권이 없습니다 +
+ {{-- 진행 중인 가망고객 --}}
+ @if($activity['all_prospects']->isNotEmpty())
+
+
+ 영업 진행중
+ {{ $activity['all_prospects']->count() }}건
+
+
+ @foreach($activity['all_prospects'] as $prospect)
+ @php
+ $prospectProgress = \App\Models\Sales\SalesScenarioChecklist::getProspectProgress($prospect->id);
+ $prospectManagement = \App\Models\Sales\SalesTenantManagement::findOrCreateByProspect($prospect->id);
+ $prospectHqStatuses = \App\Models\Sales\SalesTenantManagement::$hqStatusLabels;
+ $prospectHqStatusOrder = \App\Models\Sales\SalesTenantManagement::$hqStatusOrder;
+ $prospectCurrentHqStep = $prospectHqStatusOrder[$prospectManagement->hq_status ?? 'pending'] ?? 0;
+ $isProspectHqEnabled = $prospectProgress['sales']['percentage'] >= 100 && $prospectProgress['manager']['percentage'] >= 100;
+ @endphp
+
+
+ @endif
+
+ {{-- 인계 완료 (계약 성사) --}}
+ @if($activity['recent_tenants']->isNotEmpty())
+
+
+ {{-- 영업/매니저 진행률 --}}
+
+
+ @if($prospect->isActive())
+ D-{{ $prospect->remaining_days }}
+ @endif
+ {{ $prospect->company_name }} +{{ $prospect->business_number ?? '-' }} +
+
+
+
-
+ 영업
+ {{ $prospectProgress['sales']['percentage'] }}%
+
+
+
- {{-- 진행 단계 표시 --}}
-
+ @endforeach
+
-
-
-
-
+
+ {{-- 개발 진행 상태 (100% 완료 시) --}}
+ @if($isProspectHqEnabled)
+
+
+
+ 매니저
+ {{ $prospectProgress['manager']['percentage'] }}%
-
- {{ $prospect->converted_at?->format('Y-m-d') ?? '-' }}
-
-
- 계약완료
+
+
+
+
+
+ @endif
+
+ 개발
+
+
+ @foreach($prospectHqStatuses as $statusKey => $statusLabel)
+ @php
+ $stepNum = $prospectHqStatusOrder[$statusKey];
+ $isCompleted = $stepNum < $prospectCurrentHqStep;
+ $isCurrent = $stepNum === $prospectCurrentHqStep;
+ @endphp
+
+ @endforeach
+
+ {{ $prospectManagement->hq_status_label }}
+
+
+ 인계 완료
+ {{ $activity['conversions'] }}건
+
+
+ @foreach($activity['recent_tenants'] as $prospect)
+
+
- @endif
-
+
- @endforeach
-
+
+ {{ $prospect->company_name }} +{{ $prospect->business_number ?? '-' }} +
+ {{ $prospect->converted_at?->format('Y-m-d') ?? '-' }}
+
+
+ 완료
|
- ||||||