import React from 'react'; import ReactDomServer from 'react-dom/server'; import { _, ReactSelect as Select, PageHeader, Panel, helpers, FcDocument } from 'components'; import { List as Lists, Alert, Stack, Grid } from '@mui/material'; import { Button } from '@progress/kendo-react-buttons'; import moment from 'moment'; //pdf import { PDFExport, savePDF } from '@progress/kendo-react-pdf'; import SquarePdf from './SquarePdf'; import EightDReport from './EightDReport'; import content from './content'; import { Editor, EditorTools } from '@progress/kendo-react-editor'; //import { SampleFileBase64 } from './SampleFileBase64'; import { ERCCA } from 'apps/ERCCA/constants'; import './Form.scss'; const { Print, Pdf } = EditorTools; import { Dialog, DialogActionsBar } from '@progress/kendo-react-dialogs'; export default class Form extends React.PureComponent { constructor(props) { super(props); this._isMounted = false; this.state = { visible: false }; } componentDidMount() { this._isMounted = true; helpers.debounce(`Form-initialize`, async () => { this.initialize(); }); } componentWillUnmount() { this._isMounted = false; } initialize = async () => { if (this._isMounted) { const rccaDetail = await ERCCA.model.rccaDetail.find({ rcca_id: this.props.match.params.id, }); this._isMounted && this.setState({ rcca_status: rccaDetail.at(0).rcca_status, }); } }; toggleDialog = async (buttonName) => { let getReports = await ERCCA.API.getReport({}, {}, { id: this.props.match.params.id }); let content; if (buttonName === 'EightDReport') { content = ; } else if (buttonName === 'SquarePdf') { content = ; } this.setState({ visible: !this.state.visible, getReports: getReports, content: ReactDomServer.renderToStaticMarkup(content), }); }; toggleDialogClose = () => { this.setState({ visible: !this.state.visible, }); }; render() { return ( <> }> e-RCCA# {this.props.match.params.id} Detail Form (Status :{' '} {this.state?.rcca_status?.toLowerCase().replace(/^(.)|\s(.)/g, function ($1) { return $1.toUpperCase(); })} ){' '}


{this.state.visible && ( {this.state.getReports?.length && ( )} )} ); } }