IO-3573 Enhanced Payroll Labor Allocations
Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
@@ -21,6 +21,7 @@ import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
|||||||
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
|
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
import TimeTicketList from "../time-ticket-list/time-ticket-list.component";
|
import TimeTicketList from "../time-ticket-list/time-ticket-list.component";
|
||||||
import JobEmployeeAssignmentsContainer from "./../job-employee-assignments/job-employee-assignments.container";
|
import JobEmployeeAssignmentsContainer from "./../job-employee-assignments/job-employee-assignments.container";
|
||||||
|
import { PayrollLaborAllocationsTable } from "../labor-allocations-table/labor-allocations-table.payroll.component.jsx";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -49,7 +50,7 @@ export function TimeTicketModalComponent({
|
|||||||
splitKey: bodyshop.imexshopid
|
splitKey: bodyshop.imexshopid
|
||||||
});
|
});
|
||||||
|
|
||||||
const [loadLineTicketData, { loading, data: lineTicketData }] = useLazyQuery(GET_LINE_TICKET_BY_PK, {
|
const [loadLineTicketData, { loading, data: lineTicketData, refetch }] = useLazyQuery(GET_LINE_TICKET_BY_PK, {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only"
|
nextFetchPolicy: "network-only"
|
||||||
});
|
});
|
||||||
@@ -320,13 +321,34 @@ export function TimeTicketModalComponent({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LaborAllocationContainer jobid={watchedJobId || null} loading={loading} lineTicketData={lineTicketData} />
|
<LaborAllocationContainer
|
||||||
|
jobid={watchedJobId || null}
|
||||||
|
loading={loading}
|
||||||
|
lineTicketData={lineTicketData}
|
||||||
|
bodyshop={bodyshop}
|
||||||
|
refetch={refetch}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LaborAllocationContainer({ jobid, loading, lineTicketData, hideTimeTickets = false }) {
|
export function LaborAllocationContainer({
|
||||||
|
jobid,
|
||||||
|
loading,
|
||||||
|
lineTicketData,
|
||||||
|
hideTimeTickets = false,
|
||||||
|
bodyshop,
|
||||||
|
refetch
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const {
|
||||||
|
treatments: { Enhanced_Payroll }
|
||||||
|
} = useTreatmentsWithConfig({
|
||||||
|
attributes: {},
|
||||||
|
names: ["Enhanced_Payroll"],
|
||||||
|
splitKey: bodyshop.imexshopid
|
||||||
|
});
|
||||||
|
|
||||||
if (loading) return <LoadingSkeleton />;
|
if (loading) return <LoadingSkeleton />;
|
||||||
if (!lineTicketData) return null;
|
if (!lineTicketData) return null;
|
||||||
if (!jobid) return null;
|
if (!jobid) return null;
|
||||||
@@ -337,12 +359,23 @@ export function LaborAllocationContainer({ jobid, loading, lineTicketData, hideT
|
|||||||
<JobEmployeeAssignmentsContainer job={lineTicketData.jobs_by_pk} />
|
<JobEmployeeAssignmentsContainer job={lineTicketData.jobs_by_pk} />
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<LaborAllocationsTable
|
{Enhanced_Payroll.treatment === "off" ? (
|
||||||
jobId={jobid}
|
<PayrollLaborAllocationsTable
|
||||||
joblines={lineTicketData.joblines}
|
jobId={jobid}
|
||||||
timetickets={lineTicketData.timetickets}
|
joblines={lineTicketData.joblines}
|
||||||
adjustments={lineTicketData.jobs_by_pk.lbr_adjustments}
|
timetickets={lineTicketData.timetickets}
|
||||||
/>
|
adjustments={lineTicketData.jobs_by_pk.lbr_adjustments}
|
||||||
|
refetch={refetch}
|
||||||
|
bodyshop={bodyshop}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<LaborAllocationsTable
|
||||||
|
jobId={jobid}
|
||||||
|
joblines={lineTicketData.joblines}
|
||||||
|
timetickets={lineTicketData.timetickets}
|
||||||
|
adjustments={lineTicketData.jobs_by_pk.lbr_adjustments}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{!hideTimeTickets && (
|
{!hideTimeTickets && (
|
||||||
<TimeTicketList loading={loading} timetickets={jobid ? lineTicketData.timetickets : []} techConsole />
|
<TimeTicketList loading={loading} timetickets={jobid ? lineTicketData.timetickets : []} techConsole />
|
||||||
|
|||||||
Reference in New Issue
Block a user