move PDF generation to external service
This commit is contained in:
parent
8fe0457989
commit
efb044e485
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,3 +32,4 @@ yarn-error.log*
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
/upload/*
|
||||
@ -60,4 +60,41 @@ export const updateQuestionnaire = ({ dispatch, questionnaire }) =>
|
||||
}, 500);
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
export const downloadQuestionnaire = () =>
|
||||
{
|
||||
console.log("ACTION", "questionnaireActions", "downloadQuestionnaire()", );
|
||||
|
||||
//{ questionnaire }
|
||||
//questionnaire
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
let cookies = new Cookies();
|
||||
let cookies_list = cookies.getAll();
|
||||
console.log("cookies_list", cookies_list);
|
||||
|
||||
axios.post(`${ process.env.NEXT_PUBLIC_INT_API_HOST }/questionnaire/check`, {}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${ cookies_list.jwt }`,
|
||||
},
|
||||
//withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
console.log("downloadQuestionnaire", "response.data");
|
||||
console.log(response.data);
|
||||
console.log("downloaded?");
|
||||
//dispatch({ type: actionTypes.SUPPORT_APPEALS, data: { appeals: { list: response.data.appeals, new: response.data.new, } } });
|
||||
resolve();
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.log("error");
|
||||
console.error(error);
|
||||
|
||||
reject();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
@ -28,7 +28,6 @@ export default class CalendarDatePicker extends React.Component
|
||||
{
|
||||
if(this.props.onChange !== undefined)
|
||||
{
|
||||
console.log("date.getTime", date.toJSON());
|
||||
this.props.onChange(date.getTime !== undefined ? date.toJSON() : "");
|
||||
}
|
||||
}
|
||||
@ -77,7 +76,6 @@ export default class CalendarDatePicker extends React.Component
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("FUCK", value);
|
||||
return (
|
||||
<div className="date_input_wrapper" style={ this.props.style }>
|
||||
<DatePicker
|
||||
|
||||
@ -28,7 +28,6 @@ export default class DateInput extends React.Component
|
||||
{
|
||||
if(this.props.onChange !== undefined)
|
||||
{
|
||||
console.log("date.getTime", date.toJSON());
|
||||
this.props.onChange(date.getTime !== undefined ? date : "");
|
||||
}
|
||||
}
|
||||
@ -77,7 +76,6 @@ export default class DateInput extends React.Component
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("FUCK", value);
|
||||
return (
|
||||
<div className="date_input_wrapper" style={ this.props.style }>
|
||||
<DatePicker
|
||||
|
||||
172
components/questionnaire/AddressSuggests.js
Normal file
172
components/questionnaire/AddressSuggests.js
Normal file
@ -0,0 +1,172 @@
|
||||
import React from "react";
|
||||
import Head from 'next/head';
|
||||
import Image from 'next/image';
|
||||
import Link from "next/link";
|
||||
import cookie from 'cookie';
|
||||
import { connect } from "react-redux";
|
||||
import numeral from "numeral";
|
||||
import pluralize from 'pluralize-ru';
|
||||
import { SpinnerCircular } from 'spinners-react';
|
||||
import AsyncSelect from 'react-select/async';
|
||||
import debounce from 'debounce-promise';
|
||||
import { set as _set, get as _get } from 'lodash';
|
||||
|
||||
import { getAddress } from '../../actions';
|
||||
|
||||
const suggestsAddressDebounce = (text) =>
|
||||
{
|
||||
return getAddress(text);
|
||||
}
|
||||
|
||||
const suggestsAddress = debounce(suggestsAddressDebounce, 200);
|
||||
|
||||
export default class AddressSuggests extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props);
|
||||
this.state = {
|
||||
focused: false,
|
||||
options: [],
|
||||
fias: [],
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount()
|
||||
{
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState)
|
||||
{
|
||||
}
|
||||
|
||||
_handle_onChange = (value) =>
|
||||
{
|
||||
const { fias, focused } = this.state;
|
||||
const { onChange } = this.props;
|
||||
|
||||
onChange({ title: value, fias_id: "" });
|
||||
if(focused)
|
||||
{
|
||||
this._getAddress(value);
|
||||
}
|
||||
}
|
||||
|
||||
_handle_onSelect = (value) =>
|
||||
{
|
||||
const { fias, focused } = this.state;
|
||||
const { onChange } = this.props;
|
||||
|
||||
this.setState({ focused: false }, () =>
|
||||
{
|
||||
onChange({ title: value, fias_id: fias[value] });
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onFocus = () =>
|
||||
{
|
||||
this.setState({ focused: true });
|
||||
}
|
||||
|
||||
_handle_onBlur = () =>
|
||||
{
|
||||
setTimeout(() =>
|
||||
{
|
||||
this.setState({ focused: false });
|
||||
}, 100);
|
||||
}
|
||||
|
||||
_getAddress = (text) =>
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
if(text === "")
|
||||
{
|
||||
this.setState({ options: [], fias: {}, value: "" }, () =>
|
||||
{
|
||||
resolve([]);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
suggestsAddress(text)
|
||||
.then((result) =>
|
||||
{
|
||||
const options = [];
|
||||
const fias = {};
|
||||
|
||||
for(let i in result.suggestions)
|
||||
{
|
||||
const s = result.suggestions[i];
|
||||
options.push({ value: s.value, label: s.value });
|
||||
fias[s.value] = s.data.fias_id;
|
||||
}
|
||||
|
||||
this.setState({ options, fias }, () =>
|
||||
{
|
||||
resolve(options);
|
||||
});
|
||||
})
|
||||
.catch(() =>
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { focused, options } = this.state;
|
||||
const { value, disabled } = this.props;
|
||||
|
||||
return (
|
||||
<div className="autocomlete" style={{ position: "relative" }}>
|
||||
<input type="text"
|
||||
autoComplete="off"
|
||||
style={{ width: "100%" }}
|
||||
className={ `react-select__control react-select__control--is-focused ${ focused ? "react-select__control--menu-is-open" : "" }` }
|
||||
id="address"
|
||||
name="address"
|
||||
value={ value }
|
||||
placeholder="Введите адрес"
|
||||
onChange={ (event) => this._handle_onChange(event.target.value) }
|
||||
onFocus={ this._handle_onFocus }
|
||||
onBlur={ this._handle_onBlur }
|
||||
required={ true }
|
||||
disabled={ disabled }
|
||||
/>
|
||||
{ focused && options.length > 0 && (
|
||||
<div className="react-select__menu" style={{ position: "absolute", zIndex: 1, background: "#fff", width: "100%", left: "0px", top: "40px" }}>
|
||||
<div className="react-select__menu-list">
|
||||
{ options.map((option, index) =>
|
||||
(
|
||||
<div className="react-select__option" aria-disabled="false" tab-index="-1" key={ index } onClick={ () => this._handle_onSelect(option.value) }>{ option.value }</div>
|
||||
)) }
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
<AsyncSelect
|
||||
//value={ value }
|
||||
defaultInputValue={ value }
|
||||
placeholder="Укажите адрес"
|
||||
className="autocomlete"
|
||||
classNamePrefix="react-select"
|
||||
cacheOptions={ true }
|
||||
defaultOptions={ this.state.options }
|
||||
noOptionsMessage={ () => null }
|
||||
loadingMessage={ () => null }
|
||||
loadOptions={ (text) => this._getAddress(text) }
|
||||
onChange={ this._handle_onChange }
|
||||
//onBlur={ this._handle_onBlur }
|
||||
onInputChange={ this._handle_onInputChange }
|
||||
//isDisabled={ disabled ? true : false }
|
||||
/>
|
||||
*/
|
||||
}
|
||||
}
|
||||
@ -27,31 +27,35 @@ export default class DigitalSignaturesList extends React.Component
|
||||
setTimeout(() =>
|
||||
{
|
||||
isPluginCryptoProInstalled()
|
||||
.then(
|
||||
getCertificates()
|
||||
.then(certificates =>
|
||||
.then(setTimeout(() =>
|
||||
{
|
||||
const certificates_list = [];
|
||||
for(let i in certificates)
|
||||
getCertificates()
|
||||
.then(certificates =>
|
||||
{
|
||||
const certificate = certificates[i];
|
||||
let today = moment();
|
||||
if(today < moment(certificate.info.validToDate))
|
||||
const certificates_list = [];
|
||||
for(let i in certificates)
|
||||
{
|
||||
certificate.info.validToDate = moment(certificate.info.validToDate).format('DD.MM.YYYY');
|
||||
certificates_list.push(certificate);
|
||||
const certificate = certificates[i];
|
||||
let today = moment();
|
||||
if(today < moment(certificate.info.validToDate))
|
||||
{
|
||||
certificate.info.validToDate = moment(certificate.info.validToDate).format('DD.MM.YYYY');
|
||||
certificates_list.push(certificate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.setState({ certificates: certificates_list, certificates_error: certificates_list.length > 0 ? null : "ISSUED", loading: false });
|
||||
})
|
||||
.catch((error_get_certificates) =>
|
||||
{
|
||||
console.error("error_get_certificates");
|
||||
console.error(error_get_certificates);
|
||||
console.log("certificates", 'OTHER');
|
||||
this.setState({ certificates: [], certificates_error: "OTHER", loading: false });
|
||||
})
|
||||
|
||||
this.setState({ certificates: certificates_list, certificates_error: certificates_list.length > 0 ? null : "ISSUED", loading: false });
|
||||
})
|
||||
.catch((error_get_certificates) =>
|
||||
{
|
||||
console.error("error_get_certificates");
|
||||
console.error(error_get_certificates);
|
||||
console.log("certificates", 'OTHER');
|
||||
this.setState({ certificates: [], certificates_error: "OTHER", loading: false });
|
||||
})
|
||||
}, 500)
|
||||
)
|
||||
.catch((error_plugin_installed) =>
|
||||
{
|
||||
@ -108,9 +112,10 @@ export default class DigitalSignaturesList extends React.Component
|
||||
<div className="feed_item user">
|
||||
<img src="/assets/images/icons/avatar.svg" alt="" />
|
||||
<div>
|
||||
|
||||
<p className="item_title">{ certificate?.info?.subjectName }</p>
|
||||
<p className="item_desc">
|
||||
{ certificate.info.subjectFields.map((field) => field.fieldName === "Имя" ? <span>{ field.value }</span> : null)}
|
||||
{ certificate.info.subjectFields['SN'] || certificate.info.subjectFields['SN'] ? (<span>{ certificate.info.subjectFields['SN'] } { certificate.info.subjectFields['G'] }</span>) : null }
|
||||
<span>Подпись действительна до { certificate?.info?.validToDate }</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -33,6 +33,7 @@ export default class FilesList extends React.Component
|
||||
|
||||
_renderFileName = (name) =>
|
||||
{
|
||||
console.log("FilesList", "_renderFileName", { name });
|
||||
let chunks = name.split(/(.{19})/).filter(O => O);
|
||||
console.log({chunks});
|
||||
if(chunks.length > 2)
|
||||
@ -48,7 +49,7 @@ export default class FilesList extends React.Component
|
||||
}
|
||||
|
||||
//return chunks.join("\n");
|
||||
return name;
|
||||
return chunks;
|
||||
}
|
||||
|
||||
render()
|
||||
@ -60,18 +61,21 @@ export default class FilesList extends React.Component
|
||||
return (
|
||||
<div style={{ flexDirection: "row", display: "flex", alignItems: "flex-start", justifyContent: "flex-start", gap: "2%", }}>
|
||||
|
||||
{ files.map((file, index) => (
|
||||
<div key={ index } className="dosc_list medium-icon" style={{ position: "relative", border: "1px dashed rgb(28, 1, 169)", width: "32%", height: "100px", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", }}>
|
||||
<div className="row" style={{ alignItems: "center", justifyContent: "center", display: "flex", flexDirection: "row", flex: 1, marginBottom: "0px" }}>
|
||||
<p className="doc_name i-pdf extension" style={{ wordBreak: "break-all", lineHeight: "15px" }}>{ this._renderFileName(file.name) }{/*}<span style={{width: "100%"}}>Постановление</span>{*/}</p>
|
||||
</div>
|
||||
{ !checking && (
|
||||
<div style={{ position: "absolute", top: "5px", right: "5px", width: "20px", height: "20px", background: "#edeff5", flex: 1, justifyContent: "center", display: "flex", alignItems: "center", borderRadius: "10px", cursor: "pointer" }} onClick={ () => this._handle_onRemoveFile(file.name) }>
|
||||
<span style={{ color: "#919399", fontSize: "12px" }}>✕</span>
|
||||
{ files.map((file, index) => {
|
||||
if(file.name === undefined) { return null; }
|
||||
return (
|
||||
<div key={ index } className="dosc_list medium-icon" style={{ position: "relative", border: "1px dashed rgb(28, 1, 169)", width: "32%", height: "100px", borderRadius: "4px", display: "flex", alignItems: "center", justifyContent: "center", }}>
|
||||
<div className="row" style={{ alignItems: "center", justifyContent: "center", display: "flex", flexDirection: "row", flex: 1, marginBottom: "0px" }}>
|
||||
<p className="doc_name i-pdf extension" style={{ wordBreak: "break-all", lineHeight: "15px" }}>{ this._renderFileName(file.name) }{/*}<span style={{width: "100%"}}>Постановление</span>{*/}</p>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
)) }
|
||||
{ !checking && (
|
||||
<div style={{ position: "absolute", top: "5px", right: "5px", width: "20px", height: "20px", background: "#edeff5", flex: 1, justifyContent: "center", display: "flex", alignItems: "center", borderRadius: "10px", cursor: "pointer" }} onClick={ () => this._handle_onRemoveFile(file.name) }>
|
||||
<span style={{ color: "#919399", fontSize: "12px" }}>✕</span>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
)
|
||||
}) }
|
||||
|
||||
{ !checking && (
|
||||
<Dropzone onDrop={ (acceptedFiles) => this._handle_onAddFile(acceptedFiles) }>
|
||||
|
||||
@ -11,8 +11,8 @@ import { connect } from "react-redux";
|
||||
import { withRouter } from 'next/router';
|
||||
|
||||
import QuestionnaireForm from "../QuestionnaireForm";
|
||||
import AddressSuggestsSelect from "../AddressSuggestsSelect";
|
||||
import { reduxWrapper } from '../../../../store';
|
||||
import AddressSuggests from "../../AddressSuggests";
|
||||
|
||||
class Form_2_Contacts extends QuestionnaireForm
|
||||
{
|
||||
@ -36,6 +36,10 @@ class Form_2_Contacts extends QuestionnaireForm
|
||||
name: "",
|
||||
fias_id: "",
|
||||
},
|
||||
},
|
||||
value: {
|
||||
title: "",
|
||||
fias_id: "",
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -100,7 +104,7 @@ class Form_2_Contacts extends QuestionnaireForm
|
||||
|
||||
<div className="form_field">
|
||||
<label>Фактический адрес</label>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
value={ fact_address.title }
|
||||
fias={ fact_address.fias_id }
|
||||
onChange={ (data) => this._handle_onTextFieldChange("contacts.fact_address", data) }
|
||||
@ -148,7 +152,7 @@ class Form_2_Contacts extends QuestionnaireForm
|
||||
/>
|
||||
<label htmlFor="contacts.address_type_postal" className="unselectable" style={{ width: "100%" }}>
|
||||
<span>По следующему адресу</span>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
value={ postal_address.title }
|
||||
fias={ postal_address.fias_id }
|
||||
onChange={ (data) => this._handle_onTextFieldChange("contacts.postal_address", data) }
|
||||
|
||||
@ -15,11 +15,11 @@ import QuestionnaireForm from "../QuestionnaireForm";
|
||||
import CalendarDatePicker from '../../../CalendarDatePicker';
|
||||
import FilesList from "../FilesList";
|
||||
import Modal from "../../../../pages/components/Modal/modal";
|
||||
import AddressSuggestsSelect from "../AddressSuggestsSelect";
|
||||
import countries from "../../../../lib/countries.json";
|
||||
import citizenships from "../../../../lib/citizenships.json";
|
||||
import { reduxWrapper } from '../../../../store';
|
||||
import moment from "moment";
|
||||
import AddressSuggests from "../../AddressSuggests";
|
||||
|
||||
class Form_3_Signer extends QuestionnaireForm
|
||||
{
|
||||
@ -53,9 +53,6 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
middlename: "",
|
||||
no_middle_name: false,
|
||||
jobtitle: "",
|
||||
assignment_date: "",
|
||||
indefinite: "",
|
||||
credentials_dateend: "",
|
||||
telephone: "",
|
||||
email: "",
|
||||
identity_document: {
|
||||
@ -77,8 +74,6 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
evo_credentials_dateend: "",
|
||||
evo_indefinite: false,
|
||||
},
|
||||
head_person_files: [],
|
||||
individual_executive_files: [],
|
||||
signatory_person: {
|
||||
not_head_person: false,
|
||||
lastname: "",
|
||||
@ -109,6 +104,8 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
}
|
||||
}
|
||||
},
|
||||
individual_executive_files: [],
|
||||
head_person_files: [],
|
||||
signatory_person_files: [],
|
||||
|
||||
personal_data_consent: false,
|
||||
@ -284,7 +281,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
modal_show_personal_data,
|
||||
} = this.state;
|
||||
|
||||
console.log("individual_executive_files", this.state);
|
||||
console.log("individual_executive_files", individual_executive_files);
|
||||
|
||||
const { loading, } = this.state;
|
||||
const { main, head_person, signatory_person } = this.state;
|
||||
@ -418,7 +415,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
</div>
|
||||
<div className="form_field">
|
||||
<label>Место рождения</label>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
id={ "head_person.identity_document.placebirth" }
|
||||
value={ head_person.identity_document.placebirth }
|
||||
placeholder="Укажите место рождения"
|
||||
@ -446,7 +443,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
</div>
|
||||
<div className="form_field">
|
||||
<label>Адрес регистрации</label>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
value={ head_person.identity_document.registration_address.title }
|
||||
fias={ head_person.identity_document.registration_address.fias_id }
|
||||
placeholder="Укажите адрес регистрации"
|
||||
@ -779,7 +776,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
|
||||
<div className="form_field">
|
||||
<label>Место рождения</label>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
id={ "signatory_person.identity_document.placebirth" }
|
||||
value={ signatory_person.identity_document.placebirth }
|
||||
placeholder="Укажите место рождения"
|
||||
@ -809,7 +806,7 @@ class Form_3_Signer extends QuestionnaireForm
|
||||
|
||||
<div className="form_field">
|
||||
<label>Адрес регистрации</label>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
value={ signatory_person.identity_document.registration_address.title }
|
||||
fias={ signatory_person.identity_document.registration_address.fias_id }
|
||||
onChange={ (data) => this._handle_onTextFieldChange("signatory_person.identity_document.registration_address", data) }
|
||||
|
||||
@ -14,8 +14,8 @@ import { get as _get } from 'lodash';
|
||||
import QuestionnaireForm from "../QuestionnaireForm";
|
||||
import CalendarDatePicker from '../../../CalendarDatePicker';
|
||||
import citizenships from "../../../../lib/citizenships.json";
|
||||
import AddressSuggestsSelect from "../AddressSuggestsSelect";
|
||||
import { reduxWrapper } from '../../../../store';
|
||||
import AddressSuggests from "../../AddressSuggests";
|
||||
|
||||
class ShareholderForm extends React.Component
|
||||
{
|
||||
@ -192,7 +192,7 @@ class ShareholderForm extends React.Component
|
||||
|
||||
<div className="form_field" style={{ flex: 1 }}>
|
||||
<label>Место рождения</label>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
id={ `founded_persons[${ index }].identity_document.placebirth` }
|
||||
value={ shareholder.identity_document.placebirth }
|
||||
onChange={ (data) => this._handle_onTextFieldChange(`founded_persons[${ index }].identity_document.placebirth`, data.title) }
|
||||
@ -220,7 +220,7 @@ class ShareholderForm extends React.Component
|
||||
|
||||
<div className="form_field">
|
||||
<label>Адрес регистрации</label>
|
||||
<AddressSuggestsSelect
|
||||
<AddressSuggests
|
||||
id={ `founded_persons[${ index }].identity_document.registration_address` }
|
||||
value={ shareholder.identity_document.registration_address.title }
|
||||
fias={ shareholder.identity_document.registration_address.fias_id }
|
||||
|
||||
@ -13,6 +13,7 @@ import moment from "moment";
|
||||
import QuestionnaireForm from "../QuestionnaireForm";
|
||||
import { reduxWrapper } from '../../../../store';
|
||||
import DigitalSignaturesList from "../DigitalSignaturesList";
|
||||
import { downloadQuestionnaire } from "../../../../actions";
|
||||
|
||||
class Form_8_Signing extends QuestionnaireForm
|
||||
{
|
||||
@ -38,7 +39,7 @@ class Form_8_Signing extends QuestionnaireForm
|
||||
}
|
||||
|
||||
componentDidMount()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
_handle_onFormSubmit = (event) =>
|
||||
@ -62,7 +63,11 @@ class Form_8_Signing extends QuestionnaireForm
|
||||
|
||||
_download = () =>
|
||||
{
|
||||
alert("Скачивание сформированного PDF");
|
||||
downloadQuestionnaire()
|
||||
.then(() =>
|
||||
{
|
||||
alert("Скачивание сформированного PDF");
|
||||
});
|
||||
}
|
||||
|
||||
render()
|
||||
|
||||
@ -70,36 +70,10 @@ export default class QuestionnaireForm extends React.Component
|
||||
|
||||
_handle_onTextFieldChange = (name, value) =>
|
||||
{
|
||||
console.log("QuestionnaireForm", "_handle_onTextFieldChange", { name, value });
|
||||
//console.log("QuestionnaireForm", "_handle_onTextFieldChange", { name, value });
|
||||
|
||||
const update = { ...this.state };
|
||||
_set(update, name, value);
|
||||
|
||||
/*
|
||||
if(name.indexOf(".") > -1)
|
||||
{
|
||||
const names = name.split(".");
|
||||
if(names.length === 4)
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ][ names[2] ][ names[3] ] = value;
|
||||
}
|
||||
else if(names.length === 3)
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ][ names[2] ] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ] = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
update[name] = value;
|
||||
}
|
||||
*/
|
||||
this._updateQuestionnaire(update);
|
||||
}
|
||||
|
||||
@ -109,33 +83,6 @@ export default class QuestionnaireForm extends React.Component
|
||||
|
||||
const update = { ...this.state };
|
||||
_set(update, name, value);
|
||||
|
||||
/*
|
||||
const update = {};
|
||||
if(name.indexOf(".") > -1)
|
||||
{
|
||||
const names = name.split(".");
|
||||
if(names.length === 4)
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ][ names[2] ][ names[3] ] = value;
|
||||
}
|
||||
else if(names.length === 3)
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ][ names[2] ] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ] = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
update[name] = value;
|
||||
}
|
||||
*/
|
||||
this._updateQuestionnaire(update);
|
||||
}
|
||||
|
||||
@ -195,42 +142,4 @@ export default class QuestionnaireForm extends React.Component
|
||||
|
||||
this._updateQuestionnaire(update);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
const state = {
|
||||
foo: {
|
||||
bar: {
|
||||
val: []
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
console.log(state);
|
||||
console.log(state);
|
||||
|
||||
const name = "foo.bar.val";
|
||||
const names = name.split(".");
|
||||
|
||||
console.log(names);
|
||||
|
||||
if(names.length > 0)
|
||||
{
|
||||
|
||||
}
|
||||
if(names.length === 4)
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ][ names[2] ][ names[3] ] = value;
|
||||
}
|
||||
else if(names.length === 3)
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ][ names[2] ] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
update[ names[0] ] = { ...this.state[ names[0] ] };
|
||||
update[ names[0] ][ names[1] ] = value;
|
||||
}
|
||||
*/
|
||||
}
|
||||
283
package-lock.json
generated
283
package-lock.json
generated
@ -12,41 +12,11 @@
|
||||
"@babel/highlight": "^7.10.4"
|
||||
}
|
||||
},
|
||||
"@babel/helper-module-imports": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz",
|
||||
"integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==",
|
||||
"requires": {
|
||||
"@babel/types": "^7.18.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz",
|
||||
"integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g=="
|
||||
},
|
||||
"@babel/types": {
|
||||
"version": "7.18.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.10.tgz",
|
||||
"integrity": "sha512-MJvnbEiiNkpjo+LknnmRrqbY1GPUUggjv+wQVjetM/AONoupqRALB7I6jGqNUAZsKcRIEu2J6FRFvsczljjsaQ==",
|
||||
"requires": {
|
||||
"@babel/helper-string-parser": "^7.18.10",
|
||||
"@babel/helper-validator-identifier": "^7.18.6",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/helper-plugin-utils": {
|
||||
"version": "7.14.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz",
|
||||
"integrity": "sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ=="
|
||||
},
|
||||
"@babel/helper-string-parser": {
|
||||
"version": "7.18.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz",
|
||||
"integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw=="
|
||||
},
|
||||
"@babel/helper-validator-identifier": {
|
||||
"version": "7.15.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz",
|
||||
@ -97,148 +67,6 @@
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"@emotion/babel-plugin": {
|
||||
"version": "11.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.10.0.tgz",
|
||||
"integrity": "sha512-xVnpDAAbtxL1dsuSelU5A7BnY/lftws0wUexNJZTPsvX/1tM4GZJbclgODhvW4E+NH7E5VFcH0bBn30NvniPJA==",
|
||||
"requires": {
|
||||
"@babel/helper-module-imports": "^7.16.7",
|
||||
"@babel/plugin-syntax-jsx": "^7.17.12",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@emotion/hash": "^0.9.0",
|
||||
"@emotion/memoize": "^0.8.0",
|
||||
"@emotion/serialize": "^1.1.0",
|
||||
"babel-plugin-macros": "^3.1.0",
|
||||
"convert-source-map": "^1.5.0",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"find-root": "^1.1.0",
|
||||
"source-map": "^0.5.7",
|
||||
"stylis": "4.0.13"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": {
|
||||
"version": "7.18.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz",
|
||||
"integrity": "sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w=="
|
||||
},
|
||||
"@babel/plugin-syntax-jsx": {
|
||||
"version": "7.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz",
|
||||
"integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==",
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.18.6"
|
||||
}
|
||||
},
|
||||
"@babel/runtime": {
|
||||
"version": "7.18.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz",
|
||||
"integrity": "sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.5.7",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
"integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ=="
|
||||
},
|
||||
"stylis": {
|
||||
"version": "4.0.13",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.13.tgz",
|
||||
"integrity": "sha512-xGPXiFVl4YED9Jh7Euv2V220mriG9u4B2TA6Ybjc1catrstKD2PpIdU3U0RKpkVBC2EhmL/F0sPCr9vrFTNRag=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@emotion/cache": {
|
||||
"version": "11.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.10.1.tgz",
|
||||
"integrity": "sha512-uZTj3Yz5D69GE25iFZcIQtibnVCFsc/6+XIozyL3ycgWvEdif2uEw9wlUt6umjLr4Keg9K6xRPHmD8LGi+6p1A==",
|
||||
"requires": {
|
||||
"@emotion/memoize": "^0.8.0",
|
||||
"@emotion/sheet": "^1.2.0",
|
||||
"@emotion/utils": "^1.2.0",
|
||||
"@emotion/weak-memoize": "^0.3.0",
|
||||
"stylis": "4.0.13"
|
||||
},
|
||||
"dependencies": {
|
||||
"stylis": {
|
||||
"version": "4.0.13",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.13.tgz",
|
||||
"integrity": "sha512-xGPXiFVl4YED9Jh7Euv2V220mriG9u4B2TA6Ybjc1catrstKD2PpIdU3U0RKpkVBC2EhmL/F0sPCr9vrFTNRag=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@emotion/hash": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.0.tgz",
|
||||
"integrity": "sha512-14FtKiHhy2QoPIzdTcvh//8OyBlknNs2nXRwIhG904opCby3l+9Xaf/wuPvICBF0rc1ZCNBd3nKe9cd2mecVkQ=="
|
||||
},
|
||||
"@emotion/memoize": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.0.tgz",
|
||||
"integrity": "sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA=="
|
||||
},
|
||||
"@emotion/react": {
|
||||
"version": "11.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.10.0.tgz",
|
||||
"integrity": "sha512-K6z9zlHxxBXwN8TcpwBKcEsBsOw4JWCCmR+BeeOWgqp8GIU1yA2Odd41bwdAAr0ssbQrbJbVnndvv7oiv1bZeQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@emotion/babel-plugin": "^11.10.0",
|
||||
"@emotion/cache": "^11.10.0",
|
||||
"@emotion/serialize": "^1.1.0",
|
||||
"@emotion/utils": "^1.2.0",
|
||||
"@emotion/weak-memoize": "^0.3.0",
|
||||
"hoist-non-react-statics": "^3.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.18.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz",
|
||||
"integrity": "sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@emotion/serialize": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.1.0.tgz",
|
||||
"integrity": "sha512-F1ZZZW51T/fx+wKbVlwsfchr5q97iW8brAnXmsskz4d0hVB4O3M/SiA3SaeH06x02lSNzkkQv+n3AX3kCXKSFA==",
|
||||
"requires": {
|
||||
"@emotion/hash": "^0.9.0",
|
||||
"@emotion/memoize": "^0.8.0",
|
||||
"@emotion/unitless": "^0.8.0",
|
||||
"@emotion/utils": "^1.2.0",
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"@emotion/sheet": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.0.tgz",
|
||||
"integrity": "sha512-OiTkRgpxescko+M51tZsMq7Puu/KP55wMT8BgpcXVG2hqXc0Vo0mfymJ/Uj24Hp0i083ji/o0aLddh08UEjq8w=="
|
||||
},
|
||||
"@emotion/unitless": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.0.tgz",
|
||||
"integrity": "sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw=="
|
||||
},
|
||||
"@emotion/utils": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.2.0.tgz",
|
||||
"integrity": "sha512-sn3WH53Kzpw8oQ5mgMmIzzyAaH2ZqFEbozVVBSYp538E06OSE6ytOp7pRAjNQR+Q/orwqdQYJSe2m3hCOeznkw=="
|
||||
},
|
||||
"@emotion/weak-memoize": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.3.0.tgz",
|
||||
"integrity": "sha512-AHPmaAx+RYfZz0eYu6Gviiagpmiyw98ySSlQvCUhVGDRtDFe4DBS0x1bSjdF3gqUDYOczB+yYvBTtEylYSdRhg=="
|
||||
},
|
||||
"@eslint/eslintrc": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz",
|
||||
@ -577,11 +405,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz",
|
||||
"integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w=="
|
||||
},
|
||||
"@types/parse-json": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
|
||||
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA=="
|
||||
},
|
||||
"@types/prop-types": {
|
||||
"version": "15.7.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz",
|
||||
@ -928,16 +751,6 @@
|
||||
"integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-macros": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz",
|
||||
"integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"cosmiconfig": "^7.0.0",
|
||||
"resolve": "^1.19.0"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
@ -1120,7 +933,8 @@
|
||||
"callsites": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
|
||||
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001271",
|
||||
@ -1325,18 +1139,6 @@
|
||||
"vary": "^1"
|
||||
}
|
||||
},
|
||||
"cosmiconfig": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz",
|
||||
"integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==",
|
||||
"requires": {
|
||||
"@types/parse-json": "^4.0.0",
|
||||
"import-fresh": "^3.2.1",
|
||||
"parse-json": "^5.0.0",
|
||||
"path-type": "^4.0.0",
|
||||
"yaml": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"create-ecdh": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz",
|
||||
@ -1622,14 +1424,6 @@
|
||||
"resolved": "https://registry.npmjs.org/enquire.js/-/enquire.js-2.1.6.tgz",
|
||||
"integrity": "sha512-/KujNpO+PT63F7Hlpu4h3pE3TokKRHN26JYmQpPyjkRD/N57R7bPDNojMXdi7uveAKjYB7yQnartCxZnFWr0Xw=="
|
||||
},
|
||||
"error-ex": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
||||
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
|
||||
"requires": {
|
||||
"is-arrayish": "^0.2.1"
|
||||
}
|
||||
},
|
||||
"es-abstract": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz",
|
||||
@ -2309,11 +2103,6 @@
|
||||
"array-back": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"find-root": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
|
||||
"integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng=="
|
||||
},
|
||||
"find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
@ -2616,6 +2405,7 @@
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||
"integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"parent-module": "^1.0.0",
|
||||
"resolve-from": "^4.0.0"
|
||||
@ -2702,11 +2492,6 @@
|
||||
"has-tostringtag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-arrayish": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
|
||||
"integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg=="
|
||||
},
|
||||
"is-bigint": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz",
|
||||
@ -2746,6 +2531,7 @@
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
|
||||
"integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
}
|
||||
@ -2924,11 +2710,6 @@
|
||||
"argparse": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"json-parse-even-better-errors": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
|
||||
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
@ -3049,11 +2830,6 @@
|
||||
"type-check": "~0.4.0"
|
||||
}
|
||||
},
|
||||
"lines-and-columns": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
||||
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
|
||||
},
|
||||
"loader-utils": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
|
||||
@ -3194,11 +2970,6 @@
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ=="
|
||||
},
|
||||
"memoize-one": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz",
|
||||
"integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q=="
|
||||
},
|
||||
"merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
@ -3312,6 +3083,11 @@
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.17.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
|
||||
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "3.1.30",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz",
|
||||
@ -3790,6 +3566,7 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||
"integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"callsites": "^3.0.0"
|
||||
}
|
||||
@ -3806,17 +3583,6 @@
|
||||
"safe-buffer": "^5.1.1"
|
||||
}
|
||||
},
|
||||
"parse-json": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
|
||||
"integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==",
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"error-ex": "^1.3.1",
|
||||
"json-parse-even-better-errors": "^2.3.0",
|
||||
"lines-and-columns": "^1.1.6"
|
||||
}
|
||||
},
|
||||
"path-browserify": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
|
||||
@ -3842,12 +3608,14 @@
|
||||
"path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true
|
||||
},
|
||||
"path-type": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
|
||||
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="
|
||||
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
|
||||
"dev": true
|
||||
},
|
||||
"pbkdf2": {
|
||||
"version": "3.1.2",
|
||||
@ -4155,20 +3923,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz",
|
||||
"integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg=="
|
||||
},
|
||||
"react-select": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/react-select/-/react-select-5.4.0.tgz",
|
||||
"integrity": "sha512-CjE9RFLUvChd5SdlfG4vqxZd55AZJRrLrHzkQyTYeHlpOztqcgnyftYAolJ0SGsBev6zAs6qFrjm6KU3eo2hzg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.12.0",
|
||||
"@emotion/cache": "^11.4.0",
|
||||
"@emotion/react": "^11.8.1",
|
||||
"@types/react-transition-group": "^4.4.0",
|
||||
"memoize-one": "^5.0.0",
|
||||
"prop-types": "^15.6.0",
|
||||
"react-transition-group": "^4.3.0"
|
||||
}
|
||||
},
|
||||
"react-slick": {
|
||||
"version": "0.29.0",
|
||||
"resolved": "https://registry.npmjs.org/react-slick/-/react-slick-0.29.0.tgz",
|
||||
@ -4300,6 +4054,7 @@
|
||||
"version": "1.20.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
|
||||
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-core-module": "^2.2.0",
|
||||
"path-parse": "^1.0.6"
|
||||
@ -4308,7 +4063,8 @@
|
||||
"resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
|
||||
"dev": true
|
||||
},
|
||||
"reusify": {
|
||||
"version": "1.0.4",
|
||||
@ -4978,11 +4734,6 @@
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"dev": true
|
||||
},
|
||||
"yaml": {
|
||||
"version": "1.10.2",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
|
||||
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="
|
||||
},
|
||||
"yocto-queue": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
|
||||
33
pages/api/questionnaire/download.js
Normal file
33
pages/api/questionnaire/download.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import axios from 'axios';
|
||||
import { Cookies } from 'react-cookie';
|
||||
import cookie from 'cookie';
|
||||
import moment from 'moment';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { cors } from '../../../lib/cors';
|
||||
import { inspect } from 'util';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "questionnaire", "get");
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
await cors(req, res);
|
||||
|
||||
if(req.headers.cookie !== undefined)
|
||||
{
|
||||
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
|
||||
|
||||
if(cookies.jwt !== undefined && cookies.jwt !== null)
|
||||
{
|
||||
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
|
||||
var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true });
|
||||
|
||||
res.status(200);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(403);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
pages/api/questionnaire/sign.js
Normal file
33
pages/api/questionnaire/sign.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import axios from 'axios';
|
||||
import { Cookies } from 'react-cookie';
|
||||
import cookie from 'cookie';
|
||||
import moment from 'moment';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { cors } from '../../../lib/cors';
|
||||
import { inspect } from 'util';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "questionnaire", "get");
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
await cors(req, res);
|
||||
|
||||
if(req.headers.cookie !== undefined)
|
||||
{
|
||||
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
|
||||
|
||||
if(cookies.jwt !== undefined && cookies.jwt !== null)
|
||||
{
|
||||
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
|
||||
var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true });
|
||||
|
||||
res.status(200);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(403);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
pages/api/questionnaire/upload.js
Normal file
33
pages/api/questionnaire/upload.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import axios from 'axios';
|
||||
import { Cookies } from 'react-cookie';
|
||||
import cookie from 'cookie';
|
||||
import moment from 'moment';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { cors } from '../../../lib/cors';
|
||||
import { inspect } from 'util';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "questionnaire", "get");
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
await cors(req, res);
|
||||
|
||||
if(req.headers.cookie !== undefined)
|
||||
{
|
||||
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
|
||||
|
||||
if(cookies.jwt !== undefined && cookies.jwt !== null)
|
||||
{
|
||||
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
|
||||
var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true });
|
||||
|
||||
res.status(200);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(403);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@ import InnerMenu from "../../components/questionnaire/InnerMenu";
|
||||
import Header from '../components/Header';
|
||||
import Footer from '../components/Footer';
|
||||
|
||||
import { sendPhoneChangeNumber, sendPhoneChangeNumberSmsCode, setUserPhone, getQuestionnaire, getContractGraphicChangeSignatories } from '../../actions';
|
||||
import { sendPhoneChangeNumber, sendPhoneChangeNumberSmsCode, setUserPhone, getQuestionnaire, getContractGraphicChangeSignatories, } from '../../actions';
|
||||
import AccountLayout from "../components/Layout/Account";
|
||||
import Form_1_Main from "../../components/questionnaire/forms/Form_1_Main";
|
||||
import Form_2_Contacts from "../../components/questionnaire/forms/Form_2_Contacts";
|
||||
|
||||
@ -168,9 +168,6 @@ export const defaultState = {
|
||||
middlename: "",
|
||||
no_middle_name: false,
|
||||
jobtitle: "",
|
||||
assignment_date: "",
|
||||
indefinite: "",
|
||||
credentials_dateend: "",
|
||||
telephone: "",
|
||||
email: "",
|
||||
identity_document: {
|
||||
|
||||
@ -5,19 +5,30 @@ export function isPluginCryptoProInstalled()
|
||||
return new Promise(function(resolve, reject)
|
||||
{
|
||||
console.log("isPluginCryptoProInstalled");
|
||||
console.log("window.cadesplugin", window.cadesplugin);
|
||||
console.log("window.cadesplugin", "BEFORE", window.cadesplugin);
|
||||
|
||||
window.cadesplugin.async_spawn(function *(args)
|
||||
setTimeout(() =>
|
||||
{
|
||||
try {
|
||||
yield window.cadesplugin
|
||||
} catch (e) {
|
||||
reject({message: e})
|
||||
return;
|
||||
}
|
||||
console.log("window.cadesplugin", "AFTER", window.cadesplugin);
|
||||
|
||||
resolve();
|
||||
});
|
||||
window.cadesplugin.async_spawn(function *(args)
|
||||
{
|
||||
try
|
||||
{
|
||||
yield window.cadesplugin
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.error("isPluginCryptoProInstalled");
|
||||
console.error(e);
|
||||
|
||||
reject({ message: e })
|
||||
return;
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
@ -29,43 +40,53 @@ export function getCertificates()
|
||||
{
|
||||
return new Promise(function(resolve, reject)
|
||||
{
|
||||
window.cadesplugin.async_spawn(function *(args)
|
||||
setTimeout(() =>
|
||||
{
|
||||
try {
|
||||
var store = yield window.cadesplugin.CreateObjectAsync("CAdESCOM.Store");
|
||||
|
||||
yield store.Open(
|
||||
window.cadesplugin.CAPICOM_CURRENT_USER_STORE,
|
||||
window.cadesplugin.CAPICOM_MY_STORE,
|
||||
window.cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED
|
||||
);
|
||||
var certificates = yield store.Certificates;
|
||||
var certificatesCount = yield certificates.Count
|
||||
|
||||
var data = [];
|
||||
for (let i = 0; i < certificatesCount; i++)
|
||||
window.cadesplugin.async_spawn(function *(args)
|
||||
{
|
||||
try
|
||||
{
|
||||
let certificate = yield certificates.Item(i+1)
|
||||
var store = yield window.cadesplugin.CreateObjectAsync("CAdESCOM.Store");
|
||||
|
||||
data.push({
|
||||
index: i+1,
|
||||
certificate: certificate,
|
||||
info: {
|
||||
subjectName: parseSubjectNameToObj(yield certificate.SubjectName)['name'],
|
||||
subjectFields: parseSubjectNameToArray(yield certificate.SubjectName),
|
||||
issuerName: yield certificate.IssuerName,
|
||||
validFromDate: yield certificate.ValidFromDate,
|
||||
validToDate: yield certificate.ValidToDate
|
||||
}
|
||||
});
|
||||
yield store.Open(
|
||||
window.cadesplugin.CAPICOM_CURRENT_USER_STORE,
|
||||
window.cadesplugin.CAPICOM_MY_STORE,
|
||||
window.cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED
|
||||
);
|
||||
|
||||
var certificates = yield store.Certificates;
|
||||
var certificatesCount = yield certificates.Count
|
||||
|
||||
var data = [];
|
||||
for (let i = 0; i < certificatesCount; i++)
|
||||
{
|
||||
let certificate = yield certificates.Item(i+1)
|
||||
|
||||
data.push({
|
||||
index: i+1,
|
||||
certificate: certificate,
|
||||
info: {
|
||||
subjectName: parseSubjectNameToObj(yield certificate.SubjectName)['name'],
|
||||
subjectFields: parseSubjectNameToObj(yield certificate.SubjectName), //parseSubjectNameToArray(yield certificate.SubjectName),
|
||||
issuerName: yield certificate.IssuerName,
|
||||
validFromDate: yield certificate.ValidFromDate,
|
||||
validToDate: yield certificate.ValidToDate
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
store.Close();
|
||||
resolve(data);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.error("getCertificates");
|
||||
console.error(e);
|
||||
|
||||
reject(e);
|
||||
}
|
||||
|
||||
store.Close();
|
||||
resolve(data);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
@ -103,16 +124,19 @@ export function getCertificates()
|
||||
|
||||
function parseSubjectNameToArray(string)
|
||||
{
|
||||
let outputData = [];
|
||||
console.log("parseSubjectNameToArray", "string", string);
|
||||
|
||||
let outputData = [];
|
||||
let fieldsNames = {
|
||||
'CN': 'Имя',
|
||||
'E': 'Электронная почта',
|
||||
'C': 'Страна',
|
||||
'S': 'Область, штат',
|
||||
'L': 'Город',
|
||||
'O': 'Организация',
|
||||
'OU': 'Подраздиление'
|
||||
'CN': 'Имя',
|
||||
'E': 'Электронная почта',
|
||||
'C': 'Страна',
|
||||
'S': 'Область, штат',
|
||||
'L': 'Город',
|
||||
'O': 'Организация',
|
||||
'OU': 'Подраздиление',
|
||||
'SN': 'SN',
|
||||
'G': 'G',
|
||||
};
|
||||
|
||||
// 'C=RU, S="Область, штат"' -> [['C', 'RU'], ['S', '"Область, штат"']]
|
||||
@ -165,7 +189,9 @@ function parseSubjectNameToObj(string)
|
||||
'S': 'state',
|
||||
'L': 'city',
|
||||
'O': 'organization',
|
||||
'OU': 'subdivision'
|
||||
'OU': 'subdivision',
|
||||
'SN': 'SN',
|
||||
'G': 'G',
|
||||
};
|
||||
|
||||
// 'C=RU, S="Область, штат"' -> [['C', 'RU'], ['S', '"Область, штат"']]
|
||||
@ -247,6 +273,7 @@ export function signData(dataToSign, certificate, returnObj, signingType)
|
||||
resolve(signedData);
|
||||
} catch (e)
|
||||
{
|
||||
console.error("window.cadesplugin.async_spawn(function *(args) CATCH");
|
||||
console.error(e);
|
||||
reject(e);
|
||||
}
|
||||
@ -278,11 +305,17 @@ export function hasDataSignature(data)
|
||||
}
|
||||
catch (e2)
|
||||
{
|
||||
console.error("oSignedData.VerifyCades");
|
||||
console.error(e2);
|
||||
|
||||
resolve(false);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.error("CAdESCOM.CadesSignedData");
|
||||
console.error(e);
|
||||
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user