Bug fixes and formatting for RO guard.

This commit is contained in:
Patrick Fic
2024-04-11 09:49:00 -07:00
parent e5599ff4c4
commit 453236cf3a
11 changed files with 146 additions and 130 deletions

View File

@@ -34201,6 +34201,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>profitbypassrequired</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>profits</name>
<definition_loaded>false</definition_loaded>

View File

@@ -1,20 +1,20 @@
import React from 'react';
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';
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,
jobRO: selectJobReadOnly
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
@@ -24,21 +24,21 @@ 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',
fetchPolicy: "network-only",
nextFetchPolicy: "network-only"
});
const {
treatments: { Enhanced_Payroll },
treatments: { Enhanced_Payroll }
} = useSplitTreatments({
attributes: {},
names: ['Enhanced_Payroll'],
splitKey: bodyshop.imexshopid,
names: ["Enhanced_Payroll"],
splitKey: bodyshop.imexshopid
});
if (loading) return <LoadingSkeleton />;
if (error) return <AlertComponent message={error.message} type="error" />;
return Enhanced_Payroll.treatment === 'on' ? (
return Enhanced_Payroll.treatment === "on" ? (
<PayrollLaborAllocationsTable
jobId={job.id}
timetickets={data ? data.timetickets : []}

View File

@@ -1,19 +1,19 @@
import React, { useEffect } from 'react';
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';
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,
jobRO: selectJobReadOnly
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
@@ -41,25 +41,21 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallb
useEffect(() => {
if (balance.getAmount() !== 0) {
warningCallback({ key: 'ar', warning: t('jobs.labels.outstanding_ar') });
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>
<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')}
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')}
/>
<Alert style={{ margin: "8px 0px" }} type="warning" message={t("jobs.labels.outstanding_ar")} />
)}
</Card>
);

View File

@@ -1,17 +1,17 @@
import React from 'react';
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';
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,
jobRO: selectJobReadOnly
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
@@ -21,8 +21,8 @@ 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',
fetchPolicy: "network-only",
nextFetchPolicy: "network-only"
});
if (error) return <AlertComponent message={error.message} type="error" />;

View File

@@ -76,20 +76,27 @@ export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
<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}
/>
<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} /> })}
{InstanceRenderManager({
imex: (
<Col md={24} lg={8}>
{/* <JobCloseRoGuardSublet job={job} warningCallback={warningCallback} /> */}
<JobCloseRoGuardPpd job={job} warningCallback={warningCallback} />
</Col>
),
rome: (
<Col 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>

View File

@@ -1,20 +1,19 @@
import React, { useEffect, useState } from 'react';
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';
import { Alert, Card } 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,
jobRO: selectJobReadOnly
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
@@ -31,7 +30,7 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallb
try {
if (job.id) {
setLoading(true);
const { data } = await axios.post('/job/costing', { jobid: job.id });
const { data } = await axios.post("/job/costing", { jobid: job.id });
setCostingData(data);
}
} catch (error) {}
@@ -45,16 +44,19 @@ export function JobCloseRoGuardProfit({ job, jobRO, bodyshop, form, warningCallb
parseFloat(costingData?.summaryData.gppercent) < bodyshop?.md_ro_guard?.totalgppercent_minimum;
useEffect(() => {
if (enforceProfitPassword && typeof warningCallback === 'function') {
warningCallback({ key: 'profit', warning: t('jobs.labels.profitbypassrequired') });
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%' }}>
<Card title={t("jobs.labels.profits")} style={{ height: "100%" }}>
<JobCostingStatistics summaryData={costingData?.summaryData} onlyGP />
{enforceProfitPassword && (
<Alert style={{ margin: "8px 0px" }} type="warning" message={t("jobs.labels.profitbypassrequired")} />
)}
</Card>
);
}

View File

@@ -1,17 +1,17 @@
import React, { useEffect } from 'react';
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';
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,
jobRO: selectJobReadOnly
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
@@ -20,69 +20,56 @@ 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)
(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',
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',
className: record.manual_line && "job-line-manual",
style: {
...(record.critical ? { boxShadow: ' -.5em 0 0 #FFC107' } : {}),
},
...(record.critical ? { boxShadow: " -.5em 0 0 #FFC107" } : {})
}
}),
ellipsis: true,
ellipsis: true
},
{
title: t('joblines.fields.act_price'),
dataIndex: 'act_price',
key: 'act_price',
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>,
render: (text, record) => <CurrencyFormatter>{record.act_price}</CurrencyFormatter>
},
{
title: t('joblines.fields.part_qty'),
dataIndex: 'part_qty',
key: 'part_qty',
title: t("joblines.fields.part_qty"),
dataIndex: "part_qty",
key: "part_qty"
},
{
title: t('joblines.fields.notes'),
dataIndex: 'notes',
key: 'notes',
},
title: t("joblines.fields.notes"),
dataIndex: "notes",
key: "notes"
}
];
useEffect(() => {
if (subletsNotDone.length > 0) {
warningCallback({ key: 'sublet', warning: t('jobs.labels.outstanding_sublets') });
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"
/>
<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')}
/>
<Alert style={{ margin: "8px 0px" }} type="warning" message={t("jobs.labels.outstanding_sublets")} />
)}
</Card>
);

View File

@@ -1,14 +1,14 @@
import React from 'react';
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';
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,
jobRO: selectJobReadOnly
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))

View File

@@ -2003,6 +2003,7 @@
"ppc": "This line contains a part price change.",
"ppdnotexported": "PPDs not Exported",
"profileadjustments": "Profile Disc./Mkup",
"profitbypassrequired": "Minimum gross profit requirements have not been met.",
"profits": "Job Profits",
"prt_dsmk_total": "Line Item Adjustment",
"rates": "Rates",

View File

@@ -2003,6 +2003,7 @@
"ppc": "",
"ppdnotexported": "",
"profileadjustments": "",
"profitbypassrequired": "",
"profits": "",
"prt_dsmk_total": "",
"rates": "Tarifas",

View File

@@ -2003,6 +2003,7 @@
"ppc": "",
"ppdnotexported": "",
"profileadjustments": "",
"profitbypassrequired": "",
"profits": "",
"prt_dsmk_total": "",
"rates": "Les taux",