WIP RO Closer.
This commit is contained in:
@@ -33645,6 +33645,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>prt_dsmk_total</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
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 }) {
|
||||
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 : []}
|
||||
/>
|
||||
) : (
|
||||
<LaborAllocationsTableComponent
|
||||
jobId={job.id}
|
||||
joblines={data ? data.joblines : []}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
refetch={refetch}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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 }) {
|
||||
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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Col, Row } from 'antd';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import JobCloseRoGuardBills from './job-close-ro-guard.bills';
|
||||
import JobCloseRoGuardTotals from './job-close-ro-guard.totals';
|
||||
import JobCloseRoGuardLabor from './job-close-ro-gaurd.labor';
|
||||
import JobCloseRoGuardTtLifecycle from './job-close-ro-guard.tt-lifecycle';
|
||||
import JobCloseRoGuardProfit from './job-close-ro-guard.profit';
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardContainer);
|
||||
|
||||
const colSpans = {
|
||||
md: 24,
|
||||
lg: 12,
|
||||
xl: 8,
|
||||
};
|
||||
export function JobCloseRoGuardContainer({ job, jobRO, bodyshop, form }) {
|
||||
return (
|
||||
<Row gutter={[32,32]}>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardBills job={job} form={form} />
|
||||
</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardProfit job={job} form={form} />
|
||||
</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardTotals job={job} />
|
||||
</Col>
|
||||
<Col {...colSpans}>AR Balance</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardLabor job={job} form={form} />
|
||||
</Col>
|
||||
<Col {...colSpans}>Sublet Manager</Col>
|
||||
<Col {...colSpans}>PPD Check</Col>
|
||||
<Col {...colSpans}>
|
||||
<JobCloseRoGuardTtLifecycle job={job} />
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import axios from 'axios';
|
||||
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 { Card, Form, Input, Space } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { LockOutlined } from '@ant-design/icons';
|
||||
|
||||
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 }) {
|
||||
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]);
|
||||
|
||||
if (loading || !costingData) return <LoadingSkeleton />;
|
||||
|
||||
const enforceProfitPassword = parseFloat(costingData?.summaryData.gppercent) < 90;
|
||||
return (
|
||||
<Card title={t('jobs.labels.profits')}>
|
||||
<Space direction="horizontal">
|
||||
<JobCostingStatistics summaryData={costingData?.summaryData} onlyGP />
|
||||
</Space>{' '}
|
||||
{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
|
||||
) {
|
||||
console.log('We shoudl enforce it.');
|
||||
return Promise.reject(t('jobs.labels.profitbypassrequired'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input prefix={<LockOutlined />} type="password" placeholder="Password" />
|
||||
</Form.Item>
|
||||
)}
|
||||
</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,25 @@
|
||||
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>
|
||||
Add Touch Time
|
||||
<JobLifecycleComponent job={job} statuses={bodyshop.md_ro_statuses} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,63 +1,64 @@
|
||||
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}) {
|
||||
const {t} = useTranslation();
|
||||
export default function JobCostingStatistics({ summaryData, onlyGP }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const gpTotals = (
|
||||
<>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.gpdollars).toFormat()}
|
||||
title={t('jobs.labels.gpdollars')}
|
||||
/>
|
||||
<Statistic value={summaryData.gppercentFormatted} title={t('jobs.labels.gppercent')} />
|
||||
</>
|
||||
);
|
||||
if (onlyGP) return gpTotals;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
||||
<Space className="imex-flex-row imex-flex-row__flex-space-around">
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalLaborSales).toFormat()}
|
||||
title={t("jobs.labels.sale_labor")}
|
||||
title={t('jobs.labels.sale_labor')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalPartsSales).toFormat()}
|
||||
title={t("jobs.labels.sale_parts")}
|
||||
title={t('jobs.labels.sale_parts')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalSubletSales).toFormat()}
|
||||
title={t("jobs.labels.sale_sublet")}
|
||||
title={t('jobs.labels.sale_sublet')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalAdditionalSales).toFormat()}
|
||||
title={t("jobs.labels.sale_additional")}
|
||||
title={t('jobs.labels.sale_additional')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalSales).toFormat()}
|
||||
title={t("jobs.labels.total_sales")}
|
||||
title={t('jobs.labels.total_sales')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalLaborCost).toFormat()}
|
||||
title={t("jobs.labels.cost_labor")}
|
||||
title={t('jobs.labels.cost_labor')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalPartsCost).toFormat()}
|
||||
title={t("jobs.labels.cost_parts")}
|
||||
title={t('jobs.labels.cost_parts')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalSubletCost).toFormat()}
|
||||
title={t("jobs.labels.cost_sublet")}
|
||||
title={t('jobs.labels.cost_sublet')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalAdditionalCost).toFormat()}
|
||||
title={t("jobs.labels.cost_Additional")}
|
||||
title={t('jobs.labels.cost_Additional')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.totalCost).toFormat()}
|
||||
title={t("jobs.labels.total_cost")}
|
||||
title={t('jobs.labels.total_cost')}
|
||||
/>
|
||||
<Statistic
|
||||
value={Dinero(summaryData.gpdollars).toFormat()}
|
||||
title={t("jobs.labels.gpdollars")}
|
||||
/>
|
||||
<Statistic
|
||||
value={summaryData.gppercentFormatted}
|
||||
title={t("jobs.labels.gppercent")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import {insertAuditTrail} from "../../redux/application/application.actions";
|
||||
import {selectJobReadOnly} from "../../redux/application/application.selectors";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||
import JobCloseRoGuardContainer from '../../components/job-close-ro-guard/job-close-ro-guard.container';
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -193,7 +194,7 @@ export function JobsCloseComponent({job, bodyshop, jobRO, insertAuditTrail}) {
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
|
||||
<JobCloseRoGuardContainer form={form} job={job} />
|
||||
<Space wrap direction="vertical" style={{width: "100%"}}>
|
||||
<FormsFieldChanged form={form}/>
|
||||
{!job.actual_in && job.scheduled_in && (
|
||||
|
||||
@@ -1973,6 +1973,7 @@
|
||||
},
|
||||
"ppc": "This line contains a part price change.",
|
||||
"profileadjustments": "Profile Disc./Mkup",
|
||||
"profitbypassrequired": "Profit margin requirements not met. Bypass password required.",
|
||||
"prt_dsmk_total": "Line Item Adjustment",
|
||||
"rates": "Rates",
|
||||
"rates_subtotal": "All Rates Subtotal",
|
||||
|
||||
@@ -1973,6 +1973,7 @@
|
||||
},
|
||||
"ppc": "",
|
||||
"profileadjustments": "",
|
||||
"profitbypassrequired": "",
|
||||
"prt_dsmk_total": "",
|
||||
"rates": "Tarifas",
|
||||
"rates_subtotal": "",
|
||||
|
||||
@@ -1973,6 +1973,7 @@
|
||||
},
|
||||
"ppc": "",
|
||||
"profileadjustments": "",
|
||||
"profitbypassrequired": "",
|
||||
"prt_dsmk_total": "",
|
||||
"rates": "Les taux",
|
||||
"rates_subtotal": "",
|
||||
|
||||
Reference in New Issue
Block a user