diff --git a/actions/questionnaireActions.js b/actions/questionnaireActions.js index 587714b..eb2ce00 100644 --- a/actions/questionnaireActions.js +++ b/actions/questionnaireActions.js @@ -68,6 +68,7 @@ export const getQuestionnaire = ({ dispatch, id }) => founder_number: 0, founder_part: "", is_beneficial: false, + birthdate: "", identity_document: { doctype: "", @@ -165,6 +166,11 @@ export const getQuestionnaire = ({ dispatch, id }) => { questionnaire.founder_persons[i].identity_document = JSON.parse(JSON.stringify(identity_document_template)); } + + if(questionnaire.founder_persons[i].birthdate === null) + { + questionnaire.founder_persons[i].birthdate = moment().subtract(18, 'years').toDate(); + } } } @@ -184,6 +190,11 @@ export const getQuestionnaire = ({ dispatch, id }) => { questionnaire.client_contacts[i].identity_document = JSON.parse(JSON.stringify(identity_document_template)); } + + if(questionnaire.client_contacts[i].birthdate === null) + { + questionnaire.client_contacts[i].birthdate = moment().subtract(18, 'years').toDate(); + } } } diff --git a/components/questionnaire/forms/Form_3_Signer/index.js b/components/questionnaire/forms/Form_3_Signer/index.js index deeb094..eec1dbb 100644 --- a/components/questionnaire/forms/Form_3_Signer/index.js +++ b/components/questionnaire/forms/Form_3_Signer/index.js @@ -739,10 +739,10 @@ class Form_3_Signer extends QuestionnaireForm
- + -1 ? "error" : "" } - mask='9999' + mask={ parseInt(head_person.identity_document.doctype, 10) === 100000000 ? "9999" : parseInt(head_person.identity_document.doctype, 10) === 100000002 ? "99" : undefined } id="head_person.identity_document.seria" name="head_person.identity_document.seria" value={ this._checkStrValue(head_person.identity_document.seria) } @@ -753,10 +753,10 @@ class Form_3_Signer extends QuestionnaireForm />
- + -1 ? "error" : "" } - mask='999999' + mask={ parseInt(head_person.identity_document.doctype, 10) === 100000000 ? "999999" : parseInt(head_person.identity_document.doctype, 10) === 100000002 ? "9999999" : undefined } id="head_person.identity_document.docnumber" name="head_person.identity_document.docnumber" value={ this._checkStrValue(head_person.identity_document.docnumber) } @@ -1243,10 +1243,10 @@ class Form_3_Signer extends QuestionnaireForm
- + -1 ? "error" : "" } - mask='9999' + mask={ parseInt(signatory_person.identity_document.doctype, 10) === 100000000 ? "9999" : parseInt(signatory_person.identity_document.doctype, 10) === 100000002 ? "99" : undefined } id="signatory_person.identity_document.seria" name="signatory_person.identity_document.seria" value={ this._checkStrValue(signatory_person.identity_document.seria) } @@ -1258,10 +1258,10 @@ class Form_3_Signer extends QuestionnaireForm
- + -1 ? "error" : "" } - mask='999999' + mask={ parseInt(signatory_person.identity_document.doctype, 10) === 100000000 ? "999999" : parseInt(signatory_person.identity_document.doctype, 10) === 100000002 ? "9999999" : undefined } id="signatory_person.identity_document.docnumber" name="signatory_person.identity_document.docnumber" value={ this._checkStrValue(signatory_person.identity_document.docnumber) } @@ -1289,21 +1289,23 @@ class Form_3_Signer extends QuestionnaireForm />
-
- - -1 ? "error" : "" } - type="issuer" - id="signatory_person.identity_document.code" - name="signatory_person.identity_document.code" - value={ this._checkStrValue(signatory_person.identity_document.code) } - placeholder="Введите код" - onChange={ (value) => { this._removeError("signatory_person.identity_document.code"); this._handle_onIssuerCodeChange("signatory_person", value); } } - maxResults={ 5 } - required={ true } - disabled={ checking } - /> -
+ { parseInt(signatory_person.identity_document.doctype, 10) === 100000000 && ( +
+ + -1 ? "error" : "" } + type="issuer" + id="signatory_person.identity_document.code" + name="signatory_person.identity_document.code" + value={ this._checkStrValue(signatory_person.identity_document.code) } + placeholder="Введите код" + onChange={ (value) => { this._removeError("signatory_person.identity_document.code"); this._handle_onIssuerCodeChange("signatory_person", value); } } + maxResults={ 5 } + required={ true } + disabled={ checking } + /> +
+ ) }
diff --git a/components/questionnaire/forms/Form_4_Shareholders/index.js b/components/questionnaire/forms/Form_4_Shareholders/index.js index c3c3f84..c92ab65 100644 --- a/components/questionnaire/forms/Form_4_Shareholders/index.js +++ b/components/questionnaire/forms/Form_4_Shareholders/index.js @@ -50,8 +50,6 @@ class ShareholderForm extends React.Component const { index, shareholder, checking, errors } = this.props; let citizenship = { label: getCitizenshipTitleByCode(shareholder.identity_document.citizenship.code), code: shareholder.identity_document.citizenship.code }; - //console.log({ errors }); - return ( @@ -169,12 +167,12 @@ class ShareholderForm extends React.Component
- +
-1 ? "error" : "" } - mask='9999' + mask={ parseInt(shareholder.identity_document.doctype, 10) === 100000000 ? "9999" : parseInt(shareholder.identity_document.doctype, 10) === 100000002 ? "99" : undefined } id={ `founder_persons[${ index }].identity_document.seria` } name={ `founder_persons[${ index }].identity_document.seria` } value={ this._checkStrValue(shareholder.identity_document.seria) } @@ -187,7 +185,7 @@ class ShareholderForm extends React.Component
-1 ? "error" : "" } - mask='999999' + mask={ parseInt(shareholder.identity_document.doctype, 10) === 100000000 ? "999999" : parseInt(shareholder.identity_document.doctype, 10) === 100000002 ? "9999999" : undefined } id={ `founder_persons[${ index }].identity_document.docnumber` } name={ `founder_persons[${ index }].identity_document.docnumber` } value={ this._checkStrValue(shareholder.identity_document.docnumber) } @@ -203,7 +201,7 @@ class ShareholderForm extends React.Component
- +
-
- -1 ? "error" : "" } - style={{ width: "calc(100% - 198px)" }} - innerStyle={{ width: "100%", }} - type="issuer" - id={ `founder_persons[${ index }].identity_document.code` } - name={ `founder_persons[${ index }].identity_document.code` } - value={ this._checkStrValue(shareholder.identity_document.code) } - placeholder="Введите код" - onChange={ (value) => { this._handle_onIssuerCodeChange(`founder_persons[${ index }]`, index, value); } } - maxResults={ 5 } - required={ true } - disabled={ checking } - /> -
+ { parseInt(shareholder.identity_document.doctype, 10) === 100000000 && ( +
+ -1 ? "error" : "" } + style={{ width: "calc(100% - 198px)" }} + innerStyle={{ width: "100%", }} + type="issuer" + id={ `founder_persons[${ index }].identity_document.code` } + name={ `founder_persons[${ index }].identity_document.code` } + value={ this._checkStrValue(shareholder.identity_document.code) } + placeholder="Введите код" + onChange={ (value) => { this._handle_onIssuerCodeChange(`founder_persons[${ index }]`, index, value); } } + maxResults={ 5 } + required={ true } + disabled={ checking } + /> +
+ ) }
@@ -254,6 +254,22 @@ class ShareholderForm extends React.Component />
+
+ + -1 ? "error" : "" } + //style={{ width: "calc(100% - 198px)" }} + placeholder="ДД.ММ.ГГГГ" + min={ moment().subtract(90, 'years').toDate() } + max={ moment().subtract(18, 'years').toDate() } + id={ `founder_persons[${ index }].birthdate` } + value={ this._checkStrValue(shareholder.birthdate) !== "" ? this._checkStrValue(shareholder.birthdate) : moment().subtract(18, 'years').toDate() } + onChange={ (date) => { this._removeError("birthdate"); this._handle_onTextFieldChange(`founder_persons[${ index }].birthdate`, date) } } + required={ true } + disabled={ checking } + /> +
+
0) - { - console.error(errors); - } - return (
{if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_4 ${ checking && "disabled" }`}>

4. Сведения об участниках (акционерах) и бенефициарных владельцах

@@ -825,28 +837,30 @@ class Form_4_Shareholders extends QuestionnaireForm ( ) } - { founder_persons.map((shareholder, index) => ( - this._onRemoveError(index, name) } - removeShareholder={ this._handle_onRemoveShareholder } - clearFounderFromListSelection={ this._handle_onClearFounderFromListSelection } - changeFounderSelectionFromList={ this._handle_onChangeFounderSelectionFromList } - contacts={ client_contacts } - checking={ checking } - /> - )) } + { founder_persons.map((shareholder, index) => { + return ( + this._onRemoveError(index, name) } + removeShareholder={ this._handle_onRemoveShareholder } + clearFounderFromListSelection={ this._handle_onClearFounderFromListSelection } + changeFounderSelectionFromList={ this._handle_onChangeFounderSelectionFromList } + contacts={ client_contacts } + checking={ checking } + /> + ) } + ) } { !checking && (
diff --git a/pages/api/questionnaire/download.js b/pages/api/questionnaire/download.js index 42b00de..e260704 100644 --- a/pages/api/questionnaire/download.js +++ b/pages/api/questionnaire/download.js @@ -16,6 +16,12 @@ const address = { 100000002: "postal", }; +const personal_doctypes = { + 100000000: "Паспорт РФ", + 100000001: "Иностранный паспорт", + 100000002: "Вид на жительство", +}; + const fields = { main: { title: { name: "main_title", type: "text", bind: null, }, @@ -159,10 +165,11 @@ export default async function handler(req, res) } else if(field === "personal") { - const { citizenship, doctype, seria, docnumber, code, issueby, issuedate, } = questionnaire[group][p].identity_document; + const { birthdate, } = questionnaire[group][p]; + const { placebirth, citizenship, doctype, seria, docnumber, code, issueby, issuedate, } = questionnaire[group][p].identity_document; fields[group][p][field].bind = form.getTextField(fields[group][p][field].name); if(fields[group][p][field].size !== undefined) { fields[group][p][field].bind.setFontSize(fields[group][p][field].size); } - fields[group][p][field].bind.setText(`Гражданство: ${ citizenship.title }, паспорт ${ seria.toString() } ${ docnumber.toString() }, выдан \n${ issueby.toString() }, ${ code.toString() } ${ moment(issuedate).format("DD.MM.YYYY") }`.toUpperCase()); + fields[group][p][field].bind.setText(`${ moment(birthdate).format("DD.MM.YYYY") }, ${ placebirth }, ${ citizenship.title }, ${ personal_doctypes[doctype].toString().toUpperCase() } ${ seria.toString() } ${ docnumber.toString() }, выдан ${ issueby.toString() }, ${ code.toString() } ${ moment(issuedate).format("DD.MM.YYYY") }`.toUpperCase()); } else if(field === "registration") { diff --git a/pages/api/questionnaire/send.js b/pages/api/questionnaire/send.js index ebcb6c0..af7a50c 100644 --- a/pages/api/questionnaire/send.js +++ b/pages/api/questionnaire/send.js @@ -192,6 +192,7 @@ export default async function handler(req, res) founder_persons[i].telephone = checkNullEmpty(founder_persons[i].telephone) ? founder_persons[i].telephone.replace(/[^0-9]/g, '') : null; founder_persons[i].identity_document.issuedate = checkNullEmpty(founder_persons[i].identity_document.issuedate) ? moment(founder_persons[i].identity_document.issuedate).format("YYYY-MM-DD") : null; founder_persons[i].identity_document.citizenship_code = founder_persons[i].identity_document.citizenship.code.toString(); + founder_persons[i].birthdate = checkNullEmpty(founder_persons[i].birthdate) ? moment(founder_persons[i].birthdate).format("YYYY-MM-DD") : null; if(founder_persons[i].middlename !== "" && founder_persons[i].middlename !== null) {