From 05a0ee30f4443f8dbab4b5b3ed81d98629525260 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 13 Jul 2022 13:50:13 -0700 Subject: [PATCH] IO-1972 add table for converted parts to labor lines. --- bodyshop_translations.babel | 21 ++++ .../labor-allocations-table.component.jsx | 115 +++++++++++++++--- client/src/graphql/jobs-lines.queries.js | 1 + client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 6 files changed, 126 insertions(+), 14 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index df2b5f8be..f2c3b671a 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -26551,6 +26551,27 @@ + + convertedtolabor + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + cost false diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx index cecc22795..9ba78c922 100644 --- a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx +++ b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx @@ -1,6 +1,6 @@ import { EditFilled } from "@ant-design/icons"; -import { Card, Space, Table } from "antd"; -import React, { useEffect, useState } from "react"; +import { Card, Space, Table, Row, Col } from "antd"; +import React, { useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -11,6 +11,8 @@ import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit import "./labor-allocations-table.styles.scss"; import { CalculateAllocationsTotals } from "./labor-allocations-table.utility"; import _ from "lodash"; +import CurrencyFormatter from "../../utils/CurrencyFormatter"; + const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, technician: selectTechnician, @@ -43,6 +45,11 @@ export function LaborAllocationsTable({ if (!jobId) setTotals([]); }, [joblines, timetickets, bodyshop, adjustments, jobId]); + const convertedLines = useMemo( + () => joblines && joblines.filter((j) => j.convertedtolbr), + [joblines] + ); + const columns = [ { title: t("timetickets.fields.cost_center"), @@ -114,24 +121,104 @@ export function LaborAllocationsTable({ ), }, ]; + const convertedTableCols = [ + { + title: t("joblines.fields.line_desc"), + dataIndex: "line_desc", + key: "line_desc", + ellipsis: true, + }, + { + title: t("joblines.fields.op_code_desc"), + dataIndex: "op_code_desc", + key: "op_code_desc", + ellipsis: true, + render: (text, record) => + `${record.op_code_desc || ""}${ + record.alt_partm ? ` ${record.alt_partm}` : "" + }`, + }, + + { + title: t("joblines.fields.act_price"), + dataIndex: "act_price", + key: "act_price", + ellipsis: true, + render: (text, record) => ( + <> + + {record.db_ref === "900510" || record.db_ref === "900511" + ? record.prt_dsmk_m + : record.act_price} + + {record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? ( + {`(${record.prt_dsmk_p}%)`} + ) : ( + <> + )} + + ), + }, + { + title: t("joblines.fields.part_qty"), + dataIndex: "part_qty", + key: "part_qty", + }, + + { + title: t("joblines.fields.mod_lbr_ty"), + dataIndex: "mod_lbr_ty", + key: "mod_lbr_ty", + render: (text, record) => + record.mod_lbr_ty + ? t(`joblines.fields.lbr_types.${record.mod_lbr_ty}`) + : null, + }, + { + title: t("joblines.fields.mod_lb_hrs"), + dataIndex: "mod_lb_hrs", + key: "mod_lb_hrs", + }, + ]; const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; return ( - - - + + + +
+ + + {convertedLines && convertedLines.length > 0 && ( + + +
+ + + )} + ); } export default connect(mapStateToProps, null)(LaborAllocationsTable); diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js index 0c0b4228d..5ac7f30c5 100644 --- a/client/src/graphql/jobs-lines.queries.js +++ b/client/src/graphql/jobs-lines.queries.js @@ -48,6 +48,7 @@ export const GET_LINE_TICKET_BY_PK = gql` lbr_op lbr_amt op_code_desc + convertedtolbr } timetickets(where: { jobid: { _eq: $id } }) { actualhrs diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 12cf52836..95a6d0ea1 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1570,6 +1570,7 @@ "closeconfirm": "Are you sure you want to close this job? This cannot be easily undone.", "closejob": "Close Job {{ro_number}}", "contracts": "CC Contracts", + "convertedtolabor": "Lines Converted to Labor", "cost": "Cost", "cost_Additional": "Cost - Additional", "cost_labor": "Cost - Labor", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index ca23c77a3..402e26e56 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1570,6 +1570,7 @@ "closeconfirm": "", "closejob": "", "contracts": "", + "convertedtolabor": "", "cost": "", "cost_Additional": "", "cost_labor": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 7f5176898..eb6800fb5 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1570,6 +1570,7 @@ "closeconfirm": "", "closejob": "", "contracts": "", + "convertedtolabor": "", "cost": "", "cost_Additional": "", "cost_labor": "",