Files
sam-manage/resources/views/finance/settlement/partials/partner-summary.blade.php
김보곤 7bc412d9a1 feat:통합 정산관리 페이지 구현 (5개 탭 기반)
- SettlementController 신규 생성 (통합 정산관리 메인 + 탭별 HTMX)
- 5개 탭: 수당정산, 파트너별현황(NEW), 컨설팅비용, 고객사정산, 구독관리
- 수당정산 탭: 기존 영업수수료정산 이관 + 유치수당 컬럼/수당유형 필터 추가
- 파트너별 현황 탭: SalesPartner 수당 집계 + 필터/페이지네이션
- 컨설팅/고객사/구독 탭: React → Blade+Alpine.js 전환 (기존 API 재사용)
- 통합 통계카드 (미지급수당/승인대기/이번달예정/누적지급)
- 기존 4개 URL → 통합 페이지 리다이렉트
- SalesPartner 모델에 commissions 관계 추가
- SalesCommissionService에 commission_type 필터 + referrerPartner eager load 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:53:13 +09:00

119 lines
7.3 KiB
PHP

{{-- 파트너별 현황 --}}
<div class="space-y-6">
{{-- 필터 --}}
<div class="bg-white rounded-lg shadow-sm p-4">
<form hx-get="{{ route('finance.settlement.partner-summary') }}"
hx-target="#partner-content"
hx-trigger="submit"
class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">검색</label>
<input type="text" name="search" placeholder="파트너명 / 파트너코드"
value="{{ request('search') }}"
class="w-full rounded-lg border-gray-300 focus:border-indigo-500 focus:ring-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">유형</label>
<select name="type" class="w-full rounded-lg border-gray-300 focus:border-indigo-500 focus:ring-indigo-500">
<option value="">전체</option>
<option value="individual" {{ request('type') == 'individual' ? 'selected' : '' }}>개인</option>
<option value="corporate" {{ request('type') == 'corporate' ? 'selected' : '' }}>단체</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">상태</label>
<select name="status" class="w-full rounded-lg border-gray-300 focus:border-indigo-500 focus:ring-indigo-500">
<option value="active" {{ request('status', 'active') == 'active' ? 'selected' : '' }}>활성</option>
<option value="all" {{ request('status') == 'all' ? 'selected' : '' }}>전체</option>
</select>
</div>
<div class="flex items-end">
<button type="submit" class="w-full px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg transition-colors">
조회
</button>
</div>
</form>
</div>
{{-- 테이블 --}}
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">파트너명</th>
<th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">유형</th>
<th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">수당률</th>
<th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">계약건수</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">누적 수당</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">미지급</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">지급완료</th>
<th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">최근 지급일</th>
<th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">액션</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@forelse ($partners as $partner)
@php
$stats = $commissionStats[$partner->id] ?? null;
$paidTotal = $stats->paid_total ?? 0;
$unpaidTotal = $stats->unpaid_total ?? 0;
$totalCount = $stats->total_count ?? $partner->total_contracts ?? 0;
$lastPaidDate = $stats->last_paid_date ?? null;
@endphp
<tr class="hover:bg-gray-50">
<td class="px-4 py-3">
<div class="text-sm font-medium text-gray-900">{{ $partner->user?->name ?? '-' }}</div>
<div class="text-xs text-gray-500">{{ $partner->partner_code }}</div>
</td>
<td class="px-4 py-3 text-center">
@if ($partner->partner_type === 'corporate')
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700">단체</span>
@else
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-sky-100 text-sky-700">개인</span>
@endif
</td>
<td class="px-4 py-3 text-center text-sm text-gray-900">
{{ $partner->commission_rate }}%
</td>
<td class="px-4 py-3 text-center text-sm text-gray-900">
{{ number_format($totalCount) }}
</td>
<td class="px-4 py-3 text-right text-sm font-medium text-gray-900">
{{ number_format($paidTotal + $unpaidTotal) }}
</td>
<td class="px-4 py-3 text-right text-sm font-medium {{ $unpaidTotal > 0 ? 'text-red-600' : 'text-gray-400' }}">
{{ number_format($unpaidTotal) }}
</td>
<td class="px-4 py-3 text-right text-sm font-medium text-green-600">
{{ number_format($paidTotal) }}
</td>
<td class="px-4 py-3 text-center text-sm text-gray-500">
{{ $lastPaidDate ? \Carbon\Carbon::parse($lastPaidDate)->format('Y-m-d') : '-' }}
</td>
<td class="px-4 py-3 text-center">
<a href="{{ route('finance.settlement', ['tab' => 'commission', 'partner_id' => $partner->id]) }}"
class="inline-flex items-center px-2.5 py-1 text-xs font-medium text-indigo-600 hover:text-indigo-800 hover:bg-indigo-50 rounded transition-colors">
상세보기
</a>
</td>
</tr>
@empty
<tr>
<td colspan="9" class="px-4 py-8 text-center text-gray-500">
등록된 파트너가 없습니다.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if ($partners->hasPages())
<div class="px-4 py-3 border-t border-gray-200">
{{ $partners->links() }}
</div>
@endif
</div>
</div>