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 @@ - {{-- 하위 파트너 활동 테이블 --}} -
-
-
-
- - - -
-
-

유치 파트너 활동 현황

-

직접 유치한 파트너들의 영업 활동을 확인하세요

-
-
-
- - @if(count($partnerActivities) === 0) + {{-- 파트너별 영업 현황 --}} + @if(count($partnerActivities) === 0) +
@@ -85,126 +71,215 @@

유치한 파트너가 없습니다

파트너를 유치하면 이곳에서 활동 현황을 확인할 수 있습니다

- @else -
- - - - - - - - - - - - - - @foreach($partnerActivities as $activity) - @php - $statusColors = [ - 'active' => 'bg-green-100 text-green-800', - 'moderate' => 'bg-yellow-100 text-yellow-800', - 'inactive' => 'bg-gray-100 text-gray-800', - ]; - $statusLabels = [ - 'active' => '활동중', - 'moderate' => '보통', - 'inactive' => '비활동', - ]; - @endphp - - - - - - - - - - + + @else + @foreach($partnerActivities as $activity) + @php + $statusColors = [ + 'active' => 'bg-green-100 text-green-800 border-green-200', + 'moderate' => 'bg-yellow-100 text-yellow-800 border-yellow-200', + 'inactive' => 'bg-gray-100 text-gray-600 border-gray-200', + ]; + $statusLabels = [ + 'active' => '활동중', + 'moderate' => '보통', + 'inactive' => '비활동', + ]; + $borderColors = [ + 'active' => 'border-green-300', + 'moderate' => 'border-yellow-300', + 'inactive' => 'border-gray-200', + ]; + @endphp +
+ {{-- 파트너 헤더 --}} +
+
+
+ {{-- 펼침 아이콘 --}} + + {{-- 파트너 정보 --}} +
+
+ {{ mb_substr($activity['partner']->name, 0, 1) }} +
+
+

{{ $activity['partner']->name }}

+

{{ $activity['partner']->email }}

+
+
+ {{-- 역할 배지 --}} + + {{ $activity['role_label'] }} + + {{-- 상태 배지 --}} + + {{ $statusLabels[$activity['status']] ?? '비활동' }} + +
+ {{-- 요약 통계 --}} +
+
+

영업권

+

{{ $activity['prospect_count'] }}

+
+
+

진행중

+

{{ $activity['active_prospects'] }}

+
+
+

인계완료

+

{{ $activity['conversions'] }}

+
+
+

예상수당

+

₩{{ number_format($activity['manager_commission']) }}

+
+
+
+
- -
- - - @endforeach - -
파트너역할영업권진행중성공예상수당상태
-
- -
-

{{ $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 +
+
+
+

{{ $prospect->company_name }}

+

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

+
+ @if($prospect->isActive()) + D-{{ $prospect->remaining_days }} + @endif +
+ {{-- 영업/매니저 진행률 --}} +
+
+
+ 영업 + {{ $prospectProgress['sales']['percentage'] }}% +
+
+
-
- {{-- 진행 단계 표시 --}} -
- - - - +
+
+ 매니저 + {{ $prospectProgress['manager']['percentage'] }}%
- - {{ $prospect->converted_at?->format('Y-m-d') ?? '-' }} - - - 계약완료 +
+
+
+
+
+ {{-- 개발 진행 상태 (100% 완료 시) --}} + @if($isProspectHqEnabled) +
+
+ 개발 +
+ @foreach($prospectHqStatuses as $statusKey => $statusLabel) + @php + $stepNum = $prospectHqStatusOrder[$statusKey]; + $isCompleted = $stepNum < $prospectCurrentHqStep; + $isCurrent = $stepNum === $prospectCurrentHqStep; + @endphp +
+ @endforeach +
+ {{ $prospectManagement->hq_status_label }} +
+
+ @endif +
+ @endforeach +
+
+ @endif + + {{-- 인계 완료 (계약 성사) --}} + @if($activity['recent_tenants']->isNotEmpty()) +
+
+ 인계 완료 + {{ $activity['conversions'] }}건 +
+
+ @foreach($activity['recent_tenants'] as $prospect) +
+
+
+

{{ $prospect->company_name }}

+

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

+
+
+ {{ $prospect->converted_at?->format('Y-m-d') ?? '-' }} + + + + + 완료
- @endforeach -
- @endif -
+ {{-- 완료 프로그레스 바 --}} +
+
+
+ 영업 + 100% +
+
+
+
+
+ 매니저 + 100% +
+
+
+
+
+ @endforeach +
+
+ @endif +
+ @endif + - @endif - + @endforeach + @endif