From 22dfcc215ebf84ec71ebab8de11cec95ba364ddf Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 9 Feb 2022 15:51:19 -0800 Subject: [PATCH] IO-1718 Add part type to OEC. --- bodyshop_translations.babel | 21 ++++++++ .../bill-detail-edit.container.jsx | 2 + .../bills-list-table.component.jsx | 1 + .../parts-order-list-table.component.jsx | 9 ++++ .../parts-order-modal.component.jsx | 50 ++++++++++++++++++- .../parts-order-modal.container.jsx | 13 ++--- client/src/graphql/bills.queries.js | 9 ++++ client/src/graphql/parts-orders.queries.js | 1 + client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 11 files changed, 102 insertions(+), 7 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 8948c8daf..939e5bb18 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -32127,6 +32127,27 @@ + + part_type + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + quantity false diff --git a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx index b8ac4e8cb..b3fc0504a 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx @@ -207,6 +207,8 @@ export function BillDetailEditcontainer({ cost: i.actual_cost, quantity: i.quantity, joblineid: i.joblineid, + oem_partno: i.jobline && i.jobline.oem_partno, + part_type: i.jobline && i.jobline.part_type, }; }), isReturn: true, diff --git a/client/src/components/bills-list-table/bills-list-table.component.jsx b/client/src/components/bills-list-table/bills-list-table.component.jsx index 1f1e3d3fc..d15b29a20 100644 --- a/client/src/components/bills-list-table/bills-list-table.component.jsx +++ b/client/src/components/bills-list-table/bills-list-table.component.jsx @@ -76,6 +76,7 @@ export function BillsListTableComponent({ quantity: i.quantity, joblineid: i.joblineid, oem_partno: i.jobline && i.jobline.oem_partno, + part_type: i.jobline && i.jobline.part_type, }; }), isReturn: true, diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx index 324fcb1ed..b4fc3fe16 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx @@ -319,6 +319,15 @@ export function PartsOrderListTableComponent({ }, ] : []), + { + title: t("parts_orders.fields.part_type"), + dataIndex: "part_type", + key: "part_type", + render: (text, record) => + record.part_type + ? t(`joblines.fields.part_types.${record.part_type}`) + : null, + }, { title: t("parts_orders.fields.oem_partno"), dataIndex: "oem_partno", diff --git a/client/src/components/parts-order-modal/parts-order-modal.component.jsx b/client/src/components/parts-order-modal/parts-order-modal.component.jsx index 98e3e5008..04f6e4fdd 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.component.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.component.jsx @@ -1,6 +1,15 @@ import { DeleteFilled, WarningFilled } from "@ant-design/icons"; import { useTreatments } from "@splitsoftware/splitio-react"; -import { Divider, Form, Input, InputNumber, Radio, Space, Tag } from "antd"; +import { + Divider, + Form, + Input, + InputNumber, + Radio, + Space, + Tag, + Select, +} from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -114,6 +123,45 @@ export function PartsOrderModalComponent({ > + + + { logImEXEvent("parts_order_insert"); - + setSaving(true); const insertResult = await insertPartOrder({ variables: { po: [ @@ -247,8 +247,6 @@ export function PartsOrderModalContainer({ }); } - console.log(partsOrder.data.parts_orders_by_pk); - const oecResponse = await axios.post( "http://localhost:1337/oec/", @@ -275,11 +273,11 @@ export function PartsOrderModalContainer({ error: JSON.stringify(error.message), }), }); - + setSaving(false); return; } } - + setSaving(false); toggleModalVisible(); }; @@ -301,6 +299,7 @@ export function PartsOrderModalContainer({ cost: value.cost, quantity: value.part_qty, job_line_id: isReturn ? value.joblineid : value.id, + part_type: value.part_type, }); return acc; }, []) @@ -324,6 +323,8 @@ export function PartsOrderModalContainer({ } onCancel={() => toggleModalVisible()} onOk={() => form.submit()} + okButtonProps={{ loading: saving }} + cancelButtonProps={{ loading: saving }} destroyOnClose width="75%" forceRender diff --git a/client/src/graphql/bills.queries.js b/client/src/graphql/bills.queries.js index cb9aa755d..14900f2e0 100644 --- a/client/src/graphql/bills.queries.js +++ b/client/src/graphql/bills.queries.js @@ -84,6 +84,7 @@ export const QUERY_BILLS_BY_JOBID = gql` line_remarks quantity job_line_id + part_type cost jobline { id @@ -123,6 +124,10 @@ export const QUERY_BILLS_BY_JOBID = gql` applicable_taxes deductedfromlbr lbr_adjustment + jobline{ + oem_partno + part_type + } } } } @@ -159,6 +164,10 @@ export const QUERY_BILL_BY_PK = gql` cost_center quantity joblineid + jobline{ + oem_partno + part_type + } applicable_taxes deductedfromlbr lbr_adjustment diff --git a/client/src/graphql/parts-orders.queries.js b/client/src/graphql/parts-orders.queries.js index c85922bd9..82641d1a9 100644 --- a/client/src/graphql/parts-orders.queries.js +++ b/client/src/graphql/parts-orders.queries.js @@ -69,6 +69,7 @@ export const QUERY_PARTS_ORDER_OEC = gql` db_price line_desc quantity + part_type } job { bodyshop{ diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index f18639995..65de30e1a 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1906,6 +1906,7 @@ "order_date": "Order Date", "order_number": "Order Number", "orderedby": "Ordered By", + "part_type": "Type", "quantity": "Qty.", "return": "Return", "status": "Status" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index a3e39f983..096511350 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1906,6 +1906,7 @@ "order_date": "", "order_number": "", "orderedby": "", + "part_type": "", "quantity": "", "return": "", "status": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index f04282a76..c9bd6291b 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1906,6 +1906,7 @@ "order_date": "", "order_number": "", "orderedby": "", + "part_type": "", "quantity": "", "return": "", "status": ""