diff --git a/client/src/components/jobs-available-new/jobs-available-new.container.jsx b/client/src/components/jobs-available-new/jobs-available-new.container.jsx index 1f1504836..2f4f7b630 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.container.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.container.jsx @@ -13,7 +13,6 @@ import { QUERY_AVAILABLE_NEW_JOBS, } from "../../graphql/available-jobs.queries"; import { INSERT_NEW_JOB } from "../../graphql/jobs.queries"; -import { SEARCH_VEHICLE_BY_VIN } from "../../graphql/vehicles.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; import AlertComponent from "../alert/alert.component"; import LoadingSpinner from "../loading-spinner/loading-spinner.component"; @@ -73,12 +72,12 @@ export function JobsAvailableContainer({ }) ).data; - const existingVehicles = await client.query({ - query: SEARCH_VEHICLE_BY_VIN, - variables: { - vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin, - }, - }); + // const existingVehicles = await client.query({ + // query: SEARCH_VEHICLE_BY_VIN, + // variables: { + // vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin, + // }, + // }); const newJob = { ...estData.data.available_jobs_by_pk.est_data, @@ -86,9 +85,9 @@ export function JobsAvailableContainer({ owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"), job_totals: newTotals, queued_for_parts: true, - ...(existingVehicles.data.vehicles.length > 0 - ? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null } - : {}), + // ...(existingVehicles.data.vehicles.length > 0 + // ? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null } + // : {}), }; insertNewJob({ diff --git a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx index 106391730..6348b40bc 100644 --- a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx +++ b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx @@ -6,7 +6,10 @@ import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { CONVERT_JOB_TO_RO } from "../../graphql/jobs.queries"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; -import { selectBodyshop } from "../../redux/user/user.selectors"; +import { + selectAuthLevel, + selectBodyshop, +} from "../../redux/user/user.selectors"; const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser @@ -22,16 +25,18 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO }) { const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO); const { t } = useTranslation(); - const handleConvert = (values) => { - mutationConvertJob({ + const handleConvert = async (values) => { + const res = await mutationConvertJob({ variables: { jobId: job.id, ...values }, - }).then((r) => { - refetch(); + }); + if (!res.errors) { + refetch(); notification["success"]({ message: t("jobs.successes.converted"), }); - }); + setVisible(false); + } }; const popMenu = (