2025-09-15 21:29:07 +00:00
|
|
|
|
import React, { useState, useEffect } from 'react'
|
|
|
|
|
|
import { FaTimes, FaSave, FaCalendar, FaClock } from 'react-icons/fa'
|
|
|
|
|
|
import { PmCalendarEvent, WorkOrderStatusEnum } from '../../../types/pm'
|
|
|
|
|
|
import { mockWorkCenters } from '../../../mocks/mockWorkCenters'
|
|
|
|
|
|
import { mockEmployees } from '../../../mocks/mockEmployees'
|
|
|
|
|
|
import { PriorityEnum } from '../../../types/common'
|
2025-09-17 09:46:58 +00:00
|
|
|
|
import { getPriorityText, getWorkOrderStatusText } from '@/utils/erp'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
interface NewCalendarEventModalProps {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
isOpen: boolean
|
|
|
|
|
|
onClose: () => void
|
|
|
|
|
|
onSave: (event: Partial<PmCalendarEvent>) => void
|
|
|
|
|
|
selectedDate?: Date
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const NewCalendarEventModal: React.FC<NewCalendarEventModalProps> = ({
|
|
|
|
|
|
isOpen,
|
|
|
|
|
|
onClose,
|
|
|
|
|
|
onSave,
|
|
|
|
|
|
selectedDate,
|
|
|
|
|
|
}) => {
|
|
|
|
|
|
const getInitialStartTime = () => {
|
|
|
|
|
|
if (selectedDate) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const hour = selectedDate.getHours()
|
|
|
|
|
|
const minute = selectedDate.getMinutes()
|
|
|
|
|
|
return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
return '09:00'
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const getInitialEndTime = () => {
|
|
|
|
|
|
if (selectedDate) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const endTime = new Date(selectedDate)
|
|
|
|
|
|
endTime.setHours(endTime.getHours() + 1)
|
|
|
|
|
|
const hour = endTime.getHours()
|
|
|
|
|
|
const minute = endTime.getMinutes()
|
|
|
|
|
|
return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
return '10:00'
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const [eventData, setEventData] = useState<Partial<PmCalendarEvent>>({
|
2025-09-15 21:29:07 +00:00
|
|
|
|
title: '',
|
|
|
|
|
|
type: 'plan',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
date: selectedDate || new Date(),
|
|
|
|
|
|
startTime: getInitialStartTime(),
|
|
|
|
|
|
endTime: getInitialEndTime(),
|
|
|
|
|
|
status: WorkOrderStatusEnum.Planned,
|
|
|
|
|
|
priority: PriorityEnum.Normal,
|
2025-09-15 21:29:07 +00:00
|
|
|
|
assignedTo: '',
|
|
|
|
|
|
workCenterCode: '',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
duration: 60,
|
2025-09-15 21:29:07 +00:00
|
|
|
|
})
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const [errors, setErrors] = useState<Record<string, string>>({})
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
// Update form data when selectedDate changes
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (selectedDate) {
|
|
|
|
|
|
const getInitialStartTime = () => {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const hour = selectedDate.getHours()
|
|
|
|
|
|
const minute = selectedDate.getMinutes()
|
|
|
|
|
|
return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const getInitialEndTime = () => {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const endTime = new Date(selectedDate)
|
|
|
|
|
|
endTime.setHours(endTime.getHours() + 1)
|
|
|
|
|
|
const hour = endTime.getHours()
|
|
|
|
|
|
const minute = endTime.getMinutes()
|
|
|
|
|
|
return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
setEventData((prev) => ({
|
|
|
|
|
|
...prev,
|
|
|
|
|
|
date: selectedDate,
|
|
|
|
|
|
startTime: getInitialStartTime(),
|
|
|
|
|
|
endTime: getInitialEndTime(),
|
2025-09-15 21:29:07 +00:00
|
|
|
|
}))
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
}, [selectedDate])
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 21:29:07 +00:00
|
|
|
|
if (!isOpen) return null
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const validateForm = () => {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const newErrors: Record<string, string> = {}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
if (!eventData.title?.trim()) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
newErrors.title = 'Başlık gerekli'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (!eventData.workCenterCode?.trim()) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
newErrors.workCenterCode = 'İş Merkezi seçimi gerekli'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (!eventData.startTime) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
newErrors.startTime = 'Başlangıç saati gerekli'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (!eventData.endTime) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
newErrors.endTime = 'Bitiş saati gerekli'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (eventData.startTime && eventData.endTime) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const start = new Date(`2000-01-01 ${eventData.startTime}`)
|
|
|
|
|
|
const end = new Date(`2000-01-01 ${eventData.endTime}`)
|
2025-09-15 09:31:47 +00:00
|
|
|
|
if (start >= end) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
newErrors.endTime = 'Bitiş saati başlangıç saatinden sonra olmalı'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 21:29:07 +00:00
|
|
|
|
setErrors(newErrors)
|
|
|
|
|
|
return Object.keys(newErrors).length === 0
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleSave = () => {
|
|
|
|
|
|
if (validateForm()) {
|
|
|
|
|
|
// Calculate duration
|
|
|
|
|
|
if (eventData.startTime && eventData.endTime) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const start = new Date(`2000-01-01 ${eventData.startTime}`)
|
|
|
|
|
|
const end = new Date(`2000-01-01 ${eventData.endTime}`)
|
|
|
|
|
|
const durationMinutes = (end.getTime() - start.getTime()) / (1000 * 60)
|
|
|
|
|
|
eventData.duration = durationMinutes
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onSave({
|
|
|
|
|
|
...eventData,
|
|
|
|
|
|
id: `E${Date.now()}`, // Generate a simple ID
|
2025-09-15 21:29:07 +00:00
|
|
|
|
})
|
|
|
|
|
|
onClose()
|
2025-09-15 09:31:47 +00:00
|
|
|
|
// Reset form
|
|
|
|
|
|
setEventData({
|
2025-09-15 21:29:07 +00:00
|
|
|
|
title: '',
|
|
|
|
|
|
type: 'plan',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
date: selectedDate || new Date(),
|
|
|
|
|
|
startTime: getInitialStartTime(),
|
|
|
|
|
|
endTime: getInitialEndTime(),
|
|
|
|
|
|
status: WorkOrderStatusEnum.Planned,
|
|
|
|
|
|
priority: PriorityEnum.Normal,
|
2025-09-15 21:29:07 +00:00
|
|
|
|
assignedTo: '',
|
|
|
|
|
|
workCenterCode: '',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
duration: 60,
|
2025-09-15 21:29:07 +00:00
|
|
|
|
})
|
|
|
|
|
|
setErrors({})
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const handleInputChange = (
|
|
|
|
|
|
field: keyof PmCalendarEvent,
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value: string | Date | PriorityEnum | WorkOrderStatusEnum | 'plan' | 'workorder' | 'scheduled',
|
2025-09-15 09:31:47 +00:00
|
|
|
|
) => {
|
|
|
|
|
|
setEventData((prev) => ({
|
|
|
|
|
|
...prev,
|
|
|
|
|
|
[field]: value,
|
2025-09-15 21:29:07 +00:00
|
|
|
|
}))
|
2025-09-15 09:31:47 +00:00
|
|
|
|
// Clear error when user starts typing
|
|
|
|
|
|
if (errors[field]) {
|
|
|
|
|
|
setErrors((prev) => ({
|
|
|
|
|
|
...prev,
|
2025-09-15 21:29:07 +00:00
|
|
|
|
[field]: '',
|
|
|
|
|
|
}))
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
const generateTimeOptions = () => {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const options = []
|
2025-09-15 09:31:47 +00:00
|
|
|
|
for (let hour = 0; hour < 24; hour++) {
|
|
|
|
|
|
for (let minute = 0; minute < 60; minute += 30) {
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const timeString = `${hour.toString().padStart(2, '0')}:${minute
|
2025-09-15 09:31:47 +00:00
|
|
|
|
.toString()
|
2025-09-15 21:29:07 +00:00
|
|
|
|
.padStart(2, '0')}`
|
|
|
|
|
|
options.push(timeString)
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
return options
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 21:29:07 +00:00
|
|
|
|
const timeOptions = generateTimeOptions()
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
|
|
|
|
|
|
<div className="bg-white rounded-lg w-full max-w-lg mx-4 max-h-[90vh] overflow-y-auto">
|
|
|
|
|
|
{/* Header */}
|
|
|
|
|
|
<div className="flex items-center justify-between p-4 border-b border-gray-200">
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<h2 className="text-xl font-bold text-gray-900">Yeni Bakım Planlaması</h2>
|
|
|
|
|
|
<button onClick={onClose} className="text-gray-400 hover:text-gray-600 transition-colors">
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<FaTimes className="w-5 h-5" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Content */}
|
|
|
|
|
|
<div className="p-3 space-y-3">
|
|
|
|
|
|
{/* Basic Info */}
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
|
<div className="md:col-span-2">
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Başlık *</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.title || ''}
|
|
|
|
|
|
onChange={(e) => handleInputChange('title', e.target.value)}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className={`w-full px-2.5 py-1.5 text-sm border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${
|
2025-09-15 21:29:07 +00:00
|
|
|
|
errors.title ? 'border-red-500' : 'border-gray-300'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}`}
|
|
|
|
|
|
placeholder="Bakım planı başlığı"
|
|
|
|
|
|
/>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
{errors.title && <p className="text-red-500 text-xs mt-1">{errors.title}</p>}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Tip</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<select
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.type || 'plan'}
|
|
|
|
|
|
onChange={(e) => handleInputChange('type', e.target.value as 'plan' | 'workorder')}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className="w-full px-2.5 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="plan">Bakım Planı</option>
|
|
|
|
|
|
<option value="workorder">İş Emri</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Öncelik</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<select
|
|
|
|
|
|
value={eventData.priority || PriorityEnum.Normal}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
onChange={(e) => handleInputChange('priority', e.target.value as PriorityEnum)}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className="w-full px-2.5 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
|
|
|
|
>
|
2025-09-17 09:46:58 +00:00
|
|
|
|
{Object.values(PriorityEnum).map((priority) => (
|
|
|
|
|
|
<option key={priority} value={priority}>
|
|
|
|
|
|
{getPriorityText(priority)}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">İş Merkezi *</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<select
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.workCenterCode || ''}
|
|
|
|
|
|
onChange={(e) => handleInputChange('workCenterCode', e.target.value)}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className={`w-full px-2.5 py-1.5 text-sm border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${
|
2025-09-15 21:29:07 +00:00
|
|
|
|
errors.workCenterCode ? 'border-red-500' : 'border-gray-300'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="">İş merkezi seçin</option>
|
|
|
|
|
|
{mockWorkCenters.map((workCenter) => (
|
|
|
|
|
|
<option key={workCenter.id} value={workCenter.code}>
|
|
|
|
|
|
{workCenter.code} - {workCenter.name}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
{errors.workCenterCode && (
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<p className="text-red-500 text-xs mt-1">{errors.workCenterCode}</p>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Atanan Kişi</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<select
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.assignedTo || ''}
|
|
|
|
|
|
onChange={(e) => handleInputChange('assignedTo', e.target.value)}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className="w-full px-2.5 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="">Kişi seçin</option>
|
|
|
|
|
|
{mockEmployees.map((employee) => (
|
|
|
|
|
|
<option key={employee.id} value={employee.fullName}>
|
|
|
|
|
|
{employee.fullName} ({employee.code})
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Date and Time */}
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
|
|
|
|
<FaCalendar className="inline w-4 h-4 mr-2" />
|
|
|
|
|
|
Tarih
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="date"
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.date?.toISOString().split('T')[0] || ''}
|
|
|
|
|
|
onChange={(e) => handleInputChange('date', new Date(e.target.value))}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className="w-full px-2.5 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
|
|
|
|
<FaClock className="inline w-4 h-4 mr-2" />
|
|
|
|
|
|
Başlangıç Saati *
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<select
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.startTime || '09:00'}
|
|
|
|
|
|
onChange={(e) => handleInputChange('startTime', e.target.value)}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className={`w-full px-2.5 py-1.5 text-sm border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${
|
2025-09-15 21:29:07 +00:00
|
|
|
|
errors.startTime ? 'border-red-500' : 'border-gray-300'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{timeOptions.map((time) => (
|
|
|
|
|
|
<option key={time} value={time}>
|
|
|
|
|
|
{time}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</select>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
{errors.startTime && <p className="text-red-500 text-xs mt-1">{errors.startTime}</p>}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Bitiş Saati *</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<select
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.endTime || '10:00'}
|
|
|
|
|
|
onChange={(e) => handleInputChange('endTime', e.target.value)}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
className={`w-full px-2.5 py-1.5 text-sm border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${
|
2025-09-15 21:29:07 +00:00
|
|
|
|
errors.endTime ? 'border-red-500' : 'border-gray-300'
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{timeOptions.map((time) => (
|
|
|
|
|
|
<option key={time} value={time}>
|
|
|
|
|
|
{time}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</select>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
{errors.endTime && <p className="text-red-500 text-xs mt-1">{errors.endTime}</p>}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Status */}
|
2025-09-15 21:29:07 +00:00
|
|
|
|
{eventData.type === 'workorder' && (
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<div>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Durum</label>
|
2025-09-15 09:31:47 +00:00
|
|
|
|
<select
|
2025-09-15 21:29:07 +00:00
|
|
|
|
value={eventData.status || 'scheduled'}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
onChange={(e) =>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
handleInputChange('status', e.target.value as WorkOrderStatusEnum | 'scheduled')
|
2025-09-15 09:31:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
className="w-full px-2.5 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
|
|
|
|
>
|
2025-09-17 09:46:58 +00:00
|
|
|
|
{Object.values(WorkOrderStatusEnum).map((status) => (
|
|
|
|
|
|
<option key={status} value={status}>
|
|
|
|
|
|
{getWorkOrderStatusText(status)}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Footer */}
|
|
|
|
|
|
<div className="flex items-center justify-end space-x-2 p-3 border-t border-gray-200">
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
|
className="px-3 py-1 text-sm text-gray-600 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
İptal
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={handleSave}
|
|
|
|
|
|
className="px-3 py-1 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center space-x-2"
|
|
|
|
|
|
>
|
|
|
|
|
|
<FaSave className="w-4 h-4" />
|
|
|
|
|
|
<span>Kaydet</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-09-15 21:29:07 +00:00
|
|
|
|
)
|
|
|
|
|
|
}
|
2025-09-15 09:31:47 +00:00
|
|
|
|
|
2025-09-15 21:29:07 +00:00
|
|
|
|
export default NewCalendarEventModal
|