diff --git a/admin/src/components/admin-root/admin-root.component.jsx b/admin/src/components/admin-root/admin-root.component.jsx index bb650ed88..7ef2edf01 100644 --- a/admin/src/components/admin-root/admin-root.component.jsx +++ b/admin/src/components/admin-root/admin-root.component.jsx @@ -28,7 +28,7 @@ import JobsShow from "../jobs/jobs.show"; const httpLink = new HttpLink({ uri: process.env.REACT_APP_GRAPHQL_ENDPOINT, headers: { - "x-hasura-admin-secret": `Dev-BodyShopAppBySnaptSoftware!`, + "x-hasura-admin-secret": `Dev-BodyShopApp!`, // 'Authorization': `Bearer xxxx`, }, }); @@ -67,7 +67,7 @@ const client = new ApolloClient({ // uri: process.env.REACT_APP_GRAPHQL_ENDPOINT, // cache: new InMemoryCache(), // headers: { -// "x-hasura-admin-secret": `Dev-BodyShopAppBySnaptSoftware!`, +// "x-hasura-admin-secret": `Dev-BodyShopApp!`, // // 'Authorization': `Bearer xxxx`, // }, // }); diff --git a/client/src/components/jira-support-widget/jira-support-widget.component.jsx b/client/src/components/jira-support-widget/jira-support-widget.component.jsx index 83eb45367..e919a5f17 100644 --- a/client/src/components/jira-support-widget/jira-support-widget.component.jsx +++ b/client/src/components/jira-support-widget/jira-support-widget.component.jsx @@ -1,28 +1,28 @@ -import React, { useEffect } from "react"; +import React from "react"; export default function JiraSupportComponent() { - useScript(); + //useScript(); return
; } -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); +// }; +// }, []); +// }; diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 1f68838c3..a7b9198f6 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -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, diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js index 5f01b0a12..2a86cd9f7 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js @@ -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); diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 3002e8d7f..0ae54a202 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -1056,6 +1056,236 @@ export const SEARCH_FOR_JOBS = gql` } `; +export const QUERY_JOB_FOR_DUPE = gql` + query QUERY_JOB_FOR_DUPE($id: uuid!) { + jobs_by_pk(id: $id) { + id + agt_addr1 + agt_addr2 + agt_city + agt_co_id + agt_co_nm + agt_ct_fn + agt_ct_ln + agt_ct_ph + agt_ct_phx + agt_ctry + agt_ea + agt_faxx + agt_fax + agt_lic_no + agt_ph1 + agt_ph1x + agt_ph2 + agt_zip + agt_st + agt_ph2x + area_of_damage + cat_no + cieca_stl + cieca_ttl + clm_addr1 + clm_addr2 + clm_city + clm_ct_fn + clm_ct_ln + clm_ct_ph + clm_ct_phx + clm_ctry + clm_ea + clm_fax + clm_faxx + clm_ofc_id + clm_ofc_nm + clm_ph1 + clm_ph1x + clm_ph2 + clm_ph2x + clm_st + clm_title + clm_total + clm_zip + cust_pr + est_addr1 + est_addr2 + est_city + est_co_nm + est_ct_fn + est_ct_ln + est_ctry + est_ea + est_ph1 + est_st + est_zip + federal_tax_rate + ins_addr1 + ins_addr2 + ins_city + ins_co_id + ins_co_nm + ins_ct_fn + ins_ct_ln + ins_ct_ph + ins_ct_phx + ins_ctry + ins_ea + ins_fax + ins_faxx + ins_memo + ins_ph1 + ins_ph1x + ins_ph2 + ins_ph2x + ins_st + ins_title + ins_zip + insd_addr1 + insd_addr2 + insd_city + insd_co_nm + insd_ctry + insd_ea + insd_fax + insd_faxx + insd_fn + insd_ln + insd_ph1 + insd_ph1x + insd_ph2 + insd_ph2x + insd_st + insd_title + insd_zip + labor_rate_desc + labor_rate_id + local_tax_rate + other_amount_payable + owner_owing + ownerid + ownr_addr1 + ownr_addr2 + ownr_city + ownr_co_nm + ownr_ctry + ownr_ea + ownr_fax + ownr_faxx + ownr_fn + ownr_ln + ownr_ph1 + ownr_ph1x + ownr_ph2 + ownr_ph2x + ownr_st + ownr_title + ownr_zip + parts_tax_rates + plate_no + plate_st + po_number + rate_la1 + rate_la2 + rate_la3 + rate_la4 + rate_laa + rate_lab + rate_lad + rate_lae + rate_lag + rate_laf + rate_lam + rate_lar + rate_las + rate_lau + rate_ma2s + rate_ma2t + rate_ma3s + rate_mabl + rate_macs + rate_mahw + rate_mapa + rate_mash + rate_matd + regie_number + selling_dealer + selling_dealer_contact + servicing_dealer + servicing_dealer_contact + shopid + + state_tax_rate + + tax_lbr_rt + tax_levies_rt + tax_paint_mat_rt + tax_predis + tax_prethr + tax_pstthr + tax_str_rt + tax_sub_rt + tax_thramt + tax_tow_rt + unit_number + v_color + v_make_desc + v_model_desc + v_model_yr + v_vin + vehicleid + joblines(where: { removed: { _eq: false } }) { + act_price + alt_co_id + alt_overrd + alt_part_i + alt_partm + bett_amt + alt_partno + bett_pctg + bett_tax + bett_type + cert_part + db_hrs + db_price + db_ref + est_seq + glass_flag + id + lbr_amt + lbr_hrs_j + lbr_inc + lbr_op + lbr_op_j + lbr_tax + lbr_typ_j + line_desc + line_ind + line_ref + misc_amt + misc_sublt + misc_tax + mod_lb_hrs + mod_lbr_ty + oem_partno + op_code_desc + paint_stg + paint_tone + part_qty + part_type + price_inc + price_j + prt_dsmk_m + prt_dsmk_p + status + tax_part + unq_seq + manual_line + } + driveable + towin + } + } +`; + export const QUERY_ALL_JOB_FIELDS = gql` query QUERY_ALL_JOB_FIELDS($id: uuid!) { jobs_by_pk(id: $id) { diff --git a/firebase/readme.md b/firebase/readme.md index fba8d7a35..a1b2e503b 100644 --- a/firebase/readme.md +++ b/firebase/readme.md @@ -1,4 +1,3 @@ +Must set the environment variables using: -Must set the environment variables using: - -firebase functions:config:set auth.graphql_endpoint="https://bodyshop-dev-db.herokuapp.com/v1/graphql" auth.hasura_secret_admin_key="Dev-BodyShopAppBySnaptSoftware!" \ No newline at end of file +firebase functions:config:set auth.graphql_endpoint="https://bodyshop-dev-db.herokuapp.com/v1/graphql" auth.hasura_secret_admin_key="Dev-BodyShopApp!" diff --git a/hasura/config.yaml b/hasura/config.yaml index 3dda55b42..b3b3d8636 100644 --- a/hasura/config.yaml +++ b/hasura/config.yaml @@ -1,2 +1,2 @@ endpoint: https://bodyshop-dev-db.herokuapp.com -admin_secret: Dev-BodyShopAppBySnaptSoftware! \ No newline at end of file +admin_secret: Dev-BodyShopApp! diff --git a/hasura/migrations/1622495491154_alter_table_public_vehicles_alter_column_v_vin/down.yaml b/hasura/migrations/1622495491154_alter_table_public_vehicles_alter_column_v_vin/down.yaml new file mode 100644 index 000000000..4302f4466 --- /dev/null +++ b/hasura/migrations/1622495491154_alter_table_public_vehicles_alter_column_v_vin/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."vehicles" ALTER COLUMN "v_vin" SET NOT NULL; + type: run_sql diff --git a/hasura/migrations/1622495491154_alter_table_public_vehicles_alter_column_v_vin/up.yaml b/hasura/migrations/1622495491154_alter_table_public_vehicles_alter_column_v_vin/up.yaml new file mode 100644 index 000000000..5740a2ce7 --- /dev/null +++ b/hasura/migrations/1622495491154_alter_table_public_vehicles_alter_column_v_vin/up.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."vehicles" ALTER COLUMN "v_vin" DROP NOT NULL; + type: run_sql