feat:고객 상세 모달에 계약 상세정보 보기 기능 추가

- 계약 및 납입 정보 옆에 '정보보기' 토글 버튼 추가
- 계약 상품 내역 (카테고리, 상품명, 개발비, 구독료, 할인율) 테이블 표시
- 수당 정산 내역 (계약금/잔금별 입금액, 수당, 지급예정일 등) 카드 표시

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-20 14:55:52 +09:00
parent 44f443966a
commit f2f10d2f15
2 changed files with 153 additions and 2 deletions

View File

@@ -105,10 +105,16 @@ public function modalShow(int $id): View
// management 정보
$management = SalesTenantManagement::findOrCreateByProspect($prospect->id);
$management->load(['contractProducts.product', 'contractProducts.category']);
// 수당 정보
$commission = $this->loadMergedCommission($management);
// 수당 정산 전체 레코드 (상세보기용)
$commissions = SalesCommission::where('management_id', $management->id)
->with(['partner.user', 'manager'])
->get();
// 파트너 타입
$partnerType = $management->salesPartner?->partner_type;
if (!$partnerType && $prospect->registered_by) {
@@ -116,7 +122,7 @@ public function modalShow(int $id): View
}
$partnerType = $partnerType ?? 'individual';
return view('sales.admin-prospects.partials.show-modal', compact('prospect', 'management', 'progress', 'commission', 'partnerType'));
return view('sales.admin-prospects.partials.show-modal', compact('prospect', 'management', 'progress', 'commission', 'commissions', 'partnerType'));
}
/**

View File

@@ -103,7 +103,16 @@
<!-- 계약 납입 정보 -->
<div class="bg-emerald-50 rounded-lg p-4 mb-6">
<h3 class="text-sm font-semibold text-emerald-700 mb-3">계약 납입 정보</h3>
<div class="flex items-center justify-between mb-3">
<h3 class="text-sm font-semibold text-emerald-700">계약 납입 정보</h3>
<button type="button" onclick="toggleContractDetail()"
class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium text-emerald-700 bg-emerald-100 hover:bg-emerald-200 rounded-md transition">
<svg id="contractDetailIcon" class="w-3.5 h-3.5 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
</svg>
<span id="contractDetailBtnText">정보보기</span>
</button>
</div>
@php
$totalRegFee = $management->total_registration_fee ?? $management->contractProducts->sum('registration_fee') ?? 0;
$totalSubFee = $management->contractProducts->sum('subscription_fee') ?? 0;
@@ -142,8 +151,144 @@
</p>
</div>
</div>
{{-- 상세 정보 패널 (기본 숨김) --}}
<div id="contractDetailPanel" class="hidden mt-4 pt-4 border-t border-emerald-200 space-y-4">
{{-- 계약 상품 목록 --}}
<div>
<h4 class="text-xs font-semibold text-emerald-600 mb-2">계약 상품 내역</h4>
@if($management->contractProducts->count() > 0)
<div class="bg-white rounded-md overflow-hidden">
<table class="w-full text-xs">
<thead class="bg-emerald-100/50">
<tr>
<th class="px-3 py-1.5 text-left text-emerald-700 font-medium">카테고리</th>
<th class="px-3 py-1.5 text-left text-emerald-700 font-medium">상품명</th>
<th class="px-3 py-1.5 text-right text-emerald-700 font-medium">개발비</th>
<th class="px-3 py-1.5 text-right text-emerald-700 font-medium">구독료()</th>
<th class="px-3 py-1.5 text-right text-emerald-700 font-medium">할인율</th>
</tr>
</thead>
<tbody class="divide-y divide-emerald-50">
@foreach($management->contractProducts as $cp)
<tr>
<td class="px-3 py-1.5 text-gray-600">{{ $cp->category?->name ?? '-' }}</td>
<td class="px-3 py-1.5 text-gray-900 font-medium">{{ $cp->product?->name ?? '-' }}</td>
<td class="px-3 py-1.5 text-right text-gray-700">{{ $cp->registration_fee > 0 ? number_format($cp->registration_fee) . '원' : '-' }}</td>
<td class="px-3 py-1.5 text-right text-gray-700">{{ $cp->subscription_fee > 0 ? number_format($cp->subscription_fee) . '원' : '-' }}</td>
<td class="px-3 py-1.5 text-right text-gray-500">{{ $cp->discount_rate > 0 ? number_format($cp->discount_rate, 0) . '%' : '-' }}</td>
</tr>
@endforeach
</tbody>
<tfoot class="bg-emerald-50/50">
<tr class="font-medium">
<td colspan="2" class="px-3 py-1.5 text-emerald-700">합계</td>
<td class="px-3 py-1.5 text-right text-emerald-700">{{ number_format($management->contractProducts->sum('registration_fee')) }}</td>
<td class="px-3 py-1.5 text-right text-emerald-700">{{ number_format($management->contractProducts->sum('subscription_fee')) }}</td>
<td class="px-3 py-1.5"></td>
</tr>
</tfoot>
</table>
</div>
@else
<p class="text-xs text-gray-400 italic">등록된 계약 상품이 없습니다.</p>
@endif
</div>
{{-- 수당 정산 내역 --}}
<div>
<h4 class="text-xs font-semibold text-emerald-600 mb-2">수당 정산 내역</h4>
@if($commissions->count() > 0)
<div class="space-y-2">
@foreach($commissions as $comm)
<div class="bg-white rounded-md p-3">
<div class="flex items-center gap-2 mb-2">
<span class="px-1.5 py-0.5 text-xs font-medium rounded
{{ $comm->payment_type === 'deposit' ? 'bg-blue-100 text-blue-700' : 'bg-orange-100 text-orange-700' }}">
{{ $comm->payment_type_label }}
</span>
<span class="px-1.5 py-0.5 text-xs rounded
{{ $comm->status === 'paid' ? 'bg-emerald-100 text-emerald-700' : ($comm->status === 'approved' ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 text-gray-600') }}">
{{ $comm->status_label }}
</span>
</div>
<div class="grid grid-cols-2 gap-x-4 gap-y-1 text-xs">
<div class="flex justify-between">
<span class="text-gray-500">입금액</span>
<span class="font-medium {{ $comm->payment_amount > 0 ? 'text-gray-900' : 'text-gray-400' }}">
{{ $comm->payment_amount > 0 ? number_format($comm->payment_amount) . '원' : '-' }}
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">입금일</span>
<span class="font-medium {{ $comm->payment_date ? 'text-gray-900' : 'text-gray-400' }}">
{{ $comm->payment_date ? $comm->payment_date->format('Y-m-d') : '-' }}
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">기준금액</span>
<span class="font-medium {{ $comm->base_amount > 0 ? 'text-gray-900' : 'text-gray-400' }}">
{{ $comm->base_amount > 0 ? number_format($comm->base_amount) . '원' : '-' }}
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">지급예정일</span>
<span class="font-medium {{ $comm->scheduled_payment_date ? 'text-gray-900' : 'text-gray-400' }}">
{{ $comm->scheduled_payment_date ? $comm->scheduled_payment_date->format('Y-m-d') : '-' }}
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">파트너 수당</span>
<span class="font-medium {{ $comm->partner_commission > 0 ? 'text-emerald-700' : 'text-gray-400' }}">
{{ $comm->partner_commission > 0 ? number_format($comm->partner_commission) . '원' : '-' }}
@if($comm->partner_rate > 0)
<span class="text-gray-400">({{ number_format($comm->partner_rate, 1) }}%)</span>
@endif
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">매니저 수당</span>
<span class="font-medium {{ $comm->manager_commission > 0 ? 'text-emerald-700' : 'text-gray-400' }}">
{{ $comm->manager_commission > 0 ? number_format($comm->manager_commission) . '원' : '-' }}
@if($comm->manager_rate > 0)
<span class="text-gray-400">({{ number_format($comm->manager_rate, 1) }}%)</span>
@endif
</span>
</div>
@if($comm->referrer_commission > 0)
<div class="flex justify-between col-span-2">
<span class="text-gray-500">협업지원금</span>
<span class="font-medium text-purple-700">
{{ number_format($comm->referrer_commission) }}
</span>
</div>
@endif
</div>
@if($comm->notes)
<p class="mt-2 text-xs text-gray-500 italic">{{ $comm->notes }}</p>
@endif
</div>
@endforeach
</div>
@else
<p class="text-xs text-gray-400 italic">등록된 수당 정산 내역이 없습니다.</p>
@endif
</div>
</div>
</div>
<script>
function toggleContractDetail() {
const panel = document.getElementById('contractDetailPanel');
const icon = document.getElementById('contractDetailIcon');
const btnText = document.getElementById('contractDetailBtnText');
const isHidden = panel.classList.contains('hidden');
panel.classList.toggle('hidden');
icon.style.transform = isHidden ? 'rotate(180deg)' : '';
btnText.textContent = isHidden ? '접기' : '정보보기';
}
</script>
<!-- 등록 정보 -->
<div class="text-sm text-gray-500">
<p>등록일: {{ $prospect->created_at->format('Y-m-d H:i') }}</p>