deal files update, EDO sign on additional
This commit is contained in:
parent
ef1cac0ec4
commit
0f20d0d952
@ -295,7 +295,7 @@ export const getDealContracts = ({ dispatch, deal_id }) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const attachDealDocument = ({ deal_id, document_id, document_name, index, lastModified, filename, file, type }) =>
|
||||
export const attachDealDocument = ({ deal_id, document_id, document_name, group, index, lastModified, filename, file, type }) =>
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
@ -306,6 +306,7 @@ export const attachDealDocument = ({ deal_id, document_id, document_name, index,
|
||||
deal_id,
|
||||
document_id,
|
||||
document_name,
|
||||
group,
|
||||
filename,
|
||||
index,
|
||||
lastModified,
|
||||
@ -333,13 +334,13 @@ export const attachDealDocument = ({ deal_id, document_id, document_name, index,
|
||||
});
|
||||
}
|
||||
|
||||
export const removeDealDocument = ({ deal_id, document_id, index, }) =>
|
||||
export const removeDealDocument = ({ deal_id, group, index, }) =>
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
const payload = new URLSearchParams({
|
||||
deal_id,
|
||||
document_id,
|
||||
group,
|
||||
index,
|
||||
});
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ export const docEDOSign = (payload) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const docEDOCancel = ({ contract_number, doc_type_id, }) =>
|
||||
export const docEDOCancel = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/edo/cancel`;
|
||||
|
||||
@ -207,7 +207,7 @@ export const docEDOCancel = ({ contract_number, doc_type_id, }) =>
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number, doc_type_id, }, {
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
|
||||
@ -9,7 +9,7 @@ import fileDownload from 'js-file-download';
|
||||
import * as actionTypes from '../constants/actionTypes';
|
||||
import * as currentState from '../reducers/initialState';
|
||||
|
||||
export const signCheckCreatePrintForm = ({ contract_number, sign_type }) =>
|
||||
export const signCheckCreatePrintForm = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/check`;
|
||||
|
||||
@ -17,7 +17,7 @@ export const signCheckCreatePrintForm = ({ contract_number, sign_type }) =>
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number, sign_type }, {
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
@ -36,7 +36,7 @@ export const signCheckCreatePrintForm = ({ contract_number, sign_type }) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const signGetGUIDEntity = ({ contract_number }) =>
|
||||
export const signGetGUIDEntity = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/entity`;
|
||||
|
||||
@ -44,7 +44,7 @@ export const signGetGUIDEntity = ({ contract_number }) =>
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number }, {
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
@ -63,13 +63,13 @@ export const signGetGUIDEntity = ({ contract_number }) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const signCheckPowerAttorneyClient = ({ contract_number }) =>
|
||||
export const signCheckPowerAttorneyClient = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/attorney/check`;
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number }, {
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
@ -87,13 +87,13 @@ export const signCheckPowerAttorneyClient = ({ contract_number }) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const signGetPowerAttorneyClient = ({ contract_number }) =>
|
||||
export const signGetPowerAttorneyClient = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/attorney/get`;
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number }, {
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
@ -251,7 +251,7 @@ export const signUploadPaperDocument = (contract_number, deal_id, files) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const signCheckCancelDocument = ({ contract_number, doc_type_id }) =>
|
||||
export const signCheckCancelDocument = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/cancel/check`;
|
||||
|
||||
@ -259,7 +259,7 @@ export const signCheckCancelDocument = ({ contract_number, doc_type_id }) =>
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number, doc_type_id }, {
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
@ -278,7 +278,7 @@ export const signCheckCancelDocument = ({ contract_number, doc_type_id }) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const signCancelDocument = ({ contract_number, doc_type_id }) =>
|
||||
export const signCancelDocument = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/cancel`;
|
||||
|
||||
@ -286,7 +286,7 @@ export const signCancelDocument = ({ contract_number, doc_type_id }) =>
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number, doc_type_id }, {
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
|
||||
@ -158,6 +158,7 @@ class DealContractsSignEDO extends React.Component
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
sign_type: "EDO",
|
||||
evo_id: "144",
|
||||
code: "Leas_Contract",
|
||||
});
|
||||
console.log({ wmdoc_result });
|
||||
|
||||
|
||||
@ -139,6 +139,7 @@ export default class DealContractsSignPaper extends React.Component
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
sign_type: "Paper",
|
||||
evo_id: "60",
|
||||
code: "Leas_Contract",
|
||||
});
|
||||
console.log({ wmdoc_result });
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import FileDropzoneDeals from "../../FileDropzoneDeals";
|
||||
import { attachDealDocument, removeDealDocument, sendDealDocuments, } from "../../../actions";
|
||||
|
||||
import Step from "./Step";
|
||||
import md5 from "md5";
|
||||
|
||||
export default class DocumentsForm extends Step
|
||||
{
|
||||
@ -99,16 +100,17 @@ export default class DocumentsForm extends Step
|
||||
console.log({ document_id, document_name, files, update });
|
||||
console.log("_handle_onAddFile", { existed_files });
|
||||
|
||||
const document_files = existed_files[ document_id ] === undefined ? [] : existed_files[ document_id ].files;
|
||||
const group = md5(`${ document_id }_${ document_name }`);
|
||||
const document_files = existed_files[ group ] === undefined ? [] : existed_files[ group ].files;
|
||||
|
||||
if(existed_files[ document_id ] === undefined)
|
||||
if(existed_files[ group ] === undefined)
|
||||
{
|
||||
existed_files[ document_id ] = {
|
||||
existed_files[ group ] = {
|
||||
files: [],
|
||||
};
|
||||
}
|
||||
|
||||
let index = parseInt(existed_files[ document_id ].files.length, 10);
|
||||
let index = parseInt(existed_files[ group ].files.length, 10);
|
||||
|
||||
for(let nf in files)
|
||||
{
|
||||
@ -126,7 +128,8 @@ export default class DocumentsForm extends Step
|
||||
// console.log({ new_index });
|
||||
|
||||
// files[nf].index = new_index;
|
||||
files[nf].group = document_id;
|
||||
files[nf].document_id = document_id;
|
||||
files[nf].group = group;
|
||||
files[nf].group_name = document_name;
|
||||
files[nf].uploaded = false;
|
||||
files[nf].update = update;
|
||||
@ -134,11 +137,12 @@ export default class DocumentsForm extends Step
|
||||
document_files.push(files[nf]);
|
||||
//}
|
||||
|
||||
existed_files[ document_id ].files = document_files;
|
||||
existed_files[ group ].files = document_files;
|
||||
}
|
||||
|
||||
this.setState({ uploaded: existed_files, uploading: true }, () =>
|
||||
{
|
||||
console.log({ existed_files });
|
||||
const { opp_number } = this.props;
|
||||
|
||||
console.log("DOUBLE", { files });
|
||||
@ -147,7 +151,8 @@ export default class DocumentsForm extends Step
|
||||
{
|
||||
const payload = {
|
||||
deal_id: opp_number,
|
||||
document_id: file.group,
|
||||
document_id: file.document_id,
|
||||
group: file.group,
|
||||
document_name: file.group_name,
|
||||
filename: file.name,
|
||||
lastModified: file.lastModified,
|
||||
@ -160,7 +165,7 @@ export default class DocumentsForm extends Step
|
||||
attachDealDocument(payload)
|
||||
.then(async () =>
|
||||
{
|
||||
await this._onSendFileStats(document_id, index);
|
||||
await this._onSendFileStats(group, index);
|
||||
index++;
|
||||
callback();
|
||||
}, 1000)
|
||||
@ -172,15 +177,15 @@ export default class DocumentsForm extends Step
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onDeleteFile = (document_id, index) =>
|
||||
_handle_onDeleteFile = (group, index) =>
|
||||
{
|
||||
const uploaded = { ...this.state.uploaded };
|
||||
const { opp_number } = this.props;
|
||||
|
||||
const list = [ ...uploaded[document_id].files ];
|
||||
const list = [ ...uploaded[group].files ];
|
||||
list.splice(index, 1);
|
||||
|
||||
uploaded[document_id].files = list;
|
||||
uploaded[group].files = list;
|
||||
|
||||
/*
|
||||
for(let i in uploaded[document_id].files)
|
||||
@ -208,7 +213,7 @@ export default class DocumentsForm extends Step
|
||||
const completed = this._checkFilesCompleted();
|
||||
this.setState({ completed }, () =>
|
||||
{
|
||||
removeDealDocument({ deal_id: opp_number, document_id, index });
|
||||
removeDealDocument({ deal_id: opp_number, group, index });
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -240,8 +245,8 @@ export default class DocumentsForm extends Step
|
||||
continue;
|
||||
}
|
||||
|
||||
const group = documents[g].doc_id;
|
||||
console.log({ g: documents[g] });
|
||||
const group = md5(`${ documents[g].doc_id }_${ documents[g].name }`);
|
||||
console.log({ g: documents[g], group });
|
||||
|
||||
if(uploaded[group] === undefined || uploaded[group].files.length === 0)
|
||||
{
|
||||
@ -336,9 +341,9 @@ export default class DocumentsForm extends Step
|
||||
<></>
|
||||
) : (
|
||||
<>
|
||||
{ documents.map((document, index) =>
|
||||
{
|
||||
{ documents.map((document, index) => {
|
||||
console.log({ document });
|
||||
const group = md5(`${ document.doc_id }_${ document.name }`);
|
||||
return (
|
||||
<div className="block deal_documents_form_group" key={ index }>
|
||||
<div className="left">
|
||||
@ -349,7 +354,7 @@ export default class DocumentsForm extends Step
|
||||
<FileDropzoneDeals
|
||||
statuscode_id={ statuscode_id }
|
||||
uploading={ uploading }
|
||||
uploaded={ uploaded[ document.doc_id ] !== undefined ? uploaded[ document.doc_id ] : { files: [] } }
|
||||
uploaded={ uploaded[ group ] !== undefined ? uploaded[ group ] : { files: [] } }
|
||||
onAddFile={ (files, update) => { this._handle_onAddFile({ document_id: document.doc_id, document_name: document.name, files, update }) } }
|
||||
onDeleteFile={ this._handle_onDeleteFile }
|
||||
document={ document }
|
||||
|
||||
@ -159,6 +159,7 @@ class EDOSign extends React.Component
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
sign_type: "EDO",
|
||||
evo_id: "144",
|
||||
code: "Leas_Contract",
|
||||
});
|
||||
console.log({ wmdoc_result });
|
||||
|
||||
|
||||
@ -6016,6 +6016,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
.contractStatus_modal .single_status > div .status_body .wrap .single_text p {
|
||||
margin-right: 0;
|
||||
padding-top: 0;
|
||||
line-height: 15px;
|
||||
}
|
||||
}
|
||||
.contractStatus_modal .single_status > div .status_body .wrap .single_text p:before {
|
||||
@ -6031,7 +6032,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
}
|
||||
@media all and (max-width: 768px) {
|
||||
.contractStatus_modal .single_status > div .status_body .wrap .single_text p:before {
|
||||
margin-top: 0;
|
||||
margin-top: -13px;
|
||||
}
|
||||
}
|
||||
.contractStatus_modal .single_status > div .status_body .wrap table {
|
||||
@ -6761,6 +6762,9 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
width: 186px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
.edo_list_field label.wide {
|
||||
width: 30%;
|
||||
}
|
||||
.edo_list_selection {
|
||||
flex: 1;
|
||||
margin-top: -12px;
|
||||
|
||||
@ -6822,6 +6822,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
@media all and (max-width: 768px) {
|
||||
margin-right: 0;
|
||||
padding-top: 0;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
@ -6837,7 +6838,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='40' height='40' rx='8' fill='%232F80ED' fill-opacity='0.1'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M20 29C24.9706 29 29 24.9706 29 20C29 15.0294 24.9706 11 20 11C15.0294 11 11 15.0294 11 20C11 24.9706 15.0294 29 20 29ZM21 14.5C21 13.9477 20.5523 13.5 20 13.5C19.4477 13.5 19 13.9477 19 14.5V19.75C19 20.4404 19.5596 21 20.25 21H23.5C24.0523 21 24.5 20.5523 24.5 20C24.5 19.4477 24.0523 19 23.5 19H21V14.5Z' fill='%232F80ED'/%3E%3C/svg%3E");
|
||||
|
||||
@media all and (max-width: 768px) {
|
||||
margin-top: 0;
|
||||
margin-top: -13px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7723,6 +7724,10 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
label {
|
||||
width: 186px;
|
||||
margin-right: 12px;
|
||||
|
||||
&.wide {
|
||||
width: 30%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,9 +4,11 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/attorney/check");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const { contract_number, addcontract_number, contactid, } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
contactid,
|
||||
};
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
|
||||
@ -4,9 +4,11 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/attorney/get");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const { contract_number, addcontract_number, contactid, } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
contactid,
|
||||
};
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/cancel/check");
|
||||
|
||||
const { contract_number, doc_type_id } = req.body;
|
||||
const { contract_number, addcontract_number, doc_type_id } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
doc_type_id,
|
||||
};
|
||||
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/cancel");
|
||||
|
||||
const { contract_number, doc_type_id } = req.body;
|
||||
const { contract_number, addcontract_number, doc_type_id } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
doc_type_id,
|
||||
};
|
||||
|
||||
|
||||
@ -4,10 +4,11 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/check");
|
||||
|
||||
const { contract_number, sign_type } = req.body;
|
||||
const { contract_number, addcontract_number, sign_type } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
sign_type
|
||||
addcontract_number,
|
||||
sign_type,
|
||||
};
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/document/check");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const { contract_number, addcontract_number } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
};
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/document/connect");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const { contract_number, addcontract_number, } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
};
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
@ -4,11 +4,11 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/document/create");
|
||||
|
||||
const { entity_name, entity_id, sign_type, evo_id } = req.body;
|
||||
const { entity_name, entity_id, sign_type, evo_id, code } = req.body;
|
||||
const payload = {
|
||||
entityName: entity_name,
|
||||
entityId: entity_id,
|
||||
reportCodes: [ "Leas_Contract" ],
|
||||
reportCodes: [ code ],
|
||||
inputParameters: [ sign_type ],
|
||||
createDocument: true,
|
||||
openFile: false,
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/document/link");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const { contract_number, addcontract_number, } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
};
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/document/status");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const { contract_number, addcontract_number, } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
};
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "SIGN", "/entity");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const { contract_number, addcontract_number, } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
};
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
|
||||
@ -34,16 +34,17 @@ export default async function handler(req, res)
|
||||
upload.single("file")(req, {}, async (err) =>
|
||||
{
|
||||
const { file, } = req;
|
||||
const { deal_id, document_id, document_name, type, index, lastModified, } = req.query;
|
||||
const { deal_id, document_id, document_name, group, type, index, lastModified, } = req.query;
|
||||
|
||||
console.log({ deal_id, document_id, document_name, type, index, lastModified, });
|
||||
console.log({ deal_id, document_id, document_name, group, type, index, lastModified, });
|
||||
|
||||
const local_filename = `${ client_jwt_decoded.acc_number }_${ deal_id }_${ document_id }_${ index }`;
|
||||
const local_filename = `${ client_jwt_decoded.acc_number }_${ deal_id }_${ group }_${ index }`;
|
||||
|
||||
const file_payload = {
|
||||
name: Buffer.from(file.originalname, 'latin1').toString('utf8'),
|
||||
filename: local_filename,
|
||||
group: document_id,
|
||||
document_id: document_id,
|
||||
group,
|
||||
index,
|
||||
type,
|
||||
uploaded: true,
|
||||
@ -78,31 +79,20 @@ export default async function handler(req, res)
|
||||
|
||||
if(uploaded !== undefined)
|
||||
{
|
||||
if(uploaded[ document_id ] !== undefined)
|
||||
if(uploaded[ group ] !== undefined)
|
||||
{
|
||||
uploaded[ document_id ].files.push(file_payload);
|
||||
uploaded[ group ].files.push(file_payload);
|
||||
}
|
||||
else
|
||||
{
|
||||
uploaded[ document_id ] = {
|
||||
uploaded[ group ] = {
|
||||
id: document_id,
|
||||
name: document_name,
|
||||
files: [ file_payload ],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(files[ document_id ] !== undefined)
|
||||
{
|
||||
files[ document_id ].push(file_payload);
|
||||
}
|
||||
else
|
||||
{
|
||||
files[ document_id ] = [ file_payload ];
|
||||
}
|
||||
*/
|
||||
|
||||
//files[ document_id ] = [ file_payload ];
|
||||
deals[ deal_id ] = { uploaded };
|
||||
|
||||
await RedisClient.set(key, JSON.stringify(deals));
|
||||
|
||||
@ -31,8 +31,8 @@ export default async function handler(req, res)
|
||||
{
|
||||
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
|
||||
|
||||
const { deal_id, document_id, index } = req.query;
|
||||
const local_filename = `${ client_jwt_decoded.acc_number }_${ deal_id }_${ document_id }_${ index }`;
|
||||
const { deal_id, group, index } = req.query;
|
||||
const local_filename = `${ client_jwt_decoded.acc_number }_${ deal_id }_${ group }_${ index }`;
|
||||
|
||||
try
|
||||
{
|
||||
@ -66,13 +66,13 @@ export default async function handler(req, res)
|
||||
|
||||
if(uploaded !== undefined)
|
||||
{
|
||||
if(uploaded[ document_id ] !== undefined)
|
||||
if(uploaded[ group ] !== undefined)
|
||||
{
|
||||
if(uploaded[ document_id ].files !== undefined)
|
||||
if(uploaded[ group ].files !== undefined)
|
||||
{
|
||||
console.log({ files: uploaded[ document_id ].files });
|
||||
console.log({ files: uploaded[ group ].files });
|
||||
|
||||
uploaded[ document_id ].files.splice(index, 1);
|
||||
uploaded[ group ].files.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,24 +70,24 @@ function createZipFile(zip_filename, files)
|
||||
});
|
||||
}
|
||||
|
||||
function uploadFile({ deal_id, filename, name, group, crm_jwt })
|
||||
function uploadFile({ deal_id, local_filename, filename, name, id, crm_jwt })
|
||||
{
|
||||
return new Promise((resolve) =>
|
||||
{
|
||||
if(fs.existsSync(`${ uploads }${ filename }`))
|
||||
if(fs.existsSync(`${ uploads }${ local_filename }`))
|
||||
{
|
||||
const path = `${ uploads }${ filename }`;
|
||||
const path = `${ uploads }${ local_filename }`;
|
||||
|
||||
const file_to_send_data = fs.readFileSync(path);
|
||||
console.log("uploadFile", { filename, len: file_to_send_data.length, path });
|
||||
|
||||
const data = new FormData();
|
||||
data.append("file", file_to_send_data, name);
|
||||
data.append("file", file_to_send_data, filename);
|
||||
|
||||
const payload = new URLSearchParams({
|
||||
name: deal_id,
|
||||
entity: "opportunity",
|
||||
documentTypeNumber: group,
|
||||
documentTypeNumber: id,
|
||||
documentName: name,
|
||||
});
|
||||
|
||||
@ -170,7 +170,7 @@ export default async function handler(req, res)
|
||||
{
|
||||
const file = document.files[0];
|
||||
|
||||
uploadFile({ deal_id, filename: file.filename, name: document.name, group, crm_jwt })
|
||||
uploadFile({ deal_id, local_filename: file.filename, filename: file.name, name: document.name, id: document.id, crm_jwt })
|
||||
.then(() =>
|
||||
{
|
||||
callback();
|
||||
@ -198,7 +198,7 @@ export default async function handler(req, res)
|
||||
createZipFile(`${ uploads }${ zip_filename }`, files_to_zip)
|
||||
.then(() =>
|
||||
{
|
||||
uploadFile({ deal_id, filename: zip_filename, name: zip_filename, group, crm_jwt })
|
||||
uploadFile({ deal_id, local_filename: zip_filename, filename: zip_filename, name: document.name, id: document.id, crm_jwt })
|
||||
.then(() =>
|
||||
{
|
||||
callback();
|
||||
|
||||
@ -7,9 +7,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "EDO", "/cancel");
|
||||
|
||||
const { contract_number, doc_type_id, } = req.body;
|
||||
const { contract_number, addcontract_number, doc_type_id, } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
doc_type_id,
|
||||
};
|
||||
|
||||
|
||||
@ -4,9 +4,10 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("\n\n", "API", "EDO", "/project");
|
||||
|
||||
const { contract_number, power_attorney, power_attorney_number, edo_box, } = req.body;
|
||||
const { contract_number, addcontract_number, power_attorney, power_attorney_number, edo_box, } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
addcontract_number,
|
||||
power_attorney,
|
||||
power_attorney_number,
|
||||
edo_box,
|
||||
|
||||
@ -126,9 +126,9 @@ class ContractPage extends React.Component
|
||||
</span>
|
||||
{ file.type !== undefined && (<span>{ file.type }</span>) }
|
||||
</p>
|
||||
{/**/}
|
||||
{/*
|
||||
<a className="button button-blue" onClick={ () => this._handle_onEDOClick({ ...file, ...{ name: types[ type ] } }) }>Подписать по ЭДО</a>
|
||||
{/**/}
|
||||
*/}
|
||||
<DownloadPdfButton
|
||||
id={ file.url }
|
||||
filename={`evoleasing_${ types[ type ] }_${ file.type }_${ file.number }_${ file.date }.${ file.extension }`}
|
||||
|
||||
@ -0,0 +1,426 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import moment from "moment";
|
||||
import { SpinnerCircular } from "spinners-react";
|
||||
import { concatSeries } from "async";
|
||||
import { eachSeries } from 'async';
|
||||
import Select from 'react-select';
|
||||
|
||||
import { createEDOProject, signCheckCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect, getFile, signGetFileContractProject, signCheckCancelDocument, signContractGraphicChange, signCancelDocument } from "../../../../../../../actions";
|
||||
//import { getDeals, getDealOffers, getDealDocuments, getDealContracts } from "../../actions";
|
||||
|
||||
class SignEDO extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props)
|
||||
this.state = {
|
||||
finished: false,
|
||||
operators: null,
|
||||
edo_message: null,
|
||||
loading: false,
|
||||
disabled: false,
|
||||
documents: [],
|
||||
operator_selected: {},
|
||||
statuses: {},
|
||||
error: false,
|
||||
message: undefined,
|
||||
ready: false,
|
||||
attorney: false,
|
||||
attorneys: [],
|
||||
attorney_selected: undefined,
|
||||
step: 0,
|
||||
graphic_change_comment: undefined,
|
||||
edoid: undefined,
|
||||
}
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(nextProps, prevState)
|
||||
{
|
||||
console.log("SignEDO", "getDerivedStateFromProps", { nextProps });
|
||||
return {
|
||||
operators: nextProps.operators,
|
||||
edo_message: nextProps.edo_message,
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount()
|
||||
{
|
||||
console.log("SignEDO", { props: this.props });
|
||||
/*
|
||||
const check_result = await signCheckCreatePrintForm({ addcontract_number: calculation_id, sign_type: "EDO" });
|
||||
if(check_result.status === "success")
|
||||
{
|
||||
const get_guid_entity_result = await signGetGUIDEntity({ addcontract_number: calculation_id });
|
||||
|
||||
}
|
||||
*/
|
||||
/*
|
||||
const docs = [];
|
||||
for(let i in this.props.documents)
|
||||
{
|
||||
docs.push({ ...this.props.documents[i], ...{ index: i, loading: true, ready: false, attorney: false } });
|
||||
}
|
||||
this.setState({ documents: docs });
|
||||
*/
|
||||
|
||||
if(this.state.operator_selected.box_id === undefined)
|
||||
{
|
||||
this.setState({ operator_selected: this.state.operators !== null && this.state.operators[0] !== undefined ? this.state.operators[0] : {} });
|
||||
}
|
||||
|
||||
/*
|
||||
setTimeout(() =>
|
||||
{
|
||||
this.setState({ loading: false })
|
||||
}, 5000);
|
||||
*/
|
||||
}
|
||||
|
||||
_update = (update) =>
|
||||
{
|
||||
return new Promise((resolve) =>
|
||||
{
|
||||
this.setState(update, () =>
|
||||
{
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_sign = async () =>
|
||||
{
|
||||
const { calculation_id, contract_number, signer, onFinished } = this.props;
|
||||
const { operator_selected, error, step, completed, signing, ready, attorney, attorney_selected, } = this.state;
|
||||
|
||||
console.log("_handle_onFormSubmit");
|
||||
console.log({ operator_selected });
|
||||
|
||||
await this._update({ loading: true, disabled: true, });
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(attorney && attorney_selected !== undefined)
|
||||
{
|
||||
this._finalizeSign({
|
||||
power_attorney: attorney_selected.value,
|
||||
power_attorney_number: attorney_selected.label,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
const create_print_form_result = await signCheckCreatePrintForm({ addcontract_number: calculation_id, sign_type: "EDO" });
|
||||
console.log({ create_print_form_result });
|
||||
|
||||
if(create_print_form_result.status === "success")
|
||||
{
|
||||
const get_guid_entity_result = await signGetGUIDEntity({
|
||||
addcontract_number: calculation_id,
|
||||
});
|
||||
|
||||
console.log("\n\nENTITY !!!!!!!!!!\n\n");
|
||||
console.log({ get_guid_entity_result });
|
||||
|
||||
const graphic_change_comment = await signContractGraphicChange({
|
||||
contract_number: contract_number,
|
||||
addcontract_number: calculation_id,
|
||||
signatoryid: signer.signatoryid,
|
||||
type: 1,
|
||||
});
|
||||
|
||||
await signCancelDocument({ addcontract_number: calculation_id, doc_type_id: "64" });
|
||||
|
||||
await this._update({ graphic_change_comment, entity_id: get_guid_entity_result.entityid });
|
||||
|
||||
const check_attorney_client_result = await signCheckPowerAttorneyClient({ addcontract_number: calculation_id, contactid: signer.signatoryid, })
|
||||
console.log({ check_attorney_client_result });
|
||||
|
||||
await this._update({ attorney: check_attorney_client_result.power_attorney_required, });
|
||||
|
||||
if(check_attorney_client_result.power_attorney_required)
|
||||
{
|
||||
const get_attorney_client_result = await signGetPowerAttorneyClient({ addcontract_number: calculation_id, contactid: signer.signatoryid, });
|
||||
console.log({ get_attorney_client_result });
|
||||
|
||||
if(get_attorney_client_result === null)
|
||||
{
|
||||
await this._update({ loading: false, disabled: false, error: true, ready: false, message: "Возникла ошибка при создании документа для подписания." });
|
||||
}
|
||||
else
|
||||
{
|
||||
if(get_attorney_client_result.length === null)
|
||||
{
|
||||
await this._update({ loading: false, disabled: false, error: true, ready: false, message: "Не обнаружена доверенность на подписанта. Для продолжения подписания обратитесь к своему персональному менеджеру" });
|
||||
}
|
||||
else
|
||||
{
|
||||
const attorneys = [];
|
||||
for(let i in get_attorney_client_result)
|
||||
{
|
||||
attorneys.push({
|
||||
value: get_attorney_client_result[i].power_attorney,
|
||||
label: get_attorney_client_result[i].power_attorney_number,
|
||||
});
|
||||
}
|
||||
|
||||
await this._update({ loading: false, disabled: true, error: false, attorneys, attorney_selected: undefined });
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._finalizeSign({});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({
|
||||
loading: false,
|
||||
error: true,
|
||||
disabled: false,
|
||||
message: create_print_form_result.message !== undefined && create_print_form_result.message !== null ? create_print_form_result.message : "Возникла ошибка при создании документа для подписания.",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_finalizeSign = async (attorney) =>
|
||||
{
|
||||
await this._update({ ready: true, });
|
||||
|
||||
const { calculation_id, onFinished } = this.props;
|
||||
const { operator_selected, } = this.state;
|
||||
|
||||
const create_edo_project_result = await createEDOProject({ ...{
|
||||
addcontract_number: calculation_id,
|
||||
edo_box: operator_selected.edo_box,
|
||||
}, ...attorney });
|
||||
|
||||
if(create_edo_project_result.edoid !== undefined)
|
||||
{
|
||||
await this._update({ edoid: create_edo_project_result.edoid, });
|
||||
|
||||
const get_guid_entity_result = await signGetGUIDEntity({
|
||||
addcontract_number: calculation_id,
|
||||
});
|
||||
|
||||
const wmdoc_result = await signGetWMDoc({
|
||||
entity_name: "evo_addcontract",
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
sign_type: "EDO",
|
||||
evo_id: "156",
|
||||
code: "AddcontractSale",
|
||||
});
|
||||
|
||||
const connect_result = await docEDOConnect({ addcontract_number: calculation_id });
|
||||
const sign_result = await docEDOSign({ edoid: this.state.edoid, });
|
||||
|
||||
onFinished(this.state.graphic_change_comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({
|
||||
loading: false,
|
||||
error: true,
|
||||
disabled: false,
|
||||
message: create_edo_project_result.message !== undefined && create_edo_project_result.message !== null ? create_edo_project_result.message : "Возникла ошибка при создании документа для подписания.",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_handle_onFormSubmit = (event) =>
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
const { onFinish, onCancel, onGoToEDOInvites } = this.props;
|
||||
const { operators, operator_selected, step, finished, error } = this.state;
|
||||
|
||||
console.log("_handle_onFormSubmit");
|
||||
console.log({ operator_selected });
|
||||
|
||||
if(operators !== null && operators.length === 0)
|
||||
{
|
||||
onGoToEDOInvites();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(error)
|
||||
{
|
||||
onCancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(finished)
|
||||
{
|
||||
onFinish();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(step)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
this.setState({ step: 1 }, () =>
|
||||
{
|
||||
this._sign();
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
this._sign();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_handle_onSelectOperator = (operator) =>
|
||||
{
|
||||
this.setState({ operator_selected: operator });
|
||||
}
|
||||
|
||||
_handle_onAttorneyChange = (attorney) =>
|
||||
{
|
||||
console.log("_handle_onAttorneyChange", { attorney });
|
||||
this.setState({ attorney_selected: attorney, disabled: false, });
|
||||
}
|
||||
|
||||
_handle_onCancel = () =>
|
||||
{
|
||||
const { onCancel } = this.props;
|
||||
onCancel();
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { step, operators, edo_message, loading, disabled, operator_selected } = this.state;
|
||||
const { error, message, ready, attorney, attorneys, attorney_selected, } = this.state;
|
||||
|
||||
const { onCancel, calculation_id, } = this.props;
|
||||
console.log({ operators, props: this.props });
|
||||
|
||||
return (
|
||||
<div className="edo_detail">
|
||||
<div className="docs_list medium-icon">
|
||||
<p className="list_title">Подписание через ЭДО</p>
|
||||
</div>
|
||||
<>
|
||||
{ step === 0 && (
|
||||
<div className="form_field edo_list_field">
|
||||
<label className="wide">Выберите оператора ЭДО для отправки дополнительного соглашения [{ this.props.contract_number }]</label>
|
||||
<div className="edo_list_selection edo_sign_documents_document" style={{ flexDirection: "column", border: "none", padding: "0px 0px 0px 15px", }}>
|
||||
{ operators !== undefined && operators !== null && (
|
||||
<>
|
||||
{ operators.length === 0 ? (
|
||||
<div className="edo_sign_documents_document_right" style={{ border: "none", }}>
|
||||
<div className="status_icon await"></div>
|
||||
<div className="status_title">
|
||||
<i>{ edo_message }</i>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
operators.map((operator, index) => (
|
||||
<div className="form_field checkbox item" key={ index }>
|
||||
<input type="radio"
|
||||
checked={ operator.box_id === operator_selected.box_id }
|
||||
hidden=""
|
||||
id={ `operator_${ index }` }
|
||||
name={ `operator_${ index }` }
|
||||
onChange={ (event) => this._handle_onSelectOperator(operator) }
|
||||
disabled={ false }
|
||||
/>
|
||||
<label htmlFor={ `operator_${ index }` } className="unselectable">{ operator.provider_edo }</label>
|
||||
</div>
|
||||
) )
|
||||
)}
|
||||
</>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
{ step === 1 && (
|
||||
<div className="docs_list medium-icon edo_sign_documents_list">
|
||||
<div className="edo_sign_documents_document">
|
||||
<div className="edo_sign_documents_document_left">
|
||||
<p className="doc_name i-pdf extension edo_sign_document" data-format={ "pdf" }>
|
||||
Дополнительное соглашение №{ calculation_id } от { moment().format("DD.MM.YYYY") }
|
||||
</p>
|
||||
</div>
|
||||
<div className="edo_sign_documents_document_right">
|
||||
{ loading ? (
|
||||
<>
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
{ !error && (
|
||||
<i>{ ready ? "Подписание дополнительного соглашения" : "Подготовка подписания" }</i>
|
||||
) }
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{ error ? (
|
||||
<>
|
||||
<div className="status_icon error"></div>
|
||||
<i>{ message !== undefined && message !== null ? message : "" }</i>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{ attorney && (
|
||||
<>
|
||||
<div className="status_icon await"></div>
|
||||
<div className="edo_sign_status_attorney_select">
|
||||
<Select
|
||||
id="edo_attorneys_list"
|
||||
name="edo_attorneys_list"
|
||||
options={ attorneys }
|
||||
placeholder="Выберите доверенность"
|
||||
noOptionsMessage={ ({ inputValue }) => !inputValue ? "" :"Ничего не найдено" }
|
||||
isSearchable={ true }
|
||||
className="autocomlete autocomlete_with_indicators"
|
||||
classNamePrefix="react-select"
|
||||
value={ attorney_selected }
|
||||
onChange={ (element) => { this._handle_onAttorneyChange(element) } }
|
||||
required={ true }
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
<form ref={ this.ref_form } onSubmit={ this._handle_onFormSubmit } onKeyDown={(e) => {if (e.key === 'Enter') e.preventDefault() }}>
|
||||
<div className="form_field" style={{ display: "flex", justifyContent: step === 0 ? "space-between" : "flex-end" }}>
|
||||
{ step === 0 && (
|
||||
<button className="button button-blue" onClick={ this._handle_onCancel }>Отменить</button>
|
||||
) }
|
||||
<button type="submit" className="button button-blue" disabled={ disabled }>
|
||||
{ loading ? (
|
||||
<SpinnerCircular size={24} thickness={100} speed={100} color="rgba(255, 255, 255, 1)" secondaryColor="rgba(255, 255, 255, 0.5)" style={{ marginTop: "4px" }}/>
|
||||
) : "Продолжить" }
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state, ownProps)
|
||||
{
|
||||
console.log("SignEDO", "mapStateToProps", { state: state });
|
||||
return {
|
||||
operators: state.edo.operators,
|
||||
edo_message: state.edo.message,
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(SignEDO)
|
||||
@ -6,6 +6,7 @@ import 'moment/locale/ru';
|
||||
import numeral from "numeral";
|
||||
import { SpinnerCircular } from "spinners-react";
|
||||
import Link from "next/link";
|
||||
import SignEDO from "./components/SignEDO";
|
||||
|
||||
export default class Comparison extends React.Component
|
||||
{
|
||||
@ -21,6 +22,8 @@ export default class Comparison extends React.Component
|
||||
mixed_index: 0,
|
||||
signatories_show_all: false,
|
||||
opened: [],
|
||||
signer_selected: {},
|
||||
sign_edo: false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -32,7 +35,7 @@ export default class Comparison extends React.Component
|
||||
{
|
||||
if(signatories !== undefined && signatories !== null)
|
||||
{
|
||||
this._handle_onSigner(signatories[0].signatoryid);
|
||||
this._handle_onSigner(signatories[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,14 +69,18 @@ export default class Comparison extends React.Component
|
||||
{
|
||||
if(this.props.signer === undefined && this.props.signatories !== undefined && this.props.signatories !== null)
|
||||
{
|
||||
this._handle_onSigner(this.props.signatories[0].signatoryid);
|
||||
this._handle_onSigner(this.props.signatories[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_handle_onSigner = (signer_id) =>
|
||||
_handle_onSigner = (person) =>
|
||||
{
|
||||
const signer_id = person.signatoryid;
|
||||
this.setState({ signer_selected: person }, () =>
|
||||
{
|
||||
this.props.onSigner(signer_id);
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onOptions = () =>
|
||||
@ -95,7 +102,8 @@ export default class Comparison extends React.Component
|
||||
|
||||
_handle_onSignEDO = () =>
|
||||
{
|
||||
this.props.onSign(1);
|
||||
this.setState({ sign_edo: true, });
|
||||
//this.props.onSign(1);
|
||||
}
|
||||
|
||||
_handle_onMixedPayment = (index) =>
|
||||
@ -230,8 +238,13 @@ export default class Comparison extends React.Component
|
||||
|
||||
render()
|
||||
{
|
||||
const { calculation, mixed_index, today, show_previous, signatories_show_all } = this.state;
|
||||
const { number, signer, signatories, current, calculated, loading_pdf } = this.props;
|
||||
const { calculation, mixed_index, today, show_previous, signatories_show_all, signer_selected, sign_edo, } = this.state;
|
||||
const { number, signer, signatories, current, calculated, loading_pdf, calculation_id, } = this.props;
|
||||
|
||||
console.log("render", {
|
||||
calculation,
|
||||
calculation_id,
|
||||
})
|
||||
|
||||
return (
|
||||
<article className="compare">
|
||||
@ -389,6 +402,16 @@ export default class Comparison extends React.Component
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{ sign_edo ? (
|
||||
<SignEDO
|
||||
signer={ signer_selected }
|
||||
contract_number={ number }
|
||||
calculation_id={ calculation_id }
|
||||
onCancel={ () => this.setState({ sign_edo: false }) }
|
||||
onFinished={ this.props.onSignEDOFinished }
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<div className="compare_suscr">
|
||||
<p className="block_title">
|
||||
Подписанты
|
||||
@ -399,7 +422,7 @@ export default class Comparison extends React.Component
|
||||
<div className="feed static">
|
||||
{ signatories !== undefined && signatories !== null && signatories.slice(0, signatories_show_all ? signatories.length : 3).map((person, index) => (
|
||||
<div className="feed_item user" key={ person.signatoryid }>
|
||||
<input type="radio" hidden id={ `user_${ person.signatoryid }` } name={ `user_${ person.signatoryid }` } checked={ person.signatoryid === signer } onChange={ () => this._handle_onSigner(person.signatoryid) }/>
|
||||
<input type="radio" hidden id={ `user_${ person.signatoryid }` } name={ `user_${ person.signatoryid }` } checked={ person.signatoryid === signer } onChange={ () => this._handle_onSigner(person) }/>
|
||||
<label htmlFor={ `user_${ person.signatoryid }` }></label>
|
||||
<img src="/assets/images/icons/avatar.svg" alt="" />
|
||||
<div>
|
||||
@ -414,12 +437,12 @@ export default class Comparison extends React.Component
|
||||
<button className="button button-blue" onClick={ this._handle_onSignPaper }>
|
||||
Согласовать и подписать в бумажном виде
|
||||
</button>
|
||||
{/*}
|
||||
<button className="button button-blue" onClick={ this._handle_onSignEDO }>
|
||||
Согласовать и подписать по ЭДО
|
||||
</button>
|
||||
{*/}
|
||||
</div>
|
||||
</>
|
||||
) }
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import {
|
||||
getContractGraphicChangeCalculationsList,
|
||||
signContractGraphicChange,
|
||||
getContractCalculationPDFFile,
|
||||
signCheckCreatePrintForm,
|
||||
} from "../../../actions";
|
||||
import Options from "./components/Options";
|
||||
import Comparison from "./components/Comparison";
|
||||
@ -221,7 +222,7 @@ class ChangeGraphicPage extends React.Component
|
||||
signatoryid: signer,
|
||||
type
|
||||
})
|
||||
.then((comment) =>
|
||||
.then(async (comment) =>
|
||||
{
|
||||
this.setState({ loading: false, mode_final: true, mode_options: false, mode_comparison: false, comment });
|
||||
})
|
||||
@ -235,6 +236,11 @@ class ChangeGraphicPage extends React.Component
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onSignEDOFinished = (comment) =>
|
||||
{
|
||||
this.setState({ loading: false, mode_final: true, mode_options: false, mode_comparison: false, comment });
|
||||
}
|
||||
|
||||
_handle_onDownloadPDF = () =>
|
||||
{
|
||||
const { calculation_id, } = this.state;
|
||||
@ -299,7 +305,6 @@ class ChangeGraphicPage extends React.Component
|
||||
|
||||
//console.log("contracts_info", contracts_info);
|
||||
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Head>
|
||||
@ -334,6 +339,7 @@ class ChangeGraphicPage extends React.Component
|
||||
) : (
|
||||
<div className="aside_container about">
|
||||
<Comparison
|
||||
number={ number }
|
||||
loading_pdf={ loading_pdf }
|
||||
signer={ signer }
|
||||
signatories={ signatories }
|
||||
@ -347,6 +353,7 @@ class ChangeGraphicPage extends React.Component
|
||||
onSigner={ this._handle_onSigner }
|
||||
onSign={ this._handle_onSign }
|
||||
onDownloadPDF={ this._handle_onDownloadPDF }
|
||||
onSignEDOFinished={ this._handle_onSignEDOFinished }
|
||||
/>
|
||||
</div>
|
||||
) }
|
||||
|
||||
@ -1,474 +0,0 @@
|
||||
import React from "react";
|
||||
import Head from "next/head";
|
||||
import Image from "next/image";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "next/router";
|
||||
import moment from "moment";
|
||||
import { SpinnerCircular } from "spinners-react";
|
||||
import Link from "next/link";
|
||||
import { reduxWrapper } from "../../store";
|
||||
|
||||
import Header from "../components/Header";
|
||||
import Footer from "../components/Footer";
|
||||
import Company from "../components/Company";
|
||||
|
||||
import {
|
||||
getContractInfo,
|
||||
getContractAgreement,
|
||||
getContractRules,
|
||||
getFile,
|
||||
} from "../../actions";
|
||||
|
||||
class ChangeGraphicComparePage extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props);
|
||||
this.state = {
|
||||
date: null,
|
||||
car: null,
|
||||
contract_date: null,
|
||||
agreement: null,
|
||||
rules: null,
|
||||
loading: false,
|
||||
};
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(nextProps, prevState)
|
||||
{
|
||||
return {
|
||||
date: nextProps.date,
|
||||
car: nextProps.car,
|
||||
contract_date: nextProps.contract_date,
|
||||
agreement: nextProps.agreement,
|
||||
rules: nextProps.rules,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount()
|
||||
{
|
||||
if (!this.state.loading && this.props.number !== undefined)
|
||||
{
|
||||
this.setState({ loading: true }, () =>
|
||||
{
|
||||
getContractInfo({
|
||||
dispatch: this.props.dispatch,
|
||||
number: this.props.number,
|
||||
})
|
||||
.then((info) =>
|
||||
{
|
||||
//console.log("info", info);
|
||||
|
||||
|
||||
getContractRules({
|
||||
dispatch: this.props.dispatch,
|
||||
date: moment(info.date, "YYYY-MM-DD").format("DD.MM.YYYY"),
|
||||
})
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
getContractAgreement({
|
||||
dispatch: this.props.dispatch,
|
||||
number: this.props.number,
|
||||
})
|
||||
.then(() =>
|
||||
{
|
||||
this.setState({ loading: false });
|
||||
})
|
||||
.catch(() => {});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { number } = this.props;
|
||||
const { loading, date, car, contract_date, agreement, rules } = this.state;
|
||||
|
||||
//console.log("rules", rules);
|
||||
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Head>
|
||||
<title>ЛК Эволюция автолизинга</title>
|
||||
<meta name="description" content="ЛК Эволюция автолизинга" />
|
||||
</Head>
|
||||
<Header {...this.props} />
|
||||
<main>
|
||||
<section>
|
||||
<div className="clear"></div>
|
||||
<div className="container">
|
||||
<div className="title_wrapper">
|
||||
<div className="left" style={{ flexDirection: "column" }}>
|
||||
<h1 className="section_title">Договор №{ number }</h1>
|
||||
<h5 style={{ fontSize: "14px" }}>
|
||||
{ date !== undefined && date !== null && date !== null && ( <> от {moment(date).format("DD.MM.YYYY")}</> ) }
|
||||
{ car !== undefined && car !== null ? ` - ${car.brand.name} ${car.model.name} | ${ car.reg_number !== null ? car.reg_number : "без рег. номера" } | ${ car.vin_number !== null ? car.vin_number : "без VIN номера" }` : "" }
|
||||
</h5>
|
||||
</div>
|
||||
<Company { ...this.props }/>
|
||||
</div>
|
||||
<div className="aside_container about">
|
||||
<article className="compare">
|
||||
<div className="compare_top">
|
||||
<p>
|
||||
Выбранный(ые) варианты изменения графика
|
||||
<Link href="#">
|
||||
<a>Вернуться к параметрам изменения графика</a>
|
||||
</Link>
|
||||
</p>
|
||||
<button className="button button-blue">Скачать PDF</button>
|
||||
</div>
|
||||
<div className="compare_data">
|
||||
<div className="form_field">
|
||||
<input type="checkbox" hidden id="" name="" checked disabled />
|
||||
<label htmlFor="">Изменить дату платежа</label>
|
||||
</div>
|
||||
<div className="form_field">
|
||||
<input type="checkbox" hidden id="" name="" checked disabled />
|
||||
<label htmlFor="">Изменение кол-ва платежей</label>
|
||||
</div>
|
||||
<div className="form_field">
|
||||
<p>
|
||||
<span>Дата платежа:</span> 1 месяц (37 платежей)
|
||||
</p>
|
||||
</div>
|
||||
<div className="form_field">
|
||||
<p>
|
||||
<span>Тип каникул:</span> С увеличением срока
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="compare_tables">
|
||||
<div className="compare_table">
|
||||
<p className="table_title">Текущий график</p>
|
||||
<div className="table_body">
|
||||
<div className="table_row table_header">
|
||||
<div>№</div>
|
||||
<div className="sortable">
|
||||
Дата лизингового платежа
|
||||
</div>
|
||||
<div className="sortable">Лизинговый платеж с НДС ₽</div>
|
||||
<div className="sortable">Сумма досрочного выкупа</div>
|
||||
</div>
|
||||
<div className="table_row row-button">
|
||||
<button className="button button-gray">
|
||||
Показать прошедшие платежи
|
||||
</button>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>14</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>15</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>16</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>17</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>18</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>19</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>20</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="compare_table">
|
||||
<p className="table_title">
|
||||
Изменения с платежа №ХХ от ХХ.ХХ.ХХХХ
|
||||
</p>
|
||||
<div className="table_body">
|
||||
<div className="table_row table_header">
|
||||
<div>№</div>
|
||||
<div className="sortable">
|
||||
Дата лизингового платежа
|
||||
</div>
|
||||
<div className="sortable">
|
||||
Лизинговый платеж с НДС ₽
|
||||
</div>
|
||||
<div className="sortable">
|
||||
Сумма досрочного выкупа
|
||||
</div>
|
||||
</div>
|
||||
<div className="table_row row-button">
|
||||
<button className="button button-gray">
|
||||
Показать прошедшие платежи
|
||||
</button>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>14</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>15</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>16</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>17</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>18</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>19</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<div>20</div>
|
||||
<div>21.02.2021</div>
|
||||
<div>239 724,05</div>
|
||||
<div>43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="compare_table touchable">
|
||||
<div className="table_body">
|
||||
<button className="button button-gray">
|
||||
Показать прошедшие платежи
|
||||
</button>
|
||||
<div className="table_row opened">
|
||||
<p className="row_title">Платеж №14</p>
|
||||
<div className="table_group">
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<p className="row_title">Платеж №15</p>
|
||||
<div className="table_group">
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<p className="row_title">Платеж №15</p>
|
||||
<div className="table_group">
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<p className="row_title">Платеж №15</p>
|
||||
<div className="table_group">
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<p className="row_title">Платеж №15</p>
|
||||
<div className="table_group">
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="table_row">
|
||||
<p className="row_title">Платеж №15</p>
|
||||
<div className="table_group">
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
<div className="table_cell">
|
||||
<div><span>Текущий график</span> 21.02.2021</div>
|
||||
<div><span>На сумму</span> 239 724,05</div>
|
||||
<div><span>Сумма досрочного выкупа</span> 43 079,18</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="compare_suscr">
|
||||
<p className="block_title">
|
||||
Подписанты
|
||||
<Link href="#">
|
||||
<a>Все</a>
|
||||
</Link>
|
||||
</p>
|
||||
<div className="feed static">
|
||||
<div className="feed_item user">
|
||||
<input type="radio" hidden id="user_1" name="user_1" />
|
||||
<label htmlFor="user_1"></label>
|
||||
<img src="/assets/images/icons/avatar.svg" alt="" />
|
||||
<div>
|
||||
<p className="item_title">Иванов Иван</p>
|
||||
<p className="item_desc">Менеджер по продажам</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="feed_item user">
|
||||
<input type="radio" hidden id="user_1" name="user_1" />
|
||||
<label htmlFor="user_1"></label>
|
||||
<img src="/assets/images/icons/avatar.svg" alt="" />
|
||||
<div>
|
||||
<p className="item_title">Иванов Иван</p>
|
||||
<p className="item_desc">Менеджер по продажам</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="feed_item user">
|
||||
<input type="radio" hidden id="user_1" name="user_1" />
|
||||
<label htmlFor="user_1"></label>
|
||||
<img src="/assets/images/icons/avatar.svg" alt="" />
|
||||
<div>
|
||||
<p className="item_title">Иванов Иван</p>
|
||||
<p className="item_desc">Менеджер по продажам</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="feed_item user">
|
||||
<input type="radio" hidden id="user_2" name="user_2" />
|
||||
<label htmlFor="user_2"></label>
|
||||
<img src="/assets/images/icons/avatar.svg" alt="" />
|
||||
<div>
|
||||
<p className="item_title">Иванов Иван</p>
|
||||
<p className="item_desc">Менеджер по продажам</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="feed_item user">
|
||||
<input type="radio" hidden id="user_3" name="user_3" />
|
||||
<label htmlFor="user_3"></label>
|
||||
<img src="/assets/images/icons/avatar.svg" alt="" />
|
||||
<div>
|
||||
<p className="item_title">Иванов Иван</p>
|
||||
<p className="item_desc">Менеджер по продажам</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="btn_group">
|
||||
<button className="button button-blue">
|
||||
Согласовать и подписать в бумажном виде
|
||||
</button>
|
||||
<button className="button button-blue">
|
||||
Согласовать и подписать по ЭДО
|
||||
</button>
|
||||
</div>
|
||||
<div className="compare_message">
|
||||
<p>
|
||||
Дополнительное соглашение отправлено на согласование. После согласования документ появится на странице <br />
|
||||
<Link href="#">«Документы по договору» </Link>
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<Footer authenticated={ true }/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state, ownProps)
|
||||
{
|
||||
return {
|
||||
contract_date: state.contract.date,
|
||||
date: state.contract.date,
|
||||
car: state.contract.car,
|
||||
agreement: state.contract.agreement,
|
||||
rules: state.contract.rules,
|
||||
};
|
||||
}
|
||||
|
||||
export const getServerSideProps = reduxWrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ req, res, query }) =>
|
||||
{
|
||||
return {
|
||||
props: {
|
||||
//number: query.number,
|
||||
number: null,
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
export default withRouter(connect(mapStateToProps)(ChangeGraphicComparePage));
|
||||
Loading…
x
Reference in New Issue
Block a user