Auto allocate MAPA, MASH, ATS. IO-442

This commit is contained in:
Patrick Fic
2021-01-14 15:47:50 -08:00
parent 9c03d48fc2
commit 03f0afbb68

View File

@@ -1,11 +1,11 @@
import { Button } from "antd";
import _ from "lodash";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { selectBodyshop } from "../../redux/user/user.selectors";
import _ from "lodash";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
@@ -23,7 +23,17 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
if (jl.part_type) {
ret.profitcenter_part = defaults.profits[jl.part_type.toUpperCase()];
} else {
ret.profitcenter_part = null;
console.log("Jobline Didnt matchMedia.", jl);
const lineDesc = jl.line_desc.toLowerCase();
if (lineDesc.includes("shop materials")) {
ret.profitcenter_part = defaults.profits["MASH"];
} else if (lineDesc.includes("paint/materials")) {
ret.profitcenter_part = defaults.profits["MAPA"];
} else if (lineDesc.includes("ats amount")) {
ret.profitcenter_part = defaults.profits["ATS"];
} else {
ret.profitcenter_part = null;
}
}
if (jl.mod_lbr_ty) {
ret.profitcenter_labor =