From 7e3f496ea14dc8a332e6652b679f46eaddcf334e Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 13 Sep 2021 09:43:41 -0700 Subject: [PATCH] IO-233 CDK WIP customer changes. --- bodyshop_translations.babel | 42 +++++++++++++++++ ...accounting-receivables-table.component.jsx | 34 +++++++++++--- .../dms-allocations-summary.component.jsx | 4 +- .../dms-cdk-makes/dms-cdk-makes.component.jsx | 4 -- .../dms-customer-selector.component.jsx | 13 +++++- .../dms-post-form/dms-post-form.component.jsx | 4 +- client/src/graphql/jobs.queries.js | 5 +++ client/src/pages/dms/dms.container.jsx | 12 ++++- client/src/translations/en_us/common.json | 4 +- client/src/translations/es/common.json | 4 +- client/src/translations/fr/common.json | 4 +- server/cdk/cdk-job-export.js | 45 ++++++++++++------- server/graphql-client/queries.js | 1 + 13 files changed, 141 insertions(+), 35 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 8f945d9b8..8fe98b129 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -19467,6 +19467,27 @@ + + id + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + journal false @@ -19682,6 +19703,27 @@ + + vinowner + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + diff --git a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx index da2e4885c..d7f57388e 100644 --- a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx +++ b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx @@ -8,7 +8,25 @@ import { alphaSort } from "../../utils/sorters"; import JobExportButton from "../jobs-close-export-button/jobs-close-export-button.component"; import JobsExportAllButton from "../jobs-export-all-button/jobs-export-all-button.component"; -export default function AccountingReceivablesTableComponent({ loading, jobs }) { +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect( + mapStateToProps, + mapDispatchToProps +)(AccountingReceivablesTableComponent); + +export function AccountingReceivablesTableComponent({ + bodyshop, + loading, + jobs, +}) { const { t } = useTranslation(); const [selectedJobs, setSelectedJobs] = useState([]); const [transInProgress, setTransInProgress] = useState(false); @@ -180,12 +198,14 @@ export default function AccountingReceivablesTableComponent({ loading, jobs }) { - + {!bodyshop.cdk_dealerid && ( + + )} { diff --git a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx index 726fdc417..06201284b 100644 --- a/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx +++ b/client/src/components/dms-cdk-makes/dms-cdk-makes.component.jsx @@ -47,10 +47,6 @@ export function DmsCdkVehicles({ bodyshop, form, socket, job }) { }, ]; - console.log( - "🚀 ~ file: dms-cdk-makes.component.jsx ~ line 95 ~ selectedModel", - selectedModel - ); return (
+ }, { title: t("jobs.fields.dms.name1"), dataIndex: ["name1", "fullName"], diff --git a/client/src/components/dms-post-form/dms-post-form.component.jsx b/client/src/components/dms-post-form/dms-post-form.component.jsx index 3e6cda1b8..d018fe336 100644 --- a/client/src/components/dms-post-form/dms-post-form.component.jsx +++ b/client/src/components/dms-post-form/dms-post-form.component.jsx @@ -69,7 +69,7 @@ export function DmsPostForm({ bodyshop, socket, job }) { story: t("jobs.labels.dms.defaultstory", { ro_number: job.ro_number, area_of_damage: job.area_of_damage && job.area_of_damage.impact1, - }).substr(0, 249), + }).substr(0, 239), }} > @@ -153,7 +153,7 @@ export function DmsPostForm({ bodyshop, socket, job }) { }, ]} > - + diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 0601a0a84..296a1d40b 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -1887,8 +1887,13 @@ export const QUERY_JOB_EXPORT_DMS = gql` po_number clm_no job_totals + ownr_fn + ownr_ln + ownr_co_nm kmin kmout + v_make_desc + v_model_yr v_model_desc area_of_damage } diff --git a/client/src/pages/dms/dms.container.jsx b/client/src/pages/dms/dms.container.jsx index b43ee5909..d0731610a 100644 --- a/client/src/pages/dms/dms.container.jsx +++ b/client/src/pages/dms/dms.container.jsx @@ -71,6 +71,10 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { document.title = t("titles.dms"); setSelectedHeader("dms"); setBreadcrumbs([ + { + link: "/manage/accounting/receivables", + label: t("titles.bc.accounting-receivables"), + }, { link: "/manage/dms", label: t("titles.bc.dms"), @@ -122,7 +126,13 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index f853198e3..8be2f987c 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1193,6 +1193,7 @@ "dms_make": "DMS Make", "dms_model": "DMS Model", "dms_wip_acctnumber": "Cost WIP DMS Acct #", + "id": "DMS ID", "journal": "Journal #", "name1": "Customer Name", "payer": { @@ -1204,7 +1205,8 @@ }, "sale": "Sale", "sale_dms_acctnumber": "Sale DMS Acct #", - "story": "Story" + "story": "Story", + "vinowner": "VIN Owner" }, "driveable": "Driveable", "employee_body": "Body", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 15632a580..4ed4b5df6 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1193,6 +1193,7 @@ "dms_make": "", "dms_model": "", "dms_wip_acctnumber": "", + "id": "", "journal": "", "name1": "", "payer": { @@ -1204,7 +1205,8 @@ }, "sale": "", "sale_dms_acctnumber": "", - "story": "" + "story": "", + "vinowner": "" }, "driveable": "", "employee_body": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1868f720c..6dc6547de 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1193,6 +1193,7 @@ "dms_make": "", "dms_model": "", "dms_wip_acctnumber": "", + "id": "", "journal": "", "name1": "", "payer": { @@ -1204,7 +1205,8 @@ }, "sale": "", "sale_dms_acctnumber": "", - "story": "" + "story": "", + "vinowner": "" }, "driveable": "", "employee_body": "", diff --git a/server/cdk/cdk-job-export.js b/server/cdk/cdk-job-export.js index 2aec2ad99..d0fbd61ed 100644 --- a/server/cdk/cdk-job-export.js +++ b/server/cdk/cdk-job-export.js @@ -75,7 +75,9 @@ exports.default = async function (socket, { txEnvelope, jobid }) { socket.DMSCustList = await QueryDmsCustomerByName(socket, JobData); socket.emit("cdk-select-customer", [ - ...(socket.DMSVehCustomer ? [socket.DMSVehCustomer] : []), + ...(socket.DMSVehCustomer + ? [{ ...socket.DMSVehCustomer, vinOwner: true }] + : []), ...socket.DMSCustList, ]); } catch (error) { @@ -140,30 +142,24 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) { ); socket.DMSVeh = await UpdateDmsVehicle(socket); } - CdkBase.createLogEvent( - socket, - "DEBUG", - `{5} Updating Service Vehicle History. ***SKIPPING FOR NOW TO PRESERVE RO NUMBERS ***` - ); - //socket.DMSVehHistory = await InsertServiceVehicleHistory(socket); CdkBase.createLogEvent( socket, "DEBUG", - `{6} Creating Transaction header with Dms Start WIP` + `{5} Creating Transaction header with Dms Start WIP` ); socket.DMSTransHeader = await InsertDmsStartWip(socket); CdkBase.createLogEvent( socket, "DEBUG", - `{6.1} Creating Transaction with ID ${socket.DMSTransHeader.transID}` + `{5.1} Creating Transaction with ID ${socket.DMSTransHeader.transID}` ); socket.DMSBatchTxn = await InsertDmsBatchWip(socket); CdkBase.createLogEvent( socket, "DEBUG", - `{7} Attempting to post Transaction with ID ${socket.DMSTransHeader.transID}` + `{6} Attempting to post Transaction with ID ${socket.DMSTransHeader.transID}` ); socket.DmsBatchTxnPost = await PostDmsBatchWip(socket); if (socket.DmsBatchTxnPost.code === "success") { @@ -171,25 +167,31 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) { CdkBase.createLogEvent( socket, "DEBUG", - `{8} Successfully posted sransaction to DMS.` + `{6} Successfully posted sransaction to DMS.` ); await MarkJobExported(socket, socket.JobData.id); + CdkBase.createLogEvent( + socket, + "DEBUG", + `{5} Updating Service Vehicle History. ***SKIPPING FOR NOW TO PRESERVE RO NUMBERS ***` + ); + //socket.DMSVehHistory = await InsertServiceVehicleHistory(socket); socket.emit("export-success", socket.JobData.id); } else { //Get the error code CdkBase.createLogEvent( socket, "DEBUG", - `{7.1} Getting errors for Transaction ID ${socket.DMSTransHeader.transID}` + `{6.1} Getting errors for Transaction ID ${socket.DMSTransHeader.transID}` ); socket.DmsError = await QueryDmsErrWip(socket); //Delete the transaction CdkBase.createLogEvent( socket, "DEBUG", - `{7.2} Deleting Transaction ID ${socket.DMSTransHeader.transID}` + `{6.2} Deleting Transaction ID ${socket.DMSTransHeader.transID}` ); socket.DmsBatchTxnPost = await DeleteDmsWip(socket); //Emit the error in a nice way . @@ -203,7 +205,7 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) { CdkBase.createLogEvent( socket, "ERROR", - r`Error(s) encountered in posting transaction. ${e}` + `Error(s) encountered in posting transaction. ${e}` ) ); } @@ -575,7 +577,12 @@ async function InsertDmsCustomer(socket, newCustomerNumber) { addressLine: socket.JobData.ownr_addr1, city: socket.JobData.ownr_city, country: null, - postalCode: socket.JobData.ownr_zip, + postalCode: + socket.JobData.ownr_zip && + socket.JobData.ownr_zip //TODO Need to remove for US Based customers. + .toUpperCase() + .replace(/\W/g, "") + .replace(/(...)/, "$1 "), stateOrProvince: socket.JobData.ownr_st, }, contactInfo: { @@ -583,6 +590,10 @@ async function InsertDmsCustomer(socket, newCustomerNumber) { main: true, value: socket.JobData.ownr_ph1, }, + email: { + desc: socket.JobData.ownr_ea ? "Other" : "CustomerDeclined", + value: socket.JobData.ownr_ea ? "Other" : null, + }, }, demographics: null, name1: { @@ -595,6 +606,10 @@ async function InsertDmsCustomer(socket, newCustomerNumber) { suffix: null, title: null, }, + //TODO - REMOVE THIS AFTER TESTING. + ...(process.env.NODE_ENV !== "production" + ? { arStatus: { dealerField1: "Testing" } } + : {}), }, }, diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index 550fecd77..35ed225d5 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -140,6 +140,7 @@ query QUERY_JOBS_FOR_CDK_EXPORT($id: uuid!) { ownr_zip ownr_city ownr_st + ownr_ea ins_co_nm job_totals rate_la1