import React from "react"; import Head from 'next/head'; import Image from 'next/image'; import Link from "next/link"; import cookie from 'cookie'; import numeral from "numeral"; import pluralize from 'pluralize-ru'; import { SpinnerCircular } from 'spinners-react'; import Select from 'react-select'; import { connect } from "react-redux"; import { withRouter } from 'next/router'; import { get as _get } from 'lodash'; import QuestionnaireForm from "../QuestionnaireForm"; import CalendarDatePicker from '../../../CalendarDatePicker'; import FilesList from "../FilesList"; import Modal from "../../../../pages/components/Modal/modal"; import countries from "../../../../lib/countries.json"; import citizenships from "../../../../lib/citizenships.json"; import doctypes_personal from "../../../../lib/doctypes_personal.json"; import doctypes_corporate from "../../../../lib/doctypes_corporate.json"; import { reduxWrapper } from '../../../../store'; import moment from "moment"; import AddressSuggests from "../../AddressSuggests"; import InputMask from 'react-input-mask'; import SuggestsInput from "../../SuggestsInput"; import { getCitizenshipTitleByCode } from "../../../../utils/citizenship"; import { removeAttachmentFiles, saveQuestionnaire } from "../../../../actions"; class Form_3_Signer extends QuestionnaireForm { constructor(props) { super(props); this.state = { main: { title: null, inn: null, kpp: null, email: null, telephone: null, websiteurl: null, financial_loan: null, is_individual_executive: false, individual_executive_inn: "", individual_executive_kpp: "", individual_executive_oop: "", individual_executive_docnum: "", individual_executive_docdate: "", high_level: "", board_of_directors: "", collective_executive: "", individual_executive: "", other_control: "", }, head_person: { lastname: "", firstname: "", middlename: "", no_middle_name: false, jobtitle: "Генеральный директор", telephone: "", email: "", identity_document: { doctype: "", seria: "", docnumber: "", issuedate: "", code: "", issueby: "", issueby_search_dadata: "", placebirth: "", citizenship: { title: "", code: "", }, registration_address: { name: "", fias_id: "", } }, evo_assignment_date: "", evo_credentials_dateend: "", evo_indefinite: false, }, signatory_person: { not_head_person: false, lastname: "", firstname: "", middlename: "", no_middle_name: false, jobtitle: "", signer_rule_basis: "", signer_rule_basis_add: "", docdate: "", docnumber: "", delegation_agreement: false, telephone: "", email: "", identity_document: { docype: "", seria: "", docnumber: "", issuedate: "", code: "", issueby: "", issueby_search_dadata: "", placebirth: "", citizenship: { title: "", code: "", }, registration_address: { name: "", fias_id: "", } } }, delegation_files: [], head_person_files: [], signatory_person_files: [], signatory_corporate_files: [], loading: false, modal_show_personal_data: false, status: "empty", errors: [], }; this.ref_form = React.createRef(); this.ref_submit = React.createRef(); } static getDerivedStateFromProps(nextProps, prevState) { return { main: nextProps.questionnaire.main, head_person: nextProps.questionnaire.head_person, head_person_files: nextProps.questionnaire.head_person_files, delegation_files: nextProps.questionnaire.delegation_files, signatory_person: nextProps.questionnaire.signatory_person, signatory_person_files: nextProps.questionnaire.signatory_person_files, signatory_corporate_files: nextProps.questionnaire.signatory_corporate_files, status: nextProps.questionnaire.status, }; } componentDidMount() { const { main } = this.state; if( main.inn !== null && main.inn.length === 12) { this._handle_onCheckboxFieldChange("head_person.evo_indefinite", true); } } _handle_onCitizenshipChange = (name, value) => { console.log("_handle_onCitizenshipChange", value); let citizenship = getCitizenshipTitleByCode(value); this._handle_onFieldChange(name, { title: citizenship, code: value, }); } _handle_onIndefiniteChange = () => { const { head_person } = this.state; const indefinite = !head_person.evo_indefinite ? true : false; this._handle_onCheckboxFieldChange("head_person.evo_indefinite", indefinite); if(!indefinite) { setTimeout(() => { this._handle_onCheckboxFieldChange("head_person.evo_credentials_dateend", ""); }, 10); } } _handle_onChangeDelegationAgreement = () => { const { signatory_person, delegation_files } = this.state; if(!signatory_person.delegation_agreement) { this._handle_onCheckboxFieldChange("signatory_person.delegation_agreement", true); } else { removeAttachmentFiles(delegation_files); this._handle_onBranchChange([ { name: "signatory_person.delegation_agreement", value: false, }, { name: "main.individual_executive_inn", value: "", }, { name: "main.individual_executive_kpp", value: "", }, { name: "main.individual_executive_oop", value: "", }, { name: "main.individual_executive_docnum", value: "", }, { name: "main.individual_executive_docdate", value: "", }, { name: "delegation_files", value: [], }, ]); } } _handle_onNextPage = (event) => { console.log("Form_3_Signer", "_handle_onNextPage"); event.preventDefault(); const errors = []; const { main, head_person, signatory_person, } = this.state; const head_person_check = [ "lastname", "firstname", "jobtitle", "telephone", "email", "identity_document.seria", "identity_document.docnumber", "identity_document.issuedate", "identity_document.code", "identity_document.issueby", "identity_document.placebirth", "identity_document.citizenship_code", "identity_document.registration_address.title", "evo_assignment_date", ]; for(let i in head_person_check) { let v = _get(head_person, head_person_check[i]); if(v === "" || v === null) { errors.push(`head_person.${ head_person_check[i] }`); } } console.log({ errors }); if(!head_person.evo_indefinite) { if(head_person.evo_credentials_dateend === "") { errors.push(`head_person.evo_credentials_dateend`); } } //переданы if(signatory_person.delegation_agreement) { const main_check = [ "individual_executive_inn", "individual_executive_kpp", "individual_executive_oop", "individual_executive_docnum", "individual_executive_docdate", ]; for(let i in main_check) { let v = _get(main, main_check[i]); if(v === "" || v === null) { errors.push(`main.${ main_check[i] }`); } } } //иной подписант if(signatory_person.not_head_person) { const signatory_person_check = [ "lastname", "firstname", "jobtitle", "signer_rule_basis", "telephone", "email", "identity_document.seria", "identity_document.docnumber", "identity_document.issuedate", "identity_document.code", "identity_document.issueby", "identity_document.placebirth", "identity_document.citizenship.code", "identity_document.registration_address.title", ]; if(signatory_person.signer_rule_basis === 100000003) { signatory_person_check.push("signer_rule_basis_add"); } if(signatory_person.signer_rule_basis === 100000001 || signatory_person.signer_rule_basis === 100000003) { signatory_person_check.push("docdate"); signatory_person_check.push("docnumber"); } for(let i in signatory_person_check) { let v = _get(signatory_person, signatory_person_check[i]); if(v === "" || v === null) { errors.push(`signatory_person.${ signatory_person_check[i] }`); } } } this.setState({ errors }, () => { this.ref_submit.current.click(); }); //this.ref_form.current.submit(); //this.ref_form.current.dispatchEvent(new Event('submit', { cancelable: true })); } _removeError = (name) => { const errors = [ ...this.state.errors ]; if(errors.indexOf(name) > -1) { errors.splice(errors.indexOf(name), 1); } this.setState({ errors }); } _handle_onFormSubmit = (event) => { event.preventDefault(); console.log("Form_3_Signer", "_handle_onFormSubmit"); this._handle_onCheckboxFieldChange("step", 4); setTimeout(() => { saveQuestionnaire(); this.props.onNextStep("shareholders"); }, 10); } render() { const { checking } = this.props; const { personal_data_consent, head_person_files, signatory_person_files, signatory_corporate_files, delegation_files, modal_show_personal_data, errors, } = this.state; console.log("delegation_files", delegation_files); const { loading, } = this.state; const { main, head_person, signatory_person, status } = this.state; console.log("head_person.evo_assignment_date", head_person.evo_assignment_date); let head_person_citizenship = { label: getCitizenshipTitleByCode(head_person.identity_document.citizenship.code), code: head_person.identity_document.citizenship.code }; let signatory_person_citizenship = { label: getCitizenshipTitleByCode(signatory_person.identity_document.citizenship.code), code: signatory_person.identity_document.citizenship.code }; return (
{if (e.key === 'Enter') e.preventDefault() }}>

3. Информация о единоличном исполнительном органе, подписанте договора лизинга

-1 ? "error" : "" } type="lastname" id="head_person.lastname" name="head_person.lastname" value={ this._checkStrValue(head_person.lastname) } placeholder="Введите фамилию" onChange={ (value) => { this._removeError("head_person.lastname"); this._handle_onTextFieldChange("head_person.lastname", value); } } required={ true } disabled={ checking } /> {/*} this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } /> {*/}
-1 ? "error" : "" } type="firstname" id="head_person.firstname" name="head_person.firstname" value={ this._checkStrValue(head_person.firstname) } placeholder="Введите имя" onChange={ (value) => { this._removeError("head_person.firstname"); this._handle_onTextFieldChange("head_person.firstname", value) } } required={ true } disabled={ checking } /> {/*} this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } /> {*/}
-1 ? "error" : "" } type="middlename" id="head_person.middlename" name="head_person.middlename" value={ this._checkStrValue(head_person.middlename) } placeholder="Введите отчество" onChange={ (value) => { this._removeError("head_person.middlename"); this._handle_onTextFieldChange("head_person.middlename", value) } } required={ false } disabled={ checking } /> {/*} this._handle_onTextFieldChange(event.target.name, event.target.value) } disabled={ checking } /> {*/}
{ this._removeError("head_person.identity_document.issueby"); this._handle_onTextFieldChange(event.target.name, event.target.value) } } required={ true } disabled={ checking } />
{ this._removeError("head_person.identity_document.issueby"); this._handle_onTextFieldChange("head_person.identity_document.placebirth", data.title) } } required={ true } disabled={ checking } />
-1 ? "error" : "" } id="head_person.jobtitle" name="head_person.jobtitle" value={ this._checkStrValue(head_person.jobtitle) } placeholder="Укажите должность" onChange={ (event) => this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
-1 ? "error" : "" } placeholder="ДД.ММ.ГГГГ" id={ "head_person.evo_assignment_date" } value={ this._checkStrValue(head_person.evo_assignment_date) !== "" ? this._checkStrValue(head_person.evo_assignment_date) : null } onChange={ (date) => { this._removeError("head_person.evo_assignment_date"); this._handle_onTextFieldChange("head_person.evo_assignment_date", date) } } required={ true } disabled={ checking } style={{maxWidth: "320px"}} />
this._handle_onIndefiniteChange() } disabled={ checking } />
{ !head_person.evo_indefinite && (
{ console.log("date", date); this._handle_onTextFieldChange("head_person.evo_credentials_dateend", date) } } required={ true } disabled={ checking } style={{maxWidth: "320px"}} />
) } { main.inn !== null && main.inn.length < 11 && (
{ signatory_person.delegation_agreement && (

Информация об управляющей организации или управляющем

this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
{ main.individual_executive_inn !== null && main.individual_executive_inn.replace(/[^\d.-]+/g, '').length < 11 && (
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
) }

this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } disabled={ checking } />
{/*} this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } /> {*/} this._handle_onTextFieldChange("main.individual_executive_docdate", date) } required={ true } disabled={ checking } />
) }
) }
this._handle_onCheckboxFieldChange(event.target.name, !signatory_person.not_head_person ? true : false) } disabled={ checking } />
{ signatory_person.not_head_person && (

Информация о подписанте (заполняется если подписант договора лизинга отличается от единоличного исполнительного органа)

this._handle_onTextFieldChange("signatory_person.lastname", value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange("signatory_person.firstname", value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange("signatory_person.middlename", value) } required={ false } disabled={ checking } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange("signatory_person.identity_document.placebirth", data.name) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } /> {*/}
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } mask='+7 (999) 999 99 99' />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />

Реквизиты документа подтверждающие полномочия на подписание договора лизинга

this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
) } { (signatory_person.signer_rule_basis === 100000000 || signatory_person.signer_rule_basis === 100000003) && ( <>
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange("signatory_person.docdate", date) } required={ true } disabled={ checking } />
) } {/*}

№ 01/20/2020 (.PDF)Постановление

{*/}
) } {/*}
this._handle_onCheckboxFieldChange(event.target.name, !personal_data_consent ? true : false) } disabled={ checking } />
{*/} { !checking && (
) }
) } } function mapStateToProps(state, ownProps) { return { questionnaire: state.questionnaire, } } export const getServerSideProps = reduxWrapper.getServerSideProps(store => async ({ req, res, query }) => { } ); export default connect(mapStateToProps)(Form_3_Signer);