aboutsummaryrefslogtreecommitdiff
path: root/src/reports/StopReportPage.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/reports/StopReportPage.jsx')
-rw-r--r--src/reports/StopReportPage.jsx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/reports/StopReportPage.jsx b/src/reports/StopReportPage.jsx
index 066b29a4..0fd6aba1 100644
--- a/src/reports/StopReportPage.jsx
+++ b/src/reports/StopReportPage.jsx
@@ -10,7 +10,7 @@ import {
formatDistance, formatVolume, formatTime, formatNumericHours,
} from '../common/util/formatter';
import ReportFilter from './components/ReportFilter';
-import { useAttributePreference, usePreference } from '../common/util/preferences';
+import { useAttributePreference } from '../common/util/preferences';
import { useTranslation } from '../common/components/LocalizationProvider';
import PageLayout from '../common/components/PageLayout';
import ReportsMenu from './components/ReportsMenu';
@@ -44,7 +44,6 @@ const StopReportPage = () => {
const distanceUnit = useAttributePreference('distanceUnit');
const volumeUnit = useAttributePreference('volumeUnit');
- const hours12 = usePreference('twelveHourFormat');
const [columns, setColumns] = usePersistedState('stopColumns', ['startTime', 'endTime', 'startOdometer', 'address']);
const [items, setItems] = useState([]);
@@ -88,22 +87,23 @@ const StopReportPage = () => {
});
const formatValue = (item, key) => {
+ const value = item[key];
switch (key) {
case 'startTime':
case 'endTime':
- return formatTime(item[key], 'minutes', hours12);
+ return formatTime(value, 'minutes');
case 'startOdometer':
- return formatDistance(item[key], distanceUnit, t);
+ return formatDistance(value, distanceUnit, t);
case 'duration':
- return formatNumericHours(item[key], t);
+ return formatNumericHours(value, t);
case 'engineHours':
- return formatNumericHours(item[key], t);
+ return value > 0 ? formatNumericHours(value, t) : null;
case 'spentFuel':
- return formatVolume(item[key], volumeUnit, t);
+ return value > 0 ? formatVolume(value, volumeUnit, t) : null;
case 'address':
- return (<AddressValue latitude={item.latitude} longitude={item.longitude} originalAddress={item[key]} />);
+ return (<AddressValue latitude={item.latitude} longitude={item.longitude} originalAddress={value} />);
default:
- return item[key];
+ return value;
}
};
@@ -129,7 +129,7 @@ const StopReportPage = () => {
)}
<div className={classes.containerMain}>
<div className={classes.header}>
- <ReportFilter handleSubmit={handleSubmit} handleSchedule={handleSchedule}>
+ <ReportFilter handleSubmit={handleSubmit} handleSchedule={handleSchedule} loading={loading}>
<ColumnSelect columns={columns} setColumns={setColumns} columnsArray={columnsArray} />
</ReportFilter>
</div>