updates for suggests fields

This commit is contained in:
merelendor 2023-04-11 09:34:13 +03:00
parent 486bbf9686
commit adcf982285
21 changed files with 782 additions and 182 deletions

View File

@ -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);

View File

@ -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 (
<div className="autocomlete" style={{ ...{ position: "relative" }, ...innerStyle, }}>
<input type="text"
autoComplete="off"
style={{ width: "100%" }}
className={ `react-select__control react-select__control--is-focused ${ focused ? "react-select__control--menu-is-open" : "" } ${ className }` }
id={ name }
name={ name }
value={ value }
placeholder={ placeholder !== undefined ? placeholder : "Заполните поле" }
onChange={ (event) => this._handle_onChange(event.target.value) }
onFocus={ this._handle_onFocus }
onBlur={ this._handle_onBlur }
required={ required }
disabled={ disabled }
/>
{ focused && options.length > 0 && (
<div className="react-select__menu" style={{ position: "absolute", zIndex: 1, background: "#fff", width: "100%", left: "0px", top: "40px" }}>
<div className="react-select__menu-list">
{ options.map((option, index) =>
(
<div className="react-select__option" aria-disabled="false" tab-index="-1" key={ index } onClick={ () => this._handle_onSelect(option) }>{ option.value }</div>
)) }
</div>
</div>
) }
</div>
);
}
}

View File

