fix for questionnaire signing when sign on paper

This commit is contained in:
merelendor 2023-12-26 13:19:04 +03:00
parent 0139fae6d0
commit 1eabde05e3
6 changed files with 46 additions and 47 deletions

View File

@ -334,6 +334,7 @@ export const resetQuestionnaire = ({ dispatch, id }) =>
{ {
const template = JSON.parse(JSON.stringify(questionnaire_template)); const template = JSON.parse(JSON.stringify(questionnaire_template));
dispatch({ type: actionTypes.QUESTIONNAIRE_UPDATE, data: { questionnaire: template, } }); dispatch({ type: actionTypes.QUESTIONNAIRE_UPDATE, data: { questionnaire: template, } });
eraseQuestionnaire() eraseQuestionnaire()
.then(() => .then(() =>
{ {
@ -341,13 +342,18 @@ export const resetQuestionnaire = ({ dispatch, id }) =>
}); });
} }
export const defaultQuestionnaire = ({ dispatch }) => export const defaultQuestionnaire = ({ dispatch, sign }) =>
{ {
//console.log("defaultQuestionnaire"); //console.log("defaultQuestionnaire");
const template = JSON.parse(JSON.stringify(questionnaire_template)); const template = JSON.parse(JSON.stringify(questionnaire_template));
if(sign !== undefined)
{
template.sign = sign;
}
dispatch({ type: actionTypes.QUESTIONNAIRE_UPDATE, data: { questionnaire: template, } }); dispatch({ type: actionTypes.QUESTIONNAIRE_UPDATE, data: { questionnaire: template, } });
eraseQuestionnaire().then(() => {}).catch(() => {});
} }

View File

