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/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..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 @@ -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, @@ -265,6 +271,7 @@ export function ProductionListTable({ columns={columns.map((c, index) => { 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/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 = ( 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")} + + )} +