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 (
) }
{ 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 && (
-