Merge remote-tracking branch 'origin/master' into feature/payroll
This commit is contained in:
@@ -8890,6 +8890,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>tt_enforce_hours_for_tech_console</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>
|
<concept_node>
|
||||||
<name>use_fippa</name>
|
<name>use_fippa</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -17435,6 +17456,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>total</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>
|
<concept_node>
|
||||||
<name>totals</name>
|
<name>totals</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -45189,6 +45231,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>hoursenteredmorethanavailable</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>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -91,11 +91,13 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
|||||||
b.v_make_desc + b.v_model_desc
|
b.v_make_desc + b.v_model_desc
|
||||||
),
|
),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "ownr" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
<Link to={`/manage/vehicles/${record.vehicleid}`}>{`${
|
||||||
record.v_model_desc || ""
|
record.v_model_yr || ""
|
||||||
} ${record.v_color || ""} ${record.plate_no || ""}`}</span>
|
} ${record.v_make_desc || ""} ${record.v_model_desc || ""} ${
|
||||||
|
record.v_color || ""
|
||||||
|
} ${record.plate_no || ""}`}</Link>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export function ProductionListTable({
|
|||||||
state,
|
state,
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).find((e) => e.key === k.key),
|
}).find((e) => e.key === k.key),
|
||||||
width: k.width,
|
width: k.width ?? 100,
|
||||||
};
|
};
|
||||||
})) ||
|
})) ||
|
||||||
[]
|
[]
|
||||||
@@ -267,6 +267,8 @@ export function ProductionListTable({
|
|||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
||||||
title: headerItem(c),
|
title: headerItem(c),
|
||||||
|
ellipsis: true,
|
||||||
|
width: c.width ?? 100,
|
||||||
onHeaderCell: (column) => ({
|
onHeaderCell: (column) => ({
|
||||||
width: column.width,
|
width: column.width,
|
||||||
onResize: handleResize(index),
|
onResize: handleResize(index),
|
||||||
@@ -276,11 +278,12 @@ export function ProductionListTable({
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
loading={loading}
|
loading={loading}
|
||||||
dataSource={dataSource}
|
dataSource={dataSource}
|
||||||
// scroll={{ x: true }}
|
scroll={{ x: 1000 }}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
/>
|
/>
|
||||||
</ReactDragListView.DragColumn>
|
</ReactDragListView.DragColumn>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(ProductionListTable);
|
export default connect(mapStateToProps, null)(ProductionListTable);
|
||||||
|
|||||||
@@ -3,8 +3,26 @@ import { Resizable } from "react-resizable";
|
|||||||
|
|
||||||
export default function ResizableComponent(props) {
|
export default function ResizableComponent(props) {
|
||||||
const { onResize, width, ...restProps } = props;
|
const { onResize, width, ...restProps } = props;
|
||||||
|
|
||||||
|
if (!width) {
|
||||||
|
return <th {...restProps} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Resizable width={width || 200} height={0} onResize={onResize}>
|
<Resizable
|
||||||
|
width={width || 200}
|
||||||
|
height={0}
|
||||||
|
onResize={onResize}
|
||||||
|
draggableOpts={{ enableUserSelectHack: false }}
|
||||||
|
handle={
|
||||||
|
<span
|
||||||
|
className="react-resizable-handle"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
<th {...restProps} />
|
<th {...restProps} />
|
||||||
</Resizable>
|
</Resizable>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Card, Statistic } from "antd";
|
import { Card, Divider, Statistic } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -41,6 +41,9 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) {
|
|||||||
label="P"
|
label="P"
|
||||||
value={paintHrs.toFixed(1)}
|
value={paintHrs.toFixed(1)}
|
||||||
/>
|
/>
|
||||||
|
<Divider style={{ margin: 0 }} />
|
||||||
|
|
||||||
|
<Statistic value={(bodyHrs + paintHrs).toFixed(1)} />
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { CalendarOutlined } from "@ant-design/icons";
|
import { CalendarOutlined } from "@ant-design/icons";
|
||||||
import { Card, Col, Row, Statistic } from "antd";
|
import { Card, Col, Divider, Row, Statistic } from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
@@ -177,6 +177,9 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
<Statistic value={values.toDatePaint.toFixed(1)} />
|
<Statistic value={values.toDatePaint.toFixed(1)} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Divider style={{ margin: 5 }} />
|
||||||
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Col {...statSpans}></Col>
|
<Col {...statSpans}></Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
@@ -184,14 +187,53 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
value={(values.todayPaint + values.todayBody).toFixed(1)}
|
value={(values.todayPaint + values.todayBody).toFixed(1)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col {...statSpans}></Col>
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={(values.weeklyPaint + values.weeklyBody).toFixed(1)}
|
value={(values.weeklyPaint + values.weeklyBody).toFixed(1)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col {...statSpans}></Col>
|
<Col {...statSpans}>
|
||||||
<Col {...statSpans}></Col>
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={(values.toDatePaint + values.toDateBody).toFixed(1)}
|
value={(values.toDatePaint + values.toDateBody).toFixed(1)}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ export default function ScoreboardTimeTickets() {
|
|||||||
totalLastMonth: 0,
|
totalLastMonth: 0,
|
||||||
totalOverPeriod: 0,
|
totalOverPeriod: 0,
|
||||||
actualTotalOverPeriod: 0,
|
actualTotalOverPeriod: 0,
|
||||||
|
totalEffieciencyOverPeriod: 0,
|
||||||
employees: {},
|
employees: {},
|
||||||
};
|
};
|
||||||
data.fixedperiod.forEach((ticket) => {
|
data.fixedperiod.forEach((ticket) => {
|
||||||
@@ -94,6 +95,7 @@ export default function ScoreboardTimeTickets() {
|
|||||||
totalLastMonth: 0,
|
totalLastMonth: 0,
|
||||||
totalOverPeriod: 0,
|
totalOverPeriod: 0,
|
||||||
actualTotalOverPeriod: 0,
|
actualTotalOverPeriod: 0,
|
||||||
|
totalEffieciencyOverPeriod: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,6 +223,28 @@ export default function ScoreboardTimeTickets() {
|
|||||||
|
|
||||||
ret2.push(r);
|
ret2.push(r);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add total efficiency of employees
|
||||||
|
const totalActualAndProductive = Object.keys(ret.employees)
|
||||||
|
.map((key) => {
|
||||||
|
return { employee_number: key, ...ret.employees[key] };
|
||||||
|
})
|
||||||
|
.reduce(
|
||||||
|
(acc, e) => {
|
||||||
|
return {
|
||||||
|
totalOverPeriod: acc.totalOverPeriod + e.totalOverPeriod,
|
||||||
|
actualTotalOverPeriod:
|
||||||
|
acc.actualTotalOverPeriod + e.actualTotalOverPeriod,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{ totalOverPeriod: 0, actualTotalOverPeriod: 0 }
|
||||||
|
);
|
||||||
|
|
||||||
|
ret.totalEffieciencyOverPeriod =
|
||||||
|
(totalActualAndProductive.totalOverPeriod /
|
||||||
|
totalActualAndProductive.actualTotalOverPeriod) *
|
||||||
|
100;
|
||||||
|
|
||||||
roundObject(ret);
|
roundObject(ret);
|
||||||
roundObject(totals);
|
roundObject(totals);
|
||||||
roundObject(ret2);
|
roundObject(ret2);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
|||||||
key: "efficiencyoverperiod",
|
key: "efficiencyoverperiod",
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
`${(
|
`${(
|
||||||
(record.totalOverPeriod / (record.actualTotalOverPeriod || .1)) *
|
(record.totalOverPeriod / (record.actualTotalOverPeriod || 0.1)) *
|
||||||
100
|
100
|
||||||
).toFixed(1)} %`,
|
).toFixed(1)} %`,
|
||||||
},
|
},
|
||||||
@@ -113,6 +113,12 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
|||||||
value={data.totalOverPeriod}
|
value={data.totalOverPeriod}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.efficiencyoverperiod")}
|
||||||
|
value={`${data.totalEffieciencyOverPeriod}%`}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Typography.Text type="secondary">
|
<Typography.Text type="secondary">
|
||||||
{t("scoreboard.labels.calendarperiod")}
|
{t("scoreboard.labels.calendarperiod")}
|
||||||
@@ -121,7 +127,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
|||||||
<Col md={24} lg={20}>
|
<Col md={24} lg={20}>
|
||||||
<Table
|
<Table
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey='employee_number'
|
rowKey="employee_number"
|
||||||
dataSource={tableData}
|
dataSource={tableData}
|
||||||
id="employee_number"
|
id="employee_number"
|
||||||
scroll={{ y: "300px" }}
|
scroll={{ y: "300px" }}
|
||||||
|
|||||||
@@ -589,6 +589,13 @@ export default function ShopInfoGeneral({ form }) {
|
|||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={["tt_enforce_hours_for_tech_console"]}
|
||||||
|
label={t("bodyshop.fields.tt_enforce_hours_for_tech_console")}
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={["bill_allow_post_to_closed"]}
|
name={["bill_allow_post_to_closed"]}
|
||||||
label={t("bodyshop.fields.bill_allow_post_to_closed")}
|
label={t("bodyshop.fields.bill_allow_post_to_closed")}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation, useQuery } from "@apollo/client";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@@ -21,6 +21,8 @@ import { selectTechnician } from "../../redux/tech/tech.selectors";
|
|||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import TechJobClockoutDelete from "../tech-job-clock-out-delete/tech-job-clock-out-delete.component";
|
import TechJobClockoutDelete from "../tech-job-clock-out-delete/tech-job-clock-out-delete.component";
|
||||||
import { LaborAllocationContainer } from "../time-ticket-modal/time-ticket-modal.component";
|
import { LaborAllocationContainer } from "../time-ticket-modal/time-ticket-modal.component";
|
||||||
|
import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries";
|
||||||
|
import { CalculateAllocationsTotals } from "../labor-allocations-table/labor-allocations-table.utility";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -39,7 +41,17 @@ export function TechClockOffButton({
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [updateTimeticket] = useMutation(UPDATE_TIME_TICKET);
|
const [updateTimeticket] = useMutation(UPDATE_TIME_TICKET);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
const { queryLoading, data: lineTicketData } = useQuery(
|
||||||
|
GET_LINE_TICKET_BY_PK,
|
||||||
|
{
|
||||||
|
variables: {
|
||||||
|
id: jobId,
|
||||||
|
},
|
||||||
|
skip: !jobId,
|
||||||
|
fetchPolicy: "network-only",
|
||||||
|
nextFetchPolicy: "network-only",
|
||||||
|
}
|
||||||
|
);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const emps = bodyshop.employees.filter(
|
const emps = bodyshop.employees.filter(
|
||||||
(e) => e.id === (technician && technician.id)
|
(e) => e.id === (technician && technician.id)
|
||||||
@@ -129,6 +141,54 @@ export function TechClockOffButton({
|
|||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
|
({ getFieldValue }) => ({
|
||||||
|
validator(rule, value) {
|
||||||
|
console.log(
|
||||||
|
bodyshop.tt_enforce_hours_for_tech_console
|
||||||
|
);
|
||||||
|
if (!bodyshop.tt_enforce_hours_for_tech_console) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!value ||
|
||||||
|
getFieldValue("cost_center") === null ||
|
||||||
|
!lineTicketData
|
||||||
|
)
|
||||||
|
return Promise.resolve();
|
||||||
|
|
||||||
|
//Check the cost center,
|
||||||
|
const totals = CalculateAllocationsTotals(
|
||||||
|
bodyshop,
|
||||||
|
lineTicketData.joblines,
|
||||||
|
lineTicketData.timetickets,
|
||||||
|
lineTicketData.jobs_by_pk.lbr_adjustments
|
||||||
|
);
|
||||||
|
|
||||||
|
const fieldTypeToCheck =
|
||||||
|
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||||
|
? "mod_lbr_ty"
|
||||||
|
: "cost_center";
|
||||||
|
|
||||||
|
const costCenterDiff =
|
||||||
|
Math.round(
|
||||||
|
totals.find(
|
||||||
|
(total) =>
|
||||||
|
total[fieldTypeToCheck] ===
|
||||||
|
getFieldValue("cost_center")
|
||||||
|
)?.difference * 10
|
||||||
|
) / 10;
|
||||||
|
|
||||||
|
if (value > costCenterDiff)
|
||||||
|
return Promise.reject(
|
||||||
|
t(
|
||||||
|
"timetickets.validation.hoursenteredmorethanavailable"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
else {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber min={0} precision={1} />
|
<InputNumber min={0} precision={1} />
|
||||||
@@ -178,7 +238,11 @@ export function TechClockOffButton({
|
|||||||
</Col>
|
</Col>
|
||||||
{!isShiftTicket && (
|
{!isShiftTicket && (
|
||||||
<Col span={16}>
|
<Col span={16}>
|
||||||
<LaborAllocationContainer jobid={jobId} />
|
<LaborAllocationContainer
|
||||||
|
jobid={jobId || null}
|
||||||
|
loading={queryLoading}
|
||||||
|
lineTicketData={lineTicketData}
|
||||||
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
)}
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
import { useLazyQuery } from "@apollo/client";
|
||||||
import { Form, Input, InputNumber, Select, Switch } from "antd";
|
import { Form, Input, InputNumber, Select, Switch } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -14,6 +14,7 @@ import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
|||||||
import FormDateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
import FormDateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
||||||
import JobSearchSelect from "../job-search-select/job-search-select.component";
|
import JobSearchSelect from "../job-search-select/job-search-select.component";
|
||||||
import LaborAllocationsTable from "../labor-allocations-table/labor-allocations-table.component";
|
import LaborAllocationsTable from "../labor-allocations-table/labor-allocations-table.component";
|
||||||
|
import { CalculateAllocationsTotals } from "../labor-allocations-table/labor-allocations-table.utility";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||||
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
|
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
@@ -39,7 +40,11 @@ export function TimeTicketModalComponent({
|
|||||||
employeeSelectDisabled,
|
employeeSelectDisabled,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const [loadLineTicketData, { called, loading, data: lineTicketData }] =
|
||||||
|
useLazyQuery(GET_LINE_TICKET_BY_PK, {
|
||||||
|
fetchPolicy: "network-only",
|
||||||
|
nextFetchPolicy: "network-only",
|
||||||
|
});
|
||||||
const CostCenterSelect = ({ emps, value, ...props }) => {
|
const CostCenterSelect = ({ emps, value, ...props }) => {
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
@@ -178,7 +183,52 @@ export function TimeTicketModalComponent({
|
|||||||
label={t("timetickets.fields.productivehrs")}
|
label={t("timetickets.fields.productivehrs")}
|
||||||
name="productivehrs"
|
name="productivehrs"
|
||||||
rules={[
|
rules={[
|
||||||
{
|
({ getFieldValue }) => ({
|
||||||
|
validator(rule, value) {
|
||||||
|
if (!bodyshop.tt_enforce_hours_for_tech_console) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!value ||
|
||||||
|
getFieldValue("cost_center") === null ||
|
||||||
|
!lineTicketData
|
||||||
|
)
|
||||||
|
return Promise.resolve();
|
||||||
|
|
||||||
|
//Check the cost center,
|
||||||
|
const totals = CalculateAllocationsTotals(
|
||||||
|
bodyshop,
|
||||||
|
lineTicketData.joblines,
|
||||||
|
lineTicketData.timetickets,
|
||||||
|
lineTicketData.jobs_by_pk.lbr_adjustments
|
||||||
|
);
|
||||||
|
|
||||||
|
const fieldTypeToCheck =
|
||||||
|
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||||
|
? "mod_lbr_ty"
|
||||||
|
: "cost_center";
|
||||||
|
|
||||||
|
const costCenterDiff =
|
||||||
|
Math.round(
|
||||||
|
totals.find(
|
||||||
|
(total) =>
|
||||||
|
total[fieldTypeToCheck] ===
|
||||||
|
getFieldValue("cost_center")
|
||||||
|
)?.difference * 10
|
||||||
|
) / 10;
|
||||||
|
|
||||||
|
if (value > costCenterDiff)
|
||||||
|
return Promise.reject(
|
||||||
|
t(
|
||||||
|
"timetickets.validation.hoursenteredmorethanavailable"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
else {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{
|
||||||
required:
|
required:
|
||||||
form.getFieldValue("cost_center") !==
|
form.getFieldValue("cost_center") !==
|
||||||
"timetickets.labels.shift",
|
"timetickets.labels.shift",
|
||||||
@@ -300,23 +350,28 @@ export function TimeTicketModalComponent({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<Form.Item dependencies={["jobid"]}>
|
<Form.Item dependencies={["jobid"]}>
|
||||||
{() => (
|
{() => {
|
||||||
<LaborAllocationContainer
|
const jobid = form.getFieldValue("jobid");
|
||||||
jobid={form.getFieldValue("jobid") || null}
|
if (
|
||||||
/>
|
(!called && jobid) ||
|
||||||
)}
|
(jobid && lineTicketData?.jobs_by_pk?.id !== jobid && !loading)
|
||||||
|
) {
|
||||||
|
loadLineTicketData({ variables: { id: jobid } });
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<LaborAllocationContainer
|
||||||
|
jobid={jobid || null}
|
||||||
|
loading={loading}
|
||||||
|
lineTicketData={lineTicketData}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LaborAllocationContainer({ jobid }) {
|
export function LaborAllocationContainer({ jobid, loading, lineTicketData }) {
|
||||||
const { loading, data: lineTicketData } = useQuery(GET_LINE_TICKET_BY_PK, {
|
|
||||||
variables: { id: jobid },
|
|
||||||
skip: !jobid,
|
|
||||||
fetchPolicy: "network-only",
|
|
||||||
nextFetchPolicy: "network-only",
|
|
||||||
});
|
|
||||||
if (loading) return <LoadingSkeleton />;
|
if (loading) return <LoadingSkeleton />;
|
||||||
if (!lineTicketData) return null;
|
if (!lineTicketData) return null;
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ export const QUERY_BODYSHOP = gql`
|
|||||||
md_lost_sale_reasons
|
md_lost_sale_reasons
|
||||||
md_parts_scan
|
md_parts_scan
|
||||||
enforce_conversion_category
|
enforce_conversion_category
|
||||||
|
tt_enforce_hours_for_tech_console
|
||||||
employees {
|
employees {
|
||||||
user_email
|
user_email
|
||||||
id
|
id
|
||||||
@@ -230,6 +231,7 @@ export const UPDATE_SHOP = gql`
|
|||||||
md_lost_sale_reasons
|
md_lost_sale_reasons
|
||||||
md_parts_scan
|
md_parts_scan
|
||||||
enforce_conversion_category
|
enforce_conversion_category
|
||||||
|
tt_enforce_hours_for_tech_console
|
||||||
employees {
|
employees {
|
||||||
id
|
id
|
||||||
first_name
|
first_name
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
|
|||||||
clm_no
|
clm_no
|
||||||
v_make_desc
|
v_make_desc
|
||||||
v_color
|
v_color
|
||||||
|
vehicleid
|
||||||
plate_no
|
plate_no
|
||||||
actual_in
|
actual_in
|
||||||
scheduled_completion
|
scheduled_completion
|
||||||
|
|||||||
@@ -544,6 +544,7 @@
|
|||||||
"target_touchtime": "Target Touch Time",
|
"target_touchtime": "Target Touch Time",
|
||||||
"timezone": "Timezone",
|
"timezone": "Timezone",
|
||||||
"tt_allow_post_to_invoiced": "Allow Time Tickets to be posted to Invoiced & Exported Jobs",
|
"tt_allow_post_to_invoiced": "Allow Time Tickets to be posted to Invoiced & Exported Jobs",
|
||||||
|
"tt_enforce_hours_for_tech_console": "Restrict Claimable hours from Tech Console",
|
||||||
"use_fippa": "Use FIPPA for Names on Generated Documents?",
|
"use_fippa": "Use FIPPA for Names on Generated Documents?",
|
||||||
"uselocalmediaserver": "Use Local Media Server?",
|
"uselocalmediaserver": "Use Local Media Server?",
|
||||||
"website": "Website",
|
"website": "Website",
|
||||||
@@ -1076,6 +1077,7 @@
|
|||||||
"sunday": "Sunday",
|
"sunday": "Sunday",
|
||||||
"text": "Text",
|
"text": "Text",
|
||||||
"thursday": "Thursday",
|
"thursday": "Thursday",
|
||||||
|
"total": "Total",
|
||||||
"totals": "Totals",
|
"totals": "Totals",
|
||||||
"tuesday": "Tuesday",
|
"tuesday": "Tuesday",
|
||||||
"unknown": "Unknown",
|
"unknown": "Unknown",
|
||||||
@@ -2675,7 +2677,8 @@
|
|||||||
},
|
},
|
||||||
"validation": {
|
"validation": {
|
||||||
"clockoffmustbeafterclockon": "Clock off time must be the same or after clock in time.",
|
"clockoffmustbeafterclockon": "Clock off time must be the same or after clock in time.",
|
||||||
"clockoffwithoutclockon": "Clock off time cannot be set without a clock in time."
|
"clockoffwithoutclockon": "Clock off time cannot be set without a clock in time.",
|
||||||
|
"hoursenteredmorethanavailable": "The number of hours entered is more than what is available for this cost center."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
|
|||||||
@@ -544,6 +544,7 @@
|
|||||||
"target_touchtime": "",
|
"target_touchtime": "",
|
||||||
"timezone": "",
|
"timezone": "",
|
||||||
"tt_allow_post_to_invoiced": "",
|
"tt_allow_post_to_invoiced": "",
|
||||||
|
"tt_enforce_hours_for_tech_console": "",
|
||||||
"use_fippa": "",
|
"use_fippa": "",
|
||||||
"uselocalmediaserver": "",
|
"uselocalmediaserver": "",
|
||||||
"website": "",
|
"website": "",
|
||||||
@@ -1076,6 +1077,7 @@
|
|||||||
"sunday": "",
|
"sunday": "",
|
||||||
"text": "",
|
"text": "",
|
||||||
"thursday": "",
|
"thursday": "",
|
||||||
|
"total": "",
|
||||||
"totals": "",
|
"totals": "",
|
||||||
"tuesday": "",
|
"tuesday": "",
|
||||||
"unknown": "Desconocido",
|
"unknown": "Desconocido",
|
||||||
@@ -2675,7 +2677,8 @@
|
|||||||
},
|
},
|
||||||
"validation": {
|
"validation": {
|
||||||
"clockoffmustbeafterclockon": "",
|
"clockoffmustbeafterclockon": "",
|
||||||
"clockoffwithoutclockon": ""
|
"clockoffwithoutclockon": "",
|
||||||
|
"hoursenteredmorethanavailable": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
|
|||||||
@@ -544,6 +544,7 @@
|
|||||||
"target_touchtime": "",
|
"target_touchtime": "",
|
||||||
"timezone": "",
|
"timezone": "",
|
||||||
"tt_allow_post_to_invoiced": "",
|
"tt_allow_post_to_invoiced": "",
|
||||||
|
"tt_enforce_hours_for_tech_console": "",
|
||||||
"use_fippa": "",
|
"use_fippa": "",
|
||||||
"uselocalmediaserver": "",
|
"uselocalmediaserver": "",
|
||||||
"website": "",
|
"website": "",
|
||||||
@@ -1076,6 +1077,7 @@
|
|||||||
"sunday": "",
|
"sunday": "",
|
||||||
"text": "",
|
"text": "",
|
||||||
"thursday": "",
|
"thursday": "",
|
||||||
|
"total": "",
|
||||||
"totals": "",
|
"totals": "",
|
||||||
"tuesday": "",
|
"tuesday": "",
|
||||||
"unknown": "Inconnu",
|
"unknown": "Inconnu",
|
||||||
@@ -2675,7 +2677,8 @@
|
|||||||
},
|
},
|
||||||
"validation": {
|
"validation": {
|
||||||
"clockoffmustbeafterclockon": "",
|
"clockoffmustbeafterclockon": "",
|
||||||
"clockoffwithoutclockon": ""
|
"clockoffwithoutclockon": "",
|
||||||
|
"hoursenteredmorethanavailable": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
|
|||||||
@@ -935,6 +935,7 @@
|
|||||||
- textid
|
- textid
|
||||||
- timezone
|
- timezone
|
||||||
- tt_allow_post_to_invoiced
|
- tt_allow_post_to_invoiced
|
||||||
|
- tt_enforce_hours_for_tech_console
|
||||||
- updated_at
|
- updated_at
|
||||||
- use_fippa
|
- use_fippa
|
||||||
- uselocalmediaserver
|
- uselocalmediaserver
|
||||||
@@ -1023,6 +1024,7 @@
|
|||||||
- target_touchtime
|
- target_touchtime
|
||||||
- timezone
|
- timezone
|
||||||
- tt_allow_post_to_invoiced
|
- tt_allow_post_to_invoiced
|
||||||
|
- tt_enforce_hours_for_tech_console
|
||||||
- updated_at
|
- updated_at
|
||||||
- use_fippa
|
- use_fippa
|
||||||
- uselocalmediaserver
|
- uselocalmediaserver
|
||||||
@@ -2391,30 +2393,32 @@
|
|||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
columns:
|
columns:
|
||||||
- id
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- jobid
|
|
||||||
- billid
|
- billid
|
||||||
|
- bodyshopid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- jobid
|
||||||
|
- message
|
||||||
|
- metadata
|
||||||
- paymentid
|
- paymentid
|
||||||
- successful
|
- successful
|
||||||
- message
|
- updated_at
|
||||||
- bodyshopid
|
|
||||||
- useremail
|
- useremail
|
||||||
select_permissions:
|
select_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- successful
|
|
||||||
- message
|
|
||||||
- useremail
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- billid
|
- billid
|
||||||
- bodyshopid
|
- bodyshopid
|
||||||
|
- created_at
|
||||||
- id
|
- id
|
||||||
- jobid
|
- jobid
|
||||||
|
- message
|
||||||
|
- metadata
|
||||||
- paymentid
|
- paymentid
|
||||||
|
- successful
|
||||||
|
- updated_at
|
||||||
|
- useremail
|
||||||
filter:
|
filter:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
associations:
|
associations:
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."joblines" add column "act_price_before_ppc" numeric
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."joblines" add column "act_price_before_ppc" numeric
|
||||||
|
null;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."exportlog" add column "metadata" jsonb
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."exportlog" add column "metadata" jsonb
|
||||||
|
null;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."bodyshops" add column "tt_enforce_hours_for_tech_console" boolean
|
||||||
|
-- not null default 'false';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."bodyshops" add column "tt_enforce_hours_for_tech_console" boolean
|
||||||
|
not null default 'false';
|
||||||
@@ -249,10 +249,10 @@ async function QueryCustomersFromDms(socket) {
|
|||||||
SerialNumber: socket.JobData.bodyshop.pbs_serialnumber,
|
SerialNumber: socket.JobData.bodyshop.pbs_serialnumber,
|
||||||
//ContactId: "00000000000000000000000000000000",
|
//ContactId: "00000000000000000000000000000000",
|
||||||
// ContactCode: socket.JobData.owner.accountingid,
|
// ContactCode: socket.JobData.owner.accountingid,
|
||||||
FirstName: socket.JobData.ownr_co_nm
|
FirstName: socket.JobData.ownr_fn,
|
||||||
|
LastName: socket.JobData.ownr_co_nm
|
||||||
? socket.JobData.ownr_co_nm
|
? socket.JobData.ownr_co_nm
|
||||||
: socket.JobData.ownr_fn,
|
: socket.JobData.ownr_ln,
|
||||||
LastName: socket.JobData.ownr_ln,
|
|
||||||
PhoneNumber: socket.JobData.ownr_ph1,
|
PhoneNumber: socket.JobData.ownr_ph1,
|
||||||
EmailAddress: socket.JobData.ownr_ea,
|
EmailAddress: socket.JobData.ownr_ea,
|
||||||
// ModifiedSince: "0001-01-01T00:00:00.0000000Z",
|
// ModifiedSince: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
|
|||||||
} finally {
|
} finally {
|
||||||
//Ensure we always insert logEvents
|
//Ensure we always insert logEvents
|
||||||
//GQL to insert logevents.
|
//GQL to insert logevents.
|
||||||
|
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
socket,
|
||||||
"DEBUG",
|
"DEBUG",
|
||||||
@@ -1213,6 +1214,7 @@ async function GenerateTransWips(socket) {
|
|||||||
|
|
||||||
wips.push(item);
|
wips.push(item);
|
||||||
});
|
});
|
||||||
|
socket.transWips = wips;
|
||||||
return wips;
|
return wips;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1388,6 +1390,7 @@ async function MarkJobExported(socket, jobid) {
|
|||||||
jobid: jobid,
|
jobid: jobid,
|
||||||
successful: true,
|
successful: true,
|
||||||
useremail: socket.user.email,
|
useremail: socket.user.email,
|
||||||
|
metadata: socket.transWips,
|
||||||
},
|
},
|
||||||
bill: {
|
bill: {
|
||||||
exported: true,
|
exported: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user