+
+
+ {
+ if (form.getFieldValue("jobid") !== null) {
+ loadJobLines({
+ variables: { id: form.getFieldValue("jobid") },
+ });
+ }
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx
new file mode 100644
index 000000000..099eedd2e
--- /dev/null
+++ b/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx
@@ -0,0 +1,150 @@
+import { useLazyQuery, useMutation, useQuery } from "@apollo/react-hooks";
+import { Form, Modal, notification, Button } from "antd";
+import React, { useState, useEffect } from "react";
+import { useTranslation } from "react-i18next";
+import { connect } from "react-redux";
+import { createStructuredSelector } from "reselect";
+import { INSERT_NEW_INVOICE } from "../../graphql/invoices.queries";
+import { ACTIVE_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries";
+import { toggleModalVisible } from "../../redux/modals/modals.actions";
+import { selectTimeTicket } from "../../redux/modals/modals.selectors";
+import { selectBodyshop } from "../../redux/user/user.selectors";
+import TimeTicketModalComponent from "./time-ticket-modal.component";
+import { QUERY_EMPLOYEES } from "../../graphql/employees.queries";
+import { GET_JOB_LINES_BY_PK_MINIMAL } from "../../graphql/jobs-lines.queries";
+const mapStateToProps = createStructuredSelector({
+ timeTicketModal: selectTimeTicket,
+ bodyshop: selectBodyshop,
+});
+const mapDispatchToProps = (dispatch) => ({
+ toggleModalVisible: () => dispatch(toggleModalVisible("timeTicket")),
+});
+
+function TimeTicketModalContainer({
+ timeTicketModal,
+ toggleModalVisible,
+ bodyshop,
+}) {
+ const [form] = Form.useForm();
+ const { t } = useTranslation();
+ const [enterAgain, setEnterAgain] = useState(false);
+ // const [insertInvoice] = useMutation(INSERT_NEW_INVOICE);
+
+ const { data: RoAutoCompleteData } = useQuery(ACTIVE_JOBS_FOR_AUTOCOMPLETE, {
+ variables: { statuses: bodyshop.md_ro_statuses.open_statuses || ["Open"] },
+ skip: !timeTicketModal.visible,
+ });
+
+ const { data: EmployeeAutoCompleteData } = useQuery(QUERY_EMPLOYEES, {
+ skip: !timeTicketModal.visible,
+ });
+
+ const [loadJobLines, { data: jobLinesData }] = useLazyQuery(
+ GET_JOB_LINES_BY_PK_MINIMAL
+ );
+
+ const handleFinish = (values) => {
+ // insertInvoice({
+ // variables: {
+ // invoice: [
+ // Object.assign({}, values, {
+ // invoicelines: { data: values.invoicelines },
+ // }),
+ // ],
+ // },
+ // })
+ // .then((r) => {
+ // notification["success"]({
+ // message: t("invoices.successes.created"),
+ // });
+ // if (timeTicketModal.actions.refetch)
+ // timeTicketModal.actions.refetch();
+ // if (enterAgain) {
+ // form.resetFields();
+ // } else {
+ // toggleModalVisible();
+ // }
+ // setEnterAgain(false);
+ // })
+ // .catch((error) => {
+ // setEnterAgain(false);
+ // notification["error"]({
+ // message: t("invoices.errors.creating", {
+ // message: JSON.stringify(error),
+ // }),
+ // });
+ // });
+ };
+
+ const handleCancel = () => {
+ toggleModalVisible();
+ };
+
+ useEffect(() => {
+ if (enterAgain) form.submit();
+ }, [enterAgain, form]);
+
+ return (
+