updates for deal cancel process
This commit is contained in:
parent
94cf1d10d3
commit
986114702e
@ -238,7 +238,10 @@ export const sendDealDocuments = ({ deal_id }) =>
|
||||
{
|
||||
console.log("ACTION", "deals", "sendDealDocuments", "response.data", response.data);
|
||||
|
||||
setTimeout(() =>
|
||||
{
|
||||
resolve();
|
||||
}, 20000);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
|
||||
@ -250,3 +250,57 @@ export const signUploadPaperDocument = (contract_number, deal_id, files) =>
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const signCheckCancelDocument = ({ contract_number, doc_type_id }) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/cancel/check`;
|
||||
|
||||
console.log("ACTION", "sign", "signCheckCancelDocument()", { url });
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number, doc_type_id }, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
console.log("ACTION", "sign", "signCheckCancelDocument()", "response", response.data);
|
||||
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("ACTION", "sign", "signCheckCancelDocument()", "ERROR");
|
||||
console.error(error);
|
||||
|
||||
reject(error.data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const signCancelDocument = ({ contract_number, doc_type_id }) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/cancel`;
|
||||
|
||||
console.log("ACTION", "sign", "signCancelDocument()", { url });
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number, doc_type_id }, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
console.log("ACTION", "sign", "signCancelDocument()", "response", response.data);
|
||||
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("ACTION", "sign", "signCancelDocument()", "ERROR");
|
||||
console.error(error);
|
||||
|
||||
reject(error.data);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -6,7 +6,7 @@ import { concatSeries } from "async";
|
||||
import { eachSeries } from 'async';
|
||||
import Select from 'react-select';
|
||||
|
||||
import { createEDOProject, docEDOCancel, signCheckCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect, getFile, signGetFileContractProject } from "../../../actions";
|
||||
import { createEDOProject, signCheckCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect, getFile, signGetFileContractProject, signCheckCancelDocument, signCancelDocument } from "../../../actions";
|
||||
|
||||
class DealContractsSignEDO extends React.Component
|
||||
{
|
||||
@ -370,7 +370,10 @@ class DealContractsSignEDO extends React.Component
|
||||
|
||||
this.setState({ loading: true, disabled: true }, async () =>
|
||||
{
|
||||
await docEDOCancel({ contract_number: documents[index].id, doc_type_id: "144" });
|
||||
const check_result = await signCheckCancelDocument({ contract_number: documents[index].id, doc_type_id: "144" });
|
||||
if(check_result.status === "success")
|
||||
{
|
||||
await signCancelDocument({ contract_number: documents[index].id, doc_type_id: "144" });
|
||||
const docs = [ ...this.state.documents ];
|
||||
docs.splice(index, 1);
|
||||
|
||||
@ -382,6 +385,15 @@ class DealContractsSignEDO extends React.Component
|
||||
{
|
||||
onCancel(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await this._updateDocs(index, {
|
||||
loading: false,
|
||||
error: true,
|
||||
message: check_result.message !== undefined && check_result.message !== null ? check_result.message : "Возникла ошибка при отмене подписания через ЭДО",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import { eachSeries } from 'async';
|
||||
import Select from 'react-select';
|
||||
import Dropzone from 'react-dropzone';
|
||||
|
||||
import { docEDOCancel, signCheckCreatePrintForm, signGetGUIDEntity, signGetWMDoc, docEDOStatus, getFile, signGetFileContractProject, signUploadPaperDocument } from "../../../actions";
|
||||
import { signCheckCreatePrintForm, signGetGUIDEntity, signGetWMDoc, docEDOStatus, getFile, signGetFileContractProject, signUploadPaperDocument, signCheckCancelDocument, signCancelDocument } from "../../../actions";
|
||||
|
||||
export default class DealContractsSignPaper extends React.Component
|
||||
{
|
||||
@ -224,7 +224,10 @@ export default class DealContractsSignPaper extends React.Component
|
||||
|
||||
this.setState({ loading: true, disabled: true }, async () =>
|
||||
{
|
||||
await docEDOCancel({ contract_number: documents[index].id, doc_type_id: "60" });
|
||||
const check_result = await signCheckCancelDocument({ contract_number: documents[index].id, doc_type_id: "60" });
|
||||
if(check_result.status === "success")
|
||||
{
|
||||
await signCancelDocument({ contract_number: documents[index].id, doc_type_id: "60" });
|
||||
const docs = [ ...this.state.documents ];
|
||||
docs.splice(index, 1);
|
||||
|
||||
@ -236,6 +239,15 @@ export default class DealContractsSignPaper extends React.Component
|
||||
{
|
||||
onCancel(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await this._updateDocs(index, {
|
||||
loading: false,
|
||||
error: true,
|
||||
message: check_result.message !== undefined && check_result.message !== null ? check_result.message : "Возникла ошибка при отмене подписания",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import moment from "moment";
|
||||
import { SpinnerCircular } from "spinners-react";
|
||||
import Dropzone from 'react-dropzone';
|
||||
|
||||
import { docEDOCancel, docEDOStatus, getFile, signCheckDownloadContractProject, signGetFileContractProject, signUploadPaperDocument } from "../../../actions";
|
||||
import { docEDOStatus, getFile, signCancelDocument, signCheckCancelDocument, signCheckDownloadContractProject, signGetFileContractProject, signUploadPaperDocument } from "../../../actions";
|
||||
|
||||
export default class SignPlannedContract extends React.Component
|
||||
{
|
||||
@ -16,6 +16,7 @@ export default class SignPlannedContract extends React.Component
|
||||
finished: false,
|
||||
loading_download_file: false,
|
||||
loading_cancel_sign: false,
|
||||
loading_signing: false,
|
||||
loading_uploading_file: false,
|
||||
disabled: false,
|
||||
status: undefined,
|
||||
@ -54,7 +55,7 @@ export default class SignPlannedContract extends React.Component
|
||||
});
|
||||
}
|
||||
|
||||
_handle_downloadFile = (edo) =>
|
||||
_handle_downloadFile = () =>
|
||||
{
|
||||
console.log("_handle_downloadFile");
|
||||
|
||||
@ -74,7 +75,7 @@ export default class SignPlannedContract extends React.Component
|
||||
|
||||
console.log("_handle_downloadFile", { link_result });
|
||||
await getFile({ id: link_result.url, filename: `ЛК ЭВОЛЮЦИЯ ${ contract.name }.${ link_result.extension }` });
|
||||
this.setState({ disabled: false, loading_download_file: false, error: false, uploading: edo ? false : true, });
|
||||
this.setState({ disabled: false, loading_download_file: false, error: false, uploading: contract.sign_type === "EDO" ? false : true, });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -91,24 +92,72 @@ export default class SignPlannedContract extends React.Component
|
||||
});
|
||||
}
|
||||
|
||||
_handle_cancelEDOSign = () =>
|
||||
_handle_cancelSign = () =>
|
||||
{
|
||||
console.log("_handle_cancelEDOSign");
|
||||
console.log("_handle_cancelSign");
|
||||
const { contract, onDealContractsUpdate } = this.props;
|
||||
|
||||
this.setState({ disabled: true, loading_cancel_sign: true }, async () =>
|
||||
{
|
||||
await docEDOCancel({ contract_number: contract.name, doc_type_id: contract.sign_type === "EDO" ? "144" : "60" });
|
||||
const check_result = await signCheckCancelDocument({ contract_number: contract.name, doc_type_id: contract.sign_type === "EDO" ? "144" : "60" });
|
||||
if(check_result.status === "success")
|
||||
{
|
||||
const cancel_result = await signCancelDocument({ contract_number: contract.name, doc_type_id: contract.sign_type === "EDO" ? "144" : "60" });
|
||||
setTimeout(() => {
|
||||
onDealContractsUpdate();
|
||||
// this.setState({ disabled: false, loading_cancel_sign: false });
|
||||
// this.setState({ disabled: false, loading_cancel_sign: false });
|
||||
}, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({
|
||||
loading: false,
|
||||
loading_cancel_sign: false,
|
||||
error: true,
|
||||
message: check_result.message !== undefined && check_result.message !== null ? check_result.message : `Возникла ошибка при отмене подписания${ contract.sign_type === "EDO" ? " через ЭДО" : "" }`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handle_sendToEDO = () =>
|
||||
{
|
||||
console.log("_handle_sendToEDO");
|
||||
|
||||
const { contract, onDealContractsUpdate } = this.props;
|
||||
|
||||
this.setState({ disabled: true, loading_signing: true }, async () =>
|
||||
{
|
||||
const check_result = await signCheckDownloadContractProject({ contract_number: contract.name });
|
||||
if(check_result.status === "success")
|
||||
{
|
||||
const status_result = await docEDOStatus({ contract_number: document.id });
|
||||
console.log({ status_result });
|
||||
|
||||
if(status_result.status > 0)
|
||||
{
|
||||
const sign_result = await docEDOSign({ edoid: status_result.edoid });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({
|
||||
loading: false,
|
||||
loading_signing: false,
|
||||
error: true,
|
||||
message: status_result.message !== undefined && status_result.message !== null ? status_result.message : `Возникла ошибка при отправке в ЭДО`,
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({
|
||||
loading: false,
|
||||
loading_signing: false,
|
||||
error: true,
|
||||
message: check_result.message !== undefined && check_result.message !== null ? check_result.message : `Возникла ошибка при отправке в ЭДО`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onGoToEDO = () =>
|
||||
@ -170,7 +219,7 @@ export default class SignPlannedContract extends React.Component
|
||||
<Dropzone onDrop={ (acceptedFiles) => this._handle_onUploadFile(acceptedFiles, index) } maxFiles={ 10 }>
|
||||
{ ({getRootProps, getInputProps}) => (
|
||||
<div { ...getRootProps() }>
|
||||
<button className="button" disabled={ disabled }>
|
||||
<button className="button" style={{ minWidth: "294px", }} disabled={ disabled }>
|
||||
{ loading_uploading_file ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : (
|
||||
@ -182,13 +231,22 @@ export default class SignPlannedContract extends React.Component
|
||||
) }
|
||||
</Dropzone>
|
||||
) : (
|
||||
<button className="button blue" disabled={ disabled } style={{ minWidth: "230px" }} onClick={ () => this._handle_downloadFile(false) }>
|
||||
<>
|
||||
<button className="button blue" style={{ minWidth: "230px", }} disabled={ disabled } onClick={ () => this._handle_downloadFile() }>
|
||||
{ loading_download_file ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : (
|
||||
"Скачать файл для подписания"
|
||||
) }
|
||||
</button>
|
||||
<button className="button blue" style={{ minWidth: "175px", }} disabled={ disabled } onClick={ () => this._handle_cancelSign() }>
|
||||
{ loading_cancel_sign ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : (
|
||||
"Отменить подписание"
|
||||
) }
|
||||
</button>
|
||||
</>
|
||||
) }
|
||||
</div>
|
||||
) }
|
||||
@ -197,17 +255,17 @@ export default class SignPlannedContract extends React.Component
|
||||
{ contract.sign_type === "EDO" && (
|
||||
<div className="actions">
|
||||
{ status === 1 && (
|
||||
<button className="button blue" disabled={ disabled } onClick={ () => this._handle_downloadFile(true) }>{ loading_download_file ? (
|
||||
<button className="button blue" style={{ minWidth: "130px", }} disabled={ disabled } onClick={ () => this._handle_downloadFile() }>{ loading_download_file ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : ("Скачать проект") }</button>
|
||||
) }
|
||||
{ status === 1 && (
|
||||
<button className="button blue" disabled={ disabled } onClick={ () => this._handle_cancelEDOSign() }>{ loading_cancel_sign ? (
|
||||
<button className="button blue" style={{ minWidth: "175px", }} disabled={ disabled } onClick={ () => this._handle_cancelSign() }>{ loading_cancel_sign ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : ("Отменить подписание") }</button>
|
||||
)}
|
||||
{ status === 1 && (
|
||||
<button className="button blue" disabled={ disabled } onClick={ () => this._handle_sendToEDO() }>Отправить в ЭДО</button>
|
||||
<button className="button blue" style={{ minWidth: "144px", }} disabled={ disabled } onClick={ () => this._handle_sendToEDO() }>Отправить в ЭДО</button>
|
||||
) }
|
||||
{ status >= 2 && (
|
||||
<button className="button blue" onClick={ () => this._handle_onGoToEDO() }>Перейти в ЭДО</button>
|
||||
|
||||
@ -6,7 +6,7 @@ import { concatSeries } from "async";
|
||||
import { eachSeries } from 'async';
|
||||
import Select from 'react-select';
|
||||
|
||||
import { createEDOProject, docEDOCancel, signCheckCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect, getFile, signGetFileContractProject } from "../../actions";
|
||||
import { createEDOProject, signCheckCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect, getFile, signGetFileContractProject, signCheckCancelDocument } from "../../actions";
|
||||
//import { getDeals, getDealOffers, getDealDocuments, getDealContracts } from "../../actions";
|
||||
|
||||
class EDOSign extends React.Component
|
||||
@ -371,7 +371,7 @@ class EDOSign extends React.Component
|
||||
|
||||
this.setState({ loading: true, disabled: true }, async () =>
|
||||
{
|
||||
await docEDOCancel({ contract_number: documents[index].id, doc_type_id: "144" });
|
||||
await signCheckCancelDocument({ contract_number: documents[index].id, doc_type_id: "144" });
|
||||
const docs = [ ...this.state.documents ];
|
||||
docs.splice(index, 1);
|
||||
|
||||
|
||||
@ -6385,7 +6385,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
.contractStatus_modal .single_status > div .status_body .documents .document .actions {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
gap: 0px 20px;
|
||||
gap: 0px 0px;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
@ -7274,7 +7274,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
.actions {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
gap: 0px 20px;
|
||||
gap: 0px 0px;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
@ -4,20 +4,12 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/cancel/check");
|
||||
|
||||
const { contract_number, sign_type } = req.body;
|
||||
const { contract_number, doc_type_id } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
contract_number,
|
||||
doc_type_id,
|
||||
};
|
||||
|
||||
if(sign_type === "EDO")
|
||||
{
|
||||
payload.doc_type_id = 144;
|
||||
}
|
||||
else
|
||||
{
|
||||
payload.doc_type_id = 60;
|
||||
}
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
path: `${ process.env.CRM_API_HOST }/lk/Contract/CheckCancelDocument`,
|
||||
params: payload,
|
||||
|
||||
@ -4,20 +4,12 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/cancel");
|
||||
|
||||
const { contract_number, sign_type } = req.body;
|
||||
const { contract_number, doc_type_id } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
contract_number,
|
||||
doc_type_id,
|
||||
};
|
||||
|
||||
if(sign_type === "EDO")
|
||||
{
|
||||
payload.doc_type_id = 144;
|
||||
}
|
||||
else
|
||||
{
|
||||
payload.doc_type_id = 60;
|
||||
}
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
path: `${ process.env.CRM_API_HOST }/lk/Contract/CancelDocument`,
|
||||
params: payload,
|
||||
|
||||
@ -79,7 +79,7 @@ function uploadFile({ deal_id, filename, name, group, crm_jwt })
|
||||
const path = `${ uploads }${ filename }`;
|
||||
|
||||
const file_to_send_data = fs.readFileSync(path);
|
||||
console.log({ filename, len: file_to_send_data.length, path });
|
||||
console.log("uploadFile", { filename, len: file_to_send_data.length, path });
|
||||
|
||||
const data = new FormData();
|
||||
data.append("file", file_to_send_data, name);
|
||||
@ -91,7 +91,11 @@ function uploadFile({ deal_id, filename, name, group, crm_jwt })
|
||||
documentName: name,
|
||||
});
|
||||
|
||||
const file_upload_url = `${ process.env.CRM_API_HOST }/lk/document/upload?${ payload.toString() }`;
|
||||
console.log("uploadFile", { payload });
|
||||
|
||||
const payload_string = new URLSearchParams(payload).toString();
|
||||
|
||||
const file_upload_url = `${ process.env.CRM_API_HOST }/lk/document/upload?${ payload_string }`;
|
||||
console.log( file_upload_url );
|
||||
|
||||
axios.post(file_upload_url, data,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user