Merged in feature/2020-06-04 (pull request #81)

Feature/2020 06 04 - Batch 2
This commit is contained in:
Patrick Fic
2021-06-01 01:17:54 +00:00
9 changed files with 279 additions and 52 deletions

View File

@@ -1,28 +1,28 @@
import React, { useEffect } from "react";
import React from "react";
export default function JiraSupportComponent() {
useScript();
//useScript();
return <div></div>;
}
const useScript = () => {
useEffect(() => {
const script = document.createElement("script");
script.src = "https://jsd-widget.atlassian.com/assets/embed.js";
script.setAttribute("data-jsd-embedded", true);
script.setAttribute("data-key", "d69bb65c-1dd3-483f-b109-66a970d03f44");
script.setAttribute("data-base-url", "https://jsd-widget.atlassian.com");
//script.async = true;
script.onload = () => {
var DOMContentLoaded_event = document.createEvent("Event");
DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true);
window.document.dispatchEvent(DOMContentLoaded_event);
};
document.head.appendChild(script);
// const useScript = () => {
// useEffect(() => {
// const script = document.createElement("script");
// script.src = "https://jsd-widget.atlassian.com/assets/embed.js";
// script.setAttribute("data-jsd-embedded", true);
// script.setAttribute("data-key", "d69bb65c-1dd3-483f-b109-66a970d03f44");
// script.setAttribute("data-base-url", "https://jsd-widget.atlassian.com");
// //script.async = true;
// script.onload = () => {
// var DOMContentLoaded_event = document.createEvent("Event");
// DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true);
// window.document.dispatchEvent(DOMContentLoaded_event);
// };
// document.head.appendChild(script);
return () => {
document.head.removeChild(script);
};
}, []);
};
// return () => {
// document.head.removeChild(script);
// };
// }, []);
// };

View File

@@ -104,7 +104,10 @@ export function JobsAvailableContainer({ bodyshop, currentUser }) {
).data;
let existingVehicles;
if (estData.data.available_jobs_by_pk.est_data.vehicle) {
if (
estData.data.available_jobs_by_pk.est_data.vehicle &&
estData.data.available_jobs_by_pk.est_data.vin
) {
//There's vehicle data, need to double check the VIN.
existingVehicles = await client.query({
query: SEARCH_VEHICLE_BY_VIN,

View File

@@ -1,10 +1,7 @@
import Axios from "axios";
import _ from "lodash";
import { logImEXEvent } from "../../firebase/firebase.utils";
import {
INSERT_NEW_JOB,
QUERY_ALL_JOB_FIELDS,
} from "../../graphql/jobs.queries";
import { INSERT_NEW_JOB, QUERY_JOB_FOR_DUPE } from "../../graphql/jobs.queries";
export default async function DuplicateJob(
apolloClient,
@@ -18,33 +15,21 @@ export default async function DuplicateJob(
const { defaultOpenStatus } = config;
//get a list of all fields on the job
const res = await apolloClient.query({
query: QUERY_ALL_JOB_FIELDS,
query: QUERY_JOB_FOR_DUPE,
variables: { id: jobId },
});
console.log("res", res);
const { jobs_by_pk: existingJob } = res.data;
const { jobs_by_pk } = res.data;
const existingJob = _.cloneDeep(jobs_by_pk);
delete existingJob.__typename;
delete existingJob.id;
delete existingJob.createdat;
delete existingJob.updatedat;
const newJob = {
date_estimated: new Date(),
shopid: existingJob.shopid,
...existingJob,
status: defaultOpenStatus,
ownerid: existingJob.ownerid,
ownr_fn: existingJob.ownr_fn,
ownr_ln: existingJob.ownr_ln,
ownr_co_nm: existingJob.ownr_co_nm,
ownr_addr1: existingJob.ownr_addr1,
ownr_addr2: existingJob.ownr_addr2,
ownr_st: existingJob.ownr_st,
ownr_zip: existingJob.ownr_zip,
ownr_ctry: existingJob.ownr_ctry,
ownr_ph1: existingJob.ownr_ph1,
vehicleid: existingJob.vehicleid,
v_vin: existingJob.v_vin,
v_make_desc: existingJob.v_make_desc,
v_model_desc: existingJob.v_model_desc,
v_model_yr: existingJob.v_model_yr,
};
const _tempLines = _.cloneDeep(existingJob.joblines);