From 6e6dd9d5ae18556a7200ba6bb51af232c4d16762 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 31 Mar 2020 17:22:18 -0700 Subject: [PATCH] BOD-17 Added header blocks to contract detail. --- bodyshop_translations.babel | 63 +++++++++++++++++++ .../contract-courtesy-car-block.component.jsx | 26 ++++++++ .../contract-form/contract-form.component.jsx | 42 +++++++------ .../contract-job-block.component.jsx | 27 ++++++++ client/src/graphql/cccontracts.queries.js | 24 +++++-- .../contract-detail.page.component.jsx | 8 ++- .../contract-detail.page.container.jsx | 5 +- client/src/translations/en_us/common.json | 5 +- client/src/translations/es/common.json | 5 +- client/src/translations/fr/common.json | 5 +- 10 files changed, 181 insertions(+), 29 deletions(-) create mode 100644 client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx create mode 100644 client/src/components/contract-job-block/contract-job-block.component.jsx diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 8a260b62a..86f0692f8 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -3024,6 +3024,27 @@ labels + + courtesycar + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + fuel @@ -3218,6 +3239,27 @@ + + vehicle + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + @@ -8331,6 +8373,27 @@ + + job + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + lines false diff --git a/client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx b/client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx new file mode 100644 index 000000000..a3738832c --- /dev/null +++ b/client/src/components/contract-courtesy-car-block/contract-courtesy-car-block.component.jsx @@ -0,0 +1,26 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { Descriptions, Card } from "antd"; +import { Link } from "react-router-dom"; +export default function ContractCourtesyCarBlock({ courtesyCar }) { + const { t } = useTranslation(); + return ( + + + + + {(courtesyCar && courtesyCar.fleetnumber) || ""} + + + {(courtesyCar && courtesyCar.plate) || ""} + + + {`${(courtesyCar && courtesyCar.year) || ""} ${(courtesyCar && + courtesyCar.make) || + ""} ${(courtesyCar && courtesyCar.model) || ""}`} + + + + + ); +} diff --git a/client/src/components/contract-form/contract-form.component.jsx b/client/src/components/contract-form/contract-form.component.jsx index f7952a7ba..6097abe93 100644 --- a/client/src/components/contract-form/contract-form.component.jsx +++ b/client/src/components/contract-form/contract-form.component.jsx @@ -10,26 +10,30 @@ export default function ContractFormComponent() { const { t } = useTranslation(); return (
- setState(e.target.value)} /> - +
- var data = - "%FLDELRAY BEACH^DOE$JOHN$^4818 S FEDERAL BLVD^ ? ;6360100462172082009=2101198299090=? #! 33435 I 1600 ECCECC00000?"; - data = data.replace(/\n/, ""); - // replace spaces with regular space - data = data.replace(/\s/g, " "); - var track = data.match(/(.*?\?)(.*?\?)(.*?\?)/); - console.log("data", data); - console.log("track", track); - const a = aamva.stripe(data); - console.log(JSON.stringify(a)); - }} - > - Decode - + + + + {(job && job.ro_number) || ""} + + + {`${(job && job.v_model_yr) || ""} ${(job && job.v_make_desc) || + ""} ${(job && job.v_model_desc) || ""}`} + + + {`${(job && job.ownr_fn) || ""} ${(job && job.ownr_ln) || + ""} ${(job && job.ownr_co_nm) || ""}`} + + + + + ); +} diff --git a/client/src/graphql/cccontracts.queries.js b/client/src/graphql/cccontracts.queries.js index c0873e1c0..8fab495ee 100644 --- a/client/src/graphql/cccontracts.queries.js +++ b/client/src/graphql/cccontracts.queries.js @@ -15,10 +15,7 @@ export const UPDATE_CONTRACT = gql` $contractId: uuid! $cccontract: cccontracts_set_input! ) { - update_cccontracts( - where: { id: { _eq: $contractId } } - _set: $cccontract - ) { + update_cccontracts(where: { id: { _eq: $contractId } }, _set: $cccontract) { returning { id } @@ -49,12 +46,31 @@ export const QUERY_CONTRACT_BY_PK = gql` driver_zip id jobid + job { + id + est_number + ro_number + v_make_desc + v_model_desc + ownr_fn + ownr_ln + ownr_co_nm + scheduled_completion + } kmend kmstart scheduledreturn start status updated_at + courtesycar { + id + fleetnumber + make + model + year + plate + } } } `; diff --git a/client/src/pages/contract-detail/contract-detail.page.component.jsx b/client/src/pages/contract-detail/contract-detail.page.component.jsx index acc1cc5be..9f36f3b6b 100644 --- a/client/src/pages/contract-detail/contract-detail.page.component.jsx +++ b/client/src/pages/contract-detail/contract-detail.page.component.jsx @@ -2,14 +2,18 @@ import React from "react"; import ContractFormComponent from "../../components/contract-form/contract-form.component"; import { useTranslation } from "react-i18next"; import { Button } from "antd"; -export default function ContractDetailPage() { +import ContractJobBlock from "../../components/contract-job-block/contract-job-block.component"; +import ContractCourtesyCarBlock from "../../components/contract-courtesy-car-block/contract-courtesy-car-block.component"; + +export default function ContractDetailPage({ job, courtesyCar }) { const { t } = useTranslation(); return (
- SOME SORT OF HEADER INFORMATION HERE. + +
); diff --git a/client/src/pages/contract-detail/contract-detail.page.container.jsx b/client/src/pages/contract-detail/contract-detail.page.container.jsx index 243078792..b125bedf0 100644 --- a/client/src/pages/contract-detail/contract-detail.page.container.jsx +++ b/client/src/pages/contract-detail/contract-detail.page.container.jsx @@ -78,7 +78,10 @@ export default function ContractDetailPageContainer() { : {} } > - + ); } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index f1e7059d7..4b66a166e 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -203,6 +203,7 @@ "year": "Year" }, "labels": { + "courtesycar": "Courtesy Car", "fuel": { "12": "1/2", "14": "1/4", @@ -213,7 +214,8 @@ "78": "7/8", "empty": "Empty", "full": "Full" - } + }, + "vehicle": "Vehicle Description" }, "status": { "in": "Available", @@ -535,6 +537,7 @@ "creating_new_job": "Creating new job...", "documents": "Documents", "existing_jobs": "Existing Jobs", + "job": "Job Details", "lines": "Estimate Lines", "notes": "Notes", "override_header": "Override estimate header on import?", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index d6054a671..23d7ff0cd 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -203,6 +203,7 @@ "year": "" }, "labels": { + "courtesycar": "", "fuel": { "12": "", "14": "", @@ -213,7 +214,8 @@ "78": "", "empty": "", "full": "" - } + }, + "vehicle": "" }, "status": { "in": "", @@ -535,6 +537,7 @@ "creating_new_job": "Creando nuevo trabajo ...", "documents": "documentos", "existing_jobs": "Empleos existentes", + "job": "", "lines": "Líneas estimadas", "notes": "Notas", "override_header": "¿Anular encabezado estimado al importar?", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 295a01a55..b45967ffe 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -203,6 +203,7 @@ "year": "" }, "labels": { + "courtesycar": "", "fuel": { "12": "", "14": "", @@ -213,7 +214,8 @@ "78": "", "empty": "", "full": "" - } + }, + "vehicle": "" }, "status": { "in": "", @@ -535,6 +537,7 @@ "creating_new_job": "Création d'un nouvel emploi ...", "documents": "Les documents", "existing_jobs": "Emplois existants", + "job": "", "lines": "Estimer les lignes", "notes": "Remarques", "override_header": "Remplacer l'en-tête d'estimation à l'importation?",