aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-03-05 21:43:11 -0600
committerIván Ávalos <avalos@disroot.org>2023-03-05 21:43:11 -0600
commit19a5dc94fcb678e27e766258b2839c139953776c (patch)
tree3e6e9d2c11f082b3980260541abaf4ea0a7b3392
parent5c425999cf2d2aed657c61dbc636d9ac178aa63a (diff)
downloadetbsa-traccar-web-19a5dc94fcb678e27e766258b2839c139953776c.tar.gz
etbsa-traccar-web-19a5dc94fcb678e27e766258b2839c139953776c.tar.bz2
etbsa-traccar-web-19a5dc94fcb678e27e766258b2839c139953776c.zip
Cambios en reportes
-rw-r--r--modern/src/DevicesList.js10
-rw-r--r--modern/src/admin/UsersPage.js4
-rw-r--r--modern/src/map/ReplayPathMap.js2
-rw-r--r--modern/src/map/StatusView.js13
-rw-r--r--modern/src/reports/EventReportPage.js18
-rw-r--r--modern/src/reports/ReportLayout.js1
-rw-r--r--modern/src/reports/StopReportPage.js32
-rw-r--r--modern/src/reports/SummaryReportPage.js30
-rw-r--r--modern/src/reports/TripReportPage.js5
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)})`}<br />
+ {/* Address */}
+ {position.address && (
+ <>
+ <PlaceIcon fontSize="inherit" />
+ {` ${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 }) => {
</TableCell>
<TableCell>{item.name}</TableCell>
<TableCell>{item.email}</TableCell>
- <TableCell>{formatBoolean(item, 'administrator', t)}</TableCell>
- <TableCell>{formatBoolean(item, 'disabled', t)}</TableCell>
+ <TableCell>{formatBoolean(item['administrator'], t)}</TableCell>
+ <TableCell>{formatBoolean(item['disabled'], t)}</TableCell>
</TableRow>
))}
</TableBody>
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 = ({
</List>
</Grid>
<Grid item container>
- <Grid item>
- <IconButton onClick={handleClick}>
- <InfoIcon />
- </IconButton>
- </Grid>
+ {session.user.administrator && (<>
+ <Grid item>
+ <IconButton onClick={handleClick}>
+ <InfoIcon />
+ </IconButton>
+ </Grid>
+ </>
+ )}
<Grid item>
<IconButton onClick={() => onShowHistory(deviceId)}>
<PlayCircleFilledIcon />
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 }) => {
{/*<MenuItem value="deviceOnline">{t('eventDeviceOnline')}</MenuItem>*/}
{/*<MenuItem value="deviceUnknown">{t('eventDeviceUnknown')}</MenuItem>*/}
{/*<MenuItem value="deviceOffline">{t('eventDeviceOffline')}</MenuItem>*/}
- <MenuItem value="deviceInactive">{t('eventDeviceInactive')}</MenuItem>
- <MenuItem value="deviceMoving">{t('eventDeviceMoving')}</MenuItem>
- <MenuItem value="deviceStopped">{t('eventDeviceStopped')}</MenuItem>
+ {/*<MenuItem value="deviceInactive">{t('eventDeviceInactive')}</MenuItem>*/}
+ {/*<MenuItem value="deviceMoving">{t('eventDeviceMoving')}</MenuItem>*/}
+ {/*<MenuItem value="deviceStopped">{t('eventDeviceStopped')}</MenuItem>*/}
<MenuItem value="deviceOverspeed">{t('eventDeviceOverspeed')}</MenuItem>
<MenuItem value="deviceFuelDrop">{t('eventDeviceFuelDrop')}</MenuItem>
<MenuItem value="commandResult">{t('eventCommandResult')}</MenuItem>
<MenuItem value="geofenceEnter">{t('eventGeofenceEnter')}</MenuItem>
<MenuItem value="geofenceExit">{t('eventGeofenceExit')}</MenuItem>
- <MenuItem value="alarm">{t('eventAlarm')}</MenuItem>
+ {/*<MenuItem value="alarm">{t('eventAlarm')}</MenuItem>*/}
<MenuItem value="ignitionOn">{t('eventIgnitionOn')}</MenuItem>
<MenuItem value="ignitionOff">{t('eventIgnitionOff')}</MenuItem>
<MenuItem value="maintenance">{t('eventMaintenance')}</MenuItem>
- <MenuItem value="textMessage">{t('eventTextMessage')}</MenuItem>
- <MenuItem value="driverChanged">{t('eventDriverChanged')}</MenuItem>
+ {/*<MenuItem value="textMessage">{t('eventTextMessage')}</MenuItem>*/}
+ {/*<MenuItem value="driverChanged">{t('eventDriverChanged')}</MenuItem>*/}
</Select>
</FormControl>
</Grid>
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: <PlayCircleFilledIcon /> },
{ name: t('reportStops'), href: '/reports/stop', icon: <PauseCircleFilledIcon /> },
{ name: t('reportSummary'), href: '/reports/summary', icon: <FormatListBulletedIcon /> },
- { name: t('reportChart'), href: '/reports/chart', icon: <TrendingUpIcon /> },
], [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
@@ -83,12 +83,6 @@ const StopReportPage = () => {
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',
type: 'dateTime',
@@ -101,29 +95,29 @@ const StopReportPage = () => {
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',
type: 'number',
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 (
<ReportLayout filter={<Filter setItems={setItems} />}>
- <DataGrid
- rows={items}
- columns={columns}
- hideFooter
- autoHeight
- getRowId={() => Math.random()}
- />
+ <DataGrid
+ rows={items}
+ columns={columns}
+ hideFooter
+ autoHeight
+ getRowId={() => Math.random()}
+ />
</ReportLayout>
);
};
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',
@@ -107,18 +113,6 @@ const SummaryReportPage = () => {
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',
type: 'string',
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'),