2025-09-15 19:46:52 +00:00
|
|
|
|
import React, { useState } from 'react'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
import {
|
|
|
|
|
|
FaBriefcase,
|
|
|
|
|
|
FaPlus,
|
|
|
|
|
|
FaEdit,
|
|
|
|
|
|
FaTrash,
|
|
|
|
|
|
FaUsers,
|
|
|
|
|
|
FaDollarSign,
|
|
|
|
|
|
FaBuilding,
|
|
|
|
|
|
FaEye,
|
|
|
|
|
|
FaTh,
|
|
|
|
|
|
FaList,
|
2025-09-15 19:46:52 +00:00
|
|
|
|
} from 'react-icons/fa'
|
|
|
|
|
|
import { HrJobPosition, JobLevelEnum } from '../../../types/hr'
|
|
|
|
|
|
import DataTable, { Column } from '../../../components/common/DataTable'
|
|
|
|
|
|
import { mockJobPositions } from '../../../mocks/mockJobPositions'
|
|
|
|
|
|
import JobPositionFormModal from './JobPositionFormModal'
|
|
|
|
|
|
import JobPositionViewModal from './JobPositionViewModal'
|
|
|
|
|
|
import { getJobLevelColor, getJobLevelText } from '../../../utils/erp'
|
|
|
|
|
|
import { Container } from '@/components/shared'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const JobPositions: React.FC = () => {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
const [positions, setPositions] = useState<HrJobPosition[]>(mockJobPositions)
|
|
|
|
|
|
const [searchTerm, setSearchTerm] = useState('')
|
|
|
|
|
|
const [selectedLevel, setSelectedLevel] = useState<string>('all')
|
|
|
|
|
|
const [selectedDepartment, setSelectedDepartment] = useState<string>('all')
|
|
|
|
|
|
const [viewMode, setViewMode] = useState<'list' | 'card'>('list')
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
// Modal states
|
2025-09-15 19:46:52 +00:00
|
|
|
|
const [isFormModalOpen, setIsFormModalOpen] = useState(false)
|
|
|
|
|
|
const [isViewModalOpen, setIsViewModalOpen] = useState(false)
|
|
|
|
|
|
const [selectedPosition, setSelectedPosition] = useState<HrJobPosition | undefined>(undefined)
|
|
|
|
|
|
const [modalTitle, setModalTitle] = useState('')
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleAdd = () => {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
setSelectedPosition(undefined)
|
|
|
|
|
|
setModalTitle('Yeni İş Pozisyonu')
|
|
|
|
|
|
setIsFormModalOpen(true)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleEdit = (position: HrJobPosition) => {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
setSelectedPosition(position)
|
|
|
|
|
|
setModalTitle('İş Pozisyonu Düzenle')
|
|
|
|
|
|
setIsFormModalOpen(true)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleView = (position: HrJobPosition) => {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
setSelectedPosition(position)
|
|
|
|
|
|
setIsViewModalOpen(true)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleDelete = (id: string) => {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
if (window.confirm('Bu pozisyonu silmek istediğinizden emin misiniz?')) {
|
|
|
|
|
|
setPositions(positions.filter((p) => p.id !== id))
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 19:46:52 +00:00
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleSavePosition = (positionData: Partial<HrJobPosition>) => {
|
|
|
|
|
|
if (selectedPosition) {
|
|
|
|
|
|
// Edit existing position
|
|
|
|
|
|
const updatedPosition = {
|
|
|
|
|
|
...selectedPosition,
|
|
|
|
|
|
...positionData,
|
|
|
|
|
|
lastModificationTime: new Date(),
|
2025-09-15 19:46:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
setPositions(positions.map((p) => (p.id === selectedPosition.id ? updatedPosition : p)))
|
2025-09-15 09:31:47 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
// Add new position
|
|
|
|
|
|
const newPosition: HrJobPosition = {
|
|
|
|
|
|
id: `jp-${Date.now()}`,
|
|
|
|
|
|
...positionData,
|
|
|
|
|
|
employees: [],
|
|
|
|
|
|
creationTime: new Date(),
|
|
|
|
|
|
lastModificationTime: new Date(),
|
2025-09-15 19:46:52 +00:00
|
|
|
|
} as HrJobPosition
|
|
|
|
|
|
setPositions([...positions, newPosition])
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 19:46:52 +00:00
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const closeFormModal = () => {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
setIsFormModalOpen(false)
|
|
|
|
|
|
setSelectedPosition(undefined)
|
|
|
|
|
|
setModalTitle('')
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const closeViewModal = () => {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
setIsViewModalOpen(false)
|
|
|
|
|
|
setSelectedPosition(undefined)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const filteredPositions = positions.filter((position) => {
|
|
|
|
|
|
if (
|
|
|
|
|
|
searchTerm &&
|
|
|
|
|
|
!position.name.toLowerCase().includes(searchTerm.toLowerCase()) &&
|
|
|
|
|
|
!position.code.toLowerCase().includes(searchTerm.toLowerCase())
|
|
|
|
|
|
) {
|
2025-09-15 19:46:52 +00:00
|
|
|
|
return false
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 19:46:52 +00:00
|
|
|
|
if (selectedLevel !== 'all' && position.level !== selectedLevel) {
|
|
|
|
|
|
return false
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 19:46:52 +00:00
|
|
|
|
if (selectedDepartment !== 'all' && position.department?.id !== selectedDepartment) {
|
|
|
|
|
|
return false
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 19:46:52 +00:00
|
|
|
|
return true
|
|
|
|
|
|
})
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
// Card component for individual position
|
2025-09-15 19:46:52 +00:00
|
|
|
|
const PositionCard: React.FC<{ position: HrJobPosition }> = ({ position }) => (
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<div className="bg-white rounded-lg shadow-sm border hover:shadow-md transition-shadow p-4">
|
|
|
|
|
|
<div className="flex items-start justify-between mb-4">
|
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
|
<div className="flex items-center gap-2 mb-2">
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<h3 className="text-base font-semibold text-gray-900">{position.name}</h3>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<span
|
|
|
|
|
|
className={`px-2 py-1 text-xs font-medium rounded-full ${getJobLevelColor(
|
2025-09-15 19:46:52 +00:00
|
|
|
|
position.level,
|
2025-09-15 09:31:47 +00:00
|
|
|
|
)}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{getJobLevelText(position.level)}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<p className="text-sm text-gray-600 mb-2">{position.code}</p>
|
|
|
|
|
|
<p
|
|
|
|
|
|
className="text-sm text-gray-700 overflow-hidden"
|
|
|
|
|
|
style={{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
display: '-webkit-box',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
WebkitLineClamp: 2,
|
2025-09-15 19:46:52 +00:00
|
|
|
|
WebkitBoxOrient: 'vertical',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
{position.description}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span
|
|
|
|
|
|
className={`px-2 py-1 text-xs font-medium rounded-full ${
|
2025-09-15 19:46:52 +00:00
|
|
|
|
position.isActive ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}`}
|
|
|
|
|
|
>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
{position.isActive ? 'Aktif' : 'Pasif'}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2 mb-3">
|
|
|
|
|
|
<div className="flex items-center gap-2 text-sm text-gray-600">
|
|
|
|
|
|
<FaBuilding className="w-4 h-4" />
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<span>{position.department?.name || 'Departman belirtilmemiş'}</span>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="flex items-center gap-2 text-sm text-gray-600">
|
|
|
|
|
|
<FaUsers className="w-4 h-4" />
|
|
|
|
|
|
<span>{position.employees?.length || 0} personel</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="flex items-center gap-2 text-sm text-gray-600">
|
|
|
|
|
|
<FaDollarSign className="w-4 h-4" />
|
|
|
|
|
|
<span>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
₺{position.minSalary.toLocaleString()} - ₺{position.maxSalary.toLocaleString()}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mb-3">
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<p className="text-xs font-medium text-gray-500 mb-2">Gerekli Yetenekler</p>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<div className="flex flex-wrap gap-1">
|
|
|
|
|
|
{position.requiredSkills?.slice(0, 4).map((skill, index) => (
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<span key={index} className="px-2 py-1 text-xs bg-blue-50 text-blue-700 rounded">
|
2025-09-15 09:31:47 +00:00
|
|
|
|
{skill}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
))}
|
|
|
|
|
|
{position.requiredSkills?.length > 4 && (
|
|
|
|
|
|
<span className="text-xs text-gray-500 px-2 py-1">
|
|
|
|
|
|
+{position.requiredSkills.length - 4} daha
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="flex gap-1.5">
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => handleView(position)}
|
|
|
|
|
|
className="flex-1 flex items-center justify-center gap-1 px-2 py-1.5 text-xs text-green-700 bg-green-50 hover:bg-green-100 rounded-md transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaEye className="w-4 h-4" />
|
|
|
|
|
|
Görüntüle
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => handleEdit(position)}
|
|
|
|
|
|
className="flex-1 flex items-center justify-center gap-1 px-2 py-1.5 text-xs text-blue-700 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaEdit className="w-4 h-4" />
|
|
|
|
|
|
Düzenle
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => handleDelete(position.id)}
|
|
|
|
|
|
className="px-2 py-1.5 text-xs text-red-700 bg-red-50 hover:bg-red-100 rounded-md transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaTrash className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
)
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const columns: Column<HrJobPosition>[] = [
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'code',
|
|
|
|
|
|
header: 'Pozisyon Kodu',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
sortable: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'title',
|
|
|
|
|
|
header: 'Pozisyon Adı',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
sortable: true,
|
|
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div className="font-medium text-gray-900">{position.name}</div>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<div className="text-sm text-gray-500 truncate max-w-xs">{position.description}</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'department',
|
|
|
|
|
|
header: 'Departman',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
|
<FaBuilding className="w-4 h-4 text-gray-500" />
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<span>{position.department?.name || '-'}</span>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'level',
|
|
|
|
|
|
header: 'Seviye',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<span
|
|
|
|
|
|
className={`px-2 py-1 text-xs font-medium rounded-full ${getJobLevelColor(
|
2025-09-15 19:46:52 +00:00
|
|
|
|
position.level,
|
2025-09-15 09:31:47 +00:00
|
|
|
|
)}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{getJobLevelText(position.level)}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'employeeCount',
|
|
|
|
|
|
header: 'Personel Sayısı',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<div className="flex items-center gap-1">
|
|
|
|
|
|
<FaUsers className="w-4 h-4 text-gray-500" />
|
|
|
|
|
|
<span>{position.employees?.length || 0}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'salary',
|
|
|
|
|
|
header: 'Maaş Aralığı',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<div className="flex items-center gap-1">
|
|
|
|
|
|
<FaDollarSign className="w-4 h-4 text-gray-500" />
|
|
|
|
|
|
<div className="text-sm">
|
|
|
|
|
|
<div>₺{position.minSalary.toLocaleString()}</div>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<div className="text-gray-500">₺{position.maxSalary.toLocaleString()}</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'skills',
|
|
|
|
|
|
header: 'Gerekli Yetenekler',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<div className="flex flex-wrap gap-1 max-w-xs">
|
|
|
|
|
|
{position.requiredSkills?.slice(0, 3).map((skill, index) => (
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<span key={index} className="px-2 py-1 text-xs bg-blue-50 text-blue-700 rounded">
|
2025-09-15 09:31:47 +00:00
|
|
|
|
{skill}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
))}
|
|
|
|
|
|
{position.requiredSkills?.length > 3 && (
|
|
|
|
|
|
<span className="text-xs text-gray-500">
|
|
|
|
|
|
+{position.requiredSkills.length - 3} daha
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'status',
|
|
|
|
|
|
header: 'Durum',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<span
|
|
|
|
|
|
className={`px-2 py-1 text-xs font-medium rounded-full ${
|
2025-09-15 19:46:52 +00:00
|
|
|
|
position.isActive ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}`}
|
|
|
|
|
|
>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
{position.isActive ? 'Aktif' : 'Pasif'}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</span>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-09-15 19:46:52 +00:00
|
|
|
|
key: 'actions',
|
|
|
|
|
|
header: 'İşlemler',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
render: (position: HrJobPosition) => (
|
|
|
|
|
|
<div className="flex gap-2">
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => handleView(position)}
|
|
|
|
|
|
className="p-1 text-green-600 hover:bg-green-50 rounded"
|
|
|
|
|
|
title="Görüntüle"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaEye className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => handleEdit(position)}
|
|
|
|
|
|
className="p-1 text-blue-600 hover:bg-blue-50 rounded"
|
|
|
|
|
|
title="Düzenle"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaEdit className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => handleDelete(position.id)}
|
|
|
|
|
|
className="p-1 text-red-600 hover:bg-red-50 rounded"
|
|
|
|
|
|
title="Sil"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaTrash className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
2025-09-15 19:46:52 +00:00
|
|
|
|
]
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
// Get unique departments for filter
|
2025-09-15 19:46:52 +00:00
|
|
|
|
const departments = [...new Set(positions.map((p) => p.department).filter(Boolean))]
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
return (
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<Container>
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
|
{/* Header */}
|
|
|
|
|
|
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4">
|
|
|
|
|
|
<div>
|
2025-09-15 21:02:48 +00:00
|
|
|
|
<h2 className="text-2xl font-bold text-gray-900">İş Pozisyonları</h2>
|
2025-09-17 09:46:58 +00:00
|
|
|
|
<p className="text-gray-600">Şirket pozisyonları ve iş tanımları yönetimi</p>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
|
{/* View Toggle */}
|
|
|
|
|
|
<div className="flex bg-gray-100 rounded-lg p-0.5">
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => setViewMode('list')}
|
|
|
|
|
|
className={`flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium transition-colors ${
|
|
|
|
|
|
viewMode === 'list'
|
|
|
|
|
|
? 'bg-white text-gray-900 shadow-sm'
|
|
|
|
|
|
: 'text-gray-500 hover:text-gray-700'
|
|
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaList className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => setViewMode('card')}
|
|
|
|
|
|
className={`flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium transition-colors ${
|
|
|
|
|
|
viewMode === 'card'
|
|
|
|
|
|
? 'bg-white text-gray-900 shadow-sm'
|
|
|
|
|
|
: 'text-gray-500 hover:text-gray-700'
|
|
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaTh className="w-4 h-4" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<button
|
2025-09-15 19:46:52 +00:00
|
|
|
|
onClick={handleAdd}
|
|
|
|
|
|
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"
|
2025-09-15 09:31:47 +00:00
|
|
|
|
>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<FaPlus className="w-4 h-4" />
|
|
|
|
|
|
<span className="hidden sm:inline">Yeni Pozisyon</span>
|
|
|
|
|
|
<span className="sm:hidden">Yeni</span>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
{/* Stats Cards */}
|
|
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
|
|
|
|
<div className="bg-white p-4 rounded-lg shadow-sm border">
|
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
|
<FaBriefcase className="w-6 h-6 text-blue-600" />
|
|
|
|
|
|
<div className="ml-3">
|
|
|
|
|
|
<p className="text-xs font-medium text-gray-600">Toplam Pozisyon</p>
|
|
|
|
|
|
<p className="text-xl font-bold text-gray-900">{positions.length}</p>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<div className="bg-white p-4 rounded-lg shadow-sm border">
|
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
|
<FaUsers className="w-6 h-6 text-green-600" />
|
|
|
|
|
|
<div className="ml-3">
|
|
|
|
|
|
<p className="text-xs font-medium text-gray-600">Dolu Pozisyonlar</p>
|
|
|
|
|
|
<p className="text-xl font-bold text-gray-900">
|
|
|
|
|
|
{positions.filter((p) => p.employees && p.employees.length > 0).length}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<div className="bg-white p-4 rounded-lg shadow-sm border">
|
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
|
<FaBriefcase className="w-6 h-6 text-orange-600" />
|
|
|
|
|
|
<div className="ml-3">
|
|
|
|
|
|
<p className="text-xs font-medium text-gray-600">Boş Pozisyonlar</p>
|
|
|
|
|
|
<p className="text-xl font-bold text-gray-900">
|
|
|
|
|
|
{positions.filter((p) => !p.employees || p.employees.length === 0).length}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<div className="bg-white p-4 rounded-lg shadow-sm border">
|
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
|
<FaBuilding className="w-6 h-6 text-purple-600" />
|
|
|
|
|
|
<div className="ml-3">
|
|
|
|
|
|
<p className="text-xs font-medium text-gray-600">Departman Sayısı</p>
|
|
|
|
|
|
<p className="text-xl font-bold text-gray-900">{departments.length}</p>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
{/* Filters */}
|
|
|
|
|
|
<div className="flex flex-col sm:flex-row gap-3 items-stretch sm:items-center">
|
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
placeholder="Pozisyon adı veya kodu ara..."
|
|
|
|
|
|
value={searchTerm}
|
|
|
|
|
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
|
|
|
|
className="w-full px-3 py-1.5 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
<div className="flex flex-col sm:flex-row gap-3">
|
|
|
|
|
|
<select
|
|
|
|
|
|
value={selectedLevel}
|
|
|
|
|
|
onChange={(e) => setSelectedLevel(e.target.value)}
|
|
|
|
|
|
className="px-3 py-1.5 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 min-w-0 sm:min-w-[160px]"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="all">Tüm Seviyeler</option>
|
2025-09-17 09:46:58 +00:00
|
|
|
|
{Object.values(JobLevelEnum).map((level) => (
|
|
|
|
|
|
<option key={level} value={level}>
|
|
|
|
|
|
{getJobLevelText(level)}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
2025-09-15 19:46:52 +00:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select
|
|
|
|
|
|
value={selectedDepartment}
|
|
|
|
|
|
onChange={(e) => setSelectedDepartment(e.target.value)}
|
|
|
|
|
|
className="px-3 py-1.5 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 min-w-0 sm:min-w-[160px]"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="all">Tüm Departmanlar</option>
|
|
|
|
|
|
{departments.map((dept) => (
|
|
|
|
|
|
<option key={dept?.id} value={dept?.id}>
|
|
|
|
|
|
{dept?.name}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
{/* Content - List or Card View */}
|
|
|
|
|
|
{viewMode === 'list' ? (
|
|
|
|
|
|
<div className="bg-white rounded-lg shadow-sm border overflow-hidden">
|
|
|
|
|
|
<div className="overflow-x-auto">
|
|
|
|
|
|
<DataTable data={filteredPositions} columns={columns} />
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
) : (
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
|
|
|
|
|
{filteredPositions.map((position) => (
|
|
|
|
|
|
<PositionCard key={position.id} position={position} />
|
|
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{/* Empty State */}
|
|
|
|
|
|
{filteredPositions.length === 0 && (
|
|
|
|
|
|
<div className="text-center py-12">
|
|
|
|
|
|
<FaBriefcase className="w-10 h-10 text-gray-400 mx-auto mb-3" />
|
|
|
|
|
|
<h3 className="text-base font-medium text-gray-900 mb-2">Pozisyon bulunamadı</h3>
|
|
|
|
|
|
<p className="text-sm text-gray-500">Arama kriterlerinizi değiştirmeyi deneyin.</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
{/* Modals */}
|
|
|
|
|
|
<JobPositionFormModal
|
|
|
|
|
|
isOpen={isFormModalOpen}
|
|
|
|
|
|
onClose={closeFormModal}
|
|
|
|
|
|
onSave={handleSavePosition}
|
|
|
|
|
|
position={selectedPosition}
|
|
|
|
|
|
title={modalTitle}
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<JobPositionViewModal
|
|
|
|
|
|
isOpen={isViewModalOpen}
|
|
|
|
|
|
onClose={closeViewModal}
|
|
|
|
|
|
position={selectedPosition}
|
|
|
|
|
|
/>
|
2025-09-15 19:46:52 +00:00
|
|
|
|
</Container>
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 19:46:52 +00:00
|
|
|
|
export default JobPositions
|