feat:영업 대시보드에 진행중 가망고객 표시 추가
- 고객 관리에서 등록한 가망고객(TenantProspect)도 내 계약 현황에 표시 - active/expired 상태의 가망고객을 '영업 진행중' 섹션으로 구분하여 표시 - 영업권 만료까지 D-day 표시 - 상세 버튼으로 고객 관리 페이지 연결 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -158,9 +158,16 @@ private function getDashboardData(Request $request): array
|
||||
// 두 목록 합치기 (중복 제거)
|
||||
$convertedTenantIds = array_unique(array_merge($registeredTenantIds, $managedTenantIds));
|
||||
|
||||
// 3) 내가 등록한 가망고객 (아직 전환되지 않은 것 - active 상태)
|
||||
$prospects = TenantProspect::whereIn('registered_by', $partnerIds)
|
||||
->whereIn('status', [TenantProspect::STATUS_ACTIVE, TenantProspect::STATUS_EXPIRED])
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
|
||||
// 수익 및 테넌트 관리 통계 (실제 데이터)
|
||||
$tenantStats = [
|
||||
'total_tenants' => count($convertedTenantIds), // 관리 테넌트
|
||||
'total_prospects' => $prospects->count(), // 진행중 가망고객
|
||||
'total_membership_revenue' => $totalMembershipFee, // 총 가입비 실적
|
||||
'total_commission_accumulated' => $totalCommission, // 누적 수당
|
||||
'confirmed_commission' => $paidCommission, // 확정(지급완료) 수당
|
||||
@@ -190,6 +197,7 @@ private function getDashboardData(Request $request): array
|
||||
'totalCommissionRatio',
|
||||
'tenantStats',
|
||||
'tenants',
|
||||
'prospects',
|
||||
'managements',
|
||||
'allManagers',
|
||||
'period',
|
||||
|
||||
@@ -51,20 +51,93 @@
|
||||
</div>
|
||||
<h2 class="text-xl font-bold text-gray-800">내 계약 현황</h2>
|
||||
</div>
|
||||
<span class="text-sm text-gray-500">총 {{ $tenants->total() }}건</span>
|
||||
<span class="text-sm text-gray-500">총 {{ $tenants->total() + (isset($prospects) ? $prospects->count() : 0) }}건</span>
|
||||
</div>
|
||||
|
||||
@if($tenants->isEmpty())
|
||||
{{-- 가망고객 (아직 전환되지 않은 영업권) --}}
|
||||
@if(isset($prospects) && $prospects->isNotEmpty())
|
||||
<div class="mb-6">
|
||||
<div class="flex items-center gap-2 mb-3">
|
||||
<span class="text-sm font-semibold text-orange-600">영업 진행중</span>
|
||||
<span class="px-2 py-0.5 bg-orange-100 text-orange-700 text-xs font-medium rounded-full">{{ $prospects->count() }}건</span>
|
||||
</div>
|
||||
<div class="divide-y divide-gray-100 border border-orange-200 rounded-lg bg-orange-50/30">
|
||||
@foreach($prospects as $prospect)
|
||||
<div class="flex items-center gap-4 px-4 py-3 hover:bg-orange-50 transition-colors">
|
||||
<!-- 업체명 및 정보 -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="font-bold text-gray-900 truncate">{{ $prospect->company_name }}</div>
|
||||
<span class="px-2 py-0.5 text-xs font-medium rounded-full {{ $prospect->status_color }}">
|
||||
{{ $prospect->status_label }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-xs text-gray-500 mt-0.5">
|
||||
@if($prospect->ceo_name)
|
||||
<span>대표: {{ $prospect->ceo_name }}</span>
|
||||
<span class="mx-1">|</span>
|
||||
@endif
|
||||
<span>{{ $prospect->business_number ?? '-' }}</span>
|
||||
@if($prospect->contact_phone)
|
||||
<span class="mx-1">|</span>
|
||||
<span>{{ $prospect->contact_phone }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 영업권 유효기간 -->
|
||||
<div class="flex-shrink-0 text-center">
|
||||
@if($prospect->isActive())
|
||||
<div class="text-xs text-gray-400">영업권 만료까지</div>
|
||||
<div class="text-lg font-bold text-orange-600">D-{{ $prospect->remaining_days }}</div>
|
||||
@elseif($prospect->isExpired())
|
||||
<div class="text-xs text-gray-400">상태</div>
|
||||
<div class="text-sm font-medium text-gray-500">만료됨</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- 등록일 -->
|
||||
<div class="flex-shrink-0 text-right border-l border-gray-200 pl-4">
|
||||
<div class="text-xs text-gray-400">등록일</div>
|
||||
<div class="text-sm font-medium text-gray-700">{{ $prospect->registered_at?->format('Y-m-d') ?? $prospect->created_at->format('Y-m-d') }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 고객 관리 바로가기 -->
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('sales.prospects.index') }}?search={{ $prospect->business_number }}"
|
||||
class="inline-flex items-center gap-1 px-3 py-1.5 rounded text-xs font-medium bg-orange-600 text-white hover:bg-orange-700 transition-colors">
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
상세
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- 계약 완료 고객 --}}
|
||||
@if($tenants->isNotEmpty())
|
||||
<div class="flex items-center gap-2 mb-3">
|
||||
<span class="text-sm font-semibold text-green-600">계약 완료</span>
|
||||
<span class="px-2 py-0.5 bg-green-100 text-green-700 text-xs font-medium rounded-full">{{ $tenants->total() }}건</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($tenants->isEmpty() && (!isset($prospects) || $prospects->isEmpty()))
|
||||
<div class="text-center py-16">
|
||||
<div class="w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4">
|
||||
<svg class="w-8 h-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
</div>
|
||||
<p class="text-gray-600 font-medium mb-1">아직 계약이 없습니다</p>
|
||||
<p class="text-sm text-gray-400">가망고객에서 전환된 계약이 여기에 표시됩니다</p>
|
||||
<p class="text-gray-600 font-medium mb-1">등록된 고객이 없습니다</p>
|
||||
<p class="text-sm text-gray-400">고객 관리에서 명함을 등록하면 여기에 표시됩니다</p>
|
||||
</div>
|
||||
@else
|
||||
@elseif($tenants->isNotEmpty())
|
||||
<!-- 테이블 헤더 (숨김 처리 - 심플 레이아웃) -->
|
||||
{{-- 헤더 없는 깔끔한 리스트 스타일 --}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user