UPDATE: add trace (log/debug/error) wrapper, fix questionnaire css & logical errors with citizenship
This commit is contained in:
parent
0de9b0add6
commit
f4b1fbac01
@ -15,6 +15,7 @@ import QuestionnaireForm from "../QuestionnaireForm";
|
||||
import { reduxWrapper } from '../../../../store';
|
||||
import { saveQuestionnaire } from "../../../../actions";
|
||||
import FormMessage from "../FormMessage";
|
||||
import { traceDebug } from "../../../../utils";
|
||||
|
||||
class Form_1_Main extends QuestionnaireForm
|
||||
{
|
||||
@ -150,6 +151,10 @@ class Form_1_Main extends QuestionnaireForm
|
||||
{
|
||||
this.ref_submit.current.click();
|
||||
}
|
||||
else
|
||||
{
|
||||
traceDebug({ errors });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import { reduxWrapper } from '../../../../store';
|
||||
import AddressSuggests from "../../AddressSuggests";
|
||||
import { saveQuestionnaire } from "../../../../actions";
|
||||
import FormMessage from "../FormMessage";
|
||||
import { traceDebug } from "../../../../utils";
|
||||
|
||||
class Form_2_Contacts extends QuestionnaireForm
|
||||
{
|
||||
@ -101,7 +102,14 @@ class Form_2_Contacts extends QuestionnaireForm
|
||||
this.setState({ errors }, () =>
|
||||
{
|
||||
window.scroll(0, 0);
|
||||
this.ref_submit.current.click();
|
||||
if(errors.length === 0)
|
||||
{
|
||||
this.ref_submit.current.click();
|
||||
}
|
||||
else
|
||||
{
|
||||
traceDebug({ errors });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ import { getCitizenshipTitleByCode } from "../../../../utils/citizenship";
|
||||
import { removeAttachmentFiles, saveQuestionnaire, getSuggests, checkDocumentData } from "../../../../actions";
|
||||
import DocumentIssuerSuggestsInput from "../../DocumentIssuerSuggestsInput";
|
||||
import FormMessage from "../FormMessage";
|
||||
import { traceDebug } from "../../../../utils";
|
||||
|
||||
const is_valid_inn = (i) =>
|
||||
{
|
||||
@ -379,9 +380,6 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
|
||||
_handle_onSignerFromListSelect = (contact) =>
|
||||
{
|
||||
//console.log(contact);
|
||||
|
||||
|
||||
const signer = { ...JSON.parse(JSON.stringify(signer_template)), ...contact };
|
||||
if(signer.identity_document === undefined || signer.identity_document === null)
|
||||
{
|
||||
@ -418,7 +416,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
"identity_document.docnumber",
|
||||
"identity_document.issuedate",
|
||||
"identity_document.placebirth",
|
||||
"identity_document.citizenship_code",
|
||||
"identity_document.citizenship.code",
|
||||
"identity_document.registration_address.name",
|
||||
/*
|
||||
Запрос 2024-02-08 на удаление даты назначения и даты окончания полномочий
|
||||
@ -437,7 +435,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
{
|
||||
const v = _get(head_person, head_person_check[i]);
|
||||
|
||||
if(v === "" || v === null)
|
||||
if(v === "" || v === null || v === undefined)
|
||||
{
|
||||
errors.push(`head_person.${ head_person_check[i] }`);
|
||||
}
|
||||
@ -572,7 +570,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
}
|
||||
else
|
||||
{
|
||||
if(v === "" || v === null)
|
||||
if(v === "" || v === null || v === undefined)
|
||||
{
|
||||
errors.push(`main.${ main_check[i] }`);
|
||||
}
|
||||
@ -635,7 +633,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
{
|
||||
let v = _get(signatory_person, signatory_person_check[i]);
|
||||
|
||||
if(v === "" || v === null)
|
||||
if(v === "" || v === null || v === undefined)
|
||||
{
|
||||
errors.push(`signatory_person.${ signatory_person_check[i] }`);
|
||||
}
|
||||
@ -677,6 +675,10 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
{
|
||||
this.ref_submit.current.click();
|
||||
}
|
||||
else
|
||||
{
|
||||
traceDebug({ errors });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -705,8 +707,6 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
client_contacts,
|
||||
} = this.state;
|
||||
|
||||
//console.log({ errors });
|
||||
|
||||
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 };
|
||||
|
||||
@ -876,7 +876,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
</div>
|
||||
|
||||
{ parseInt(head_person.identity_document.doctype, 10) !== 100000000 && (
|
||||
<div className="form_field">
|
||||
<div className="form_field" style={{ zIndex: 10 }}>
|
||||
<label>Гражданство <sup className="required_label">*</sup></label>
|
||||
<Select
|
||||
id="head_person.identity_document.citizenship"
|
||||
@ -887,7 +887,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
isSearchable={ true }
|
||||
className="autocomlete"
|
||||
classNamePrefix="react-select"
|
||||
value={ head_person_citizenship.code !== null ? head_person_citizenship : undefined }
|
||||
value={ head_person_citizenship.code !== undefined && head_person_citizenship.code !== null ? head_person_citizenship : undefined }
|
||||
onChange={ (element) => { this._removeError("head_person.identity_document.citizenship"); this._handle_onCitizenshipChange(`head_person.identity_document.citizenship`, element.value) } }
|
||||
required={ true }
|
||||
isDisabled={ checking }
|
||||
@ -1359,20 +1359,22 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
) }
|
||||
</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._removeError("signatory_person.identity_document.issueby"); this._handle_onIssuerChange("signatory_person", value); } }
|
||||
required={ true }
|
||||
disabled={ checking }
|
||||
/>
|
||||
</div>
|
||||
{ parseInt(signatory_person.identity_document.doctype, 10) === 100000000 && (
|
||||
<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._removeError("signatory_person.identity_document.issueby"); this._handle_onIssuerChange("signatory_person", value); } }
|
||||
required={ true }
|
||||
disabled={ checking }
|
||||
/>
|
||||
</div>
|
||||
) }
|
||||
|
||||
<div className="form_field">
|
||||
<label>Место рождения <sup className="required_label">*</sup></label>
|
||||
@ -1388,7 +1390,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
</div>
|
||||
|
||||
{ parseInt(signatory_person.identity_document.doctype, 10) !== 100000000 && (
|
||||
<div className="form_field">
|
||||
<div className="form_field" style={{ zIndex: 10 }}>
|
||||
<label>Гражданство <sup className="required_label">*</sup></label>
|
||||
<Select
|
||||
className={ errors.indexOf("signatory_person.identity_document.placebirth") > -1 ? "autocomlete error" : "autocomlete" }
|
||||
@ -1399,7 +1401,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
noOptionsMessage={ ({ inputValue }) => !inputValue ? noOptionsText :"Ничего не найдено" }
|
||||
isSearchable={ true }
|
||||
classNamePrefix="react-select"
|
||||
value={ signatory_person_citizenship.code !== null ? signatory_person_citizenship : undefined }
|
||||
value={ signatory_person_citizenship.code !== undefined && signatory_person_citizenship.code !== null ? signatory_person_citizenship : undefined }
|
||||
onChange={ (element) => { this._removeError("signatory_person.identity_document.citizenship"); this._handle_onCitizenshipChange(`signatory_person.identity_document.citizenship`, element.value); } }
|
||||
required={ true }
|
||||
isDisabled={ checking }
|
||||
|
||||
@ -25,6 +25,7 @@ import { checkDocumentData, saveQuestionnaire } from "../../../../actions";
|
||||
import SuggestsInput from "../../SuggestsInput";
|
||||
import DocumentIssuerSuggestsInput from "../../DocumentIssuerSuggestsInput";
|
||||
import FormMessage from "../FormMessage";
|
||||
import { traceDebug } from "../../../../utils";
|
||||
|
||||
class ShareholderForm extends React.Component
|
||||
{
|
||||
@ -284,21 +285,23 @@ class ShareholderForm extends React.Component
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="form_field">
|
||||
<label>Кем выдан <sup className="required_label">*</sup></label>
|
||||
<DocumentIssuerSuggestsInput
|
||||
className={ errors.indexOf(`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 }
|
||||
/>
|
||||
</div>
|
||||
{ parseInt(shareholder.identity_document.doctype, 10) === 100000000 && (
|
||||
<div className="form_field">
|
||||
<label>Кем выдан <sup className="required_label">*</sup></label>
|
||||
<DocumentIssuerSuggestsInput
|
||||
className={ errors.indexOf(`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 }
|
||||
/>
|
||||
</div>
|
||||
) }
|
||||
|
||||
<div className="form_field">
|
||||
<label>Дата рождения <sup className="required_label">*</sup></label>
|
||||
@ -329,7 +332,7 @@ class ShareholderForm extends React.Component
|
||||
</div>
|
||||
|
||||
{ parseInt(shareholder.identity_document.doctype, 10) !== 100000000 && (
|
||||
<div className="form_field">
|
||||
<div className="form_field" style={{ zIndex: 10 }}>
|
||||
<label>Гражданство <sup className="required_label">*</sup></label>
|
||||
<Select
|
||||
className={ errors.indexOf("identity_document.placebirth") > -1 ? "autocomlete error" : "autocomlete" }
|
||||
@ -340,7 +343,7 @@ class ShareholderForm extends React.Component
|
||||
noOptionsMessage={ ({ inputValue }) => !inputValue ? noOptionsText :"Ничего не найдено" }
|
||||
isSearchable={ true }
|
||||
classNamePrefix="react-select"
|
||||
value={ citizenship.code !== null ? citizenship : undefined }
|
||||
value={ citizenship.code !== undefined && citizenship.code !== null ? citizenship : undefined }
|
||||
onChange={ (element) => this._handle_onCitizenshipChange(`founder_persons[${ index }].identity_document.citizenship`, element.value) }
|
||||
required={ true }
|
||||
isDisabled={ checking }
|
||||
@ -742,26 +745,6 @@ class Form_4_Shareholders extends QuestionnaireForm
|
||||
|
||||
const { founder_persons } = this.state;
|
||||
|
||||
const check = [
|
||||
"founder_part",
|
||||
"lastname",
|
||||
"firstname",
|
||||
/*
|
||||
Запрос 2024-02-13 на удаление телефона и адреса E-mail
|
||||
"telephone",
|
||||
"email",
|
||||
*/
|
||||
"birthdate",
|
||||
"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.name",
|
||||
];
|
||||
|
||||
this.setState({ loading: true }, async () =>
|
||||
{
|
||||
if(parseInt(_get("signatory_person.identity_document.doctype"), 10) === 100000000)
|
||||
@ -772,16 +755,32 @@ class Form_4_Shareholders extends QuestionnaireForm
|
||||
|
||||
for(let f in founder_persons)
|
||||
{
|
||||
const check = [
|
||||
"founder_part",
|
||||
"lastname",
|
||||
"firstname",
|
||||
/*
|
||||
Запрос 2024-02-13 на удаление телефона и адреса E-mail
|
||||
"telephone",
|
||||
"email",
|
||||
*/
|
||||
"birthdate",
|
||||
"identity_document.seria",
|
||||
"identity_document.docnumber",
|
||||
"identity_document.issuedate",
|
||||
"identity_document.placebirth",
|
||||
"identity_document.citizenship.code",
|
||||
"identity_document.registration_address.name",
|
||||
];
|
||||
|
||||
if(parseInt(_get(founder_persons[f], "identity_document.doctype"), 10) === 100000000)
|
||||
{
|
||||
check.push("identity_document.code");
|
||||
check.push("identity_document.issueby");
|
||||
}
|
||||
|
||||
for(let i in check)
|
||||
{
|
||||
if(check[i] === "identity_document.code")
|
||||
{
|
||||
if(parseInt(_get(founder_persons[f], "identity_document.doctype"), 10) !== 100000000)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const v = _get(founder_persons[f], check[i]);
|
||||
/*
|
||||
Запрос 2024-02-13 на удаление телефона и адреса E-mail
|
||||
@ -823,7 +822,7 @@ class Form_4_Shareholders extends QuestionnaireForm
|
||||
}
|
||||
else
|
||||
{
|
||||
if(v === "" || v === null)
|
||||
if(v === "" || v === null || v === undefined)
|
||||
{
|
||||
errors[f].push(check[i]);
|
||||
}
|
||||
@ -867,6 +866,10 @@ class Form_4_Shareholders extends QuestionnaireForm
|
||||
{
|
||||
this.ref_submit.current.click();
|
||||
}
|
||||
else
|
||||
{
|
||||
traceDebug({ errors });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import QuestionnaireForm from "../QuestionnaireForm";
|
||||
import { reduxWrapper } from '../../../../store';
|
||||
import { saveQuestionnaire } from "../../../../actions";
|
||||
import FormMessage from "../FormMessage";
|
||||
import { traceDebug } from "../../../../utils";
|
||||
|
||||
class Form_5_Regulatory extends QuestionnaireForm
|
||||
{
|
||||
@ -90,6 +91,10 @@ class Form_5_Regulatory extends QuestionnaireForm
|
||||
{
|
||||
this.ref_submit.current.click();
|
||||
}
|
||||
else
|
||||
{
|
||||
traceDebug({ errors });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ import QuestionnaireForm from "../QuestionnaireForm";
|
||||
import { reduxWrapper } from '../../../../store';
|
||||
import { saveQuestionnaire } from "../../../../actions";
|
||||
import FormMessage from "../FormMessage";
|
||||
import { traceDebug } from "../../../../utils";
|
||||
|
||||
class Form_6_NonProfit extends QuestionnaireForm
|
||||
{
|
||||
@ -169,6 +170,10 @@ class Form_6_NonProfit extends QuestionnaireForm
|
||||
{
|
||||
this.ref_submit.current.click();
|
||||
}
|
||||
else
|
||||
{
|
||||
traceDebug({ errors });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1358,6 +1358,10 @@
|
||||
margin-top: 0;
|
||||
top: 40px;
|
||||
padding: 8px 12px;
|
||||
z-index: 10;
|
||||
}
|
||||
.questionnaire .autocomlete .react-select__menu .react-select__menu-list {
|
||||
z-index: 10;
|
||||
}
|
||||
.questionnaire .autocomlete .react-select__menu .react-select__option {
|
||||
color: #8E94A7;
|
||||
@ -1366,6 +1370,7 @@
|
||||
background: transparent !important;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
.questionnaire .autocomlete .react-select__menu .react-select__option:not(:last-child) {
|
||||
margin-bottom: 8px;
|
||||
|
||||
@ -1594,14 +1594,20 @@
|
||||
margin-top: 0;
|
||||
top: 40px;
|
||||
padding: 8px 12px;
|
||||
z-index: 10;
|
||||
|
||||
.react-select__option {
|
||||
.react-select__menu-list {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.react-select__option {
|
||||
color: #8E94A7;
|
||||
font-size: 15px;
|
||||
line-height: 24px;
|
||||
background: transparent !important;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
z-index: 10;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 8px;
|
||||
|
||||
@ -3,4 +3,79 @@ const _checkStrValue = (value) =>
|
||||
return value !== undefined && value !== null ? value.toString() : "";
|
||||
}
|
||||
|
||||
export { _checkStrValue }
|
||||
const traceLog = (value) =>
|
||||
{
|
||||
if(typeof window === 'undefined')
|
||||
{
|
||||
if(parseInt(process.env.NEXT_PUBLIC_SERVER_LOG, 10) === 1)
|
||||
{
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(parseInt(process.env.NEXT_PUBLIC_LOG, 10) === 1)
|
||||
{
|
||||
console.log(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(global.store?.getState()?.auth?.observer)
|
||||
{
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const traceDebug = (value) =>
|
||||
{
|
||||
if(typeof window === 'undefined')
|
||||
{
|
||||
if(parseInt(process.env.NEXT_PUBLIC_SERVER_LOG, 10) === 1)
|
||||
{
|
||||
console.debug(value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(parseInt(process.env.NEXT_PUBLIC_LOG, 10) === 1)
|
||||
{
|
||||
console.debug(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(global.store?.getState()?.auth?.observer)
|
||||
{
|
||||
console.debug(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const traceError = (value) =>
|
||||
{
|
||||
if(typeof window === 'undefined')
|
||||
{
|
||||
if(parseInt(process.env.NEXT_PUBLIC_SERVER_LOG, 10) === 1)
|
||||
{
|
||||
console.error(value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(parseInt(process.env.NEXT_PUBLIC_LOG, 10) === 1)
|
||||
{
|
||||
console.error(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(global.store?.getState()?.auth?.observer)
|
||||
{
|
||||
console.error(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { _checkStrValue, traceLog, traceDebug, traceError }
|
||||
Loading…
x
Reference in New Issue
Block a user