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);
|
//console.log("ACTION", "questionnaire", "getQuestionnaire()", "response", response.data);
|
||||||
|
|
||||||
|
/* DEPRECATED ?
|
||||||
const founder_persons_template = {
|
const founder_persons_template = {
|
||||||
signatory_id: null,
|
signatory_id: null,
|
||||||
lastname: "",
|
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 =
|
const identity_document_template =
|
||||||
{
|
{
|
||||||
@ -117,14 +129,8 @@ export const getQuestionnaire = ({ dispatch, id }) =>
|
|||||||
issueby: null,
|
issueby: null,
|
||||||
issueby_search_dadata: null,
|
issueby_search_dadata: null,
|
||||||
placebirth: null,
|
placebirth: null,
|
||||||
citizenship: {
|
citizenship: citizenship_template,
|
||||||
title: getCitizenshipTitleByCode(643),
|
registration_address: registration_address_template
|
||||||
code: 643,
|
|
||||||
},
|
|
||||||
registration_address: {
|
|
||||||
title: null,
|
|
||||||
fias_id: null,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const questionnaire = JSON.parse(JSON.stringify(global.store.getState().questionnaire));
|
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));
|
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 = {
|
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,
|
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));
|
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 = {
|
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,
|
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));
|
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)
|
if(questionnaire.founder_persons[i].birthdate === null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -356,8 +356,8 @@ class ShareholderForm extends React.Component
|
|||||||
<AddressSuggests
|
<AddressSuggests
|
||||||
className={ errors.indexOf("identity_document.registration_address.name") > -1 ? "error" : "" }
|
className={ errors.indexOf("identity_document.registration_address.name") > -1 ? "error" : "" }
|
||||||
id={ `founder_persons[${ index }].identity_document.registration_address` }
|
id={ `founder_persons[${ index }].identity_document.registration_address` }
|
||||||
value={ this._checkStrValue(shareholder.identity_document.registration_address.name) }
|
value={ this._checkStrValue(shareholder.identity_document.registration_address?.name) }
|
||||||
fias={ this._checkStrValue(shareholder.identity_document.registration_address.fias_id) }
|
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) } }
|
onChange={ (data) => { this._removeError("identity_document.registration_address.name"); this._handle_onTextFieldChange(`founder_persons[${ index }].identity_document.registration_address`, data) } }
|
||||||
required={ true }
|
required={ true }
|
||||||
disabled={ checking }
|
disabled={ checking }
|
||||||
@ -629,6 +629,7 @@ class Form_4_Shareholders extends QuestionnaireForm
|
|||||||
componentDidMount()
|
componentDidMount()
|
||||||
{
|
{
|
||||||
const founder_persons_template = JSON.parse(JSON.stringify(this.state.founder_persons_template));
|
const founder_persons_template = JSON.parse(JSON.stringify(this.state.founder_persons_template));
|
||||||
|
traceDebug({ state: this.state });
|
||||||
|
|
||||||
if(this.state.founder_persons.length === 0)
|
if(this.state.founder_persons.length === 0)
|
||||||
{
|
{
|
||||||
@ -919,6 +920,7 @@ class Form_4_Shareholders extends QuestionnaireForm
|
|||||||
const { checking } = this.props;
|
const { checking } = this.props;
|
||||||
const { founder_persons, client_contacts, loading, address, status, errors, } = this.state;
|
const { founder_persons, client_contacts, loading, address, status, errors, } = this.state;
|
||||||
console.log("Form_4_Shareholders", { errors });
|
console.log("Form_4_Shareholders", { errors });
|
||||||
|
traceDebug({ state: this.state });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_4 ${ checking && "disabled" }`}>
|
<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