IO-233 CDK Updates.

This commit is contained in:
Patrick Fic
2021-11-26 09:18:19 -08:00
parent b311a6df53
commit c3baee1fa9
2 changed files with 53 additions and 30 deletions

View File

@@ -86,11 +86,13 @@ export function DmsCustomerSelector({ bodyshop }) {
//dataIndex: ["name2", "fullName"], //dataIndex: ["name2", "fullName"],
key: "address", key: "address",
render: (record, value) => render: (record, value) =>
`${record.address && record.address.addressLine[0]}, ${ `${
record.address && record.address.city record.address &&
} ${record.address && record.address.stateOrProvince} ${ record.address.addressLine &&
record.address && record.address.postalCode record.address.addressLine[0]
}`, }, ${record.address && record.address.city} ${
record.address && record.address.stateOrProvince
} ${record.address && record.address.postalCode}`,
}, },
]; ];

View File

@@ -54,18 +54,21 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
const DMSVehCustomer = const DMSVehCustomer =
socket.DMSVeh && socket.DMSVeh &&
socket.DMSVeh.owners &&
socket.DMSVeh.owners.find((o) => o.id.assigningPartyId === "CURRENT"); socket.DMSVeh.owners.find((o) => o.id.assigningPartyId === "CURRENT");
CdkBase.createLogEvent( if (DMSVehCustomer && DMSVehCustomer.id && DMSVehCustomer.id.value) {
socket, CdkBase.createLogEvent(
"DEBUG", socket,
`{2.2} Querying the Customer using the ID from DMSVeh: ${DMSVehCustomer.id.value}` "DEBUG",
); `{2.2} Querying the Customer using the ID from DMSVeh: ${DMSVehCustomer.id.value}`
socket.DMSVehCustomer = await QueryDmsCustomerById( );
socket, socket.DMSVehCustomer = await QueryDmsCustomerById(
JobData, socket,
DMSVehCustomer.id.value JobData,
); DMSVehCustomer.id.value
);
}
} }
CdkBase.createLogEvent( CdkBase.createLogEvent(
@@ -771,26 +774,44 @@ async function UpdateDmsVehicle(socket) {
let ids = []; let ids = [];
const existingOwnerinVeh = socket.DMSVeh.owners.filter( const existingOwnerinVeh =
(o) => o.id.value === socket.DMSCust.id.value socket.DMSVeh &&
); socket.DMSVeh.owners &&
socket.DMSVeh.owners.find((o) => o.id.value === socket.DMSCust.id.value);
if (existingOwnerinVeh) { if (existingOwnerinVeh) {
ids = socket.DMSVeh.owners.filter( ids = socket.DMSVeh.owners.map((o) => {
(o) => o.id.value === socket.DMSCust.id.value return {
); id: {
assigningPartyId:
o.id.value === socket.dmsCust.id.value ? "CURRENT" : "PREVIOUS",
value: o.id.value,
},
};
});
} else { } else {
const oldOwner =
socket.DMSVeh &&
socket.DMSVeh.owners &&
socket.DMSVeh.owners.find((o) => o.id.assigningPartyId === "CURRENT");
ids = [ ids = [
{ {
assigningPartyId: "CURRENT", id: {
value: socket.DMSCust.id.value, assigningPartyId: "CURRENT",
value: socket.DMSCust.id.value,
},
}, },
...socket.DMSVeh.owners.map((o) => { ...(oldOwner
return { ? [
assigningPartyId: "PREVIOUS", {
value: o.id.value, id: {
}; assigningPartyId: "PREVIOUS",
}), value: oldOwner.id.value,
},
},
]
: []),
]; ];
} }
@@ -812,7 +833,7 @@ async function UpdateDmsVehicle(socket) {
socket.DMSVeh.vehicle.deliveryDate socket.DMSVeh.vehicle.deliveryDate
).toISOString(), ).toISOString(),
}, },
owners: { ids: ids }, owners: ids,
}, },
arg3: "VEHICLES", arg3: "VEHICLES",
}); });