diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 861135c34..319a8d546 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -462,6 +462,121 @@ + + joblines + + + fields + + + act_price + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + db_price + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + line_desc + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + part_type + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + unq_seq + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + jobs diff --git a/client/src/components/job-lines/job-lines.component.jsx b/client/src/components/job-lines/job-lines.component.jsx index 7b1f6cca8..fedc980ed 100644 --- a/client/src/components/job-lines/job-lines.component.jsx +++ b/client/src/components/job-lines/job-lines.component.jsx @@ -1,33 +1,69 @@ import React, { useState } from "react"; import { Table } from "antd"; import { alphaSort } from "../../utils/sorters"; +import { useTranslation } from "react-i18next"; +import CurrencyFormatter from "../../utils/CurrencyFormatter"; -export default function JobLinesComponent({ loading, joblines }) { +export default function JobLinesComponent({ job }) { const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" } }); + const { t } = useTranslation(); const columns = [ { - title: "Line #", - dataIndex: "line_ind", - key: "line_ind", + title: t("joblines.fields.unq_seq"), + dataIndex: "unq_seq", + key: "unq_seq", // onFilter: (value, record) => record.ro_number.includes(value), // filteredValue: state.filteredInfo.text || null, sorter: (a, b) => alphaSort(a, b), sortOrder: - state.sortedInfo.columnKey === "line_ind" && state.sortedInfo.order, - ellipsis: true + state.sortedInfo.columnKey === "unq_seq" && state.sortedInfo.order + //ellipsis: true }, { - title: "Description", + title: t("joblines.fields.line_desc"), dataIndex: "line_desc", key: "line_desc", - sorter: (a, b) => alphaSort(a, b), + sorter: (a, b) => alphaSort(a.line_desc, b.line_desc), sortOrder: state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order, ellipsis: true + }, + { + title: t("joblines.fields.part_type"), + dataIndex: "part_type", + key: "part_type", + sorter: (a, b) => alphaSort(a.part_type, b.part_type), + sortOrder: + state.sortedInfo.columnKey === "part_type" && state.sortedInfo.order, + ellipsis: true + }, + { + title: t("joblines.fields.db_price"), + dataIndex: "db_price", + key: "db_price", + sorter: (a, b) => a.db_price - b.db_price, + sortOrder: + state.sortedInfo.columnKey === "db_price" && state.sortedInfo.order, + ellipsis: true, + render: (text, record) => ( + {record.db_price} + ) + }, + { + title: t("joblines.fields.act_price"), + dataIndex: "act_price", + key: "act_price", + sorter: (a, b) => a.act_price - b.act_price, + sortOrder: + state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order, + ellipsis: true, + render: (text, record) => ( + {record.act_price} + ) } ]; @@ -39,14 +75,13 @@ export default function JobLinesComponent({ loading, joblines }) { // const { value } = event.target; // setState({ ...state, filterinfo: { text: [value] } }); // }; - return ( ({ ...item }))} rowKey='id' - dataSource={joblines} + dataSource={job.joblines} onChange={handleTableChange} /> ); diff --git a/client/src/components/job-lines/job-lines.container.component.jsx b/client/src/components/job-lines/job-lines.container.jsx similarity index 89% rename from client/src/components/job-lines/job-lines.container.component.jsx rename to client/src/components/job-lines/job-lines.container.jsx index 70e74c7c5..cf59100b2 100644 --- a/client/src/components/job-lines/job-lines.container.component.jsx +++ b/client/src/components/job-lines/job-lines.container.jsx @@ -1,7 +1,7 @@ import React from "react"; import JobLinesComponent from "./job-lines.component"; import { useQuery } from "@apollo/react-hooks"; -import AlertComponent from "../../components/alert/alert.component"; +import AlertComponent from "../alert/alert.component"; import { GET_JOB_LINES_BY_PK } from "../../graphql/jobs-lines.queries"; @@ -16,3 +16,4 @@ export default function JobLinesContainer({ jobId }) { ); } + \ No newline at end of file diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 5bffe873d..f90290794 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -159,6 +159,23 @@ export const GET_JOB_BY_PK = gql` ownr_fn ownr_ln } + + joblines{ + id + unq_seq + line_ind + line_desc + part_type + oem_partno + db_price + act_price + part_qty + mod_lbr_ty + db_hrs + mod_lb_hrs + lbr_op + lbr_amt + } } } `; diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 7f7c27aa7..d2a44a7ce 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -7,7 +7,8 @@ import { FaRegStickyNote, FaShieldAlt } from "react-icons/fa"; -import JobLinesContainer from "../../components/job-lines/job-lines.container.component"; +//import JobLinesContainer from "../../components/job-lines/job-lines.container"; +import JobsLines from '../../components/job-lines/job-lines.component' import JobsDetailClaims from "../../components/jobs-detail-claims/jobs-detail-claims.component"; import JobsDetailFinancials from "../../components/jobs-detail-financial/jobs-detail-financial.component"; import JobsDetailHeader from "../../components/jobs-detail-header/jobs-detail-header.component"; @@ -94,7 +95,7 @@ export default function JobsDetailPage({ } key="repairdata" > - +