import React, { useState } from "react"; import MainToolbar from "../MainToolbar"; import { Grid, TableContainer, Table, TableRow, TableCell, TableHead, TableBody, Paper, makeStyles, } from "@material-ui/core"; import t from "../common/localization"; import { formatPosition } from "../common/formatter"; import ReportFilter from "./ReportFilter"; const useStyles = makeStyles((theme) => ({ root: { height: "100%", display: "flex", flexDirection: "column", }, content: { flex: 1, overflow: "auto", padding: theme.spacing(2), }, form: { padding: theme.spacing(1, 2, 2), }, })); const EventReportPage = () => { const classes = useStyles(); const [data, setData] = useState([]); const handleSubmit = (deviceId, from, to) => { const query = new URLSearchParams({ deviceId, from: from.toISOString(), to: to.toISOString(), }); fetch(`/api/reports/events?${query.toString()}`, { headers: { Accept: "application/json" }, }).then((response) => { if (response.ok) { response.json().then(setData); } }); }; return (
{t("positionFixTime")} {t("sharedType")} {t("sharedGeofence")} {t("sharedMaintenance")} {data.map((item) => ( {formatPosition(item, "serverTime")} {item.type} {} {} ))}
); }; export default EventReportPage;