@ -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 && (
<div className="react-select__menu" style={{ position: "absolute", zIndex: 1, background: "#fff", width: "100%", left: "0px", top: "40px" }}>
<div className="react-select__menu" style={{ position: "absolute", zIndex: 100, background: "#fff", width: "100%", left: "0px", top: "40px" }}>
<div className="react-select__menu-list">
{ options.map((option, index) =>
(

View File

@ -170,8 +170,7 @@ export default class DigitalSignaturesList extends React.Component
<div className="feed_item user">
<img src="/assets/images/icons/avatar.svg" alt="" />
<div>
<p className="item_title">{ certificate?.info?.subjectName }</p>
<p className="item_title">{ certificate?.info?.subjectName.replace(/\""/g, '@').replace(/"/g, '').replace(/@/g, '"') }</p>
<p className="item_desc">
{ certificate.info.subjectFields['SN'] || certificate.info.subjectFields['SN'] ? (<span>{ certificate.info.subjectFields['SN'] } { certificate.info.subjectFields['G'] }</span>) : null }
<span>Подпись действительна до { certificate?.info?.validToDate }</span>

View File

@ -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
</div>
) }
{ !checking && (
{ files.length < (loading ? maxFiles - 1 : maxFiles) && !checking && (
<Dropzone onDrop={ (acceptedFiles) => this._handle_onAddFile(acceptedFiles) }>
{ ({getRootProps, getInputProps}) => (
<div className="file_upload dropzone" { ...getRootProps() } style={{ width: "32%", height: "100px", marginBottom: "25px", marginTop: "0px", cursor: "pointer", }}>

View File

@ -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 (
<React.Fragment>
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_1 ${ checking && "disabled" }`}>

View File

@ -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 (
<React.Fragment>
@ -148,10 +149,10 @@ class Form_2_Contacts extends QuestionnaireForm
{ company.inn.length < 11 && (
<div className="form_field checkbox">
<input type="radio" hidden=""
value="legal"
value={ 100000000 }
id="contacts.address_type_legal"
name="contacts.address_type"
checked={ address_type === "legal" ? true : false }
name="main.evo_mail_delivery_address_type"
checked={ parseInt(evo_mail_delivery_address_type, 10) === 100000000 ? true : false }
onChange={ (event) => { 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
<div className="form_field checkbox">
<input type="radio" hidden=""
value="fact"
value={ 100000001 }
id="contacts.address_type_fact"
name="contacts.address_type"
checked={ address_type === "fact" ? true : false }
name="main.evo_mail_delivery_address_type"
checked={ parseInt(evo_mail_delivery_address_type, 10) === 100000001 ? true : false }
onChange={ (event) => { 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
<div className="form_field checkbox">
<input type="radio" hidden=""
value="postal"
value={ 100000002 }
id="contacts.address_type_postal"
name="contacts.address_type"
checked={ address_type === "postal" ? true : false }
name="main.evo_mail_delivery_address_type"
checked={ parseInt(evo_mail_delivery_address_type, 10) === 100000002 ? true : false }
onChange={ (event) => this._handle_onCheckboxFieldChange(event.target.name, event.target.value) }
disabled={ checking }
/>
<label htmlFor="contacts.address_type_postal" className="unselectable" style={{ width: "100%" }}>
<span>По следующему адресу { address_type === "postal" && <sup className="required_label">*</sup> }</span>
<span>По следующему адресу { parseInt(evo_mail_delivery_address_type, 10) === 100000002 && <sup className="required_label">*</sup> }</span>
<AddressSuggests
className={ errors.indexOf("contacts.postal_address") > -1 ? "error" : "" }
value={ this._checkStrValue(postal_address.name) }
fias={ this._checkStrValue(postal_address.fias_id) }
onChange={ (data) => { this._removeError("contacts.postal_address"); this._handle_onTextFieldChange("contacts.postal_address", data); } }
required={ true }
disabled={ !checking && address_type === "postal" ? false : true }
disabled={ !checking && parseInt(evo_mail_delivery_address_type, 10) === 100000002 ? false : true }
/>
</label>
</div>

View File

@ -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 }
/>
</div>
<div className="form_field">
<label>Код подразделения <sup className="required_label">*</sup></label>
<InputMask
mask='999-999'
id="head_person.identity_document.code"
name="head_person.identity_document.code"
value={ this._checkStrValue(head_person.identity_document.code) }
placeholder="Введите код"
onChange={ (event) => { 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 }
/>
</div>
{ parseInt(head_person.identity_document.doctype, 10) === 100000000 && (
<div className="form_field">
<label>Код подразделения <sup className="required_label">*</sup></label>
<DocumentIssuerSuggestsInput
className={ errors.indexOf("head_person.identity_document.code") > -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 }
/>
{/*}
<InputMask
mask='999-999'
id="head_person.identity_document.code"
name="head_person.identity_document.code"
value={ this._checkStrValue(head_person.identity_document.code) }
placeholder="Введите код"
onChange={ (event) => { this._removeError("head_person.identity_document.code"); this._handle_onTextFieldChange(event.target.name, event.target.value); } }
required={ true }
disabled={ checking }
/>
{*/}
</div>
) }
</div>
<div className="form_field">
<label>Кем выдан <sup className="required_label">*</sup></label>
<input type="text"
id="head_person.identity_document.issueby"
name="head_person.identity_document.issueby"
value={ this._checkStrValue(head_person.identity_document.issueby) }
placeholder="Введите наименование подразделения выдавшего документ"
onChange={ (event) => { this._removeError("head_person.identity_document.issueby"); this._handle_onTextFieldChange(event.target.name, event.target.value) } }
required={ true }
disabled={ checking }
/>
</div>
{ parseInt(head_person.identity_document.doctype, 10) === 100000000 && (
<div className="form_field">
<label>Кем выдан <sup className="required_label">*</sup></label>
<DocumentIssuerSuggestsInput
className={ errors.indexOf("head_person.identity_document.issueby") > -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 }
/>
{/*}
<input type="text"
id="head_person.identity_document.issueby"
name="head_person.identity_document.issueby"
value={ this._checkStrValue(head_person.identity_document.issueby) }
placeholder="Введите наименование подразделения выдавшего документ"
onChange={ (event) => { this._removeError("head_person.identity_document.issueby"); this._handle_onTextFieldChange(event.target.name, event.target.value) } }
required={ true }
disabled={ checking }
/>
{*/}
</div>
) }
<div className="form_field">
<label>Место рождения <sup className="required_label">*</sup></label>
<AddressSuggests
id={ "head_person.identity_document.placebirth" }
value={ this._checkStrValue(head_person.identity_document.placebirth) }
placeholder="Укажите место рождения"
onChange={ (data) => { 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
</div>
) }
<FilesList
maxFiles={ 2 }
name="head_person_files"
files={ head_person_files }
onAddFile={ (name, files) => { this._removeError("head_person_files"); this._handle_onAddFile(name, files); } }
@ -689,7 +798,7 @@ class Form_3_Signer extends QuestionnaireForm
checking={ checking }
title="Прикрепить скан паспорта единоличного исполнительного органа"
/>
<input type="text" id="head_person_files_error_check" value={ head_person_files.length > 0 ? head_person_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>
<input type="text" id="head_person_files_error_check" onChange={ () => {} } 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
</div>
) }
<FilesList
maxFiles={ 2 }
name="delegation_files"
files={ delegation_files }
onAddFile={ (name, files) => { this._removeError("delegation_files"); this._handle_onAddFile(name, files); } }
onRemoveFile={ this._handle_onRemoveFile }
checking={ checking }
/>
<input type="text" id="delegation_files_error_check" value={ delegation_files.length > 0 ? delegation_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>
<input type="text" id="delegation_files_error_check" onChange={ () => {} } value={ delegation_files.length > 0 ? delegation_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>
</React.Fragment>
) }
@ -949,6 +1059,19 @@ class Form_3_Signer extends QuestionnaireForm
<div className="form_field">
<label>Код подразделения <sup className="required_label">*</sup></label>
<DocumentIssuerSuggestsInput
className={ errors.indexOf("signatory_person.identity_document.code") > -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 }
/>
{/*}
<InputMask
className={ errors.indexOf("signatory_person.identity_document.code") > -1 ? "error" : "" }
mask='999-999'
@ -960,11 +1083,24 @@ class Form_3_Signer extends QuestionnaireForm
required={ true }
disabled={ checking }
/>
{*/}
</div>
</div>
<div className="form_field">
<label>Кем выдан <sup className="required_label">*</sup></label>
<DocumentIssuerSuggestsInput
className={ errors.indexOf("signatory_person.identity_document.issueby") > -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 }
/>
{/*}
<input type="text"
className={ errors.indexOf("signatory_person.identity_document.issueby") > -1 ? "error" : "" }
id="signatory_person.identity_document.issueby"
@ -975,6 +1111,7 @@ class Form_3_Signer extends QuestionnaireForm
required={ true }
disabled={ checking }
/>
{*/}
</div>
<div className="form_field">
@ -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
</div>
) }
<FilesList
maxFiles={ 2 }
title="Прикрепить скан паспорта подписанта"
name="signatory_person_files"
files={ signatory_person_files }
@ -1095,7 +1233,7 @@ class Form_3_Signer extends QuestionnaireForm
onRemoveFile={ this._handle_onRemoveFile }
checking={ checking }
/>
<input type="text" id="signatory_person_files_error_check" value={ signatory_person_files.length > 0 ? signatory_person_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>
<input type="text" id="signatory_person_files_error_check" onChange={ () => {} } value={ signatory_person_files.length > 0 ? signatory_person_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>
<p><b>Реквизиты документа подтверждающие полномочия на подписание договора лизинга</b></p>
@ -1177,6 +1315,7 @@ class Form_3_Signer extends QuestionnaireForm
</div>
) }
<FilesList
maxFiles={ 2 }
title="Прикрепить скан документа на право подписи"
name="signatory_corporate_files"
files={ signatory_corporate_files }
@ -1184,7 +1323,7 @@ class Form_3_Signer extends QuestionnaireForm
onRemoveFile={ this._handle_onRemoveFile }
checking={ checking }
/>
<input type="text" id="signatory_corporate_files_error_check" value={ signatory_corporate_files.length > 0 ? signatory_corporate_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>
<input type="text" id="signatory_corporate_files_error_check" onChange={ () => {} } value={ signatory_corporate_files.length > 0 ? signatory_corporate_files.length : "" } required={ true } style={{ opacity: 0.0, height: "0px", marginTop: "-25px", display: "flex" }}/>
</>
) }

View File

@ -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
/>
</div>
<div className="form_field">
<DocumentIssuerSuggestsInput
style={{ width: "calc(100% - 198px)" }}
innerStyle={{ width: "100%", }}
className={ errors.indexOf(`founder_persons[${ index }].identity_document.code`) > -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 }
/>
{/*}
<InputMask
mask='999-999'
id={ `founder_persons[${ index }].identity_document.code` }
@ -209,6 +227,7 @@ class ShareholderForm extends React.Component
required={ true }
disabled={ checking }
/>
{*/}
</div>
</div>
</div>
@ -216,6 +235,19 @@ class ShareholderForm extends React.Component
<div className="form_field">
<label>Кем выдан <sup className="required_label">*</sup></label>
<DocumentIssuerSuggestsInput
className={ errors.indexOf(`founder_persons[${ index }].identity_document.issueby`) > -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 }
/>
{/*}
<input type="text"
id={ `founder_persons[${ index }].identity_document.issueby` }
name={ `founder_persons[${ index }].identity_document.issueby` }
@ -225,6 +257,7 @@ class ShareholderForm extends React.Component
required={ true }
disabled={ checking }
/>
{*/}
</div>
<div className="form_field" style={{ flex: 1 }}>
@ -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, }) }
/>
<label className="unselectable" htmlFor={ `founder_persons[${ index }].founder_from_list` }>Выбрать из списка</label>
</div>
@ -348,12 +381,14 @@ class Shareholder extends React.Component
<div className="feed">
<div className="feed_list">
{ 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 (
<div className="form_field checkbox" key={ s_index }>
<input type="radio" hidden=""
id={ `founder_persons[${ index }].signatory_${ signatory.signatoryid }` }
name={ `founder_persons[${ index }].signatory_${ signatory.signatoryid }` }
checked={ signatory.signatoryid === shareholder.signatory_id }
onChange={ () => 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 }
/>
<label className="unselectable" style={ disabled ? { opacity: "0.5" } : {} } htmlFor={ `founder_persons[${ index }].signatory_${ signatory.signatoryid }` }>
<label className="unselectable" style={ disabled ? { opacity: "0.5" } : {} } htmlFor={ `founder_persons[${ index }].contact_${ hash }` }>
<div className="feed_item user">
<img src="/assets/images/icons/avatar.svg" alt="" />
<div>
<p className="item_title">{ signatory.lastname } { signatory.firstname } { signatory.middlename }</p>
<p className="item_title">{ contact.lastname } { contact.firstname } { contact.middlename }</p>
<p className="item_desc">
<span>{ signatory.jobtitle }</span>
<span>{ contact.jobtitle }</span>
</p>
</div>
</div>
@ -493,6 +528,7 @@ class Form_4_Shareholders extends QuestionnaireForm
errors: [
[], [], [], []
],
client_contacts: [],
};
this.ref_form = React.createRef();
@ -503,6 +539,7 @@ class Form_4_Shareholders extends QuestionnaireForm
{
return {
founder_persons: nextProps.questionnaire.founder_persons,
client_contacts: nextProps.questionnaire.client_contacts,
status: nextProps.questionnaire.status,
};
}
@ -551,22 +588,57 @@ class Form_4_Shareholders extends QuestionnaireForm
});
}
_handle_onClearSignatorySelection = (name, values) =>
_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_onClearSignatorySelection", update);
console.log("_handle_onClearFounderFromListSelection", update);
this._handle_onFieldChange(name, update );
}
_handle_onChangeSignatorySelection = (name, values) =>
_handle_onChangeFounderSelectionFromList = (name, values) =>
{
console.log("_handle_onChangeSignatorySelection");
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();
@ -604,6 +676,10 @@ class Form_4_Shareholders extends QuestionnaireForm
"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)
@ -617,6 +693,7 @@ class Form_4_Shareholders extends QuestionnaireForm
this.setState({ errors }, () =>
{
window.scroll(0, 0);
this.ref_submit.current.click();
});
}
@ -648,9 +725,11 @@ class Form_4_Shareholders extends QuestionnaireForm
render()
{
const { signatories, checking } = this.props;
const { client_contacts, checking } = this.props;
const { founder_persons, loading, address, status, errors, } = this.state;
//console.log("questionnaire", questionnaire);
return (
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_4 ${ checking && "disabled" }`}>
<p className="title">4. Сведения об участниках (акционерах) и бенефициарных владельцах</p>
@ -681,12 +760,14 @@ class Form_4_Shareholders extends QuestionnaireForm
_handle_onTextFieldChange={ this._handle_onTextFieldChange }
_handle_onCheckboxFieldChange={ this._handle_onCheckboxFieldChange }
_handle_onFieldChange={ this._handle_onFieldChange }
_handle_onIssuerCodeChange={ this._handle_onIssuerCodeChange }
_handle_onIssuerChange={ this._handle_onIssuerChange }
_checkStrValue={ this._checkStrValue }
_removeError={ (name) => this._onRemoveError(index, name) }
removeShareholder={ this._handle_onRemoveShareholder }
clearSignatorySelection={ this._handle_onClearSignatorySelection }
changeSignatorySelection={ this._handle_onChangeSignatorySelection }
signatories={ signatories }
clearFounderFromListSelection={ this._handle_onClearFounderFromListSelection }
changeFounderSelectionFromList={ this._handle_onChangeFounderSelectionFromList }
contacts={ client_contacts }
checking={ checking }
/>
)) }

View File

@ -82,6 +82,7 @@ class Form_5_Regulatory extends QuestionnaireForm
this.setState({ errors }, () =>
{
window.scroll(0, 0);
this.ref_submit.current.click();
});
}
@ -97,7 +98,7 @@ class Form_5_Regulatory extends QuestionnaireForm
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_5 ${ checking && "disabled" }`}>
<p className="title">5. Сведения об органах управления</p>
<p>Заполняется юридическими лицами, индивидуальными предпринимателями не заполняется</p>
{ errors.length > 0 &&
{ errors.length > 0 &&
(
<div className="questionnaire message error">
<svg width="44" height="45" viewBox="0 0 44 45" fill="none" xmlns="http://www.w3.org/2000/svg">

View File

@ -109,6 +109,66 @@ class Form_6_NonProfit extends QuestionnaireForm
return false;
}
_handle_onNextPage = (event) =>
{
console.log("Form_6_NonProfit", "_handle_onNextPage");
event.preventDefault();
const { non_profit } = this.state;
const errors = [];
const fin_source = ["fin_source_business", "fin_source_donate", "fin_source_fees"];
let check_another_fin_source = true;
for(let i in fin_source)
{
if(non_profit[fin_source[i]] !== false)
{
check_another_fin_source = false;
}
}
if(check_another_fin_source)
{
if(!non_profit.fin_source_another)
{
errors.push("non_profit.fin_source");
}
else
{
if(!this._checkStrNotEmpty(non_profit.fin_source_another_description))
{
errors.push("non_profit.fin_source_another_description");
}
}
}
const fin_goals = ["fin_goals_cars", "fin_goals_trucks", "fin_goals_special"];
let fin_goals_need = true;
for(let i in fin_goals)
{
if(this._checkStrNotEmpty(non_profit[fin_goals[i]]))
{
fin_goals_need = false;
}
}
if(fin_goals_need)
{
errors.push("non_profit.fin_goals");
}
this.setState({ errors }, () =>
{
window.scroll(0, 0);
if(errors.length === 0)
{
this.ref_submit.current.click();
}
});
}
_checkRequired = (field) =>
{
const { non_profit } = this.state;
@ -130,13 +190,25 @@ class Form_6_NonProfit extends QuestionnaireForm
render()
{
const { checking } = this.props;
const { non_profit, loading, status } = this.state;
const { non_profit, loading, status, errors } = this.state;
console.log("errors", errors);
return (
<React.Fragment>
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_6 ${ checking && "disabled" }`}>
<p className="title">6. Данные о некомерческой организации</p>
{ errors.indexOf("non_profit.fin_source") > -1 &&
(
<div className="questionnaire message error">
<svg width="44" height="45" viewBox="0 0 44 45" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M40.5425 31.1863L25.7969 8.08116C24.9653 6.77804 23.5459 6 22 6C20.4539 6 19.0345 6.77804 18.2032 8.08116L3.45741 31.1862C2.57234 32.5732 2.51363 34.3313 3.30467 35.7746C4.09572 37.2173 5.60918 38.1137 7.25444 38.1137H36.7456C38.3909 38.1137 39.9044 37.2175 40.6956 35.7742C41.4863 34.3313 41.4276 32.5733 40.5425 31.1863ZM22 34.2245C20.644 34.2245 19.5448 33.1252 19.5448 31.7694C19.5448 30.4133 20.6441 29.3141 22 29.3141C23.356 29.3141 24.4551 30.4133 24.4551 31.7694C24.4551 33.1252 23.3559 34.2245 22 34.2245ZM25.403 17.1635L24.1937 25.3052C24.0157 26.5037 22.8999 27.3309 21.7016 27.1529C20.7334 27.0091 20.0075 26.25 19.8582 25.333L18.5451 17.2074C18.2394 15.3155 19.5251 13.534 21.417 13.2283C23.3089 12.9226 25.0904 14.2083 25.3962 16.1002C25.4536 16.4565 25.4517 16.8243 25.403 17.1635Z" fill="white"/>
</svg>
<p><b>Ошибка</b>
Необходимо указать источник происхождения денежных средств.
</p>
</div>
) }
<p>Источники происхождения денежных средств, из которых будут осуществляться лизинговые платежи:</p>
<div className="form_field">
@ -146,7 +218,7 @@ class Form_6_NonProfit extends QuestionnaireForm
id="non_profit.fin_source_business"
name="non_profit.fin_source_business"
checked={ non_profit.fin_source_business }
onChange={ (event) => this._handle_onCheckboxFieldChange(event.target.name, !non_profit.fin_source_business ? true : false) }
onChange={ (event) => { this._removeError("non_profit.fin_source"); this._handle_onCheckboxFieldChange(event.target.name, !non_profit.fin_source_business ? true : false); } }
disabled={ checking }
/>
<label htmlFor="non_profit.fin_source_business" className="unselectable">От приносящей доход деятельности</label>
@ -156,7 +228,7 @@ class Form_6_NonProfit extends QuestionnaireForm
id="non_profit.fin_source_donate"
name="non_profit.fin_source_donate"
checked={ non_profit.fin_source_donate }
onChange={ (event) => this._handle_onCheckboxFieldChange(event.target.name, !non_profit.fin_source_donate ? true : false) }
onChange={ (event) => { this._removeError("non_profit.fin_source"); this._handle_onCheckboxFieldChange(event.target.name, !non_profit.fin_source_donate ? true : false); } }
disabled={ checking }
/>
<label htmlFor="non_profit.fin_source_donate" className="unselectable">Добровольные пожертвования</label>
@ -167,7 +239,7 @@ class Form_6_NonProfit extends QuestionnaireForm
id="non_profit.fin_source_fees"
name="non_profit.fin_source_fees"
checked={ non_profit.fin_source_fees }
onChange={ (event) => this._handle_onCheckboxFieldChange(event.target.name, !non_profit.fin_source_fees ? true : false ) }
onChange={ (event) => { this._removeError("non_profit.fin_source"); this._handle_onCheckboxFieldChange(event.target.name, !non_profit.fin_source_fees ? true : false ); } }
disabled={ checking }
/>
<label htmlFor="non_profit.fin_source_fees" className="unselectable">Вступительные членские взносы</label>
@ -178,18 +250,20 @@ class Form_6_NonProfit extends QuestionnaireForm
id="non_profit.fin_source_another"
name="non_profit.fin_source_another"
checked={ non_profit.fin_source_another }
onChange={ (event) => this._handle_onAnother() }
onChange={ (event) => { this._removeError([ "non_profit.fin_source", "non_profit.fin_source_another_description" ]); this._handle_onAnother(); } }
disabled={ checking }
/>
<label htmlFor="non_profit.fin_source_another" style={{ width: "100%" }} className="unselectable">
<span>Иное</span>
<span>Иное { non_profit.fin_source_another && (<sup className="required_label">*</sup>) }</span>
<input type="text"
className={ errors.indexOf("non_profit.fin_source_another_description") > -1 ? "error" : "" }
id="non_profit.fin_source_another_description"
name="non_profit.fin_source_another_description"
value={ this._checkStrValue(non_profit.fin_source_another_description) }
disabled={ checking ? true : non_profit.fin_source_another ? false : true }
placeholder="Укажите источник"
onChange={ (event) => this._handle_onTextFieldChange(event.target.name, event.target.value) }
required={ non_profit.fin_source_another ? true : false }
onChange={ (event) => { this._removeError([ "non_profit.fin_source", "non_profit.fin_source_another_description" ]); this._handle_onTextFieldChange(event.target.name, event.target.value); } }
/>
</label>
</div>
@ -225,6 +299,18 @@ class Form_6_NonProfit extends QuestionnaireForm
</div>
</div>
{ errors.indexOf("non_profit.fin_goals") > -1 &&
(
<div className="questionnaire message error">
<svg width="44" height="45" viewBox="0 0 44 45" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M40.5425 31.1863L25.7969 8.08116C24.9653 6.77804 23.5459 6 22 6C20.4539 6 19.0345 6.77804 18.2032 8.08116L3.45741 31.1862C2.57234 32.5732 2.51363 34.3313 3.30467 35.7746C4.09572 37.2173 5.60918 38.1137 7.25444 38.1137H36.7456C38.3909 38.1137 39.9044 37.2175 40.6956 35.7742C41.4863 34.3313 41.4276 32.5733 40.5425 31.1863ZM22 34.2245C20.644 34.2245 19.5448 33.1252 19.5448 31.7694C19.5448 30.4133 20.6441 29.3141 22 29.3141C23.356 29.3141 24.4551 30.4133 24.4551 31.7694C24.4551 33.1252 23.3559 34.2245 22 34.2245ZM25.403 17.1635L24.1937 25.3052C24.0157 26.5037 22.8999 27.3309 21.7016 27.1529C20.7334 27.0091 20.0075 26.25 19.8582 25.333L18.5451 17.2074C18.2394 15.3155 19.5251 13.534 21.417 13.2283C23.3089 12.9226 25.0904 14.2083 25.3962 16.1002C25.4536 16.4565 25.4517 16.8243 25.403 17.1635Z" fill="white"/>
</svg>
<p><b>Ошибка</b>
Необходимо указать цели использования предмета лизинга для любой из категорий.
</p>
</div>
) }
<p>Укажите цели использования предмета лизинга и подтвердите их соответствие уставным целям для каждого предмета лизинга отдельно</p>
<div className="form_field">
@ -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 }
/>
</div>
@ -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 }
/>
</div>
@ -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 }
/>
</div>
{ !checking && (
<div className="action">
<button type="submit" className="button button-blue" disabled={ this._checkDisabled() }>
<button type="submit" className="button button-blue" onClick={ this._handle_onNextPage }>
{ loading ? (
<SpinnerCircular size={24} thickness={100} speed={100} color="rgba(255, 255, 255, 1)" secondaryColor="rgba(255, 255, 255, 0.5)" style={{ marginTop: "4px" }}/>
) : "Продолжить" }
</button>
<button ref={ this.ref_submit } type="submit" style={{ display: "none" }}/>
{ status !== "empty" && (
<>
<br/><br/>

View File

@ -38,7 +38,16 @@ export default class QuestionnaireForm extends React.Component
_checkStrValue = (value) =>
{
return value !== null ? value.toString() : "";
return value !== undefined && value !== null ? value.toString() : "";
}
_checkStrNotEmpty = (value) =>
{
if(value === null || value === undefined || value === "")
{
return false;
}
return true;
}
_getAddress = (name, text) =>
@ -64,11 +73,28 @@ export default class QuestionnaireForm extends React.Component
_removeError = (name) =>
{
console.log("_removeError", name, typeof name);
const errors = [ ...this.state.errors ];
if(errors.indexOf(name) > -1)
if(typeof name === "string")
{
errors.splice(errors.indexOf(name), 1);
if(errors.indexOf(name) > -1)
{
errors.splice(errors.indexOf(name), 1);
}
}
else
{
for(let i in name)
{
console.log("REMOVE", name[i]);
if(errors.indexOf(name[i]) > -1)
{
errors.splice(errors.indexOf(name[i]), 1);
}
}
}
this.setState({ errors });
}

View File

@ -0,0 +1,8 @@
[
{ "label": "Генеральный директор", "value": 100000000 },
{ "label": "Подписант", "value": 100000001 },
{ "label": "Бухгалтер", "value": 100000002 },
{ "label": "Бухгалтер (закрывающие док.)", "value": 100000005 },
{ "label": "Контактное лицо", "value": 100000003 },
{ "label": "Учредитель", "value": 100000004 }
]

View File

@ -10,6 +10,12 @@ import fs from 'fs';
import { PDFDocument } from 'pdf-lib';
import fontkit from '@pdf-lib/fontkit';
const address = {
100000000: "legal",
100000001: "fact",
100000002: "postal",
};
const fields = {
main: {
title: { name: "main_title", type: "text", bind: null, },
@ -31,9 +37,9 @@ const fields = {
collective_executive: { name: "execution_team", type: "text", bind: null, size: 6 },
individual_executive: { name: "execution_sole", type: "text", bind: null, size: 6 },
other_control: { name: "execution_another", type: "text", bind: null, size: 6 },
evo_mail_delivery_address_type: { name: "evo_mail_delivery_address_type", type: "radio", bind: null },
},
contacts: {
address_type: { name: "address_type", type: "radio", bind: null },
fact_address: { name: "address_fact", type: "text", bind: null },
postal_address: { name: "address_postal", type: "text", bind: null },
},
@ -241,10 +247,10 @@ export default async function handler(req, res)
fields[group][field].bind.setText(questionnaire[group].fact_address.name.toUpperCase());
}
}
else if(field === "address_type")
else if(field === "evo_mail_delivery_address_type")
{
fields[group][field].bind = form.getRadioGroup(fields[group][field].name);
fields[group][field].bind.select(questionnaire[group].address_type);
fields[group][field].bind.select(address[ questionnaire[group].evo_mail_delivery_address_type ]);
}
/*
else if(field === "foreign_payers")

View File

@ -45,23 +45,23 @@ export default async function handler(req, res)
console.log("error");
console.error(error);
res.status(500);
res.status(500).send();
});
}
catch(e)
{
console.error(e);
res.status(500);
res.status(500).send();
}
}
else
{
res.status(403);
}
res.status(403).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
}

View File

@ -42,23 +42,23 @@ export default async function handler(req, res)
console.log("error");
console.error(error);
res.status(500);
res.status(500).send();
});
}
catch(e)
{
console.error(e);
res.status(500);
res.status(500).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
}

View File

@ -23,9 +23,9 @@ export default async function handler(req, res)
{
try
{
const { query, } = req.body;
const { query, max } = req.body;
axios.post(`https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/fms_unit`, { query }, {
axios.post(`https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/fms_unit`, { query, count: max ? max : 10 }, {
httpAgent: keepAliveAgent,
headers: {
"Content-Type": "application/json",
@ -42,23 +42,23 @@ export default async function handler(req, res)
console.log("error");
console.error(error);
res.status(500);
res.status(500).send();
});
}
catch(e)
{
console.error(e);
res.status(500);
res.status(500).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
}

67
pages/api/suggests/inn.js Normal file
View File

@ -0,0 +1,67 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import https from 'https';
import axios from 'axios';
import { Cookies } from 'react-cookie';
import cookie from 'cookie';
import moment from 'moment';
import jwt from 'jsonwebtoken';
import { cors } from '../../../lib/cors';
const keepAliveAgent = new https.Agent({ keepAlive: true });
export default async function handler(req, res)
{
await cors(req, res);
if(req.headers.cookie !== undefined)
{
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
if(cookies.jwt !== undefined && cookies.jwt !== null)
{
if(jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT))
{
try
{
const { query, } = req.body;
axios.post(`https://suggestions.dadata.ru/suggestions/api/4_1/rs/findById/party`, { query }, {
httpAgent: keepAliveAgent,
headers: {
"Content-Type": "application/json",
"Authorization": `Token ${ process.env.DADATA_API_KEY }`,
"X-Secret": process.env.DADATA_SECRET_KEY
},
})
.then((api_response) =>
{
//console.log("RESPONSE");
//console.log(api_response.data);
res.status(200).send(api_response.data);
})
.catch((error) =>
{
console.log("error");
console.error(error);
res.status(500).send();
});
}
catch(e)
{
console.error(e);
res.status(500).send();
}
}
else
{
res.status(403).send();
}
}
else
{
res.status(403).send();
}
}
}

View File

@ -42,23 +42,23 @@ export default async function handler(req, res)
console.log("error");
console.error(error);
res.status(500);
res.status(500).send();
});
}
catch(e)
{
console.error(e);
res.status(500);
res.status(500).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
}

View File

@ -42,23 +42,23 @@ export default async function handler(req, res)
console.log("error");
console.error(error);
res.status(500);
res.status(500).send();
});
}
catch(e)
{
console.error(e);
res.status(500);
res.status(500).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
else
{
res.status(403);
res.status(403).send();
}
}
}

View File

@ -25,7 +25,7 @@ export const questionnaire_template = {
},
delegation_files: [],
contacts: {
address_type: "legal",
evo_mail_delivery_address_type: 100000000,
legal_address: {
name: null,
fias_id: null,
@ -106,42 +106,7 @@ export const questionnaire_template = {
signatory_person_files: [],
signatory_corporate_files: [],
founder_persons: [],
client_contacts: {
lastname: null,
firstname: null,
middlename: null,
no_middle_name: false,
jobtitle: null,
assignment_date: null,
indefinite: false,
credentials_dateend: null,
telephone: null,
email: null,
signer_rule_basis: null,
signer_rule_basis_add: null,
docdate: null,
docnumber: null,
delegation_agreement: false,
functiontype: null,
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,
}
}
},
client_contacts: [],
non_profit: {
fin_source_business: false,
fin_source_donate: false,