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 bbb09178c..90dc234d3 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,12 +1,13 @@ import { EditFilled } from "@ant-design/icons"; import { Card, Col, Row, Space, Table } from "antd"; import _ from "lodash"; -import React, { useEffect, useState } from "react"; +import React, { useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectTechnician } from "../../redux/tech/tech.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { alphaSort } from "../../utils/sorters"; import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component"; import "./labor-allocations-table.styles.scss"; @@ -44,10 +45,14 @@ export function LaborAllocationsTable({ if (!jobId) setTotals([]); }, [joblines, timetickets, bodyshop, adjustments, jobId]); - // const convertedLines = useMemo( - // () => joblines && joblines.filter((j) => j.convertedtolbr), - // [joblines] - // ); + const convertedLines = useMemo( + () => joblines && joblines.filter((j) => j.convertedtolbr), + [joblines] + ); + console.log( + "🚀 ~ file: labor-allocations-table.component.jsx ~ line 52 ~ convertedLines", + convertedLines + ); const columns = [ { @@ -120,52 +125,68 @@ 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}` : "" - // }`, - // }, + 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.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: "conv_mod_lbr_ty", + key: "conv_mod_lbr_ty", + render: (text, record) => + record.convertedtolbr_data && record.convertedtolbr_data.mod_lbr_ty, + }, + { + title: t("joblines.fields.mod_lb_hrs"), + dataIndex: "conv_mod_lb_hrs", + key: "conv_mod_lb_hrs", + render: (text, record) => + record.convertedtolbr_data && + record.convertedtolbr_data.mod_lb_hrs && + record.convertedtolbr_data.mod_lb_hrs.toFixed(1), + }, + ]; const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); @@ -187,23 +208,21 @@ export function LaborAllocationsTable({ /> - { - // convertedLines && convertedLines.length > 0 && ( - // - // - // - // - // - // ) - } + {convertedLines && convertedLines.length > 0 && ( + + +
+ + + )} ); } diff --git a/client/src/components/vehicle-vin-display/vehicle-vin-display.component.jsx b/client/src/components/vehicle-vin-display/vehicle-vin-display.component.jsx index 1ba46b8b5..cef554562 100644 --- a/client/src/components/vehicle-vin-display/vehicle-vin-display.component.jsx +++ b/client/src/components/vehicle-vin-display/vehicle-vin-display.component.jsx @@ -2,7 +2,7 @@ import React from "react"; export default function VehicleVinDisplay({ children }) { if (!children) return null; - console.log(children); + if (typeof children !== "string" || children.length !== 17) return children; const vin = children.trim(); diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js index 906498299..dfcf3b1c8 100644 --- a/client/src/graphql/jobs-lines.queries.js +++ b/client/src/graphql/jobs-lines.queries.js @@ -49,6 +49,7 @@ export const GET_LINE_TICKET_BY_PK = gql` lbr_amt op_code_desc convertedtolbr + convertedtolbr_data } timetickets(where: { jobid: { _eq: $id } }) { actualhrs