HOTFIX: questionnaire identity_document.registration_address fix on first API request
This commit is contained in:
parent
99450790d2
commit
1c35bf8c27
@ -72,6 +72,7 @@ export const getQuestionnaire = ({ dispatch, id }) =>
|
||||
{
|
||||
//console.log("ACTION", "questionnaire", "getQuestionnaire()", "response", response.data);
|
||||
|
||||
/* DEPRECATED ?
|
||||
const founder_persons_template = {
|
||||
signatory_id: null,
|
||||
lastname: "",
|
||||
@ -106,6 +107,17 @@ export const getQuestionnaire = ({ dispatch, id }) =>
|
||||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
const citizenship_template = {
|
||||
title: getCitizenshipTitleByCode(643),
|
||||
code: 643,
|
||||
};
|
||||
|
||||
const registration_address_template = {
|
||||
title: null,
|
||||
fias_id: null,
|
||||
};
|
||||
|
||||
const identity_document_template =
|
||||
{
|
||||
@ -117,14 +129,8 @@ export const getQuestionnaire = ({ dispatch, id }) =>
|
||||
issueby: null,
|
||||
issueby_search_dadata: null,
|
||||
placebirth: null,
|
||||
citizenship: {
|
||||
title: getCitizenshipTitleByCode(643),
|
||||
code: 643,
|
||||
},
|
||||
registration_address: {
|
||||
title: null,
|
||||
fias_id: null,
|
||||
}
|
||||
citizenship: citizenship_template,
|
||||
registration_address: registration_address_template
|
||||
};
|
||||
|
||||
const questionnaire = JSON.parse(JSON.stringify(global.store.getState().questionnaire));
|
||||
@ -149,6 +155,17 @@ export const getQuestionnaire = ({ dispatch, id }) =>
|
||||
{
|
||||
questionnaire.head_person.identity_document = JSON.parse(JSON.stringify(identity_document_template));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(questionnaire.head_person.identity_document.citizenship === undefined || questionnaire.head_person.identity_document.citizenship === null)
|
||||
{
|
||||
questionnaire.head_person.identity_document.citizenship = citizenship_template;
|
||||
}
|
||||
if(questionnaire.head_person.identity_document.registration_address === undefined || questionnaire.head_person.identity_document.registration_address === null)
|
||||
{
|
||||
questionnaire.head_person.identity_document.registration_address = registration_address_template;
|
||||
}
|
||||
}
|
||||
|
||||
questionnaire.head_person.identity_document.citizenship = {
|
||||
title: response.data.head_person !== null && response.data.head_person.identity_document !== null ? getCitizenshipTitleByCode(response.data.head_person.identity_document.citizenship_code) : null,
|
||||
@ -177,6 +194,17 @@ export const getQuestionnaire = ({ dispatch, id }) =>
|
||||
{
|
||||
questionnaire.signatory_person.identity_document = JSON.parse(JSON.stringify(identity_document_template));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(questionnaire.signatory_person.identity_document.citizenship === undefined || questionnaire.signatory_person.identity_document.citizenship === null)
|
||||
{
|
||||
questionnaire.signatory_person.identity_document.citizenship = citizenship_template;
|
||||
}
|
||||
if(questionnaire.signatory_person.identity_document.registration_address === undefined || questionnaire.signatory_person.identity_document.registration_address === null)
|
||||
{
|
||||
questionnaire.signatory_person.identity_document.registration_address = registration_address_template;
|
||||
}
|
||||
}
|
||||
|
||||
questionnaire.signatory_person.identity_document.citizenship = {
|
||||
title: response.data.signatory_person !== null && response.data.signatory_person.identity_document !== null ? getCitizenshipTitleByCode(response.data.signatory_person.identity_document.citizenship_code) : null,
|
||||
@ -216,6 +244,15 @@ export const getQuestionnaire = ({ dispatch, id }) =>
|
||||
questionnaire.founder_persons[i].identity_document = JSON.parse(JSON.stringify(identity_document_template));
|
||||
}
|
||||
|
||||
if(questionnaire.founder_persons[i].identity_document.citizenship === undefined || questionnaire.founder_persons[i].identity_document.citizenship === null)
|
||||
{
|
||||
questionnaire.founder_persons[i].identity_document.citizenship = citizenship_template;
|
||||
}
|
||||
if(questionnaire.founder_persons[i].identity_document.registration_address === undefined || questionnaire.founder_persons[i].identity_document.registration_address === null)
|
||||
{
|
||||
questionnaire.founder_persons[i].identity_document.registration_address = registration_address_template;
|
||||
}
|
||||
|
||||
/*
|
||||
if(questionnaire.founder_persons[i].birthdate === null)
|
||||
{
|
||||
|
||||
@ -356,8 +356,8 @@ class ShareholderForm extends React.Component
|
||||
<AddressSuggests
|
||||
className={ errors.indexOf("identity_document.registration_address.name") > -1 ? "error" : "" }
|
||||
id={ `founder_persons[${ index }].identity_document.registration_address` }
|
||||
value={ this._checkStrValue(shareholder.identity_document.registration_address.name) }
|
||||
fias={ this._checkStrValue(shareholder.identity_document.registration_address.fias_id) }
|
||||
value={ this._checkStrValue(shareholder.identity_document.registration_address?.name) }
|
||||
fias={ this._checkStrValue(shareholder.identity_document.registration_address?.fias_id) }
|
||||
onChange={ (data) => { this._removeError("identity_document.registration_address.name"); this._handle_onTextFieldChange(`founder_persons[${ index }].identity_document.registration_address`, data) } }
|
||||
required={ true }
|
||||
disabled={ checking }
|
||||
@ -629,6 +629,7 @@ class Form_4_Shareholders extends QuestionnaireForm
|
||||
componentDidMount()
|
||||
{
|
||||
const founder_persons_template = JSON.parse(JSON.stringify(this.state.founder_persons_template));
|
||||
traceDebug({ state: this.state });
|
||||
|
||||
if(this.state.founder_persons.length === 0)
|
||||
{
|
||||
@ -919,6 +920,7 @@ class Form_4_Shareholders extends QuestionnaireForm
|
||||
const { checking } = this.props;
|
||||
const { founder_persons, client_contacts, loading, address, status, errors, } = this.state;
|
||||
console.log("Form_4_Shareholders", { errors });
|
||||
traceDebug({ state: this.state });
|
||||
|
||||
return (
|
||||
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_4 ${ checking && "disabled" }`}>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user