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

@@ -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 : []}