Changed RO Search Select to use RO searching and possible provided job value for options IMEX-129 IMEX-327
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { useLazyQuery, useMutation, useQuery } from "@apollo/react-hooks";
|
||||
import { Button, Form, Modal, notification } from "antd";
|
||||
import moment from "moment";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { QUERY_EMPLOYEES } from "../../graphql/employees.queries";
|
||||
import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries";
|
||||
import { ACTIVE_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries";
|
||||
import {
|
||||
INSERT_NEW_TIME_TICKET,
|
||||
UPDATE_TIME_TICKET,
|
||||
@@ -15,7 +15,6 @@ 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 moment from "moment";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
timeTicketModal: selectTimeTicket,
|
||||
@@ -35,13 +34,11 @@ export function TimeTicketModalContainer({
|
||||
const [enterAgain, setEnterAgain] = useState(false);
|
||||
const [insertTicket] = useMutation(INSERT_NEW_TIME_TICKET);
|
||||
const [updateTicket] = useMutation(UPDATE_TIME_TICKET);
|
||||
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 [loadLineTicketData, { data: lineTicketData }] = useLazyQuery(
|
||||
GET_LINE_TICKET_BY_PK
|
||||
);
|
||||
@@ -194,7 +191,6 @@ export function TimeTicketModalContainer({
|
||||
>
|
||||
<TimeTicketModalComponent
|
||||
form={form}
|
||||
roAutoCompleteOptions={RoAutoCompleteData && RoAutoCompleteData.jobs}
|
||||
employeeAutoCompleteOptions={
|
||||
EmployeeAutoCompleteData && EmployeeAutoCompleteData.employees
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user