From 4fb9c37c0d91644f52c6078fb8136caa537f4f59 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Mon, 22 Apr 2024 09:15:59 -0700 Subject: [PATCH] IO-2761 Actual Completion in Vehicle and Owners Job Details lists Signed-off-by: Allan Carr --- .../owner-detail-jobs.component.jsx | 16 ++++++++++++++-- .../vehicle-detail-jobs.component.jsx | 16 ++++++++++++++-- client/src/graphql/owners.queries.js | 1 + client/src/graphql/vehicles.queries.js | 1 + 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx b/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx index d47be4d1f..d62d849a1 100644 --- a/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx +++ b/client/src/components/owner-detail-jobs/owner-detail-jobs.component.jsx @@ -6,7 +6,8 @@ import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; -import { alphaSort, statusSort } from "../../utils/sorters"; +import { DateTimeFormatter } from "../../utils/DateFormatter"; +import { alphaSort, dateSort, statusSort } from "../../utils/sorters"; import OwnerDetailUpdateJobsComponent from "../owner-detail-update-jobs/owner-detail-update-jobs.component"; const mapStateToProps = createStructuredSelector({ @@ -86,7 +87,18 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) { })), onFilter: (value, record) => value.includes(record.status), }, - + { + title: t("jobs.fields.actual_completion"), + dataIndex: "actual_completion", + key: "actual_completion", + render: (text, record) => ( + {record.actual_completion} + ), + sorter: (a, b) => dateSort(a.actual_completion, b.actual_completion), + sortOrder: + state.sortedInfo.columnKey === "actual_completion" && + state.sortedInfo.order, + }, { title: t("jobs.fields.clm_total"), dataIndex: "clm_total", diff --git a/client/src/components/vehicle-detail-jobs/vehicle-detail-jobs.component.jsx b/client/src/components/vehicle-detail-jobs/vehicle-detail-jobs.component.jsx index 370142a2a..98be8d233 100644 --- a/client/src/components/vehicle-detail-jobs/vehicle-detail-jobs.component.jsx +++ b/client/src/components/vehicle-detail-jobs/vehicle-detail-jobs.component.jsx @@ -6,7 +6,8 @@ import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; -import { alphaSort, statusSort } from "../../utils/sorters"; +import { DateTimeFormatter } from "../../utils/DateFormatter"; +import { alphaSort, dateSort, statusSort } from "../../utils/sorters"; import OwnerNameDisplay, { OwnerNameDisplayFunction, } from "../owner-name-display/owner-name-display.component"; @@ -79,7 +80,18 @@ export function VehicleDetailJobsComponent({ vehicle, bodyshop }) { })), onFilter: (value, record) => value.includes(record.status), }, - + { + title: t("jobs.fields.actual_completion"), + dataIndex: "actual_completion", + key: "actual_completion", + render: (text, record) => ( + {record.actual_completion} + ), + sorter: (a, b) => dateSort(a.actual_completion, b.actual_completion), + sortOrder: + state.sortedInfo.columnKey === "actual_completion" && + state.sortedInfo.order, + }, { title: t("jobs.fields.clm_total"), dataIndex: "clm_total", diff --git a/client/src/graphql/owners.queries.js b/client/src/graphql/owners.queries.js index ea0062cd5..aba6d2dfa 100644 --- a/client/src/graphql/owners.queries.js +++ b/client/src/graphql/owners.queries.js @@ -71,6 +71,7 @@ export const QUERY_OWNER_BY_ID = gql` tax_number jobs(order_by: { date_open: desc }) { id + actual_completion ro_number clm_no status diff --git a/client/src/graphql/vehicles.queries.js b/client/src/graphql/vehicles.queries.js index 1daccc7f5..930af12e5 100644 --- a/client/src/graphql/vehicles.queries.js +++ b/client/src/graphql/vehicles.queries.js @@ -30,6 +30,7 @@ export const QUERY_VEHICLE_BY_ID = gql` notes jobs(order_by: { date_open: desc }) { id + actual_completion ro_number ownr_co_nm ownr_fn