diff --git a/.gitignore b/.gitignore
index 1437c53..98472a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,4 @@ yarn-error.log*
# vercel
.vercel
+/upload/*
\ No newline at end of file
diff --git a/actions/questionnaireActions.js b/actions/questionnaireActions.js
index a3f5e29..7cfe5e5 100644
--- a/actions/questionnaireActions.js
+++ b/actions/questionnaireActions.js
@@ -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();
+ });
+
+ });
}
\ No newline at end of file
diff --git a/components/CalendarDatePicker/index.js b/components/CalendarDatePicker/index.js
index 40284b5..08afe47 100644
--- a/components/CalendarDatePicker/index.js
+++ b/components/CalendarDatePicker/index.js
@@ -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 (
+{
+ 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 (
+
+
this._handle_onChange(event.target.value) }
+ onFocus={ this._handle_onFocus }
+ onBlur={ this._handle_onBlur }
+ required={ true }
+ disabled={ disabled }
+ />
+ { focused && options.length > 0 && (
+
+
+ { options.map((option, index) =>
+ (
+
this._handle_onSelect(option.value) }>{ option.value }
+ )) }
+
+
+ ) }
+
+ );
+
+
+ /*
+ null }
+ loadingMessage={ () => null }
+ loadOptions={ (text) => this._getAddress(text) }
+ onChange={ this._handle_onChange }
+ //onBlur={ this._handle_onBlur }
+ onInputChange={ this._handle_onInputChange }
+ //isDisabled={ disabled ? true : false }
+ />
+ */
+ }
+}
\ No newline at end of file
diff --git a/components/questionnaire/forms/DigitalSignaturesList.js b/components/questionnaire/forms/DigitalSignaturesList.js
index c066ec0..d42e862 100644
--- a/components/questionnaire/forms/DigitalSignaturesList.js
+++ b/components/questionnaire/forms/DigitalSignaturesList.js
@@ -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
+
{ certificate?.info?.subjectName }
- { certificate.info.subjectFields.map((field) => field.fieldName === "Имя" ? { field.value } : null)}
+ { certificate.info.subjectFields['SN'] || certificate.info.subjectFields['SN'] ? ({ certificate.info.subjectFields['SN'] } { certificate.info.subjectFields['G'] }) : null }
Подпись действительна до { certificate?.info?.validToDate }
diff --git a/components/questionnaire/forms/FilesList.js b/components/questionnaire/forms/FilesList.js
index e7e3743..a28b322 100644
--- a/components/questionnaire/forms/FilesList.js
+++ b/components/questionnaire/forms/FilesList.js
@@ -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 (
- { files.map((file, index) => (
-
-
-
{ this._renderFileName(file.name) }{/*}Постановление{*/}
-
- { !checking && (
-
this._handle_onRemoveFile(file.name) }>
-
✕
+ { files.map((file, index) => {
+ if(file.name === undefined) { return null; }
+ return (
+
+
+
{ this._renderFileName(file.name) }{/*}Постановление{*/}
- ) }
-
- )) }
+ { !checking && (
+
this._handle_onRemoveFile(file.name) }>
+ ✕
+
+ ) }
+
+ )
+ }) }
{ !checking && (
this._handle_onAddFile(acceptedFiles) }>
diff --git a/components/questionnaire/forms/Form_2_Contacts/index.js b/components/questionnaire/forms/Form_2_Contacts/index.js
index c29e8db..d938552 100644
--- a/components/questionnaire/forms/Form_2_Contacts/index.js
+++ b/components/questionnaire/forms/Form_2_Contacts/index.js
@@ -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
-
this._handle_onTextFieldChange("contacts.fact_address", data) }
@@ -148,7 +152,7 @@ class Form_2_Contacts extends QuestionnaireForm
/>
-
-
-
- this._handle_onTextFieldChange("signatory_person.identity_document.registration_address", data) }
diff --git a/components/questionnaire/forms/Form_4_Shareholders/index.js b/components/questionnaire/forms/Form_4_Shareholders/index.js
index ad18e64..77b0c8f 100644
--- a/components/questionnaire/forms/Form_4_Shareholders/index.js
+++ b/components/questionnaire/forms/Form_4_Shareholders/index.js
@@ -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
-
this._handle_onTextFieldChange(`founded_persons[${ index }].identity_document.placebirth`, data.title) }
@@ -220,7 +220,7 @@ class ShareholderForm extends React.Component
-
@@ -62,7 +63,11 @@ class Form_8_Signing extends QuestionnaireForm
_download = () =>
{
- alert("Скачивание сформированного PDF");
+ downloadQuestionnaire()
+ .then(() =>
+ {
+ alert("Скачивание сформированного PDF");
+ });
}
render()
diff --git a/components/questionnaire/forms/QuestionnaireForm.js b/components/questionnaire/forms/QuestionnaireForm.js
index d12112b..4509148 100644
--- a/components/questionnaire/forms/QuestionnaireForm.js
+++ b/components/questionnaire/forms/QuestionnaireForm.js
@@ -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;
-}
-*/
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index a28e22b..82b3702 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -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",
diff --git a/pages/api/questionnaire/download.js b/pages/api/questionnaire/download.js
new file mode 100644
index 0000000..5354ea1
--- /dev/null
+++ b/pages/api/questionnaire/download.js
@@ -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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pages/api/questionnaire/put.js b/pages/api/questionnaire/put.js
deleted file mode 100644
index e69de29..0000000
diff --git a/pages/api/questionnaire/sign.js b/pages/api/questionnaire/sign.js
new file mode 100644
index 0000000..5354ea1
--- /dev/null
+++ b/pages/api/questionnaire/sign.js
@@ -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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pages/api/questionnaire/upload.js b/pages/api/questionnaire/upload.js
new file mode 100644
index 0000000..5354ea1
--- /dev/null
+++ b/pages/api/questionnaire/upload.js
@@ -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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pages/questionnaire/index.js b/pages/questionnaire/index.js
index cb00ffe..8d0fc05 100644
--- a/pages/questionnaire/index.js
+++ b/pages/questionnaire/index.js
@@ -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";
diff --git a/reducers/initialState.js b/reducers/initialState.js
index 896f22c..390ac46 100644
--- a/reducers/initialState.js
+++ b/reducers/initialState.js
@@ -168,9 +168,6 @@ export const defaultState = {
middlename: "",
no_middle_name: false,
jobtitle: "",
- assignment_date: "",
- indefinite: "",
- credentials_dateend: "",
telephone: "",
email: "",
identity_document: {
diff --git a/utils/digital_signature/index.js b/utils/digital_signature/index.js
index 68fb0a7..06c9c60 100644
--- a/utils/digital_signature/index.js
+++ b/utils/digital_signature/index.js
@@ -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);
}
});