diff --git a/client/src/components/production-board-filters/production-board-filters.component.jsx b/client/src/components/production-board-filters/production-board-filters.component.jsx index d90a3af04..68fab1b6d 100644 --- a/client/src/components/production-board-filters/production-board-filters.component.jsx +++ b/client/src/components/production-board-filters/production-board-filters.component.jsx @@ -30,7 +30,7 @@ export function ProductionBoardFilters({ bodyshop, filter, setFilter }) { }} /> e.active)} value={filter.employeeId} placeholder={t("production.labels.employeesearch")} onChange={(emp) => setFilter({ ...filter, employeeId: emp })} 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 index e158da2c8..5b2845a8e 100644 --- a/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx +++ b/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx @@ -5,7 +5,7 @@ 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 { QUERY_ACTIVE_EMPLOYEES } from "../../graphql/employees.queries"; import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries"; import { INSERT_NEW_TIME_TICKET, @@ -35,7 +35,7 @@ export function TimeTicketModalContainer({ const [insertTicket] = useMutation(INSERT_NEW_TIME_TICKET); const [updateTicket] = useMutation(UPDATE_TIME_TICKET); - const { data: EmployeeAutoCompleteData } = useQuery(QUERY_EMPLOYEES, { + const { data: EmployeeAutoCompleteData } = useQuery(QUERY_ACTIVE_EMPLOYEES, { skip: !timeTicketModal.visible, }); diff --git a/client/src/graphql/employees.queries.js b/client/src/graphql/employees.queries.js index fbc398ed7..3cba23648 100644 --- a/client/src/graphql/employees.queries.js +++ b/client/src/graphql/employees.queries.js @@ -18,6 +18,24 @@ export const QUERY_EMPLOYEES = gql` } `; +export const QUERY_ACTIVE_EMPLOYEES = gql` + query QUERY_ACTIVE_EMPLOYEES { + employees(where: { active: { _eq: true } }) { + last_name + id + first_name + employee_number + active + termination_date + hire_date + flat_rate + rates + pin + user_email + } + } +`; + export const INSERT_EMPLOYEES = gql` mutation INSERT_EMPLOYEES($employees: [employees_insert_input!]!) { insert_employees(objects: $employees) {