feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration -Cleaned up DMS key check (consolidated into a helper function), Clean up DMS post form and make it agnostic, same with customer selector.
This commit is contained in:
@@ -16,6 +16,7 @@ import TechJobClockoutDelete from "../tech-job-clock-out-delete/tech-job-clock-o
|
||||
import { LaborAllocationContainer } from "../time-ticket-modal/time-ticket-modal.component";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||
import { bodyshopHasDmsKey } from "../../utils/dmsUtils.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -53,7 +54,9 @@ export function TechClockOffButton({
|
||||
nextFetchPolicy: "network-only"
|
||||
});
|
||||
const { t } = useTranslation();
|
||||
const emps = bodyshop.employees.filter((e) => e.id === (technician && technician.id))[0];
|
||||
|
||||
const emps = bodyshop.employees.filter((e) => e.id === technician?.id)[0];
|
||||
const hasDmsKey = bodyshopHasDmsKey(bodyshop);
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
logImEXEvent("tech_clock_out_job");
|
||||
@@ -167,10 +170,7 @@ export function TechClockOffButton({
|
||||
lineTicketData.jobs_by_pk.lbr_adjustments
|
||||
);
|
||||
|
||||
const fieldTypeToCheck =
|
||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid
|
||||
? "mod_lbr_ty"
|
||||
: "cost_center";
|
||||
const fieldTypeToCheck = hasDmsKey ? "mod_lbr_ty" : "cost_center";
|
||||
|
||||
const costCenterDiff =
|
||||
Math.round(
|
||||
@@ -210,7 +210,7 @@ export function TechClockOffButton({
|
||||
<Select.Option key={item.cost_center}>
|
||||
{item.cost_center === "timetickets.labels.shift"
|
||||
? t(item.cost_center)
|
||||
: bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid
|
||||
: hasDmsKey
|
||||
? t(`joblines.fields.lbr_types.${item.cost_center.toUpperCase()}`)
|
||||
: item.cost_center}
|
||||
</Select.Option>
|
||||
|
||||
Reference in New Issue
Block a user