diff --git a/components/questionnaire/AddressSuggests.js b/components/questionnaire/AddressSuggests.js
index 91a837c..bb123e0 100644
--- a/components/questionnaire/AddressSuggests.js
+++ b/components/questionnaire/AddressSuggests.js
@@ -141,7 +141,7 @@ export default class AddressSuggests extends React.Component
+
{ options.map((option, index) =>
(
-
this._handle_onSelect(option.value) }>{ option.value }
+
this._handle_onSelect(option.value) }>{ option.value }
)) }
diff --git a/components/questionnaire/forms/FormMessage.js b/components/questionnaire/forms/FormMessage.js
new file mode 100644
index 0000000..924927e
--- /dev/null
+++ b/components/questionnaire/forms/FormMessage.js
@@ -0,0 +1,27 @@
+import React from "react";
+
+export default class FormMessage extends React.Component
+{
+ constructor(props)
+ {
+ super(props);
+ this.state = {
+ };
+ }
+
+ render()
+ {
+ const { type, title, message } = this.props;
+
+ return (
+
+
+
{ title }
+ { message }
+
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/components/questionnaire/forms/Form_1_Main/index.js b/components/questionnaire/forms/Form_1_Main/index.js
index 2e92e94..1196fc1 100644
--- a/components/questionnaire/forms/Form_1_Main/index.js
+++ b/components/questionnaire/forms/Form_1_Main/index.js
@@ -14,6 +14,7 @@ import CurrencyInput from 'react-currency-input';
import QuestionnaireForm from "../QuestionnaireForm";
import { reduxWrapper } from '../../../../store';
import { saveQuestionnaire } from "../../../../actions";
+import FormMessage from "../FormMessage";
class Form_1_Main extends QuestionnaireForm
{
@@ -99,6 +100,15 @@ class Form_1_Main extends QuestionnaireForm
}
}
+ if(main.websiteurl !== null && main.websiteurl !== "")
+ {
+ const r = new RegExp('^(http:\/\/|^https:\/\/)?[a-zA-ZА-я0-9][a-zA-ZА-я0-9-]{1,61}[a-zA-ZА-я0-9](?:\.[a-zA-ZА-я]{2,})+', 'g');
+ if(!r.test(main.websiteurl))
+ {
+ errors.push(`main.websiteurl`);
+ }
+ }
+
this.setState({ errors }, () =>
{
window.scroll(0, 0);
@@ -118,7 +128,7 @@ class Form_1_Main extends QuestionnaireForm
this._handle_onFieldChange("step", 6);
}
}
-
+
_handle_onFormSubmit = (event) =>
{
event.preventDefault();
@@ -159,14 +169,7 @@ class Form_1_Main extends QuestionnaireForm
1. Информация о лизингополучателе
{ errors.length > 0 &&
(
-
-
-
Ошибка
- Пожалуйста, проверьте корректность заполнения данных в форме.
-
-
+
) }
@@ -191,7 +194,7 @@ class Form_1_Main extends QuestionnaireForm
name="main.inn"
value={ this._checkStrValue(main.inn) }
placeholder="Введите ИНН"
- onChange={ (event) => {this._removeError("main.inn"); this._handle_onTextFieldChange(event.target.name, event.target.value); } }
+ onChange={ (event) => { this._removeError("main.inn"); this._handle_onTextFieldChange(event.target.name, event.target.value); } }
required={ true }
disabled={ true }
maxLength={ 12 }
@@ -206,7 +209,7 @@ class Form_1_Main extends QuestionnaireForm
name="main.kpp"
value={ this._checkStrValue(main.kpp) }
placeholder="Введите КПП"
- onChange={ (event) => {this._removeError("main.kpp"); this._handle_onTextFieldChange(event.target.name, event.target.value); } }
+ onChange={ (event) => { this._removeError("main.kpp"); this._handle_onTextFieldChange(event.target.name, event.target.value); } }
required={ true }
disabled={ true }
/>
@@ -226,19 +229,21 @@ class Form_1_Main extends QuestionnaireForm
placeholder="Введите номер"
onChange={ (event) => { if(event.target.value !== "" && !isNaN(parseInt(event.target.value.replace(/[^\d]+/g, ''), 10)) && parseInt(event.target.value.replace(/[^\d]+/g, ''), 10) > 7) { this._removeError("main.telephone"); } this._handle_onTextFieldChange(event.target.name, event.target.value); } }
required={ true }
- disabled={ checking } >
+ disabled={ checking }>
-
+
-1 ? "error" : "" }
id="main.websiteurl"
name="main.websiteurl"
value={ this._checkStrValue(main.websiteurl) }
- placeholder="Введите адрес сайта, если есть"
- onChange={ (event) => { this._handle_onTextFieldChange(event.target.name, event.target.value); } }
+ placeholder="Например https://example.com"
+ onChange={ (event) => { this._removeError(event.target.name); this._handle_onTextFieldChange(event.target.name, event.target.value); } }
disabled={ checking }
+ pattern="^(http:\/\/|^https:\/\/)?[a-zA-ZА-я0-9][a-zA-ZА-я0-9-]{1,61}[a-zA-ZА-я0-9](?:\.[a-zA-ZА-я]{2,})+"
/>
diff --git a/components/questionnaire/forms/Form_2_Contacts/index.js b/components/questionnaire/forms/Form_2_Contacts/index.js
index e344cff..22d2698 100644
--- a/components/questionnaire/forms/Form_2_Contacts/index.js
+++ b/components/questionnaire/forms/Form_2_Contacts/index.js
@@ -14,6 +14,7 @@ import QuestionnaireForm from "../QuestionnaireForm";
import { reduxWrapper } from '../../../../store';
import AddressSuggests from "../../AddressSuggests";
import { saveQuestionnaire } from "../../../../actions";
+import FormMessage from "../FormMessage";
class Form_2_Contacts extends QuestionnaireForm
{
@@ -118,14 +119,7 @@ class Form_2_Contacts extends QuestionnaireForm
2. Адреса лизингополучателя
{ errors.length > 0 &&
(
-
diff --git a/components/questionnaire/forms/Form_3_Signer/index.js b/components/questionnaire/forms/Form_3_Signer/index.js
index 4e74a76..43387d1 100644
--- a/components/questionnaire/forms/Form_3_Signer/index.js
+++ b/components/questionnaire/forms/Form_3_Signer/index.js
@@ -28,6 +28,7 @@ import SuggestsInput from "../../SuggestsInput";
import { getCitizenshipTitleByCode } from "../../../../utils/citizenship";
import { removeAttachmentFiles, saveQuestionnaire, getSuggests } from "../../../../actions";
import DocumentIssuerSuggestsInput from "../../DocumentIssuerSuggestsInput";
+import FormMessage from "../FormMessage";
const suggestsInnDebounce = (query) =>
{
@@ -107,7 +108,7 @@ class Form_3_Signer extends QuestionnaireForm
telephone: "",
email: "",
identity_document: {
- docype: "",
+ doctype: "",
seria: "",
docnumber: "",
issuedate: "",
@@ -186,6 +187,7 @@ class Form_3_Signer extends QuestionnaireForm
{ name: `${ branch }.identity_document.code`, value: option.data.code },
{ name: `${ branch }.identity_document.issueby`, value: option.value },
]);
+ this._removeError(`${ branch }.identity_document.issueby`);
}
}
@@ -203,6 +205,7 @@ class Form_3_Signer extends QuestionnaireForm
{ name: `${ branch }.identity_document.code`, value: option.data.code },
{ name: `${ branch }.identity_document.issueby`, value: option.value },
]);
+ this._removeError(`${ branch }.identity_document.code`);
}
}
@@ -276,6 +279,14 @@ class Form_3_Signer extends QuestionnaireForm
});
}
+ _handle_onDocumentTypeChange = (branch, element) =>
+ {
+ this._handle_onBranchChange([
+ { name: `${ branch }.identity_document.doctype`, value: element.value },
+ { name: `${ branch }.identity_document.citizenship_code`, value: element.value === 100000000 ? 643 : null },
+ ]);
+ }
+
_handle_onNextPage = (event) =>
{
event.preventDefault();
@@ -296,7 +307,7 @@ class Form_3_Signer extends QuestionnaireForm
"identity_document.issuedate",
"identity_document.placebirth",
"identity_document.citizenship_code",
- "identity_document.registration_address.title",
+ "identity_document.registration_address.name",
"evo_assignment_date",
];
@@ -308,7 +319,7 @@ class Form_3_Signer extends QuestionnaireForm
for(let i in head_person_check)
{
- let v = _get(head_person, head_person_check[i]);
+ const v = _get(head_person, head_person_check[i]);
if(v === "" || v === null)
{
@@ -316,12 +327,52 @@ class Form_3_Signer extends QuestionnaireForm
}
}
+ if(head_person.evo_assignment_date !== undefined && head_person.evo_assignment_date !== null && head_person.evo_assignment_date !== "")
+ {
+ try
+ {
+ const date = moment(head_person.evo_assignment_date);
+ const today = moment();
+
+ if(date > today)
+ {
+ errors.push(`head_person.evo_assignment_date`);
+ errors.push(`head_person.evo_assignment_date_invalid`);
+ }
+ }
+ catch(e)
+ {
+ errors.push(`head_person.evo_assignment_date`);
+ errors.push(`head_person.evo_assignment_date_invalid`);
+ }
+ }
+
if(!head_person.evo_indefinite)
{
if(head_person.evo_credentials_dateend === "")
{
errors.push(`head_person.evo_credentials_dateend`);
}
+
+ if(head_person.evo_credentials_dateend !== undefined && head_person.evo_credentials_dateend !== null && head_person.evo_credentials_dateend !== "")
+ {
+ try
+ {
+ const date = moment(head_person.evo_credentials_dateend);
+ const today = moment();
+
+ if(date < today)
+ {
+ errors.push(`head_person.evo_credentials_dateend`);
+ errors.push(`head_person.evo_credentials_dateend_invalid`);
+ }
+ }
+ catch(e)
+ {
+ errors.push(`head_person.evo_credentials_dateend`);
+ errors.push(`head_person.evo_credentials_dateend_invalid`);
+ }
+ }
}
//переданы
@@ -361,7 +412,9 @@ class Form_3_Signer extends QuestionnaireForm
"identity_document.issuedate",
"identity_document.placebirth",
"identity_document.citizenship.code",
- "identity_document.registration_address.title",
+ "identity_document.registration_address.name",
+ "docnumber",
+ "docdate",
];
if(parseInt(_get(signatory_person, "identity_document.doctype"), 10) === 100000000)
@@ -400,20 +453,11 @@ class Form_3_Signer extends QuestionnaireForm
this.setState({ errors }, () =>
{
window.scroll(0, 0);
- this.ref_submit.current.click();
+ if(errors.length === 0)
+ {
+ this.ref_submit.current.click();
+ }
});
- //this.ref_form.current.submit();
- //this.ref_form.current.dispatchEvent(new Event('submit', { cancelable: true }));
- }
-
- _removeError = (name) =>
- {
- const errors = [ ...this.state.errors ];
- if(errors.indexOf(name) > -1)
- {
- errors.splice(errors.indexOf(name), 1);
- }
- this.setState({ errors });
}
_handle_onFormSubmit = (event) =>
@@ -447,14 +491,7 @@ class Form_3_Signer extends QuestionnaireForm
3. Информация о единоличном исполнительном органе, подписанте договора лизинга
{ errors.length > 0 &&
(
-
-
-
Ошибка
- Пожалуйста, проверьте корректность заполнения данных в форме.
-
-
+
) }
@@ -469,17 +506,6 @@ class Form_3_Signer extends QuestionnaireForm
required={ true }
disabled={ checking }
/>
- {/*}
- this._handle_onTextFieldChange(event.target.name, event.target.value) }
- required={ true }
- disabled={ checking }
- />
- {*/}
@@ -494,17 +520,6 @@ class Form_3_Signer extends QuestionnaireForm
required={ true }
disabled={ checking }
/>
- {/*}
- this._handle_onTextFieldChange(event.target.name, event.target.value) }
- required={ true }
- disabled={ checking }
- />
- {*/}
@@ -518,16 +533,6 @@ class Form_3_Signer extends QuestionnaireForm
required={ false }
disabled={ checking }
/>
- {/*}
- this._handle_onTextFieldChange(event.target.name, event.target.value) }
- disabled={ checking }
- />
- {*/}
@@ -537,11 +542,11 @@ class Form_3_Signer extends QuestionnaireForm
options={ doctypes_personal }
placeholder="Выберите тип документа"
noOptionsMessage={ ({ inputValue }) => !inputValue ? noOptionsText :"Ничего не найдено" }
- isSearchable={ true }
+ isSearchable={ false }
className="autocomlete"
classNamePrefix="react-select"
value={ doctypes_personal.filter((type) => head_person.identity_document.doctype === type.value) }
- onChange={ (element) => this._handle_onTextFieldChange(`head_person.identity_document.doctype`, element.value) }
+ onChange={ (element) => this._handle_onDocumentTypeChange("head_person", element) }
required={ true }
isDisabled={ checking }
/>
@@ -582,7 +587,9 @@ class Form_3_Signer extends QuestionnaireForm
-1 ? "error" : "" }
placeholder="ДД.ММ.ГГГГ"
+ max={ moment().toDate() }
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); } }
@@ -600,25 +607,11 @@ class Form_3_Signer extends QuestionnaireForm
name="head_person.identity_document.code"
value={ this._checkStrValue(head_person.identity_document.code) }
placeholder="Введите код"
- onChange={ (value) => { this._handle_onIssuerCodeChange("head_person", value); } }
+ onChange={ (value) => { this._removeError("head_person.identity_document.code"); 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 }
- />
- {*/}
-
) }
@@ -633,26 +626,16 @@ class Form_3_Signer extends QuestionnaireForm
name="head_person.identity_document.issueby"
value={ this._checkStrValue(head_person.identity_document.issueby) }
placeholder="Введите наименование подразделения выдавшего документ"
- onChange={ (value) => { this._handle_onIssuerChange("head_person", value); } }
+ onChange={ (value) => { this._removeError("head_person.identity_document.issueby"); 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 }
- />
- {*/}
) }