diff --git a/client/src/components/trans-routes/RoutesDashboard.js b/client/src/components/trans-routes/RoutesDashboard.js index f7b1a8e..c3325f4 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 [isScheduleEditMode, setIsScheduleEditMode] = useState(false); const scheduleImportProgressTimerRef = useRef(null); @@ -701,6 +702,10 @@ const RoutesDashboard = () => { } }, [allRoutes, allHistoryRoutes, allTomorrowRoutes]); + useEffect(() => { + setIsScheduleEditMode(false); + }, [dateSelected, currentTab]); + const now = new Date(); const yesterday = new Date(); const tomorrow = new Date(); @@ -1754,13 +1759,12 @@ const RoutesDashboard = () => {
changeTab(k)}> - {(!dateSelected || getDateString(dateSelected) === getDateString(new Date())) &&
+ {(!dateSelected || getDateString(dateSelected) === getDateString(new Date())) && isScheduleEditMode &&
{/* */} {/* */} -
} {isFutureScheduleSelected &&
{/* */} @@ -1920,6 +1924,9 @@ const RoutesDashboard = () => { { currentTab === 'allRoutesOverview' && <> { !showCopyDateTargetLoading && <> + { } } - {!isFutureScheduleSelected && } + {!isFutureScheduleSelected && AuthService.canAddOrEditRoutes() && ( + + )} + {!isFutureScheduleSelected && isScheduleEditMode && } }