From 72c18269c9ffc86181222358b59796f2f790f267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Wed, 4 Feb 2026 09:39:28 +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=201=EC=B0=A8/2=EC=B0=A8=20?= =?UTF-8?q?=EC=88=98=EB=8B=B9=20=EC=A7=80=EA=B8=89=20=ED=98=84=ED=99=A9=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 컨트롤러에 매니저 수당 1차/2차 분할 데이터 추가 - 요약 카드를 5개 카드 + 1차/2차 테이블로 개선 - 내 활동 탭과 동일한 UI 패턴 적용 Co-Authored-By: Claude Opus 4.5 --- .../Sales/SalesDashboardController.php | 38 ++++ .../partials/partner-activity.blade.php | 172 ++++++++++++++---- 2 files changed, 174 insertions(+), 36 deletions(-) diff --git a/app/Http/Controllers/Sales/SalesDashboardController.php b/app/Http/Controllers/Sales/SalesDashboardController.php index e9c92520..011fb592 100644 --- a/app/Http/Controllers/Sales/SalesDashboardController.php +++ b/app/Http/Controllers/Sales/SalesDashboardController.php @@ -658,11 +658,49 @@ private function calculatePartnerSummaryStats(array $partnerIds, int $currentUse // 최종 예상 수당 (확정 + 예상 중 큰 값) $expectedCommission = max($confirmedCommission, $expectedFromFee); + // 지급 완료된 매니저 수당 + $paidManagerCommission = SalesCommission::where('manager_user_id', $currentUserId) + ->whereHas('partner', function ($query) use ($partnerIds) { + $query->whereIn('user_id', $partnerIds); + }) + ->where('status', SalesCommission::STATUS_PAID) + ->sum('manager_commission'); + + // 지급예정 (승인됨) + $scheduledManagerCommission = SalesCommission::where('manager_user_id', $currentUserId) + ->whereHas('partner', function ($query) use ($partnerIds) { + $query->whereIn('user_id', $partnerIds); + }) + ->where('status', SalesCommission::STATUS_APPROVED) + ->sum('manager_commission'); + + // 납입대기 = 총 예상 - 지급완료 - 지급예정 + $pendingManagerCommission = max(0, $expectedCommission - $paidManagerCommission - $scheduledManagerCommission); + + // 1차/2차 분할 (각 50%) + $halfExpected = $expectedCommission / 2; + $halfPending = $pendingManagerCommission / 2; + $halfScheduled = $scheduledManagerCommission / 2; + $halfPaid = $paidManagerCommission / 2; + return [ 'partner_count' => $partnerCount, 'total_prospects' => $totalProspects, 'total_conversions' => $totalConversions, 'expected_commission' => $expectedCommission, + 'paid_commission' => $paidManagerCommission, + 'first_commission' => [ + 'total' => (int)$halfExpected, + 'pending' => (int)$halfPending, + 'scheduled' => (int)$halfScheduled, + 'paid' => (int)$halfPaid, + ], + 'second_commission' => [ + 'total' => (int)$halfExpected, + 'pending' => (int)$halfPending, + 'scheduled' => (int)$halfScheduled, + 'paid' => (int)$halfPaid, + ], ]; } diff --git a/resources/views/sales/dashboard/partials/partner-activity.blade.php b/resources/views/sales/dashboard/partials/partner-activity.blade.php index 9ac87e11..5a9549a5 100644 --- a/resources/views/sales/dashboard/partials/partner-activity.blade.php +++ b/resources/views/sales/dashboard/partials/partner-activity.blade.php @@ -1,61 +1,161 @@ {{-- 유치 파트너 활동 현황 --}} +@php + $first = $summaryStats['first_commission'] ?? ['total' => 0, 'pending' => 0, 'scheduled' => 0, 'paid' => 0]; + $second = $summaryStats['second_commission'] ?? ['total' => 0, 'pending' => 0, 'scheduled' => 0, 'paid' => 0]; + $totalCommissionAmount = $first['total'] + $second['total']; + $totalPending = $first['pending'] + $second['pending']; + $totalScheduled = $first['scheduled'] + $second['scheduled']; + $totalPaid = $first['paid'] + $second['paid']; + $paidPercent = $totalCommissionAmount > 0 ? round(($totalPaid / $totalCommissionAmount) * 100) : 0; +@endphp
{{-- 요약 카드 섹션 --}} -
- -
-
- 유치 파트너 -
- +
+ {{-- 헤더 --}} +
+
+ + + +
+

유치 파트너 현황

+
+ + {{-- 상단 요약 카드 (5개) --}} +
+ {{-- 유치 파트너 --}} +
+
+ 유치 파트너 +
+

{{ $summaryStats['partner_count'] }}

-

{{ $summaryStats['partner_count'] }}명

-

직접 유치한 파트너

-
- -
-
- 총 영업권 -
- + {{-- 총 영업권 --}} +
+
+ 총 영업권 +
+

{{ $summaryStats['total_prospects'] }}

-

{{ $summaryStats['total_prospects'] }}건

-

파트너들이 등록한 명함

-
- -
-
- 총 계약 -
- + {{-- 총 계약 --}} +
+
+ 총 계약 +
+

{{ $summaryStats['total_conversions'] }}

-

{{ $summaryStats['total_conversions'] }}건

-

계약 성사 건수

-
- -
-
- 예상 수당 -
- + {{-- 예상 수당 --}} +
+
+ 예상 수당 +
+

{{ number_format($totalCommissionAmount) }}

+
+ + {{-- 지급 완료 --}} +
+
+ 지급완료 + {{ $paidPercent }}% +
+

{{ number_format($totalPaid) }}

+
+
+ + {{-- 1차/2차 수당 지급 현황 (합계표) --}} +
+
+

+ + + + 매니저 수당 지급 현황 + (1개월 구독료 기준, 1차/2차 분할) +

+
+ +
+ + + + + + + + + + + + {{-- 1차 수당 --}} + + + + + + + + {{-- 2차 수당 --}} + + + + + + + + + + {{-- 합계 --}} + + + + + + + + +
구분총액납입대기지급예정지급완료
+
+ 1 + 1차 수당 +
+
{{ number_format($first['total']) }}원{{ number_format($first['pending']) }}원{{ number_format($first['scheduled']) }}원{{ number_format($first['paid']) }}원
+
+ 2 + 2차 수당 +
+
{{ number_format($second['total']) }}원{{ number_format($second['pending']) }}원{{ number_format($second['scheduled']) }}원{{ number_format($second['paid']) }}원
+ 합계 + {{ number_format($totalCommissionAmount) }}원{{ number_format($totalPending) }}원{{ number_format($totalScheduled) }}원{{ number_format($totalPaid) }}원
+
+ + {{-- 수당 지급 안내 --}} +
+ + + + + 납입대기 → + 개발비 입금 → + 지급예정 → + 익월 10일 → + 지급완료 +
-

{{ number_format($summaryStats['expected_commission']) }}원

-

매니저 수당 합계