From 214e29d29221849e2f2ece8cdc9961d80b4b463c Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 19 Mar 2024 09:20:09 -0700 Subject: [PATCH] IO-2695 Respect payroll treatment for prod table column generation. --- .../production-list-columns.add.component.jsx | 11 ++++++++++- .../production-list-columns.data.jsx | 7 ++++--- .../production-list-table-view-select.component.jsx | 9 +++++++++ .../production-list-table.component.jsx | 9 +++++---- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/client/src/components/production-list-columns/production-list-columns.add.component.jsx b/client/src/components/production-list-columns/production-list-columns.add.component.jsx index 09e99625a..c7f14ea7c 100644 --- a/client/src/components/production-list-columns/production-list-columns.add.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.add.component.jsx @@ -7,6 +7,7 @@ import {connect} from "react-redux"; import {createStructuredSelector} from "reselect"; import {selectTechnician} from "../../redux/tech/tech.selectors"; import {selectBodyshop} from "../../redux/user/user.selectors"; +import {useSplitTreatments} from "@splitsoftware/splitio-react"; const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser @@ -31,7 +32,13 @@ export function ProductionColumnsComponent({ }) { const [columns, setColumns] = columnState; const {t} = useTranslation(); - + const { + treatments: { Enhanced_Payroll }, + } = useSplitTreatments({ + attributes: {}, + names: ['Enhanced_Payroll'], + splitKey: bodyshop.imexshopid, + }); const handleAdd = (e) => { setColumns([ ...columns, @@ -41,6 +48,7 @@ export function ProductionColumnsComponent({ state: tableState, data, activeStatuses: bodyshop.md_ro_statuses.active_statuses, + treatments:{Enhanced_Payroll} }).filter((i) => i.key === e.key), ]); }; @@ -52,6 +60,7 @@ export function ProductionColumnsComponent({ state: tableState, activeStatuses: bodyshop.md_ro_statuses.active_statuses, refetch, + treatments:{Enhanced_Payroll} }); const menu = { diff --git a/client/src/components/production-list-columns/production-list-columns.data.jsx b/client/src/components/production-list-columns/production-list-columns.data.jsx index 479f41f9d..0dd7a849f 100644 --- a/client/src/components/production-list-columns/production-list-columns.data.jsx +++ b/client/src/components/production-list-columns/production-list-columns.data.jsx @@ -29,7 +29,8 @@ import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.co import {store} from "../../redux/store"; import {setModalContext} from "../../redux/modals/modals.actions"; -const r = ({technician, state, activeStatuses, data, bodyshop, refetch}) => { +const r = ({technician, state, activeStatuses, data, bodyshop, refetch, treatments}) => { +const {Enhanced_Payroll} = treatments; return [ { title: i18n.t("jobs.actions.viewdetail"), @@ -42,7 +43,7 @@ const r = ({technician, state, activeStatuses, data, bodyshop, refetch}) => { ), }, - { + ...Enhanced_Payroll.treatment === "on" ? [ { title: i18n.t("timetickets.actions.claimtasks"), dataIndex: "claimtasks", key: "claimtasks", @@ -64,7 +65,7 @@ const r = ({technician, state, activeStatuses, data, bodyshop, refetch}) => { {i18n.t("timetickets.actions.claimtasks")} ), - }, + },] : [], { title: i18n.t("jobs.fields.ro_number"), dataIndex: "ro_number", diff --git a/client/src/components/production-list-table/production-list-table-view-select.component.jsx b/client/src/components/production-list-table/production-list-table-view-select.component.jsx index a313ec8f1..e9c96ef58 100644 --- a/client/src/components/production-list-table/production-list-table-view-select.component.jsx +++ b/client/src/components/production-list-table/production-list-table-view-select.component.jsx @@ -10,6 +10,7 @@ import {UPDATE_SHOP} from "../../graphql/bodyshop.queries"; import {selectTechnician} from "../../redux/tech/tech.selectors"; import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors"; import ProductionListColumns from "../production-list-columns/production-list-columns.data"; +import {useSplitTreatments} from '@splitsoftware/splitio-react'; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -31,6 +32,12 @@ export function ProductionListTable({ const [updateDefaultProdView] = useMutation(UPDATE_ACTIVE_PROD_LIST_VIEW); const [updateShop] = useMutation(UPDATE_SHOP); + const {treatments: {Enhanced_Payroll}} = useSplitTreatments({ + attributes: {}, + names: ["Enhanced_Payroll"], + splitKey: bodyshop.imexshopid, +}); + const handleSelect = async (value, option) => { setColumns( bodyshop.production_config @@ -44,6 +51,7 @@ export function ProductionListTable({ state, data: data, activeStatuses: bodyshop.md_ro_statuses.active_statuses, + treatments:{Enhanced_Payroll} }).find((e) => e.key === k.key), width: k.width, }; @@ -100,6 +108,7 @@ export function ProductionListTable({ refetch, data: data, activeStatuses: bodyshop.md_ro_statuses.active_statuses, + treatments: {Enhanced_Payroll} }).find((e) => e.key === k.key), width: k.width, }; 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 c99f662d4..7c2e24038 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 @@ -28,13 +28,12 @@ export function ProductionListTable({loading, data, refetch, bodyshop, technicia const [searchText, setSearchText] = useState(""); - const {treatments: {Production_List_Status_Colors}} = useSplitTreatments({ + const {treatments: {Production_List_Status_Colors, Enhanced_Payroll}} = useSplitTreatments({ attributes: {}, - names: ["Production_List_Status_Colors"], + names: ["Production_List_Status_Colors","Enhanced_Payroll"], splitKey: bodyshop.imexshopid, }); - const assoc = bodyshop.associations.find( (a) => a.useremail === currentUser.email ); @@ -69,6 +68,7 @@ export function ProductionListTable({loading, data, refetch, bodyshop, technicia state, data, activeStatuses: bodyshop.md_ro_statuses.active_statuses, + treatments: {Production_List_Status_Colors, Enhanced_Payroll} }).find((e) => e.key === k.key), width: k.width ?? 100, }; @@ -88,7 +88,8 @@ export function ProductionListTable({loading, data, refetch, bodyshop, technicia refetch, state, data: data, - activeStatuses: bodyshop.md_ro_statuses.active_statuses, + activeStatuses: bodyshop.md_ro_statuses.active_statuses, + treatments: {Production_List_Status_Colors, Enhanced_Payroll} }).find((e) => e.key === k.key), width: k.width ?? 100, };