diff --git a/components/questionnaire/forms/DigitalCertificates.js b/components/questionnaire/forms/DigitalCertificates.js index 3bb089f..59f78e0 100644 --- a/components/questionnaire/forms/DigitalCertificates.js +++ b/components/questionnaire/forms/DigitalCertificates.js @@ -48,9 +48,16 @@ export default class DigitalCertificates extends React.Component this.cryptopro.certificateInfo(certificate.id) .then((cert) => { - if(cert.IsValid) + if(cert.Subject['INNLE'] !== undefined && cert.Subject['INNLE'] !== null && cert.Subject['INNLE'] !== "") { - callback(null, [ { id: certificate.id, fields: cert.Subject, valid_to_date: moment(cert.ValidToDate).format("DD.MM.YYYY") } ]); + if(cert.IsValid) + { + callback(null, [ { id: certificate.id, fields: cert.Subject, valid_to_date: moment(cert.ValidToDate).format("DD.MM.YYYY") } ]); + } + else + { + callback(null, []); + } } else { @@ -87,7 +94,7 @@ export default class DigitalCertificates extends React.Component this.setState({ signing: true }, () => { const { company, main, onSignDigital } = this.props; - const filename = `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf`; + const filename = `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.sig`; downloadQuestionnaire({ filename, download: false, base64: true }) .then(({ file }) => @@ -98,7 +105,9 @@ export default class DigitalCertificates extends React.Component this.cryptopro.signData(file_to_sign, this.state.certificate_selected.id) .then(signature => { - uploadSignedFile(signature, company.questionnaire_id, true) + console.log({ signature }); + let signature_file = new File([ signature ], filename); + uploadSignedFile(signature_file, company.questionnaire_id, true) .then(() => { onSignDigital(); @@ -163,11 +172,11 @@ export default class DigitalCertificates extends React.Component { certificate.fields['SN'] ? ({ certificate.fields['SN'] } { certificate.fields['G'] }) : null }
- ИНН { certificate.fields['INN'] } + ИНН { certificate.fields['INNLE'] }
{ certificate.fields['OGRNIP'] && (ОГРНИП { certificate.fields['OGRNIP'] }) } - { certificate.fields['OGRN'] && (ОГРН { certificate.fields['ОГРН'] }) } + { certificate.fields['OGRN'] && (ОГРН { certificate.fields['OGRN'] }) }
Подпись действительна до { certificate.valid_to_date } diff --git a/components/questionnaire/forms/FormMessage.js b/components/questionnaire/forms/FormMessage.js index 924927e..7e5ebef 100644 --- a/components/questionnaire/forms/FormMessage.js +++ b/components/questionnaire/forms/FormMessage.js @@ -11,13 +11,26 @@ export default class FormMessage extends React.Component render() { - const { type, title, message } = this.props; + const { type, title, message, style } = this.props; return ( -
{ title } { message }
diff --git a/components/questionnaire/forms/Form_3_Signer/index.js b/components/questionnaire/forms/Form_3_Signer/index.js index 6c959dd..af4f929 100644 --- a/components/questionnaire/forms/Form_3_Signer/index.js +++ b/components/questionnaire/forms/Form_3_Signer/index.js @@ -608,21 +608,21 @@ class Form_3_Signer extends QuestionnaireForm errors.push(`signatory_person.identity_document.docnumber`); } } + + if(head_person.lastname !== null && head_person.lastname !== "" && head_person.firstname !== null && head_person.firstname !== "") + { + if(signatory_person.lastname !== null && signatory_person.lastname !== "" && signatory_person.firstname !== null && signatory_person.firstname !== "") + { + if(head_person.lastname === signatory_person.lastname && head_person.firstname === signatory_person.firstname) + { + errors.push(`signatory_person.identical`); + } + } + } } if(head_person_files.length === 0) { errors.push(`head_person_files`); } - if(head_person.lastname !== null && head_person.lastname !== "" && head_person.firstname !== null && head_person.firstname !== "") - { - if(signatory_person.lastname !== null && signatory_person.lastname !== "" && signatory_person.firstname !== null && signatory_person.firstname !== "") - { - if(head_person.lastname === signatory_person.lastname && head_person.firstname === signatory_person.firstname) - { - errors.push(`signatory_person.identical`); - } - } - } - this.setState({ errors, loading: false }, () => { window.scroll(0, 0); diff --git a/components/questionnaire/forms/Form_8_Signing/index.js b/components/questionnaire/forms/Form_8_Signing/index.js index b7d0790..849dd77 100644 --- a/components/questionnaire/forms/Form_8_Signing/index.js +++ b/components/questionnaire/forms/Form_8_Signing/index.js @@ -14,8 +14,7 @@ import NoSSR from "@mpth/react-no-ssr"; import QuestionnaireForm from "../QuestionnaireForm"; import { MatchMedia } from '../../../../utils/mediaqueries'; import { reduxWrapper } from '../../../../store'; -import DigitalSignaturesList from "../DigitalSignaturesList"; -import { downloadQuestionnaire } from "../../../../actions"; +import { downloadQuestionnaire, saveQuestionnaire } from "../../../../actions"; import DigitalCertificates from "../DigitalCertificates"; import FormMessage from "../FormMessage"; @@ -25,6 +24,7 @@ class Form_8_Signing extends QuestionnaireForm { super(props); this.state = { + loading: true, main: {}, signatory_person: {}, sign_digital: true, @@ -35,6 +35,7 @@ class Form_8_Signing extends QuestionnaireForm downloading: false, error: false, digital_disabled: false, + sign: {}, }; } @@ -43,21 +44,37 @@ class Form_8_Signing extends QuestionnaireForm return { main: nextProps.questionnaire.main, signatory_person: nextProps.questionnaire.signatory_person, + sign: nextProps.questionnaire.sign, company: nextProps.company, }; } componentDidMount() { - const { main, signatory_person } = this.state; - const update = { filename: `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf` }; - if(signatory_person.not_head_person) - { - update.sign_digital = false; - update.digital_disabled = true; - } + console.log("Form_8_Signing", "CDM"); - this.setState({ ...this.state, ...update }); + //setTimeout(() => + //{ + console.log("Form_8_Signing", "CDM", { state: this.state }); + + const { main, signatory_person } = this.state; + const update = { filename: `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf` }; + let digital = true; + + if(signatory_person.not_head_person) + { + update.digital_disabled = true; + digital = false; + } + + this.setState({ ...this.state, ...update, ...{ loading: false } }, () => + { + this._handle_onBranchChange([ + { name: `sign.digital`, value: digital }, + ]); + }); + + //}, 50); } _handle_onFormSubmit = (event) => @@ -86,129 +103,147 @@ class Form_8_Signing extends QuestionnaireForm { this.setState({ downloading: true }, () => { - downloadQuestionnaire({ filename, download: true }) + saveQuestionnaire() .then(() => { - this._handle_onCheckboxFieldChange("step", 9); - setTimeout(() => + downloadQuestionnaire({ filename, download: true }) + .then(() => { - this.props.onNextStep("status"); - this.props.onSuccess(); - }, 10); + this._handle_onCheckboxFieldChange("step", 9); + setTimeout(() => + { + this.props.onNextStep("status"); + }, 10); + }) + .catch(() => + { + this.setState({ downloading: false, error: true, }) + }); }) .catch(() => { this.setState({ downloading: false, error: true, }) - }) - }); + }); + }); } } _handle_onChangeSignMethod = () => { - const { sign_digital } = this.state; - this.setState({ sign_digital: sign_digital ? false : true }, () => - { - window.scrollTo(0, 0); - }); + const { sign } = this.state; + this._handle_onBranchChange([ + { name: `sign.digital`, value: sign.digital ? false : true }, + ]); + window.scrollTo(0, 0); } render() { - const { filename, sign_digital, mobile, company, main, downloading, error, digital_disabled } = this.state; + const { loading, filename, sign_digital, sign, mobile, company, main, downloading, error, digital_disabled } = this.state; - return ( -