rrScratch3 - Progress Commit
This commit is contained in:
@@ -21,10 +21,22 @@ export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm);
|
||||
* @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 }) {
|
||||
export function DmsPostForm({
|
||||
mode,
|
||||
bodyshop,
|
||||
socket,
|
||||
job,
|
||||
logsRef,
|
||||
key,
|
||||
allocationsSummary,
|
||||
rrOpCodeParts,
|
||||
onChangeRrOpCodeParts
|
||||
}) {
|
||||
switch (mode) {
|
||||
case DMS_MAP.reynolds:
|
||||
return (
|
||||
@@ -35,6 +47,8 @@ export function DmsPostForm({ mode, bodyshop, socket, job, logsRef, key, allocat
|
||||
logsRef={logsRef}
|
||||
key={key}
|
||||
allocationsSummary={allocationsSummary}
|
||||
opCodeParts={rrOpCodeParts}
|
||||
onChangeOpCodeParts={onChangeRrOpCodeParts}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -27,10 +27,20 @@ import dayjs from "../../utils/day";
|
||||
* @param job
|
||||
* @param logsRef
|
||||
* @param allocationsSummary
|
||||
* @param opCodeParts
|
||||
* @param onChangeOpCodeParts
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
export default function RRPostForm({ bodyshop, socket, job, logsRef, allocationsSummary }) {
|
||||
export default function RRPostForm({
|
||||
bodyshop,
|
||||
socket,
|
||||
job,
|
||||
logsRef,
|
||||
allocationsSummary,
|
||||
opCodeParts,
|
||||
onChangeOpCodeParts
|
||||
}) {
|
||||
const [form] = Form.useForm();
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -98,19 +108,54 @@ export default function RRPostForm({ bodyshop, socket, job, logsRef, allocations
|
||||
: job.v_model_yr)) ||
|
||||
2019
|
||||
}-01-01`
|
||||
)
|
||||
),
|
||||
opPrefix: opCodeParts?.prefix ?? "",
|
||||
opBase: opCodeParts?.base ?? "",
|
||||
opSuffix: opCodeParts?.suffix ?? ""
|
||||
}),
|
||||
[job, t]
|
||||
[job, t, opCodeParts]
|
||||
);
|
||||
|
||||
// Keep the RR OpCode parts in sync with DmsContainer state
|
||||
const opPrefixWatch = Form.useWatch("opPrefix", form);
|
||||
const opBaseWatch = Form.useWatch("opBase", form);
|
||||
const opSuffixWatch = Form.useWatch("opSuffix", form);
|
||||
|
||||
useEffect(() => {
|
||||
if (!onChangeOpCodeParts) return;
|
||||
|
||||
onChangeOpCodeParts({
|
||||
prefix: opPrefixWatch || "",
|
||||
base: opBaseWatch || "",
|
||||
suffix: opSuffixWatch || ""
|
||||
});
|
||||
}, [opPrefixWatch, opBaseWatch, opSuffixWatch, onChangeOpCodeParts]);
|
||||
|
||||
const handleFinish = (values) => {
|
||||
if (!socket) return;
|
||||
|
||||
const { opPrefix, opBase, opSuffix, ...rest } = values;
|
||||
|
||||
const combinedOpCode = `${opPrefix || ""}${opBase || ""}${opSuffix || ""}`.trim();
|
||||
|
||||
const txEnvelope = {
|
||||
...rest,
|
||||
opPrefix,
|
||||
opBase,
|
||||
opSuffix
|
||||
};
|
||||
|
||||
if (combinedOpCode) {
|
||||
txEnvelope.opCode = combinedOpCode;
|
||||
}
|
||||
|
||||
socket.emit("rr-export-job", {
|
||||
bodyshopId: bodyshop?.id,
|
||||
jobId: job.id,
|
||||
job,
|
||||
txEnvelope: values
|
||||
txEnvelope
|
||||
});
|
||||
|
||||
logsRef?.current?.scrollIntoView({ behavior: "smooth" });
|
||||
};
|
||||
|
||||
@@ -177,10 +222,39 @@ export default function RRPostForm({ bodyshop, socket, job, logsRef, allocations
|
||||
</Form.Item>
|
||||
</Col>
|
||||
|
||||
{/* Make Override */}
|
||||
{/* RR OpCode (prefix / base / suffix) */}
|
||||
<Col xs={24} sm={12} md={12} lg={8}>
|
||||
<Form.Item name="makeOverride" label={t("jobs.fields.dms.make_override")}>
|
||||
<Input allowClear placeholder={t("general.actions.optional")} />
|
||||
<Form.Item label={t("jobs.fields.dms.rr_opcode", "RR OpCode")}>
|
||||
<Space.Compact block>
|
||||
<Form.Item name="opPrefix" noStyle>
|
||||
<Input
|
||||
allowClear
|
||||
maxLength={4}
|
||||
style={{ width: "30%" }}
|
||||
placeholder={t("jobs.fields.dms.rr_opcode_prefix", "Prefix")}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="opBase"
|
||||
noStyle
|
||||
rules={[{ required: true, message: t("general.validation.required") }]}
|
||||
>
|
||||
<Input
|
||||
allowClear
|
||||
maxLength={10}
|
||||
style={{ width: "40%" }}
|
||||
placeholder={t("jobs.fields.dms.rr_opcode_base", "Base")}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="opSuffix" noStyle>
|
||||
<Input
|
||||
allowClear
|
||||
maxLength={4}
|
||||
style={{ width: "30%" }}
|
||||
placeholder={t("jobs.fields.dms.rr_opcode_suffix", "Suffix")}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Space.Compact>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user