- TenantProspect 모델, 서비스, 컨트롤러 추가 - 명함 등록 시 2개월 영업권 부여 - 만료 후 1개월 쿨다운 기간 적용 - 테넌트 전환 기능 구현 - 사업자번호 중복 체크 API 추가 - 명함 이미지 업로드 지원 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
159 lines
7.3 KiB
PHP
159 lines
7.3 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', '명함 등록')
|
|
|
|
@section('content')
|
|
<div class="max-w-2xl mx-auto">
|
|
<!-- 페이지 헤더 -->
|
|
<div class="mb-6">
|
|
<a href="{{ route('sales.prospects.index') }}" class="text-gray-500 hover:text-gray-700 text-sm mb-2 inline-flex items-center">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
|
|
</svg>
|
|
목록으로
|
|
</a>
|
|
<h1 class="text-2xl font-bold text-gray-800">명함 등록</h1>
|
|
<p class="text-sm text-gray-500 mt-1">명함 등록 시 2개월간 영업권이 부여됩니다</p>
|
|
</div>
|
|
|
|
<!-- 알림 메시지 -->
|
|
@if(session('error'))
|
|
<div class="mb-4 p-4 bg-red-50 border border-red-200 rounded-lg text-red-700">
|
|
{{ session('error') }}
|
|
</div>
|
|
@endif
|
|
|
|
<!-- 폼 -->
|
|
<form action="{{ route('sales.prospects.store') }}" method="POST" enctype="multipart/form-data" class="bg-white rounded-lg shadow-sm p-6 space-y-6">
|
|
@csrf
|
|
|
|
<!-- 사업자번호 (중복 체크) -->
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">사업자번호 <span class="text-red-500">*</span></label>
|
|
<div class="flex gap-2">
|
|
<input type="text" name="business_number" id="business_number" value="{{ old('business_number') }}" required
|
|
placeholder="000-00-00000"
|
|
class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 @error('business_number') border-red-500 @enderror">
|
|
<button type="button" id="checkBusinessNumber"
|
|
class="px-4 py-2 bg-gray-600 hover:bg-gray-700 text-white rounded-lg transition">
|
|
중복확인
|
|
</button>
|
|
</div>
|
|
<p id="businessNumberResult" class="mt-1 text-sm"></p>
|
|
@error('business_number')
|
|
<p class="mt-1 text-sm text-red-500">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">회사명 <span class="text-red-500">*</span></label>
|
|
<input type="text" name="company_name" value="{{ old('company_name') }}" required
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 @error('company_name') border-red-500 @enderror">
|
|
@error('company_name')
|
|
<p class="mt-1 text-sm text-red-500">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">대표자명</label>
|
|
<input type="text" name="ceo_name" value="{{ old('ceo_name') }}"
|
|
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>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">연락처</label>
|
|
<input type="text" name="contact_phone" value="{{ old('contact_phone') }}"
|
|
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>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">이메일</label>
|
|
<input type="email" name="contact_email" value="{{ old('contact_email') }}"
|
|
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>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">주소</label>
|
|
<input type="text" name="address" value="{{ old('address') }}"
|
|
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>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">명함 이미지</label>
|
|
<input type="file" name="business_card" accept="image/*"
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
<p class="mt-1 text-xs text-gray-500">JPG, PNG 형식 (최대 5MB)</p>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">메모</label>
|
|
<textarea name="memo" rows="3"
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">{{ old('memo') }}</textarea>
|
|
</div>
|
|
|
|
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
|
|
<h3 class="font-medium text-blue-800 mb-2">영업권 안내</h3>
|
|
<ul class="text-sm text-blue-700 space-y-1">
|
|
<li>등록일로부터 <strong>2개월간</strong> 영업권이 유효합니다.</li>
|
|
<li>유효기간 내 테넌트로 전환 시 영업 실적으로 인정됩니다.</li>
|
|
<li>만료 후 <strong>1개월간</strong> 쿨다운 기간이 적용됩니다.</li>
|
|
<li>쿨다운 이후 다른 영업파트너가 등록할 수 있습니다.</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="flex justify-end gap-3 pt-4 border-t">
|
|
<a href="{{ route('sales.prospects.index') }}"
|
|
class="px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition">
|
|
취소
|
|
</a>
|
|
<button type="submit"
|
|
class="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition">
|
|
등록
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
@push('scripts')
|
|
<script>
|
|
document.getElementById('checkBusinessNumber').addEventListener('click', function() {
|
|
const businessNumber = document.getElementById('business_number').value;
|
|
const resultEl = document.getElementById('businessNumberResult');
|
|
|
|
if (!businessNumber) {
|
|
resultEl.textContent = '사업자번호를 입력해주세요.';
|
|
resultEl.className = 'mt-1 text-sm text-red-500';
|
|
return;
|
|
}
|
|
|
|
fetch('{{ route("sales.prospects.check-business-number") }}', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
},
|
|
body: JSON.stringify({ business_number: businessNumber })
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.can_register) {
|
|
resultEl.textContent = '등록 가능한 사업자번호입니다.';
|
|
resultEl.className = 'mt-1 text-sm text-green-500';
|
|
} else {
|
|
resultEl.textContent = data.reason;
|
|
resultEl.className = 'mt-1 text-sm text-red-500';
|
|
}
|
|
})
|
|
.catch(error => {
|
|
resultEl.textContent = '확인 중 오류가 발생했습니다.';
|
|
resultEl.className = 'mt-1 text-sm text-red-500';
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|
|
@endsection
|