From 67eac69bd513e2a7613d91d20bf99b486c3b7818 Mon Sep 17 00:00:00 2001 From: merelendor Date: Thu, 20 Apr 2023 12:36:12 +0300 Subject: [PATCH] hotfix for citizenships --- actions/questionnaireActions.js | 30 ++++++++++++++++++++++++++---- pages/index.js | 12 +++++++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/actions/questionnaireActions.js b/actions/questionnaireActions.js index abe0dcd..ede9d08 100644 --- a/actions/questionnaireActions.js +++ b/actions/questionnaireActions.js @@ -89,6 +89,26 @@ export const getQuestionnaire = ({ dispatch, id }) => } }; + const identity_document_template = + { + doctype: "", + seria: "", + docnumber: "", + issuedate: "", + icode: "", + issueby: "", + issueby_search_dadata: "", + placebirth: "", + citizenship: { + title: "", + code: "", + }, + registration_address: { + title: "", + fias_id: "", + } + }; + const questionnaire = JSON.parse(JSON.stringify(global.store.getState().questionnaire)); if(questionnaire.status === "empty") { @@ -111,6 +131,7 @@ export const getQuestionnaire = ({ dispatch, id }) => { questionnaire.head_person.identity_document = head_person_identity_document; } + 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, code: response.data.head_person !== null && response.data.head_person.identity_document !== null ? response.data.head_person.identity_document.citizenship_code : 643, @@ -118,15 +139,16 @@ export const getQuestionnaire = ({ dispatch, id }) => const signatory_person_identity_document = questionnaire.signatory_person.identity_document; questionnaire.signatory_person = { ...questionnaire.signatory_person, ...response.data.signatory_person }; - 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, - code: response.data.signatory_person !== null && response.data.signatory_person.identity_document !== null ? response.data.signatory_person.identity_document.citizenship_code : 643, - }; if(questionnaire.signatory_person.identity_document === null) { questionnaire.signatory_person.identity_document = signatory_person_identity_document; } + 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, + code: response.data.signatory_person !== null && response.data.signatory_person.identity_document !== null ? response.data.signatory_person.identity_document.citizenship_code : 643, + }; + for(let i in response.data.founder_persons) { questionnaire.founder_persons[i] = response.data.founder_persons[i]; diff --git a/pages/index.js b/pages/index.js index ad5fe41..b63f693 100644 --- a/pages/index.js +++ b/pages/index.js @@ -21,7 +21,7 @@ import AccountLayout from "./components/Layout/Account"; import AnnouncementsList from "./components/AnnouncementsList"; -import { getContractsList, getImage } from '../actions'; +import { getCompanyInfo, getContractsList, getImage } from '../actions'; class IndexPage extends React.Component { @@ -59,11 +59,17 @@ class IndexPage extends React.Component componentDidMount() { + const { dispatch } = this.props; + this.setState({ loading: true }, () => { - getContractsList({ dispatch: this.props.dispatch, order: this.state.order, sort: this.state.sort_number, }).then(() => { + getCompanyInfo({ dispatch }).then(() => {}).catch(() => {}); + getContractsList({ dispatch, order: this.state.order, sort: this.state.sort_number, }) + .then(() => + { this.setState({ loading: false }); - }).catch(() => {}); + }) + .catch(() => {}); }); }