import React, { useState } from 'react'; import { X, MapPin, Loader2, Clock } from 'lucide-react'; import { useTourStore } from './useTourStore.js'; export const AddLocationModal = ({ isOpen, onClose, tourId }: { isOpen: boolean, onClose: () => void, tourId: string }) => { const [formData, setFormData] = useState({ name: '', address: '', latitude: 10.7769, longitude: 106.7009, type: 'VISIT', plannedStart: '', plannedEnd: '' }); const [isLoading, setIsLoading] = useState(false); const addLocation = useTourStore(state => state.addLocation); if (!isOpen) return null; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); try { await addLocation(tourId, { ...formData, latitude: parseFloat(formData.latitude as any), longitude: parseFloat(formData.longitude as any), }); onClose(); } catch (error) { alert('Lỗi khi thêm địa điểm'); } finally { setIsLoading(false); } }; return (