Revert changes for IO-1972.

This commit is contained in:
Patrick Fic
2022-07-15 15:31:16 -07:00
parent 27ce30527e
commit 7cf32775eb
2 changed files with 71 additions and 84 deletions

View File

@@ -249,6 +249,7 @@ export function ScheduleEventComponent({
const RegularEvent = event.isintake ? ( const RegularEvent = event.isintake ? (
<Space <Space
wrap wrap
size='small'
style={{ style={{
backgroundColor: backgroundColor:
event.color && event.color.hex ? event.color.hex : event.color, event.color && event.color.hex ? event.color.hex : event.color,

View File

@@ -1,17 +1,16 @@
import { EditFilled } from "@ant-design/icons"; import { EditFilled } from "@ant-design/icons";
import { Card, Space, Table, Row, Col } from "antd"; import { Card, Col, Row, Space, Table } from "antd";
import React, { useEffect, useMemo, useState } from "react"; import _ from "lodash";
import React, { useEffect, 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 { selectBodyshop } from "../../redux/user/user.selectors";
import { selectTechnician } from "../../redux/tech/tech.selectors"; import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
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";
import { CalculateAllocationsTotals } from "./labor-allocations-table.utility"; import { CalculateAllocationsTotals } from "./labor-allocations-table.utility";
import _ from "lodash";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
@@ -45,10 +44,10 @@ 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]
); // );
const columns = [ const columns = [
{ {
@@ -121,67 +120,52 @@ 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: "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) => { const handleTableChange = (pagination, filters, sorter) => {
setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
@@ -203,21 +187,23 @@ export function LaborAllocationsTable({
/> />
</Card> </Card>
</Col> </Col>
{convertedLines && convertedLines.length > 0 && ( {
<Col span={24}> // convertedLines && convertedLines.length > 0 && (
<Card title={t("jobs.labels.convertedtolabor")}> // <Col span={24}>
<Table // <Card title={t("jobs.labels.convertedtolabor")}>
columns={convertedTableCols} // <Table
rowKey="id" // columns={convertedTableCols}
pagination={false} // rowKey="id"
dataSource={convertedLines} // pagination={false}
scroll={{ // dataSource={convertedLines}
x: true, // scroll={{
}} // x: true,
/> // }}
</Card> // />
</Col> // </Card>
)} // </Col>
// )
}
</Row> </Row>
); );
} }