mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 13:05:44 +00:00
Cut off time configuration
This commit is contained in:
@@ -308,7 +308,12 @@ export default function RoutesPage() {
|
||||
};
|
||||
|
||||
const addStop = () => {
|
||||
setStops([...stops, { stationId: '', sequence: stops.length + 1, distanceFromOrigin: 0 }]);
|
||||
// distanceKm must be cumulative and strictly increasing (enforced server-side) — defaulting
|
||||
// every new stop to 0 made each one collide with the previous, so simply clicking "Add
|
||||
// Intermediate Stop" a few times and saving without hand-editing every distance always failed
|
||||
// validation. Default each new stop's distance a step past whatever precedes it instead.
|
||||
const lastDistance = stops.length > 0 ? (stops[stops.length - 1].distanceFromOrigin ?? 0) : 0;
|
||||
setStops([...stops, { stationId: '', sequence: stops.length + 1, distanceFromOrigin: lastDistance + 10 }]);
|
||||
};
|
||||
|
||||
const removeStop = (index: number) => {
|
||||
|
||||
Reference in New Issue
Block a user