- Merge client update into test-beta
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,108 +1,109 @@
|
||||
import { Col, Row } from "antd";
|
||||
import {Col, Row} from "antd";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectJobReadOnly} from "../../redux/application/application.selectors";
|
||||
import LaborAllocationsTableComponent from "../labor-allocations-table/labor-allocations-table.component";
|
||||
import TimeTicketList from "../time-ticket-list/time-ticket-list.component";
|
||||
import PayrollLaborAllocationsTable from "../labor-allocations-table/labor-allocations-table.payroll.component";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
jobRO: selectJobReadOnly,
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(JobsDetailLaborContainer);
|
||||
|
||||
const ticketSpan = {
|
||||
xs: {
|
||||
span: 24,
|
||||
},
|
||||
sm: {
|
||||
span: 24,
|
||||
},
|
||||
md: {
|
||||
span: 24,
|
||||
},
|
||||
lg: {
|
||||
span: 24,
|
||||
},
|
||||
xl: {
|
||||
span: 16,
|
||||
},
|
||||
xs: {
|
||||
span: 24,
|
||||
},
|
||||
sm: {
|
||||
span: 24,
|
||||
},
|
||||
md: {
|
||||
span: 24,
|
||||
},
|
||||
lg: {
|
||||
span: 24,
|
||||
},
|
||||
xl: {
|
||||
span: 16,
|
||||
},
|
||||
};
|
||||
const adjSpan = {
|
||||
xs: {
|
||||
span: 24,
|
||||
},
|
||||
sm: {
|
||||
span: 24,
|
||||
},
|
||||
md: {
|
||||
span: 24,
|
||||
},
|
||||
lg: {
|
||||
span: 24,
|
||||
},
|
||||
xl: {
|
||||
span: 8,
|
||||
},
|
||||
xs: {
|
||||
span: 24,
|
||||
},
|
||||
sm: {
|
||||
span: 24,
|
||||
},
|
||||
md: {
|
||||
span: 24,
|
||||
},
|
||||
lg: {
|
||||
span: 24,
|
||||
},
|
||||
xl: {
|
||||
span: 8,
|
||||
},
|
||||
};
|
||||
|
||||
export function JobsDetailLaborContainer({
|
||||
bodyshop,
|
||||
jobRO,
|
||||
job,
|
||||
jobId,
|
||||
joblines,
|
||||
timetickets,
|
||||
refetch,
|
||||
loading,
|
||||
techConsole,
|
||||
adjustments,
|
||||
}) {
|
||||
const { Enhanced_Payroll } = useTreatments(
|
||||
["Enhanced_Payroll"],
|
||||
{},
|
||||
bodyshop.imexshopid
|
||||
);
|
||||
bodyshop,
|
||||
jobRO,
|
||||
job,
|
||||
jobId,
|
||||
joblines,
|
||||
timetickets,
|
||||
refetch,
|
||||
loading,
|
||||
techConsole,
|
||||
adjustments,
|
||||
}) {
|
||||
const {treatments: {Enhanced_Payroll}} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ["Enhanced_Payroll"],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
});
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col {...ticketSpan}>
|
||||
<TimeTicketList
|
||||
loading={loading}
|
||||
timetickets={timetickets}
|
||||
refetch={refetch}
|
||||
techConsole={techConsole}
|
||||
disabled={jobRO || (job && !job.converted)}
|
||||
jobId={jobId}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
{Enhanced_Payroll.treatment === "on" ? (
|
||||
<Col {...adjSpan}>
|
||||
<PayrollLaborAllocationsTable
|
||||
jobId={jobId}
|
||||
joblines={joblines}
|
||||
timetickets={timetickets}
|
||||
refetch={refetch}
|
||||
adjustments={adjustments}
|
||||
/>
|
||||
</Col>
|
||||
) : (
|
||||
<Col {...adjSpan}>
|
||||
<LaborAllocationsTableComponent
|
||||
jobId={jobId}
|
||||
joblines={joblines}
|
||||
timetickets={timetickets}
|
||||
refetch={refetch}
|
||||
adjustments={adjustments}
|
||||
/>
|
||||
</Col>
|
||||
)}
|
||||
</Row>
|
||||
);
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col {...ticketSpan}>
|
||||
<TimeTicketList
|
||||
loading={loading}
|
||||
timetickets={timetickets}
|
||||
refetch={refetch}
|
||||
techConsole={techConsole}
|
||||
disabled={jobRO || (job && !job.converted)}
|
||||
jobId={jobId}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
{Enhanced_Payroll.treatment === "on" ? (
|
||||
<Col {...adjSpan}>
|
||||
<PayrollLaborAllocationsTable
|
||||
jobId={jobId}
|
||||
joblines={joblines}
|
||||
timetickets={timetickets}
|
||||
refetch={refetch}
|
||||
adjustments={adjustments}
|
||||
/>
|
||||
</Col>
|
||||
) : (
|
||||
<Col {...adjSpan}>
|
||||
<LaborAllocationsTableComponent
|
||||
jobId={jobId}
|
||||
joblines={joblines}
|
||||
timetickets={timetickets}
|
||||
refetch={refetch}
|
||||
adjustments={adjustments}
|
||||
/>
|
||||
</Col>
|
||||
)}
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import {useQuery} from "@apollo/client";
|
||||
import React from "react";
|
||||
import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries";
|
||||
import {GET_LINE_TICKET_BY_PK} from "../../graphql/jobs-lines.queries";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import JobsDetailLaborComponent from "./jobs-detail-labor.component";
|
||||
|
||||
export default function JobsDetailLaborContainer({ jobId, techConsole, job }) {
|
||||
const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, {
|
||||
variables: { id: jobId },
|
||||
skip: !!!jobId,
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
export default function JobsDetailLaborContainer({jobId, techConsole, job}) {
|
||||
const {loading, error, data, refetch} = useQuery(GET_LINE_TICKET_BY_PK, {
|
||||
variables: {id: jobId},
|
||||
skip: !!!jobId,
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
|
||||
return (
|
||||
<JobsDetailLaborComponent
|
||||
loading={loading}
|
||||
jobId={jobId}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
joblines={data ? data.joblines : []}
|
||||
refetch={refetch}
|
||||
techConsole={techConsole}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
job={job}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<JobsDetailLaborComponent
|
||||
loading={loading}
|
||||
jobId={jobId}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
joblines={data ? data.joblines : []}
|
||||
refetch={refetch}
|
||||
techConsole={techConsole}
|
||||
adjustments={data ? data.jobs_by_pk.lbr_adjustments : []}
|
||||
job={job}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user