diff --git a/actions/signActions.js b/actions/signActions.js index fccc1d5..71ebe92 100644 --- a/actions/signActions.js +++ b/actions/signActions.js @@ -9,11 +9,11 @@ import fileDownload from 'js-file-download'; import * as actionTypes from '../constants/actionTypes'; import * as currentState from '../reducers/initialState'; -export const signCheckEDOCreatePrintForm = ({ contract_number, sign_type }) => +export const signCheckCreatePrintForm = ({ contract_number, sign_type }) => { const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/check`; - console.log("ACTION", "sign", "signCheckEDOCreatePrintForm()", { url }); + console.log("ACTION", "sign", "signCheckCreatePrintForm()", { url }); return new Promise((resolve, reject) => { @@ -22,13 +22,13 @@ export const signCheckEDOCreatePrintForm = ({ contract_number, sign_type }) => }) .then((response) => { - console.log("ACTION", "sign", "signCheckEDOCreatePrintForm()", "response", response.data); + console.log("ACTION", "sign", "signCheckCreatePrintForm()", "response", response.data); resolve(response.data); }) .catch((error) => { - console.error("ACTION", "sign", "signCheckEDOCreatePrintForm()", "ERROR"); + console.error("ACTION", "sign", "signCheckCreatePrintForm()", "ERROR"); console.error(error); reject(error.data); diff --git a/components/DealsStatus/DealContractsSignPaper.js b/components/DealsStatus/DealContractsSignPaper.js index 39407e1..4bce3db 100644 --- a/components/DealsStatus/DealContractsSignPaper.js +++ b/components/DealsStatus/DealContractsSignPaper.js @@ -6,7 +6,7 @@ import { concatSeries } from "async"; import { eachSeries } from 'async'; import Select from 'react-select'; -import { createEDOProject, docEDOCancel, signCheckEDOCreatePrintForm, signDownloadFile, signGetGUIDEntity, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect } from "../../actions"; +import { createEDOProject, docEDOCancel, signCheckCreatePrintForm, signDownloadFile, signGetGUIDEntity, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect } from "../../actions"; export default class DealContractsSignPaper extends React.Component { @@ -32,7 +32,10 @@ export default class DealContractsSignPaper extends React.Component docs.push({ ...this.props.documents[i], ...{ index: i, loading: true, ready: false, upload: false, } }); } - this.setState({ documents: docs, loading: true }); + this.setState({ documents: docs, loading: true }, () => + { + this._sign(); + }); } _updateDocs = (id, update) => @@ -68,11 +71,10 @@ export default class DealContractsSignPaper extends React.Component _sign = () => { //const { documents } = this.props; - const { operator_selected, step } = this.state; const documents = [ ...this.state.documents ]; - console.log("_handle_onFormSubmit"); - console.log({ documents, operator_selected }); + console.log("DealContractsSignPaper", "_sign"); + console.log({ documents, }); this.setState({ loading: true }, () => { @@ -119,7 +121,7 @@ export default class DealContractsSignPaper extends React.Component console.log({ document }) // await this._updateDocs(document.index, { loading: true }); - const create_print_form_result = await signCheckEDOCreatePrintForm({ contract_number: document.id, sign_type: "Paper" }); + const create_print_form_result = await signCheckCreatePrintForm({ contract_number: document.id, sign_type: "Paper" }); console.log({ create_print_form_result }); const docs = { status: create_print_form_result.status }; diff --git a/components/DealsStatus/SingleDeal.js b/components/DealsStatus/SingleDeal.js index 9ff6894..a6f7afc 100644 --- a/components/DealsStatus/SingleDeal.js +++ b/components/DealsStatus/SingleDeal.js @@ -460,6 +460,7 @@ class DocumentsForm extends Step type: file.type, file, update, + index, }; attachDealDocument(payload) diff --git a/components/EDOSign/index.js b/components/EDOSign/index.js index 3b61fc9..12624de 100644 --- a/components/EDOSign/index.js +++ b/components/EDOSign/index.js @@ -6,7 +6,7 @@ import { concatSeries } from "async"; import { eachSeries } from 'async'; import Select from 'react-select'; -import { createEDOProject, docEDOCancel, signCheckEDOCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect, getFile, signGetFileContractProject } from "../../actions"; +import { createEDOProject, docEDOCancel, signCheckCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect, getFile, signGetFileContractProject } from "../../actions"; //import { getDeals, getDealOffers, getDealDocuments, getDealContracts } from "../../actions"; class EDOSign extends React.Component @@ -173,7 +173,7 @@ class EDOSign extends React.Component } else { - const create_print_form_result = await signCheckEDOCreatePrintForm({ contract_number: document.id, sign_type: "EDO" }); + const create_print_form_result = await signCheckCreatePrintForm({ contract_number: document.id, sign_type: "EDO" }); console.log({ create_print_form_result }); const docs = { status: create_print_form_result.status }; diff --git a/pages/api/deals/upload.js b/pages/api/deals/upload.js index 9fbcc35..15da2fd 100644 --- a/pages/api/deals/upload.js +++ b/pages/api/deals/upload.js @@ -35,9 +35,15 @@ function createZipFile(zip_filename, files) zlib: { level: 9 } // Sets the compression level. }); + output.on('close', function() + { + console.log('archive on close'); + resolve(); + }); + output.on('end', function() { - console.log('Data has been drained'); + console.log('archive on end'); }); archive.on('warning', function(err) @@ -60,9 +66,7 @@ function createZipFile(zip_filename, files) { archive.append(fs.createReadStream(files[i].path), { name: files[i].name }); } - await archive.finalize(); - - resolve(); + archive.finalize(); }); } diff --git a/pages/api/questionnaire/send.js b/pages/api/questionnaire/send.js index bbe3168..8e89973 100644 --- a/pages/api/questionnaire/send.js +++ b/pages/api/questionnaire/send.js @@ -42,9 +42,15 @@ function createZipFile(zip_filename, files) zlib: { level: 9 } // Sets the compression level. }); + output.on('close', function() + { + console.log('archive on close'); + resolve(); + }); + output.on('end', function() { - console.log('Data has been drained'); + console.log('archive on end'); }); archive.on('warning', function(err) @@ -70,8 +76,6 @@ function createZipFile(zip_filename, files) archive.append(fs.createReadStream(files[i].path), { name: files[i].name }); } archive.finalize(); - - resolve(); }); } diff --git a/yarn.lock b/yarn.lock index de7ca31..e0837c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4614,9 +4614,9 @@ multer@^1.4.5-lts.1: xtend "^4.0.0" nan@^2.12.1: - version "2.17.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" - integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== + version "2.18.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.18.0.tgz#26a6faae7ffbeb293a39660e88a76b82e30b7554" + integrity sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w== nanoid@^3.1.23: version "3.1.30"