Files
sam-manage/resources/views/sales/prospects/index.blade.php
pro e04cbcf1e0 feat:영업권(명함등록) 시스템 구현
- TenantProspect 모델, 서비스, 컨트롤러 추가
- 명함 등록 시 2개월 영업권 부여
- 만료 후 1개월 쿨다운 기간 적용
- 테넌트 전환 기능 구현
- 사업자번호 중복 체크 API 추가
- 명함 이미지 업로드 지원

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 22:39:42 +09:00

156 lines
9.0 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">명함을 등록하여 2개월간 영업권을 확보하세요</p>
</div>
<a href="{{ route('sales.prospects.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-4 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-xl font-bold text-gray-800">{{ number_format($stats['total']) }}</div>
</div>
<div class="bg-blue-50 rounded-lg shadow-sm p-4">
<div class="text-sm text-blue-600">영업중</div>
<div class="text-xl font-bold text-blue-800">{{ number_format($stats['active']) }}</div>
</div>
<div class="bg-gray-50 rounded-lg shadow-sm p-4">
<div class="text-sm text-gray-600">만료</div>
<div class="text-xl font-bold text-gray-800">{{ number_format($stats['expired']) }}</div>
</div>
<div class="bg-green-50 rounded-lg shadow-sm p-4">
<div class="text-sm text-green-600">계약완료</div>
<div class="text-xl font-bold text-green-800">{{ number_format($stats['converted']) }}</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="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="active" {{ request('status') === 'active' ? 'selected' : '' }}>영업중</option>
<option value="expired" {{ request('status') === 'expired' ? 'selected' : '' }}>만료</option>
<option value="converted" {{ request('status') === 'converted' ? '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-right text-xs font-medium text-gray-500 uppercase tracking-wider">관리</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@forelse($prospects as $prospect)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4">
<div class="font-medium text-gray-900">{{ $prospect->company_name }}</div>
<div class="text-sm text-gray-500">{{ $prospect->business_number }}</div>
@if($prospect->ceo_name)
<div class="text-sm text-gray-500">{{ $prospect->ceo_name }}</div>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 text-xs font-medium rounded-full {{ $prospect->status_color }}">
{{ $prospect->status_label }}
</span>
@if($prospect->isActive() && $prospect->remaining_days <= 14)
<div class="text-xs text-red-500 mt-1">D-{{ $prospect->remaining_days }}</div>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">{{ $prospect->registeredBy?->name ?? '-' }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $prospect->contact_phone ?? '-' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
@if($prospect->isConverted())
<div class="text-green-600">{{ $prospect->converted_at?->format('Y-m-d') }} 전환</div>
@elseif($prospect->isActive())
<div class="text-blue-600">{{ $prospect->expires_at->format('Y-m-d') }} 까지</div>
@else
<div class="text-gray-500">{{ $prospect->expires_at->format('Y-m-d') }} 만료</div>
@if($prospect->isInCooldown())
<div class="text-xs text-yellow-600">쿨다운: {{ $prospect->cooldown_ends_at->format('Y-m-d') }}</div>
@endif
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<a href="{{ route('sales.prospects.show', $prospect->id) }}" class="text-blue-600 hover:text-blue-900 mr-3">상세</a>
@if(!$prospect->isConverted())
<a href="{{ route('sales.prospects.edit', $prospect->id) }}" class="text-indigo-600 hover:text-indigo-900 mr-3">수정</a>
@if($prospect->isActive())
<form action="{{ route('sales.prospects.convert', $prospect->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.prospects.destroy', $prospect->id) }}" method="POST" class="inline"
onsubmit="return confirm('정말 삭제하시겠습니까?')">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-900">삭제</button>
</form>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-6 py-12 text-center text-gray-500">
등록된 명함이 없습니다.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<!-- 페이지네이션 -->
@if($prospects->hasPages())
<div class="px-6 py-4 border-t border-gray-200">
{{ $prospects->withQueryString()->links() }}
</div>
@endif
</div>
</div>
@endsection