From b738fc9007b0d1ca0abaaead7c37b12fb1247d2f Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 7 Apr 2022 10:56:02 -0700 Subject: [PATCH] IO-1751 Add parts order data to repair data screen. --- bodyshop_translations.babel | 21 ++++++++ .../job-lines-expander.component.jsx | 54 +++++++++++++++++++ .../job-detail-lines/job-lines.component.jsx | 16 ++++++ client/src/graphql/jobs.queries.js | 40 ++++++++------ client/src/translations/en_us/common.json | 3 +- client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 7 files changed, 118 insertions(+), 18 deletions(-) create mode 100644 client/src/components/job-detail-lines/job-lines-expander.component.jsx diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index ff279e491..95881f674 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -32672,6 +32672,27 @@ + + notyetordered + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + oec false diff --git a/client/src/components/job-detail-lines/job-lines-expander.component.jsx b/client/src/components/job-detail-lines/job-lines-expander.component.jsx new file mode 100644 index 000000000..b875a61b1 --- /dev/null +++ b/client/src/components/job-detail-lines/job-lines-expander.component.jsx @@ -0,0 +1,54 @@ +import { useQuery } from "@apollo/client"; +import { Row, Col, Timeline, Typography, Space, Divider, Skeleton } from "antd"; +import React from "react"; +import { GET_JOB_LINE_ORDERS } from "../../graphql/jobs.queries"; +import { useTranslation } from "react-i18next"; +import AlertComponent from "../alert/alert.component"; +import { DateFormatter } from "../../utils/DateFormatter"; +import { Link } from "react-router-dom"; + +export default function JobLinesExpander({ jobline, jobid }) { + const { t } = useTranslation(); + const { loading, error, data } = useQuery(GET_JOB_LINE_ORDERS, { + fetchPolicy: "network-only", + nextFetchPolicy: "network-only", + variables: { + joblineid: jobline.id, + }, + }); + + if (loading) return ; + if (error) return ; + + return ( + + + + {t("parts_orders.labels.parts_orders")} + + + {data.parts_order_lines.length > 0 ? ( + data.parts_order_lines.map((line) => ( + + } wrap> + + {line.parts_order.order_number} + + {line.parts_order.order_date} + {line.parts_order.vendor.name} + + + )) + ) : ( + + {t("parts_orders.labels.notyetordered")} + + )} + + + + + ); +} diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index e00fa21c3..f811752df 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -4,6 +4,8 @@ import { SyncOutlined, WarningFilled, EditFilled, + PlusCircleTwoTone, + MinusCircleTwoTone, } from "@ant-design/icons"; import { useMutation } from "@apollo/client"; import { @@ -38,6 +40,7 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container"; import _ from "lodash"; import JobCreateIOU from "../job-create-iou/job-create-iou.component"; +import JobLinesExpander from "./job-lines-expander.component"; const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser @@ -449,6 +452,19 @@ export function JobLinesComponent({ scroll={{ x: true, }} + expandable={{ + expandedRowRender: (record) => ( + + ), + rowExpandable: (record) => true, + expandRowByClick: true, + expandIcon: ({ expanded, onExpand, record }) => + expanded ? ( + onExpand(record, e)} /> + ) : ( + onExpand(record, e)} /> + ), + }} onRow={(record, rowIndex) => { return { onDoubleClick: (event) => { diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index aabb3670a..201e3aebf 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -146,7 +146,7 @@ export const QUERY_EXACT_JOB_IN_PRODUCTION = gql` employee_refinish employee_prep employee_csr - joblines_status{ + joblines_status { part_type status count @@ -224,7 +224,7 @@ export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql` employee_refinish employee_prep employee_csr - joblines_status{ + joblines_status { part_type status count @@ -304,7 +304,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql` employee_prep employee_csr suspended - joblines_status{ + joblines_status { part_type status count @@ -721,20 +721,6 @@ export const GET_JOB_BY_PK = gql` } } } - parts_order_lines { - id - parts_order { - id - order_number - comments - order_date - user_email - vendor { - id - name - } - } - } } payments { id @@ -2114,3 +2100,23 @@ export const DELETE_RELATED_RO = gql` } } `; +export const GET_JOB_LINE_ORDERS = gql` + query GET_JOB_LINE_ORDERS($joblineid: uuid!) { + parts_order_lines(where: { job_line_id: { _eq: $joblineid } }) { + id + act_price + parts_order { + id + order_date + order_number + orderedby + return + comments + vendor { + id + name + } + } + } + } +`; diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index e6f49071f..f0c9291f1 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1082,7 +1082,7 @@ "mod_lbr_ty": "Labor Type", "notes": "Notes", "oem_partno": "OEM Part #", - "op_code_desc": "Operation Code Description", + "op_code_desc": "Op Code Description", "part_qty": "Qty.", "part_type": "Part Type", "part_types": { @@ -1939,6 +1939,7 @@ "email": "Send by Email", "inthisorder": "Parts in this Order", "newpartsorder": "New Parts Order", + "notyetordered": "This part has not yet been ordered.", "oec": "Order via OEC", "orderhistory": "Order History", "parts_orders": "Parts Orders", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index b42cc800b..e35b9f209 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1939,6 +1939,7 @@ "email": "Enviar por correo electrónico", "inthisorder": "Partes en este pedido", "newpartsorder": "", + "notyetordered": "", "oec": "", "orderhistory": "Historial de pedidos", "parts_orders": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index d5646f9a4..3f5a196bd 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1939,6 +1939,7 @@ "email": "Envoyé par email", "inthisorder": "Pièces dans cette commande", "newpartsorder": "", + "notyetordered": "", "oec": "", "orderhistory": "Historique des commandes", "parts_orders": "",