This commit is contained in:
@@ -530,6 +530,8 @@ const RoutesDashboard = () => {
|
||||
};
|
||||
const routeNote = normalizeNullableNote(customerInRoute?.customer_note);
|
||||
const dbNoteToDriver = normalizeNullableNote(customerProfile?.notes_for_driver);
|
||||
// Ignore empty-note comparisons during route checks.
|
||||
if (!routeNote || !dbNoteToDriver) return;
|
||||
if (routeNote === dbNoteToDriver) return;
|
||||
|
||||
const existing = mismatchMap.get(customerId) || {
|
||||
|
||||
@@ -16,31 +16,50 @@ const TransRoutes = () => {
|
||||
navigate('/admin');
|
||||
}
|
||||
useEffect(() => {
|
||||
if (
|
||||
!AuthService.canAddOrEditRoutes() &&
|
||||
!AuthService.canViewRoutes() &&
|
||||
!AuthService.canViewRouteTemplates() &&
|
||||
!AuthService.canEditRouteTemplates()
|
||||
) {
|
||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change a dispatcher or admin account to login.')
|
||||
AuthService.logout();
|
||||
navigate(`/login`);
|
||||
}
|
||||
dispatch(fetchAllDrivers());
|
||||
dispatch(fetchAllVehicles());
|
||||
dispatch(fetchAllRoutes());
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const scheduleDate = params.get('dateSchedule');
|
||||
const requestBody = scheduleDate ? {dateText: moment(scheduleDate).format('MM/DD/YYYY')}: {};
|
||||
dispatch(fetchAllTomorrowRoutes(requestBody));
|
||||
dispatch(fetchAllRouteTemplates());
|
||||
dispatch(fetchAllBreakfastRecords());
|
||||
dispatch(fetchAllLunchRecords());
|
||||
dispatch(fetchAllSnackRecords());
|
||||
const timeInterval = setInterval(
|
||||
() => { dispatch(fetchAllRoutes()); }, 180000
|
||||
);
|
||||
return () => clearInterval(timeInterval);
|
||||
let isMounted = true;
|
||||
let timeInterval;
|
||||
const initPage = async () => {
|
||||
try {
|
||||
// Ensure permission checks use latest server-side permissions on refresh.
|
||||
await AuthService.refreshCurrentUserPermissions();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
if (!isMounted) return;
|
||||
if (
|
||||
!AuthService.canAddOrEditRoutes() &&
|
||||
!AuthService.canViewRoutes() &&
|
||||
!AuthService.canViewRouteTemplates() &&
|
||||
!AuthService.canEditRouteTemplates()
|
||||
) {
|
||||
window.alert('You haven\'t login yet OR this user does not have access to this page. Please change a dispatcher or admin account to login.')
|
||||
AuthService.logout();
|
||||
navigate(`/login`);
|
||||
return;
|
||||
}
|
||||
dispatch(fetchAllDrivers());
|
||||
dispatch(fetchAllVehicles());
|
||||
dispatch(fetchAllRoutes());
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const scheduleDate = params.get('dateSchedule');
|
||||
const requestBody = scheduleDate ? {dateText: moment(scheduleDate).format('MM/DD/YYYY')}: {};
|
||||
dispatch(fetchAllTomorrowRoutes(requestBody));
|
||||
dispatch(fetchAllRouteTemplates());
|
||||
dispatch(fetchAllBreakfastRecords());
|
||||
dispatch(fetchAllLunchRecords());
|
||||
dispatch(fetchAllSnackRecords());
|
||||
timeInterval = setInterval(
|
||||
() => { dispatch(fetchAllRoutes()); }, 180000
|
||||
);
|
||||
};
|
||||
initPage();
|
||||
return () => {
|
||||
isMounted = false;
|
||||
if (timeInterval) {
|
||||
clearInterval(timeInterval);
|
||||
}
|
||||
};
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user