From ac890bd92b9dd1f1af4b3fdc4c8ffbf3a3ae48ce Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Tue, 17 May 2022 08:24:04 -0700
Subject: [PATCH] IO-1898 Add vehicle notes.
---
bodyshop_translations.babel | 21 ++++++
.../jobs-detail-header.component.jsx | 14 ++++
.../vehicle-detail-form.component.jsx | 3 +
client/src/graphql/jobs.queries.js | 2 +
client/src/graphql/vehicles.queries.js | 1 +
client/src/translations/en_us/common.json | 1 +
client/src/translations/es/common.json | 1 +
client/src/translations/fr/common.json | 1 +
hasura/metadata/tables.yaml | 65 ++++++++++---------
.../down.sql | 4 ++
.../up.sql | 2 +
server/graphql-client/queries.js | 5 +-
12 files changed, 88 insertions(+), 32 deletions(-)
create mode 100644 hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/down.sql
create mode 100644 hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/up.sql
diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index a354ac876..36716b308 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -44249,6 +44249,27 @@
+
+ notes
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
plate_no
false
diff --git a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
index 7f5847f2c..8494086a8 100644
--- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
+++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx
@@ -216,6 +216,20 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
+ {job.vehicle.notes && (
+
+ {job.vehicle.notes}
+
+ )}
+ {job.vehicle.v_paint_codes && (
+
+
+ {Object.keys(job.vehicle.v_paint_codes).map((key, idx) => (
+ {job.vehicle.v_paint_codes[key]}
+ ))}
+
+
+ )}
diff --git a/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx b/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx
index 86c587afe..6ec1c3853 100644
--- a/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx
+++ b/client/src/components/vehicle-detail-form/vehicle-detail-form.component.jsx
@@ -139,6 +139,9 @@ export default function VehicleDetailFormComponent({ form, loading }) {
+
+
+
);
}
diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js
index 150b06a62..8603fcfe6 100644
--- a/client/src/graphql/jobs.queries.js
+++ b/client/src/graphql/jobs.queries.js
@@ -530,6 +530,8 @@ export const GET_JOB_BY_PK = gql`
v_model_desc
v_make_desc
v_color
+ notes
+ v_paint_codes
jobs {
id
ro_number
diff --git a/client/src/graphql/vehicles.queries.js b/client/src/graphql/vehicles.queries.js
index 507b22399..a2a31a57d 100644
--- a/client/src/graphql/vehicles.queries.js
+++ b/client/src/graphql/vehicles.queries.js
@@ -27,6 +27,7 @@ export const QUERY_VEHICLE_BY_ID = gql`
v_bstyle
updated_at
trim_color
+ notes
jobs {
id
ro_number
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index 8f56b78de..934ea93f3 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -2633,6 +2633,7 @@
},
"fields": {
"description": "Vehicle Description",
+ "notes": "Vehicle Notes",
"plate_no": "License Plate",
"plate_st": "Plate Jurisdiction",
"trim_color": "Trim Color",
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index 0a909f644..ebe6acf2d 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -2633,6 +2633,7 @@
},
"fields": {
"description": "Descripcion del vehiculo",
+ "notes": "",
"plate_no": "Placa",
"plate_st": "Jurisdicción de placas",
"trim_color": "Recortar color",
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index 33398f6fa..c6fd3677c 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -2633,6 +2633,7 @@
},
"fields": {
"description": "Description du véhicule",
+ "notes": "",
"plate_no": "Plaque d'immatriculation",
"plate_st": "Juridiction de la plaque",
"trim_color": "Couleur de garniture",
diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml
index fa69a7da1..c2f4970b8 100644
--- a/hasura/metadata/tables.yaml
+++ b/hasura/metadata/tables.yaml
@@ -4925,60 +4925,62 @@
- active:
_eq: true
columns:
- - id
- created_at
- - updated_at
- - v_vin
- - v_make_desc
- - v_model_desc
- - v_model_yr
- - v_color
- - v_paint_codes
- - v_bstyle
- - v_engine
- - shopid
- db_v_code
+ - id
+ - notes
- plate_no
- plate_st
- - v_cond
- - v_prod_dt
- - v_type
- - v_trimcode
+ - shopid
- trim_color
- - v_mldgcode
- - v_options
- - v_tone
- - v_stage
+ - updated_at
+ - v_bstyle
+ - v_color
+ - v_cond
+ - v_engine
+ - v_make_desc
- v_makecode
+ - v_mldgcode
+ - v_model_desc
+ - v_model_yr
+ - v_options
+ - v_paint_codes
+ - v_prod_dt
+ - v_stage
+ - v_tone
+ - v_trimcode
+ - v_type
+ - v_vin
select_permissions:
- role: user
permission:
columns:
- - v_paint_codes
+ - created_at
- db_v_code
+ - id
+ - notes
- plate_no
- plate_st
+ - shopid
- trim_color
+ - updated_at
- v_bstyle
- v_color
- v_cond
- v_engine
- - v_makecode
- v_make_desc
+ - v_makecode
- v_mldgcode
- v_model_desc
- v_model_yr
- v_options
+ - v_paint_codes
- v_prod_dt
- v_stage
- v_tone
- v_trimcode
- v_type
- v_vin
- - created_at
- - updated_at
- - id
- - shopid
filter:
bodyshop:
associations:
@@ -4993,31 +4995,32 @@
- role: user
permission:
columns:
- - v_paint_codes
+ - created_at
- db_v_code
+ - id
+ - notes
- plate_no
- plate_st
+ - shopid
- trim_color
+ - updated_at
- v_bstyle
- v_color
- v_cond
- v_engine
- - v_makecode
- v_make_desc
+ - v_makecode
- v_mldgcode
- v_model_desc
- v_model_yr
- v_options
+ - v_paint_codes
- v_prod_dt
- v_stage
- v_tone
- v_trimcode
- v_type
- v_vin
- - created_at
- - updated_at
- - id
- - shopid
filter:
bodyshop:
associations:
diff --git a/hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/down.sql b/hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/down.sql
new file mode 100644
index 000000000..aa517de93
--- /dev/null
+++ b/hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/down.sql
@@ -0,0 +1,4 @@
+-- Could not auto-generate a down migration.
+-- Please write an appropriate down migration for the SQL below:
+-- alter table "public"."vehicles" add column "notes" text
+-- null;
diff --git a/hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/up.sql b/hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/up.sql
new file mode 100644
index 000000000..628296048
--- /dev/null
+++ b/hasura/migrations/1652743525497_alter_table_public_vehicles_add_column_notes/up.sql
@@ -0,0 +1,2 @@
+alter table "public"."vehicles" add column "notes" text
+ null;
diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js
index 39eed99e2..019a4d6b6 100644
--- a/server/graphql-client/queries.js
+++ b/server/graphql-client/queries.js
@@ -917,7 +917,10 @@ exports.GET_JOB_BY_PK = ` query GET_JOB_BY_PK($id: uuid!) {
est_co_nm
est_ct_fn
est_ct_ln
-
+vehicle{
+ id
+ notes
+}
est_ph1
est_ea
selling_dealer