Final changes for RO closer.

This commit is contained in:
Patrick Fic
2024-04-03 14:18:45 -07:00
parent 815ada0516
commit 5e63ce7271
18 changed files with 1266 additions and 494 deletions

View File

@@ -1,130 +1,147 @@
import {useSplitTreatments} from "@splitsoftware/splitio-react";
import {Button, Card, Tabs} from "antd";
import React from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
import ShopInfoGeneral from "./shop-info.general.component";
import ShopInfoIntakeChecklistComponent from "./shop-info.intake.component";
import ShopInfoLaborRates from "./shop-info.laborrates.component";
import ShopInfoOrderStatusComponent from "./shop-info.orderstatus.component";
import ShopInfoPartsScan from "./shop-info.parts-scan";
import ShopInfoRbacComponent from "./shop-info.rbac.component";
import ShopInfoResponsibilityCenterComponent from "./shop-info.responsibilitycenters.component";
import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
import {useLocation, useNavigate} from "react-router-dom";
import ShopInfoTaskPresets from "./shop-info.task-presets.component";
import queryString from "query-string";
import InstanceRenderManager from "../../utils/instanceRenderMgr";
import { useSplitTreatments } from '@splitsoftware/splitio-react';
import { Button, Card, Tabs } from 'antd';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { selectBodyshop } from '../../redux/user/user.selectors';
import ShopInfoGeneral from './shop-info.general.component';
import ShopInfoIntakeChecklistComponent from './shop-info.intake.component';
import ShopInfoLaborRates from './shop-info.laborrates.component';
import ShopInfoOrderStatusComponent from './shop-info.orderstatus.component';
import ShopInfoPartsScan from './shop-info.parts-scan';
import ShopInfoRbacComponent from './shop-info.rbac.component';
import ShopInfoResponsibilityCenterComponent from './shop-info.responsibilitycenters.component';
import ShopInfoROStatusComponent from './shop-info.rostatus.component';
import ShopInfoSchedulingComponent from './shop-info.scheduling.component';
import ShopInfoSpeedPrint from './shop-info.speedprint.component';
import { useLocation, useNavigate } from 'react-router-dom';
import ShopInfoTaskPresets from './shop-info.task-presets.component';
import queryString from 'query-string';
import InstanceRenderManager from '../../utils/instanceRenderMgr';
import ShopInfoRoGuard from './shop-info.roguard.component';
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(mapStateToProps, mapDispatchToProps)(ShopInfoComponent);
export function ShopInfoComponent({bodyshop, form, saveLoading}) {
export function ShopInfoComponent({ bodyshop, form, saveLoading }) {
const {
treatments: { CriticalPartsScanning, Enhanced_Payroll },
} = useSplitTreatments({
attributes: {},
names: ['CriticalPartsScanning', 'Enhanced_Payroll'],
splitKey: bodyshop.imexshopid,
});
const {treatments: {CriticalPartsScanning, Enhanced_Payroll}} = useSplitTreatments({
attributes: {},
names: ["CriticalPartsScanning","Enhanced_Payroll"],
splitKey: bodyshop.imexshopid,
});
const { t } = useTranslation();
const history = useNavigate();
const location = useLocation();
const search = queryString.parse(location.search);
const {t} = useTranslation();
const history = useNavigate();
const location = useLocation();
const search = queryString.parse(location.search);
const tabItems = [
const tabItems = [
{
key: 'general',
label: t('bodyshop.labels.shopinfo'),
children: <ShopInfoGeneral form={form} />,
},
{
key: 'speedprint',
label: t('bodyshop.labels.speedprint'),
children: <ShopInfoSpeedPrint form={form} />,
},
{
key: 'rbac',
label: t('bodyshop.labels.rbac'),
children: <ShopInfoRbacComponent form={form} />,
},
{
key: 'roStatus',
label: t('bodyshop.labels.jobstatuses'),
children: <ShopInfoROStatusComponent form={form} />,
},
{
key: 'scheduling',
label: t('bodyshop.labels.scheduling'),
children: <ShopInfoSchedulingComponent form={form} />,
},
{
key: 'orderStatus',
label: t('bodyshop.labels.orderstatuses'),
children: <ShopInfoOrderStatusComponent form={form} />,
},
{
key: 'responsibilityCenters',
label: t('bodyshop.labels.responsibilitycenters.title'),
children: <ShopInfoResponsibilityCenterComponent form={form} />,
},
...InstanceRenderManager({
imex: [
{
key: "general",
label: t("bodyshop.labels.shopinfo"),
children: <ShopInfoGeneral form={form}/>,
key: 'checklists',
label: t('bodyshop.labels.checklists'),
children: <ShopInfoIntakeChecklistComponent form={form} />,
},
],
rome: 'USE_IMEX',
promanager: [],
}),
{
key: 'laborrates',
label: t('bodyshop.labels.laborrates'),
children: <ShopInfoLaborRates form={form} />,
},
...(CriticalPartsScanning.treatment === 'on'
? [
{
key: 'partsscan',
label: t('bodyshop.labels.partsscan'),
children: <ShopInfoPartsScan form={form} />,
},
]
: []),
...(Enhanced_Payroll.treatment === 'on'
? [
{
key: 'task-presets',
label: t('bodyshop.labels.task-presets'),
children: <ShopInfoTaskPresets form={form} />,
},
]
: []),
...InstanceRenderManager({
imex: [
{
key: "speedprint",
label: t("bodyshop.labels.speedprint"),
children: <ShopInfoSpeedPrint form={form}/>,
key: 'roguard',
label: t('bodyshop.labels.roguard.title'),
children: <ShopInfoRoGuard form={form} />,
},
{
key: "rbac",
label: t("bodyshop.labels.rbac"),
children: <ShopInfoRbacComponent form={form}/>,
},
{
key: "roStatus",
label: t("bodyshop.labels.jobstatuses"),
children: <ShopInfoROStatusComponent form={form}/>,
},
{
key: "scheduling",
label: t("bodyshop.labels.scheduling"),
children: <ShopInfoSchedulingComponent form={form}/>,
},
{
key: "orderStatus",
label: t("bodyshop.labels.orderstatuses"),
children: <ShopInfoOrderStatusComponent form={form}/>,
},
{
key: "responsibilityCenters",
label: t("bodyshop.labels.responsibilitycenters.title"),
children: <ShopInfoResponsibilityCenterComponent form={form}/>,
},
...InstanceRenderManager({imex: [ {
key: "checklists",
label: t("bodyshop.labels.checklists"),
children: <ShopInfoIntakeChecklistComponent form={form}/>,
}], rome: "USE_IMEX", promanager:[]})
,
{
key: "laborrates",
label: t("bodyshop.labels.laborrates"),
children: <ShopInfoLaborRates form={form}/>,
},
...(CriticalPartsScanning.treatment === "on"
? [
{
key: "partsscan",
label: t("bodyshop.labels.partsscan"),
children: <ShopInfoPartsScan form={form}/>,
},
]
: []),
...Enhanced_Payroll.treatment === "on" ? [
{
key: 'task-presets',
label: t("bodyshop.labels.task-presets"),
children: <ShopInfoTaskPresets form={form}/>
}]: []
];
return (
<Card
extra={
<Button
type="primary"
loading={saveLoading}
onClick={() => form.submit()}
>
{t("general.actions.save")}
</Button>
}
>
<Tabs
defaultActiveKey={search.subtab}
onChange={(key) =>
history({
search: `?tab=${search.tab}&subtab=${key}`,
})
}
items={tabItems}
/>
</Card>
);
],
rome: 'USE_IMEX',
promanager: [],
}),
];
return (
<Card
extra={
<Button type="primary" loading={saveLoading} onClick={() => form.submit()}>
{t('general.actions.save')}
</Button>
}
>
<Tabs
defaultActiveKey={search.subtab}
onChange={(key) =>
history({
search: `?tab=${search.tab}&subtab=${key}`,
})
}
items={tabItems}
/>
</Card>
);
}

View File

@@ -0,0 +1,111 @@
import { Form, Input, InputNumber, Switch } from 'antd';
import React from 'react';
import { useTranslation } from 'react-i18next';
import LayoutFormRow from '../layout-form-row/layout-form-row.component';
export default function ShopInfoRoGuard({ form }) {
const { t } = useTranslation();
return (
<div>
<LayoutFormRow header={t('bodyshop.labels.md_ro_guard')}>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enabled')}
name={['md_ro_guard', 'enabled']}
valuePropName="checked"
>
<Switch />
</Form.Item>
</LayoutFormRow>
<Form.Item noStyle dependencies={[['md_ro_guard', 'enabled']]}>
{() => {
const disabled = !form.getFieldValue(['md_ro_guard', 'enabled']);
return (
<LayoutFormRow noDivider>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.totalgppercent_minimum')}
name={['md_ro_guard', 'totalgppercent_minimum']}
rules={[
{
required: !disabled,
//message: t("general.validation.required"),
},
]}
>
<InputNumber min={0} max={100} precision={1} disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.masterbypass')}
name={['md_ro_guard', 'masterbypass']}
rules={[
{
required: !disabled,
//message: t("general.validation.required"),
},
]}
>
<Input type="password" allowClear disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enforce_bills')}
name={['md_ro_guard', 'enforce_bills']}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enforce_cm')}
name={['md_ro_guard', 'enforce_cm']}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enforce_profit')}
name={['md_ro_guard', 'enforce_profit']}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enforce_ar')}
name={['md_ro_guard', 'enforce_ar']}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enforce_sublet')}
name={['md_ro_guard', 'enforce_sublet']}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enforce_ppd')}
name={['md_ro_guard', 'enforce_ppd']}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={t('bodyshop.fields.md_ro_guard.enforce_labor')}
name={['md_ro_guard', 'enforce_labor']}
valuePropName="checked"
>
<Switch disabled={disabled} />
</Form.Item>
</LayoutFormRow>
);
}}
</Form.Item>
</div>
);
}