feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint
This commit is contained in:
@@ -40,6 +40,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||
// ✅ RR takes precedence over Fortellis
|
||||
if (dms === "rr") {
|
||||
wsssocket.emit("rr-calculate-allocations", jobId, (ack) => {
|
||||
console.dir({ ack });
|
||||
setAllocationsSummary(ack);
|
||||
socket.allocationsSummary = ack;
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ export function DmsCustomerSelector({ bodyshop, jobid }) {
|
||||
const onUseSelected = () => {
|
||||
setOpen(false);
|
||||
if (dmsType === "rr") {
|
||||
wsssocket.emit("rr-selected-customer", { bodyshopId, selectedCustomerId: selectedCustomer, jobid });
|
||||
wsssocket.emit("rr-selected-customer", { bodyshopId, custNo: selectedCustomer, jobId: jobid });
|
||||
} else if (Fortellis.treatment === "on") {
|
||||
wsssocket.emit("fortellis-selected-customer", { selectedCustomerId: selectedCustomer, jobid });
|
||||
} else {
|
||||
@@ -95,9 +95,11 @@ export function DmsCustomerSelector({ bodyshop, jobid }) {
|
||||
const onUseGeneric = () => {
|
||||
setOpen(false);
|
||||
const generic = bodyshop.cdk_configuration?.generic_customer_number || null;
|
||||
|
||||
console.dir({ bodyshop, generic });
|
||||
if (dmsType === "rr") {
|
||||
wsssocket.emit("rr-selected-customer", { bodyshopId, selectedCustomerId: generic, jobid });
|
||||
if (generic) {
|
||||
wsssocket.emit("rr-selected-customer", { bodyshopId, custNo: generic, jobId: jobid });
|
||||
}
|
||||
} else if (Fortellis.treatment === "on") {
|
||||
wsssocket.emit("fortellis-selected-customer", { selectedCustomerId: generic, jobid });
|
||||
} else {
|
||||
@@ -109,7 +111,8 @@ export function DmsCustomerSelector({ bodyshop, jobid }) {
|
||||
const onCreateNew = () => {
|
||||
setOpen(false);
|
||||
if (dmsType === "rr") {
|
||||
wsssocket.emit("rr-selected-customer", { bodyshopId, selectedCustomerId: null, jobid });
|
||||
// RR equivalent: signal create intent explicitly
|
||||
wsssocket.emit("rr-selected-customer", { bodyshopId, create: true, jobId: jobid });
|
||||
} else if (Fortellis.treatment === "on") {
|
||||
wsssocket.emit("fortellis-selected-customer", { selectedCustomerId: null, jobid });
|
||||
} else {
|
||||
@@ -201,36 +204,13 @@ export function DmsCustomerSelector({ bodyshop, jobid }) {
|
||||
}
|
||||
];
|
||||
|
||||
// NEW: RR columns (aligned with RR CombinedSearch-style payloads; falls back gracefully)
|
||||
const rrColumns = [
|
||||
{
|
||||
title: t("jobs.fields.dms.id"),
|
||||
dataIndex: "CustomerId",
|
||||
key: "CustomerId"
|
||||
},
|
||||
{ title: t("jobs.fields.dms.id"), dataIndex: "custNo", key: "custNo" },
|
||||
{
|
||||
title: t("jobs.fields.dms.name1"),
|
||||
key: "CustomerName",
|
||||
sorter: (a, b) =>
|
||||
alphaSort(
|
||||
(a.CustomerName?.FirstName || "") + " " + (a.CustomerName?.LastName || ""),
|
||||
(b.CustomerName?.FirstName || "") + " " + (b.CustomerName?.LastName || "")
|
||||
),
|
||||
render: (record) => `${record.CustomerName?.FirstName || ""} ${record.CustomerName?.LastName || ""}`.trim()
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.dms.address"),
|
||||
key: "Address",
|
||||
render: (record) => {
|
||||
const a = record.PostalAddress || record.Address || {};
|
||||
const l1 = a.AddressLine1 || a.Line1 || "";
|
||||
const l2 = a.AddressLine2 || a.Line2 || "";
|
||||
const city = a.City || "";
|
||||
const st = a.State || a.StateProvince || "";
|
||||
const pc = a.PostalCode || "";
|
||||
const ctry = a.Country || "";
|
||||
return `${l1}${l2 ? `, ${l2}` : ""}, ${city} ${st} ${pc} ${ctry}`.trim();
|
||||
}
|
||||
dataIndex: "name",
|
||||
key: "name",
|
||||
sorter: (a, b) => alphaSort(a?.name, b?.name)
|
||||
}
|
||||
];
|
||||
|
||||
@@ -247,7 +227,7 @@ export function DmsCustomerSelector({ bodyshop, jobid }) {
|
||||
|
||||
const rowKeyFn =
|
||||
dmsType === "rr"
|
||||
? (record) => record.CustomerId || record.customerId
|
||||
? (record) => record.custNo
|
||||
: dmsType === "cdk"
|
||||
? (record) => record.id?.value || record.customerId
|
||||
: (record) => record.ContactId;
|
||||
@@ -274,7 +254,7 @@ export function DmsCustomerSelector({ bodyshop, jobid }) {
|
||||
onSelect: (record) => {
|
||||
const key =
|
||||
dmsType === "rr"
|
||||
? record.CustomerId || record.customerId
|
||||
? record.custNo
|
||||
: dmsType === "cdk"
|
||||
? record.id?.value || record.customerId
|
||||
: record.ContactId;
|
||||
|
||||
@@ -75,7 +75,7 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
||||
if (dms === "rr") {
|
||||
wsssocket.emit("rr-export-job", {
|
||||
bodyshopId: bodyshop?.id || bodyshop?.bodyshopid || bodyshop?.uuid,
|
||||
jobid: job.id,
|
||||
jobId: job.id,
|
||||
job,
|
||||
txEnvelope: values
|
||||
});
|
||||
|
||||
@@ -111,10 +111,11 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
};
|
||||
|
||||
const handleLogEvent = (payload) => setLogs((prev) => [...prev, payload]);
|
||||
|
||||
const handleExportSuccess = (payload) => {
|
||||
notification.success({ message: t("jobs.successes.exported") });
|
||||
const jobId = payload?.jobId ?? payload; // RR sends object; legacy sends raw id notification.success({ message: t("jobs.successes.exported") });
|
||||
insertAuditTrail({
|
||||
jobid: payload,
|
||||
jobid: jobId,
|
||||
operation: AuditTrailMapping.jobexported(),
|
||||
type: "jobexported"
|
||||
});
|
||||
@@ -128,6 +129,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
|
||||
// RR channels (over wss)
|
||||
wsssocket.on("rr-log-event", handleLogEvent);
|
||||
wsssocket.on("RR:LOG", handleLogEvent);
|
||||
wsssocket.on("export-success", handleExportSuccess);
|
||||
wsssocket.on("rr-export-job:result", handleRrExportResult);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user