diff --git a/components/questionnaire/forms/Form_3_Signer/index.js b/components/questionnaire/forms/Form_3_Signer/index.js index 56971d1..be386f2 100644 --- a/components/questionnaire/forms/Form_3_Signer/index.js +++ b/components/questionnaire/forms/Form_3_Signer/index.js @@ -157,9 +157,9 @@ class Form_3_Signer extends QuestionnaireForm fias_id: "", } }, - evo_assignment_date: "", - evo_credentials_dateend: "", - evo_indefinite: false, + assignment_date: "", + credentials_dateend: "", + indefinite: false, }, signatory_person: { not_head_person: false, @@ -230,7 +230,7 @@ class Form_3_Signer extends QuestionnaireForm const { main, signatory_person } = this.state; if( main.inn !== null && main.inn.length === 12) { - this._handle_onCheckboxFieldChange("head_person.evo_indefinite", true); + this._handle_onCheckboxFieldChange("head_person.indefinite", true); } if(signatory_person.lastname !== null || signatory_person.lastname !== undefined || signatory_person.lastname !== "") @@ -288,15 +288,15 @@ class Form_3_Signer extends QuestionnaireForm _handle_onIndefiniteChange = () => { const { head_person } = this.state; - const indefinite = !head_person.evo_indefinite ? true : false; - this._handle_onCheckboxFieldChange("head_person.evo_indefinite", indefinite); - this._removeError("head_person.evo_credentials_dateend"); + const indefinite = !head_person.indefinite ? true : false; + this._handle_onCheckboxFieldChange("head_person.indefinite", indefinite); + this._removeError("head_person.credentials_dateend"); if(!indefinite) { setTimeout(() => { - this._handle_onCheckboxFieldChange("head_person.evo_credentials_dateend", ""); + this._handle_onCheckboxFieldChange("head_person.credentials_dateend", ""); }, 10); } } @@ -406,7 +406,7 @@ class Form_3_Signer extends QuestionnaireForm "identity_document.placebirth", "identity_document.citizenship_code", "identity_document.registration_address.name", - "evo_assignment_date", + "assignment_date", ]; if(parseInt(_get(head_person, "identity_document.doctype"), 10) === 100000000) @@ -425,50 +425,50 @@ class Form_3_Signer extends QuestionnaireForm } } - if(head_person.evo_assignment_date !== undefined && head_person.evo_assignment_date !== null && head_person.evo_assignment_date !== "") + if(head_person.assignment_date !== undefined && head_person.assignment_date !== null && head_person.assignment_date !== "") { try { - const date = moment(head_person.evo_assignment_date); + const date = moment(head_person.assignment_date); const today = moment(); if(date > today) { - errors.push(`head_person.evo_assignment_date`); - errors.push(`head_person.evo_assignment_date_invalid`); + errors.push(`head_person.assignment_date`); + errors.push(`head_person.assignment_date_invalid`); } } catch(e) { - errors.push(`head_person.evo_assignment_date`); - errors.push(`head_person.evo_assignment_date_invalid`); + errors.push(`head_person.assignment_date`); + errors.push(`head_person.assignment_date_invalid`); } } - if(!head_person.evo_indefinite) + if(!head_person.indefinite) { - if(head_person.evo_credentials_dateend === undefined || head_person.evo_credentials_dateend === null || head_person.evo_credentials_dateend === "") + if(head_person.credentials_dateend === undefined || head_person.credentials_dateend === null || head_person.credentials_dateend === "") { - errors.push(`head_person.evo_credentials_dateend`); + errors.push(`head_person.credentials_dateend`); } - if(head_person.evo_credentials_dateend !== undefined && head_person.evo_credentials_dateend !== null && head_person.evo_credentials_dateend !== "") + if(head_person.credentials_dateend !== undefined && head_person.credentials_dateend !== null && head_person.credentials_dateend !== "") { try { - const date = moment(head_person.evo_credentials_dateend); + const date = moment(head_person.credentials_dateend); const today = moment(); if(date < today) { - errors.push(`head_person.evo_credentials_dateend`); - errors.push(`head_person.evo_credentials_dateend_invalid`); + errors.push(`head_person.credentials_dateend`); + errors.push(`head_person.credentials_dateend_invalid`); } } catch(e) { - errors.push(`head_person.evo_credentials_dateend`); - errors.push(`head_person.evo_credentials_dateend_invalid`); + errors.push(`head_person.credentials_dateend`); + errors.push(`head_person.credentials_dateend_invalid`); } } } @@ -893,7 +893,7 @@ class Form_3_Signer extends QuestionnaireForm /> - { errors.indexOf("head_person.evo_assignment_date_invalid") > -1 && + { errors.indexOf("head_person.assignment_date_invalid") > -1 && ( ) } @@ -902,12 +902,12 @@ class Form_3_Signer extends QuestionnaireForm
-1 ? "error" : "" } + className={ errors.indexOf("head_person.assignment_date") > -1 ? "error" : "" } placeholder="ДД.ММ.ГГГГ" max={ moment().toDate() } - id={ "head_person.evo_assignment_date" } - value={ this._checkStrValue(head_person.evo_assignment_date) !== "" ? this._checkStrValue(head_person.evo_assignment_date) : null } - onChange={ (date) => { this._removeError([ "head_person.evo_assignment_date", "head_person.evo_assignment_date_invalid" ]); this._handle_onTextFieldChange("head_person.evo_assignment_date", date) } } + id={ "head_person.assignment_date" } + value={ this._checkStrValue(head_person.assignment_date) !== "" ? this._checkStrValue(head_person.assignment_date) : null } + onChange={ (date) => { this._removeError([ "head_person.assignment_date", "head_person.assignment_date_invalid" ]); this._handle_onTextFieldChange("head_person.assignment_date", date) } } required={ true } disabled={ checking } style={{maxWidth: "320px"}} @@ -915,19 +915,19 @@ class Form_3_Signer extends QuestionnaireForm
this._handle_onIndefiniteChange() } disabled={ checking } /> - +
- { !head_person.evo_indefinite && ( + { !head_person.indefinite && ( - { errors.indexOf("head_person.evo_credentials_dateend_invalid") > -1 && + { errors.indexOf("head_person.credentials_dateend_invalid") > -1 && ( ) } @@ -935,12 +935,12 @@ class Form_3_Signer extends QuestionnaireForm
-1 ? "error" : "" } + className={ errors.indexOf("head_person.credentials_dateend") > -1 ? "error" : "" } min={ moment().toDate() } placeholder="ДД.ММ.ГГГГ" - id={ "head_person.evo_credentials_dateend" } - value={ this._checkStrValue(head_person.evo_credentials_dateend) !== "" ? this._checkStrValue(head_person.evo_credentials_dateend) : null } - onChange={ (date) => { this._removeError([ "head_person.evo_credentials_dateend", "head_person.evo_credentials_dateend_invalid" ]); this._handle_onTextFieldChange("head_person.evo_credentials_dateend", date) } } + id={ "head_person.credentials_dateend" } + value={ this._checkStrValue(head_person.credentials_dateend) !== "" ? this._checkStrValue(head_person.credentials_dateend) : null } + onChange={ (date) => { this._removeError([ "head_person.credentials_dateend", "head_person.credentials_dateend_invalid" ]); this._handle_onTextFieldChange("head_person.credentials_dateend", date) } } required={ true } disabled={ checking } style={{maxWidth: "320px"}} diff --git a/components/questionnaire/forms/Form_8_Signing/index.js b/components/questionnaire/forms/Form_8_Signing/index.js index 25ce3b7..1c78e82 100644 --- a/components/questionnaire/forms/Form_8_Signing/index.js +++ b/components/questionnaire/forms/Form_8_Signing/index.js @@ -24,32 +24,38 @@ class Form_8_Signing extends QuestionnaireForm super(props); this.state = { main: {}, + signatory_person: {}, sign_digital: true, - address: "", - phone_check_loading: false, - phone_number_format_error: false, - - certificates: [], + address: "", filename: null, mobile: MatchMedia() === "mobile" ? true : false, company: {}, downloading: false, error: false, + digital_disabled: false, }; } static getDerivedStateFromProps(nextProps, prevState) { return { - main: nextProps.main, + main: nextProps.questionnaire.main, + signatory_person: nextProps.questionnaire.signatory_person, company: nextProps.company, }; } componentDidMount() { - const { main } = this.state; - this.setState({ filename: `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf` }); + const { main, signatory_person } = this.state; + const update = { filename: `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf` }; + if(signatory_person.not_head_person) + { + update.sign_digital = false; + update.digital_disabled = true; + } + + this.setState({ ...this.state, ...update }); } _handle_onFormSubmit = (event) => @@ -107,7 +113,7 @@ class Form_8_Signing extends QuestionnaireForm render() { - const { filename, sign_digital, mobile, company, main, downloading, error } = this.state; + const { filename, sign_digital, mobile, company, main, downloading, error, digital_disabled } = this.state; return ( @@ -132,18 +138,31 @@ class Form_8_Signing extends QuestionnaireForm { sign_digital && ( <> - { mobile ? ( + { digital_disabled ? (

Внимание - Для подписания анкеты посредством ЭЦП пожалуйста воспользуйтесь стационарным компьютером или ноутбуком с установленной программой КриптоПро CSP. + Подписант отличается от Единоличного исполнительного органа. Подписание посредством ЭЦП недоступно.

) : ( - - ) } + <> + { mobile ? ( +
+ + + +

Внимание + Для подписания анкеты посредством ЭЦП пожалуйста воспользуйтесь стационарным компьютером или ноутбуком с установленной программой КриптоПро CSP. +

+
+ ) : ( + + ) } + + )} ) } @@ -190,7 +209,7 @@ class Form_8_Signing extends QuestionnaireForm function mapStateToProps(state, ownProps) { return { - main: state.questionnaire.main, + questionnaire: state.questionnaire, company: state.company, } } diff --git a/components/questionnaire/forms/Form_9_Status/index.js b/components/questionnaire/forms/Form_9_Status/index.js index 5210d87..59a048a 100644 --- a/components/questionnaire/forms/Form_9_Status/index.js +++ b/components/questionnaire/forms/Form_9_Status/index.js @@ -64,23 +64,27 @@ class Form_9_Status extends QuestionnaireForm _handle_onSend = () => { - const { file, company } = this.state; + const { file, company, uploading } = this.state; console.log("company", company); - this.setState({ uploading: true }, () => + if(!uploading) { - uploadSignedFile(file, company.questionnaire_id) - .then(() => + this.setState({ uploading: true }, () => { - this.setState({ sent: true }, () => + uploadSignedFile(file, company.questionnaire_id) + .then(() => { - this.props.onSuccess(); + this.setState({ uploading: false, sent: true }, () => + { + this.props.onSuccess(); + }); + }) + .catch(() => + { + this.setState({ uploading: false, sent: false }); }); - }) - .catch(() => - { }); - }); + } } render() diff --git a/pages/api/questionnaire/download.js b/pages/api/questionnaire/download.js index 9144302..b4fb9a6 100644 --- a/pages/api/questionnaire/download.js +++ b/pages/api/questionnaire/download.js @@ -46,9 +46,9 @@ const fields = { head_person: { fullname: { name: "head_fullname", type: "text", bind: null }, jobtitle: { name: "head_jobtitle", type: "text", bind: null }, - evo_assignment_date: { name: "head_date", type: "text", bind: null, date: true }, - evo_credentials_dateend: { name: "head_dateend", type: "text", bind: null, date: true }, - evo_indefinite: { name: "head_date_infinite", type: "checkbox", bind: null }, + assignment_date: { name: "head_date", type: "text", bind: null, date: true }, + credentials_dateend: { name: "head_dateend", type: "text", bind: null, date: true }, + indefinite: { name: "head_date_infinite", type: "checkbox", bind: null }, telephone: { name: "head_phone", type: "text", bind: null }, email: { name: "head_email", type: "text", bind: null }, }, diff --git a/pages/api/questionnaire/send.js b/pages/api/questionnaire/send.js index 50752a4..a573970 100644 --- a/pages/api/questionnaire/send.js +++ b/pages/api/questionnaire/send.js @@ -162,7 +162,8 @@ export default async function handler(req, res) payload.head_person.identity_document.citizenship_code = payload.head_person.identity_document.citizenship.code.toString(); payload.head_person.telephone = checkNullEmpty(payload.head_person.telephone) ? payload.head_person.telephone.replace(/[^0-9]/g, '') : null; payload.head_person.identity_document.issuedate = checkNullEmpty(payload.head_person.identity_document.issuedate) ? moment(payload.head_person.identity_document.issuedate).format("YYYY-MM-DD") : null; - payload.head_person.evo_assignment_date = checkNullEmpty(payload.head_person.evo_assignment_date) ? moment(payload.head_person.evo_assignment_date).format("YYYY-MM-DD") : null; + payload.head_person.assignment_date = checkNullEmpty(payload.head_person.assignment_date) ? moment(payload.head_person.assignment_date).format("YYYY-MM-DD") : null; + payload.head_person.credentials_dateend = checkNullEmpty(payload.head_person.credentials_dateend) ? moment(payload.head_person.credentials_dateend).format("YYYY-MM-DD") : null; if(payload.signatory_person.not_head_person) { @@ -178,7 +179,7 @@ export default async function handler(req, res) else { payload.signatory_person = { ...payload.signatory_person, ..._pick(payload.head_person, [ - "lastname", "firstname", "middlename", "no_middle_name", "jobtitle", "telephone", "email", "identity_document", "evo_assignment_date", "evo_credentials_dateend", "evo_indefinite", + "lastname", "firstname", "middlename", "no_middle_name", "jobtitle", "telephone", "email", "identity_document", "assignment_date", "credentials_dateend", "indefinite", ]) }; } payload.signatory_person.identity_document.citizenship_code = payload.signatory_person.identity_document.citizenship.code.toString(); @@ -186,6 +187,7 @@ export default async function handler(req, res) payload.signatory_person.identity_document.issuedate = checkNullEmpty(payload.signatory_person.identity_document.issuedate) ? moment(payload.signatory_person.identity_document.issuedate).format("YYYY-MM-DD") : null; payload.signatory_person.docdate = checkNullEmpty(payload.signatory_person.docdate) ? moment(payload.signatory_person.docdate).format("YYYY-MM-DD") : null; payload.signatory_person.assignment_date = checkNullEmpty(payload.signatory_person.assignment_date) ? moment(payload.signatory_person.assignment_date).format("YYYY-MM-DD") : null; + payload.signatory_person.credentials_dateend = checkNullEmpty(payload.signatory_person.credentials_dateend) ? moment(payload.signatory_person.credentials_dateend).format("YYYY-MM-DD") : null; const founder_persons = parsed.founder_persons; diff --git a/reducers/initialState.js b/reducers/initialState.js index 4aded42..1ac16b8 100644 --- a/reducers/initialState.js +++ b/reducers/initialState.js @@ -65,9 +65,9 @@ export const questionnaire_template = { fias_id: null, } }, - evo_assignment_date: null, - evo_credentials_dateend: null, - evo_indefinite: false, + assignment_date: null, + credentials_dateend: null, + indefinite: false, }, head_person_files: [], signatory_person: {