fix
All checks were successful
Build And Deploy Main / build-and-deploy (push) Successful in 35s

This commit is contained in:
2026-03-12 17:31:06 -04:00
parent 473cfcffeb
commit 9a1efbf532
2 changed files with 46 additions and 25 deletions

View File

@@ -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) || {

View File

@@ -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 (