Merge branch 'master' of https://github.com/merelendor/evoleasing-account
This commit is contained in:
commit
8aa18bb95a
@ -161,7 +161,137 @@ export const createEDOProject = (payload) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const docEDOConnect = ({ contract_number }) =>
|
||||
export const docEDOSign = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/edo/sign`;
|
||||
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.log("ACTION", "edo", "docEDOSign()", { url });
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.log("ACTION", "edo", "docEDOSign()", "response", response.data);
|
||||
}
|
||||
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.error("ACTION", "edo", "docEDOSign()", "ERROR");
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
reject(error.data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const docEDOCancel = ({ contract_number, doc_type_id, }) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/edo/cancel`;
|
||||
|
||||
console.log("ACTION", "edo", "docEDOCancel()", { url });
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, { contract_number, doc_type_id, }, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
console.log("ACTION", "edo", "docEDOCancel()", "response", response.data);
|
||||
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("ACTION", "edo", "docEDOCancel()", "ERROR");
|
||||
console.error(error);
|
||||
|
||||
reject(error.data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const docEDOConnect = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/document/connect`;
|
||||
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.log("ACTION", "edo", "docEDOConnect()", { url });
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.log("ACTION", "edo", "docEDOConnect()", "response", response.data);
|
||||
}
|
||||
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.error("ACTION", "edo", "docEDOConnect()", "ERROR");
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
reject(error.data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const docEDOStatus = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/document/status`;
|
||||
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.log("ACTION", "edo", "docEDOStatus()", { url });
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.log("ACTION", "edo", "docEDOStatus()", "response", response.data);
|
||||
}
|
||||
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
if(parseInt(process.env.LOG, 10) === 1)
|
||||
{
|
||||
console.error("ACTION", "edo", "docEDOStatus()", "ERROR");
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
reject(error.data);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -67,8 +67,6 @@ export const getFile = ({ id, filename }) =>
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
//console.log("error");
|
||||
|
||||
console.error(error);
|
||||
|
||||
reject();
|
||||
|
||||
@ -4,6 +4,7 @@ import Router from 'next/router';
|
||||
import moment from 'moment';
|
||||
import { nSQL } from "@nano-sql/core";
|
||||
import { concatSeries, eachSeries } from 'async';
|
||||
import fileDownload from 'js-file-download';
|
||||
|
||||
import * as actionTypes from '../constants/actionTypes';
|
||||
import * as currentState from '../reducers/initialState';
|
||||
@ -134,19 +135,20 @@ export const signGetWMDoc = (payload) =>
|
||||
});
|
||||
}
|
||||
|
||||
export const signDownloadFile = (payload) =>
|
||||
export const signDownloadFile = ({ payload, filename }) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/document/download`;
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
axios.get(url, {
|
||||
params: payload,
|
||||
responseType: 'blob',
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
console.log("ACTION", "sign", "signDownloadFile()", "response", response.data);
|
||||
resolve(response.data);
|
||||
fileDownload(response.data, filename);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
@ -157,3 +159,28 @@ export const signDownloadFile = (payload) =>
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const signGetFileContractProject = (payload) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/document/link`;
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
if(parseInt(process.env.LOG, 10) === 1) { console.log("ACTION", "sign", "signGetFileContractProject()", "response", response.data); }
|
||||
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("ACTION", "sign", "signGetFileContractProject()", "ERROR");
|
||||
console.error(error);
|
||||
|
||||
reject(error.data);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -39,7 +39,7 @@ export default class DealsList extends React.Component
|
||||
|
||||
render()
|
||||
{
|
||||
const { status, deals, questionnaire_status, dealSelected, onCloseDeal, onDealsUpdate } = this.props;
|
||||
const { status, deals, questionnaire_status, dealSelected, onCloseDeal, onDealsUpdate, onDealContractsUpdate } = this.props;
|
||||
|
||||
console.log({ deals });
|
||||
|
||||
@ -59,6 +59,7 @@ export default class DealsList extends React.Component
|
||||
questionnaire_status={ questionnaire_status }
|
||||
onCloseDeal={ this._handle_onCloseDeal }
|
||||
onDealsUpdate={ onDealsUpdate }
|
||||
onDealContractsUpdate={ onDealContractsUpdate }
|
||||
{ ...deal }
|
||||
/>)
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import React from "react"
|
||||
import React from "react";
|
||||
import numeral from "numeral";
|
||||
import moment from "moment";
|
||||
import { eachLimit } from "async";
|
||||
|
||||
import { SpinnerCircular } from "spinners-react";
|
||||
|
||||
import FileDropzoneDeals from "../FileDropzoneDeals";
|
||||
import EDOSign from "../../components/EDOSign";
|
||||
|
||||
import { acceptDealOffers, attachDealDocument, removeDealDocument, sendDealDocuments } from "../../actions";
|
||||
import { acceptDealOffers, attachDealDocument, docEDOCancel, docEDOStatus, getFile, removeDealDocument, sendDealDocuments, signDownloadFile, signGetFileContractProject } from "../../actions";
|
||||
|
||||
class Step extends React.Component
|
||||
{
|
||||
componentDidMount()
|
||||
{
|
||||
if(this.status.indexOf(this.props.statuscode_id) > -1)
|
||||
if(this.status === this.props.statuscode_id)
|
||||
{
|
||||
this.setState({ open: true });
|
||||
}
|
||||
@ -23,7 +23,7 @@ class Step extends React.Component
|
||||
{
|
||||
if(this.props.statuscode_id !== prevProps.statuscode_id)
|
||||
{
|
||||
if(this.status.indexOf(this.props.statuscode_id) > -1)
|
||||
if(this.status === this.props.statuscode_id)
|
||||
{
|
||||
this.setState({ open: true });
|
||||
}
|
||||
@ -46,11 +46,11 @@ class Step extends React.Component
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className="status_header" style={statuscode_id >= this.status[ 0 ] ? { position: "relative", } : { position: "relative", cursor: "inherit" }} onClick={ statuscode_id >= this.status[ 0 ] ? this._handle_onSwitch : () => {} }>
|
||||
{ this.status.indexOf(statuscode_id) > -1 && ( <div className="background"></div> )}
|
||||
<i className={`status_${ this.status[ 0 ] } ${ statuscode_id < this.status[ 0 ] ? "inactive" : "" }`}></i>
|
||||
<div className="status_header" style={statuscode_id >= this.status ? { position: "relative", } : { position: "relative", cursor: "inherit" }} onClick={ statuscode_id >= this.status ? this._handle_onSwitch : () => {} }>
|
||||
{ this.status === statuscode_id && ( <div className="background"></div> )}
|
||||
<i className={`status_${ this.status } ${ statuscode_id < this.status ? "inactive" : "" }`}></i>
|
||||
<p>{ title }</p>
|
||||
{ statuscode_id >= this.status[ 0 ] && (
|
||||
{ statuscode_id >= this.status && (
|
||||
<div className="button_arrow">
|
||||
<div className={`icon ${ open ? "up" : "down" }`}></div>
|
||||
</div>
|
||||
@ -71,7 +71,7 @@ class Offers extends Step
|
||||
loading: false,
|
||||
checked: [],
|
||||
};
|
||||
this.status = [ 100 ];
|
||||
this.status = 100;
|
||||
}
|
||||
|
||||
_handle_onCheckOffer = (quote_number) =>
|
||||
@ -150,7 +150,7 @@ class Offers extends Step
|
||||
const { checked, open, loading } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<div className={`${ this.status === statuscode_id ? "current" : statuscode_id > this.status ? "done" : "" }`}>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
@ -166,10 +166,10 @@ class Offers extends Step
|
||||
<table className="deal_offers_table">
|
||||
<thead>
|
||||
<tr>
|
||||
{ statuscode_id === 100 && <th></th> }
|
||||
<th></th>
|
||||
<th>№</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Первый платеж, р.</th>
|
||||
<th>Первый платеж, ₽</th>
|
||||
<th>Первый платеж, %</th>
|
||||
<th>Марка</th>
|
||||
<th>Модель</th>
|
||||
@ -178,7 +178,11 @@ class Offers extends Step
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{ offers.map((offer, offer_index) => (
|
||||
{ offers.map((offer, offer_index) =>
|
||||
{
|
||||
console.log({ offer });
|
||||
|
||||
return (
|
||||
<tr key={ offer_index }>
|
||||
{ offer.quote_status ? (
|
||||
<td>
|
||||
@ -191,8 +195,8 @@ class Offers extends Step
|
||||
<td></td>
|
||||
)}
|
||||
<td>{ offer_index + 1 }</td>
|
||||
<td>{ numeral(offer.price).format(' ., ') } р.</td>
|
||||
<td>{ numeral(offer.first_payment_rub).format(' ., ') } р.</td>
|
||||
<td>{ numeral(offer.price).format(' ., ') } ₽</td>
|
||||
<td>{ numeral(offer.first_payment_rub).format(' ., ') } ₽</td>
|
||||
<td>{ offer.first_payment_perc }%</td>
|
||||
<td>{ offer.brand_name }</td>
|
||||
<td>{ offer.model_name }</td>
|
||||
@ -210,7 +214,8 @@ class Offers extends Step
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)) }
|
||||
)
|
||||
} ) }
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
@ -233,7 +238,7 @@ class FinancialProgram extends Step
|
||||
this.state = {
|
||||
open: false,
|
||||
};
|
||||
this.status = [ 101 ];
|
||||
this.status = 101;
|
||||
}
|
||||
|
||||
render()
|
||||
@ -242,14 +247,18 @@ class FinancialProgram extends Step
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<div className={`${ this.status === statuscode_id ? "current" : statuscode_id > this.status ? "done" : "" }`}>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Программа финансирования") }
|
||||
<div className="wrap" style={{ display: open ? "block" : "none" }}>
|
||||
<div className="single_text">
|
||||
<p>Статусный текст о том что выбирается программа финансированияи</p>
|
||||
{ statuscode_id === this.status ? (
|
||||
<p>Идёт подбор оптимальной программы финансирования</p>
|
||||
) : (
|
||||
<p>Программа финансирования выбрана</p>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -270,14 +279,14 @@ class DocumentsForm extends Step
|
||||
completed: false,
|
||||
loading: true,
|
||||
};
|
||||
this.status = [ 102 ];
|
||||
this.status = 102;
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState)
|
||||
{
|
||||
if(this.props.statuscode_id !== prevProps.statuscode_id)
|
||||
{
|
||||
if(this.status.indexOf(this.props.statuscode_id) > -1)
|
||||
if(this.status === this.props.statuscode_id)
|
||||
{
|
||||
this.setState({ open: true });
|
||||
}
|
||||
@ -487,8 +496,11 @@ class DocumentsForm extends Step
|
||||
_renderHeaderButtons = () =>
|
||||
{
|
||||
const { open, uploading, completed, loading, } = this.state;
|
||||
const { statuscode_id } = this.props;
|
||||
|
||||
if(open && !uploading && !loading && completed)
|
||||
{
|
||||
if(this.status === statuscode_id)
|
||||
{
|
||||
return (
|
||||
<div className="buttons">
|
||||
@ -496,6 +508,7 @@ class DocumentsForm extends Step
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -506,7 +519,7 @@ class DocumentsForm extends Step
|
||||
const { open, files, uploading, loading } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<div className={`${ this.status === statuscode_id ? "current" : statuscode_id > this.status ? "done" : "" }`}>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
@ -547,21 +560,39 @@ class DocumentsForm extends Step
|
||||
<></>
|
||||
) : (
|
||||
<>
|
||||
{ documents.map((document, index) => (
|
||||
{ documents.map((document, index) =>
|
||||
{
|
||||
console.log({ document });
|
||||
return (
|
||||
<div className="block" key={ index }>
|
||||
<div className="left">
|
||||
<p><b><span>{ document.name }</span>:</b></p>
|
||||
</div>
|
||||
<div className="right">
|
||||
{ document.add ? (
|
||||
<FileDropzoneDeals
|
||||
uploading={ uploading }
|
||||
files={ files[ document.doc_id ] !== undefined ? files[ document.doc_id ] : [] }
|
||||
onAddFile={ (file) => { this._handle_onAddFile(document.doc_id, file) } }
|
||||
onDeleteFile={ (file) => this._handle_onDeleteFile(document.doc_id, file) }
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{ document.check === "Документ принят" ? (
|
||||
<div className="message ok">
|
||||
<p>{ document.check }</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="message wait">
|
||||
<p>{ document.check }</p>
|
||||
</div>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
)) }
|
||||
)
|
||||
} ) }
|
||||
</>
|
||||
) }
|
||||
{/*}
|
||||
@ -598,7 +629,7 @@ class StatusDocumentsCheck extends Step
|
||||
this.state = {
|
||||
open: false,
|
||||
};
|
||||
this.status = [ 103 ];
|
||||
this.status = 103;
|
||||
}
|
||||
|
||||
render()
|
||||
@ -607,14 +638,18 @@ class StatusDocumentsCheck extends Step
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<div className={`${ statuscode_id === this.status ? "current" : statuscode_id > this.status ? "done" : "" }`}>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Проверка документов") }
|
||||
<div className="wrap" style={{ display: open ? "block" : "none" }}>
|
||||
<div className="single_text">
|
||||
<p>Статусный текст о том что выбирается программа финансированияи</p>
|
||||
{ statuscode_id === this.status ? (
|
||||
<p>Идёт проверка предоставленных документов</p>
|
||||
) : (
|
||||
<p>Документы проверены</p>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -631,7 +666,7 @@ class StatusDecisionMaking extends Step
|
||||
this.state = {
|
||||
open: false,
|
||||
};
|
||||
this.status = [ 104, 105, ];
|
||||
this.status = 104;
|
||||
}
|
||||
|
||||
render()
|
||||
@ -639,15 +674,62 @@ class StatusDecisionMaking extends Step
|
||||
const { index, statuscode_id, dealSelected } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
if(statuscode_id === 105)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf(statuscode_id) > -1 ? "current" : (statuscode_id > this.status[0] && statuscode_id > this.status[1]) ? "done" : "" }`}>
|
||||
<div className={`${ this.status === statuscode_id ? "current" : (statuscode_id > this.status) ? "done" : "" }`}>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Принятие решения по сделке") }
|
||||
<div className="wrap" style={{ display: open ? "block" : "none" }}>
|
||||
<div className="single_text">
|
||||
<p>Статусный текст о том что выбирается программа финансированияи</p>
|
||||
{ this.status === statuscode_id ? (
|
||||
<p>Принятие решение о финансировании</p>
|
||||
) : (
|
||||
<p>Поздравляем! Принято положительное решение по сделке.</p>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class StatusDecisionRefuse extends Step
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props);
|
||||
this.state = {
|
||||
open: false,
|
||||
};
|
||||
this.status = 105;
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id, dealSelected } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
if(statuscode_id !== this.status)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`${ this.status === statuscode_id ? "current" : (statuscode_id > this.status) ? "done" : "" }`}>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Требуется изменение параметров") }
|
||||
<div className="wrap" style={{ display: open ? "block" : "none" }}>
|
||||
<div className="single_text">
|
||||
<p>Продолжение оформления заблокировано</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -664,7 +746,7 @@ class StatusPositiveDecision extends Step
|
||||
this.state = {
|
||||
open: false,
|
||||
};
|
||||
this.status = [ 106 ];
|
||||
this.status = 106;
|
||||
}
|
||||
|
||||
render()
|
||||
@ -673,14 +755,18 @@ class StatusPositiveDecision extends Step
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<div className={`${ this.status === statuscode_id ? "current" : statuscode_id > this.status ? "done" : "" }`}>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Принято положительное решение") }
|
||||
<div className="wrap" style={{ display: open ? "block" : "none" }}>
|
||||
<div className="single_text">
|
||||
<p>Статусный текст о том что выбирается программа финансированияи</p>
|
||||
{ statuscode_id === this.status ? (
|
||||
<p>Идёт подготовка необходимых документов</p>
|
||||
) : (
|
||||
<p>Документы подготовлены</p>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -689,6 +775,146 @@ class StatusPositiveDecision extends Step
|
||||
}
|
||||
}
|
||||
|
||||
class SignPlannedContract extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: true,
|
||||
loading_download_file: false,
|
||||
loading_cancel_sign: false,
|
||||
disabled: false,
|
||||
status: undefined,
|
||||
contract_entity_id: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
async componentDidMount()
|
||||
{
|
||||
const { contract } = this.props;
|
||||
console.log("SignPlannedContract", "CDM", { props: this.props });
|
||||
|
||||
if(contract.sign_type === "EDO")
|
||||
{
|
||||
const status_result = await docEDOStatus({ contract_number: contract.name });
|
||||
console.log("SignPlannedContract", "CDM", { status_result });
|
||||
this.setState({ contract_entity_id: status_result.edoid, status: status_result.status, loading: false });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({ loading: false });
|
||||
}
|
||||
}
|
||||
|
||||
_handle_downloadFile = (edo) =>
|
||||
{
|
||||
console.log("_handle_downloadFile");
|
||||
|
||||
const { contract } = this.props;
|
||||
//const { contract_entity_id } = this.state;
|
||||
|
||||
this.setState({ disabled: true, loading_download_file: true }, async () =>
|
||||
{
|
||||
const link_result = await signGetFileContractProject({
|
||||
contract_number: contract.name
|
||||
});
|
||||
|
||||
console.log("_downloadFile", { link_result });
|
||||
await getFile({ id: link_result.url, filename: `ЛК ЭВОЛЮЦИЯ ${ contract.name }.${ link_result.extension }` });
|
||||
this.setState({ disabled: false, loading_download_file: false });
|
||||
|
||||
/*
|
||||
const wmdoc_result = await signDownloadFile({
|
||||
payload: { entity_name: "evo_contract", entity_id: contract_entity_id, sign_type: edo ? "EDO" : "Paper", evo_id: "144", },
|
||||
filename: `ЛК ЭВОЛЮЦИЯ ${ contract.name }.pdf`,
|
||||
});
|
||||
console.log({ wmdoc_result });
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
_handle_cancelEDOSign = () =>
|
||||
{
|
||||
console.log("_handle_cancelEDOSign");
|
||||
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" });
|
||||
setTimeout(() => {
|
||||
onDealContractsUpdate();
|
||||
//this.setState({ disabled: false, loading_cancel_sign: false });
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
_handle_sendToEDO = () =>
|
||||
{
|
||||
console.log("_handle_sendToEDO");
|
||||
}
|
||||
|
||||
_handle_goToEDO = () =>
|
||||
{
|
||||
console.log("_handle_goToEDO");
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, contract, } = this.props;
|
||||
const { status, loading, disabled, loading_download_file, loading_cancel_sign } = this.state;
|
||||
|
||||
return (
|
||||
<div className="document deal_contract_sign_item">
|
||||
<div className="icon">
|
||||
<span className="extension">PDF</span>
|
||||
</div>
|
||||
<div className="title">
|
||||
<p>{ contract.name }</p>
|
||||
<div className="description">
|
||||
<span>{ moment(contract.date).format("DD.MM.YYYY") }</span>
|
||||
<span>{ contract.brand_name }</span>
|
||||
<span>{ contract.model_name }</span>
|
||||
</div>
|
||||
</div>
|
||||
{ loading ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : (
|
||||
<>
|
||||
{ contract.sign_type === "PAPER" && (
|
||||
<div className="actions" style={{ justifyContent: "flex-end" }}>
|
||||
<button className="button blue" disabled={ disabled } style={{ minWidth: "230px" }} onClick={ () => this._handle_downloadFile(false) }>{ loading_download_file ? (
|
||||
<SpinnerCircular size={ 22 } thickness={ 100 } speed={ 100 } color="rgba(236, 239, 244, 1)" secondaryColor="rgba(28, 1, 169, 1)" />
|
||||
) : ("Скачать файл для подписания") }</button>
|
||||
</div>
|
||||
) }
|
||||
{ contract.sign_type === "EDO" && (
|
||||
<div className="actions">
|
||||
{ status < 3 && (
|
||||
<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 && (
|
||||
<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 && (
|
||||
<button className="button blue" disabled={ disabled } style={{ minWidth: "145px" }} onClick={ () => this._handle_sendToEDO() }>Отправить в ЭДО</button>
|
||||
) }
|
||||
{ status === 3 && (
|
||||
<button className="button blue" style={{ minWidth: "145px" }} onClick={ () => this._handle_goToEDO() }>Перейти в ЭДО</button>
|
||||
) }
|
||||
</div>
|
||||
) }
|
||||
</>
|
||||
) }
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class LeasingRegistration extends Step
|
||||
{
|
||||
constructor(props)
|
||||
@ -708,7 +934,7 @@ class LeasingRegistration extends Step
|
||||
checked: [],
|
||||
edo: false,
|
||||
};
|
||||
this.status = [ 107 ];
|
||||
this.status = 107;
|
||||
this.types = [
|
||||
{
|
||||
title: "Подготовлено",
|
||||
@ -765,6 +991,28 @@ class LeasingRegistration extends Step
|
||||
});
|
||||
}
|
||||
|
||||
_onEDOCancel = (clean = false) =>
|
||||
{
|
||||
if(clean)
|
||||
{
|
||||
this.setState({ edo: false, checked: [] });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({ edo: false });
|
||||
}
|
||||
}
|
||||
|
||||
_onEDOCancel = () =>
|
||||
{
|
||||
const { onDealContractsUpdate } = this.props;
|
||||
|
||||
this.setState({ edo: false }, () =>
|
||||
{
|
||||
onDealContractsUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
_getEDODocuments = () =>
|
||||
{
|
||||
const contracts = this.props.contracts['prepared_contracts'];
|
||||
@ -801,7 +1049,8 @@ class LeasingRegistration extends Step
|
||||
return (
|
||||
<EDOSign
|
||||
documents={ this._getEDODocuments() }
|
||||
onCancel={ () => this.setState({ edo: false }) }
|
||||
onCancel={ this._onEDOCancel }
|
||||
onFinish={ this._onEDOFinish }
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -840,37 +1089,21 @@ class LeasingRegistration extends Step
|
||||
_render_signingPlanContracts = () =>
|
||||
{
|
||||
const contracts = this.props.contracts['signing_plan_contracts'];
|
||||
const { onDealContractsUpdate } = this.props;
|
||||
console.log("_render_signingPlanContracts", { contracts });
|
||||
|
||||
return (
|
||||
<div className="documents">
|
||||
<div className="documents deal_contract_sign_list">
|
||||
{ contracts.length > 0 ?
|
||||
contracts.map((contract, index) => (
|
||||
<div className="document" key={ index }>
|
||||
<div className="icon">
|
||||
<span className="extension">PDF</span>
|
||||
</div>
|
||||
<div className="title">
|
||||
<p>{ contract.name }</p>
|
||||
<div className="description">
|
||||
<span>{ moment(contract.date).format("DD.MM.YYYY") }</span>
|
||||
<span>{ contract.brand_name }</span>
|
||||
<span>{ contract.model_name }</span>
|
||||
</div>
|
||||
</div>
|
||||
{ index === 0 && (
|
||||
<div className="actions">
|
||||
<button className="button blue">Перейти в ЭДО</button>
|
||||
</div>
|
||||
) }
|
||||
{ index === 1 && (
|
||||
<div className="actions">
|
||||
<button className="button blue">Скачать документ</button>
|
||||
<button className="button blue">Загрузить подписанный экземпляр</button>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
)) : (
|
||||
<SignPlannedContract
|
||||
key={ `SignPlannedContract_${ contract.name }` }
|
||||
index={ index }
|
||||
contract={ contract }
|
||||
onDealContractsUpdate={ onDealContractsUpdate }
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<p className="empty">Нет договоров</p>
|
||||
) }
|
||||
</div>
|
||||
@ -1017,7 +1250,7 @@ class LeasingRegistration extends Step
|
||||
const { open, edo } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`} ref={ this.container_ref }>
|
||||
<div className={`${ this.status === statuscode_id ? "current" : statuscode_id > this.status ? "done" : "" }`} ref={ this.container_ref }>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
@ -1030,7 +1263,7 @@ class LeasingRegistration extends Step
|
||||
) : (
|
||||
<>
|
||||
{ this.types.map((type, index) => (
|
||||
<div className="block" key={ index }>
|
||||
<div className="block deal_contracts_group_item" key={ index }>
|
||||
{ edo ? (
|
||||
<>
|
||||
{ type.key !== "prepared_contracts" && (
|
||||
@ -1062,6 +1295,12 @@ export default class SingleDeal extends React.Component
|
||||
this.leasing_registration_ref = React.createRef();
|
||||
}
|
||||
|
||||
_onDealContractsUpdate = () =>
|
||||
{
|
||||
const { onDealContractsUpdate, dealSelected } = this.props;
|
||||
onDealContractsUpdate(dealSelected);
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, status, deals, dealSelected, onCloseDeal, } = this.props;
|
||||
@ -1085,8 +1324,9 @@ export default class SingleDeal extends React.Component
|
||||
<DocumentsForm { ...this.props } documents={ documents } files={ files }/>
|
||||
<StatusDocumentsCheck { ...this.props }/>
|
||||
<StatusDecisionMaking { ...this.props }/>
|
||||
<StatusDecisionRefuse { ...this.props }/>
|
||||
<StatusPositiveDecision { ...this.props }/>
|
||||
<LeasingRegistration { ...this.props } contracts={ contracts }/>
|
||||
<LeasingRegistration { ...this.props } contracts={ contracts } onDealContractsUpdate={ this._onDealContractsUpdate }/>
|
||||
</div>
|
||||
<div className="bottom_button_close" onClick={ onCloseDeal } >
|
||||
<span>Свернуть</span>
|
||||
|
||||
@ -109,6 +109,7 @@ class DealsStatus extends React.Component
|
||||
|
||||
_onDealsUpdate = () =>
|
||||
{
|
||||
console.log("_onDealsUpdate");
|
||||
return new Promise((resolve) =>
|
||||
{
|
||||
const { dispatch } = this.props;
|
||||
@ -125,6 +126,14 @@ class DealsStatus extends React.Component
|
||||
});
|
||||
}
|
||||
|
||||
_onDealContractsUpdate = (deal_id) =>
|
||||
{
|
||||
console.log("_onDealContractsUpdate");
|
||||
|
||||
const { dispatch } = this.props;
|
||||
getDealContracts({ dispatch, deal_id, });
|
||||
}
|
||||
|
||||
_handleModalToggle = (modal) =>
|
||||
{
|
||||
if (modal === "current")
|
||||
@ -176,6 +185,7 @@ class DealsStatus extends React.Component
|
||||
<p className="deals_list_title">Статусы сделок</p>
|
||||
</div>
|
||||
<DealsList
|
||||
dispatch={ this.props.dispatch }
|
||||
status={ status }
|
||||
deals={ deals }
|
||||
questionnaire_status={ questionnaire_status }
|
||||
@ -183,6 +193,7 @@ class DealsStatus extends React.Component
|
||||
onSelectDeal={ this._handle_onSelectDeal }
|
||||
onCloseDeal={ this._handle_onCloseDeal }
|
||||
onDealsUpdate={ this._onDealsUpdate }
|
||||
onDealContractsUpdate={ this._onDealContractsUpdate }
|
||||
/>
|
||||
{/*}
|
||||
<AllContractsModal
|
||||
|
||||
@ -5,10 +5,8 @@ import { SpinnerCircular } from "spinners-react";
|
||||
import { concatSeries } from "async";
|
||||
import { eachSeries } from 'async';
|
||||
import Select from 'react-select';
|
||||
import fileDownload from 'js-file-download';
|
||||
|
||||
|
||||
import { createEDOProject, signCheckEDOCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc } from "../../actions";
|
||||
import { createEDOProject, docEDOCancel, signCheckEDOCreatePrintForm, signCheckPowerAttorneyClient, signDownloadFile, signGetGUIDEntity, signGetPowerAttorneyClient, signGetWMDoc, docEDOSign, docEDOStatus, docEDOConnect } from "../../actions";
|
||||
//import { getDeals, getDealOffers, getDealDocuments, getDealContracts } from "../../actions";
|
||||
|
||||
class EDOSign extends React.Component
|
||||
@ -17,8 +15,10 @@ class EDOSign extends React.Component
|
||||
{
|
||||
super(props)
|
||||
this.state = {
|
||||
finished: false,
|
||||
operators: null,
|
||||
loading: false,
|
||||
disabled: false,
|
||||
documents: [],
|
||||
operator_selected: {},
|
||||
statuses: {},
|
||||
@ -39,7 +39,7 @@ class EDOSign extends React.Component
|
||||
const docs = [];
|
||||
for(let i in this.props.documents)
|
||||
{
|
||||
docs.push({ ...this.props.documents[i], ...{ index: i, loading: true, completed: false, attorney: false } });
|
||||
docs.push({ ...this.props.documents[i], ...{ index: i, loading: true, ready: false, attorney: false } });
|
||||
}
|
||||
this.setState({ documents: docs });
|
||||
|
||||
@ -63,6 +63,22 @@ class EDOSign extends React.Component
|
||||
});
|
||||
}
|
||||
|
||||
_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;
|
||||
@ -80,6 +96,38 @@ class EDOSign extends React.Component
|
||||
{
|
||||
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 })
|
||||
@ -106,7 +154,7 @@ class EDOSign extends React.Component
|
||||
|
||||
await this._updateDocs(document.index, {
|
||||
entity_id: get_guid_entity_result.entityid,
|
||||
completed: true,
|
||||
ready: true,
|
||||
loading: false,
|
||||
attorney: false,
|
||||
});
|
||||
@ -115,7 +163,7 @@ class EDOSign extends React.Component
|
||||
}
|
||||
else
|
||||
{
|
||||
const create_print_form_result = await signCheckEDOCreatePrintForm({ contract_number: document.id === "2023_5885" ? "2023_5894" : document.id, sign_type: "EDO" });
|
||||
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 };
|
||||
@ -124,7 +172,7 @@ class EDOSign extends React.Component
|
||||
{
|
||||
docs.loading = false;
|
||||
docs.error = true;
|
||||
docs.completed = true;
|
||||
docs.ready = true;
|
||||
docs.message = create_print_form_result.message;
|
||||
}
|
||||
|
||||
@ -144,14 +192,14 @@ class EDOSign extends React.Component
|
||||
|
||||
if(get_attorney_client_result === null)
|
||||
{
|
||||
await this._updateDocs(document.index, { loading: false, error: true, completed: true, message: "Возникла ошибка при создании документа для подписания." });
|
||||
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, completed: true, message: "Не обнаружена доверенность на подписанта. Для продолжения подписания обратитесь к своему персональному менеджеру" });
|
||||
await this._updateDocs(document.index, { loading: false, error: true, ready: true, message: "Не обнаружена доверенность на подписанта. Для продолжения подписания обратитесь к своему персональному менеджеру" });
|
||||
callback();
|
||||
}
|
||||
else
|
||||
@ -190,9 +238,11 @@ class EDOSign extends React.Component
|
||||
});
|
||||
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,
|
||||
completed: true,
|
||||
ready: true,
|
||||
loading: false,
|
||||
attorney: false,
|
||||
});
|
||||
@ -207,8 +257,15 @@ class EDOSign extends React.Component
|
||||
}
|
||||
}
|
||||
}, () =>
|
||||
{
|
||||
if(this._checkDocumentsCompleted())
|
||||
{
|
||||
this.setState({ loading: false, finished: true, });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setState({ loading: false });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -217,13 +274,19 @@ class EDOSign extends React.Component
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
//const { documents } = this.props;
|
||||
const { operator_selected, step } = this.state;
|
||||
const { onFinish } = this.props;
|
||||
const { operator_selected, step, finished } = this.state;
|
||||
const documents = [ ...this.state.documents ];
|
||||
|
||||
console.log("_handle_onFormSubmit");
|
||||
console.log({ documents, operator_selected });
|
||||
|
||||
if(finished)
|
||||
{
|
||||
onFinish();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(step)
|
||||
{
|
||||
case 0:
|
||||
@ -242,6 +305,7 @@ class EDOSign extends React.Component
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_handle_onSelectOperator = (operator) =>
|
||||
{
|
||||
@ -257,30 +321,86 @@ class EDOSign extends React.Component
|
||||
_handle_onDownloadFile = (index, entity_id, name) =>
|
||||
{
|
||||
console.log("_handle_onDownloadFile", { index, entity_id });
|
||||
this.setState({ loading: true }, async () =>
|
||||
this.setState({ loading: true, disabled: true, }, async () =>
|
||||
{
|
||||
await this._updateDocs(index, { loading: true });
|
||||
|
||||
const wmdoc_result = await signDownloadFile({ entity_name: "evo_contract", entity_id, sign_type: "EDO", evo_id: "144", });
|
||||
console.log({ wmdoc_result });
|
||||
fileDownload(wmdoc_result, `ЛК ЭВОЛЮЦИЯ ${ name }.pdf`);
|
||||
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 });
|
||||
await this._updateDocs(index, { loading: false, disabled: false, });
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onCancelFile = async (index, entity_id) =>
|
||||
_handle_onCancelFile = async (index) =>
|
||||
{
|
||||
const { onCancel } = this.props;
|
||||
const { documents } = this.state;
|
||||
await this._updateDocs(index, { loading: true });
|
||||
this.setState({ loading: true }, async () =>
|
||||
|
||||
this.setState({ loading: true, disabled: true }, async () =>
|
||||
{
|
||||
await this._updateDocs(index, { loading: true });
|
||||
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 { step, operators, documents, loading, operator_selected } = this.state;
|
||||
const { step, operators, documents, loading, disabled, finished, operator_selected } = this.state;
|
||||
const { onCancel, } = this.props;
|
||||
console.log({ operators, documents });
|
||||
|
||||
@ -312,7 +432,9 @@ class EDOSign extends React.Component
|
||||
{ step === 1 && (
|
||||
<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 }>
|
||||
@ -332,7 +454,7 @@ class EDOSign extends React.Component
|
||||
{ document.error ? (
|
||||
<>
|
||||
<div className="status_icon error"></div>
|
||||
<i>{ document.message }</i>
|
||||
<i>{ document.message !== undefined && document.message !== null ? document.message : "" }</i>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@ -356,34 +478,63 @@ class EDOSign extends React.Component
|
||||
</div>
|
||||
</>
|
||||
) }
|
||||
{ document.completed && (
|
||||
{ document.ready && (
|
||||
<>
|
||||
<div className="status_icon success"></div>
|
||||
{ document.entity_id !== undefined && (
|
||||
<>
|
||||
<button className="button" onClick={ () => this._handle_onDownloadFile(index, document.entity_id, document.name) }>Посмотреть проект договора</button>
|
||||
<button className="button" onClick={ () => this._handle_onCancelFile(index, document.entity_id) }>Отменить подписание</button>
|
||||
<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={ onCancel }>Отменить</button>
|
||||
<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>
|
||||
|
||||
@ -5328,6 +5328,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
.contractStatus_list .list_item div:nth-child(2) p {
|
||||
cursor: pointer;
|
||||
color: var(--text_not_active);
|
||||
min-width: 120px;
|
||||
}
|
||||
.contractStatus_list .list_item div:nth-child(2):before {
|
||||
content: "";
|
||||
@ -5757,7 +5758,6 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
.contractStatus_modal .single_status > div .status_body .wrap.form .block .right {
|
||||
width: 80%;
|
||||
padding-left: 30px;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
.contractStatus_modal .single_status > div .status_body .wrap input[type="checkbox"] + label {
|
||||
width: 16px;
|
||||
@ -6336,6 +6336,12 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z' stroke='%238E94A7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12 8L12 12' stroke='%238E94A7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M16 12L12 12' stroke='%238E94A7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
||||
border: none !important;
|
||||
}
|
||||
.edo_sign_documents_document .status_title {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
.edo_sign_documents_document .status_title i {
|
||||
display: contents;
|
||||
}
|
||||
.edo_sign_documents_document .edo_sign_documents_document_left {
|
||||
width: 35%;
|
||||
}
|
||||
@ -6362,3 +6368,29 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
padding-left: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.deal_contract_sign_list {
|
||||
gap: 0px 0px;
|
||||
}
|
||||
.deal_contract_sign_item {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
border-top: solid 1px #edeff5;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.deal_contract_sign_item .title {
|
||||
width: 35%;
|
||||
}
|
||||
.deal_contract_sign_item .actions {
|
||||
width: 65%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.deal_contract_sign_item:first-child {
|
||||
border: none;
|
||||
}
|
||||
.deal_contracts_group_item {
|
||||
border-top: solid 1px #edeff5;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
@ -6030,7 +6030,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
p {
|
||||
cursor: pointer;
|
||||
color: var(--text_not_active);
|
||||
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
@ -6565,7 +6565,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
.right {
|
||||
width: 80%;
|
||||
padding-left: 30px;
|
||||
padding-bottom: 30px;
|
||||
//padding-bottom: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7311,6 +7311,14 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
}
|
||||
}
|
||||
|
||||
.status_title {
|
||||
padding: 0px 10px;
|
||||
|
||||
i {
|
||||
display: contents;
|
||||
}
|
||||
}
|
||||
|
||||
.edo_sign_documents_document_left {
|
||||
width: 35%;
|
||||
}
|
||||
@ -7342,3 +7350,37 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
padding-left: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.deal_contract_sign_list {
|
||||
gap: 0px 0px;
|
||||
}
|
||||
|
||||
.deal_contract_sign_item {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
border-top: solid 1px #edeff5;
|
||||
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
.title {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
.actions {
|
||||
width: 65%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.deal_contracts_group_item {
|
||||
border-top: solid 1px #edeff5;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 20px;
|
||||
// margin-top: 30px;
|
||||
}
|
||||
@ -1,13 +1,15 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import fs from 'fs';
|
||||
import axios from 'axios';
|
||||
import { Cookies } from 'react-cookie';
|
||||
import cookie from 'cookie';
|
||||
import moment from 'moment';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { cors } from '../cors';
|
||||
import { inspect } from 'util';
|
||||
|
||||
export default async function CRMRequestGet(req, res, path, params, data = undefined, log = false)
|
||||
import { cors } from '../cors';
|
||||
|
||||
export default async function CRMRequestGet({ req, res, path, params, data = undefined, log = false, headers = {}, options = {} })
|
||||
{
|
||||
await cors(req, res);
|
||||
|
||||
@ -16,19 +18,14 @@ export default async function CRMRequestGet(req, res, path, params, data = undef
|
||||
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
|
||||
|
||||
//console.log("-".repeat(50));
|
||||
|
||||
//console.log("CRMRequestGet", "req.body");
|
||||
|
||||
//console.log(req.body);
|
||||
|
||||
|
||||
if(cookies.jwt !== undefined && cookies.jwt !== null)
|
||||
{
|
||||
//console.log("cookies.jwt");
|
||||
|
||||
//console.log(cookies.jwt);
|
||||
|
||||
|
||||
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
|
||||
var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true });
|
||||
|
||||
@ -39,31 +36,29 @@ export default async function CRMRequestGet(req, res, path, params, data = undef
|
||||
}
|
||||
|
||||
//console.log("path", path);
|
||||
|
||||
//console.log("params", { ...client_jwt_decoded, ...params });
|
||||
|
||||
|
||||
const payload = { ...{ acc_number: client_jwt_decoded.acc_number }, ...params };
|
||||
const options = {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${ crm_jwt }`,
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
const request_options = {
|
||||
headers: { ...{ "Authorization": `Bearer ${ crm_jwt }` }, ...headers },
|
||||
withCredentials: true,
|
||||
};
|
||||
|
||||
if(data !== undefined)
|
||||
{
|
||||
options.data = data;
|
||||
request_options.data = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
options.params = payload;
|
||||
request_options.params = payload;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await axios.get(path, options)
|
||||
console.log({ options, __dirname });
|
||||
console.log("{ ...request_options, ...options }", { ...request_options, ...options });
|
||||
|
||||
await axios.get(path, { ...request_options, ...options })
|
||||
.then((crm_response) =>
|
||||
{
|
||||
if(log)
|
||||
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetDocumentList`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetDocumentList`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -3,5 +3,5 @@ import CRMRequestGet from '../../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculations`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculations`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -7,5 +7,5 @@ export default async function handler(req, res)
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculationGraph`, { addcontract_number: req.body.calculation });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/add-contract/GetPreCalculationGraph`, params: { addcontract_number: req.body.calculation } });
|
||||
}
|
||||
@ -7,5 +7,5 @@ export default async function handler(req, res)
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetCurrentGraph`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/add-contract/GetCurrentGraph`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -7,5 +7,5 @@ export default async function handler(req, res)
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetTypeOptions`, { ...{ contract_number: req.body.number }, ...req.body.variants });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/add-contract/GetTypeOptions`, params: { ...{ contract_number: req.body.number }, ...req.body.variants } });
|
||||
}
|
||||
@ -3,5 +3,5 @@ import CRMRequestGet from '../../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetSignatories`, {});
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/add-contract/GetSignatories`, params: {} });
|
||||
}
|
||||
@ -7,5 +7,5 @@ export default async function handler(req, res)
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetAvaliableGraphChangeTypes`, { ...{ contract_number: req.body.number }, ...req.body.variants });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/add-contract/GetAvaliableGraphChangeTypes`, params: { ...{ contract_number: req.body.number }, ...req.body.variants } });
|
||||
}
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetFineGIBDDList`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetFineGIBDDList`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetHelpCard`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetHelpCard`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetSchedulePayments`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetSchedulePayments`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetAddInfoForContract`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetAddInfoForContract`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetPlannedFines`, { contract_number: req.body.number, planned_date: req.body.date });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetPlannedFines`, params: { contract_number: req.body.number, planned_date: req.body.date } });
|
||||
}
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetRegistration`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetRegistration`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -9,5 +9,5 @@ export default async function handler(req, res)
|
||||
contract_number,
|
||||
};
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/CheckPowerAttorneyClient`, payload);
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/CheckPowerAttorneyClient`, params: payload });
|
||||
}
|
||||
@ -9,5 +9,5 @@ export default async function handler(req, res)
|
||||
contract_number,
|
||||
};
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetPowerAttorneyClient`, payload);
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetPowerAttorneyClient`, params: payload });
|
||||
}
|
||||
@ -18,5 +18,5 @@ export default async function handler(req, res)
|
||||
payload.doc_type_id = 60;
|
||||
}
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/CheckCancelDocument`, payload);
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/CheckCancelDocument`, params: payload });
|
||||
}
|
||||
@ -18,5 +18,5 @@ export default async function handler(req, res)
|
||||
payload.doc_type_id = 60;
|
||||
}
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/CancelDocument`, payload);
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/CancelDocument`, params: payload });
|
||||
}
|
||||
@ -10,5 +10,5 @@ export default async function handler(req, res)
|
||||
sign_type
|
||||
};
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/CheckCreatePrintForm`, payload);
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/CheckCreatePrintForm`, params: payload });
|
||||
}
|
||||
18
pages/api/contract/sign/document/connect.js
Normal file
18
pages/api/contract/sign/document/connect.js
Normal file
@ -0,0 +1,18 @@
|
||||
import CRMRequestGet from '../../../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "SIGN", "/document/connect");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
};
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
path: `${ process.env.CRM_API_HOST }/lk/Contract/DocEdoConnect`,
|
||||
params: payload,
|
||||
});
|
||||
}
|
||||
@ -17,5 +17,9 @@ export default async function handler(req, res)
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/File/GetWMDoc`, undefined, JSON.stringify(payload));
|
||||
await CRMRequestGet({ req, res,
|
||||
path: `${ process.env.CRM_API_HOST }/File/GetWMDoc`,
|
||||
data: JSON.stringify(payload),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}
|
||||
@ -1,10 +1,20 @@
|
||||
import CRMRequestGet from '../../../../../lib/CRMRequestGet';
|
||||
import fs from 'fs';
|
||||
import axios from 'axios';
|
||||
import { Cookies } from 'react-cookie';
|
||||
import cookie from 'cookie';
|
||||
import moment from 'moment';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { inspect } from 'util';
|
||||
|
||||
import { cors } from '../../../../../lib/cors';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "SIGN", "/document/download");
|
||||
|
||||
const { entity_name, entity_id, sign_type, evo_id } = req.body;
|
||||
await cors(req, res);
|
||||
|
||||
const { entity_name, entity_id, sign_type, evo_id } = req.query;
|
||||
const payload = {
|
||||
entityName: entity_name,
|
||||
entityId: entity_id,
|
||||
@ -17,5 +27,58 @@ export default async function handler(req, res)
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/File/GetWMDoc`, undefined, JSON.stringify(payload));
|
||||
return new Promise(async (resolve) =>
|
||||
{
|
||||
if(req.headers.cookie !== undefined)
|
||||
{
|
||||
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
|
||||
|
||||
if(cookies.jwt !== undefined && cookies.jwt !== null)
|
||||
{
|
||||
var client_jwt_decoded = jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT);
|
||||
var crm_jwt = jwt.sign({ acc_number: client_jwt_decoded.acc_number }, process.env.JWT_SECRET_CRM, { noTimestamp: true });
|
||||
|
||||
try
|
||||
{
|
||||
axios.get(`${ process.env.CRM_API_HOST }/File/GetWMDoc`, {
|
||||
data: JSON.stringify(payload),
|
||||
responseType: 'arraybuffer',
|
||||
headers: {
|
||||
"Authorization": `Bearer ${ crm_jwt }`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((crm_response) =>
|
||||
{
|
||||
res.status(200).send(crm_response.data);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error(error);
|
||||
console.error(error.data);
|
||||
|
||||
res.status(500).send(error.data);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
res.status(500).send(e);
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(403).send();
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(403).send();
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
18
pages/api/contract/sign/document/link.js
Normal file
18
pages/api/contract/sign/document/link.js
Normal file
@ -0,0 +1,18 @@
|
||||
import CRMRequestGet from '../../../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "SIGN", "/document/link");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
};
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
path: `${ process.env.CRM_API_HOST }/lk/Contract/GetFileContractProject`,
|
||||
params: payload,
|
||||
});
|
||||
}
|
||||
18
pages/api/contract/sign/document/status.js
Normal file
18
pages/api/contract/sign/document/status.js
Normal file
@ -0,0 +1,18 @@
|
||||
import CRMRequestGet from '../../../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "SIGN", "/document/status");
|
||||
|
||||
const { contract_number } = req.body;
|
||||
const payload = {
|
||||
contract_number
|
||||
};
|
||||
|
||||
console.log({ payload });
|
||||
|
||||
await CRMRequestGet({ req, res,
|
||||
path: `${ process.env.CRM_API_HOST }/lk/Contract/GetEdoProjectID`,
|
||||
params: payload,
|
||||
});
|
||||
}
|
||||
@ -9,5 +9,5 @@ export default async function handler(req, res)
|
||||
contract_number
|
||||
};
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetGUIDEntity`, payload);
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetGUIDEntity`, params: payload });
|
||||
}
|
||||
@ -2,5 +2,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/GetTelematics`, { contract_number: req.body.number });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/GetTelematics`, params: { contract_number: req.body.number } });
|
||||
}
|
||||
@ -13,5 +13,5 @@ export default async function handler(req, res)
|
||||
|
||||
const { deal_id } = req.body;
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/contract`, { ...{ opp_number: deal_id } });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/contract`, params: { ...{ opp_number: deal_id } } });
|
||||
}
|
||||
@ -7,5 +7,5 @@ import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/`, {});
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/`, params: {} });
|
||||
}
|
||||
@ -13,5 +13,5 @@ export default async function handler(req, res)
|
||||
|
||||
const { deal_id } = req.body;
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/quote`, { ...{ opp_number: deal_id } });
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/quote`, params: { ...{ opp_number: deal_id } } });
|
||||
}
|
||||
17
pages/api/edo/cancel.js
Normal file
17
pages/api/edo/cancel.js
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
2.8.1 - Метод получения доступных для работы в ЭДО ящиков (lk/Account/GetEdoBox)
|
||||
*/
|
||||
import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "EDO", "/cancel");
|
||||
|
||||
const { contract_number, doc_type_id, } = req.body;
|
||||
const payload = {
|
||||
contract_number,
|
||||
doc_type_id,
|
||||
};
|
||||
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/CancelDocument`, params: payload });
|
||||
}
|
||||
@ -8,5 +8,5 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "EDO", "/invite/send");
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Account/InviteEdoBox`, {});
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Account/InviteEdoBox`, params: {} });
|
||||
}
|
||||
@ -7,5 +7,5 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "EDO", "/invites");
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Account/GetInviteEdoBox`, {});
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Account/GetInviteEdoBox`, params: {} });
|
||||
}
|
||||
@ -7,5 +7,5 @@ export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "EDO", "/operators");
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Account/GetEdoBox`, {});
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Account/GetEdoBox`, params: {} });
|
||||
}
|
||||
@ -12,5 +12,5 @@ export default async function handler(req, res)
|
||||
edo_box,
|
||||
};
|
||||
|
||||
await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Contract/CreateEDOProject`, payload);
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/CreateEDOProject`, params: payload });
|
||||
}
|
||||
13
pages/api/edo/sign.js
Normal file
13
pages/api/edo/sign.js
Normal file
@ -0,0 +1,13 @@
|
||||
import CRMRequestGet from '../../../lib/CRMRequestGet';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "EDO", "/sign");
|
||||
|
||||
const { edoid } = req.body;
|
||||
const payload = {
|
||||
edoid,
|
||||
};
|
||||
|
||||
await CRMRequestGet({ req, res, path: `${ process.env.CRM_API_HOST }/lk/Contract/SignEDODocument`, params: payload });
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user