diff --git a/client/src/components/employee-search-select/employee-search-select-email.component.jsx b/client/src/components/employee-search-select/employee-search-select-email.component.jsx new file mode 100644 index 000000000..c583db68c --- /dev/null +++ b/client/src/components/employee-search-select/employee-search-select-email.component.jsx @@ -0,0 +1,37 @@ +import { Select, Space, Tag } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; + +const { Option } = Select; +//To be used as a form element only. + +const EmployeeSearchSelectEmail = ({ options, ...props }) => { + const { t } = useTranslation(); + + return ( + + ); +}; +export default EmployeeSearchSelectEmail; diff --git a/client/src/components/report-center-modal/report-center-modal.component.jsx b/client/src/components/report-center-modal/report-center-modal.component.jsx index b1847d9e3..49a5372ff 100644 --- a/client/src/components/report-center-modal/report-center-modal.component.jsx +++ b/client/src/components/report-center-modal/report-center-modal.component.jsx @@ -2,23 +2,24 @@ import { useLazyQuery } from "@apollo/client"; import { useSplitTreatments } from "@splitsoftware/splitio-react"; import { Button, Card, Col, DatePicker, Form, Input, Radio, Row, Typography } from "antd"; import _ from "lodash"; -import dayjs from "../../utils/day"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { QUERY_ACTIVE_EMPLOYEES } from "../../graphql/employees.queries"; +import { QUERY_ACTIVE_EMPLOYEES, QUERY_ACTIVE_EMPLOYEES_WITH_EMAIL } from "../../graphql/employees.queries"; import { QUERY_ALL_VENDORS } from "../../graphql/vendors.queries"; import { selectReportCenter } from "../../redux/modals/modals.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; import DatePickerRanges from "../../utils/DatePickerRanges"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; +import dayjs from "../../utils/day"; +import EmployeeSearchSelectEmail from "../employee-search-select/employee-search-select-email.component"; import EmployeeSearchSelect from "../employee-search-select/employee-search-select.component"; -import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component"; -import "./report-center-modal.styles.scss"; -import ReportCenterModalFiltersSortersComponent from "./report-center-modal-filters-sorters-component"; import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component"; +import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component"; +import ReportCenterModalFiltersSortersComponent from "./report-center-modal-filters-sorters-component"; +import "./report-center-modal.styles.scss"; const mapStateToProps = createStructuredSelector({ reportCenterModal: selectReportCenter, @@ -66,6 +67,13 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) { skip: !(open && Templates[form.getFieldValue("key")] && Templates[form.getFieldValue("key")].idtype) }); + const [callEmployeeWithEmailQuery, { data: employeeWithEmailData, called: employeeWithEmailCalled }] = useLazyQuery( + QUERY_ACTIVE_EMPLOYEES_WITH_EMAIL, + { + skip: !(open && Templates[form.getFieldValue("key")] && Templates[form.getFieldValue("key")].idtype) + } + ); + const handleFinish = async (values) => { setLoading(true); const start = values.dates ? values.dates[0] : null; @@ -197,6 +205,7 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) { } if (!vendorCalled && idtype === "vendor") callVendorQuery(); if (!employeeCalled && idtype === "employee") callEmployeeQuery(); + if (!employeeWithEmailCalled && idtype === "employeeWithEmail") callEmployeeWithEmailQuery(); if (idtype === "vendor") return (