feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration -Cleaned up DMS key check (consolidated into a helper function), Clean up DMS post form and make it agnostic, same with customer selector.
This commit is contained in:
@@ -15,6 +15,7 @@ import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||
import ShopInfoResponsibilitycentersTaxesComponent from "./shop-info.responsibilitycenters.taxes.component";
|
||||
import ShopInfoRRConfigurationComponent from "./shop-info.rr-configuration.component";
|
||||
import { bodyshopHasDmsKey } from "../../utils/dmsUtils.js";
|
||||
|
||||
const SelectorDiv = styled.div`
|
||||
.ant-form-item .ant-select {
|
||||
@@ -34,12 +35,14 @@ export default connect(mapStateToProps, mapDispatchToProps)(ShopInfoResponsibili
|
||||
export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const hasDMSKey = bodyshopHasDmsKey(bodyshop);
|
||||
|
||||
const {
|
||||
treatments: { Qb_Multi_Ar, DmsAp }
|
||||
} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Qb_Multi_Ar", "DmsAp"],
|
||||
splitKey: bodyshop && bodyshop.imexshopid
|
||||
splitKey: bodyshop?.imexshopid
|
||||
});
|
||||
|
||||
const [costOptions, setCostOptions] = useState([
|
||||
@@ -62,7 +65,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
return (
|
||||
<div>
|
||||
<RbacWrapper action="shop:responsibilitycenter">
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<>
|
||||
{bodyshop.rr_dealerid && <ShopInfoRRConfigurationComponent form={form} />}
|
||||
|
||||
@@ -396,7 +399,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
>
|
||||
<Input onBlur={handleBlur} />
|
||||
</Form.Item> */}
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||
key={`${index}dms_acctnumber`}
|
||||
@@ -410,7 +413,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
<Input onBlur={handleBlur} />
|
||||
</Form.Item>
|
||||
)}
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_wip_acctnumber")}
|
||||
key={`${index}dms_wip_acctnumber`}
|
||||
@@ -537,7 +540,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
>
|
||||
<Input onBlur={handleBlur} />
|
||||
</Form.Item>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||
key={`${index}dms_acctnumber`}
|
||||
@@ -588,7 +591,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
</Form.List>
|
||||
</LayoutFormRow>
|
||||
<SelectorDiv>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<>
|
||||
<LayoutFormRow id="mappingname" header={t("bodyshop.labels.dms.dms_allocations")}>
|
||||
<Form.List name={["md_responsibility_centers", "dms_defaults"]}>
|
||||
@@ -3802,7 +3805,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||
rules={[
|
||||
@@ -3901,7 +3904,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||
rules={[
|
||||
@@ -3997,7 +4000,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{hasDMSKey && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||
rules={[
|
||||
@@ -4348,7 +4351,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
||||
{InstanceRenderManager({
|
||||
rome: (
|
||||
<LayoutFormRow header={<div>Adjustments</div>} id="refund">
|
||||
{bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid ? (
|
||||
{hasDMSKey ? (
|
||||
<>
|
||||
<Form.Item
|
||||
label={t("bodyshop.labels.responsibilitycenters.ttl_adjustment")}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import { bodyshopHasDmsKey } from "../../utils/dmsUtils.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -2126,7 +2127,7 @@ function TaxFormItems({ typeNum, typeNumIterator, rootElements, bodyshop }) {
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
|
||||
{bodyshopHasDmsKey(bodyshop) && (
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.dms.dms_acctnumber")}
|
||||
rules={[
|
||||
|
||||
Reference in New Issue
Block a user