2025-09-15 14:13:20 +00:00
|
|
|
|
import React, { useState } from 'react'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
import {
|
|
|
|
|
|
FaUsers,
|
|
|
|
|
|
FaArrowLeft,
|
|
|
|
|
|
FaSave,
|
|
|
|
|
|
FaTimes,
|
|
|
|
|
|
FaPlus,
|
|
|
|
|
|
FaTrash,
|
|
|
|
|
|
FaMapMarkerAlt,
|
2025-09-15 14:13:20 +00:00
|
|
|
|
} from 'react-icons/fa'
|
|
|
|
|
|
import { useNavigate } from 'react-router-dom'
|
|
|
|
|
|
import { CrmTerritory } from '../../../types/crm'
|
|
|
|
|
|
import { mockEmployees } from '../../../mocks/mockEmployees'
|
|
|
|
|
|
import { Team, TeamMember, TeamRoleEnum } from '../../../types/common'
|
|
|
|
|
|
import { Container } from '@/components/shared'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const SalesTeamCreate: React.FC = () => {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
const navigate = useNavigate()
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const [formData, setFormData] = useState({
|
2025-09-15 14:13:20 +00:00
|
|
|
|
teamCode: '',
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
description: '',
|
|
|
|
|
|
managerId: '',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
isActive: true,
|
2025-09-15 14:13:20 +00:00
|
|
|
|
})
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
const [members, setMembers] = useState<Partial<TeamMember>[]>([])
|
|
|
|
|
|
const [territories, setTerritories] = useState<Partial<CrmTerritory>[]>([])
|
|
|
|
|
|
const [errors, setErrors] = useState<Record<string, string>>({})
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleInputChange = (field: string, value: string | boolean) => {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
setFormData((prev) => ({ ...prev, [field]: value }))
|
2025-09-15 09:31:47 +00:00
|
|
|
|
if (errors[field]) {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
setErrors((prev) => ({ ...prev, [field]: '' }))
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 14:13:20 +00:00
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const addMember = () => {
|
|
|
|
|
|
setMembers((prev) => [
|
|
|
|
|
|
...prev,
|
|
|
|
|
|
{
|
2025-09-15 14:13:20 +00:00
|
|
|
|
employeeId: '',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
role: TeamRoleEnum.Member,
|
|
|
|
|
|
isActive: true,
|
|
|
|
|
|
},
|
2025-09-15 14:13:20 +00:00
|
|
|
|
])
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const removeMember = (index: number) => {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
setMembers((prev) => prev.filter((_, i) => i !== index))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const updateMember = (index: number, field: string, value: string | TeamRoleEnum | boolean) => {
|
2025-09-15 09:31:47 +00:00
|
|
|
|
setMembers((prev) =>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
prev.map((member, i) => (i === index ? { ...member, [field]: value } : member)),
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const addTerritory = () => {
|
|
|
|
|
|
setTerritories((prev) => [
|
|
|
|
|
|
...prev,
|
|
|
|
|
|
{
|
2025-09-15 14:13:20 +00:00
|
|
|
|
territoryCode: '',
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
description: '',
|
|
|
|
|
|
region: '',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
countries: [],
|
|
|
|
|
|
cities: [],
|
|
|
|
|
|
isActive: true,
|
|
|
|
|
|
},
|
2025-09-15 14:13:20 +00:00
|
|
|
|
])
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const removeTerritory = (index: number) => {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
setTerritories((prev) => prev.filter((_, i) => i !== index))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const updateTerritory = (index: number, field: string, value: string | string[] | boolean) => {
|
2025-09-15 09:31:47 +00:00
|
|
|
|
setTerritories((prev) =>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
prev.map((territory, i) => (i === index ? { ...territory, [field]: value } : territory)),
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const validateForm = () => {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
const newErrors: Record<string, string> = {}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
if (!formData.teamCode.trim()) {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
newErrors.teamCode = 'Takım kodu zorunludur'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (!formData.name.trim()) {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
newErrors.name = 'Takım adı zorunludur'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (!formData.managerId.trim()) {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
newErrors.managerId = 'Takım lideri seçimi zorunludur'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
setErrors(newErrors)
|
|
|
|
|
|
return Object.keys(newErrors).length === 0
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleSave = () => {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
if (!validateForm()) return
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const newTeam: Partial<Team> = {
|
|
|
|
|
|
...formData,
|
|
|
|
|
|
members: members.map((member, index) => ({
|
|
|
|
|
|
...member,
|
|
|
|
|
|
id: `member-new-${index}`,
|
2025-09-15 14:13:20 +00:00
|
|
|
|
teamId: 'new-team',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
joinDate: new Date(),
|
|
|
|
|
|
})) as TeamMember[],
|
|
|
|
|
|
territories: territories.map((territory, index) => ({
|
|
|
|
|
|
...territory,
|
|
|
|
|
|
id: `territory-new-${index}`,
|
2025-09-15 14:13:20 +00:00
|
|
|
|
assignedTeamId: 'new-team',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
})) as CrmTerritory[],
|
|
|
|
|
|
targets: [],
|
|
|
|
|
|
creationTime: new Date(),
|
|
|
|
|
|
lastModificationTime: new Date(),
|
2025-09-15 14:13:20 +00:00
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
console.log('Creating new sales team:', newTeam)
|
|
|
|
|
|
alert('Satış ekibi başarıyla oluşturuldu!')
|
|
|
|
|
|
navigate('/admin/crm/sales-teams')
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleCancel = () => {
|
2025-09-15 14:13:20 +00:00
|
|
|
|
if (confirm('Değişiklikler kaydedilmedi. Çıkmak istediğinizden emin misiniz?')) {
|
|
|
|
|
|
navigate('/admin/crm/sales-teams')
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 14:13:20 +00:00
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
return (
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<Container>
|
2025-09-15 19:22:43 +00:00
|
|
|
|
<div className="space-y-2">
|
2025-09-15 14:13:20 +00:00
|
|
|
|
{/* Header */}
|
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
|
<div className="flex items-center gap-4">
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => navigate('/admin/crm/sales-teams')}
|
|
|
|
|
|
className="p-1.5 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaArrowLeft className="w-5 h-5" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2 className="text-xl font-bold text-gray-900">Yeni Satış Ekibi</h2>
|
|
|
|
|
|
<p className="text-sm text-gray-600 mt-1">
|
|
|
|
|
|
Yeni satış ekibi oluşturun ve ekip üyelerini atayın
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<div className="flex gap-2">
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={handleCancel}
|
|
|
|
|
|
className="flex items-center gap-2 px-3 py-1.5 text-sm text-gray-700 bg-gray-100 rounded-md hover:bg-gray-200 transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaTimes className="w-4 h-4" />
|
|
|
|
|
|
İptal
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={handleSave}
|
|
|
|
|
|
className="flex items-center gap-2 px-3 py-1.5 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaSave className="w-4 h-4" />
|
|
|
|
|
|
Kaydet
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
{/* Form */}
|
|
|
|
|
|
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
|
|
|
|
|
{/* Basic Information */}
|
|
|
|
|
|
<div className="lg:col-span-2">
|
|
|
|
|
|
<div className="bg-white rounded-lg shadow-sm border p-4">
|
|
|
|
|
|
<h3 className="text-base font-semibold text-gray-900 mb-4 flex items-center">
|
|
|
|
|
|
<FaUsers className="w-5 h-5 mr-2" />
|
|
|
|
|
|
Temel Bilgiler
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">
|
|
|
|
|
|
Takım Kodu *
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
value={formData.teamCode}
|
|
|
|
|
|
onChange={(e) => handleInputChange('teamCode', e.target.value)}
|
|
|
|
|
|
className={`w-full px-3 py-1.5 text-sm border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent ${
|
|
|
|
|
|
errors.teamCode ? 'border-red-500' : 'border-gray-300'
|
|
|
|
|
|
}`}
|
|
|
|
|
|
placeholder="ST-001"
|
|
|
|
|
|
/>
|
|
|
|
|
|
{errors.teamCode && (
|
|
|
|
|
|
<p className="text-red-500 text-sm mt-1">{errors.teamCode}</p>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">
|
|
|
|
|
|
Takım Lideri *
|
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
|
|
<select
|
|
|
|
|
|
value={formData.managerId}
|
|
|
|
|
|
onChange={(e) => handleInputChange('managerId', e.target.value)}
|
|
|
|
|
|
className={`w-full px-3 py-1.5 text-sm border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent ${
|
|
|
|
|
|
errors.managerId ? 'border-red-500' : 'border-gray-300'
|
|
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="">Çalışan seçin</option>
|
|
|
|
|
|
{mockEmployees.map((employee) => (
|
|
|
|
|
|
<option key={employee.id} value={employee.id}>
|
|
|
|
|
|
{employee.fullName}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
{errors.managerId && (
|
|
|
|
|
|
<p className="text-red-500 text-sm mt-1">{errors.managerId}</p>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mt-4">
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">Takım Adı *</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
2025-09-15 14:13:20 +00:00
|
|
|
|
value={formData.name}
|
|
|
|
|
|
onChange={(e) => handleInputChange('name', e.target.value)}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className={`w-full px-3 py-1.5 text-sm border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent ${
|
2025-09-15 14:13:20 +00:00
|
|
|
|
errors.name ? 'border-red-500' : 'border-gray-300'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}`}
|
2025-09-15 14:13:20 +00:00
|
|
|
|
placeholder="Kurumsal Satış Ekibi"
|
2025-09-15 09:31:47 +00:00
|
|
|
|
/>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
{errors.name && <p className="text-red-500 text-sm mt-1">{errors.name}</p>}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<div className="mt-4">
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">Açıklama</label>
|
|
|
|
|
|
<textarea
|
|
|
|
|
|
value={formData.description}
|
|
|
|
|
|
onChange={(e) => handleInputChange('description', e.target.value)}
|
|
|
|
|
|
className="w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
|
|
|
|
rows={3}
|
|
|
|
|
|
placeholder="Ekip açıklaması..."
|
2025-09-15 09:31:47 +00:00
|
|
|
|
/>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<div className="mt-4">
|
|
|
|
|
|
<label className="flex items-center">
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="checkbox"
|
|
|
|
|
|
checked={formData.isActive}
|
|
|
|
|
|
onChange={(e) => handleInputChange('isActive', e.target.checked)}
|
|
|
|
|
|
className="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<span className="ml-2 text-sm text-gray-700">Aktif</span>
|
|
|
|
|
|
</label>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
{/* Team Members */}
|
|
|
|
|
|
<div className="bg-white rounded-lg shadow-sm border p-4 mt-4">
|
|
|
|
|
|
<div className="flex items-center justify-between mb-4">
|
|
|
|
|
|
<h3 className="text-base font-semibold text-gray-900 flex items-center">
|
|
|
|
|
|
<FaUsers className="w-5 h-5 mr-2" />
|
|
|
|
|
|
Ekip Üyeleri
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={addMember}
|
|
|
|
|
|
className="flex items-center gap-2 px-3 py-1.5 text-sm text-blue-600 border border-blue-200 rounded-md hover:bg-blue-50 transition-colors"
|
2025-09-15 09:31:47 +00:00
|
|
|
|
>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<FaPlus className="w-4 h-4" />
|
|
|
|
|
|
Üye Ekle
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<div className="space-y-3">
|
|
|
|
|
|
{members.map((member, index) => (
|
|
|
|
|
|
<div
|
|
|
|
|
|
key={index}
|
|
|
|
|
|
className="flex items-center gap-3 p-3 border border-gray-200 rounded-lg"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div className="flex-1 grid grid-cols-1 md:grid-cols-2 gap-3">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">
|
|
|
|
|
|
Çalışan
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<select
|
|
|
|
|
|
value={member.employeeId || ''}
|
|
|
|
|
|
onChange={(e) => updateMember(index, 'employeeId', e.target.value)}
|
|
|
|
|
|
className="w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="">Çalışan seçin</option>
|
|
|
|
|
|
{mockEmployees.map((employee) => (
|
|
|
|
|
|
<option key={employee.id} value={employee.id}>
|
|
|
|
|
|
{employee.fullName}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">Rol</label>
|
|
|
|
|
|
<select
|
|
|
|
|
|
value={member.role || TeamRoleEnum.Member}
|
|
|
|
|
|
onChange={(e) => updateMember(index, 'role', e.target.value)}
|
|
|
|
|
|
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value={TeamRoleEnum.Member}>Üye</option>
|
|
|
|
|
|
<option value={TeamRoleEnum.Lead}>Takım Lideri</option>
|
|
|
|
|
|
<option value={TeamRoleEnum.Manager}>Yönetici</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<button
|
2025-09-15 14:13:20 +00:00
|
|
|
|
onClick={() => removeMember(index)}
|
|
|
|
|
|
className="p-1.5 text-red-600 hover:bg-red-50 rounded-lg transition-colors"
|
2025-09-15 09:31:47 +00:00
|
|
|
|
>
|
|
|
|
|
|
<FaTrash className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
))}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
{members.length === 0 && (
|
|
|
|
|
|
<div className="text-center py-8 text-gray-500">
|
|
|
|
|
|
<FaUsers className="w-8 h-8 mx-auto mb-2 text-gray-400" />
|
|
|
|
|
|
<p>Henüz ekip üyesi eklenmedi</p>
|
|
|
|
|
|
<p className="text-sm">Üye eklemek için yukarıdaki butona tıklayın</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Territories */}
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div className="bg-white rounded-lg shadow-sm border p-4">
|
|
|
|
|
|
<div className="flex items-center justify-between mb-4">
|
|
|
|
|
|
<h3 className="text-base font-semibold text-gray-900 flex items-center">
|
|
|
|
|
|
<FaMapMarkerAlt className="w-5 h-5 mr-2" />
|
|
|
|
|
|
Bölgeler
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={addTerritory}
|
|
|
|
|
|
className="flex items-center gap-2 px-3 py-1.5 text-sm text-blue-600 border border-blue-200 rounded-md hover:bg-blue-50 transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaPlus className="w-4 h-4" />
|
|
|
|
|
|
Bölge Ekle
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<div className="space-y-3">
|
|
|
|
|
|
{territories.map((territory, index) => (
|
|
|
|
|
|
<div key={index} className="p-3 border border-gray-200 rounded-lg">
|
|
|
|
|
|
<div className="flex justify-between items-start mb-3">
|
|
|
|
|
|
<h4 className="font-medium text-gray-900">Bölge {index + 1}</h4>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => removeTerritory(index)}
|
|
|
|
|
|
className="p-1.5 text-red-600 hover:bg-red-50 rounded"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaTrash className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">
|
|
|
|
|
|
Bölge Kodu
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
value={territory.territoryCode || ''}
|
|
|
|
|
|
onChange={(e) => updateTerritory(index, 'territoryCode', e.target.value)}
|
|
|
|
|
|
className="w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
|
|
|
|
placeholder="TR-IST"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">
|
|
|
|
|
|
Bölge Adı
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
value={territory.name || ''}
|
|
|
|
|
|
onChange={(e) => updateTerritory(index, 'name', e.target.value)}
|
|
|
|
|
|
className="w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
|
|
|
|
placeholder="İstanbul Anadolu"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-xs font-medium text-gray-700 mb-1">
|
|
|
|
|
|
Bölge
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
value={territory.region || ''}
|
|
|
|
|
|
onChange={(e) => updateTerritory(index, 'region', e.target.value)}
|
|
|
|
|
|
className="w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
|
|
|
|
placeholder="Marmara"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
))}
|
|
|
|
|
|
|
|
|
|
|
|
{territories.length === 0 && (
|
|
|
|
|
|
<div className="text-center py-8 text-gray-500">
|
|
|
|
|
|
<FaMapMarkerAlt className="w-8 h-8 mx-auto mb-2 text-gray-400" />
|
|
|
|
|
|
<p>Henüz bölge eklenmedi</p>
|
|
|
|
|
|
<p className="text-sm">Bölge eklemek için yukarıdaki butona tıklayın</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-09-15 14:13:20 +00:00
|
|
|
|
</Container>
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 14:13:20 +00:00
|
|
|
|
export default SalesTeamCreate
|