Files
bodyshop/client/src/components/dms-post-form/dms-post-form.component.jsx
2025-11-28 14:41:00 -05:00

76 lines
1.8 KiB
JavaScript

import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { DMS_MAP } from "../../utils/dmsUtils";
import RRPostForm from "./rr-dms-post-form";
import CdkLikePostForm from "./cdklike-dms-post-form";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop
});
const mapDispatchToProps = () => ({});
export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm);
/**
* DMS Post Form component that renders the appropriate post form
* @param mode
* @param bodyshop
* @param socket
* @param job
* @param logsRef
* @param key
* @param allocationsSummary
* @param rrOpCodeParts
* @param onChangeRrOpCodeParts
* @returns {JSX.Element|null}
* @constructor
*/
export function DmsPostForm({
mode,
bodyshop,
socket,
job,
logsRef,
key,
allocationsSummary,
rrOpCodeParts,
onChangeRrOpCodeParts
}) {
switch (mode) {
case DMS_MAP.reynolds:
return (
<RRPostForm
bodyshop={bodyshop}
socket={socket}
job={job}
logsRef={logsRef}
key={key}
allocationsSummary={allocationsSummary}
opCodeParts={rrOpCodeParts}
onChangeOpCodeParts={onChangeRrOpCodeParts}
/>
);
// CDK (legacy /ws), Fortellis (CDK-over-WSS), and PBS share the same UI;
// we pass mode down so the child can choose the correct event name.
case DMS_MAP.fortellis:
case DMS_MAP.cdk:
case DMS_MAP.pbs:
return (
<CdkLikePostForm
mode={mode}
bodyshop={bodyshop}
socket={socket}
job={job}
logsRef={logsRef}
key={key}
allocationsSummary={allocationsSummary}
/>
);
default:
return null;
}
}