feature/IO-3499-React-19: Ticket Ticket Issues, Employee Select Issues
This commit is contained in:
@@ -16,11 +16,15 @@ const mapDispatchToProps = () => ({});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardLabor);
|
||||
|
||||
export function JobCloseRoGuardLabor({ job, bodyshop, warningCallback }) {
|
||||
const jobId = job?.id ?? null;
|
||||
|
||||
const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, {
|
||||
variables: { id: job.id },
|
||||
variables: { id: jobId },
|
||||
skip: !jobId,
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only"
|
||||
});
|
||||
|
||||
const {
|
||||
treatments: { Enhanced_Payroll }
|
||||
} = useTreatmentsWithConfig({
|
||||
@@ -29,12 +33,13 @@ export function JobCloseRoGuardLabor({ job, bodyshop, warningCallback }) {
|
||||
splitKey: bodyshop.imexshopid
|
||||
});
|
||||
|
||||
if (!jobId) return <LoadingSkeleton />;
|
||||
if (loading) return <LoadingSkeleton />;
|
||||
if (error) return <AlertComponent title={error.message} type="error" />;
|
||||
|
||||
return Enhanced_Payroll.treatment === "on" ? (
|
||||
<PayrollLaborAllocationsTable
|
||||
jobId={job.id}
|
||||
jobId={jobId}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
refetch={refetch}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
@@ -43,7 +48,7 @@ export function JobCloseRoGuardLabor({ job, bodyshop, warningCallback }) {
|
||||
/>
|
||||
) : (
|
||||
<LaborAllocationsTableComponent
|
||||
jobId={job.id}
|
||||
jobId={jobId}
|
||||
joblines={data ? data.joblines : []}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
refetch={refetch}
|
||||
|
||||
Reference in New Issue
Block a user