import { DatePicker, Form, Input, Row, Col, Select, Image, Tag, Flex } from "antd";
import { COMMITMENT_PARAGRAPHS } from "../../filingCommitment";
const BLANK_STYLE = {
display: "inline-block",
minWidth: 120,
padding: "0 4px 2px",
borderBottom: "1px solid #333",
textAlign: "center",
lineHeight: 1.6,
};
function renderBlank(value) {
const text = value?.trim() || "";
return {text || "\u00A0".repeat(8)};
}
function CommitmentBody({ legalRepName, filingUnitName }) {
const values = { legalRepName, filingUnitName };
return (
{COMMITMENT_PARAGRAPHS.map((paragraph) => (
{paragraph.parts.map((part, index) => {
if (part.type === "blank") {
return (
{renderBlank(values[part.field])}
);
}
return {part.value};
})}
))}
);
}
export default function CommitmentStep({
form,
disabled,
personnelOptions = [],
handleVerifyConfirm,
mode
}) {
const legalRepName = Form.useWatch("legalRepName", form);
const filingUnitName = Form.useWatch("filingUnitName", form);
const legalRepSignatureUrl= Form.useWatch('legalRepSignatureUrl', form);
const handleLegalRepChange = (personnelId) => {
if (!personnelId) {
form.setFieldsValue({ legalRepPersonnelId: undefined, legalRepName: "", legalRepSignatureUrl: null });
return;
}
const selected = personnelOptions.find(
(item) => item.value === personnelId,
);
form.setFieldsValue({
legalRepPersonnelId: personnelId,
legalRepName: selected?.staffName || selected?.label || "",
legalRepSignatureUrl: null
});
handleVerifyConfirm({ isSaveDraft: true, isSign: true });
};
return (
);
}