From 19a5dc94fcb678e27e766258b2839c139953776c Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Sun, 5 Mar 2023 21:43:11 -0600 Subject: Cambios en reportes --- modern/src/DevicesList.js | 10 +++++++++- modern/src/admin/UsersPage.js | 4 ++-- modern/src/map/ReplayPathMap.js | 2 +- modern/src/map/StatusView.js | 13 ++++++++----- modern/src/reports/EventReportPage.js | 18 ++++++------------ modern/src/reports/ReportLayout.js | 1 - modern/src/reports/StopReportPage.js | 32 +++++++++++++------------------- modern/src/reports/SummaryReportPage.js | 30 ++++++++++++------------------ modern/src/reports/TripReportPage.js | 5 +++-- 9 files changed, 54 insertions(+), 61 deletions(-) diff --git a/modern/src/DevicesList.js b/modern/src/DevicesList.js index 62a28cf..541369c 100644 --- a/modern/src/DevicesList.js +++ b/modern/src/DevicesList.js @@ -20,6 +20,7 @@ import SpeedIcon from '@material-ui/icons/Speed'; import CalendarTodayIcon from '@material-ui/icons/CalendarToday'; import LockIcon from '@material-ui/icons/Lock'; import LockOpenIcon from '@material-ui/icons/LockOpen'; +import PlaceIcon from '@material-ui/icons/Place'; import { devicesActions, uiActions } from './store'; import EditCollectionView from './EditCollectionView'; @@ -147,7 +148,14 @@ const DeviceRow = ({ data, index, style }) => { && (item.category.toLowerCase() === 'backhoe' || item.category.toLowerCase() === 'tractor' ) && position.attributes.hours && position.attributes.hours > 1 - && ` (${formatHours(position.attributes.hours, t)})`} + && ` (${formatHours(position.attributes.hours, t)})`}
+ {/* Address */} + {position.address && ( + <> + + {` ${position.adress}`} + + )} )} diff --git a/modern/src/admin/UsersPage.js b/modern/src/admin/UsersPage.js index bd2a003..55a6761 100644 --- a/modern/src/admin/UsersPage.js +++ b/modern/src/admin/UsersPage.js @@ -51,8 +51,8 @@ const UsersView = ({ updateTimestamp, onMenuClick }) => { {item.name} {item.email} - {formatBoolean(item, 'administrator', t)} - {formatBoolean(item, 'disabled', t)} + {formatBoolean(item['administrator'], t)} + {formatBoolean(item['disabled'], t)} ))} diff --git a/modern/src/map/ReplayPathMap.js b/modern/src/map/ReplayPathMap.js index 022548b..c0c3a97 100644 --- a/modern/src/map/ReplayPathMap.js +++ b/modern/src/map/ReplayPathMap.js @@ -25,7 +25,7 @@ const ReplayPathMap = ({ positions }) => { 'line-cap': 'round', }, paint: { - 'line-color': '#333', + 'line-color': '#337729', 'line-width': 5, }, }); diff --git a/modern/src/map/StatusView.js b/modern/src/map/StatusView.js index b892e77..5c8d22d 100644 --- a/modern/src/map/StatusView.js +++ b/modern/src/map/StatusView.js @@ -103,11 +103,14 @@ const StatusView = ({ - - - - - + {session.user.administrator && (<> + + + + + + + )} onShowHistory(deviceId)}> diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index 8e81039..27f8bf9 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -18,20 +18,14 @@ const Filter = ({ setItems }) => { const [data, setData] = useState({url: '', filename: ''}); const [eventTypes, setEventTypes] = useState([ - 'deviceInactive', - 'deviceMoving', - 'deviceStopped', 'deviceOverspeed', 'deviceFuelDrop', 'commandResult', 'geofenceEnter', 'geofenceExit', - 'alarm', 'ignitionOn', 'ignitionOff', 'maintenance', - 'textMessage', - 'driverChanged', ]); const renderSelectedEvents = (value) => { @@ -109,20 +103,20 @@ const Filter = ({ setItems }) => { {/*{t('eventDeviceOnline')}*/} {/*{t('eventDeviceUnknown')}*/} {/*{t('eventDeviceOffline')}*/} - {t('eventDeviceInactive')} - {t('eventDeviceMoving')} - {t('eventDeviceStopped')} + {/*{t('eventDeviceInactive')}*/} + {/*{t('eventDeviceMoving')}*/} + {/*{t('eventDeviceStopped')}*/} {t('eventDeviceOverspeed')} {t('eventDeviceFuelDrop')} {t('eventCommandResult')} {t('eventGeofenceEnter')} {t('eventGeofenceExit')} - {t('eventAlarm')} + {/*{t('eventAlarm')}*/} {t('eventIgnitionOn')} {t('eventIgnitionOff')} {t('eventMaintenance')} - {t('eventTextMessage')} - {t('eventDriverChanged')} + {/*{t('eventTextMessage')}*/} + {/*{t('eventDriverChanged')}*/} diff --git a/modern/src/reports/ReportLayout.js b/modern/src/reports/ReportLayout.js index f6e71db..f95787b 100644 --- a/modern/src/reports/ReportLayout.js +++ b/modern/src/reports/ReportLayout.js @@ -66,7 +66,6 @@ const ReportLayout = ({ children, filter }) => { { name: t('reportTrips'), href: '/reports/trip', icon: }, { name: t('reportStops'), href: '/reports/stop', icon: }, { name: t('reportSummary'), href: '/reports/summary', icon: }, - { name: t('reportChart'), href: '/reports/chart', icon: }, ], [t]); useEffect(() => { diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js index 5012637..208c604 100644 --- a/modern/src/reports/StopReportPage.js +++ b/modern/src/reports/StopReportPage.js @@ -82,12 +82,6 @@ const StopReportPage = () => { type: 'number', width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit, t), - }, { - headerName: t('positionAddress'), - field: 'address', - type: 'string', - hide: true, - width: theme.dimensions.columnWidthString, }, { headerName: t('reportEndTime'), field: 'endTime', @@ -100,12 +94,6 @@ const StopReportPage = () => { type: 'string', width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatHours(value, t), - }, { - headerName: t('reportEngineHours'), - field: 'engineHours', - type: 'string', - width: theme.dimensions.columnWidthNumber, - valueFormatter: ({ value }) => formatHours(value, t), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', @@ -113,17 +101,23 @@ const StopReportPage = () => { width: theme.dimensions.columnWidthNumber, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit, t), + }, { + headerName: t('positionAddress'), + field: 'address', + type: 'string', + width: theme.dimensions.columnWidthString, + // valueFormatter: ({ value }) => formatVolume(value, volumeUnit, t), }]; return ( }> - Math.random()} - /> + Math.random()} + /> ); }; diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js index 4413895..3c0d292 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -83,18 +83,24 @@ const SummaryReportPage = () => { const [items, setItems] = useState([]); const columns = [{ - headerName: t('reportStartDate'), + headerName: t('reportStartTime'), field: 'startTime', type: 'dateTime', width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { - headerName: t('sharedDistance'), - field: 'distance', - type: 'number', - width: theme.dimensions.columnWidthNumber, - valueFormatter: ({ value }) => formatDistance(value, distanceUnit, t), + headerName: t('reportEndTime'), + field: 'endTime', + type: 'dateTime', + width: theme.dimensions.columnWidthDate, + valueFormatter: ({ value }) => formatDate(value), }, { + headerName: t('sharedDistance'), + field: 'distance', + type: 'number', + width: theme.dimensions.columnWidthNumber, + valueFormatter: ({ value }) => formatDistance(value, distanceUnit, t), + }, { headerName: t('reportStartOdometer'), field: 'startOdometer', type: 'number', @@ -106,18 +112,6 @@ const SummaryReportPage = () => { type: 'number', width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit, t), - }, { - headerName: t('reportAverageSpeed'), - field: 'averageSpeed', - type: 'number', - width: theme.dimensions.columnWidthNumber, - valueFormatter: ({ value }) => formatSpeed(value, speedUnit, t), - }, { - headerName: t('reportMaximumSpeed'), - field: 'maxSpeed', - type: 'number', - width: theme.dimensions.columnWidthNumber, - valueFormatter: ({ value }) => formatSpeed(value, speedUnit, t), }, { headerName: t('reportEngineHours'), field: 'engineHours', diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js index 74451bc..0803eec 100644 --- a/modern/src/reports/TripReportPage.js +++ b/modern/src/reports/TripReportPage.js @@ -71,6 +71,8 @@ const TripReportPage = () => { const [items, setItems] = useState([]); + console.log(items); + const columns = [{ headerName: t('reportStartTime'), field: 'startTime', @@ -87,7 +89,6 @@ const TripReportPage = () => { headerName: t('reportStartAddress'), field: 'startAddress', type: 'string', - hide: true, width: theme.dimensions.columnWidthString, }, { headerName: t('reportEndTime'), @@ -105,7 +106,6 @@ const TripReportPage = () => { headerName: t('reportEndAddress'), field: 'endAddress', type: 'string', - hide: true, width: theme.dimensions.columnWidthString, }, { headerName: t('sharedDistance'), @@ -124,6 +124,7 @@ const TripReportPage = () => { field: 'maxSpeed', type: 'number', width: theme.dimensions.columnWidthNumber, + hide: true, valueFormatter: ({ value }) => formatSpeed(value, speedUnit, t), }, { headerName: t('reportDuration'), -- cgit v1.2.3