import { SyncOutlined } from "@ant-design/icons"; import { Button, Card, Input, Space, Table, Typography } from "antd"; import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link, useHistory, useLocation } from "react-router-dom"; import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component"; import {pageLimit} from "../../utils/config"; export default function VehiclesListComponent({ loading, vehicles, total, refetch, }) { const search = queryString.parse(useLocation().search); const { page, //sortcolumn, sortorder, } = search; const history = useHistory(); const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" }, }); const { t } = useTranslation(); const columns = [ { title: t("vehicles.fields.v_vin"), dataIndex: "v_vin", key: "v_vin", render: (text, record) => ( {record.v_vin || "N/A"} ), }, { title: t("vehicles.fields.description"), dataIndex: "description", key: "description", render: (text, record) => { return ( {`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${ record.v_model_desc || "" } ${record.v_color || ""}`} ); }, }, { title: t("vehicles.fields.plate_no"), dataIndex: "plate", key: "plate", render: (text, record) => { return ( {`${record.plate_st || ""} | ${record.plate_no || ""}`} ); }, }, ]; const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); search.page = pagination.current; search.sortcolumn = sorter.columnKey; search.sortorder = sorter.order; history.push({ search: queryString.stringify(search) }); }; return ( {search.search && ( <> {t("general.labels.searchresults", { search: search.search })} )} { search.search = value; history.push({ search: queryString.stringify(search) }); }} enterButton /> } > ); }