From d9fa00e6332d1fc14cafe642be5e8b1ea7077405 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 12 Jan 2022 12:21:30 -0800 Subject: [PATCH 1/5] IO-1636 Resolve scheduling error --- ...chedule-calendar-header-graph.component.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js index e3a48640c..7dfb88012 100644 --- a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js +++ b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js @@ -25,15 +25,20 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) { const { ssbuckets } = bodyshop; const data = useMemo(() => { - return Object.keys(loadData.expectedLoad).map((key) => { - const metadataBucket = ssbuckets.filter((b) => b.id === key)[0]; + return ( + (loadData && + loadData.expectedLoad && + Object.keys(loadData.expectedLoad).map((key) => { + const metadataBucket = ssbuckets.filter((b) => b.id === key)[0]; - return { - bucket: loadData.expectedLoad[key].label, - current: loadData.expectedLoad[key].count, - target: metadataBucket && metadataBucket.target, - }; - }); + return { + bucket: loadData.expectedLoad[key].label, + current: loadData.expectedLoad[key].count, + target: metadataBucket && metadataBucket.target, + }; + })) || + [] + ); }, [loadData, ssbuckets]); const popContent = ( From 5ec1e84671270e407570262c2e2d073595a0b274 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 12 Jan 2022 12:49:38 -0800 Subject: [PATCH 2/5] IO-1627 Add category to production. --- .../production-list-columns.data.js | 24 +++++++ ...roduction-list-columns.status.category.jsx | 63 +++++++++++++++++++ .../production-list-table.component.jsx | 8 +++ client/src/graphql/jobs.queries.js | 3 + 4 files changed, 98 insertions(+) create mode 100644 client/src/components/production-list-columns/production-list-columns.status.category.jsx diff --git a/client/src/components/production-list-columns/production-list-columns.data.js b/client/src/components/production-list-columns/production-list-columns.data.js index 7c3751b03..00f279a66 100644 --- a/client/src/components/production-list-columns/production-list-columns.data.js +++ b/client/src/components/production-list-columns/production-list-columns.data.js @@ -18,6 +18,7 @@ import ProductionListLastContacted from "./production-list-columns.lastcontacted import ProductionListColumnPaintPriority from "./production-list-columns.paintpriority.component"; import ProductionListColumnNote from "./production-list-columns.productionnote.component"; import ProductionListColumnStatus from "./production-list-columns.status.component"; +import ProductionListColumnCategory from "./production-list-columns.status.category"; import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component"; const r = ({ technician, state, activeStatuses, bodyshop }) => { @@ -251,6 +252,29 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => { state.sortedInfo.columnKey === "status" && state.sortedInfo.order, render: (text, record) => , }, + { + title: i18n.t("jobs.fields.category"), + dataIndex: "category", + key: "category", + ellipsis: true, + + filters: + (bodyshop && + bodyshop.md_categories.map((s) => { + return { + text: s, + value: [s], + }; + })) || + [], + onFilter: (value, record) => value.includes(record.category), + sorter: (a, b) => alphaSort(a.category, b.category), + sortOrder: + state.sortedInfo.columnKey === "category" && state.sortedInfo.order, + render: (text, record) => ( + + ), + }, { title: i18n.t("production.labels.bodyhours"), dataIndex: "labhrs", diff --git a/client/src/components/production-list-columns/production-list-columns.status.category.jsx b/client/src/components/production-list-columns/production-list-columns.status.category.jsx new file mode 100644 index 000000000..115b69a3f --- /dev/null +++ b/client/src/components/production-list-columns/production-list-columns.status.category.jsx @@ -0,0 +1,63 @@ +import { useMutation } from "@apollo/client"; +import { Dropdown, Menu, Spin } from "antd"; +import React, { useState } from "react"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { logImEXEvent } from "../../firebase/firebase.utils"; +import { UPDATE_JOB } from "../../graphql/jobs.queries"; +import { insertAuditTrail } from "../../redux/application/application.actions"; +import { selectBodyshop } from "../../redux/user/user.selectors"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + insertAuditTrail: ({ jobid, operation }) => + dispatch(insertAuditTrail({ jobid, operation })), +}); +export function ProductionListColumnCategory({ record, bodyshop }) { + const [updateJob] = useMutation(UPDATE_JOB); + const [loading, setLoading] = useState(false); + + const handleSetStatus = async (e) => { + logImEXEvent("production_change_status"); + + setLoading(true); + const { key } = e; + await updateJob({ + variables: { + jobId: record.id, + job: { + category: key, + }, + }, + }); + + setLoading(false); + }; + + return ( + + {bodyshop.md_categories.map((item) => ( + {item} + ))} + + } + trigger={["click"]} + > +
+ {record.category} + {loading && } +
+
+ ); +} +export default connect( + mapStateToProps, + mapDispatchToProps +)(ProductionListColumnCategory); diff --git a/client/src/components/production-list-table/production-list-table.component.jsx b/client/src/components/production-list-table/production-list-table.component.jsx index dd2c5fc32..56278c1fc 100644 --- a/client/src/components/production-list-table/production-list-table.component.jsx +++ b/client/src/components/production-list-table/production-list-table.component.jsx @@ -88,6 +88,12 @@ export function ProductionListTable({ ); const handleTableChange = (pagination, filters, sorter) => { + console.log( + "🚀 ~ file: production-list-table.component.jsx ~ line 91 ~ pagination, filters, sorter", + pagination, + filters, + sorter + ); setState({ ...state, filteredInfo: filters, @@ -263,8 +269,10 @@ export function ProductionListTable({ }, }} columns={columns.map((c, index) => { + console.log(c); return { ...c, + filteredValue: state.filteredInfo[c.key] || null, sortOrder: state.sortedInfo.columnKey === c.key && state.sortedInfo.order, title: headerItem(c), diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 6ff600dce..999d56224 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -123,6 +123,7 @@ export const QUERY_EXACT_JOB_IN_PRODUCTION = gql` ro_number ownr_fn ownr_ln + category ownr_co_nm v_model_yr v_model_desc @@ -193,6 +194,7 @@ export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql` status ro_number ownr_fn + category ownr_ln ownr_co_nm v_model_yr @@ -263,6 +265,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql` id updated_at status + category ro_number ownr_fn ownr_ln From 3bc1785351c277acff19cd23f3f442c3121493b5 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 13 Jan 2022 09:19:41 -0800 Subject: [PATCH 3/5] IO-1627 Add production category report. --- bodyshop_translations.babel | 21 +++++++++++++++++++++ client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + client/src/utils/TemplateConstants.js | 8 ++++++++ 5 files changed, 32 insertions(+) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 9365969a2..f292acf4f 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -38007,6 +38007,27 @@ + + production_by_category + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + production_by_csr false diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 5ee6705a1..8e08327d7 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2260,6 +2260,7 @@ "parts_not_recieved": "Parts Not Received", "payments_by_date": "Payments by Date", "payments_by_date_type": "Payments by Date and Type", + "production_by_category": "Production by Category", "production_by_csr": "Production by CSR", "production_by_last_name": "Production by Last Name", "production_by_repair_status": "Production by Status", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 75e2ab87d..e89b26bd5 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2260,6 +2260,7 @@ "parts_not_recieved": "", "payments_by_date": "", "payments_by_date_type": "", + "production_by_category": "", "production_by_csr": "", "production_by_last_name": "", "production_by_repair_status": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index c92da10b0..0f1c0c51c 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2260,6 +2260,7 @@ "parts_not_recieved": "", "payments_by_date": "", "payments_by_date_type": "", + "production_by_category": "", "production_by_csr": "", "production_by_last_name": "", "production_by_repair_status": "", diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index d43395e19..e486000ce 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -1598,6 +1598,14 @@ export const TemplateList = (type, context) => { //idtype: "vendor", disabled: false, }, + production_by_category: { + title: i18n.t("reportcenter.templates.production_by_category"), + description: "", + subject: i18n.t("reportcenter.templates.production_by_category"), + key: "production_by_category", + //idtype: "vendor", + disabled: false, + }, } : {}), ...(!type || type === "special" From 7ee544b01356a4cb1d0b5dad7e62a0757693b908 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 13 Jan 2022 10:55:16 -0800 Subject: [PATCH 4/5] Minor PBS Updates. --- .../production-list-table.component.jsx | 1 - ...p-info.responsibilitycenters.component.jsx | 24 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client/src/components/production-list-table/production-list-table.component.jsx b/client/src/components/production-list-table/production-list-table.component.jsx index 56278c1fc..d0a620819 100644 --- a/client/src/components/production-list-table/production-list-table.component.jsx +++ b/client/src/components/production-list-table/production-list-table.component.jsx @@ -269,7 +269,6 @@ export function ProductionListTable({ }, }} columns={columns.map((c, index) => { - console.log(c); return { ...c, filteredValue: state.filteredInfo[c.key] || null, diff --git a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx index e5543bcba..3b89799f4 100644 --- a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx +++ b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx @@ -75,9 +75,17 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( <> - - {form.getFieldValue("cdk_dealerid")} - + {bodyshop.cdk_dealerid && ( + + {form.getFieldValue("cdk_dealerid")} + + )} + {bodyshop.pbs_serialnumber && ( + + {form.getFieldValue("pbs_serialnumber")} + + )} +