@ -268,6 +268,8 @@ export default class DigitalCertificates extends React.Component
{ (certificates_error === "NOT_INSTALLED" || certificates_error === "CERTIFICATES") && ( { (certificates_error === "NOT_INSTALLED" || certificates_error === "CERTIFICATES") && (
<FormMessage type="moderate" title="Внимание!" message={ <> <FormMessage type="moderate" title="Внимание!" message={ <>
Плагин КриптоПРО не установлен или не активирован. Посмотите <a style={{ color: "#fff", textDecoration: "underline", }} href={ `${ process.env.NEXT_PUBLIC_MAIN_SITE }/upload/docs/anketa-sign.pdf` }>инструкцию</a> как установить, активировать и проверить работу плагина КриптоПро.<br/> Плагин КриптоПРО не установлен или не активирован. Посмотите <a style={{ color: "#fff", textDecoration: "underline", }} href={ `${ process.env.NEXT_PUBLIC_MAIN_SITE }/upload/docs/anketa-sign.pdf` }>инструкцию</a> как установить, активировать и проверить работу плагина КриптоПро.<br/>
<br/>
После активации плагина, пожалуйста, обновите страницу.
</> }/> </> }/>
) } ) }
{ certificates_error === "INVALID" && ( { certificates_error === "INVALID" && (

View File

@ -53,40 +53,28 @@ class Form_8_Signing extends QuestionnaireForm
componentDidMount() componentDidMount()
{ {
//console.log("Form_8_Signing", "CDM"); const { main, head_person, signatory_person } = this.state;
const update = { filename: `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf` };
let digital = true;
//setTimeout(() => if(signatory_person.not_head_person)
//{ {
//console.log("Form_8_Signing", "CDM", { state: this.state }); update.digital_disabled = true;
digital = false;
}
this.setState({ ...this.state, ...update, ...{ loading: false } }, () =>
const { main, head_person, signatory_person } = this.state; {
this._handle_onBranchChange([
const update = { filename: `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf` }; { name: `sign.digital`, value: digital },
let digital = true; ]);
});
if(signatory_person.not_head_person)
{
update.digital_disabled = true;
digital = false;
}
this.setState({ ...this.state, ...update, ...{ loading: false } }, () =>
{
this._handle_onBranchChange([
{ name: `sign.digital`, value: digital },
]);
});
//}, 50);
} }
_handle_onFormSubmit = (event) => _handle_onFormSubmit = (event) =>
{ {
event.preventDefault(); event.preventDefault();
//console.log("FormAddress", "_handle_onFormSubmit");
}; };
_check_fields_disabled = (values) => _check_fields_disabled = (values) =>
@ -147,9 +135,6 @@ class Form_8_Signing extends QuestionnaireForm
{ {
const { loading, filename, sign_digital, sign, head_person, mobile, company, main, downloading, error, digital_disabled } = this.state; const { loading, filename, sign_digital, sign, head_person, mobile, company, main, downloading, error, digital_disabled } = this.state;
//console.log({ sign });
if(loading) if(loading)
{ {
return ( return (

View File

@ -44,7 +44,13 @@ class Form_9_Status extends QuestionnaireForm
} }
componentDidMount() componentDidMount()
{ {
const { sign } = this.state;
if(sign.digital)
{
this.props.onSuccess(this.state.sign);
}
} }
_handle_onFileUpload = () => _handle_onFileUpload = () =>
@ -73,7 +79,7 @@ class Form_9_Status extends QuestionnaireForm
{ {
this.setState({ uploading: false, sent: true, error_send: false, }, () => this.setState({ uploading: false, sent: true, error_send: false, }, () =>
{ {
this.props.onSuccess(); this.props.onSuccess(this.state.sign);
}); });
}) })
.catch(() => .catch(() =>
@ -89,10 +95,9 @@ class Form_9_Status extends QuestionnaireForm
const { sign, file, uploading, sent, error_file_size, error_send, filename } = this.state; const { sign, file, uploading, sent, error_file_size, error_send, filename } = this.state;
//console.log("Form_9_Status", "render", { sign }); //console.log("Form_9_Status", "render", { sign });
return ( return (
<React.Fragment> <React.Fragment>
{ sign.digital && ( { sign.digital ? (
<React.Fragment> <React.Fragment>
<FormMessage <FormMessage
type="success" type="success"
@ -103,8 +108,7 @@ class Form_9_Status extends QuestionnaireForm
<button className="button button-blue" style={{ width: "100%", minWidth: "255px" }} onClick={ () => this.props.router.push("/") }>Перейти на главную страницу </button> <button className="button button-blue" style={{ width: "100%", minWidth: "255px" }} onClick={ () => this.props.router.push("/") }>Перейти на главную страницу </button>
</div> </div>
</React.Fragment> </React.Fragment>
) } ) : (
{ !sign.digital && (
<React.Fragment> <React.Fragment>
<input type="file" id="file" multiple={ false } ref={ this.ref_file_input } style={{ display: "none" }} onChange={ this._handle_onFileChange }/> <input type="file" id="file" multiple={ false } ref={ this.ref_file_input } style={{ display: "none" }} onChange={ this._handle_onFileChange }/>
{ file === null ? ( { file === null ? (

View File

@ -109,12 +109,12 @@ class QuestionnairePage extends React.Component
this.props.router.push(`/questionnaire#${ path }`); this.props.router.push(`/questionnaire#${ path }`);
} }
_handle_onSuccess = () => _handle_onSuccess = (sign) =>
{ {
//console.log("_handle_onSuccess"); //console.log("_handle_onSuccess");
getCompanyInfo({ dispatch: this.props.dispatch }); getCompanyInfo({ dispatch: this.props.dispatch });
defaultQuestionnaire({ dispatch: this.props.dispatch }); defaultQuestionnaire({ dispatch: this.props.dispatch, sign });
} }
_renderForm = () => _renderForm = () =>

View File

@ -1,3 +1,12 @@
export const questionnaire_sign_template = {
digital: true,
uploading: false,
uploaded: false,
sent: false,
filename: null,
filedate: null,
};
export const questionnaire_template = { export const questionnaire_template = {
step: 1, step: 1,
status: "empty", status: "empty",
@ -119,14 +128,7 @@ export const questionnaire_template = {
fin_goals_special: null, fin_goals_special: null,
}, },
personal_data_consent: true, personal_data_consent: true,
sign: { sign: questionnaire_sign_template,
digital: true,
uploading: false,
uploaded: false,
sent: false,
filename: null,
filedate: null,
},
licenses: [], licenses: [],
}; };