From 4efa01edd303a5a82e502547d31be7ef2023628f Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 23 Jan 2026 22:26:22 -0800 Subject: [PATCH 1/2] IO-3514 Print Center Restrict Financial Group on Tech Station and Fix Drawer Close on Tech Console Signed-off-by: Allan Carr --- .../print-center-jobs-parts.component.jsx | 43 +++++++------- .../print-center-jobs.component.jsx | 56 ++++++++++--------- .../tech-lookup-jobs-drawer.component.jsx | 4 +- 3 files changed, 56 insertions(+), 47 deletions(-) diff --git a/client/src/components/print-center-jobs/print-center-jobs-parts.component.jsx b/client/src/components/print-center-jobs/print-center-jobs-parts.component.jsx index e86db4255..54d9134c0 100644 --- a/client/src/components/print-center-jobs/print-center-jobs-parts.component.jsx +++ b/client/src/components/print-center-jobs/print-center-jobs-parts.component.jsx @@ -9,6 +9,7 @@ import { TemplateList } from "../../utils/TemplateConstants"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; import { HistoryOutlined, MailOutlined, PrinterOutlined, UnorderedListOutlined } from "@ant-design/icons"; +import { bodyshopHasDmsKey } from "../../utils/dmsUtils.js"; const mapStateToProps = createStructuredSelector({ printCenterModal: selectPrintCenter, @@ -29,27 +30,29 @@ export function PrintCenterJobsPartsComponent({ printCenterModal, bodyshop, tech names: ["Enhanced_Payroll"], splitKey: bodyshop.imexshopid }); - - const Templates = - bodyshop.cdk_dealerid === null && bodyshop.pbs_serialnumber === null - ? Object.keys(tempList) - .map((key) => tempList[key]) - .filter( - (temp) => - (!temp.regions || - temp.regions?.[bodyshop.region_config] || - (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) && - (!temp.dms || temp.dms === false) - ) - : Object.keys(tempList) - .map((key) => tempList[key]) - .filter( - (temp) => - !temp.regions || + const hasDMSKey = bodyshopHasDmsKey(bodyshop); + + const Templates = !hasDMSKey + ? Object.keys(tempList) + .map((key) => tempList[key]) + .filter( + (temp) => + (!temp.regions || temp.regions?.[bodyshop.region_config] || - (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true) - ); - + (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) && + (!temp.dms || temp.dms === false) + ) + .filter((temp) => !technician || temp.group !== "financial") + : Object.keys(tempList) + .map((key) => tempList[key]) + .filter( + (temp) => + !temp.regions || + temp.regions?.[bodyshop.region_config] || + (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true) + ) + .filter((temp) => !technician || temp.group !== "financial"); + const JobsReportsList = Enhanced_Payroll.treatment === "on" ? Object.keys(Templates) diff --git a/client/src/components/print-center-jobs/print-center-jobs.component.jsx b/client/src/components/print-center-jobs/print-center-jobs.component.jsx index 2df39c0b5..a33a387e1 100644 --- a/client/src/components/print-center-jobs/print-center-jobs.component.jsx +++ b/client/src/components/print-center-jobs/print-center-jobs.component.jsx @@ -12,15 +12,18 @@ import Jobd3RdPartyModal from "../job-3rd-party-modal/job-3rd-party-modal.compon import PrintCenterItem from "../print-center-item/print-center-item.component"; import PrintCenterJobsLabels from "../print-center-jobs-labels/print-center-jobs-labels.component"; import PrintCenterSpeedPrint from "../print-center-speed-print/print-center-speed-print.component"; +import { bodyshopHasDmsKey } from "../../utils/dmsUtils"; +import { selectTechnician } from "../../redux/tech/tech.selectors"; const mapStateToProps = createStructuredSelector({ printCenterModal: selectPrintCenter, - bodyshop: selectBodyshop + bodyshop: selectBodyshop, + technician: selectTechnician }); const mapDispatchToProps = () => ({}); -export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) { +export function PrintCenterJobsComponent({ printCenterModal, bodyshop, technician }) { const [search, setSearch] = useState(""); const { id: jobId, job } = printCenterModal.context; const tempList = TemplateList("job", {}); @@ -32,30 +35,33 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) { names: ["Enhanced_Payroll"], splitKey: bodyshop.imexshopid }); + const hasDMSKey = bodyshopHasDmsKey(bodyshop); - const Templates = - bodyshop.cdk_dealerid === null && bodyshop.pbs_serialnumber === null - ? Object.keys(tempList) - .map((key) => { - return tempList[key]; - }) - .filter( - (temp) => - (!temp.regions || - (temp.regions && temp.regions[bodyshop.region_config]) || - (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) && - (!temp.dms || temp.dms === false) - ) - : Object.keys(tempList) - .map((key) => { - return tempList[key]; - }) - .filter( - (temp) => - !temp.regions || + const Templates = !hasDMSKey + ? Object.keys(tempList) + .map((key) => { + return tempList[key]; + }) + .filter( + (temp) => + (!temp.regions || (temp.regions && temp.regions[bodyshop.region_config]) || - (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true) - ); + (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true)) && + (!temp.dms || temp.dms === false) + ) + .filter((temp) => !technician || temp.group !== "financial") + : Object.keys(tempList) + .map((key) => { + return tempList[key]; + }) + .filter( + (temp) => + !temp.regions || + (temp.regions && temp.regions[bodyshop.region_config]) || + (temp.regions && bodyshop.region_config.includes(Object.keys(temp.regions)) === true) + ) + .filter((temp) => !technician || temp.group !== "financial"); + const JobsReportsList = Enhanced_Payroll.treatment === "on" ? Object.keys(Templates) @@ -89,7 +95,7 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) { - setSearch(e.target.value)} value={search} /> + setSearch(e.target.value)} value={search} enterButton /> } > diff --git a/client/src/components/tech-lookup-jobs-drawer/tech-lookup-jobs-drawer.component.jsx b/client/src/components/tech-lookup-jobs-drawer/tech-lookup-jobs-drawer.component.jsx index de15aa46c..9610728a3 100644 --- a/client/src/components/tech-lookup-jobs-drawer/tech-lookup-jobs-drawer.component.jsx +++ b/client/src/components/tech-lookup-jobs-drawer/tech-lookup-jobs-drawer.component.jsx @@ -59,7 +59,8 @@ export function TechLookupJobsDrawer({ bodyshop, setPrintCenterContext }) { const handleDrawerClose = () => { // Immutable omit (no delete/mutation) - const { ...rest } = searchParams || {}; + const { selected, ...rest } = searchParams || {}; + void selected; history({ search: queryString.stringify(rest) }); @@ -72,7 +73,6 @@ export function TechLookupJobsDrawer({ bodyshop, setPrintCenterContext }) { {data ? ( window.history.back()} title={data.jobs_by_pk.ro_number || t("general.labels.na")} extra={