-
-
+
+ {waypoints.map((wp, index) => (
+ onEditWaypoint(index) : null}
+ onRemove={() => onRemoveWaypoint(index)}
/>
- {isSource && isDest && (
-
- )}
-
+ ))}
+
{isDest && (
-
-
-
-
+
+ )}
+
+ {canAddWaypoint && (
+ <>
+
+
+
+
+ افزودن نقطه میانی
+
+
+ >
)}
);
diff --git a/src/components/dashboard/roadMissions/operator/Actions/Create/Form/Area/Routing/ShowRoute.jsx b/src/components/dashboard/roadMissions/operator/Actions/Create/Form/Area/Routing/ShowRoute.jsx
index b05cc6a..2a677a1 100644
--- a/src/components/dashboard/roadMissions/operator/Actions/Create/Form/Area/Routing/ShowRoute.jsx
+++ b/src/components/dashboard/roadMissions/operator/Actions/Create/Form/Area/Routing/ShowRoute.jsx
@@ -55,3 +55,78 @@ const ShowRoute = ({ area }) => {
};
export default ShowRoute;
+
+
+
+
+// import { useEffect, useState } from "react";
+// import { Marker, Polyline, useMap } from "react-leaflet";
+// import L from "leaflet";
+// import polyline from "@mapbox/polyline";
+// import SourceIcon from "@/assets/images/source-icon.svg";
+// import DestIcon from "@/assets/images/destination-icon.svg";
+// import WaypointIcon from "@/assets/images/waypoint-icon.svg";
+//
+// const defaultIconSize = [35, 35];
+//
+// const createCustomIcon = (size, iconUrl) => {
+// return L.icon({
+// iconUrl: iconUrl,
+// iconSize: size,
+// iconAnchor: [size[0] / 2, size[1]],
+// popupAnchor: [0, -size[1]],
+// });
+// };
+//
+// const sourceIcon = createCustomIcon(defaultIconSize, SourceIcon.src);
+// const destIcon = createCustomIcon(defaultIconSize, DestIcon.src);
+// const waypointIcon = createCustomIcon(defaultIconSize, WaypointIcon.src);
+//
+// // locations: آرایه اختیاری [{lat, lon}, ...] شامل مبدا، نقاط میانی و مقصد به همون ترتیبی که برای روتینگ فرستاده شده
+// const ShowRoute = ({ area, locations = [] }) => {
+// const map = useMap();
+// const [showRoute, setShowRoute] = useState(false);
+//
+// const coords = area ? polyline.decode(area, 6) : [];
+//
+// useEffect(() => {
+// if (!coords.length) return;
+//
+// setShowRoute(false);
+//
+// map.flyToBounds(coords, {
+// padding: [50, 50],
+// duration: 1.5,
+// });
+//
+// map.once("moveend", () => {
+// setShowRoute(true);
+// });
+// // eslint-disable-next-line react-hooks/exhaustive-deps
+// }, [area]);
+//
+// if (!area || coords.length === 0) return null;
+//
+// const sourcePosition = coords[0];
+// const destPosition = coords[coords.length - 1];
+//
+// // نقاط میانی فقط از روی locations قابل استخراجان (بین اولی و آخری)
+// const middleWaypoints = locations.length > 2 ? locations.slice(1, -1) : [];
+//
+// return (
+// <>
+// {showRoute &&