diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 20dd617dd..2f473b634 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -19724,6 +19724,27 @@ + + paymentnum + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + paymenttype false @@ -23773,6 +23794,352 @@ + + cieca_pfl + + + lbr_tax_in + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lbr_tx_in1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lbr_tx_in2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lbr_tx_in3 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lbr_tx_in4 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lbr_tx_in5 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + cieca_pfo + + + stor_t_in1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + stor_t_in2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + stor_t_in3 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + stor_t_in4 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + stor_t_in5 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + tow_t_in1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + tow_t_in2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + tow_t_in3 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + tow_t_in4 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + tow_t_in5 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + claim_total false @@ -25998,6 +26365,242 @@ + + materials + + + MAPA + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + MASH + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + cal_maxdlr + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + cal_opcode + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mat_tx_in1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mat_tx_in2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mat_tx_in3 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mat_tx_in4 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mat_tx_in5 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + materials + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + tax_ind + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + other_amount_payable false @@ -26442,6 +27045,111 @@ + + prt_tx_in1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + prt_tx_in2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + prt_tx_in3 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + prt_tx_in4 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + prt_tx_in5 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + prt_type false @@ -28868,6 +29576,27 @@ + + cieca_pfl + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + closeconfirm false @@ -30269,6 +30998,32 @@ + + materials + + + mapa + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + multipayers false diff --git a/client/src/components/job-totals-table/job-totals.table.labor.component.jsx b/client/src/components/job-totals-table/job-totals.table.labor.component.jsx index fd79a6ce2..42cfe7c66 100644 --- a/client/src/components/job-totals-table/job-totals.table.labor.component.jsx +++ b/client/src/components/job-totals-table/job-totals.table.labor.component.jsx @@ -123,10 +123,10 @@ export default function JobTotalsTableLabor({ job }) { {t("jobs.labels.mapa")} {job.materials && - job.materials.mapa && - job.materials.mapa.cal_maxdlr !== undefined && + job.materials.MAPA && + job.materials.MAPA.cal_maxdlr !== undefined && t("jobs.labels.threshhold", { - amount: job.materials.mapa.cal_maxdlr, + amount: job.materials.MAPA.cal_maxdlr, })} @@ -147,10 +147,10 @@ export default function JobTotalsTableLabor({ job }) { {t("jobs.labels.mash")} {job.materials && - job.materials.mash && - job.materials.mash.cal_maxdlr !== undefined && + job.materials.MASH && + job.materials.MASH.cal_maxdlr !== undefined && t("jobs.labels.threshhold", { - amount: job.materials.mash.cal_maxdlr, + amount: job.materials.MASH.cal_maxdlr, })} 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 ce4ef3c21..4de0b4ab1 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 @@ -31,7 +31,6 @@ import { selectCurrentUser, } from "../../redux/user/user.selectors"; import AuditTrailMapping from "../../utils/AuditTrailMappings"; -import confirmDialog from "../../utils/asyncConfirm"; import CriticalPartsScan from "../../utils/criticalPartsScan"; import AlertComponent from "../alert/alert.component"; import JobsAvailableScan from "../jobs-available-scan/jobs-available-scan.component"; diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx index dab973146..53fbdce09 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx @@ -20,6 +20,9 @@ import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs import JobsMarkPstExempt from "../jobs-mark-pst-exempt/jobs-mark-pst-exempt.component"; import FormRow from "../layout-form-row/layout-form-row.component"; import JobsDetailRatesParts from "./jobs-detail-rates.parts.component"; +import JobsDetailRatesLabor from "./jobs-detail-rates.labor.component"; +import JobsDetailRatesMaterials from "./jobs-detail-rates.materials.component"; +import JobsDetailRatesOther from "./jobs-detail-rates.other.component"; const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly, @@ -243,6 +246,9 @@ export function JobsDetailRates({ jobRO, form, job, bodyshop }) { + + + ); } diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.labor.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.labor.component.jsx new file mode 100644 index 000000000..d6311db4b --- /dev/null +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.labor.component.jsx @@ -0,0 +1,427 @@ +import { Collapse, Form, Switch } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; +const mapStateToProps = createStructuredSelector({ + jobRO: selectJobReadOnly, +}); + +export function JobsDetailRatesLabor({ + jobRO, + expanded, + required = true, + form, +}) { + const { t } = useTranslation(); + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} +export default connect(mapStateToProps, null)(JobsDetailRatesLabor); diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.materials.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.materials.component.jsx new file mode 100644 index 000000000..035fbb580 --- /dev/null +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.materials.component.jsx @@ -0,0 +1,145 @@ +import { Collapse, Form, Input, InputNumber, Switch } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; +const mapStateToProps = createStructuredSelector({ + jobRO: selectJobReadOnly, +}); + +export function JobsDetailRatesMaterials({ + jobRO, + expanded, + required = true, + form, +}) { + const { t } = useTranslation(); + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} +export default connect(mapStateToProps, null)(JobsDetailRatesMaterials); diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.other.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.other.component.jsx new file mode 100644 index 000000000..2cdcb7f40 --- /dev/null +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.other.component.jsx @@ -0,0 +1,104 @@ +import { Collapse, Form, Switch } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectJobReadOnly } from "../../redux/application/application.selectors"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; +const mapStateToProps = createStructuredSelector({ + jobRO: selectJobReadOnly, +}); + +export function JobsDetailRatesOther({ + jobRO, + expanded, + required = true, + form, +}) { + const { t } = useTranslation(); + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} +export default connect(mapStateToProps, null)(JobsDetailRatesOther); diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 31578b244..ff30c41f6 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -779,6 +779,9 @@ export const GET_JOB_BY_PK = gql` } } cieca_ttl + cieca_pfo + cieca_pfl + materials csiinvites { id completedon diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 49f7f11c2..87ebeb019 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -53,6 +53,7 @@ import { insertAuditTrail } from "../../redux/application/application.actions"; import JobsDocumentsLocalGallery from "../../components/jobs-documents-local-gallery/jobs-documents-local-gallery.container"; import UndefinedToNull from "../../utils/undefinedtonull"; import NoteUpsertModalComponent from "../../components/note-upsert-modal/note-upsert-modal.container"; +import _ from "lodash"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -103,13 +104,42 @@ export function JobsDetailPage({ "category", "referral_source", ]), - parts_tax_rates: { - ...job.parts_tax_rates, - ...values.parts_tax_rates, - }, + // The union and spread is required to keep values coming in from the estimating system that aren't displayed. + parts_tax_rates: _.union( + Object.keys(job.parts_tax_rates), + Object.keys(values.parts_tax_rates) + ).reduce((acc, val) => { + acc[val] = { + ...job.parts_tax_rates[val], + ...values.parts_tax_rates[val], + }; + return acc; + }, {}), + materials: _.union( + Object.keys(job.materials), + Object.keys(values.materials) + ).reduce((acc, val) => { + acc[val] = { + ...job.materials[val], + ...values.materials[val], + }; + return acc; + }, {}), + cieca_pfl: _.union( + Object.keys(job.cieca_pfl), + Object.keys(values.cieca_pfl) + ).reduce((acc, val) => { + acc[val] = { + ...job.cieca_pfl[val], + ...values.cieca_pfl[val], + }; + return acc; + }, {}), + cieca_pfo: { ...job.cieca_pfo, ...values.cieca_pfo }, }, }, }); + const newTotals = await Axios.post("/job/totalsssu", { id: job.id, }); @@ -392,7 +422,10 @@ const transormJobToForm = (job) => { Object.keys(job.parts_tax_rates).forEach((parttype) => { Object.keys(job.parts_tax_rates[parttype]).forEach((key) => { if (key.includes("tx_in")) { - if (job.parts_tax_rates[parttype][key] === "Y" || job.parts_tax_rates[parttype][key] === true) { + if ( + job.parts_tax_rates[parttype][key] === "Y" || + job.parts_tax_rates[parttype][key] === true + ) { job.parts_tax_rates[parttype][key] = true; } else { job.parts_tax_rates[parttype][key] = false; diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 963e41b15..3819a4533 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1444,6 +1444,26 @@ "ccf": "CC Refuel", "ccm": "CC Mileage", "cieca_id": "CIECA ID", + "cieca_pfl": { + "lbr_tax_in": "Tax Labor Indicator", + "lbr_tx_in1": "Tax 1 Indicator", + "lbr_tx_in2": "Tax 2 Indicator", + "lbr_tx_in3": "Tax 3 Indicator", + "lbr_tx_in4": "Tax 4 Indicator", + "lbr_tx_in5": "Tax 5 Indicator" + }, + "cieca_pfo": { + "stor_t_in1": "Storage Tax 1 Indicator", + "stor_t_in2": "Storage Tax 2 Indicator", + "stor_t_in3": "Storage Tax 3 Indicator", + "stor_t_in4": "Storage Tax 4 Indicator", + "stor_t_in5": "Storage Tax 5 Indicator", + "tow_t_in1": "Tow Tax 1 Indicator", + "tow_t_in2": "Tow Tax 2 Indicator", + "tow_t_in3": "Tow Tax 3 Indicator", + "tow_t_in4": "Tow Tax 4 Indicator", + "tow_t_in5": "Tow Tax 5 Indicator" + }, "claim_total": "Claim Total", "class": "Class", "clm_no": "Claim #", @@ -1557,6 +1577,19 @@ "mapa": "Paint Materials", "mash": "Shop Materials", "matd": "Tire Disposal", + "materials": { + "MAPA": "Paint Materials", + "MASH": "Shop Materials", + "cal_maxdlr": "Threshhold", + "cal_opcode": "OP Codes", + "mat_tx_in1": "Tax 1 Indicator", + "mat_tx_in2": "Tax 2 Indicator", + "mat_tx_in3": "Tax 3 Indicator", + "mat_tx_in4": "Tax 4 Indicator", + "mat_tx_in5": "Tax 5 Indicator", + "materials": "Profile - Materials", + "tax_ind": "Tax Indicator" + }, "other_amount_payable": "Other Amount Payable", "owner": "Owner", "owner_owing": "Cust. Owes", @@ -1579,6 +1612,11 @@ "prt_mkupp": "Markup %", "prt_tax_in": "Tax Indicator", "prt_tax_rt": "Part Tax Rate", + "prt_tx_in1": "Tax 1 Indicator", + "prt_tx_in2": "Tax 2 Indicator", + "prt_tx_in3": "Tax 3 Indicator", + "prt_tx_in4": "Tax 4 Indicator", + "prt_tx_in5": "Tax 5 Indicator", "prt_type": "Part Type" }, "partsstatus": "Parts Status", @@ -1706,6 +1744,7 @@ "checklistcompletedby": "Checklist completed by {{by}} at {{at}}", "checklistdocuments": "Checklist Documents", "checklists": "Checklists", + "cieca_pfl": "Profile - Labor", "closeconfirm": "Are you sure you want to close this job? This cannot be easily undone.", "closejob": "Close Job {{ro_number}}", "closingperiod": "This Invoice Date is outside of the Closing Period.", @@ -1778,6 +1817,9 @@ "mapa": "Paint Materials", "markforreexport": "Mark for Re-export", "mash": "Shop Materials", + "materials": { + "mapa": "" + }, "multipayers": "Additional Payers", "net_repairs": "Net Repairs", "notes": "Notes", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 62583504c..a4a748e95 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1444,6 +1444,26 @@ "ccf": "", "ccm": "", "cieca_id": "CIECA ID", + "cieca_pfl": { + "lbr_tax_in": "", + "lbr_tx_in1": "", + "lbr_tx_in2": "", + "lbr_tx_in3": "", + "lbr_tx_in4": "", + "lbr_tx_in5": "" + }, + "cieca_pfo": { + "stor_t_in1": "", + "stor_t_in2": "", + "stor_t_in3": "", + "stor_t_in4": "", + "stor_t_in5": "", + "tow_t_in1": "", + "tow_t_in2": "", + "tow_t_in3": "", + "tow_t_in4": "", + "tow_t_in5": "" + }, "claim_total": "Reclamar total", "class": "", "clm_no": "Reclamación #", @@ -1557,6 +1577,19 @@ "mapa": "", "mash": "", "matd": "", + "materials": { + "MAPA": "", + "MASH": "", + "cal_maxdlr": "", + "cal_opcode": "", + "mat_tx_in1": "", + "mat_tx_in2": "", + "mat_tx_in3": "", + "mat_tx_in4": "", + "mat_tx_in5": "", + "materials": "", + "tax_ind": "" + }, "other_amount_payable": "Otra cantidad a pagar", "owner": "Propietario", "owner_owing": "Cust. Debe", @@ -1579,6 +1612,11 @@ "prt_mkupp": "", "prt_tax_in": "", "prt_tax_rt": "", + "prt_tx_in1": "", + "prt_tx_in2": "", + "prt_tx_in3": "", + "prt_tx_in4": "", + "prt_tx_in5": "", "prt_type": "" }, "partsstatus": "", @@ -1706,6 +1744,7 @@ "checklistcompletedby": "", "checklistdocuments": "", "checklists": "", + "cieca_pfl": "", "closeconfirm": "", "closejob": "", "closingperiod": "", @@ -1778,6 +1817,9 @@ "mapa": "", "markforreexport": "", "mash": "", + "materials": { + "mapa": "" + }, "multipayers": "", "net_repairs": "", "notes": "Notas", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index d32815fd0..0fff1b839 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1444,6 +1444,26 @@ "ccf": "", "ccm": "", "cieca_id": "CIECA ID", + "cieca_pfl": { + "lbr_tax_in": "", + "lbr_tx_in1": "", + "lbr_tx_in2": "", + "lbr_tx_in3": "", + "lbr_tx_in4": "", + "lbr_tx_in5": "" + }, + "cieca_pfo": { + "stor_t_in1": "", + "stor_t_in2": "", + "stor_t_in3": "", + "stor_t_in4": "", + "stor_t_in5": "", + "tow_t_in1": "", + "tow_t_in2": "", + "tow_t_in3": "", + "tow_t_in4": "", + "tow_t_in5": "" + }, "claim_total": "Total réclamation", "class": "", "clm_no": "Prétendre #", @@ -1557,6 +1577,19 @@ "mapa": "", "mash": "", "matd": "", + "materials": { + "MAPA": "", + "MASH": "", + "cal_maxdlr": "", + "cal_opcode": "", + "mat_tx_in1": "", + "mat_tx_in2": "", + "mat_tx_in3": "", + "mat_tx_in4": "", + "mat_tx_in5": "", + "materials": "", + "tax_ind": "" + }, "other_amount_payable": "Autre montant à payer", "owner": "Propriétaire", "owner_owing": "Cust. Owes", @@ -1579,6 +1612,11 @@ "prt_mkupp": "", "prt_tax_in": "", "prt_tax_rt": "", + "prt_tx_in1": "", + "prt_tx_in2": "", + "prt_tx_in3": "", + "prt_tx_in4": "", + "prt_tx_in5": "", "prt_type": "" }, "partsstatus": "", @@ -1706,6 +1744,7 @@ "checklistcompletedby": "", "checklistdocuments": "", "checklists": "", + "cieca_pfl": "", "closeconfirm": "", "closejob": "", "closingperiod": "", @@ -1778,6 +1817,9 @@ "mapa": "", "markforreexport": "", "mash": "", + "materials": { + "mapa": "" + }, "multipayers": "", "net_repairs": "", "notes": "Remarques", diff --git a/job-totals-testing-util.js b/job-totals-testing-util.js index 1c9bf4c71..de955552b 100644 --- a/job-totals-testing-util.js +++ b/job-totals-testing-util.js @@ -20,7 +20,7 @@ require("dotenv").config({ async function RunTheTest() { const bodyshopids = ["a7ee1503-ee05-4a02-b80e-bdb11d1cc8ac"]; - const bearerToken = `Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFkNWM1ZTlmNTdjOWI2NDYzYzg1ODQ1YTA4OTlhOWQ0MTI5MmM4YzMiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiUm9tZSBEZXZlbG9wbWVudCIsImh0dHBzOi8vaGFzdXJhLmlvL2p3dC9jbGFpbXMiOnsieC1oYXN1cmEtZGVmYXVsdC1yb2xlIjoidXNlciIsIngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsidXNlciJdLCJ4LWhhc3VyYS11c2VyLWlkIjoidDZZbTFORGxDRE9QWnIzRjliZ3VXSDRMaFNYMiJ9LCJpb2FkbWluIjp0cnVlLCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcm9tZS1wcm9kLTEiLCJhdWQiOiJyb21lLXByb2QtMSIsImF1dGhfdGltZSI6MTY5NTE1MDU0NywidXNlcl9pZCI6InQ2WW0xTkRsQ0RPUFpyM0Y5Ymd1V0g0TGhTWDIiLCJzdWIiOiJ0NlltMU5EbENET1BacjNGOWJndVdINExoU1gyIiwiaWF0IjoxNjk1ODQ5OTQxLCJleHAiOjE2OTU4NTM1NDEsImVtYWlsIjoicGF0cmlja0Byb21lLmRldiIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJlbWFpbCI6WyJwYXRyaWNrQHJvbWUuZGV2Il19LCJzaWduX2luX3Byb3ZpZGVyIjoicGFzc3dvcmQifX0.pLA1hXPQrlVmFNlo-US2MkvGfWm4kDbBFVHtwKenGu6aNBEw_NdiN6BxIy35EuHLuZjSF6HrLbVYP2FE_7U85SPf5IhpO3aED1avxiI2d557ylcZQZasgWmJmPpufE1HFQtUwTt4PxHmvQVp2b-9l_uYDHNlzE_MUdJoDEA262UQxIkost2kBK_3D3PgBRB6CVHDNLWkb8DbMjx1gyYzmEW7RqChP9NGePaZDDL3VS8PhglQ1MFPyMI-UdaIp_nWeb-AQScNvRQscyQy3LkmVKeKXqacUcTKWHPBZjING3Thzfnek0IzSR7GjMgPZ3TQiK_N12UYga9-z31qqUgctg`; + const bearerToken = `Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFkNWM1ZTlmNTdjOWI2NDYzYzg1ODQ1YTA4OTlhOWQ0MTI5MmM4YzMiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiUm9tZSBEZXZlbG9wbWVudCIsImh0dHBzOi8vaGFzdXJhLmlvL2p3dC9jbGFpbXMiOnsieC1oYXN1cmEtZGVmYXVsdC1yb2xlIjoidXNlciIsIngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsidXNlciJdLCJ4LWhhc3VyYS11c2VyLWlkIjoidDZZbTFORGxDRE9QWnIzRjliZ3VXSDRMaFNYMiJ9LCJpb2FkbWluIjp0cnVlLCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcm9tZS1wcm9kLTEiLCJhdWQiOiJyb21lLXByb2QtMSIsImF1dGhfdGltZSI6MTY5NTE1MDU0NywidXNlcl9pZCI6InQ2WW0xTkRsQ0RPUFpyM0Y5Ymd1V0g0TGhTWDIiLCJzdWIiOiJ0NlltMU5EbENET1BacjNGOWJndVdINExoU1gyIiwiaWF0IjoxNjk1ODUzNTI5LCJleHAiOjE2OTU4NTcxMjksImVtYWlsIjoicGF0cmlja0Byb21lLmRldiIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJlbWFpbCI6WyJwYXRyaWNrQHJvbWUuZGV2Il19LCJzaWduX2luX3Byb3ZpZGVyIjoicGFzc3dvcmQifX0.cLDqjTy7dyo3MYwRuWaDxFz0faqDqK5elCFy78qgr4IMhWQEZKdO1FIJoBmxuGn7qbJUfgSRettkYx5YcY3AzrzlTu7UbL6yz7yMyCUjIOF189OLhN-IZH8sHbyb4xvpP4GvYLkaEoBjTCvMaSW-9ycpM3uvYbjgCO81p2gGjo56E2TGoT8tfWE-NGO2nGv_-UacTrZWh_8CGijeZrC9QXeY3DSXTykRV1_xWA7UQNi8IeKphgXsVkOsQI6xC5fXCBWThOfx2RN5af36fU-b3aVXCq21M5y3tJg1IZbzlcYyyBw8Gc71wfp5bjKU92EPH8yCnbic7B5c5Yzk2ikWZg`; const { jobs } = await client.request( gql` query GET_JOBS($bodyshopids: [uuid!]!) { diff --git a/server/job/job-totals.js b/server/job/job-totals.js index 77b479775..522ad31b5 100644 --- a/server/job/job-totals.js +++ b/server/job/job-totals.js @@ -262,8 +262,8 @@ async function CalculateRatesTotals({ job, client }) { let hasMashLine = false; let hasMahwLine = false; let hasCustomMahwLine; - let mapaOpCodes = ParseCalopCode(job.materials["mapa"]?.cal_opcode); - let mashOpCodes = ParseCalopCode(job.materials["mash"]?.cal_opcode); + let mapaOpCodes = ParseCalopCode(job.materials["MAPA"]?.cal_opcode); + let mashOpCodes = ParseCalopCode(job.materials["MASH"]?.cal_opcode); jobLines.forEach((item) => { //IO-1317 Use the lines on the estimate if they exist instead. @@ -352,16 +352,18 @@ async function CalculateRatesTotals({ job, client }) { } let threshold; //Check if there is a max for this type. - if (job.materials && job.materials[property]) { + if (job.materials && job.materials[property.toUpperCase()]) { // if ( - job.materials[property].cal_maxdlr !== undefined && - job.materials[property].cal_maxdlr >= 0 + job.materials[property.toUpperCase()].cal_maxdlr !== undefined && + job.materials[property.toUpperCase()].cal_maxdlr >= 0 ) { //It has an upper threshhold. threshold = Dinero({ - amount: Math.round(job.materials[property].cal_maxdlr * 100), + amount: Math.round( + job.materials[property.toUpperCase()].cal_maxdlr * 100 + ), }); } }