refactor:수당 정산 테이블 2행 레이아웃 리디자인 (18열→8열×2행)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,32 +1,22 @@
|
||||
{{-- 수당 정산 테이블 --}}
|
||||
{{-- 수당 정산 테이블 (2행 레이아웃) --}}
|
||||
<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">
|
||||
<table class="min-w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="w-12 px-4 py-3">
|
||||
<input type="checkbox" onchange="toggleSelectAll(this)" class="rounded border-gray-300 text-emerald-600 focus:ring-emerald-500">
|
||||
</th>
|
||||
<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-left 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-left text-xs font-medium text-gray-500 uppercase tracking-wider">입금</th>
|
||||
<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-right text-xs font-medium text-gray-500 uppercase tracking-wider">파트너수당</th>
|
||||
<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-right text-xs font-medium text-gray-500 uppercase tracking-wider">매니저수당</th>
|
||||
<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-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>
|
||||
<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-center text-xs font-medium text-gray-500 uppercase tracking-wider">액션</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
<tbody class="bg-white">
|
||||
@forelse ($commissions as $commission)
|
||||
@php
|
||||
// 파트너 타입 판별 (개인/단체)
|
||||
@@ -71,166 +61,132 @@
|
||||
$displayReferrerComm = $commission->referrer_commission > 0
|
||||
? $commission->referrer_commission
|
||||
: ($calcBase > 0 ? $calcBase * ($rRate / 100) : 0);
|
||||
|
||||
// 영업파트너 이름
|
||||
$partnerName = $commission->partner?->user?->name
|
||||
?? $commission->management?->salesPartner?->user?->name
|
||||
?? $commission->management?->tenantProspect?->registeredBy?->name
|
||||
?? '-';
|
||||
|
||||
// 유치파트너 이름
|
||||
$referrerName = $commission->referrerPartner?->user?->name;
|
||||
if (!$referrerName) {
|
||||
$partnerUser = $commission->partner?->user
|
||||
?? $commission->management?->salesPartner?->user
|
||||
?? $commission->management?->tenantProspect?->registeredBy;
|
||||
$referrerName = $partnerUser?->parent?->name;
|
||||
}
|
||||
|
||||
// 수당지급일 필드
|
||||
$paidField = $commission->payment_type === 'deposit' ? 'first_partner_paid_at' : 'second_partner_paid_at';
|
||||
$paidValue = $commission->$paidField?->format('Y-m-d');
|
||||
|
||||
// 상태 색상
|
||||
$statusColors = [
|
||||
'pending' => 'bg-yellow-100 text-yellow-800',
|
||||
'approved' => 'bg-blue-100 text-blue-800',
|
||||
'paid' => 'bg-green-100 text-green-800',
|
||||
'cancelled' => 'bg-red-100 text-red-800',
|
||||
];
|
||||
|
||||
// 개발상태 색상
|
||||
$hqColors = [
|
||||
'pending' => 'bg-gray-100 text-gray-600',
|
||||
'review' => 'bg-yellow-100 text-yellow-700',
|
||||
'planning' => 'bg-blue-100 text-blue-700',
|
||||
'coding' => 'bg-indigo-100 text-indigo-700',
|
||||
'dev_test' => 'bg-purple-100 text-purple-700',
|
||||
'dev_done' => 'bg-teal-100 text-teal-700',
|
||||
'int_test' => 'bg-cyan-100 text-cyan-700',
|
||||
'handover' => 'bg-green-100 text-green-700',
|
||||
];
|
||||
@endphp
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-4 py-3">
|
||||
|
||||
{{-- Row 1: 메인 정보 --}}
|
||||
<tr class="hover:bg-gray-50/50 border-t border-gray-200">
|
||||
{{-- 체크박스 (rowspan=2) --}}
|
||||
<td class="px-4 py-2 align-top" rowspan="2">
|
||||
@if (in_array($commission->status, ['pending', 'approved']))
|
||||
<input type="checkbox"
|
||||
value="{{ $commission->id }}"
|
||||
onchange="updateSelection()"
|
||||
class="commission-checkbox rounded border-gray-300 text-emerald-600 focus:ring-emerald-500">
|
||||
class="commission-checkbox rounded border-gray-300 text-emerald-600 focus:ring-emerald-500 mt-1">
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
|
||||
{{-- 테넌트: 업체명 + [구분][입금구분][개발상태] 뱃지 --}}
|
||||
<td class="px-4 py-2">
|
||||
<div class="text-sm font-medium text-gray-900">
|
||||
{{ $commission->management?->tenant?->company_name ?? $commission->management?->tenantProspect?->company_name ?? '-' }}
|
||||
</div>
|
||||
@if ($commission->management?->hq_status)
|
||||
@php
|
||||
$hqColors = [
|
||||
'pending' => 'bg-gray-100 text-gray-600',
|
||||
'review' => 'bg-yellow-100 text-yellow-700',
|
||||
'planning' => 'bg-blue-100 text-blue-700',
|
||||
'coding' => 'bg-indigo-100 text-indigo-700',
|
||||
'dev_test' => 'bg-purple-100 text-purple-700',
|
||||
'dev_done' => 'bg-teal-100 text-teal-700',
|
||||
'int_test' => 'bg-cyan-100 text-cyan-700',
|
||||
'handover' => 'bg-green-100 text-green-700',
|
||||
];
|
||||
@endphp
|
||||
<span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium {{ $hqColors[$commission->management->hq_status] ?? 'bg-gray-100 text-gray-600' }}">
|
||||
{{ $commission->management->hq_status_label }}
|
||||
</span>
|
||||
@endif
|
||||
<div class="flex flex-wrap gap-1 mt-1">
|
||||
<span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium {{ $isGroup ? 'bg-purple-100 text-purple-800' : 'bg-sky-100 text-sky-800' }}">{{ $isGroup ? '단체' : '개인' }}</span>
|
||||
<span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium {{ $commission->payment_type === 'deposit' ? 'bg-blue-100 text-blue-800' : 'bg-green-100 text-green-800' }}">{{ $commission->payment_type_label }}</span>
|
||||
@if ($commission->management?->hq_status)
|
||||
<span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium {{ $hqColors[$commission->management->hq_status] ?? 'bg-gray-100 text-gray-600' }}">{{ $commission->management->hq_status_label }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
|
||||
{{ $isGroup ? 'bg-purple-100 text-purple-800' : 'bg-sky-100 text-sky-800' }}">
|
||||
{{ $isGroup ? '단체' : '개인' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
||||
{{ $commission->payment_type === 'deposit' ? 'bg-blue-100 text-blue-800' : 'bg-green-100 text-green-800' }}">
|
||||
{{ $commission->payment_type_label }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right text-sm text-gray-900">
|
||||
|
||||
{{-- 입금: 금액(볼드) + 날짜(작은글씨) --}}
|
||||
<td class="px-4 py-2">
|
||||
@if ($displayPayment > 0)
|
||||
{{ number_format($displayPayment) }}
|
||||
<div class="text-sm font-bold text-gray-900">{{ number_format($displayPayment) }}</div>
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
<div class="text-sm text-gray-400">-</div>
|
||||
@endif
|
||||
<div class="text-xs text-gray-500">{{ $commission->payment_date->format('Y-m-d') }}</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center text-sm text-gray-500">
|
||||
{{ $commission->payment_date->format('Y-m-d') }}
|
||||
|
||||
{{-- 영업파트너: 이름(비율%) + 수당금액 --}}
|
||||
<td class="px-4 py-2">
|
||||
<div class="text-sm text-gray-900">{{ $partnerName }} <span class="text-gray-400">({{ $pRate }}%)</span></div>
|
||||
<div class="text-sm font-medium text-emerald-600">
|
||||
@if ($displayPartnerComm > 0)
|
||||
{{ number_format($displayPartnerComm) }}
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
@php
|
||||
$partnerName = $commission->partner?->user?->name
|
||||
?? $commission->management?->salesPartner?->user?->name
|
||||
?? $commission->management?->tenantProspect?->registeredBy?->name
|
||||
?? '-';
|
||||
@endphp
|
||||
<div class="text-sm text-gray-900">{{ $partnerName }}</div>
|
||||
<div class="text-xs text-gray-500">{{ $pRate }}%</div>
|
||||
|
||||
{{-- 매니저: 이름(구독1월) + 수당금액 --}}
|
||||
<td class="px-4 py-2">
|
||||
<div class="text-sm text-gray-900">{{ $commission->manager?->name ?? $commission->management?->manager?->name ?? '-' }} <span class="text-gray-400">(구독1월)</span></div>
|
||||
<div class="text-sm font-medium text-blue-600">
|
||||
@if ($displayManagerComm > 0)
|
||||
{{ number_format($displayManagerComm) }}
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right text-sm font-medium text-emerald-600">
|
||||
@if ($displayPartnerComm > 0)
|
||||
{{ number_format($displayPartnerComm) }}
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<div class="text-sm text-gray-900">{{ $commission->manager?->name ?? $commission->management?->manager?->name ?? '-' }}</div>
|
||||
<div class="text-xs text-gray-500">구독1월</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right text-sm font-medium text-blue-600">
|
||||
@if ($displayManagerComm > 0)
|
||||
{{ number_format($displayManagerComm) }}
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
@php
|
||||
// 유치파트너 = 영업파트너의 상위자 (user→parent)
|
||||
$referrerName = $commission->referrerPartner?->user?->name;
|
||||
if (!$referrerName) {
|
||||
// 영업파트너 user를 찾아서 parent 확인
|
||||
$partnerUser = $commission->partner?->user
|
||||
?? $commission->management?->salesPartner?->user
|
||||
?? $commission->management?->tenantProspect?->registeredBy;
|
||||
$referrerName = $partnerUser?->parent?->name;
|
||||
}
|
||||
@endphp
|
||||
|
||||
{{-- 유치파트너: 이름(비율%) + 수당금액 --}}
|
||||
<td class="px-4 py-2">
|
||||
@if ($referrerName)
|
||||
<div class="text-sm text-gray-900">{{ $referrerName }}</div>
|
||||
<div class="text-xs text-gray-500">{{ $isGroup ? '유치 3%' : '상위 5%' }}</div>
|
||||
<div class="text-sm text-gray-900">{{ $referrerName }} <span class="text-gray-400">({{ $rRate }}%)</span></div>
|
||||
<div class="text-sm font-medium text-orange-600">
|
||||
@if ($displayReferrerComm > 0)
|
||||
{{ number_format($displayReferrerComm) }}
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<span class="text-sm text-gray-400">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right text-sm font-medium text-orange-600">
|
||||
@if ($displayReferrerComm > 0)
|
||||
{{ number_format($displayReferrerComm) }}
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center text-sm text-gray-500">
|
||||
{{ $commission->scheduled_payment_date->format('Y-m-d') }}
|
||||
</td>
|
||||
{{-- 수당지급일 (deposit→first_partner_paid_at, balance→second_partner_paid_at) --}}
|
||||
@php
|
||||
$paidField = $commission->payment_type === 'deposit' ? 'first_partner_paid_at' : 'second_partner_paid_at';
|
||||
$paidValue = $commission->$paidField?->format('Y-m-d');
|
||||
@endphp
|
||||
<td class="px-1 py-2 whitespace-nowrap text-center">
|
||||
<input type="date"
|
||||
class="w-28 h-7 text-xs px-1 border border-gray-300 rounded cursor-pointer hover:border-blue-400 focus:outline-none focus:border-blue-500 {{ $paidValue ? 'text-blue-600 font-medium bg-blue-50 border-blue-400' : 'text-gray-500 bg-gray-50' }}"
|
||||
value="{{ $paidValue }}"
|
||||
onchange="saveSettlementDate({{ $commission->id }}, '{{ $paidField }}', this.value)">
|
||||
</td>
|
||||
{{-- 매니저지급일 --}}
|
||||
<td class="px-1 py-2 whitespace-nowrap text-center">
|
||||
@if($isGroup)
|
||||
<span class="text-xs text-gray-400">-</span>
|
||||
@else
|
||||
<input type="date"
|
||||
class="w-28 h-7 text-xs px-1 border border-gray-300 rounded cursor-pointer hover:border-purple-400 focus:outline-none focus:border-purple-500 {{ $commission->manager_paid_at ? 'text-purple-600 font-medium bg-purple-50 border-purple-400' : 'text-gray-500 bg-gray-50' }}"
|
||||
value="{{ $commission->manager_paid_at?->format('Y-m-d') }}"
|
||||
onchange="saveSettlementDate({{ $commission->id }}, 'manager_paid_at', this.value)">
|
||||
@endif
|
||||
</td>
|
||||
{{-- 협업지원금 --}}
|
||||
<td class="px-1 py-2 whitespace-nowrap text-center">
|
||||
@if(!$isGroup)
|
||||
<input type="number"
|
||||
class="w-20 h-7 text-xs px-1 border border-gray-300 rounded cursor-pointer hover:border-orange-400 focus:outline-none focus:border-orange-500 {{ ($commission->referrer_commission ?? 0) > 0 ? 'text-orange-600 font-medium bg-orange-50 border-orange-400' : 'text-gray-500 bg-gray-50' }}"
|
||||
value="{{ ($commission->referrer_commission ?? 0) > 0 ? intval($commission->referrer_commission) : '' }}"
|
||||
placeholder="0"
|
||||
min="0"
|
||||
onchange="saveSettlementDate({{ $commission->id }}, 'referrer_commission', this.value)">
|
||||
@else
|
||||
<span class="text-xs text-gray-400">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
@php
|
||||
$statusColors = [
|
||||
'pending' => 'bg-yellow-100 text-yellow-800',
|
||||
'approved' => 'bg-blue-100 text-blue-800',
|
||||
'paid' => 'bg-green-100 text-green-800',
|
||||
'cancelled' => 'bg-red-100 text-red-800',
|
||||
];
|
||||
@endphp
|
||||
|
||||
{{-- 상태 --}}
|
||||
<td class="px-4 py-2 text-center">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ $statusColors[$commission->status] ?? 'bg-gray-100 text-gray-800' }}">
|
||||
{{ $commission->status_label }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
|
||||
{{-- 액션 (rowspan=2) --}}
|
||||
<td class="px-4 py-2 text-center align-top" rowspan="2">
|
||||
<div class="flex items-center justify-center gap-1">
|
||||
<button type="button"
|
||||
onclick="openDetailModal({{ $commission->id }})"
|
||||
@@ -271,9 +227,57 @@ class="p-1 text-green-400 hover:text-green-600"
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{-- Row 2: 지급 정보 --}}
|
||||
<tr class="bg-gray-50/50 border-b border-gray-200">
|
||||
<td colspan="5" class="px-4 py-2">
|
||||
<div class="flex items-center gap-6 text-xs">
|
||||
{{-- 지급예정일 --}}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="text-gray-500 whitespace-nowrap">지급예정일:</span>
|
||||
<span class="text-gray-700">{{ $commission->scheduled_payment_date->format('Y-m-d') }}</span>
|
||||
</div>
|
||||
{{-- 수당지급일 --}}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="text-gray-500 whitespace-nowrap">수당지급일:</span>
|
||||
<input type="date"
|
||||
class="h-6 text-xs px-1 border border-gray-300 rounded cursor-pointer hover:border-blue-400 focus:outline-none focus:border-blue-500 {{ $paidValue ? 'text-blue-600 font-medium bg-blue-50 border-blue-400' : 'text-gray-500 bg-gray-50' }}"
|
||||
value="{{ $paidValue }}"
|
||||
onchange="saveSettlementDate({{ $commission->id }}, '{{ $paidField }}', this.value)">
|
||||
</div>
|
||||
{{-- 매니저지급일 --}}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="text-gray-500 whitespace-nowrap">매니저지급일:</span>
|
||||
@if($isGroup)
|
||||
<span class="text-gray-400">-</span>
|
||||
@else
|
||||
<input type="date"
|
||||
class="h-6 text-xs px-1 border border-gray-300 rounded cursor-pointer hover:border-purple-400 focus:outline-none focus:border-purple-500 {{ $commission->manager_paid_at ? 'text-purple-600 font-medium bg-purple-50 border-purple-400' : 'text-gray-500 bg-gray-50' }}"
|
||||
value="{{ $commission->manager_paid_at?->format('Y-m-d') }}"
|
||||
onchange="saveSettlementDate({{ $commission->id }}, 'manager_paid_at', this.value)">
|
||||
@endif
|
||||
</div>
|
||||
{{-- 협업지원금 --}}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="text-gray-500 whitespace-nowrap">협업지원금:</span>
|
||||
@if(!$isGroup)
|
||||
<input type="number"
|
||||
class="w-20 h-6 text-xs px-1 border border-gray-300 rounded cursor-pointer hover:border-orange-400 focus:outline-none focus:border-orange-500 {{ ($commission->referrer_commission ?? 0) > 0 ? 'text-orange-600 font-medium bg-orange-50 border-orange-400' : 'text-gray-500 bg-gray-50' }}"
|
||||
value="{{ ($commission->referrer_commission ?? 0) > 0 ? intval($commission->referrer_commission) : '' }}"
|
||||
placeholder="0"
|
||||
min="0"
|
||||
onchange="saveSettlementDate({{ $commission->id }}, 'referrer_commission', this.value)">
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>{{-- 상태 빈칸 --}}
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="18" class="px-4 py-8 text-center text-gray-500">
|
||||
<td colspan="8" class="px-4 py-8 text-center text-gray-500">
|
||||
등록된 정산 내역이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user