diff --git a/actions/questionnaireActions.js b/actions/questionnaireActions.js index dccd5a9..f251a39 100644 --- a/actions/questionnaireActions.js +++ b/actions/questionnaireActions.js @@ -98,20 +98,20 @@ export const getQuestionnaire = ({ dispatch, id }) => questionnaire.main.financial_loan = response.data.financial_loan !== null ? response.data.financial_loan : ""; questionnaire.main.mail_delivery_address_type = response.data.mail_delivery_address_type !== null ? response.data.mail_delivery_address_type : response.data.inn.length > 10 ? 100000001 : 100000000; - questionnaire.contacts.fact_address = response.data.fact_address; - questionnaire.contacts.postal_address = response.data.postal_address; - questionnaire.contacts.legal_address = response.data.legal_address; + questionnaire.contacts.fact_address = response.data.fact_address !== null ? response.data.fact_address : { name: null, fias_id: null }; + questionnaire.contacts.postal_address = response.data.postal_address !== null ? response.data.postal_address : { name: null, fias_id: null }; + questionnaire.contacts.legal_address = response.data.legal_address !== null ? response.data.legal_address : { name: null, fias_id: null }; questionnaire.head_person = { ...questionnaire.head_person, ...response.data.head_person }; questionnaire.head_person.identity_document.citizenship = { - title: getCitizenshipTitleByCode(response.data.head_person.identity_document.citizenship_code), - code: response.data.head_person.identity_document.citizenship_code, + title: response.data.head_person !== null ? getCitizenshipTitleByCode(response.data.head_person.identity_document.citizenship_code) : null, + code: response.data.head_person !== null ? response.data.head_person.identity_document.citizenship_code : null, }; questionnaire.signatory_person = { ...questionnaire.signatory_person, ...response.data.signatory_person }; questionnaire.signatory_person.identity_document.citizenship = { - title: getCitizenshipTitleByCode(response.data.signatory_person.identity_document.citizenship_code), - code: response.data.signatory_person.identity_document.citizenship_code, + title: response.data.signatory_person !== null ? getCitizenshipTitleByCode(response.data.signatory_person.identity_document.citizenship_code) : null, + code: response.data.signatory_person !== null ? response.data.signatory_person.identity_document.citizenship_code : null, }; for(let i in response.data.founder_persons) diff --git a/components/questionnaire/AddressSuggests.js b/components/questionnaire/AddressSuggests.js index 28f6635..91a837c 100644 --- a/components/questionnaire/AddressSuggests.js +++ b/components/questionnaire/AddressSuggests.js @@ -137,11 +137,11 @@ export default class AddressSuggests extends React.Component disabled={ disabled } /> { focused && options.length > 0 && ( -
+
{ options.map((option, index) => ( -
this._handle_onSelect(option.value) }>{ option.value }
+
{ event.preventDefault(); this._handle_onSelect(option.value); } }>{ option.value }
)) }
diff --git a/components/questionnaire/forms/AddressSuggestsSelect.js b/components/questionnaire/forms/AddressSuggestsSelect.js index 4d1dd8c..7a6364a 100644 --- a/components/questionnaire/forms/AddressSuggestsSelect.js +++ b/components/questionnaire/forms/AddressSuggestsSelect.js @@ -177,11 +177,9 @@ export default class AddressSuggestsSelect extends React.Component { const { value, value_selected, custom } = this.state; const { disabled } = this.props; - //console.log(">>>>>>>>>>|", value, "|", value_selected); if(custom) { - //console.log("CUSTOM"); return ( + _checkContactListDisabled = (check) => { const { shareholders } = this.props; for(let i in shareholders) { - if(shareholders[i].hash === hash) + const shareholder = shareholders[i]; + const hash = `${ shareholder.lastname }_${ shareholder.firstname }_${ shareholder.middlename }`; + + if(hash === check) { return true; } @@ -338,8 +341,6 @@ class Shareholder extends React.Component const { index, shareholders, removeShareholder, signatories, contacts, changeFounderSelectionFromList, clearFounderFromListSelection, checking, errors, } = this.props; const shareholder = shareholders[index]; - console.log({ contacts }); - return (
@@ -402,12 +403,9 @@ class Shareholder extends React.Component id={ `founder_persons[${ index }].contact_${ hash }` } name={ `founder_persons[${ index }].contact_${ hash }` } checked={ hash === shareholder.hash } - onChange={ () => changeFounderSelectionFromList(`founder_persons[${ index }]`, { ...shareholder, ...{ - founder_from_list: true, - hash: hash, - lastname: _checkStrValue(contact.lastname), - firstname: _checkStrValue(contact.firstname), - middlename: _checkStrValue(contact.middlename), + onChange={ () => changeFounderSelectionFromList(`founder_persons[${ index }]`, { ...shareholder, ...contact, ...{ + founder_from_list: false, + founder_number: shareholders.length, } }) } disabled={ disabled } /> @@ -445,7 +443,7 @@ class Shareholder extends React.Component name={ `founder_persons[${ index }].founder_part` } value={ this._checkStrValue(shareholder.founder_part) } placeholder="Укажите размер доли" - onChange={ (event) => { _removeError("founder_part"); this._handle_onTextFieldChange(event.target.name, event.target.value > 100 ? 100 : event.target.value); } } + onChange={ (event) => { this._removeError("founder_part"); this._handle_onTextFieldChange(event.target.name, event.target.value > 100 ? 100 : event.target.value); } } required={ true } disabled={ checking } /> @@ -727,8 +725,8 @@ class Form_4_Shareholders extends QuestionnaireForm render() { - const { client_contacts, checking } = this.props; - const { founder_persons, loading, address, status, errors, } = this.state; + const { checking } = this.props; + const { founder_persons, client_contacts, loading, address, status, errors, } = this.state; //console.log("questionnaire", questionnaire); diff --git a/pages/api/questionnaire/file/upload.js b/pages/api/questionnaire/file/upload.js index 69aed3d..abb8987 100644 --- a/pages/api/questionnaire/file/upload.js +++ b/pages/api/questionnaire/file/upload.js @@ -13,7 +13,7 @@ import multer from 'multer'; import { cors } from '../../../../lib/cors'; const storage = multer.memoryStorage(); -const upload = multer({ storage: storage }); +const upload = multer({ storage: storage, limits: { fileSize: 1024 * 1024 * 300 } }); export default async function handler(req, res) {