update for client questionnaire: add birthdate, place_of_birth to PDF generation, fix doctype for personal data

This commit is contained in:
merelendor 2023-06-08 13:50:06 +03:00
parent 1a4d6ce64b
commit cbf09433d1
5 changed files with 110 additions and 75 deletions

View File

@ -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();
}
}
}

View File

@ -739,10 +739,10 @@ class Form_3_Signer extends QuestionnaireForm
<div className="formgroup">
<div className="form_field">
<label>Серия паспорта <sup className="required_label">*</sup></label>
<label>Серия { parseInt(head_person.identity_document.doctype, 10) === 100000002 ? "ВНЖ" : "паспорта" } <sup className="required_label">*</sup></label>
<InputMask
className={ errors.indexOf("head_person.identity_document.seria") > -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
/>
</div>
<div className="form_field">
<label>Номер паспорта <sup className="required_label">*</sup></label>
<label>Номер { parseInt(head_person.identity_document.doctype, 10) === 100000002 ? "ВНЖ" : "паспорта" } <sup className="required_label">*</sup></label>
<InputMask
className={ errors.indexOf("head_person.identity_document.docnumber") > -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
<div className="formgroup">
<div className="form_field">
<label>Серия паспорта <sup className="required_label">*</sup></label>
<label>Серия { parseInt(signatory_person.identity_document.doctype, 10) === 100000002 ? "ВНЖ" : "паспорта" } <sup className="required_label">*</sup></label>
<InputMask
className={ errors.indexOf("signatory_person.identity_document.seria") > -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
</div>
<div className="form_field">
<label>Номер паспорта <sup className="required_label">*</sup></label>
<label>Номер { parseInt(signatory_person.identity_document.doctype, 10) === 100000002 ? "ВНЖ" : "паспорта" } <sup className="required_label">*</sup></label>
<InputMask
className={ errors.indexOf("signatory_person.identity_document.docnumber") > -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
/>
</div>
<div className="form_field">
<label>Код подразделения <sup className="required_label">*</sup></label>
<DocumentIssuerSuggestsInput
className={ errors.indexOf("signatory_person.identity_document.code") > -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 }
/>
</div>
{ parseInt(signatory_person.identity_document.doctype, 10) === 100000000 && (
<div className="form_field">
<label>Код подразделения <sup className="required_label">*</sup></label>
<DocumentIssuerSuggestsInput
className={ errors.indexOf("signatory_person.identity_document.code") > -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 }
/>
</div>
) }
</div>
<div className="form_field">

View File

@ -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 (
<React.Fragment>
@ -169,12 +167,12 @@ class ShareholderForm extends React.Component
<div className="form_field ">
<div className="form_field">
<label>Серия и номер паспорта <sup className="required_label">*</sup></label>
<label>Серия и номер { parseInt(shareholder.identity_document.doctype, 10) === 100000002 ? "ВНЖ" : "паспорта" } <sup className="required_label">*</sup></label>
<div className="formgroup">
<div className="form_field">
<InputMask
className={ errors.indexOf("identity_document.seria") > -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
<div className="form_field">
<InputMask
className={ errors.indexOf("identity_document.docnumber") > -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
<div className="form_field ">
<div className="form_field">
<label>Дата выдачи и код подразделения <sup className="required_label">*</sup></label>
<label>{ parseInt(shareholder.identity_document.doctype, 10) === 100000000 ? "Дата выдачи и код подразделения" : "Дата выдачи" } <sup className="required_label">*</sup></label>
<div className="formgroup">
<div className="form_field">
<CalendarDatePicker
@ -218,22 +216,24 @@ class ShareholderForm extends React.Component
disabled={ checking }
/>
</div>
<div className="form_field">
<DocumentIssuerSuggestsInput
className={ errors.indexOf("identity_document.code") > -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 }
/>
</div>
{ parseInt(shareholder.identity_document.doctype, 10) === 100000000 && (
<div className="form_field">
<DocumentIssuerSuggestsInput
className={ errors.indexOf("identity_document.code") > -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 }
/>
</div>
) }
</div>
</div>
</div>
@ -254,6 +254,22 @@ class ShareholderForm extends React.Component
/>
</div>
<div className="form_field">
<label>Дата рождения <sup className="required_label">*</sup></label>
<CalendarDatePicker
className={ errors.indexOf("birthdate") > -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 }
/>
</div>
<div className="form_field" style={{ flex: 1 }}>
<label>Место рождения <sup className="required_label">*</sup></label>
<AddressSuggests
@ -497,6 +513,7 @@ class Form_4_Shareholders extends QuestionnaireForm
founder_number: 0,
founder_part: null,
is_beneficial: false,
birthdate: moment().subtract(18, 'years').toDate(),
identity_document:
{
doctype: 100000000,
@ -588,7 +605,7 @@ class Form_4_Shareholders extends QuestionnaireForm
{
this._handle_onFieldChange(name, { ...values } );
const { errors } = this.state;
errors.splice(index, 1);
errors.splice(index, 1, []);
this.setState({ errors });
}
@ -807,11 +824,6 @@ class Form_4_Shareholders extends QuestionnaireForm
const { checking } = this.props;
const { founder_persons, client_contacts, loading, address, status, errors, } = this.state;
if(errors.length > 0)
{
console.error(errors);
}
return (
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }} className={`questionnaire questionnaire_4 ${ checking && "disabled" }`}>
<p className="title">4. Сведения об участниках (акционерах) и бенефициарных владельцах</p>
@ -825,28 +837,30 @@ class Form_4_Shareholders extends QuestionnaireForm
(
<FormMessage type="error" title="Ошибка" message="Пожалуйста, проверьте корректность заполнения данных в форме."/>
) }
{ founder_persons.map((shareholder, index) => (
<Shareholder
key={ index }
index={ index }
shareholders={ founder_persons }
address={ address }
errors={ errors[index] }
_handle_onTextFieldChange={ this._handle_onTextFieldChange }
_handle_onCheckboxFieldChange={ this._handle_onCheckboxFieldChange }
_handle_onFieldChange={ this._handle_onFieldChange }
_handle_onIssuerCodeChange={ this._handle_onIssuerCodeChange }
_handle_onIssuerChange={ this._handle_onIssuerChange }
_handle_onDocumentTypeChange={ this._handle_onDocumentTypeChange }
_checkStrValue={ this._checkStrValue }
_removeError={ (name) => 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 (
<Shareholder
key={ index }
index={ index }
shareholders={ founder_persons }
address={ address }
errors={ errors[index] }
_handle_onTextFieldChange={ this._handle_onTextFieldChange }
_handle_onCheckboxFieldChange={ this._handle_onCheckboxFieldChange }
_handle_onFieldChange={ this._handle_onFieldChange }
_handle_onIssuerCodeChange={ this._handle_onIssuerCodeChange }
_handle_onIssuerChange={ this._handle_onIssuerChange }
_handle_onDocumentTypeChange={ this._handle_onDocumentTypeChange }
_checkStrValue={ this._checkStrValue }
_removeError={ (name) => this._onRemoveError(index, name) }
removeShareholder={ this._handle_onRemoveShareholder }
clearFounderFromListSelection={ this._handle_onClearFounderFromListSelection }
changeFounderSelectionFromList={ this._handle_onChangeFounderSelectionFromList }
contacts={ client_contacts }
checking={ checking }
/>
) }
) }
{ !checking && (
<div className="action">

View File

@ -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")
{

View File

@ -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)
{