From adcf98228500d766e7185b31e5a4e55c26eef46e Mon Sep 17 00:00:00 2001 From: merelendor Date: Tue, 11 Apr 2023 09:34:13 +0300 Subject: [PATCH] updates for suggests fields --- actions/questionnaireActions.js | 11 +- .../DocumentIssuerSuggestsInput.js | 202 +++++++++++++++ components/questionnaire/SuggestsInput.js | 13 +- .../forms/DigitalSignaturesList.js | 3 +- components/questionnaire/forms/FilesList.js | 4 +- .../questionnaire/forms/Form_1_Main/index.js | 4 +- .../forms/Form_2_Contacts/index.js | 43 ++-- .../forms/Form_3_Signer/index.js | 233 ++++++++++++++---- .../forms/Form_4_Shareholders/index.js | 133 ++++++++-- .../forms/Form_5_Regulatory/index.js | 3 +- .../forms/Form_6_NonProfit/index.js | 111 ++++++++- .../questionnaire/forms/QuestionnaireForm.js | 32 ++- lib/company_functions.json | 8 + pages/api/questionnaire/download.js | 12 +- pages/api/suggests/address.js | 10 +- pages/api/suggests/document/check.js | 8 +- pages/api/suggests/document/issuer.js | 12 +- pages/api/suggests/inn.js | 67 +++++ pages/api/suggests/middlename.js | 8 +- pages/api/suggests/name.js | 8 +- reducers/initialState.js | 39 +-- 21 files changed, 782 insertions(+), 182 deletions(-) create mode 100644 components/questionnaire/DocumentIssuerSuggestsInput.js create mode 100644 lib/company_functions.json create mode 100644 pages/api/suggests/inn.js diff --git a/actions/questionnaireActions.js b/actions/questionnaireActions.js index 110ff52..57bed17 100644 --- a/actions/questionnaireActions.js +++ b/actions/questionnaireActions.js @@ -96,8 +96,8 @@ export const getQuestionnaire = ({ dispatch, id }) => questionnaire.main.email = response.data.email; questionnaire.main.websiteurl = response.data.websiteurl !== null ? response.data.websiteurl : ""; questionnaire.main.financial_loan = response.data.financial_loan !== null ? response.data.financial_loan : ""; + questionnaire.main.evo_mail_delivery_address_type = response.data.inn.length > 10 ? 100000001 : 100000000; - questionnaire.contacts.address_type = response.data.inn.length > 10 ? "fact" : "legal"; questionnaire.contacts.fact_address = response.data.fact_address; questionnaire.contacts.postal_address = response.data.postal_address; questionnaire.contacts.legal_address = response.data.legal_address; @@ -124,6 +124,15 @@ export const getQuestionnaire = ({ dispatch, id }) => }; } + for(let i in response.data.client_contacts) + { + questionnaire.client_contacts[i] = response.data.client_contacts[i]; + questionnaire.client_contacts[i].identity_document.citizenship = { + title: getCitizenshipTitleByCode(response.data.client_contacts[i].identity_document.citizenship_code), + code: response.data.client_contacts[i].identity_document.citizenship_code, + }; + } + //questionnaire.founder_persons = { ...questionnaire.head_person, ...response.data.head_person }; console.log("questionnairequestionnairequestionnaire FROM JSON", questionnaire); diff --git a/components/questionnaire/DocumentIssuerSuggestsInput.js b/components/questionnaire/DocumentIssuerSuggestsInput.js new file mode 100644 index 0000000..0bbcf38 --- /dev/null +++ b/components/questionnaire/DocumentIssuerSuggestsInput.js @@ -0,0 +1,202 @@ +import React from "react"; +import Head from 'next/head'; +import Image from 'next/image'; +import Link from "next/link"; +import cookie from 'cookie'; +import { connect } from "react-redux"; +import numeral from "numeral"; +import pluralize from 'pluralize-ru'; +import { SpinnerCircular } from 'spinners-react'; +import AsyncSelect from 'react-select/async'; +import debounce from 'debounce-promise'; +import { set as _set, get as _get } from 'lodash'; + +import { getSuggests } from '../../actions'; + +const suggestsAddressDebounce = (query) => +{ + return getSuggests("address", { query }); +} + +const suggestsFirstnameDebounce = (query) => +{ + return getSuggests("name", { query, parts: ["NAME"] }); +} + +const suggestsMiddlenameDebounce = (query) => +{ + return getSuggests("name", { query, parts: ["PATRONYMIC"] }); +} + +const suggestsLastnameDebounce = (query) => +{ + return getSuggests("name", { query, parts: ["SURNAME"] }); +} + +const suggestsIssuerDebounce = (query, max) => +{ + return getSuggests("document/issuer", { query, max }); +} + +const suggestsAddress = debounce(suggestsAddressDebounce, 200); +const suggestsFirstname = debounce(suggestsFirstnameDebounce, 200); +const suggestsMiddlename = debounce(suggestsMiddlenameDebounce, 200); +const suggestsLastname = debounce(suggestsLastnameDebounce, 200); +const suggestsIssuer = debounce(suggestsIssuerDebounce, 200); + +export default class DocumentIssuerSuggestsInput extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + focused: false, + options: [], + }; + } + + componentDidMount() + { + } + + componentDidUpdate(prevProps, prevState) + { + } + + _handle_onChange = (value) => + { + console.log("DocumentIssuerSuggestsInput", "_handle_onChange", { value }); + const { focused } = this.state; + const { onChange } = this.props; + + onChange(value); + if(focused) + { + this._getValue(value); + } + } + + _handle_onSelect = (option) => + { + console.log("DocumentIssuerSuggestsInput", "_handle_onSelect", { option }); + const { onChange } = this.props; + + this.setState({ focused: false }, () => + { + onChange(option); + }); + } + + _handle_onFocus = () => + { + this.setState({ focused: true }); + } + + _handle_onBlur = () => + { + setTimeout(() => + { + this.setState({ focused: false }); + }, 100); + } + + _getSuggests = (text) => + { + const { type, maxResults } = this.props; + + return new Promise((resolve, reject) => + { + if(type === "lastname") + { + suggestsLastname(text).then((result) => { resolve(result); }).catch(() => {}); + } + + if(type === "firstname") + { + suggestsFirstname(text).then((result) => { resolve(result); }).catch(() => {}); + } + + if(type === "middlename") + { + suggestsMiddlename(text).then((result) => { resolve(result); }).catch(() => {}); + } + + if(type === "issuer") + { + suggestsIssuer(text, maxResults).then((result) => { resolve(result); }).catch(() => {}); + } + }); + } + + _getValue = (text) => + { + return new Promise((resolve, reject) => + { + if(text === "") + { + this.setState({ options: [], value: "" }, () => + { + resolve([]); + }); + } + else + { + this._getSuggests(text) + .then((result) => + { + const options = []; + + for(let i in result.suggestions) + { + const s = result.suggestions[i]; + options.push({ ...s, value: s.value, label: s.value }); + } + + this.setState({ options }, () => + { + resolve(options); + }); + }) + .catch(() => + { + + }); + } + }) + } + + render() + { + const { focused, options } = this.state; + const { value, disabled, required, placeholder, name, className, innerStyle } = this.props; + + return ( +
+ this._handle_onChange(event.target.value) } + onFocus={ this._handle_onFocus } + onBlur={ this._handle_onBlur } + required={ required } + disabled={ disabled } + /> + { focused && options.length > 0 && ( +
+
+ { options.map((option, index) => + ( +
this._handle_onSelect(option) }>{ option.value }
+ )) } +
+
+ ) } +
+ ); + } +} \ No newline at end of file diff --git a/components/questionnaire/SuggestsInput.js b/components/questionnaire/SuggestsInput.js index 82d127b..944e7f3 100644 --- a/components/questionnaire/SuggestsInput.js +++ b/components/questionnaire/SuggestsInput.js @@ -33,10 +33,16 @@ const suggestsLastnameDebounce = (query) => return getSuggests("name", { query, parts: ["SURNAME"] }); } +const suggestsIssuerDebounce = (query) => +{ + return getSuggests("document/issuer", { query }); +} + const suggestsAddress = debounce(suggestsAddressDebounce, 200); const suggestsFirstname = debounce(suggestsFirstnameDebounce, 200); const suggestsMiddlename = debounce(suggestsMiddlenameDebounce, 200); const suggestsLastname = debounce(suggestsLastnameDebounce, 200); +const suggestsIssuer = debounce(suggestsIssuerDebounce, 200); export default class SuggestsInput extends React.Component { @@ -112,6 +118,11 @@ export default class SuggestsInput extends React.Component { suggestsMiddlename(text).then((result) => { resolve(result); }).catch(() => {}); } + + if(type === "issuer") + { + suggestsIssuer(text).then((result) => { resolve(result); }).catch(() => {}); + } }); } @@ -174,7 +185,7 @@ export default class SuggestsInput extends React.Component disabled={ disabled } /> { focused && options.length > 0 && ( -
+
{ options.map((option, index) => ( diff --git a/components/questionnaire/forms/DigitalSignaturesList.js b/components/questionnaire/forms/DigitalSignaturesList.js index f6d48e6..aa44d5a 100644 --- a/components/questionnaire/forms/DigitalSignaturesList.js +++ b/components/questionnaire/forms/DigitalSignaturesList.js @@ -170,8 +170,7 @@ export default class DigitalSignaturesList extends React.Component
- -

{ certificate?.info?.subjectName }

+

{ certificate?.info?.subjectName.replace(/\""/g, '@').replace(/"/g, '').replace(/@/g, '"') }

{ certificate.info.subjectFields['SN'] || certificate.info.subjectFields['SN'] ? ({ certificate.info.subjectFields['SN'] } { certificate.info.subjectFields['G'] }) : null } Подпись действительна до { certificate?.info?.validToDate } diff --git a/components/questionnaire/forms/FilesList.js b/components/questionnaire/forms/FilesList.js index 94c834a..17bcba1 100644 --- a/components/questionnaire/forms/FilesList.js +++ b/components/questionnaire/forms/FilesList.js @@ -94,7 +94,7 @@ export default class FilesList extends React.Component } render() { - const { files, checking, title, } = this.props; + const { files, checking, title, maxFiles = 5, } = this.props; const { loading } = this.state; console.log("FilesList", "files", files); @@ -128,7 +128,7 @@ export default class FilesList extends React.Component

) } - { !checking && ( + { files.length < (loading ? maxFiles - 1 : maxFiles) && !checking && ( this._handle_onAddFile(acceptedFiles) }> { ({getRootProps, getInputProps}) => (
diff --git a/components/questionnaire/forms/Form_1_Main/index.js b/components/questionnaire/forms/Form_1_Main/index.js index c4077c4..2e92e94 100644 --- a/components/questionnaire/forms/Form_1_Main/index.js +++ b/components/questionnaire/forms/Form_1_Main/index.js @@ -79,7 +79,6 @@ class Form_1_Main extends QuestionnaireForm _handle_onNextPage = (event) => { - console.log("Form_1_Main", "_handle_onNextPage"); event.preventDefault(); const errors = []; @@ -102,6 +101,7 @@ class Form_1_Main extends QuestionnaireForm this.setState({ errors }, () => { + window.scroll(0, 0); this.ref_submit.current.click(); }); } @@ -153,8 +153,6 @@ class Form_1_Main extends QuestionnaireForm const digit = /[0-9]/; const fin_mask = [firstLetter, digit, letter, " ", digit, letter, digit]; - console.log({ errors }); - return (
{if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_1 ${ checking && "disabled" }`}> diff --git a/components/questionnaire/forms/Form_2_Contacts/index.js b/components/questionnaire/forms/Form_2_Contacts/index.js index dccd71c..709f6ca 100644 --- a/components/questionnaire/forms/Form_2_Contacts/index.js +++ b/components/questionnaire/forms/Form_2_Contacts/index.js @@ -22,7 +22,7 @@ class Form_2_Contacts extends QuestionnaireForm super(props); this.state = { contacts: { - address_type: "legal", + evo_mail_delivery_address_type: 100000000, loading: false, fact_address: { @@ -48,6 +48,7 @@ class Form_2_Contacts extends QuestionnaireForm static getDerivedStateFromProps(nextProps, prevState) { return { + main: nextProps.questionnaire.main, contacts: nextProps.questionnaire.contacts, step: nextProps.questionnaire.step, status: nextProps.questionnaire.status, @@ -57,11 +58,11 @@ class Form_2_Contacts extends QuestionnaireForm componentDidMount() { const { company } = this.props; - const { address_type } = this.state.contacts; + const { evo_mail_delivery_address_type } = this.state.main; - if(company.inn.length > 10 && address_type === "legal") + if(company.inn.length > 10 && evo_mail_delivery_address_type === 100000000) { - this.setState({ address_type: "fact" }); + this._handle_onCheckboxFieldChange("main.evo_mail_delivery_address_type", 100000001); } } @@ -79,7 +80,7 @@ class Form_2_Contacts extends QuestionnaireForm _handle_onNextPage = () => { - const { contacts } = this.state; + const { main, contacts } = this.state; const errors = []; const check = ["fact_address", "legal_address", "postal_address"]; @@ -89,7 +90,7 @@ class Form_2_Contacts extends QuestionnaireForm errors.push(`contacts.fact_address`); } - if(contacts.address_type === "postal") + if(main.evo_mail_delivery_address_type === 100000002) { if(contacts.postal_address.name === "") { @@ -99,6 +100,7 @@ class Form_2_Contacts extends QuestionnaireForm this.setState({ errors }, () => { + window.scroll(0, 0); this.ref_submit.current.click(); }); } @@ -106,10 +108,9 @@ class Form_2_Contacts extends QuestionnaireForm render() { const { company, checking } = this.props; - const { contacts, loading, status, step, errors } = this.state; - const { address_type, legal_address, fact_address, postal_address, } = contacts; - - console.log("errors", errors); + const { main, contacts, loading, status, step, errors } = this.state; + const { fact_address, postal_address, } = contacts; + const { evo_mail_delivery_address_type } = main; return ( @@ -148,10 +149,10 @@ class Form_2_Contacts extends QuestionnaireForm { company.inn.length < 11 && (
{ this._removeError("contacts.postal_address"); this._handle_onCheckboxFieldChange(event.target.name, event.target.value); } } disabled={ checking } /> @@ -161,10 +162,10 @@ class Form_2_Contacts extends QuestionnaireForm
{ this._removeError("contacts.postal_address"); this._handle_onCheckboxFieldChange(event.target.name, event.target.value); } } disabled={ checking } /> @@ -173,22 +174,22 @@ class Form_2_Contacts extends QuestionnaireForm
this._handle_onCheckboxFieldChange(event.target.name, event.target.value) } disabled={ checking } />
diff --git a/components/questionnaire/forms/Form_3_Signer/index.js b/components/questionnaire/forms/Form_3_Signer/index.js index 9b2b38a..4e74a76 100644 --- a/components/questionnaire/forms/Form_3_Signer/index.js +++ b/components/questionnaire/forms/Form_3_Signer/index.js @@ -9,6 +9,7 @@ import { SpinnerCircular } from 'spinners-react'; import Select from 'react-select'; import { connect } from "react-redux"; import { withRouter } from 'next/router'; +import debounce from 'debounce-promise'; import { get as _get } from 'lodash'; import QuestionnaireForm from "../QuestionnaireForm"; @@ -25,7 +26,15 @@ import AddressSuggests from "../../AddressSuggests"; import InputMask from 'react-input-mask'; import SuggestsInput from "../../SuggestsInput"; import { getCitizenshipTitleByCode } from "../../../../utils/citizenship"; -import { removeAttachmentFiles, saveQuestionnaire } from "../../../../actions"; +import { removeAttachmentFiles, saveQuestionnaire, getSuggests } from "../../../../actions"; +import DocumentIssuerSuggestsInput from "../../DocumentIssuerSuggestsInput"; + +const suggestsInnDebounce = (query) => +{ + return getSuggests("inn", { query }); +} + +const suggestsInn = debounce(suggestsInnDebounce, 200); class Form_3_Signer extends QuestionnaireForm { @@ -155,7 +164,6 @@ class Form_3_Signer extends QuestionnaireForm _handle_onCitizenshipChange = (name, value) => { - console.log("_handle_onCitizenshipChange", value); let citizenship = getCitizenshipTitleByCode(value); this._handle_onFieldChange(name, { @@ -164,6 +172,40 @@ class Form_3_Signer extends QuestionnaireForm }); } + _handle_onIssuerCodeChange = (branch, option) => + { + this._removeError(`${ 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, option) => + { + this._removeError(`${ 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_onIndefiniteChange = () => { const { head_person } = this.state; @@ -203,9 +245,39 @@ class Form_3_Signer extends QuestionnaireForm } } + _handle_onInnChange = (inn) => + { + this._handle_onTextFieldChange("main.individual_executive_inn", inn); + + suggestsInn(inn.replace(/[^\d]+/g, '')) + .then((result) => + { + if(result?.suggestions.length > 0) + { + if(inn.replace(/[^\d]+/g, '').length > 10) + { + this._handle_onTextFieldChange("main.individual_executive_oop", result?.suggestions[0]?.data?.name?.full_with_opf); + } + else + { + this._handle_onBranchChange([ { + name: "main.individual_executive_oop", + value: result?.suggestions[0]?.data?.name?.full_with_opf, + }, { + name: "main.individual_executive_kpp", + value: result?.suggestions[0]?.data?.kpp, + }]); + } + } + }) + .catch(() => + { + + }); + } + _handle_onNextPage = (event) => { - console.log("Form_3_Signer", "_handle_onNextPage"); event.preventDefault(); const errors = []; @@ -222,14 +294,18 @@ class Form_3_Signer extends QuestionnaireForm "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", ]; + if(parseInt(_get(head_person, "identity_document.doctype"), 10) === 100000000) + { + head_person_check.push("identity_document.code"); + head_person_check.push("identity_document.issueby"); + } + for(let i in head_person_check) { let v = _get(head_person, head_person_check[i]); @@ -240,8 +316,6 @@ class Form_3_Signer extends QuestionnaireForm } } - console.log({ errors }); - if(!head_person.evo_indefinite) { if(head_person.evo_credentials_dateend === "") @@ -285,13 +359,17 @@ class Form_3_Signer extends QuestionnaireForm "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(parseInt(_get(signatory_person, "identity_document.doctype"), 10) === 100000000) + { + signatory_person_check.push("identity_document.code"); + signatory_person_check.push("identity_document.issueby"); + } + if(signatory_person.signer_rule_basis === 100000003) { signatory_person_check.push("signer_rule_basis_add"); @@ -321,6 +399,7 @@ class Form_3_Signer extends QuestionnaireForm this.setState({ errors }, () => { + window.scroll(0, 0); this.ref_submit.current.click(); }); //this.ref_form.current.submit(); @@ -340,7 +419,6 @@ class Form_3_Signer extends QuestionnaireForm _handle_onFormSubmit = (event) => { event.preventDefault(); - console.log("Form_3_Signer", "_handle_onFormSubmit"); this._handle_onCheckboxFieldChange("step", 4); setTimeout(() => @@ -360,9 +438,6 @@ class Form_3_Signer extends QuestionnaireForm delegation_files, } = this.state; - console.log("delegation_files", delegation_files); - 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 }; @@ -510,45 +585,78 @@ class Form_3_Signer extends QuestionnaireForm placeholder="ДД.ММ.ГГГГ" id={ "head_person.identity_document.issuedate" } value={ this._checkStrValue(head_person.identity_document.issuedate) !== "" ? this._checkStrValue(head_person.identity_document.issuedate) : null } - onChange={ (date) => { this._removeError("head_person.identity_document.issuedate"); this._handle_onTextFieldChange("head_person.identity_document.issuedate", date) } } - required={ true } - disabled={ checking } - /> -
-
- - { this._removeError("head_person.identity_document.code"); this._handle_onTextFieldChange(event.target.name, event.target.value) } } + onChange={ (date) => { this._removeError("head_person.identity_document.issuedate"); this._handle_onTextFieldChange("head_person.identity_document.issuedate", date); } } required={ true } disabled={ checking } />
+ { parseInt(head_person.identity_document.doctype, 10) === 100000000 && ( +
+ + -1 ? "error" : "" } + type="issuer" + id="head_person.identity_document.code" + name="head_person.identity_document.code" + value={ this._checkStrValue(head_person.identity_document.code) } + placeholder="Введите код" + onChange={ (value) => { this._handle_onIssuerCodeChange("head_person", value); } } + maxResults={ 5 } + required={ true } + disabled={ checking } + /> + + {/*} + { this._removeError("head_person.identity_document.code"); this._handle_onTextFieldChange(event.target.name, event.target.value); } } + required={ true } + disabled={ checking } + /> + {*/} + +
+ ) }
-
- - { this._removeError("head_person.identity_document.issueby"); this._handle_onTextFieldChange(event.target.name, event.target.value) } } - required={ true } - disabled={ checking } - /> -
+ { parseInt(head_person.identity_document.doctype, 10) === 100000000 && ( +
+ + -1 ? "error" : "" } + type="issuer" + id="head_person.identity_document.issueby" + name="head_person.identity_document.issueby" + value={ this._checkStrValue(head_person.identity_document.issueby) } + placeholder="Введите наименование подразделения выдавшего документ" + onChange={ (value) => { this._handle_onIssuerChange("head_person", value); } } + required={ true } + 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) } } + onChange={ (data) => { this._removeError("head_person.identity_document.placebirth"); this._handle_onTextFieldChange("head_person.identity_document.placebirth", data.name) } } required={ true } disabled={ checking } /> @@ -661,7 +769,7 @@ class Form_3_Signer extends QuestionnaireForm placeholder="ДД.ММ.ГГГГ" id={ "head_person.evo_credentials_dateend" } value={ this._checkStrValue(head_person.evo_credentials_dateend) !== "" ? this._checkStrValue(head_person.evo_credentials_dateend) : null } - onChange={ (date) => { console.log("date", date); this._handle_onTextFieldChange("head_person.evo_credentials_dateend", date) } } + onChange={ (date) => { this._handle_onTextFieldChange("head_person.evo_credentials_dateend", date) } } required={ true } disabled={ checking } style={{maxWidth: "320px"}} @@ -682,6 +790,7 @@ class Form_3_Signer extends QuestionnaireForm
) } { this._removeError("head_person_files"); this._handle_onAddFile(name, files); } } @@ -689,7 +798,7 @@ class Form_3_Signer extends QuestionnaireForm checking={ checking } title="Прикрепить скан паспорта единоличного исполнительного органа" /> - 0 ? head_person_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/> + {} } value={ head_person_files.length > 0 ? head_person_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/> { main.inn !== null && main.inn.length < 11 && ( @@ -725,7 +834,7 @@ class Form_3_Signer extends QuestionnaireForm name="main.individual_executive_inn" value={ this._checkStrValue(main.individual_executive_inn) } placeholder="Введите ИНН" - onChange={ (event) => this._handle_onTextFieldChange(event.target.name, event.target.value) } + onChange={ (event) => this._handle_onInnChange(event.target.value) } required={ true } disabled={ checking } /> @@ -807,13 +916,14 @@ class Form_3_Signer extends QuestionnaireForm
) } { this._removeError("delegation_files"); this._handle_onAddFile(name, files); } } onRemoveFile={ this._handle_onRemoveFile } checking={ checking } /> - 0 ? delegation_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/> + {} } value={ delegation_files.length > 0 ? delegation_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/> ) } @@ -949,6 +1059,19 @@ class Form_3_Signer extends QuestionnaireForm
+ -1 ? "error" : "" } + type="issuer" + id="signatory_person.identity_document.code" + name="signatory_person.identity_document.code" + value={ this._checkStrValue(signatory_person.identity_document.code) } + placeholder="Введите код" + onChange={ (value) => { this._handle_onIssuerCodeChange("signatory_person", value); } } + maxResults={ 5 } + required={ true } + disabled={ checking } + /> + {/*} -1 ? "error" : "" } mask='999-999' @@ -960,11 +1083,24 @@ class Form_3_Signer extends QuestionnaireForm required={ true } disabled={ checking } /> + {*/}
+ -1 ? "error" : "" } + type="issuer" + id="signatory_person.identity_document.issueby" + name="signatory_person.identity_document.issueby" + value={ this._checkStrValue(signatory_person.identity_document.issueby) } + placeholder="Введите наименование подразделения выдавшего документ" + onChange={ (value) => { this._handle_onIssuerChange("signatory_person", value); } } + required={ true } + disabled={ checking } + /> + {/*} -1 ? "error" : "" } id="signatory_person.identity_document.issueby" @@ -975,6 +1111,7 @@ class Form_3_Signer extends QuestionnaireForm required={ true } disabled={ checking } /> + {*/}
@@ -984,7 +1121,7 @@ class Form_3_Signer extends QuestionnaireForm id={ "signatory_person.identity_document.placebirth" } value={ this._checkStrValue(signatory_person.identity_document.placebirth) } placeholder="Укажите место рождения" - onChange={ (data) => this._handle_onTextFieldChange("signatory_person.identity_document.placebirth", data.name) } + onChange={ (data) => { this._handle_onTextFieldChange("signatory_person.identity_document.placebirth", data.name); } } required={ true } disabled={ checking } /> @@ -1088,6 +1225,7 @@ class Form_3_Signer extends QuestionnaireForm
) } - 0 ? signatory_person_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/> + {} } value={ signatory_person_files.length > 0 ? signatory_person_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>

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

@@ -1177,6 +1315,7 @@ class Form_3_Signer extends QuestionnaireForm
) } - 0 ? signatory_corporate_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/> + {} } value={ signatory_corporate_files.length > 0 ? signatory_corporate_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/> ) } diff --git a/components/questionnaire/forms/Form_4_Shareholders/index.js b/components/questionnaire/forms/Form_4_Shareholders/index.js index 56e5c68..672c30a 100644 --- a/components/questionnaire/forms/Form_4_Shareholders/index.js +++ b/components/questionnaire/forms/Form_4_Shareholders/index.js @@ -21,6 +21,7 @@ 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 { @@ -29,6 +30,8 @@ class ShareholderForm extends React.Component _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) => { @@ -199,6 +202,21 @@ class ShareholderForm extends React.Component />
+ -1 ? "error" : "" } + type="issuer" + id={ `founder_persons[${ index }].identity_document.code` } + name={ `founder_persons[${ index }].identity_document.code` } + value={ this._checkStrValue(shareholder.identity_document.code) } + placeholder="Введите код" + onChange={ (value) => { this._handle_onIssuerCodeChange(`founder_persons[${ index }]`, index, value); } } + maxResults={ 5 } + required={ true } + disabled={ checking } + /> + {/*} + {*/}
@@ -216,6 +235,19 @@ class ShareholderForm extends React.Component
+ -1 ? "error" : "" } + type="issuer" + id={ `founder_persons[${ index }].identity_document.issueby` } + name={ `founder_persons[${ index }].identity_document.issueby` } + value={ this._checkStrValue(shareholder.identity_document.issueby) } + placeholder="Введите наименование подразделения выдавшего документ" + onChange={ (value) => { this._handle_onIssuerChange(`founder_persons[${ index }]`, index, value); } } + maxResults={ 10 } + required={ true } + disabled={ checking } + /> + {/*} + {*/}
@@ -286,12 +319,12 @@ class Shareholder extends React.Component _checkStrValue = this.props._checkStrValue; _removeError = this.props._removeError; - _checkSignatoryDisabled = (signatory_id) => + _checkContactListDisabled = (hash) => { const { shareholders } = this.props; for(let i in shareholders) { - if(shareholders[i].signatory_id === signatory_id) + if(shareholders[i].hash === hash) { return true; } @@ -302,7 +335,7 @@ class Shareholder extends React.Component render() { - const { index, shareholders, removeShareholder, signatories, changeSignatorySelection, clearSignatorySelection, checking, errors, } = this.props; + const { index, shareholders, removeShareholder, signatories, contacts, changeFounderSelectionFromList, clearFounderFromListSelection, checking, errors, } = this.props; const shareholder = shareholders[index]; return ( @@ -320,7 +353,7 @@ class Shareholder extends React.Component checked={ shareholder.founder_from_list } id={ `founder_persons[${ index }].founder_from_list` } name={ `founder_persons[${ index }].founder_from_list` } - onChange={ (event) => clearSignatorySelection(`founder_persons[${ index }]`, { founder_from_list: !shareholder.founder_from_list ? true : false, lastname: "", firstname: "", middlename: "", no_middle_name: false, }) } + onChange={ (event) => clearFounderFromListSelection(`founder_persons[${ index }]`, { founder_from_list: !shareholder.founder_from_list ? true : false, lastname: "", firstname: "", middlename: "", no_middle_name: false, }) } />
@@ -348,12 +381,14 @@ class Shareholder extends React.Component
- { signatories !== undefined && signatories !== null && signatories.map((signatory, s_index) => { - const disabled = signatory.signatoryid !== shareholder.signatory_id ? this._checkSignatoryDisabled(signatory.signatoryid) : false; + { 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.signatory_id !== signatory.signatoryid) + if(shareholder.hash !== hash) { return null; } @@ -362,25 +397,25 @@ class Shareholder extends React.Component return (
changeSignatorySelection(`founder_persons[${ index }]`, { ...shareholder, ...{ + id={ `founder_persons[${ index }].contact_${ hash }` } + name={ `founder_persons[${ index }].contact_${ hash }` } + checked={ hash === shareholder.hash } + onChange={ () => changeFounderSelectionFromList(`founder_persons[${ index }]`, { ...shareholder, ...{ founder_from_list: true, - signatory_id: signatory.signatoryid, - lastname: _checkStrValue(signatory.lastname), - firstname: _checkStrValue(signatory.firstname), - middlename: _checkStrValue(signatory.middlename), + hash: hash, + lastname: _checkStrValue(contact.lastname), + firstname: _checkStrValue(contact.firstname), + middlename: _checkStrValue(contact.middlename), } }) } disabled={ disabled } /> -
+ { errors.indexOf("non_profit.fin_goals") > -1 && + ( +
+ + + +

Ошибка + Необходимо указать цели использования предмета лизинга для любой из категорий. +

+
+ ) } +

Укажите цели использования предмета лизинга и подтвердите их соответствие уставным целям для каждого предмета лизинга отдельно

@@ -235,7 +321,7 @@ class Form_6_NonProfit extends QuestionnaireForm value={ this._checkStrValue(non_profit.fin_goals_cars) } placeholder="Введите данные" onChange={ (event) => this._handle_onCheckboxFieldChange(event.target.name, event.target.value) } - required={ this._checkRequired("fin_goals_cars") } + required={ false } disabled={ checking } />
@@ -248,7 +334,7 @@ class Form_6_NonProfit extends QuestionnaireForm value={ this._checkStrValue(non_profit.fin_goals_trucks) } placeholder="Введите данные" onChange={ (event) => this._handle_onCheckboxFieldChange(event.target.name, event.target.value) } - required={ this._checkRequired("fin_goals_trucks") } + required={ false } disabled={ checking } />
@@ -261,18 +347,19 @@ class Form_6_NonProfit extends QuestionnaireForm value={ this._checkStrValue(non_profit.fin_goals_special) } placeholder="Введите данные" onChange={ (event) => this._handle_onCheckboxFieldChange(event.target.name, event.target.value) } - required={ this._checkRequired("fin_goals_special") } + required={ false } disabled={ checking } />
{ !checking && (
- +