WIP Fortellis.

This commit is contained in:
Patrick Fic
2025-04-25 11:58:38 -07:00
parent e2b4b408ed
commit 19ce1c66ad
7 changed files with 895 additions and 414 deletions

View File

@@ -17,7 +17,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps)(DmsCustomerSelector);
export function DmsCustomerSelector({ bodyshop }) {
export function DmsCustomerSelector({ bodyshop, jobid }) {
const { t } = useTranslation();
const [customerList, setcustomerList] = useState([]);
const [open, setOpen] = useState(false);
@@ -38,7 +38,7 @@ export function DmsCustomerSelector({ bodyshop }) {
if (Fortellis.treatment === "on") {
const handleFortellisSelectCustomer = (customerList, callback) => {
setOpen(true);
setDmsType("fortellis");
setDmsType("cdk");
setcustomerList(customerList);
};
wsssocket.on("fortellis-select-customer", handleFortellisSelectCustomer);
@@ -67,7 +67,11 @@ export function DmsCustomerSelector({ bodyshop }) {
const onUseSelected = () => {
setOpen(false);
socket.emit(`${dmsType}-selected-customer`, selectedCustomer);
if (Fortellis.treatment === "on") {
wsssocket.emit(`fortellis-selected-customer`, { selectedCustomerId: selectedCustomer, jobid });
} else {
socket.emit(`${dmsType}-selected-customer`, selectedCustomer);
}
setSelectedCustomer(null);
};

View File

@@ -72,7 +72,13 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
const handleFinish = (values) => {
//TODO: Add this as a split instead.
if (Fortellis.treatment === "on") {
wsssocket.emit("fortellis-export-job", { jobid: job.id, txEnvelope: values });
wsssocket.emit("fortellis-export-job", {
jobid: job.id,
txEnvelope: {
...values,
SubscriptionID: "5b527d7d-baf3-40bc-adae-e7a541e37363" //bodyshop.cdk_dealerid
}
});
} else {
socket.emit(`${determineDmsType(bodyshop)}-export-job`, {
jobid: job.id,

View File

@@ -201,7 +201,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
<DmsPostForm socket={socket} jobId={jobId} job={data && data.jobs_by_pk} logsRef={logsRef} />
</Col>
<DmsCustomerSelector />
<DmsCustomerSelector jobid={jobId} />
<Col span={24}>
<div ref={logsRef}>