Merge branch 'master' of https://github.com/merelendor/evoleasing-account
This commit is contained in:
commit
945177be95
@ -329,13 +329,14 @@ export const attachDealDocument = ({ deal_id, document_id, index, lastModified,
|
||||
});
|
||||
}
|
||||
|
||||
export const removeDealDocument = ({ deal_id, document_id, }) =>
|
||||
export const removeDealDocument = ({ deal_id, document_id, index, }) =>
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
const payload = new URLSearchParams({
|
||||
deal_id,
|
||||
document_id,
|
||||
index,
|
||||
});
|
||||
|
||||
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/deals/file/remove?${ payload.toString() }`, {},
|
||||
|
||||
485
components/DealsStatus/DealContractsSignPaper.js
Normal file
485
components/DealsStatus/DealContractsSignPaper.js
Normal file
@ -0,0 +1,485 @@
|
||||
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, docEDOCancel, signCheckEDOCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect } from "../../actions";
|
||||
|
||||
export default class DealContractsSignPaper extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props)
|
||||
this.state = {
|
||||
finished: false,
|
||||
loading: false,
|
||||
disabled: false,
|
||||
documents: [],
|
||||
operator_selected: {},
|
||||
statuses: {},
|
||||
step: 0,
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount()
|
||||
{
|
||||
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, loading: true });
|
||||
}
|
||||
|
||||
_updateDocs = (id, update) =>
|
||||
{
|
||||
return new Promise((resolve) =>
|
||||
{
|
||||
const docs = [ ...this.state.documents ];
|
||||
docs[ id ] = { ...docs[id], ...update };
|
||||
|
||||
this.setState({ documents: docs }, () =>
|
||||
{
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_checkDocumentsCompleted = () =>
|
||||
{
|
||||
const { documents } = this.state;
|
||||
let completed = true;
|
||||
|
||||
for(let i in documents)
|
||||
{
|
||||
console.log({ fin: documents[i] });
|
||||
if(!documents[i].completed)
|
||||
completed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return completed;
|
||||
}
|
||||
|
||||
_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 });
|
||||
|
||||
this.setState({ loading: true }, () =>
|
||||
{
|
||||
eachSeries(documents, async (document, callback) =>
|
||||
{
|
||||
if(document.completed)
|
||||
{
|
||||
callback();
|
||||
}
|
||||
else if(document.signing)
|
||||
{
|
||||
await this._updateDocs(document.index, { loading: true, });
|
||||
|
||||
const status_result = await docEDOStatus({ contract_number: document.id });
|
||||
if(status_result.status === 3)
|
||||
{
|
||||
await this._updateDocs(document.index, { loading: false, signing: false, ready: false, completed: true, });
|
||||
}
|
||||
else
|
||||
{
|
||||
await this._updateDocs(document.index, { loading: false, signing: true, ready: false, });
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
else if(document.ready)
|
||||
{
|
||||
console.log({ document })
|
||||
await this._updateDocs(document.index, { loading: true, });
|
||||
|
||||
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 });
|
||||
}
|
||||
|
||||
await this._updateDocs(document.index, { loading: false, signing: true, ready: false, error: false, });
|
||||
callback();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log({ document })
|
||||
await this._updateDocs(document.index, { loading: true });
|
||||
|
||||
if(document.attorney && document.attorney_selected !== undefined)
|
||||
{
|
||||
const create_edo_project_result = await createEDOProject({
|
||||
contract_number: document.id,
|
||||
power_attorney: document.attorney_selected.value,
|
||||
power_attorney_number: document.attorney_selected.label,
|
||||
edo_box: operator_selected.edo_box,
|
||||
});
|
||||
|
||||
console.log("\n\nIMPORTANT !!!!!!!!!!\n\n");
|
||||
console.log({ create_edo_project_result });
|
||||
|
||||
const get_guid_entity_result = await signGetGUIDEntity({
|
||||
contract_number: document.id,
|
||||
});
|
||||
|
||||
console.log("\n\nENTITY !!!!!!!!!!\n\n");
|
||||
console.log({ get_guid_entity_result });
|
||||
|
||||
await this._updateDocs(document.index, {
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
ready: true,
|
||||
loading: false,
|
||||
attorney: false,
|
||||
});
|
||||
|
||||
callback();
|
||||
}
|
||||
else
|
||||
{
|
||||
const create_print_form_result = await signCheckEDOCreatePrintForm({ contract_number: document.id, sign_type: "EDO" });
|
||||
console.log({ create_print_form_result });
|
||||
|
||||
const docs = { status: create_print_form_result.status };
|
||||
|
||||
if(create_print_form_result.status !== "success")
|
||||
{
|
||||
docs.loading = false;
|
||||
docs.error = true;
|
||||
docs.ready = true;
|
||||
docs.message = create_print_form_result.message;
|
||||
}
|
||||
|
||||
await this._updateDocs(document.index, docs);
|
||||
|
||||
if(create_print_form_result.status === "success")
|
||||
{
|
||||
const check_attorney_client_result = await signCheckPowerAttorneyClient({ contract_number: document.id })
|
||||
console.log({ check_attorney_client_result });
|
||||
|
||||
await this._updateDocs(document.index, { attorney: check_attorney_client_result.power_attorney_required, });
|
||||
|
||||
if(check_attorney_client_result.power_attorney_required)
|
||||
{
|
||||
const get_attorney_client_result = await signGetPowerAttorneyClient({ contract_number: document.id });
|
||||
console.log({ get_attorney_client_result });
|
||||
|
||||
if(get_attorney_client_result === null)
|
||||
{
|
||||
await this._updateDocs(document.index, { loading: false, error: true, ready: true, message: "Возникла ошибка при создании документа для подписания." });
|
||||
callback();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(get_attorney_client_result.length === null)
|
||||
{
|
||||
await this._updateDocs(document.index, { loading: false, error: true, ready: true, message: "Не обнаружена доверенность на подписанта. Для продолжения подписания обратитесь к своему персональному менеджеру" });
|
||||
callback();
|
||||
}
|
||||
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._updateDocs(document.index, { loading: false, error: false, attorneys, attorney_selected: undefined });
|
||||
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const create_edo_project_result = await createEDOProject({
|
||||
contract_number: document.id,
|
||||
edo_box: operator_selected.edo_box,
|
||||
});
|
||||
|
||||
const get_guid_entity_result = await signGetGUIDEntity({
|
||||
contract_number: document.id,
|
||||
});
|
||||
|
||||
const wmdoc_result = await signGetWMDoc({
|
||||
entity_name: "evo_contract",
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
sign_type: "EDO",
|
||||
evo_id: "144",
|
||||
});
|
||||
console.log({ wmdoc_result });
|
||||
|
||||
const connect_result = await docEDOConnect({ contract_number: document.id });
|
||||
|
||||
await this._updateDocs(document.index, {
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
ready: true,
|
||||
loading: false,
|
||||
attorney: false,
|
||||
});
|
||||
|
||||
callback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, () =>
|
||||
{
|
||||
if(this._checkDocumentsCompleted())
|
||||
{
|
||||
this.setState({ loading: false, finished: true, });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({ loading: false });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onFormSubmit = (event) =>
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
const { onFinish } = this.props;
|
||||
const { finished } = this.state;
|
||||
const documents = [ ...this.state.documents ];
|
||||
|
||||
console.log("_handle_onFormSubmit");
|
||||
console.log({ documents, });
|
||||
|
||||
if(finished)
|
||||
{
|
||||
onFinish();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._sign();
|
||||
}
|
||||
}
|
||||
|
||||
_handle_onAttorneyChange = (index, attorney) =>
|
||||
{
|
||||
console.log("_handle_onAttorneyChange", { index, attorney });
|
||||
this._updateDocs(index, { attorney_selected: attorney });
|
||||
}
|
||||
|
||||
_handle_onDownloadFile = (index, entity_id, name) =>
|
||||
{
|
||||
console.log("_handle_onDownloadFile", { index, entity_id });
|
||||
this.setState({ loading: true, disabled: true, }, async () =>
|
||||
{
|
||||
await this._updateDocs(index, { loading: true });
|
||||
|
||||
const wmdoc_result = await signDownloadFile({
|
||||
payload: { entity_name: "evo_contract", entity_id, sign_type: "EDO", evo_id: "144", },
|
||||
filename: `ЛК ЭВОЛЮЦИЯ ${ name }.pdf`,
|
||||
});
|
||||
|
||||
await this._updateDocs(index, { loading: false, disabled: false, });
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onCancelFile = async (index) =>
|
||||
{
|
||||
const { onCancel } = this.props;
|
||||
const { documents } = this.state;
|
||||
await this._updateDocs(index, { loading: true });
|
||||
|
||||
this.setState({ loading: true, disabled: true }, async () =>
|
||||
{
|
||||
await docEDOCancel({ contract_number: documents[index].id, doc_type_id: "144" });
|
||||
const docs = [ ...this.state.documents ];
|
||||
docs.splice(index, 1);
|
||||
|
||||
if(docs.length > 0)
|
||||
{
|
||||
this.setState({ documents: docs, loading: false, disabled: false, });
|
||||
}
|
||||
else
|
||||
{
|
||||
onCancel(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onCancel = () =>
|
||||
{
|
||||
const { onCancel } = this.props;
|
||||
const { documents } = this.state;
|
||||
|
||||
console.log("documents", documents, "LEN", documents.length);
|
||||
|
||||
var clean = false;
|
||||
if(documents.length === 0)
|
||||
{
|
||||
clean = true;
|
||||
}
|
||||
|
||||
onCancel(clean);
|
||||
}
|
||||
|
||||
_handle_onCheckEDOStatus = async (index) =>
|
||||
{
|
||||
await this._updateDocs(index, { loading: true });
|
||||
|
||||
this.setState({ loading: true, disabled: true }, async () =>
|
||||
{
|
||||
const status_result = await docEDOStatus({ contract_number: document.id });
|
||||
console.log({ status_result });
|
||||
|
||||
if(status_result.status === 3)
|
||||
{
|
||||
await this._updateDocs(index, { loading: false, disabled: false, signing: false, completed: true, });
|
||||
}
|
||||
else
|
||||
{
|
||||
await this._updateDocs(index, { loading: false, disabled: false, signing: true, completed: false, });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onGoToEDO = () =>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { documents, loading, disabled, finished, operator_selected } = this.state;
|
||||
const { onCancel, } = this.props;
|
||||
console.log({ documents });
|
||||
|
||||
return (
|
||||
<div className="edo_detail">
|
||||
<div className="docs_list medium-icon">
|
||||
<p className="list_title">Подписание в бумажном виде</p>
|
||||
</div>
|
||||
<div className="docs_list medium-icon edo_sign_documents_list">
|
||||
{ documents.map((document, index) =>
|
||||
{
|
||||
console.log({ document });
|
||||
return (
|
||||
<div className="edo_sign_documents_document" key={ index }>
|
||||
<div className="edo_sign_documents_document_left">
|
||||
<p className="doc_name i-pdf extension edo_sign_document" data-format={ document.extension }>
|
||||
{ document.name } от { moment(document.date).format("DD.MM.YYYY") }
|
||||
{ document.type !== undefined && (<span>{ document.type }</span>) }
|
||||
</p>
|
||||
</div>
|
||||
<div className="edo_sign_documents_document_right">
|
||||
{ document.loading ? (
|
||||
<>
|
||||
{ loading && (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) }
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{ document.error ? (
|
||||
<>
|
||||
<div className="status_icon error"></div>
|
||||
<i>{ document.message !== undefined && document.message !== null ? document.message : "" }</i>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{ document.attorney && (
|
||||
<>
|
||||
<div className="status_icon await"></div>
|
||||
<div className="edo_sign_status_attorney_select">
|
||||
<Select
|
||||
id="edo_attorneys_list"
|
||||
name="edo_attorneys_list"
|
||||
options={ document.attorneys }
|
||||
placeholder="Выберите доверенность"
|
||||
noOptionsMessage={ ({ inputValue }) => !inputValue ? "" :"Ничего не найдено" }
|
||||
isSearchable={ true }
|
||||
className="autocomlete autocomlete_with_indicators"
|
||||
classNamePrefix="react-select"
|
||||
value={ document.attorney_selected }
|
||||
onChange={ (element) => { this._handle_onAttorneyChange(document.index, element) } }
|
||||
required={ true }
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) }
|
||||
{ document.ready && (
|
||||
<>
|
||||
<div className="status_icon success"></div>
|
||||
{ document.entity_id !== undefined && (
|
||||
<>
|
||||
<button className="button" disabled={ disabled } onClick={ () => this._handle_onDownloadFile(index, document.entity_id, document.name) }>Посмотреть проект договора</button>
|
||||
<button className="button" disabled={ disabled } onClick={ () => this._handle_onCancelFile(index) }>Отменить подписание</button>
|
||||
</>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
{ document.signing && (
|
||||
<>
|
||||
<div className="status_icon success"></div>
|
||||
<div className="status_title">
|
||||
<i>Идет процесс подписания</i>
|
||||
</div>
|
||||
{ document.entity_id !== undefined && (
|
||||
<>
|
||||
<button className="button" disabled={ disabled } onClick={ () => this._handle_onCheckEDOStatus(index) }>Проверить статус</button>
|
||||
</>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
{ document.completed && (
|
||||
<>
|
||||
<div className="status_icon success"></div>
|
||||
<div className="status_title">
|
||||
<i>Договор подписан со стороны "ЛК Эволюция"</i>
|
||||
</div>
|
||||
{ document.entity_id !== undefined && (
|
||||
<button className="button" disabled={ disabled } onClick={ () => this._handle_onGoToEDO(index) }>Перейти в ЭДО</button>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
</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: "space-between" }}>
|
||||
<button className="button button-blue" onClick={ this._handle_onCancel }>Отменить</button>
|
||||
{ finished ? (
|
||||
<button type="submit" className="button button-blue">Завершить</button>
|
||||
) : (
|
||||
<button type="submit" className="button button-blue">
|
||||
{ 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>
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ import FileDropzoneDeals from "../FileDropzoneDeals";
|
||||
import EDOSign from "../../components/EDOSign";
|
||||
|
||||
import { acceptDealOffers, attachDealDocument, docEDOCancel, docEDOStatus, downloadDealOffer, getFile, removeDealDocument, sendDealDocuments, signDownloadFile, signGetFileContractProject } from "../../actions";
|
||||
import DealContractsSignPaper from "./DealContractsSignPaper";
|
||||
|
||||
class Step extends React.Component
|
||||
{
|
||||
@ -385,6 +386,8 @@ class DocumentsForm extends Step
|
||||
|
||||
_onSendFileStats = (group, index) =>
|
||||
{
|
||||
console.log("_onSendFileStats", { group, index });
|
||||
|
||||
return new Promise((resolve) =>
|
||||
{
|
||||
const uploaded = { ...this.state.uploaded };
|
||||
@ -393,6 +396,8 @@ class DocumentsForm extends Step
|
||||
|
||||
this.setState({ uploaded }, () =>
|
||||
{
|
||||
console.log("_onSendFileStats", { uploaded });
|
||||
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
@ -412,8 +417,11 @@ class DocumentsForm extends Step
|
||||
};
|
||||
}
|
||||
|
||||
let index = parseInt(existed_files[ document_id ].files.length, 10);
|
||||
|
||||
for(let nf in files)
|
||||
{
|
||||
console.log("_handle_onAddFile", { files });
|
||||
let e = false;
|
||||
for(let ef in document_files)
|
||||
{
|
||||
@ -422,7 +430,11 @@ class DocumentsForm extends Step
|
||||
|
||||
if(!e)
|
||||
{
|
||||
files[nf].index = nf;
|
||||
// const ei = parseInt(existed_files[ document_id ].files.length, 10) > 0 ? parseInt(existed_files[ document_id ].files.length, 10) : 0;
|
||||
// const new_index = ei + parseInt(nf, 10);
|
||||
// console.log({ new_index });
|
||||
|
||||
// files[nf].index = new_index;
|
||||
files[nf].group = document_id;
|
||||
files[nf].sent = false;
|
||||
files[nf].update = update;
|
||||
@ -444,7 +456,6 @@ class DocumentsForm extends Step
|
||||
deal_id: opp_number,
|
||||
document_id: file.group,
|
||||
filename: file.name,
|
||||
index: file.index,
|
||||
lastModified: file.lastModified,
|
||||
type: file.type,
|
||||
file,
|
||||
@ -454,7 +465,8 @@ class DocumentsForm extends Step
|
||||
attachDealDocument(payload)
|
||||
.then(async () =>
|
||||
{
|
||||
await this._onSendFileStats(document_id, file.index);
|
||||
await this._onSendFileStats(document_id, index);
|
||||
index++;
|
||||
callback();
|
||||
}, 1000)
|
||||
}, () =>
|
||||
@ -465,13 +477,17 @@ class DocumentsForm extends Step
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onDeleteFile = (document_id, file) =>
|
||||
_handle_onDeleteFile = (document_id, index) =>
|
||||
{
|
||||
const uploaded = { ...this.state.uploaded };
|
||||
const { opp_number } = this.props;
|
||||
|
||||
const list = [];
|
||||
const list = [ ...uploaded[document_id].files ];
|
||||
list.splice(index, 1);
|
||||
|
||||
uploaded[document_id].files = list;
|
||||
|
||||
/*
|
||||
for(let i in uploaded[document_id].files)
|
||||
{
|
||||
if(uploaded[document_id].files[i].name !== file.name)
|
||||
@ -479,7 +495,9 @@ class DocumentsForm extends Step
|
||||
list.push(uploaded[document_id].files[i]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if(list.length > 0)
|
||||
{
|
||||
uploaded[document_id].files = list;
|
||||
@ -488,13 +506,14 @@ class DocumentsForm extends Step
|
||||
{
|
||||
delete uploaded[document_id];
|
||||
}
|
||||
*/
|
||||
|
||||
this.setState({ uploaded }, () =>
|
||||
{
|
||||
const completed = this._checkFilesCompleted();
|
||||
this.setState({ completed }, () =>
|
||||
{
|
||||
removeDealDocument({ deal_id: opp_number, document_id });
|
||||
removeDealDocument({ deal_id: opp_number, document_id, index });
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -630,7 +649,7 @@ class DocumentsForm extends Step
|
||||
uploading={ uploading }
|
||||
uploaded={ uploaded[ document.doc_id ] !== undefined ? uploaded[ document.doc_id ] : { sent: false, files: [] } }
|
||||
onAddFile={ (file, update) => { this._handle_onAddFile(document.doc_id, file, update) } }
|
||||
onDeleteFile={ (file) => this._handle_onDeleteFile(document.doc_id, file) }
|
||||
onDeleteFile={ this._handle_onDeleteFile }
|
||||
document={ document }
|
||||
/>
|
||||
) : (
|
||||
@ -937,20 +956,20 @@ class SignPlannedContract extends React.Component
|
||||
) }
|
||||
{ contract.sign_type === "EDO" && (
|
||||
<div className="actions">
|
||||
{ status < 3 && (
|
||||
{ status === 1 && (
|
||||
<button className="button blue" disabled={ disabled } style={{ minWidth: "130px" }} onClick={ () => this._handle_downloadFile(true) }>{ loading_download_file ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : ("Скачать проект") }</button>
|
||||
) }
|
||||
{ status < 3 && (
|
||||
{ status === 1 && (
|
||||
<button className="button blue" disabled={ disabled } style={{ minWidth: "175px" }} onClick={ () => this._handle_cancelEDOSign() }>{ loading_cancel_sign ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : ("Отменить подписание") }</button>
|
||||
)}
|
||||
{ status < 3 && (
|
||||
{ status === 1 && (
|
||||
<button className="button blue" disabled={ disabled } style={{ minWidth: "145px" }} onClick={ () => this._handle_sendToEDO() }>Отправить в ЭДО</button>
|
||||
) }
|
||||
{ status === 3 && (
|
||||
{ status >= 2 && (
|
||||
<button className="button blue" style={{ minWidth: "145px" }} onClick={ () => this._handle_goToEDO() }>Перейти в ЭДО</button>
|
||||
) }
|
||||
</div>
|
||||
@ -980,6 +999,7 @@ class LeasingRegistration extends Step
|
||||
*/
|
||||
checked: [],
|
||||
edo: false,
|
||||
paper: false,
|
||||
};
|
||||
this.status = 107;
|
||||
this.types = [
|
||||
@ -1032,7 +1052,15 @@ class LeasingRegistration extends Step
|
||||
|
||||
_handle_onSignEDO = () =>
|
||||
{
|
||||
this.setState({ edo: true }, () =>
|
||||
this.setState({ edo: true, paper: false }, () =>
|
||||
{
|
||||
this._handle_onScrollToContainer();
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onSignPaper = (contract) =>
|
||||
{
|
||||
this.setState({ edo: false, paper: true }, () =>
|
||||
{
|
||||
this._handle_onScrollToContainer();
|
||||
});
|
||||
@ -1050,17 +1078,43 @@ class LeasingRegistration extends Step
|
||||
}
|
||||
}
|
||||
|
||||
_onEDOCancel = () =>
|
||||
_handle_onCancelEDO = () =>
|
||||
{
|
||||
const { onDealContractsUpdate } = this.props;
|
||||
|
||||
this.setState({ edo: false }, () =>
|
||||
this.setState({ edo: false, checked: [] }, () =>
|
||||
{
|
||||
onDealContractsUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
_getEDODocuments = () =>
|
||||
_handle_onFinishEDO = () =>
|
||||
{
|
||||
this.setState({ edo: false, checked: [] }, () =>
|
||||
{
|
||||
onDealContractsUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onCancelPaper = () =>
|
||||
{
|
||||
const { onDealContractsUpdate } = this.props;
|
||||
|
||||
this.setState({ paper: false, checked: [] }, () =>
|
||||
{
|
||||
onDealContractsUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onFinishPaper = () =>
|
||||
{
|
||||
this.setState({ paper: false, checked: [] }, () =>
|
||||
{
|
||||
onDealContractsUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
_getDocuments = () =>
|
||||
{
|
||||
const contracts = this.props.contracts['prepared_contracts'];
|
||||
const { checked } = this.state;
|
||||
@ -1085,7 +1139,7 @@ class LeasingRegistration extends Step
|
||||
|
||||
_render_preparedContracts = () =>
|
||||
{
|
||||
const { edo, checked } = this.state;
|
||||
const { edo, paper, checked } = this.state;
|
||||
//const checked = this.state.checked.prepared_contracts;
|
||||
|
||||
const contracts = this.props.contracts['prepared_contracts'];
|
||||
@ -1095,9 +1149,20 @@ class LeasingRegistration extends Step
|
||||
{
|
||||
return (
|
||||
<EDOSign
|
||||
documents={ this._getEDODocuments() }
|
||||
onCancel={ this._onEDOCancel }
|
||||
onFinish={ this._onEDOFinish }
|
||||
documents={ this._getDocuments() }
|
||||
onCancel={ this._handle_onCancelEDO }
|
||||
onFinish={ this._handle_onFinishEDO }
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
if(paper)
|
||||
{
|
||||
return (
|
||||
<DealContractsSignPaper
|
||||
documents={ this._getDocuments() }
|
||||
onCancel={ this._handle_onCancelPaper }
|
||||
onFinish={ this._handle_onFinishPaper }
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -1126,7 +1191,7 @@ class LeasingRegistration extends Step
|
||||
(
|
||||
<div className="block_footer_btn">
|
||||
<button className="button button-blue" onClick={ this._handle_onSignEDO } disabled={ checked.length > 0 ? false : true }>Подписать в ЭДО</button>
|
||||
<button className="button button-blue" disabled={ checked.length > 0 ? false : true }>Подписать в бумажном виде</button>
|
||||
<button className="button button-blue" onClick={ this._handle_onSignPaper } disabled={ checked.length > 0 ? false : true }>Подписать в бумажном виде</button>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
|
||||
@ -36,7 +36,7 @@ export default class FileDropzoneDeals extends FileDropzone
|
||||
return (
|
||||
<div className="file" key={ index }>
|
||||
{ file.sent ? (
|
||||
<div className="delete" onClick={ () => onDeleteFile(file) }>
|
||||
<div className="delete" onClick={ () => onDeleteFile(file.group, index) }>
|
||||
<div className="icon"></div>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@ -6292,6 +6292,13 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.edo_sign_document:before {
|
||||
font-size: 8px;
|
||||
width: 32px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.edo_operators_settings_list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@ -7259,6 +7259,14 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
flex-direction: column;
|
||||
// margin: 30px 0px !important;
|
||||
align-items: flex-start;
|
||||
|
||||
&:before {
|
||||
font-size: 8px;
|
||||
width: 32px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.edo_operators_settings_list {
|
||||
|
||||
@ -32,7 +32,7 @@ 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 }`;
|
||||
const local_filename = `${ client_jwt_decoded.acc_number }_${ deal_id }_${ document_id }_${ index }`;
|
||||
|
||||
try
|
||||
{
|
||||
@ -42,6 +42,7 @@ export default async function handler(req, res)
|
||||
if (fs.existsSync(filename))
|
||||
{
|
||||
fs.unlinkSync(filename);
|
||||
}
|
||||
|
||||
const key = `deals_${ client_jwt_decoded.acc_number }`;
|
||||
var deals = await RedisClient.get(key);
|
||||
@ -69,6 +70,8 @@ export default async function handler(req, res)
|
||||
{
|
||||
if(uploaded[ document_id ].files !== undefined)
|
||||
{
|
||||
console.log({ files: uploaded[ document_id ].files });
|
||||
|
||||
uploaded[ document_id ].sent = false;
|
||||
uploaded[ document_id ].files.splice(index, 1);
|
||||
}
|
||||
@ -78,11 +81,11 @@ export default async function handler(req, res)
|
||||
deals[ deal_id ] = { uploaded };
|
||||
|
||||
await RedisClient.set(key, JSON.stringify(deals));
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error("NOT exists filename", filename);
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// console.error("NOT exists filename", filename);
|
||||
// }
|
||||
|
||||
res.status(200).send();
|
||||
resolve();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user