diff --git a/client/src/components/trans-routes/RoutesDashboard.js b/client/src/components/trans-routes/RoutesDashboard.js index f7d5702..26e2ff3 100644 --- a/client/src/components/trans-routes/RoutesDashboard.js +++ b/client/src/components/trans-routes/RoutesDashboard.js @@ -90,6 +90,7 @@ const RoutesDashboard = () => { const [customerTypeFixing, setCustomerTypeFixing] = useState({}); const [customerSpecialNeedsFixing, setCustomerSpecialNeedsFixing] = useState({}); const [customerNoteFixing, setCustomerNoteFixing] = useState({}); + const [isFutureScheduleEditMode, setIsFutureScheduleEditMode] = useState(false); const scheduleImportProgressTimerRef = useRef(null); @@ -705,6 +706,12 @@ const RoutesDashboard = () => { const yesterday = new Date(); const tomorrow = new Date(); const isFutureScheduleSelected = moment(dateSelected).startOf('day').isAfter(moment().startOf('day')); + const shouldShowFutureEditView = isFutureScheduleSelected && isFutureScheduleEditMode; + const shouldShowReadOnlyOverview = !isFutureScheduleSelected || !isFutureScheduleEditMode; + + useEffect(() => { + setIsFutureScheduleEditMode(false); + }, [dateSelected]); const startScheduleImportProgress = (label) => { if (scheduleImportProgressTimerRef.current) { @@ -1761,10 +1768,10 @@ const RoutesDashboard = () => { } - {(dateSelected && dateSelected > new Date()) &&