From 67a8c13baddd9a961ce91823cb622d3a460ba0bc Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 13 Aug 2025 16:52:08 -0400 Subject: [PATCH] feature/IO-3255-simplified-parts-management - Favor isPartsEntry over isPartsManagementOnly --- .../breadcrumbs/breadcrumbs.component.jsx | 7 ++-- .../job-detail-lines/job-lines.component.jsx | 34 +++++++++---------- .../jobs-detail-header.component.jsx | 15 ++++---- .../jobs-detail-pli.component.jsx | 13 ++++--- ...arts-order-list-table-drawer.component.jsx | 16 ++++----- .../parts-order-list-table.component.jsx | 12 +++---- ...simplified-parts-jobs-detail.component.jsx | 10 +++--- 7 files changed, 51 insertions(+), 56 deletions(-) diff --git a/client/src/components/breadcrumbs/breadcrumbs.component.jsx b/client/src/components/breadcrumbs/breadcrumbs.component.jsx index 0fda5d047..eac85832c 100644 --- a/client/src/components/breadcrumbs/breadcrumbs.component.jsx +++ b/client/src/components/breadcrumbs/breadcrumbs.component.jsx @@ -4,7 +4,7 @@ import { selectBreadcrumbs, selectIsPartsEntry } from "../../redux/application/a import { connect } from "react-redux"; import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; -import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import GlobalSearch from "../global-search/global-search.component"; import GlobalSearchOs from "../global-search/global-search-os.component"; import "./breadcrumbs.styles.scss"; @@ -13,11 +13,10 @@ import { useSplitTreatments } from "@splitsoftware/splitio-react"; const mapStateToProps = createStructuredSelector({ breadcrumbs: selectBreadcrumbs, bodyshop: selectBodyshop, - partsManagementOnly: selectPartsManagementOnly, isPartsEntry: selectIsPartsEntry }); -export function BreadCrumbs({ breadcrumbs, bodyshop, partsManagementOnly, isPartsEntry }) { +export function BreadCrumbs({ breadcrumbs, bodyshop, isPartsEntry }) { const { treatments: { OpenSearch } } = useSplitTreatments({ @@ -35,7 +34,7 @@ export function BreadCrumbs({ breadcrumbs, bodyshop, partsManagementOnly, isPart { key: "home", title: ( - + {(bodyshop && bodyshop.shopname && `(${bodyshop.shopname})`) || ""} ) 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 29bbea71d..bfd7fe131 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -17,7 +17,7 @@ import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { DELETE_JOB_LINE_BY_PK } from "../../graphql/jobs-lines.queries"; -import { selectJobReadOnly } from "../../redux/application/application.selectors"; +import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectTechnician } from "../../redux/tech/tech.selectors"; import { onlyUnique } from "../../utils/arrayHelper"; @@ -32,7 +32,7 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re import { useSplitTreatments } from "@splitsoftware/splitio-react"; import _ from "lodash"; import { FaTasks } from "react-icons/fa"; -import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import dayjs from "../../utils/day"; import InstanceRenderManager from "../../utils/instanceRenderMgr"; import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component"; @@ -51,7 +51,7 @@ const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, jobRO: selectJobReadOnly, technician: selectTechnician, - partsManagementOnly: selectPartsManagementOnly + isPartsEntry: selectIsPartsEntry }); const mapDispatchToProps = (dispatch) => ({ @@ -78,10 +78,8 @@ export function JobLinesComponent({ setBillEnterContext, setTaskUpsertContext, billsQuery, - handleBillOnRowClick, handlePartsOrderOnRowClick, - handlePartsDispatchOnRowClick, - partsManagementOnly + isPartsEntry }) { const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK); const { @@ -96,7 +94,7 @@ export function JobLinesComponent({ const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { - ...(partsManagementOnly + ...(isPartsEntry ? { part_type: ["PAN", "PAC", "PAR", "PAL", "PAA", "PAM", "PAP", "PAS", "PASL", "PAG"] } @@ -229,7 +227,7 @@ export function JobLinesComponent({ sorter: (a, b) => a.part_qty - b.part_qty, sortOrder: state.sortedInfo.columnKey === "part_qty" && state.sortedInfo.order }, - ...(!partsManagementOnly + ...(!isPartsEntry ? [ { title: t("joblines.fields.mod_lbr_ty"), @@ -281,7 +279,7 @@ export function JobLinesComponent({ key: "location", render: (text, record) => }, - ...(!partsManagementOnly && HasFeatureAccess({ featureName: "bills", bodyshop }) + ...(!isPartsEntry && HasFeatureAccess({ featureName: "bills", bodyshop }) ? [ { title: t("joblines.labels.billref"), @@ -315,7 +313,7 @@ export function JobLinesComponent({ onFilter: (value, record) => value.includes(record.status), render: (text, record) => }, - ...!partsManagementOnly + ...(!isPartsEntry ? [ { title: t("general.labels.actions"), @@ -382,7 +380,7 @@ export function JobLinesComponent({ ) } ] - : [] + : []) ]; const handleTableChange = (pagination, filters, sorter) => { @@ -555,7 +553,7 @@ export function JobLinesComponent({ - {!partsManagementOnly && ( + {!isPartsEntry && ( - {!partsManagementOnly && ( + {!isPartsEntry && ( - {!partsManagementOnly && ( + {!isPartsEntry && ( - {!partsManagementOnly && ( + {!isPartsEntry && ( <> - {!partsManagementOnly && ( + {!isPartsEntry && ( <>