@@ -1,9 +1,8 @@
|
||||
import React, { useState } from "react";
|
||||
import { Button, Form, InputNumber, Popover } from "antd";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { CalculatorFilled } from "@ant-design/icons";
|
||||
|
||||
import { Button, Form, InputNumber, Popover, Space } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
export default function CABCpvrtCalculator({ disabled, form }) {
|
||||
const [visibility, setVisibility] = useState(false);
|
||||
|
||||
@@ -27,10 +26,14 @@ export default function CABCpvrtCalculator({ disabled, form }) {
|
||||
<Form.Item name="days" label={t("jobs.labels.ca_bc_pvrt.days")}>
|
||||
<InputNumber precision={0} min={0} />
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit">
|
||||
{t("general.actions.calculate")}
|
||||
</Button>
|
||||
<Button onClick={() => setVisibility(false)}>Close</Button>
|
||||
<div style={{ display: "flex", justifyContent: "flex-end" }}>
|
||||
<Space>
|
||||
<Button type="primary" htmlType="submit">
|
||||
{t("general.actions.calculate")}
|
||||
</Button>
|
||||
<Button onClick={() => setVisibility(false)}>Close</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -11,11 +11,15 @@ import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel
|
||||
import CourtesyCarReadiness from "../courtesy-car-readiness-select/courtesy-car-readiness-select.component";
|
||||
import CourtesyCarStatus from "../courtesy-car-status-select/courtesy-car-status-select.component";
|
||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
//import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
||||
export default function CourtesyCarCreateFormComponent({
|
||||
form,
|
||||
saveLoading,
|
||||
newCC,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const client = useApolloClient();
|
||||
|
||||
@@ -30,7 +34,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
||||
}
|
||||
/>
|
||||
|
||||
{/* <FormFieldsChanged form={form} /> */}
|
||||
{newCC ? null : <FormFieldsChanged form={form} />}
|
||||
<LayoutFormRow header={t("courtesycars.labels.vehicle")}>
|
||||
<Form.Item
|
||||
label={t("courtesycars.fields.year")}
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
import { Card, Col, Row, Space, Statistic, Tooltip, Typography } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import "./job-bills-total.styles.scss";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
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 }) {
|
||||
export default function JobBillsTotalComponent({
|
||||
loading,
|
||||
bills,
|
||||
partsOrders,
|
||||
jobTotals,
|
||||
showWarning,
|
||||
warningCallback,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (loading) return <LoadingSkeleton />;
|
||||
if (!!!jobTotals) return <AlertComponent type="error" message={t("jobs.errors.nofinancial")} />;
|
||||
if (!!!jobTotals) {
|
||||
if (showWarning && warningCallback && typeof warningCallback === 'function') {
|
||||
warningCallback({ key: 'bills', warning: t('jobs.errors.nofinancial') });
|
||||
}
|
||||
return <AlertComponent type="error" message={t('jobs.errors.nofinancial')} />;
|
||||
}
|
||||
|
||||
const totals = jobTotals;
|
||||
|
||||
@@ -97,48 +109,64 @@ export default function JobBillsTotalComponent({ loading, bills, partsOrders, jo
|
||||
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}>
|
||||
<Col span={18}>
|
||||
<Card title={t("jobs.labels.jobtotals")} style={{ height: "100%" }}>
|
||||
<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")
|
||||
__html: t('jobs.labels.plitooltips.partstotal'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t("jobs.labels.rosaletotal")} value={totalPartsSublet.toFormat()} />
|
||||
<Statistic title={t('jobs.labels.rosaletotal')} value={totalPartsSublet.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>-</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.billtotal")
|
||||
__html: t('jobs.labels.plitooltips.billtotal'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t("bills.labels.retailtotal")} value={billTotals.toFormat()} />
|
||||
<Statistic title={t('bills.labels.retailtotal')} value={billTotals.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.discrep1")
|
||||
__html: t('jobs.labels.plitooltips.discrep1'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepancy")}
|
||||
title={t('bills.labels.discrepancy')}
|
||||
valueStyle={{
|
||||
color: discrepancy.getAmount() === 0 ? "green" : "red"
|
||||
color: discrepancy.getAmount() === 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={discrepancy.toFormat()}
|
||||
/>
|
||||
@@ -148,27 +176,27 @@ export default function JobBillsTotalComponent({ loading, bills, partsOrders, jo
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.laboradj")
|
||||
__html: t('jobs.labels.plitooltips.laboradj'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t("bills.labels.dedfromlbr")} value={lbrAdjustments.toFormat()} />
|
||||
<Statistic title={t('bills.labels.dedfromlbr')} value={lbrAdjustments.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.discrep2")
|
||||
__html: t('jobs.labels.plitooltips.discrep2'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepancy")}
|
||||
title={t('bills.labels.discrepancy')}
|
||||
valueStyle={{
|
||||
color: discrepWithLbrAdj.getAmount() === 0 ? "green" : "red"
|
||||
color: discrepWithLbrAdj.getAmount() === 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={discrepWithLbrAdj.toFormat()}
|
||||
/>
|
||||
@@ -178,61 +206,72 @@ export default function JobBillsTotalComponent({ loading, bills, partsOrders, jo
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.creditmemos")
|
||||
__html: t('jobs.labels.plitooltips.creditmemos'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t("bills.labels.totalreturns")} value={totalReturns.toFormat()} />
|
||||
<Statistic title={t('bills.labels.totalreturns')} value={totalReturns.toFormat()} />
|
||||
</Tooltip>
|
||||
<Typography.Title>=</Typography.Title>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.discrep3")
|
||||
__html: t('jobs.labels.plitooltips.discrep3'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepancy")}
|
||||
title={t('bills.labels.discrepancy')}
|
||||
valueStyle={{
|
||||
color: discrepWithCms.getAmount() === 0 ? "green" : "red"
|
||||
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 span={6}>
|
||||
<Card title={t("jobs.labels.returntotals")} style={{ height: "100%" }}>
|
||||
<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")
|
||||
__html: t('jobs.labels.plitooltips.totalreturns'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic title={t("bills.labels.totalreturns")} value={totalReturns.toFormat()} />
|
||||
<Statistic title={t('bills.labels.totalreturns')} value={totalReturns.toFormat()} />
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.calculatedcreditsnotreceived")
|
||||
__html: t('jobs.labels.plitooltips.calculatedcreditsnotreceived'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.calculatedcreditsnotreceived")}
|
||||
title={t('bills.labels.calculatedcreditsnotreceived')}
|
||||
valueStyle={{
|
||||
color: calculatedCreditsNotReceived.getAmount() <= 0 ? "green" : "red"
|
||||
color: calculatedCreditsNotReceived.getAmount() <= 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={
|
||||
calculatedCreditsNotReceived.getAmount() >= 0
|
||||
@@ -245,15 +284,15 @@ export default function JobBillsTotalComponent({ loading, bills, partsOrders, jo
|
||||
title={
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: t("jobs.labels.plitooltips.creditsnotreceived")
|
||||
__html: t('jobs.labels.plitooltips.creditsnotreceived'),
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Statistic
|
||||
title={t("bills.labels.creditsnotreceived")}
|
||||
title={t('bills.labels.creditsnotreceived')}
|
||||
valueStyle={{
|
||||
color: totalReturnsMarkedNotReceived.getAmount() <= 0 ? "green" : "red"
|
||||
color: totalReturnsMarkedNotReceived.getAmount() <= 0 ? 'green' : 'red',
|
||||
}}
|
||||
value={
|
||||
totalReturnsMarkedNotReceived.getAmount() >= 0
|
||||
@@ -263,6 +302,13 @@ export default function JobBillsTotalComponent({ loading, bills, partsOrders, jo
|
||||
/>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
{showWarning && calculatedCreditsNotReceived.getAmount() > 0 && (
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_credit_memos')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import React from 'react';
|
||||
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { useSplitTreatments } from '@splitsoftware/splitio-react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { GET_LINE_TICKET_BY_PK } from '../../graphql/jobs-lines.queries';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import AlertComponent from '../alert/alert.component';
|
||||
import LaborAllocationsTableComponent from '../labor-allocations-table/labor-allocations-table.component';
|
||||
import PayrollLaborAllocationsTable from '../labor-allocations-table/labor-allocations-table.payroll.component';
|
||||
import LoadingSkeleton from '../loading-skeleton/loading-skeleton.component';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardLabor);
|
||||
|
||||
export function JobCloseRoGuardLabor({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, {
|
||||
variables: { id: job.id },
|
||||
fetchPolicy: 'network-only',
|
||||
nextFetchPolicy: 'network-only',
|
||||
});
|
||||
const {
|
||||
treatments: { Enhanced_Payroll },
|
||||
} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ['Enhanced_Payroll'],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
if (loading) return <LoadingSkeleton />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
return Enhanced_Payroll.treatment === 'on' ? (
|
||||
<PayrollLaborAllocationsTable
|
||||
jobId={job.id}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
refetch={refetch}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
showWarning
|
||||
warningCallback={warningCallback}
|
||||
/>
|
||||
) : (
|
||||
<LaborAllocationsTableComponent
|
||||
jobId={job.id}
|
||||
joblines={data ? data.joblines : []}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
refetch={refetch}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
showWarning
|
||||
warningCallback={warningCallback}
|
||||
disabled={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
import { Alert, Card } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import { useMemo } from 'react';
|
||||
import Dinero from 'dinero.js';
|
||||
import DataLabel from '../data-label/data-label.component';
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardProfit);
|
||||
|
||||
export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const total = useMemo(() => {
|
||||
return (
|
||||
job.payments &&
|
||||
job.payments.reduce((acc, val) => {
|
||||
acc = acc.add(Dinero({ amount: Math.round(val.amount * 100) }));
|
||||
return acc;
|
||||
}, Dinero())
|
||||
);
|
||||
}, [job.payments]);
|
||||
|
||||
const balance = useMemo(() => {
|
||||
if (job && job.job_totals && job.job_totals.totals.total_repairs)
|
||||
return Dinero(job.job_totals.totals.total_repairs).subtract(total);
|
||||
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>
|
||||
<DataLabel
|
||||
valueStyle={{ color: balance.getAmount() !== 0 ? 'red' : 'green' }}
|
||||
label={t('payments.labels.balance')}
|
||||
>
|
||||
{balance.toFormat()}
|
||||
</DataLabel>
|
||||
{balance.getAmount() !== 0 && (
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_ar')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import React from 'react';
|
||||
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { QUERY_BILLS_BY_JOBID } from '../../graphql/bills.queries';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import AlertComponent from '../alert/alert.component';
|
||||
import JobBillsTotalComponent from '../job-bills-total/job-bills-total.component';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardBills);
|
||||
|
||||
export function JobCloseRoGuardBills({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const { loading, error, data } = useQuery(QUERY_BILLS_BY_JOBID, {
|
||||
variables: { jobid: job.id },
|
||||
fetchPolicy: 'network-only',
|
||||
nextFetchPolicy: 'network-only',
|
||||
});
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
return (
|
||||
<JobBillsTotalComponent
|
||||
loading={loading}
|
||||
bills={data ? data.bills : []}
|
||||
partsOrders={data ? data.parts_orders : []}
|
||||
jobTotals={job.job_totals}
|
||||
showWarning
|
||||
warningCallback={warningCallback}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
import React, { useCallback, useState } from "react";
|
||||
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";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import JobCloseRoGuardLabor from "./job-close-ro-gaurd.labor";
|
||||
import JobCloseRoGuardAr from "./job-close-ro-guard.ar";
|
||||
import JobCloseRoGuardBills from "./job-close-ro-guard.bills";
|
||||
import JobCloseRoGuardPpd from "./job-close-ro-guard.ppd";
|
||||
import JobCloseRoGuardProfit from "./job-close-ro-guard.profit";
|
||||
import "./job-close-ro-guard.styles.scss";
|
||||
import JobCloseRoGuardSublet from "./job-close-ro-guard.sublet";
|
||||
import JobCloseRoGuardTtLifecycle from "./job-close-ro-guard.tt-lifecycle";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardContainer);
|
||||
|
||||
export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
|
||||
const { t } = useTranslation();
|
||||
const [warnings, setWarnings] = useState([]);
|
||||
|
||||
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 (
|
||||
<>
|
||||
{warnings.length > 0 && (
|
||||
<Card
|
||||
title={
|
||||
<Space size="small">
|
||||
<Badge count={warnings.length} />
|
||||
{t("jobs.labels.roguardwarnings")}
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<ul>
|
||||
{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>
|
||||
)}
|
||||
|
||||
<Collapse>
|
||||
<Collapse.Panel forceRender key="roguard" header={t("jobs.labels.roguard")}>
|
||||
<Row gutter={[32, 32]}>
|
||||
<Col span={24}>
|
||||
<JobCloseRoGuardBills job={job} form={form} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
<Col className="ro-guard-col-multiple" md={24} lg={6}>
|
||||
<Row gutter={[32, 32]} style={{ height: "100%" }}>
|
||||
<Col span={24}>
|
||||
<JobCloseRoGuardProfit
|
||||
job={job}
|
||||
form={form} //warningCallback={warningCallback}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<JobCloseRoGuardAr job={job} form={form} warningCallback={warningCallback} />
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
<Col className="ro-guard-col-50" md={24} lg={8}>
|
||||
<JobCloseRoGuardSublet job={job} warningCallback={warningCallback} />
|
||||
{InstanceRenderManager({ rome: <JobCloseRoGuardPpd job={job} warningCallback={warningCallback} /> })}
|
||||
</Col>
|
||||
<Col className="ro-guard-col" md={24} lg={10}>
|
||||
<JobCloseRoGuardLabor job={job} form={form} 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_validation", {
|
||||
message: 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("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("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("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("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("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("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")}>
|
||||
<Row gutter={[32, 32]}>
|
||||
<Col className="ro-guard-col" span={24}>
|
||||
<JobCloseRoGuardTtLifecycle job={job} />
|
||||
</Col>
|
||||
</Row>
|
||||
</Collapse.Panel>
|
||||
</Collapse>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function PasswordCheck({ bodyshop, value }) {
|
||||
return value === bodyshop?.md_ro_guard?.masterbypass;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import { Alert, Card, Table } from "antd";
|
||||
import { t } from "i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRGuardPpd);
|
||||
|
||||
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"),
|
||||
dataIndex: "line_desc",
|
||||
fixed: "left",
|
||||
key: "line_desc",
|
||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||
onCell: (record) => ({
|
||||
className: record.manual_line && "job-line-manual",
|
||||
style: {
|
||||
...(record.critical ? { boxShadow: " -.5em 0 0 #FFC107" } : {})
|
||||
}
|
||||
}),
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("joblines.fields.act_price"),
|
||||
dataIndex: "act_price",
|
||||
key: "act_price",
|
||||
sorter: (a, b) => a.act_price - b.act_price,
|
||||
|
||||
ellipsis: true,
|
||||
render: (text, record) => <CurrencyFormatter>{record.act_price}</CurrencyFormatter>
|
||||
},
|
||||
{
|
||||
title: t("joblines.fields.act_price_before_ppc"),
|
||||
dataIndex: "act_price_before_ppc",
|
||||
key: "act_price_before_ppc",
|
||||
sorter: (a, b) => a.act_price_before_ppc - b.act_price_before_ppc,
|
||||
|
||||
ellipsis: true,
|
||||
render: (text, record) => <CurrencyFormatter>{record.act_price_before_ppc}</CurrencyFormatter>
|
||||
},
|
||||
{
|
||||
title: t("joblines.fields.part_qty"),
|
||||
dataIndex: "part_qty",
|
||||
key: "part_qty"
|
||||
},
|
||||
{
|
||||
title: t("joblines.fields.notes"),
|
||||
dataIndex: "notes",
|
||||
key: "notes"
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<Card title={t("jobs.labels.ppdnotexported")}>
|
||||
<Table 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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { LockOutlined } from '@ant-design/icons';
|
||||
import { Card, Form, Input } from 'antd';
|
||||
import axios from 'axios';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import JobCostingStatistics from '../job-costing-statistics/job-costing-statistics.component';
|
||||
import LoadingSkeleton from '../loading-skeleton/loading-skeleton.component';
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardProfit);
|
||||
|
||||
export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const [costingData, setCostingData] = useState(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
async function getData() {
|
||||
try {
|
||||
if (job.id) {
|
||||
setLoading(true);
|
||||
const { data } = await axios.post('/job/costing', { jobid: job.id });
|
||||
setCostingData(data);
|
||||
}
|
||||
} catch (error) {}
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
getData();
|
||||
}, [job.id]);
|
||||
|
||||
const enforceProfitPassword =
|
||||
parseFloat(costingData?.summaryData.gppercent) < bodyshop?.md_ro_guard?.totalgppercent_minimum;
|
||||
|
||||
useEffect(() => {
|
||||
if (enforceProfitPassword && typeof warningCallback === 'function') {
|
||||
warningCallback({ key: 'profit', warning: t('jobs.labels.profitbypassrequired') });
|
||||
}
|
||||
}, [enforceProfitPassword, t, warningCallback]);
|
||||
|
||||
if (loading || !costingData) return <LoadingSkeleton />;
|
||||
|
||||
return (
|
||||
<Card title={t('jobs.labels.profits')} style={{ height: '100%' }}>
|
||||
<JobCostingStatistics summaryData={costingData?.summaryData} onlyGP />
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
.ro-guard-col {
|
||||
.ant-card {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.ro-guard-col-50 {
|
||||
.ant-card {
|
||||
height: 50%;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
import { Alert, Card, Table } from 'antd';
|
||||
import { t } from 'i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import CurrencyFormatter from '../../utils/CurrencyFormatter';
|
||||
import { alphaSort } from '../../utils/sorters';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRGuardSublet);
|
||||
|
||||
export function JobCloseRGuardSublet({ job, jobRO, bodyshop, form, warningCallback }) {
|
||||
const subletsNotDone = job?.joblines.filter(
|
||||
(j) =>
|
||||
(j.part_type === 'PAS' || j.part_type === 'PASL') &&
|
||||
(!j.sublet_completed || !j.sublet_ignored)
|
||||
);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t('joblines.fields.line_desc'),
|
||||
dataIndex: 'line_desc',
|
||||
fixed: 'left',
|
||||
key: 'line_desc',
|
||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||
onCell: (record) => ({
|
||||
className: record.manual_line && 'job-line-manual',
|
||||
style: {
|
||||
...(record.critical ? { boxShadow: ' -.5em 0 0 #FFC107' } : {}),
|
||||
},
|
||||
}),
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.act_price'),
|
||||
dataIndex: 'act_price',
|
||||
key: 'act_price',
|
||||
sorter: (a, b) => a.act_price - b.act_price,
|
||||
|
||||
ellipsis: true,
|
||||
render: (text, record) => <CurrencyFormatter>{record.act_price}</CurrencyFormatter>,
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.part_qty'),
|
||||
dataIndex: 'part_qty',
|
||||
key: 'part_qty',
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.notes'),
|
||||
dataIndex: 'notes',
|
||||
key: 'notes',
|
||||
},
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
if (subletsNotDone.length > 0) {
|
||||
warningCallback({ key: 'sublet', warning: t('jobs.labels.outstanding_sublets') });
|
||||
}
|
||||
}, [subletsNotDone.length, warningCallback]);
|
||||
|
||||
return (
|
||||
<Card title={t('jobs.labels.subletsnotcompleted')}>
|
||||
<Table
|
||||
dataSource={subletsNotDone}
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
rowKey="id"
|
||||
bordered
|
||||
size="small"
|
||||
/>
|
||||
{subletsNotDone.length > 0 && (
|
||||
<Alert
|
||||
style={{ margin: '8px 0px' }}
|
||||
type="warning"
|
||||
message={t('jobs.labels.outstanding_sublets')}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import JobTotalsTableTotals from '../job-totals-table/job-totals.table.totals.component';
|
||||
import { Card } from 'antd';
|
||||
import { t } from 'i18next';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRGuardTotals);
|
||||
|
||||
export function JobCloseRGuardTotals({ job, jobRO, bodyshop, form }) {
|
||||
return (
|
||||
<Card title={t("jobs.labels.cards.totals")}>
|
||||
<JobTotalsTableTotals job={job} />
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import JobLifecycleComponent from '../job-lifecycle/job-lifecycle.component';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardTTLifeCycle);
|
||||
|
||||
export function JobCloseRoGuardTTLifeCycle({ job, jobRO, bodyshop, form }) {
|
||||
return (
|
||||
<div>
|
||||
<JobLifecycleComponent job={job} statuses={bodyshop.md_ro_statuses} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,35 @@
|
||||
import { Statistic } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Dinero from "dinero.js";
|
||||
import { Space, Statistic } from 'antd';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import Dinero from 'dinero.js';
|
||||
|
||||
export default function JobCostingStatistics({ summaryData }) {
|
||||
export default function JobCostingStatistics({ summaryData, onlyGP }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const gpTotals = (
|
||||
<>
|
||||
<Space wrap direction="horizontal" size={'large'}>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalSales).toFormat()}
|
||||
title={t('jobs.labels.total_sales')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalCost).toFormat()}
|
||||
title={t('jobs.labels.total_cost')}
|
||||
/>
|
||||
</Space>{' '}
|
||||
<Space wrap direction="horizontal" size={'large'}>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.gpdollars).toFormat()}
|
||||
title={t('jobs.labels.gpdollars')}
|
||||
/>
|
||||
<Statistic value={summaryData.gppercentFormatted} title={t('jobs.labels.gppercent')} />
|
||||
</Space>
|
||||
</>
|
||||
);
|
||||
|
||||
if (onlyGP) return gpTotals;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
||||
|
||||
@@ -98,11 +98,11 @@ export function JobLinesExpander({jobline, jobid, bodyshop, currentUser}) {
|
||||
)
|
||||
}))
|
||||
: [
|
||||
{
|
||||
key: "no-orders",
|
||||
children: t("parts_orders.labels.notyetordered")
|
||||
}
|
||||
]
|
||||
{
|
||||
key: "no-orders",
|
||||
children: t("bills.labels.nobilllines")
|
||||
}
|
||||
]
|
||||
}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
@@ -133,6 +133,7 @@ export function JobPayments({
|
||||
}
|
||||
];
|
||||
|
||||
//Same as in RO guard. If changed, update in both.
|
||||
const total = useMemo(() => {
|
||||
return (
|
||||
job.payments &&
|
||||
|
||||
@@ -125,16 +125,6 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail
|
||||
args: [estData.est_data, bodyshop]
|
||||
});
|
||||
|
||||
// }
|
||||
// const newTotals = (
|
||||
// await Axios.post("/job/totals", {
|
||||
// job: {
|
||||
// ...estData.est_data,
|
||||
// joblines: estData.est_data.joblines.data,
|
||||
// },
|
||||
// })
|
||||
// ).data;
|
||||
|
||||
let existingVehicles;
|
||||
if (estData.est_data.v_vin) {
|
||||
//There's vehicle data, need to double-check the VIN.
|
||||
@@ -148,9 +138,6 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail
|
||||
|
||||
const newJob = {
|
||||
...estData.est_data,
|
||||
// clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
|
||||
// owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
|
||||
// job_totals: newTotals,
|
||||
date_open: dayjs(),
|
||||
status: bodyshop.md_ro_statuses.default_imported,
|
||||
notes: {
|
||||
@@ -246,13 +233,6 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail
|
||||
let supp = replaceEmpty({ ...estData.est_data });
|
||||
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
||||
|
||||
await InstanceRenderManager({
|
||||
executeFunction: true,
|
||||
imex: CheckTaxRates,
|
||||
rome: CheckTaxRatesUSA,
|
||||
promanager: CheckTaxRatesUSA,
|
||||
args: [(supp, bodyshop)]
|
||||
});
|
||||
await InstanceRenderManager({
|
||||
executeFunction: true,
|
||||
rome: ResolveCCCLineIssues,
|
||||
@@ -260,6 +240,14 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail
|
||||
args: [(supp, bodyshop)]
|
||||
});
|
||||
|
||||
await InstanceRenderManager({
|
||||
executeFunction: true,
|
||||
imex: CheckTaxRates,
|
||||
rome: CheckTaxRatesUSA,
|
||||
promanager: CheckTaxRatesUSA,
|
||||
args: [supp, bodyshop]
|
||||
});
|
||||
|
||||
delete supp.owner;
|
||||
delete supp.vehicle;
|
||||
delete supp.ins_co_nm;
|
||||
@@ -282,11 +270,6 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail
|
||||
jobId: selectedJob,
|
||||
job: {
|
||||
...supp,
|
||||
// clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
|
||||
// owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat(
|
||||
// "0.00"
|
||||
// ),
|
||||
// job_totals: newTotals,
|
||||
queued_for_parts: partsQueueToggle
|
||||
}
|
||||
}
|
||||
@@ -609,32 +592,35 @@ function ResolveCCCLineIssues(estData, bodyshop) {
|
||||
//Group by line no
|
||||
// For everything but the first one, strip out the price number in
|
||||
|
||||
// InstanceRenderManager({executeFunction:true, args:[], promanager: () => {
|
||||
// const groupedByLineRef = _.groupBy(estData.joblines.data, "line_ref");
|
||||
// Object.keys(groupedByLineRef).forEach((lineRef) => {
|
||||
// let index0ActPrice;
|
||||
// groupedByLineRef[lineRef].forEach((line, index) => {
|
||||
// //Let the first one keep it
|
||||
// if (index === 0){
|
||||
// index0ActPrice = line.act_price;
|
||||
// return;}
|
||||
// //Web Est seems to have additional costs with UNQ_SEQ 0. Keep them all?
|
||||
// if (line.unq_seq === 0) return;
|
||||
// if(index0ActPrice !== line.act_price){
|
||||
// line.notes += ` | Price override.`;
|
||||
// return;
|
||||
// }
|
||||
// const indexInEstData = estData.joblines.data.findIndex(
|
||||
// (l) => l.unq_seq === line.unq_seq
|
||||
// );
|
||||
// estData.joblines.data[
|
||||
// indexInEstData
|
||||
// ].notes += ` | Scrubbed due to the line_ref issue. (prev act price = ${estData.joblines.data[indexInEstData].act_price})`;
|
||||
// estData.joblines.data[indexInEstData].act_price = 0;
|
||||
// estData.joblines.data[indexInEstData].db_price = 0;
|
||||
// });
|
||||
// })
|
||||
// }})
|
||||
InstanceRenderManager({
|
||||
executeFunction: true,
|
||||
args: [],
|
||||
promanager: () => {
|
||||
const groupedByLineRef = _.groupBy(estData.joblines.data, "line_ref");
|
||||
Object.keys(groupedByLineRef).forEach((lineRef) => {
|
||||
let index0ActPrice;
|
||||
groupedByLineRef[lineRef].forEach((line, index) => {
|
||||
//Let the first one keep it
|
||||
if (index === 0) {
|
||||
index0ActPrice = line.act_price;
|
||||
return;
|
||||
}
|
||||
//Web Est seems to have additional costs with UNQ_SEQ 0. Keep them all?
|
||||
if (line.unq_seq === 0) return;
|
||||
if (index0ActPrice !== line.act_price) {
|
||||
line.notes += ` | Price override.`;
|
||||
return;
|
||||
}
|
||||
const indexInEstData = estData.joblines.data.findIndex((l) => l.unq_seq === line.unq_seq);
|
||||
estData.joblines.data[
|
||||
indexInEstData
|
||||
].notes += ` | Scrubbed due to the line_ref issue. (prev act price = ${estData.joblines.data[indexInEstData].act_price})`;
|
||||
estData.joblines.data[indexInEstData].act_price = 0;
|
||||
estData.joblines.data[indexInEstData].db_price = 0;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
InstanceRenderManager({
|
||||
executeFunction: true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EditFilled } from "@ant-design/icons";
|
||||
import { Card, Col, Row, Space, Table, Typography } from "antd";
|
||||
import { Alert, Card, Col, Row, Space, Table, Typography } from "antd";
|
||||
import _ from "lodash";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -18,7 +18,17 @@ const mapStateToProps = createStructuredSelector({
|
||||
technician: selectTechnician
|
||||
});
|
||||
|
||||
export function LaborAllocationsTable({ jobId, joblines, timetickets, bodyshop, adjustments, technician }) {
|
||||
export function LaborAllocationsTable({
|
||||
jobId,
|
||||
joblines,
|
||||
timetickets,
|
||||
bodyshop,
|
||||
adjustments,
|
||||
technician,
|
||||
showWarning,
|
||||
warningCallback,
|
||||
disabled
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [totals, setTotals] = useState([]);
|
||||
const [state, setState] = useState({
|
||||
@@ -73,7 +83,7 @@ export function LaborAllocationsTable({ jobId, joblines, timetickets, bodyshop,
|
||||
render: (text, record) => (
|
||||
<Space wrap>
|
||||
{record.adjustments.toFixed(1)}
|
||||
{!technician && (
|
||||
{!technician && !disabled && (
|
||||
<LaborAllocationsAdjustmentEdit
|
||||
jobId={jobId}
|
||||
adjustments={adjustments}
|
||||
@@ -176,6 +186,10 @@ export function LaborAllocationsTable({ jobId, joblines, timetickets, bodyshop,
|
||||
{ hrs_total: 0, hrs_claimed: 0, adjustments: 0, difference: 0 }
|
||||
);
|
||||
|
||||
if (summary.difference !== 0 && typeof warningCallback === "function") {
|
||||
warningCallback({ key: "labor", warning: t("jobs.labels.outstandinghours") });
|
||||
}
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
@@ -227,6 +241,9 @@ export function LaborAllocationsTable({ jobId, joblines, timetickets, bodyshop,
|
||||
</Card>
|
||||
</Col>
|
||||
)}
|
||||
{showWarning && summary.difference !== 0 && (
|
||||
<Alert style={{ margin: "8px 0px" }} type="warning" message={t("jobs.labels.outstandinghours")} />
|
||||
)}
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Card, Col, notification, Row, Space, Table, Typography } from "antd";
|
||||
import { Alert, Button, Card, Col, notification, Row, Space, Table, Typography } from "antd";
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
@@ -23,7 +23,9 @@ export function PayrollLaborAllocationsTable({
|
||||
bodyshop,
|
||||
adjustments,
|
||||
technician,
|
||||
refetch
|
||||
refetch,
|
||||
showWarning,
|
||||
warningCallback
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [totals, setTotals] = useState([]);
|
||||
@@ -191,6 +193,10 @@ export function PayrollLaborAllocationsTable({
|
||||
{ hrs_total: 0, hrs_claimed: 0, adjustments: 0, difference: 0 }
|
||||
);
|
||||
|
||||
if (summary.difference !== 0 && typeof warningCallback === "function") {
|
||||
warningCallback({ key: "labor", warning: t("jobs.labels.outstandinghours") });
|
||||
}
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
@@ -285,6 +291,9 @@ export function PayrollLaborAllocationsTable({
|
||||
</Card>
|
||||
</Col>
|
||||
)}
|
||||
{showWarning && summary.difference !== 0 && (
|
||||
<Alert style={{ margin: "8px 0px" }} type="warning" message={t("jobs.labels.outstandinghours")} />
|
||||
)}
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
|
||||
import { Button, Form, Modal, notification, Space } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
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
|
||||
@@ -111,7 +112,18 @@ export function ShopInfoComponent({ bodyshop, form, saveLoading }) {
|
||||
children: <ShopInfoTaskPresets form={form} />
|
||||
}
|
||||
]
|
||||
: [])
|
||||
: []),
|
||||
...InstanceRenderManager({
|
||||
imex: [
|
||||
{
|
||||
key: 'roguard',
|
||||
label: t('bodyshop.labels.roguard.title'),
|
||||
children: <ShopInfoRoGuard form={form} />,
|
||||
},
|
||||
],
|
||||
rome: 'USE_IMEX',
|
||||
promanager: [],
|
||||
}),
|
||||
];
|
||||
return (
|
||||
<Card
|
||||
|
||||
116
client/src/components/shop-info/shop-info.roguard.component.jsx
Normal file
116
client/src/components/shop-info/shop-info.roguard.component.jsx
Normal file
@@ -0,0 +1,116 @@
|
||||
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";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
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>
|
||||
|
||||
{InstanceRenderManager({
|
||||
rome: (
|
||||
<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