IO-3573 Enhanced Payroll Labor Allocations

Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
Allan Carr
2026-02-23 18:20:57 -08:00
parent e3f49ebca4
commit 947ded4b5e

View File

@@ -21,6 +21,7 @@ import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
import TimeTicketList from "../time-ticket-list/time-ticket-list.component";
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({
bodyshop: selectBodyshop,
@@ -49,7 +50,7 @@ export function TimeTicketModalComponent({
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",
nextFetchPolicy: "network-only"
});
@@ -320,13 +321,34 @@ export function TimeTicketModalComponent({
</Form.Item>
</LayoutFormRow>
<LaborAllocationContainer jobid={watchedJobId || null} loading={loading} lineTicketData={lineTicketData} />
<LaborAllocationContainer
jobid={watchedJobId || null}
loading={loading}
lineTicketData={lineTicketData}
bodyshop={bodyshop}
refetch={refetch}
/>
</div>
);
}
export function LaborAllocationContainer({ jobid, loading, lineTicketData, hideTimeTickets = false }) {
export function LaborAllocationContainer({
jobid,
loading,
lineTicketData,
hideTimeTickets = false,
bodyshop,
refetch
}) {
const { t } = useTranslation();
const {
treatments: { Enhanced_Payroll }
} = useTreatmentsWithConfig({
attributes: {},
names: ["Enhanced_Payroll"],
splitKey: bodyshop.imexshopid
});
if (loading) return <LoadingSkeleton />;
if (!lineTicketData) return null;
if (!jobid) return null;
@@ -337,12 +359,23 @@ export function LaborAllocationContainer({ jobid, loading, lineTicketData, hideT
<JobEmployeeAssignmentsContainer job={lineTicketData.jobs_by_pk} />
</Card>
<LaborAllocationsTable
jobId={jobid}
joblines={lineTicketData.joblines}
timetickets={lineTicketData.timetickets}
adjustments={lineTicketData.jobs_by_pk.lbr_adjustments}
/>
{Enhanced_Payroll.treatment === "off" ? (
<PayrollLaborAllocationsTable
jobId={jobid}
joblines={lineTicketData.joblines}
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 && (
<TimeTicketList loading={loading} timetickets={jobid ? lineTicketData.timetickets : []} techConsole />