feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint
This commit is contained in:
@@ -9,6 +9,7 @@ import { SyncOutlined } from "@ant-design/icons";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import { useSocket } from "../../contexts/SocketIO/useSocket";
|
||||
import { determineDmsType } from "../../utils/determineDMSType";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -33,13 +34,23 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||
});
|
||||
const { socket: wsssocket } = useSocket();
|
||||
|
||||
useEffect(() => {
|
||||
if (Fortellis.treatment === "on") {
|
||||
const dms = determineDmsType(bodyshop);
|
||||
|
||||
const fetchAllocations = () => {
|
||||
// ✅ RR takes precedence over Fortellis
|
||||
if (dms === "rr") {
|
||||
wsssocket.emit("rr-calculate-allocations", jobId, (ack) => {
|
||||
setAllocationsSummary(ack);
|
||||
socket.allocationsSummary = ack;
|
||||
});
|
||||
} else if (Fortellis.treatment === "on") {
|
||||
// Fortellis path (unchanged)
|
||||
wsssocket.emit("fortellis-calculate-allocations", jobId, (ack) => {
|
||||
setAllocationsSummary(ack);
|
||||
socket.allocationsSummary = ack;
|
||||
});
|
||||
} else {
|
||||
// Default to CDK path
|
||||
if (socket.connected) {
|
||||
socket.emit("cdk-calculate-allocations", jobId, (ack) => {
|
||||
setAllocationsSummary(ack);
|
||||
@@ -47,7 +58,11 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [socket, socket.connected, jobId]);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchAllocations();
|
||||
}, [socket, socket.connected, jobId, dms, Fortellis?.treatment]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@@ -91,15 +106,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
|
||||
<Card
|
||||
title={title}
|
||||
extra={
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (Fortellis.treatment === "on") {
|
||||
socket.emit("fortellis-calculate-allocations", jobId, (ack) => setAllocationsSummary(ack));
|
||||
} else {
|
||||
socket.emit("cdk-calculate-allocations", jobId, (ack) => setAllocationsSummary(ack));
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Button onClick={fetchAllocations}>
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user