BOD-23 Added labor pages tab + finalized time ticket tab + created allocation calculations
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import React from "react";
|
||||
import LaborAllocationsTableComponent from "../labor-allocations-table/labor-allocations-table.component";
|
||||
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
|
||||
import TimeTicketList from "../time-ticket-list/time-ticket-list.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
export default function JobsDetailLaborContainer({
|
||||
jobId,
|
||||
joblines,
|
||||
timetickets,
|
||||
refetch,
|
||||
loading,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div>
|
||||
<TimeTicketEnterButton actions={{ refetch }} context={{ jobid: jobId }}>
|
||||
{t("timetickets.actions.enter")}
|
||||
</TimeTicketEnterButton>
|
||||
<LaborAllocationsTableComponent
|
||||
joblines={joblines}
|
||||
timetickets={timetickets}
|
||||
/>
|
||||
<TimeTicketList
|
||||
loading={loading}
|
||||
timetickets={timetickets}
|
||||
refetch={refetch}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +1,24 @@
|
||||
import React from "react";
|
||||
import { Button } from "antd";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import { useQuery } from "@apollo/react-hooks";
|
||||
import { QUERY_TICKETS_BY_JOBID } from "../../graphql/timetickets.queries";
|
||||
import React from "react";
|
||||
import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import JobsDetailLaborComponent from "./jobs-detail-labor.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setTimeTicketContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "timeTicket" })),
|
||||
});
|
||||
|
||||
export function JobsDetailLaborContainer({ jobId, setTimeTicketContext }) {
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_TICKETS_BY_JOBID, {
|
||||
variables: { jobid: jobId },
|
||||
export default function JobsDetailLaborContainer({ jobId }) {
|
||||
const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, {
|
||||
variables: { id: jobId },
|
||||
skip: !!!jobId,
|
||||
});
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{jobId}
|
||||
<Button
|
||||
onClick={() => {
|
||||
setTimeTicketContext({
|
||||
actions: { refetch },
|
||||
context: {
|
||||
jobId,
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
TEST - Open Time Ticket Modal
|
||||
</Button>
|
||||
{JSON.stringify(data)}
|
||||
</div>
|
||||
<JobsDetailLaborComponent
|
||||
loading={loading}
|
||||
jobId={jobId}
|
||||
timetickets={data ? data.timetickets : []}
|
||||
joblines={data ? data.joblines : []}
|
||||
refetch={refetch}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(null, mapDispatchToProps)(JobsDetailLaborContainer);
|
||||
|
||||
Reference in New Issue
Block a user