Merge remote-tracking branch 'origin/release/2024-03-01' into feature/IO-1828-Front-End-Package-Updates
# Conflicts: # _reference/reportFiltersAndSorters.md # client/src/components/bill-delete-button/bill-delete-button.component.jsx # client/src/components/bills-list-table/bills-list-table.component.jsx # client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx # client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx # client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx # client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx # client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx # client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx # client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx # client/src/pages/dms/dms.container.jsx # client/src/redux/application/application.sagas.js # client/src/translations/en_us/common.json # client/src/translations/es/common.json # client/src/translations/fr/common.json # client/src/utils/AuditTrailMappings.js # client/src/utils/graphQLmodifier.js # package-lock.json # package.json
This commit is contained in:
@@ -1,22 +1,35 @@
|
||||
import {SyncOutlined, WarningFilled} from "@ant-design/icons";
|
||||
import {Button, Card, Dropdown, Input, Space, Table, Tooltip,} from "antd";
|
||||
import { SyncOutlined, WarningFilled } from "@ant-design/icons";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Dropdown,
|
||||
Input,
|
||||
Menu,
|
||||
Space,
|
||||
Table,
|
||||
Tooltip,
|
||||
} from "antd";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, {useState} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Link} from "react-router-dom";
|
||||
import {DateTimeFormatter} from "../../utils/DateFormatter";
|
||||
import {GenerateDocument} from "../../utils/RenderTemplate";
|
||||
import {TemplateList} from "../../utils/TemplateConstants";
|
||||
import {alphaSort} from "../../utils/sorters";
|
||||
import {OwnerNameDisplayFunction} from "../owner-name-display/owner-name-display.component";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import useLocalStorage from "../../utils/useLocalStorage";
|
||||
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||
|
||||
export default function CourtesyCarsList({loading, courtesycars, refetch}) {
|
||||
export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: {text: ""},
|
||||
});
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const {t} = useTranslation();
|
||||
const [filter, setFilter] = useLocalStorage(
|
||||
"filter_courtesy_cars_list",
|
||||
null
|
||||
);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@@ -42,6 +55,7 @@ export default function CourtesyCarsList({loading, courtesycars, refetch}) {
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||
filteredValue: filter?.status || null,
|
||||
filters: [
|
||||
{
|
||||
text: t("courtesycars.status.in"),
|
||||
@@ -64,7 +78,7 @@ export default function CourtesyCarsList({loading, courtesycars, refetch}) {
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||
render: (text, record) => {
|
||||
const {nextservicedate, nextservicekm, mileage, insuranceexpires} =
|
||||
const { nextservicedate, nextservicekm, mileage, insuranceexpires } =
|
||||
record;
|
||||
|
||||
const mileageOver = nextservicekm ? nextservicekm <= mileage : false;
|
||||
@@ -75,19 +89,23 @@ export default function CourtesyCarsList({loading, courtesycars, refetch}) {
|
||||
const insuranceOver =
|
||||
insuranceexpires &&
|
||||
dayjs(insuranceexpires).endOf("day").isBefore(dayjs());
|
||||
|
||||
return (
|
||||
<Space>
|
||||
{t(record.status)}
|
||||
{(mileageOver || dueForService || insuranceOver) && (
|
||||
<Tooltip title={(mileageOver || dueForService) && insuranceOver
|
||||
? t("contracts.labels.insuranceexpired") +
|
||||
" / " +
|
||||
t("contracts.labels.cardueforservice")
|
||||
: insuranceOver
|
||||
? t("contracts.labels.insuranceexpired")
|
||||
: t("contracts.labels.cardueforservice")
|
||||
}>
|
||||
<WarningFilled style={{color: "tomato"}}/>
|
||||
<Tooltip
|
||||
title={
|
||||
(mileageOver || dueForService) && insuranceOver
|
||||
? t("contracts.labels.insuranceexpired") +
|
||||
" / " +
|
||||
t("contracts.labels.cardueforservice")
|
||||
: insuranceOver
|
||||
? t("contracts.labels.insuranceexpired")
|
||||
: t("contracts.labels.cardueforservice")
|
||||
}
|
||||
>
|
||||
<WarningFilled style={{ color: "tomato" }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
</Space>
|
||||
@@ -99,6 +117,7 @@ export default function CourtesyCarsList({loading, courtesycars, refetch}) {
|
||||
dataIndex: "readiness",
|
||||
key: "readiness",
|
||||
sorter: (a, b) => alphaSort(a.readiness, b.readiness),
|
||||
filteredValue: filter?.readiness || null,
|
||||
filters: [
|
||||
{
|
||||
text: t("courtesycars.readiness.ready"),
|
||||
@@ -214,7 +233,8 @@ export default function CourtesyCarsList({loading, courtesycars, refetch}) {
|
||||
];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({...state, filteredInfo: filters, sortedInfo: sorter});
|
||||
setState({ ...state, sortedInfo: sorter });
|
||||
setFilter(filters);
|
||||
};
|
||||
|
||||
const tableData = searchText
|
||||
|
||||
Reference in New Issue
Block a user