updates for deal EDO sign process
This commit is contained in:
parent
1b98fe1a62
commit
f702573890
@ -43,7 +43,8 @@ export const getEDOOperatorList = ({ dispatch, update = false }) =>
|
||||
dispatch({
|
||||
type: actionTypes.EDO_OPERATORS_LIST,
|
||||
data: {
|
||||
operators: response.data.box_edo
|
||||
operators: response.data.box_edo,
|
||||
message: response.data.message,
|
||||
}
|
||||
});
|
||||
|
||||
@ -57,7 +58,8 @@ export const getEDOOperatorList = ({ dispatch, update = false }) =>
|
||||
dispatch({
|
||||
type: actionTypes.EDO_OPERATORS_LIST,
|
||||
data: {
|
||||
operators: []
|
||||
operators: [],
|
||||
message: "Невозможно получить список операторов ЭДО",
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ export default class DealsList extends React.Component
|
||||
if(dealSelected === deal.opp_number)
|
||||
{
|
||||
return (<SingleDeal
|
||||
router={ this.props.router }
|
||||
key={ index }
|
||||
index={ index }
|
||||
ref={ ref => this.items_ref[index] = ref }
|
||||
|
||||
@ -1126,6 +1126,13 @@ class LeasingRegistration extends Step
|
||||
});
|
||||
}
|
||||
|
||||
_handle_onGoToEDOInvites = () =>
|
||||
{
|
||||
console.log("_handle_onGoToEDOInvites", { props: this.props });
|
||||
|
||||
this.props.router.push("/settings/digital");
|
||||
}
|
||||
|
||||
_getDocuments = () =>
|
||||
{
|
||||
const contracts = this.props.contracts['prepared_contracts'];
|
||||
@ -1164,6 +1171,7 @@ class LeasingRegistration extends Step
|
||||
documents={ this._getDocuments() }
|
||||
onCancel={ this._handle_onCancelEDO }
|
||||
onFinish={ this._handle_onFinishEDO }
|
||||
onGoToEDOInvites={ this._handle_onGoToEDOInvites }
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -186,6 +186,7 @@ class DealsStatus extends React.Component
|
||||
</div>
|
||||
<DealsList
|
||||
dispatch={ this.props.dispatch }
|
||||
router={ this.props.router }
|
||||
status={ status }
|
||||
deals={ deals }
|
||||
questionnaire_status={ questionnaire_status }
|
||||
|
||||
@ -17,6 +17,7 @@ class EDOSign extends React.Component
|
||||
this.state = {
|
||||
finished: false,
|
||||
operators: null,
|
||||
edo_message: null,
|
||||
loading: false,
|
||||
disabled: false,
|
||||
documents: [],
|
||||
@ -31,6 +32,7 @@ class EDOSign extends React.Component
|
||||
console.log("EDOSign", "getDerivedStateFromProps", { nextProps });
|
||||
return {
|
||||
operators: nextProps.operators,
|
||||
edo_message: nextProps.edo_message,
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,7 +264,12 @@ class EDOSign extends React.Component
|
||||
}
|
||||
else
|
||||
{
|
||||
await this._updateDocs(document.index, { loading: false, error: true, ready: true, message: "Возникла ошибка при создании документа для подписания." });
|
||||
await this._updateDocs(document.index, {
|
||||
loading: false,
|
||||
error: true,
|
||||
ready: true,
|
||||
message: create_print_form_result.message !== undefined && create_print_form_result.message !== null ? create_print_form_result.message : "Возникла ошибка при создании документа для подписания.",
|
||||
});
|
||||
callback();
|
||||
}
|
||||
}
|
||||
@ -285,35 +292,42 @@ class EDOSign extends React.Component
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
const { onFinish } = this.props;
|
||||
const { operator_selected, step, finished } = this.state;
|
||||
const { onFinish, onGoToEDOInvites } = this.props;
|
||||
const { operators, operator_selected, step, finished } = this.state;
|
||||
const documents = [ ...this.state.documents ];
|
||||
|
||||
console.log("_handle_onFormSubmit");
|
||||
console.log({ documents, operator_selected });
|
||||
|
||||
if(finished)
|
||||
if(operators !== null && operators.length === 0)
|
||||
{
|
||||
onFinish();
|
||||
onGoToEDOInvites();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(step)
|
||||
if(finished)
|
||||
{
|
||||
case 0:
|
||||
onFinish();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(step)
|
||||
{
|
||||
this.setState({ step: 1 }, () =>
|
||||
case 0:
|
||||
{
|
||||
this.setState({ step: 1 }, () =>
|
||||
{
|
||||
this._sign();
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
this._sign();
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
this._sign();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -431,7 +445,7 @@ class EDOSign extends React.Component
|
||||
|
||||
render()
|
||||
{
|
||||
const { step, operators, documents, loading, disabled, finished, operator_selected } = this.state;
|
||||
const { step, operators, edo_message, documents, loading, disabled, finished, operator_selected } = this.state;
|
||||
const { onCancel, } = this.props;
|
||||
console.log({ operators, documents });
|
||||
|
||||
@ -443,20 +457,33 @@ class EDOSign extends React.Component
|
||||
{ step === 0 && (
|
||||
<div className="form_field edo_list_field">
|
||||
<label>Выберите оператора для отправки пакета документов</label>
|
||||
<div className="edo_list_selection">
|
||||
{ operators !== undefined && operators !== null && operators.map((operator, index) => (
|
||||
<div className="form_field checkbox item" key={ index }>
|
||||
<input type="radio"
|
||||
checked={ operator.box_id === operator_selected.box_id }
|
||||
hidden=""
|
||||
id={ `operator_${ index }` }
|
||||
name={ `operator_${ index }` }
|
||||
onChange={ (event) => this._handle_onSelectOperator(operator) }
|
||||
disabled={ false }
|
||||
/>
|
||||
<label htmlFor={ `operator_${ index }` } className="unselectable">{ operator.provider_edo }</label>
|
||||
</div>
|
||||
)) }
|
||||
<div className="edo_list_selection edo_sign_documents_document" style={{ flexDirection: "column", border: "none", padding: "0px 0px 0px 15px", }}>
|
||||
{ operators !== undefined && operators !== null && (
|
||||
<>
|
||||
{ operators.length === 0 ? (
|
||||
<div className="edo_sign_documents_document_right" style={{ border: "none", }}>
|
||||
<div className="status_icon await"></div>
|
||||
<div className="status_title">
|
||||
<i>{ edo_message }</i>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
operators.map((operator, index) => (
|
||||
<div className="form_field checkbox item" key={ index }>
|
||||
<input type="radio"
|
||||
checked={ operator.box_id === operator_selected.box_id }
|
||||
hidden=""
|
||||
id={ `operator_${ index }` }
|
||||
name={ `operator_${ index }` }
|
||||
onChange={ (event) => this._handle_onSelectOperator(operator) }
|
||||
disabled={ false }
|
||||
/>
|
||||
<label htmlFor={ `operator_${ index }` } className="unselectable">{ operator.provider_edo }</label>
|
||||
</div>
|
||||
) )
|
||||
)}
|
||||
</>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
@ -578,6 +605,7 @@ function mapStateToProps(state, ownProps)
|
||||
console.log("EDOSign", "mapStateToProps", { state: state });
|
||||
return {
|
||||
operators: state.edo.operators,
|
||||
edo_message: state.edo.message,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,24 +18,34 @@ export default class FileDropzoneDeals extends FileDropzone
|
||||
const { uploaded, onAddFile, onDeleteFile, uploading, document, } = this.props;
|
||||
console.log("FileDropzoneDeals", { uploaded, document });
|
||||
|
||||
let show_comment = false;
|
||||
if(document.comment !== null && document.comment !== "")
|
||||
{
|
||||
show_comment = true;
|
||||
if(!uploaded.sent)
|
||||
{
|
||||
show_comment = false;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{ show_comment && (
|
||||
<div className="horizontal_dropzone_files_item horizontal_dropzone_files_error">
|
||||
<p className="horizontal_dropzone_files_comment">
|
||||
<span>{ document.check }</span>
|
||||
<span>{ document.comment }</span>
|
||||
</p>
|
||||
</div>
|
||||
) }
|
||||
{ uploaded.files.length > 0 && (
|
||||
<div className="horizontal_dropzone_files_wrapper">
|
||||
{ document.comment !== null && document.comment !== "" && (
|
||||
<div className="horizontal_dropzone_files_item horizontal_dropzone_files_error">
|
||||
<p className="horizontal_dropzone_files_comment">
|
||||
<span>{ document.check }</span>
|
||||
<span>{ document.comment }</span>
|
||||
</p>
|
||||
</div>
|
||||
) }
|
||||
<div className="horizontal_dropzone_files horizontal_dropzone_files_item">
|
||||
{ uploaded.files.map((file, index) =>
|
||||
{
|
||||
return (
|
||||
<div className="file" key={ index }>
|
||||
{ file.sent ? (
|
||||
{ uploaded.sent ? (
|
||||
<div className="delete" onClick={ () => onDeleteFile(file.group, index) }>
|
||||
<div className="icon"></div>
|
||||
</div>
|
||||
|
||||
@ -6169,13 +6169,13 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0px 20px;
|
||||
padding-top: 15px;
|
||||
padding: 15px 0px;
|
||||
}
|
||||
.horizontal_dropzone_files_wrapper .horizontal_dropzone_files_item {
|
||||
width: 100%;
|
||||
}
|
||||
.horizontal_dropzone_files_wrapper .horizontal_dropzone_files_error {
|
||||
padding-bottom: 24px;
|
||||
.horizontal_dropzone_files_error {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.horizontal_dropzone_files_comment {
|
||||
background: rgba(131, 3, 84, 0.1);
|
||||
|
||||
@ -7099,15 +7099,15 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0px 20px;
|
||||
padding-top: 15px;
|
||||
padding: 15px 0px;
|
||||
|
||||
.horizontal_dropzone_files_item {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.horizontal_dropzone_files_error {
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
.horizontal_dropzone_files_error {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.horizontal_dropzone_files_comment {
|
||||
|
||||
@ -45,7 +45,6 @@ export default async function handler(req, res)
|
||||
index,
|
||||
type,
|
||||
lastModified,
|
||||
sent: true
|
||||
};
|
||||
|
||||
try
|
||||
|
||||
@ -160,6 +160,7 @@ export default async function handler(req, res)
|
||||
eachSeries(Object.keys(deals[ deal_id ].uploaded), (group, callback) =>
|
||||
{
|
||||
const document = deals[ deal_id ].uploaded[ group ];
|
||||
deals[ deal_id ].uploaded[ group ].sent = true;
|
||||
console.log({ group, document });
|
||||
|
||||
if(document.files.length === 1)
|
||||
@ -201,40 +202,11 @@ export default async function handler(req, res)
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
if(fs.existsSync(`${ uploads }${ file.filename }`))
|
||||
{
|
||||
*/
|
||||
/*
|
||||
|
||||
*/
|
||||
/*
|
||||
}
|
||||
else
|
||||
{
|
||||
callback();
|
||||
}
|
||||
*/
|
||||
/*
|
||||
console.log({ file_upload_url });
|
||||
|
||||
*/
|
||||
/*
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e)
|
||||
callback();
|
||||
}
|
||||
*/
|
||||
}, () =>
|
||||
}, async () =>
|
||||
{
|
||||
console.log("ALL FILES SENT");
|
||||
await RedisClient.set(key, JSON.stringify(deals));
|
||||
|
||||
res.status(200).json({});
|
||||
resolve();
|
||||
});
|
||||
@ -256,65 +228,6 @@ export default async function handler(req, res)
|
||||
res.status(403).json({});
|
||||
resolve();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
const payload = new URLSearchParams({
|
||||
name: number,
|
||||
entity: entity,
|
||||
documentTypeNumber: id,
|
||||
documentName: filename,
|
||||
});
|
||||
const path = `${ process.env.CRM_API_HOST }/lk/document/upload?${ payload.toString() }`;
|
||||
console.log({ path });
|
||||
|
||||
upload.single("file")(req, {}, err =>
|
||||
{
|
||||
const { file } = req;
|
||||
file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf8');
|
||||
|
||||
const data = new FormData();
|
||||
data.append("file", file.buffer, file.originalname);
|
||||
|
||||
try
|
||||
{
|
||||
axios.post(path, data,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": `multipart/form-data; boundary=${ data._boundary }`,
|
||||
"Authorization": `Bearer ${ crm_jwt }`,
|
||||
},
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((crm_response) =>
|
||||
{
|
||||
console.log("/lk/document/upload SUCCESS");
|
||||
res.status(200).json(crm_response.data);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("-".repeat(30), "error.response.data:");
|
||||
console.error(error.response);
|
||||
|
||||
res.status(500).json(error.response.data);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
res.status(500).send(e);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(403).send();
|
||||
resolve();
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -316,7 +316,11 @@ class IndexPage extends React.Component
|
||||
) }
|
||||
|
||||
{/*}{*/}
|
||||
<DealsStatus questionnaire_status={ company.questionnaire_status } onQuestionnaire={ this._handle_onQuestionnaire }/>
|
||||
<DealsStatus
|
||||
questionnaire_status={ company.questionnaire_status }
|
||||
onQuestionnaire={ this._handle_onQuestionnaire }
|
||||
router={ this.props.router }
|
||||
/>
|
||||
{/*}{*/}
|
||||
|
||||
{ contracts !== null && contracts.length > 0 && (
|
||||
|
||||
@ -21,11 +21,13 @@ const edoReducer = (state = initialState.edo, action) =>
|
||||
console.log({
|
||||
...state,
|
||||
operators: action.data.operators,
|
||||
message: action.data.message,
|
||||
});
|
||||
|
||||
return {
|
||||
...state,
|
||||
operators: action.data.operators,
|
||||
message: action.data.message,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -257,6 +257,7 @@ export const defaultState = {
|
||||
loaded: false,
|
||||
operators: null,
|
||||
invites: null,
|
||||
message: null,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user