IO-2695 Respect payroll treatment for prod table column generation.

This commit is contained in:
Patrick Fic
2024-03-19 09:20:09 -07:00
parent f618719419
commit 214e29d292
4 changed files with 28 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ import {connect} from "react-redux";
import {createStructuredSelector} from "reselect"; import {createStructuredSelector} from "reselect";
import {selectTechnician} from "../../redux/tech/tech.selectors"; import {selectTechnician} from "../../redux/tech/tech.selectors";
import {selectBodyshop} from "../../redux/user/user.selectors"; import {selectBodyshop} from "../../redux/user/user.selectors";
import {useSplitTreatments} from "@splitsoftware/splitio-react";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser //currentUser: selectCurrentUser
@@ -31,7 +32,13 @@ export function ProductionColumnsComponent({
}) { }) {
const [columns, setColumns] = columnState; const [columns, setColumns] = columnState;
const {t} = useTranslation(); const {t} = useTranslation();
const {
treatments: { Enhanced_Payroll },
} = useSplitTreatments({
attributes: {},
names: ['Enhanced_Payroll'],
splitKey: bodyshop.imexshopid,
});
const handleAdd = (e) => { const handleAdd = (e) => {
setColumns([ setColumns([
...columns, ...columns,
@@ -41,6 +48,7 @@ export function ProductionColumnsComponent({
state: tableState, state: tableState,
data, data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses, activeStatuses: bodyshop.md_ro_statuses.active_statuses,
treatments:{Enhanced_Payroll}
}).filter((i) => i.key === e.key), }).filter((i) => i.key === e.key),
]); ]);
}; };
@@ -52,6 +60,7 @@ export function ProductionColumnsComponent({
state: tableState, state: tableState,
activeStatuses: bodyshop.md_ro_statuses.active_statuses, activeStatuses: bodyshop.md_ro_statuses.active_statuses,
refetch, refetch,
treatments:{Enhanced_Payroll}
}); });
const menu = { const menu = {

View File

@@ -29,7 +29,8 @@ import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.co
import {store} from "../../redux/store"; import {store} from "../../redux/store";
import {setModalContext} from "../../redux/modals/modals.actions"; 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 [ return [
{ {
title: i18n.t("jobs.actions.viewdetail"), title: i18n.t("jobs.actions.viewdetail"),
@@ -42,7 +43,7 @@ const r = ({technician, state, activeStatuses, data, bodyshop, refetch}) => {
</Link> </Link>
), ),
}, },
{ ...Enhanced_Payroll.treatment === "on" ? [ {
title: i18n.t("timetickets.actions.claimtasks"), title: i18n.t("timetickets.actions.claimtasks"),
dataIndex: "claimtasks", dataIndex: "claimtasks",
key: "claimtasks", key: "claimtasks",
@@ -64,7 +65,7 @@ const r = ({technician, state, activeStatuses, data, bodyshop, refetch}) => {
{i18n.t("timetickets.actions.claimtasks")} {i18n.t("timetickets.actions.claimtasks")}
</div> </div>
), ),
}, },] : [],
{ {
title: i18n.t("jobs.fields.ro_number"), title: i18n.t("jobs.fields.ro_number"),
dataIndex: "ro_number", dataIndex: "ro_number",

View File

@@ -10,6 +10,7 @@ import {UPDATE_SHOP} from "../../graphql/bodyshop.queries";
import {selectTechnician} from "../../redux/tech/tech.selectors"; import {selectTechnician} from "../../redux/tech/tech.selectors";
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors"; import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
import ProductionListColumns from "../production-list-columns/production-list-columns.data"; import ProductionListColumns from "../production-list-columns/production-list-columns.data";
import {useSplitTreatments} from '@splitsoftware/splitio-react';
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
@@ -31,6 +32,12 @@ export function ProductionListTable({
const [updateDefaultProdView] = useMutation(UPDATE_ACTIVE_PROD_LIST_VIEW); const [updateDefaultProdView] = useMutation(UPDATE_ACTIVE_PROD_LIST_VIEW);
const [updateShop] = useMutation(UPDATE_SHOP); const [updateShop] = useMutation(UPDATE_SHOP);
const {treatments: {Enhanced_Payroll}} = useSplitTreatments({
attributes: {},
names: ["Enhanced_Payroll"],
splitKey: bodyshop.imexshopid,
});
const handleSelect = async (value, option) => { const handleSelect = async (value, option) => {
setColumns( setColumns(
bodyshop.production_config bodyshop.production_config
@@ -44,6 +51,7 @@ export function ProductionListTable({
state, state,
data: data, data: data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses, activeStatuses: bodyshop.md_ro_statuses.active_statuses,
treatments:{Enhanced_Payroll}
}).find((e) => e.key === k.key), }).find((e) => e.key === k.key),
width: k.width, width: k.width,
}; };
@@ -100,6 +108,7 @@ export function ProductionListTable({
refetch, refetch,
data: data, data: data,
activeStatuses: bodyshop.md_ro_statuses.active_statuses, activeStatuses: bodyshop.md_ro_statuses.active_statuses,
treatments: {Enhanced_Payroll}
}).find((e) => e.key === k.key), }).find((e) => e.key === k.key),
width: k.width, width: k.width,
}; };

View File

@@ -28,13 +28,12 @@ export function ProductionListTable({loading, data, refetch, bodyshop, technicia
const [searchText, setSearchText] = useState(""); const [searchText, setSearchText] = useState("");
const {treatments: {Production_List_Status_Colors}} = useSplitTreatments({ const {treatments: {Production_List_Status_Colors, Enhanced_Payroll}} = useSplitTreatments({
attributes: {}, attributes: {},
names: ["Production_List_Status_Colors"], names: ["Production_List_Status_Colors","Enhanced_Payroll"],
splitKey: bodyshop.imexshopid, splitKey: bodyshop.imexshopid,
}); });
const assoc = bodyshop.associations.find( const assoc = bodyshop.associations.find(
(a) => a.useremail === currentUser.email (a) => a.useremail === currentUser.email
); );
@@ -69,6 +68,7 @@ export function ProductionListTable({loading, data, refetch, bodyshop, technicia
state, 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), }).find((e) => e.key === k.key),
width: k.width ?? 100, width: k.width ?? 100,
}; };
@@ -88,7 +88,8 @@ export function ProductionListTable({loading, data, refetch, bodyshop, technicia
refetch, refetch,
state, state,
data: data, 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), }).find((e) => e.key === k.key),
width: k.width ?? 100, width: k.width ?? 100,
}; };