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, slice } from 'lodash'; import QuestionnaireForm from "../QuestionnaireForm"; import CalendarDatePicker from '../../../CalendarDatePicker'; import citizenships from "../../../../lib/citizenships.json"; import doctypes_personal from "../../../../lib/doctypes_personal.json"; import { reduxWrapper } from '../../../../store'; import AddressSuggests from "../../AddressSuggests"; import InputMask from 'react-input-mask'; import { getCitizenshipTitleByCode } from "../../../../utils/citizenship"; import { saveQuestionnaire } from "../../../../actions"; import SuggestsInput from "../../SuggestsInput"; import DocumentIssuerSuggestsInput from "../../DocumentIssuerSuggestsInput"; class ShareholderForm extends React.Component { _handle_onTextFieldChange = this.props._handle_onTextFieldChange; _handle_onCheckboxFieldChange = this.props._handle_onCheckboxFieldChange; _handle_onFieldChange = this.props._handle_onFieldChange; _checkStrValue = this.props._checkStrValue; _removeError = this.props._removeError; _handle_onIssuerCodeChange = this.props._handle_onIssuerCodeChange; _handle_onIssuerChange = this.props._handle_onIssuerChange; _handle_onCitizenshipChange = (name, value) => { console.log("_handle_onCitizenshipChange", value); let citizenship = getCitizenshipTitleByCode(value); this._handle_onFieldChange(name, { title: citizenship, code: value, }); } render() { const { index, shareholder, checking, errors } = this.props; let citizenship = { label: getCitizenshipTitleByCode(shareholder.identity_document.citizenship.code), code: shareholder.identity_document.citizenship.code }; console.log("shareholder", "citizenship", citizenship); console.log("shareholder", shareholder); return (
this._handle_onTextFieldChange(`founder_persons[${ index }].lastname`, value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange(`founder_persons[${ index }].firstname`, value) } required={ true } disabled={ checking } />
this._handle_onTextFieldChange(`founder_persons[${ index }].middlename`, value) } required={ false } disabled={ checking } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ false } 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 } />
this._handle_onTextFieldChange(event.target.name, event.target.value) } required={ true } disabled={ checking } /> {*/}
this._handle_onTextFieldChange(`founder_persons[${ index }].identity_document.placebirth`, data.name) } required={ true } disabled={ checking } />
clearFounderFromListSelection(`founder_persons[${ index }]`, { founder_from_list: !shareholder.founder_from_list ? true : false, lastname: "", firstname: "", middlename: "", no_middle_name: false, }) } />
) } { !checking && ( ) } ) } { index > 0 ? ( { shareholder.founder_from_list ? (
{ contacts !== undefined && contacts !== null && contacts.map((contact, s_index) => { const hash = `${ contact.lastname }_${ contact.firstname }_${ contact.middlename }`; const disabled = hash !== shareholder.hash ? this._checkContactListDisabled(hash) : false; if(checking) { if(shareholder.hash !== hash) { return null; } } return (
changeFounderSelectionFromList(`founder_persons[${ index }]`, { ...shareholder, ...contact, ...{ founder_from_list: false, founder_number: shareholders.length, } }) } disabled={ disabled } />
); }) }
) : ( ) }
) : ( ) }
-1 ? "error" : "" } mask='999' formatChars={{ '9': '[0-9]', }} id={ `founder_persons[${ index }].founder_part` } name={ `founder_persons[${ index }].founder_part` } value={ this._checkStrValue(shareholder.founder_part) } placeholder="Укажите размер доли" onChange={ (event) => { this._removeError("founder_part"); this._handle_onTextFieldChange(event.target.name, event.target.value > 100 ? 100 : event.target.value); } } required={ true } disabled={ checking } />
this._handle_onCheckboxFieldChange(event.target.name, parseInt(event.target.value, 10)) } disabled={ checking } />
this._handle_onCheckboxFieldChange(event.target.name, parseInt(event.target.value, 10)) } disabled={ checking } />
) } } class Form_4_Shareholders extends QuestionnaireForm { constructor(props) { super(props); this.state = { founder_persons: [], founder_persons_template: { signatory_id: null, lastname: null, firstname: null, middlename: null, no_middle_name: false, jobtitle: null, telephone: null, email: null, founder_from_list: true, founder_number: 0, founder_part: null, is_beneficial: false, identity_document: { doctype: 100000000, seria: null, docnumber: null, issuedate: null, code: null, issueby: null, issueby_search_dadata: null, placebirth: null, citizenship: { title: null, code: null, }, registration_address: { name: null, fias_id: null, } } }, loading: false, status: "empty", errors: [ [], [], [], [] ], client_contacts: [], }; this.ref_form = React.createRef(); this.ref_submit = React.createRef(); } static getDerivedStateFromProps(nextProps, prevState) { return { founder_persons: nextProps.questionnaire.founder_persons, client_contacts: nextProps.questionnaire.client_contacts, status: nextProps.questionnaire.status, }; } componentDidMount() { console.log("Form_4_Shareholders", "this.state", this.state); console.log("Form_4_Shareholders", "global.store.getState()", global.store.getState()); const founder_persons_template = JSON.parse(JSON.stringify(this.state.founder_persons_template)); if(this.state.founder_persons.length === 0) { this._updateQuestionnaire({ founder_persons: [{ ...founder_persons_template, ...{ founder_from_list: false, founder_number: this.state.founder_persons.length + 1 } }], }); } } _handle_onAddShareholder = () => { console.log("_handle_onAddShareholder"); const founder_persons = [ ...this.state.founder_persons ]; const founder_persons_template = JSON.parse(JSON.stringify(this.state.founder_persons_template)); console.log("_handle_onAddShareholder", { founder_persons_template }); if(founder_persons.length < 4) { founder_persons.push(founder_persons_template); this._updateQuestionnaire({ founder_persons, }); } } _handle_onRemoveShareholder = (index) => { const founder_persons = [ ...this.state.founder_persons ]; founder_persons.splice(index, 1); this._updateQuestionnaire({ founder_persons, }); } _handle_onClearFounderFromListSelection = (name, values) => { const founder_persons_template = JSON.parse(JSON.stringify(this.state.founder_persons_template)); const update = { ...founder_persons_template , ...values }; console.log("_handle_onClearFounderFromListSelection", update); this._handle_onFieldChange(name, update ); } _handle_onChangeFounderSelectionFromList = (name, values) => { console.log("_handle_onChangeFounderSelectionFromList"); console.log(name, values); this._handle_onFieldChange(name, { ...values } ); } _handle_onIssuerCodeChange = (branch, index, option) => { this._onRemoveError(index, `${ branch }.identity_document.code`); if(typeof option === "string") { this._handle_onTextFieldChange(`${ branch }.identity_document.code`, option); } else { this._handle_onBranchChange([ { name: `${ branch }.identity_document.code`, value: option.data.code }, { name: `${ branch }.identity_document.issueby`, value: option.value }, ]); } } _handle_onIssuerChange = (branch, index, option) => { this._onRemoveError(index, `${ branch }.identity_document.issueby`); if(typeof option === "string") { this._handle_onTextFieldChange(`${ branch }.identity_document.issueby`, option); } else { this._handle_onBranchChange([ { name: `${ branch }.identity_document.code`, value: option.data.code }, { name: `${ branch }.identity_document.issueby`, value: option.value }, ]); } } _handle_onFormSubmit = (event) => { event.preventDefault(); console.log("Form_4_Shareholders", "_handle_onFormSubmit"); this._handle_onCheckboxFieldChange("step", 5); setTimeout(() => { saveQuestionnaire(); this.props.onNextStep("regulatory"); }, 10); } _handle_onNextPage = () => { const errors = [ [], [], [], [] ]; const { founder_persons } = this.state; const check = [ "founder_part", "lastname", "firstname", "telephone", "email", "identity_document.seria", "identity_document.docnumber", "identity_document.issuedate", "identity_document.icode", "identity_document.issueby", "identity_document.placebirth", "identity_document.citizenship.code", "identity_document.registration_address.title", ]; if(parseInt(_get("signatory_person.identity_document.doctype"), 10) === 100000000) { } for(let f in founder_persons) { for(let i in check) { if(_get(founder_persons[f], check[i]) === "") { errors[f].push(check[i]); } } } this.setState({ errors }, () => { window.scroll(0, 0); this.ref_submit.current.click(); }); } _onRemoveError = (index, name) => { const errors = [ ...this.state.errors ]; if(errors.indexOf(name) > -1) { errors[index].splice(errors[index].indexOf(name), 1); } this.setState({ errors }); } _checkErrorsList = () => { const { errors } = this.state; for(let i in errors) { if(errors[i].length > 0) { return true; } } return false; } render() { const { checking } = this.props; const { founder_persons, client_contacts, loading, address, status, errors, } = this.state; //console.log("questionnaire", questionnaire); return (
{if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_4 ${ checking && "disabled" }`}>

4. Сведения об участниках (акционерах) и бенефициарных владельцах

– физических лицах, владеющих долей в уставном капитале более 25% *бенефициарный владелец (в соответствии с Федеральным законом от 07.08.2001 No115-ФЗ «О противодействии легализации (отмыванию) доходов, полученных преступным путем, и финансированию терроризма») — физическое лицо, которое в конечном счете прямо или косвенно (через третьих лиц) владеет (имеет преобладающее участие более 25 процентов в капитале) вышеуказанным лизингополучателем-юридическим лицом, либо имеет возможность контролировать действия вышеуказанного лизингополучателя. Бенефициарным владельцем лизингополучателя-физического лица считается это лицо, за исключением случаев, если имеются основания полагать, что бенефициарным владельцем является иное физическое лицо. В случае, если бенефициарным владельцем являются несколько человек, сведения предоставляются в отношении каждого.

{ this._checkErrorsList() && (

Ошибка Пожалуйста, проверьте корректность заполнения данных в форме.

) } { founder_persons.map((shareholder, index) => ( this._onRemoveError(index, name) } removeShareholder={ this._handle_onRemoveShareholder } clearFounderFromListSelection={ this._handle_onClearFounderFromListSelection } changeFounderSelectionFromList={ this._handle_onChangeFounderSelectionFromList } contacts={ client_contacts } checking={ checking } /> )) } { !checking && (
{ founder_persons.length < 4 ? ( ) : (
) }
) } ) } } function mapStateToProps(state, ownProps) { return { questionnaire: state.questionnaire, } } export const getServerSideProps = reduxWrapper.getServerSideProps(store => async ({ req, res, query }) => { } ); export default connect(mapStateToProps)(Form_4_Shareholders);