IO-1972 Add tracking for conversions to labor.
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
import { EditFilled } from "@ant-design/icons";
|
import { EditFilled } from "@ant-design/icons";
|
||||||
import { Card, Col, Row, Space, Table } from "antd";
|
import { Card, Col, Row, Space, Table } from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component";
|
import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component";
|
||||||
import "./labor-allocations-table.styles.scss";
|
import "./labor-allocations-table.styles.scss";
|
||||||
@@ -44,10 +45,14 @@ export function LaborAllocationsTable({
|
|||||||
if (!jobId) setTotals([]);
|
if (!jobId) setTotals([]);
|
||||||
}, [joblines, timetickets, bodyshop, adjustments, jobId]);
|
}, [joblines, timetickets, bodyshop, adjustments, jobId]);
|
||||||
|
|
||||||
// const convertedLines = useMemo(
|
const convertedLines = useMemo(
|
||||||
// () => joblines && joblines.filter((j) => j.convertedtolbr),
|
() => joblines && joblines.filter((j) => j.convertedtolbr),
|
||||||
// [joblines]
|
[joblines]
|
||||||
// );
|
);
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: labor-allocations-table.component.jsx ~ line 52 ~ convertedLines",
|
||||||
|
convertedLines
|
||||||
|
);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
@@ -120,52 +125,68 @@ export function LaborAllocationsTable({
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
// const convertedTableCols = [
|
const convertedTableCols = [
|
||||||
// {
|
{
|
||||||
// title: t("joblines.fields.line_desc"),
|
title: t("joblines.fields.line_desc"),
|
||||||
// dataIndex: "line_desc",
|
dataIndex: "line_desc",
|
||||||
// key: "line_desc",
|
key: "line_desc",
|
||||||
// ellipsis: true,
|
ellipsis: true,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// title: t("joblines.fields.op_code_desc"),
|
title: t("joblines.fields.op_code_desc"),
|
||||||
// dataIndex: "op_code_desc",
|
dataIndex: "op_code_desc",
|
||||||
// key: "op_code_desc",
|
key: "op_code_desc",
|
||||||
// ellipsis: true,
|
ellipsis: true,
|
||||||
// render: (text, record) =>
|
render: (text, record) =>
|
||||||
// `${record.op_code_desc || ""}${
|
`${record.op_code_desc || ""}${
|
||||||
// record.alt_partm ? ` ${record.alt_partm}` : ""
|
record.alt_partm ? ` ${record.alt_partm}` : ""
|
||||||
// }`,
|
}`,
|
||||||
// },
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// title: t("joblines.fields.act_price"),
|
title: t("joblines.fields.act_price"),
|
||||||
// dataIndex: "act_price",
|
dataIndex: "act_price",
|
||||||
// key: "act_price",
|
key: "act_price",
|
||||||
// ellipsis: true,
|
ellipsis: true,
|
||||||
// render: (text, record) => (
|
render: (text, record) => (
|
||||||
// <>
|
<>
|
||||||
// <CurrencyFormatter>
|
<CurrencyFormatter>
|
||||||
// {record.db_ref === "900510" || record.db_ref === "900511"
|
{record.db_ref === "900510" || record.db_ref === "900511"
|
||||||
// ? record.prt_dsmk_m
|
? record.prt_dsmk_m
|
||||||
// : record.act_price}
|
: record.act_price}
|
||||||
// </CurrencyFormatter>
|
</CurrencyFormatter>
|
||||||
// {record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? (
|
{record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? (
|
||||||
// <span
|
<span
|
||||||
// style={{ marginLeft: ".2rem" }}
|
style={{ marginLeft: ".2rem" }}
|
||||||
// >{`(${record.prt_dsmk_p}%)`}</span>
|
>{`(${record.prt_dsmk_p}%)`}</span>
|
||||||
// ) : (
|
) : (
|
||||||
// <></>
|
<></>
|
||||||
// )}
|
)}
|
||||||
// </>
|
</>
|
||||||
// ),
|
),
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// title: t("joblines.fields.part_qty"),
|
title: t("joblines.fields.part_qty"),
|
||||||
// dataIndex: "part_qty",
|
dataIndex: "part_qty",
|
||||||
// key: "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) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||||
@@ -187,23 +208,21 @@ export function LaborAllocationsTable({
|
|||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
{
|
{convertedLines && convertedLines.length > 0 && (
|
||||||
// convertedLines && convertedLines.length > 0 && (
|
<Col span={24}>
|
||||||
// <Col span={24}>
|
<Card title={t("jobs.labels.convertedtolabor")}>
|
||||||
// <Card title={t("jobs.labels.convertedtolabor")}>
|
<Table
|
||||||
// <Table
|
columns={convertedTableCols}
|
||||||
// columns={convertedTableCols}
|
rowKey="id"
|
||||||
// rowKey="id"
|
pagination={false}
|
||||||
// pagination={false}
|
dataSource={convertedLines}
|
||||||
// dataSource={convertedLines}
|
scroll={{
|
||||||
// scroll={{
|
x: true,
|
||||||
// x: true,
|
}}
|
||||||
// }}
|
/>
|
||||||
// />
|
</Card>
|
||||||
// </Card>
|
</Col>
|
||||||
// </Col>
|
)}
|
||||||
// )
|
|
||||||
}
|
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from "react";
|
|||||||
|
|
||||||
export default function VehicleVinDisplay({ children }) {
|
export default function VehicleVinDisplay({ children }) {
|
||||||
if (!children) return null;
|
if (!children) return null;
|
||||||
console.log(children);
|
|
||||||
if (typeof children !== "string" || children.length !== 17) return children;
|
if (typeof children !== "string" || children.length !== 17) return children;
|
||||||
const vin = children.trim();
|
const vin = children.trim();
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export const GET_LINE_TICKET_BY_PK = gql`
|
|||||||
lbr_amt
|
lbr_amt
|
||||||
op_code_desc
|
op_code_desc
|
||||||
convertedtolbr
|
convertedtolbr
|
||||||
|
convertedtolbr_data
|
||||||
}
|
}
|
||||||
timetickets(where: { jobid: { _eq: $id } }) {
|
timetickets(where: { jobid: { _eq: $id } }) {
|
||||||
actualhrs
|
actualhrs
|
||||||
|
|||||||
Reference in New Issue
Block a user