Final changes for RO closer.
This commit is contained in:
@@ -1,326 +1,316 @@
|
||||
import { Alert, Card, Col, Row, Space, Statistic, Tooltip, Typography } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import "./job-bills-total.styles.scss";
|
||||
import { Alert, Card, Col, Row, Space, Statistic, Tooltip, Typography } from 'antd';
|
||||
import Dinero from 'dinero.js';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import InstanceRenderManager from '../../utils/instanceRenderMgr';
|
||||
import AlertComponent from '../alert/alert.component';
|
||||
import LoadingSkeleton from '../loading-skeleton/loading-skeleton.component';
|
||||
import './job-bills-total.styles.scss';
|
||||
|
||||
export default function JobBillsTotalComponent({
|
||||
loading,
|
||||
bills,
|
||||
partsOrders,
|
||||
jobTotals,
|
||||
showWarning,
|
||||
warningCallback
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
loading,
|
||||
bills,
|
||||
partsOrders,
|
||||
jobTotals,
|
||||
showWarning,
|
||||
warningCallback,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (loading) return <LoadingSkeleton/>;
|
||||
if (!!!jobTotals){
|
||||
|
||||
if(showWarning && warningCallback && typeof warningCallback === 'function'){
|
||||
warningCallback(t("jobs.errors.nofinancial"))
|
||||
}
|
||||
return (
|
||||
<AlertComponent type="error" message={t("jobs.errors.nofinancial")}/>
|
||||
);
|
||||
}
|
||||
|
||||
const totals = jobTotals;
|
||||
|
||||
let billTotals = Dinero();
|
||||
let billCms = Dinero();
|
||||
let lbrAdjustments = Dinero();
|
||||
let totalReturns = Dinero();
|
||||
let totalReturnsMarkedNotReceived = Dinero();
|
||||
let totalReturnsMarkedReceived = Dinero();
|
||||
|
||||
partsOrders.forEach((p) =>
|
||||
p.parts_order_lines.forEach((pol) => {
|
||||
if (p.return) {
|
||||
totalReturns = totalReturns.add(
|
||||
Dinero({
|
||||
amount: Math.round((pol.act_price || 0) * 100),
|
||||
}).multiply(pol.quantity)
|
||||
);
|
||||
|
||||
if (pol.cm_received === null) {
|
||||
return; //TODO:AIO This was previously removed. Check if functionality impacted.
|
||||
// Skip this calculation for bills posted prior to the CNR change.
|
||||
} else {
|
||||
if (pol.cm_received === false) {
|
||||
totalReturnsMarkedNotReceived = totalReturnsMarkedNotReceived.add(
|
||||
Dinero({
|
||||
amount: Math.round((pol.act_price || 0) * 100),
|
||||
}).multiply(pol.quantity)
|
||||
);
|
||||
} else {
|
||||
totalReturnsMarkedReceived = totalReturnsMarkedReceived.add(
|
||||
Dinero({
|
||||
amount: Math.round((pol.act_price || 0) * 100),
|
||||
}).multiply(pol.quantity)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
bills.forEach((i) =>
|
||||
i.billlines.forEach((il) => {
|
||||
if (!i.is_credit_memo) {
|
||||
billTotals = billTotals.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
} else {
|
||||
billCms = billCms.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
}
|
||||
if (il.deductedfromlbr) {
|
||||
lbrAdjustments = lbrAdjustments.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const totalPartsSublet = Dinero(totals.parts.parts.total)
|
||||
.add(Dinero(totals.parts.sublets.total))
|
||||
.add(Dinero(totals.additional.shipping))
|
||||
.add(Dinero(totals.additional.towing))
|
||||
.add( InstanceRenderManager({imex: Dinero(), rome: Dinero(totals.additional.additionalCosts),promanager: "USE_ROME" })) ; // Additional costs were captured for Rome, but not imex.
|
||||
|
||||
const discrepancy = totalPartsSublet.subtract(billTotals);
|
||||
|
||||
const discrepWithLbrAdj = discrepancy.add(lbrAdjustments);
|
||||
|
||||
const discrepWithCms = discrepWithLbrAdj.add(totalReturns);
|
||||
const calculatedCreditsNotReceived = totalReturns.subtract(billCms); //billCms is tracked as a negative number.
|
||||
|
||||
|
||||
if (loading) return <LoadingSkeleton />;
|
||||
if (!!!jobTotals) {
|
||||
if (showWarning && warningCallback && typeof warningCallback === 'function') {
|
||||
if (
|
||||
discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0
|
||||
) {
|
||||
warningCallback(t('jobs.labels.outstanding_reconciliation_discrep'));
|
||||
}
|
||||
if (calculatedCreditsNotReceived.getAmount() > 0) {
|
||||
warningCallback(t('jobs.labels.outstanding_credit_memos'));
|
||||
}
|
||||
warningCallback({ key: 'bills', warning: t('jobs.errors.nofinancial') });
|
||||
}
|
||||
return <AlertComponent type="error" message={t('jobs.errors.nofinancial')} />;
|
||||
}
|
||||
|
||||
const totals = jobTotals;
|
||||
|
||||
return (
|
||||
<Row gutter={[16,16]}>
|
||||
<Col md={24} lg={18}>
|
||||
<Card title={t("jobs.labels.jobtotals")} style={{height: "100%"}}>
|
||||
<Space wrap size="large">
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.partstotal"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("jobs.labels.rosaletotal")}
|
||||
value={totalPartsSublet.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>-</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.billtotal"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.retailtotal")}
|
||||
value={billTotals.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.discrep1"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepancy")}
|
||||
valueStyle={{
|
||||
color: discrepancy.getAmount() === 0 ? "green" : "red",
|
||||
}}
|
||||
value={discrepancy.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>+</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.laboradj"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.dedfromlbr")}
|
||||
value={lbrAdjustments.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.discrep2"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepancy")}
|
||||
valueStyle={{
|
||||
color: discrepWithLbrAdj.getAmount() === 0 ? "green" : "red",
|
||||
}}
|
||||
value={discrepWithLbrAdj.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>+</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.creditmemos"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.totalreturns")}
|
||||
value={totalReturns.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.discrep3"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepancy")}
|
||||
valueStyle={{
|
||||
color: discrepWithCms.getAmount() === 0 ? "green" : "red",
|
||||
}}
|
||||
value={discrepWithCms.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
let billTotals = Dinero();
|
||||
let billCms = Dinero();
|
||||
let lbrAdjustments = Dinero();
|
||||
let totalReturns = Dinero();
|
||||
let totalReturnsMarkedNotReceived = Dinero();
|
||||
let totalReturnsMarkedReceived = Dinero();
|
||||
|
||||
{showWarning && (
|
||||
discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0
|
||||
) && <Alert style={{margin: "8px 0px"}} type="warning" message={t("jobs.labels.outstanding_reconciliation_discrep")}/>}
|
||||
</Card>
|
||||
</Col>
|
||||
<Col md={24} lg={6} >
|
||||
<Card title={t("jobs.labels.returntotals")} style={{height: "100%"}}>
|
||||
<Space wrap>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.totalreturns"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.totalreturns")}
|
||||
value={totalReturns.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t(
|
||||
"jobs.labels.plitooltips.calculatedcreditsnotreceived"
|
||||
),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.calculatedcreditsnotreceived")}
|
||||
valueStyle={{
|
||||
color:
|
||||
calculatedCreditsNotReceived.getAmount() <= 0
|
||||
? "green"
|
||||
: "red",
|
||||
}}
|
||||
value={
|
||||
calculatedCreditsNotReceived.getAmount() >= 0
|
||||
? calculatedCreditsNotReceived.toFormat()
|
||||
: Dinero().toFormat()
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.creditsnotreceived"),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.creditsnotreceived")}
|
||||
valueStyle={{
|
||||
color:
|
||||
totalReturnsMarkedNotReceived.getAmount() <= 0
|
||||
? "green"
|
||||
: "red",
|
||||
}}
|
||||
value={
|
||||
totalReturnsMarkedNotReceived.getAmount() >= 0
|
||||
? totalReturnsMarkedNotReceived.toFormat()
|
||||
: Dinero().toFormat()
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
{showWarning && (
|
||||
calculatedCreditsNotReceived.getAmount() > 0
|
||||
) && <Alert style={{margin: "8px 0px"}} type="warning" message={t("jobs.labels.outstanding_credit_memos")}/>}
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
partsOrders.forEach((p) =>
|
||||
p.parts_order_lines.forEach((pol) => {
|
||||
if (p.return) {
|
||||
totalReturns = totalReturns.add(
|
||||
Dinero({
|
||||
amount: Math.round((pol.act_price || 0) * 100),
|
||||
}).multiply(pol.quantity)
|
||||
);
|
||||
|
||||
if (pol.cm_received === null) {
|
||||
return; //TODO:AIO This was previously removed. Check if functionality impacted.
|
||||
// Skip this calculation for bills posted prior to the CNR change.
|
||||
} else {
|
||||
if (pol.cm_received === false) {
|
||||
totalReturnsMarkedNotReceived = totalReturnsMarkedNotReceived.add(
|
||||
Dinero({
|
||||
amount: Math.round((pol.act_price || 0) * 100),
|
||||
}).multiply(pol.quantity)
|
||||
);
|
||||
} else {
|
||||
totalReturnsMarkedReceived = totalReturnsMarkedReceived.add(
|
||||
Dinero({
|
||||
amount: Math.round((pol.act_price || 0) * 100),
|
||||
}).multiply(pol.quantity)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
bills.forEach((i) =>
|
||||
i.billlines.forEach((il) => {
|
||||
if (!i.is_credit_memo) {
|
||||
billTotals = billTotals.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
} else {
|
||||
billCms = billCms.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
}
|
||||
if (il.deductedfromlbr) {
|
||||
lbrAdjustments = lbrAdjustments.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const totalPartsSublet = Dinero(totals.parts.parts.total)
|
||||
.add(Dinero(totals.parts.sublets.total))
|
||||
.add(Dinero(totals.additional.shipping))
|
||||
.add(Dinero(totals.additional.towing))
|
||||
.add(
|
||||
InstanceRenderManager({
|
||||
imex: Dinero(),
|
||||
rome: Dinero(totals.additional.additionalCosts),
|
||||
promanager: 'USE_ROME',
|
||||
})
|
||||
); // Additional costs were captured for Rome, but not imex.
|
||||
|
||||
const discrepancy = totalPartsSublet.subtract(billTotals);
|
||||
|
||||
const discrepWithLbrAdj = discrepancy.add(lbrAdjustments);
|
||||
|
||||
const discrepWithCms = discrepWithLbrAdj.add(totalReturns);
|
||||
const calculatedCreditsNotReceived = totalReturns.subtract(billCms); //billCms is tracked as a negative number.
|
||||
|
||||
if (showWarning && warningCallback && typeof warningCallback === 'function') {
|
||||
if (
|
||||
discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0
|
||||
) {
|
||||
warningCallback({
|
||||
key: 'bills',
|
||||
warning: t('jobs.labels.outstanding_reconciliation_discrep'),
|
||||
});
|
||||
}
|
||||
if (calculatedCreditsNotReceived.getAmount() > 0) {
|
||||
warningCallback({ key: 'cm', warning: t('jobs.labels.outstanding_credit_memos') });
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col md={24} lg={18}>
|
||||
<Card title={t('jobs.labels.jobtotals')} style={{ height: '100%' }}>
|
||||
<Space wrap size="large">
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.partstotal'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t('jobs.labels.rosaletotal')} value={totalPartsSublet.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>-</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.billtotal'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t('bills.labels.retailtotal')} value={billTotals.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.discrep1'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t('bills.labels.discrepancy')}
|
||||
valueStyle={{
|
||||
color: discrepancy.getAmount() === 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={discrepancy.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>+</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.laboradj'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t('bills.labels.dedfromlbr')} value={lbrAdjustments.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.discrep2'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t('bills.labels.discrepancy')}
|
||||
valueStyle={{
|
||||
color: discrepWithLbrAdj.getAmount() === 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={discrepWithLbrAdj.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Typography.Title>+</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.creditmemos'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t('bills.labels.totalreturns')} value={totalReturns.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.discrep3'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t('bills.labels.discrepancy')}
|
||||
valueStyle={{
|
||||
color: discrepWithCms.getAmount() === 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={discrepWithCms.toFormat()}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
|
||||
{showWarning &&
|
||||
(discrepWithCms.getAmount() !== 0 ||
|
||||
discrepWithLbrAdj.getAmount() !== 0 ||
|
||||
discrepancy.getAmount() !== 0) && (
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_reconciliation_discrep')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
</Col>
|
||||
<Col md={24} lg={6}>
|
||||
<Card title={t('jobs.labels.returntotals')} style={{ height: '100%' }}>
|
||||
<Space wrap>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.totalreturns'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t('bills.labels.totalreturns')} value={totalReturns.toFormat()} />
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.calculatedcreditsnotreceived'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t('bills.labels.calculatedcreditsnotreceived')}
|
||||
valueStyle={{
|
||||
color: calculatedCreditsNotReceived.getAmount() <= 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={
|
||||
calculatedCreditsNotReceived.getAmount() >= 0
|
||||
? calculatedCreditsNotReceived.toFormat()
|
||||
: Dinero().toFormat()
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t('jobs.labels.plitooltips.creditsnotreceived'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t('bills.labels.creditsnotreceived')}
|
||||
valueStyle={{
|
||||
color: totalReturnsMarkedNotReceived.getAmount() <= 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={
|
||||
totalReturnsMarkedNotReceived.getAmount() >= 0
|
||||
? totalReturnsMarkedNotReceived.toFormat()
|
||||
: Dinero().toFormat()
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
{showWarning && calculatedCreditsNotReceived.getAmount() > 0 && (
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_credit_memos')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
import { Alert, Card } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -20,7 +20,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardProfit);
|
||||
|
||||
export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form }) {
|
||||
export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const total = useMemo(() => {
|
||||
@@ -39,6 +39,12 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form }) {
|
||||
return Dinero({ amount: 0 }).subtract(total);
|
||||
}, [job, total]);
|
||||
|
||||
useEffect(() => {
|
||||
if (balance.getAmount !== 0) {
|
||||
warningCallback({ key: 'ar', warning: t('jobs.labels.outstanding_ar') });
|
||||
}
|
||||
}, [balance, t, warningCallback]);
|
||||
|
||||
return (
|
||||
<Card title={t('jobs.labels.accountsreceivable')} style={{ height: '100%' }}>
|
||||
<DataLabel label={t('payments.labels.totalpayments')}>{total.toFormat()}</DataLabel>
|
||||
@@ -49,7 +55,11 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form }) {
|
||||
{balance.toFormat()}
|
||||
</DataLabel>
|
||||
{balance.getAmount !== 0 && (
|
||||
<Alert style={{margin: "8px 0px"}} type="warning" message={t('jobs.labels.outstanding_ar')} />
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_ar')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
|
||||
import { Badge, Card, Col, Collapse, Row, Space } from 'antd';
|
||||
import { LockOutlined } from '@ant-design/icons';
|
||||
import { Badge, Card, Col, Collapse, Form, Input, Row, Space, Tooltip } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
@@ -25,16 +25,20 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardContainer);
|
||||
|
||||
const colSpans = {
|
||||
md: 24,
|
||||
lg: 12,
|
||||
xl: 8,
|
||||
};
|
||||
export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
const [warnings, setWarnings] = useState([]);
|
||||
|
||||
const warningCallback = useCallback((warning) => setWarnings((state) => [...state, warning]), []);
|
||||
const warningCallback = useCallback(
|
||||
({ key, warning }) =>
|
||||
setWarnings((state) => {
|
||||
if (state.find((s) => s.key === key)) return state;
|
||||
return [...state, { key, warning }];
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
if (!bodyshop?.md_ro_guard?.enabled) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -48,8 +52,15 @@ export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
|
||||
}
|
||||
>
|
||||
<ul>
|
||||
{warnings.map((warning, index) => (
|
||||
<li key={index}>{warning}</li>
|
||||
{warnings.map((w, index) => (
|
||||
<li key={index}>
|
||||
{bodyshop.md_ro_guard[`enforce_${w.key}`] && (
|
||||
<Tooltip title={t('jobs.labels.ro_guard.enforced')}>
|
||||
<LockOutlined style={{ color: 'tomato', marginRight: '8px' }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
{w.warning}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Card>
|
||||
@@ -72,16 +83,135 @@ export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
<Col className="ro-guard-col" md={24} lg={8}>
|
||||
<Col className="ro-guard-col-50" md={24} lg={8}>
|
||||
<JobCloseRoGuardSublet job={job} warningCallback={warningCallback} />
|
||||
<JobCloseRoGuardPpd job={job} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
<Col className="ro-guard-col" md={24} lg={10}>
|
||||
<JobCloseRoGuardLabor job={job} form={form} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
<Col className="ro-guard-col" {...colSpans}>
|
||||
<JobCloseRoGuardPpd job={job} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Form.Item
|
||||
name="masterbypass"
|
||||
label={t('jobs.labels.masterbypass')}
|
||||
rules={[
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
!PasswordCheck({ bodyshop, value }) &&
|
||||
bodyshop.md_ro_guard.enforce_bills &&
|
||||
warnings.find((w) => w.key === 'bills')
|
||||
) {
|
||||
return Promise.reject(t('jobs.labels.ro_guard.enforce_bills'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
!PasswordCheck({ bodyshop, value }) &&
|
||||
bodyshop.md_ro_guard.enforce_cm &&
|
||||
warnings.find((w) => w.key === 'cm')
|
||||
) {
|
||||
return Promise.reject(
|
||||
t('translation.jobs.labels.ro_guard.enforce_validation', {
|
||||
message: t('jobs.labels.ro_guard.enforce_cm'),
|
||||
})
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
!PasswordCheck({ bodyshop, value }) &&
|
||||
bodyshop.md_ro_guard.enforce_profit &&
|
||||
warnings.find((w) => w.key === 'profit')
|
||||
) {
|
||||
return Promise.reject(
|
||||
t('translation.jobs.labels.ro_guard.enforce_validation', {
|
||||
message: t('jobs.labels.ro_guard.enforce_profit'),
|
||||
})
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
!PasswordCheck({ bodyshop, value }) &&
|
||||
bodyshop.md_ro_guard.enforce_ar &&
|
||||
warnings.find((w) => w.key === 'ar')
|
||||
) {
|
||||
return Promise.reject(
|
||||
t('translation.jobs.labels.ro_guard.enforce_validation', {
|
||||
message: t('jobs.labels.ro_guard.enforce_ar'),
|
||||
})
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
!PasswordCheck({ bodyshop, value }) &&
|
||||
bodyshop.md_ro_guard.enforce_sublet &&
|
||||
warnings.find((w) => w.key === 'sublet')
|
||||
) {
|
||||
return Promise.reject(
|
||||
t('translation.jobs.labels.ro_guard.enforce_validation', {
|
||||
message: t('jobs.labels.ro_guard.enforce_sublet'),
|
||||
})
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
!PasswordCheck({ bodyshop, value }) &&
|
||||
bodyshop.md_ro_guard.enforce_ppd &&
|
||||
warnings.find((w) => w.key === 'ppd')
|
||||
) {
|
||||
return Promise.reject(
|
||||
t('translation.jobs.labels.ro_guard.enforce_validation', {
|
||||
message: t('jobs.labels.ro_guard.enforce_ppd'),
|
||||
})
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
!PasswordCheck({ bodyshop, value }) &&
|
||||
bodyshop.md_ro_guard.enforce_labor &&
|
||||
warnings.find((w) => w.key === 'labor')
|
||||
) {
|
||||
return Promise.reject(
|
||||
t('translation.jobs.labels.ro_guard.enforce_validation', {
|
||||
message: t('jobs.labels.ro_guard.enforce_labor'),
|
||||
})
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input
|
||||
prefix={<LockOutlined />}
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
disabled={jobRO}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Collapse.Panel>
|
||||
|
||||
<Collapse.Panel header={t('jobs.labels.performance')}>
|
||||
@@ -95,3 +225,7 @@ export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function PasswordCheck({ bodyshop, value }) {
|
||||
return value === bodyshop?.md_ro_guard?.masterbypass;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
import { Card, Table } from 'antd';
|
||||
import { Alert, Card, Table } from 'antd';
|
||||
import { t } from 'i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
@@ -18,11 +18,17 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRGuardPpd);
|
||||
|
||||
export function JobCloseRGuardPpd({ job, jobRO, bodyshop, form }) {
|
||||
const subletsNotDone = job?.joblines.filter(
|
||||
export function JobCloseRGuardPpd({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const linesWithPPD = job?.joblines.filter(
|
||||
(j) => j.act_price_before_ppc !== 0 && j.act_price_before_ppc !== null
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (linesWithPPD.length > 0) {
|
||||
warningCallback({ key: 'ppd', warning: t('jobs.labels.outstanding_sublets') });
|
||||
}
|
||||
}, [linesWithPPD.length, warningCallback]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t('joblines.fields.line_desc'),
|
||||
@@ -71,15 +77,22 @@ export function JobCloseRGuardPpd({ job, jobRO, bodyshop, form }) {
|
||||
];
|
||||
|
||||
return (
|
||||
<Card title={t('jobs.labels.subletsnotcompleted')}>
|
||||
<Card title={t('jobs.labels.ppdnotexported')}>
|
||||
<Table
|
||||
dataSource={subletsNotDone}
|
||||
dataSource={linesWithPPD}
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
rowKey="id"
|
||||
bordered
|
||||
size="small"
|
||||
/>
|
||||
{linesWithPPD.length > 0 && (
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_ppd')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallb
|
||||
}, [job.id]);
|
||||
|
||||
const enforceProfitPassword =
|
||||
parseFloat(costingData?.summaryData.gppercent) < bodyshop?.md_ro_guard?.totalgppercent_minimum; //TODO Add bodyshop related values.
|
||||
parseFloat(costingData?.summaryData.gppercent) < bodyshop?.md_ro_guard?.totalgppercent_minimum;
|
||||
|
||||
useEffect(() => {
|
||||
if (enforceProfitPassword && typeof warningCallback === 'function') {
|
||||
warningCallback(t('jobs.labels.profitbypassrequired'));
|
||||
warningCallback({ key: 'profit', warning: t('jobs.labels.profitbypassrequired') });
|
||||
}
|
||||
}, [enforceProfitPassword, t, warningCallback]);
|
||||
|
||||
@@ -55,32 +55,6 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallb
|
||||
return (
|
||||
<Card title={t('jobs.labels.profits')} style={{ height: '100%' }}>
|
||||
<JobCostingStatistics summaryData={costingData?.summaryData} onlyGP />
|
||||
|
||||
{enforceProfitPassword && (
|
||||
<Form.Item
|
||||
name="profitbypasspassword"
|
||||
label={t('jobs.labels.profitbypasspassword')}
|
||||
rules={[
|
||||
{
|
||||
required: enforceProfitPassword,
|
||||
},
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (
|
||||
parseFloat(costingData?.summaryData.gppercent) <
|
||||
bodyshop?.md_ro_guard?.totalgppercent_minimum &&
|
||||
value !== bodyshop.md_ro_guard.profitbypasspassword
|
||||
) {
|
||||
return Promise.reject(t('jobs.labels.profitbypassrequired'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input prefix={<LockOutlined />} type="password" placeholder="Password" />
|
||||
</Form.Item>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,3 +3,8 @@
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.ro-guard-col-50 {
|
||||
.ant-card {
|
||||
height: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export function JobCloseRGuardSublet({ job, jobRO, bodyshop, form, warningCallba
|
||||
|
||||
useEffect(() => {
|
||||
if (subletsNotDone.length > 0) {
|
||||
warningCallback(t('jobs.labels.outstanding_sublets'));
|
||||
warningCallback({ key: 'sublet', warning: t('jobs.labels.outstanding_sublets') });
|
||||
}
|
||||
}, [subletsNotDone.length, warningCallback]);
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardTTLif
|
||||
export function JobCloseRoGuardTTLifeCycle({ job, jobRO, bodyshop, form }) {
|
||||
return (
|
||||
<div>
|
||||
//TODO Add Touch Time
|
||||
<JobLifecycleComponent job={job} statuses={bodyshop.md_ro_statuses} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -205,7 +205,7 @@ export function LaborAllocationsTable({
|
||||
);
|
||||
|
||||
if (summary.difference !== 0 && typeof warningCallback === 'function') {
|
||||
warningCallback(t('jobs.labels.outstandinghours'));
|
||||
warningCallback({key: 'labor',warning: t('jobs.labels.outstandinghours')});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ export function PayrollLaborAllocationsTable({
|
||||
);
|
||||
|
||||
if (summary.difference !== 0 && typeof warningCallback === 'function') {
|
||||
warningCallback(t('jobs.labels.outstandinghours'));
|
||||
warningCallback({key: 'labor', warning: t('jobs.labels.outstandinghours')});
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
111
client/src/components/shop-info/shop-info.roguard.component.jsx
Normal file
111
client/src/components/shop-info/shop-info.roguard.component.jsx
Normal 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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user