Bổ sung tính năng sửa chữa, cập nhật địa điểm trong chặng

This commit is contained in:
2026-06-14 10:16:09 +07:00
parent ec650fb45d
commit 838aec562f
19 changed files with 285 additions and 45 deletions
+9
View File
@@ -161,6 +161,7 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
const [viewMode, setViewMode] = useState<'map' | 'timeline'>('timeline');
const [isAddLocationOpen, setIsAddLocationOpen] = useState(false);
const [targetLegId, setTargetLegId] = useState<string | null>(null);
const [editingLocation, setEditingLocation] = useState<any>(null);
// Khôi phục vị trí và mức zoom từ localStorage
const [initialViewState] = useState(() => {
@@ -499,6 +500,12 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
{viewMode === 'timeline' ? (
<ItineraryTimeline onAddLocation={(legId) => {
setTargetLegId(legId);
setEditingLocation(null);
setIsAddLocationOpen(true);
}} onEditLocation={(loc) => {
setEditingLocation(loc);
setTargetLegId(loc.legId);
setMapCenter([loc.latitude, loc.longitude]);
setIsAddLocationOpen(true);
}} />
) : (
@@ -587,6 +594,7 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
<button
onClick={() => {
setTargetLegId(null); // Reset khi nhấn nút floating tổng quát
setEditingLocation(null);
if (activeTab === 'plan') setIsAddLocationOpen(true);
}}
className="bg-blue-600 text-white px-6 py-3 rounded-full shadow-lg hover:bg-blue-700 transition-all flex items-center font-bold">
@@ -600,6 +608,7 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
isOpen={isAddLocationOpen}
onClose={() => setIsAddLocationOpen(false)}
initialLegId={targetLegId || undefined}
editingLocation={editingLocation}
tourId={currentTour.id}
/>
)}