- 역할 위임/부여/제거 기능 추가 (delegateRole, assignRole, removeRole) - '상위 관리자' → '추천인(유치자)' 용어 변경 - 역할 코드 변경: sales_operator/sales_admin/sales_manager → sales/manager/recruiter - 뷰 파일 전면 수정 (영업파트너 구조 반영) - 역할 관리 UI 추가 (show.blade.php) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
191 lines
11 KiB
PHP
191 lines
11 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', '영업파트너 관리')
|
|
|
|
@section('content')
|
|
<div class="flex flex-col h-full">
|
|
<!-- 페이지 헤더 -->
|
|
<div class="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4 mb-6 flex-shrink-0">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-gray-800">영업파트너 관리</h1>
|
|
<p class="text-sm text-gray-500 mt-1">영업파트너의 등록, 승인, 역할을 관리합니다</p>
|
|
</div>
|
|
<a href="{{ route('sales.managers.create') }}"
|
|
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition text-center w-full sm:w-auto flex items-center justify-center gap-2">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
|
|
</svg>
|
|
파트너 등록
|
|
</a>
|
|
</div>
|
|
|
|
<!-- 통계 카드 -->
|
|
<div class="grid grid-cols-2 md:grid-cols-6 gap-4 mb-6 flex-shrink-0">
|
|
<div class="bg-white rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-gray-500">전체</div>
|
|
<div class="text-2xl font-bold text-gray-800">{{ number_format($stats['total']) }}명</div>
|
|
</div>
|
|
<div class="bg-yellow-50 rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-yellow-600">승인대기</div>
|
|
<div class="text-2xl font-bold text-yellow-800">{{ number_format($stats['pending']) }}명</div>
|
|
</div>
|
|
<div class="bg-emerald-50 rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-emerald-600">승인완료</div>
|
|
<div class="text-2xl font-bold text-emerald-800">{{ number_format($stats['approved']) }}명</div>
|
|
</div>
|
|
<div class="bg-blue-50 rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-blue-600">영업</div>
|
|
<div class="text-2xl font-bold text-blue-800">{{ number_format($stats['sales']) }}명</div>
|
|
</div>
|
|
<div class="bg-purple-50 rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-purple-600">매니저</div>
|
|
<div class="text-2xl font-bold text-purple-800">{{ number_format($stats['manager']) }}명</div>
|
|
</div>
|
|
<div class="bg-green-50 rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-green-600">유치담당</div>
|
|
<div class="text-2xl font-bold text-green-800">{{ number_format($stats['recruiter']) }}명</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 필터 영역 -->
|
|
<div class="flex-shrink-0 mb-4">
|
|
<form method="GET" class="flex flex-wrap gap-2 sm:gap-4 items-center bg-white p-4 rounded-lg shadow-sm">
|
|
<div class="flex-1 min-w-0 w-full sm:w-auto">
|
|
<input type="text"
|
|
name="search"
|
|
value="{{ request('search') }}"
|
|
placeholder="이름, 아이디, 이메일, 전화번호로 검색..."
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<div class="w-full sm:w-40">
|
|
<select name="role" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
<option value="">전체 역할</option>
|
|
<option value="sales" {{ request('role') === 'sales' ? 'selected' : '' }}>영업</option>
|
|
<option value="manager" {{ request('role') === 'manager' ? 'selected' : '' }}>매니저</option>
|
|
<option value="recruiter" {{ request('role') === 'recruiter' ? 'selected' : '' }}>유치담당</option>
|
|
</select>
|
|
</div>
|
|
<div class="w-full sm:w-40">
|
|
<select name="approval_status" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
<option value="">전체 상태</option>
|
|
<option value="pending" {{ request('approval_status') === 'pending' ? 'selected' : '' }}>승인대기</option>
|
|
<option value="approved" {{ request('approval_status') === 'approved' ? 'selected' : '' }}>승인완료</option>
|
|
<option value="rejected" {{ request('approval_status') === 'rejected' ? 'selected' : '' }}>반려</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg transition w-full sm:w-auto">
|
|
검색
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 테이블 -->
|
|
<div class="bg-white rounded-lg shadow-sm overflow-hidden flex-1 flex flex-col min-h-0">
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">이름</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">아이디</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">역할</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">연락처</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">추천인(유치자)</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">상태</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">등록일</th>
|
|
<th class="px-6 py-3 text-right 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)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="font-medium text-gray-900">{{ $partner->name }}</div>
|
|
@if($partner->email)
|
|
<div class="text-sm text-gray-500">{{ $partner->email }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
|
{{ $partner->user_id ?? '-' }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="flex flex-wrap gap-1">
|
|
@foreach($partner->userRoles as $userRole)
|
|
@php
|
|
$roleColor = match($userRole->role->name ?? '') {
|
|
'sales' => 'bg-blue-100 text-blue-800',
|
|
'manager' => 'bg-purple-100 text-purple-800',
|
|
'recruiter' => 'bg-green-100 text-green-800',
|
|
default => 'bg-gray-100 text-gray-800',
|
|
};
|
|
$roleLabel = match($userRole->role->name ?? '') {
|
|
'sales' => '영업',
|
|
'manager' => '매니저',
|
|
'recruiter' => '유치담당',
|
|
default => $userRole->role->name ?? '-',
|
|
};
|
|
@endphp
|
|
<span class="px-2 py-1 text-xs font-medium rounded-full {{ $roleColor }}">
|
|
{{ $roleLabel }}
|
|
</span>
|
|
@endforeach
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ $partner->phone ?? '-' }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
@if($partner->parent)
|
|
<a href="{{ route('sales.managers.show', $partner->parent->id) }}" class="text-blue-600 hover:underline">
|
|
{{ $partner->parent->name }}
|
|
</a>
|
|
@else
|
|
<span class="text-gray-400">최상위</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="px-2 py-1 text-xs font-medium rounded-full {{ $partner->approval_status_color }}">
|
|
{{ $partner->approval_status_label }}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ $partner->created_at->format('Y-m-d') }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
|
<a href="{{ route('sales.managers.show', $partner->id) }}" class="text-blue-600 hover:text-blue-900 mr-3">상세</a>
|
|
<a href="{{ route('sales.managers.edit', $partner->id) }}" class="text-indigo-600 hover:text-indigo-900 mr-3">수정</a>
|
|
@if($partner->isPendingApproval())
|
|
<form action="{{ route('sales.managers.approve', $partner->id) }}" method="POST" class="inline"
|
|
onsubmit="return confirm('승인하시겠습니까?')">
|
|
@csrf
|
|
<button type="submit" class="text-green-600 hover:text-green-900 mr-3">승인</button>
|
|
</form>
|
|
@endif
|
|
<form action="{{ route('sales.managers.destroy', $partner->id) }}" method="POST" class="inline"
|
|
onsubmit="return confirm('정말 비활성화하시겠습니까?')">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="text-red-600 hover:text-red-900">삭제</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="8" class="px-6 py-12 text-center text-gray-500">
|
|
등록된 파트너가 없습니다.
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- 페이지네이션 -->
|
|
@if($partners->hasPages())
|
|
<div class="px-6 py-4 border-t border-gray-200">
|
|
{{ $partners->withQueryString()->links() }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endsection
|