Sửa hiển thị điểm đầu và điểm cuối của chặng
This commit is contained in:
@@ -150,6 +150,7 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
|
||||
const setMapCenter = useTourStore(state => state.setMapCenter);
|
||||
const updateTourStartPoint = useTourStore(state => state.updateTourStartPoint);
|
||||
const updateTourEndPoint = useTourStore(state => state.updateTourEndPoint);
|
||||
const initializeLegs = useTourStore(state => state.initializeLegs);
|
||||
const addLocation = useTourStore(state => state.addLocation);
|
||||
|
||||
const [mapZoom] = useState(initialViewState?.zoom || 13);
|
||||
@@ -177,6 +178,15 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
|
||||
}
|
||||
}, [publicTours, currentTour, fetchTour]);
|
||||
|
||||
// Hàm xử lý khai báo số chặng
|
||||
const handleDeclareLegs = async () => {
|
||||
const countStr = window.prompt("Chuyến đi này bạn muốn chia làm bao nhiêu chặng?", "3");
|
||||
const count = parseInt(countStr || "0");
|
||||
if (count > 0 && currentTour) {
|
||||
await initializeLegs(currentTour.id, count);
|
||||
}
|
||||
};
|
||||
|
||||
// Hàm xử lý các hành động từ Context Menu của bản đồ
|
||||
const handleMapAction = async (action: string, latlng: L.LatLng) => {
|
||||
// Bước 1: Lấy tọa độ (lat, lng) tại vị trí click (đã nhận qua tham số latlng)
|
||||
|
||||
Reference in New Issue
Block a user