Add UI elements to Job to new cieca profile fields.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user