Merge branch 'master' of https://github.com/merelendor/evoleasing-account
This commit is contained in:
commit
eb401096f3
@ -100,7 +100,7 @@ export const getDealOffers = ({ dispatch, deal_id }) =>
|
||||
list: []
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
reject();
|
||||
});
|
||||
});
|
||||
@ -111,32 +111,26 @@ export const acceptDealOffers = ({ deal_id, offers }) =>
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/deals/accept`;
|
||||
|
||||
console.log("ACTION", "deals", "acceptDealOffers()", { url });
|
||||
console.log("ACTION", "deals", "acceptDealOffers()", { deal_id, });
|
||||
console.log("ACTION", "deals", "acceptDealOffers()", { deal_id, offers, });
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
eachSeries(offers, (offer_id, callback) =>
|
||||
axios.post(url, { deal_id, offers }, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
axios.post(url, { deal_id, offer_id }, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
console.log("ACTION", "deals", "acceptDealOffers()", "response", response.data);
|
||||
console.log("ACTION", "deals", "acceptDealOffers()", "response", response.data);
|
||||
|
||||
callback();
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("ACTION", "deals", "acceptDealOffers()", "ERROR");
|
||||
console.error(error);
|
||||
|
||||
callback();
|
||||
});
|
||||
}, () =>
|
||||
{
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("ACTION", "deals", "acceptDealOffers()", "ERROR");
|
||||
console.error(error);
|
||||
|
||||
reject();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import moment from 'moment';
|
||||
import fileDownload from 'js-file-download';
|
||||
|
||||
import * as actionTypes from '../constants/actionTypes';
|
||||
import { logDocumentAccess } from './logsActions';
|
||||
|
||||
if(process.browser)
|
||||
{
|
||||
@ -166,6 +167,13 @@ export const getReconciliationFile = ({ contract, date_from, date_to, filename }
|
||||
.then((response) =>
|
||||
{
|
||||
fileDownload(response.data, filename);
|
||||
logDocumentAccess({
|
||||
contract_number: contract,
|
||||
document_type: "act_bu",
|
||||
document_period_from: date_from,
|
||||
document_period_to: date_to,
|
||||
});
|
||||
|
||||
resolve();
|
||||
})
|
||||
.catch((error) =>
|
||||
|
||||
40
actions/logsActions.js
Normal file
40
actions/logsActions.js
Normal file
@ -0,0 +1,40 @@
|
||||
import axios from 'axios';
|
||||
import { Cookies } from 'react-cookie';
|
||||
import Router from 'next/router';
|
||||
import moment from 'moment';
|
||||
import { nSQL } from "@nano-sql/core";
|
||||
import { eachSeries } from 'async';
|
||||
|
||||
import * as actionTypes from '../constants/actionTypes';
|
||||
import * as currentState from '../reducers/initialState';
|
||||
|
||||
export const logDocumentAccess = ({ payload }) =>
|
||||
{
|
||||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/logs/track`;
|
||||
|
||||
console.log("ACTION", "deals", "logDocumentAccess()", { url });
|
||||
console.log("ACTION", "deals", "logDocumentAccess()", { payload });
|
||||
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
payload.lk_user_id = global.store.getState().user;
|
||||
payload.acc_number = global.store.getState().company.active;
|
||||
|
||||
axios.post(url, payload, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response) =>
|
||||
{
|
||||
console.log("ACTION", "deals", "logDocumentAccess()", "response", response.data);
|
||||
|
||||
resolve();
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
console.error("ACTION", "deals", "logDocumentAccess()", "ERROR");
|
||||
console.error(error);
|
||||
|
||||
reject();
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -63,7 +63,7 @@ export default class DealsListDeal extends React.Component
|
||||
return (
|
||||
<div className="list_item">
|
||||
<div>
|
||||
<p>Сделка { index + 1 }</p>
|
||||
<p>№ { opp_number }</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
|
||||
@ -100,8 +100,17 @@ class Offers extends Step
|
||||
{
|
||||
const { checked } = this.state;
|
||||
const { dealSelected, onDealsUpdate } = this.props;
|
||||
const offers = [];
|
||||
|
||||
acceptDealOffers({ deal_id: dealSelected, offers: checked })
|
||||
for(let i in checked)
|
||||
{
|
||||
offers.push({
|
||||
quote_numbers: checked[i],
|
||||
agreed: true,
|
||||
});
|
||||
}
|
||||
|
||||
acceptDealOffers({ deal_id: dealSelected, offers })
|
||||
.then(() =>
|
||||
{
|
||||
onDealsUpdate()
|
||||
@ -135,12 +144,12 @@ class Offers extends Step
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id, offers } = this.props;
|
||||
const { index, statuscode_id, dealSelected, offers } = this.props;
|
||||
const { checked, open, loading } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<p>Сделка { index + 1 }</p>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Выбор КП ") }
|
||||
@ -223,12 +232,12 @@ class FinancialProgram extends Step
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id } = this.props;
|
||||
const { index, statuscode_id, dealSelected } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<p>Сделка { index + 1 }</p>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Программа финансирования") }
|
||||
@ -322,14 +331,14 @@ class DocumentsForm extends Step
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id, documents, questionnaire_status } = this.props;
|
||||
const { index, statuscode_id, dealSelected, documents, questionnaire_status } = this.props;
|
||||
const { open, files } = this.state;
|
||||
|
||||
console.log("DocumentsForm", { documents });
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<p>Сделка { index + 1 }</p>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Сборка пакета документов") }
|
||||
@ -416,12 +425,12 @@ class StatusDocumentsCheck extends Step
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id } = this.props;
|
||||
const { index, statuscode_id, dealSelected } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<p>Сделка { index + 1 }</p>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Проверка документов") }
|
||||
@ -449,7 +458,7 @@ class StatusDecisionMaking extends Step
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id } = this.props;
|
||||
const { index, statuscode_id, dealSelected } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
@ -482,12 +491,12 @@ class StatusLeasingRegistration extends Step
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id } = this.props;
|
||||
const { index, statuscode_id, dealSelected } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<p>Сделка { index + 1 }</p>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Принято положительное решение") }
|
||||
@ -682,12 +691,12 @@ class SigningTypeSelection extends Step
|
||||
|
||||
render()
|
||||
{
|
||||
const { index, statuscode_id } = this.props;
|
||||
const { index, statuscode_id, dealSelected } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
return (
|
||||
<div className={`${ this.status.indexOf( statuscode_id ) > -1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}>
|
||||
<p>Сделка { index + 1 }</p>
|
||||
<p>№ { dealSelected }</p>
|
||||
<span></span>
|
||||
<div className="status_body">
|
||||
{ this._renderHeader("Оформление лизинга") }
|
||||
|
||||
22
components/LogFileDownload/index.js
Normal file
22
components/LogFileDownload/index.js
Normal file
@ -0,0 +1,22 @@
|
||||
import React from "react";
|
||||
import { logDocumentAccess } from "../../actions/logsActions";
|
||||
|
||||
export default class LogFileDownload extends React.Component
|
||||
{
|
||||
_log = () =>
|
||||
{
|
||||
const{ log } = this.props;
|
||||
|
||||
if(log !== undefined)
|
||||
{
|
||||
const { log } = this.props;
|
||||
|
||||
console.log("LOG", "LogFileDownload", { props: this.props });
|
||||
console.log("LOG", "LogFileDownload", { log });
|
||||
|
||||
logDocumentAccess(log)
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5393,6 +5393,9 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
|
||||
white-space: nowrap;
|
||||
gap: 0 8px;
|
||||
}
|
||||
.contractStatus_list .list_item :first-child {
|
||||
min-width: 60px;
|
||||
}
|
||||
.contractStatus_list .list_item:not(:last-child) {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
@ -6107,6 +6107,10 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
|
||||
}
|
||||
}
|
||||
|
||||
:first-child {
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 5px;
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import jwt from 'jsonwebtoken';
|
||||
import { cors } from '../cors';
|
||||
import { inspect } from 'util';
|
||||
|
||||
export default async function CRMRequestPost(req, res, path, params)
|
||||
export default async function CRMRequestPost(req, res, path, params, array = false)
|
||||
{
|
||||
await cors(req, res);
|
||||
|
||||
@ -16,28 +16,28 @@ export default async function CRMRequestPost(req, res, path, params)
|
||||
const cookies = cookie.parse(req.headers?.cookie ? req.headers?.cookie : "");
|
||||
|
||||
//console.log("-".repeat(50));
|
||||
|
||||
//console.log("CRMRequestPost", "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 });
|
||||
|
||||
const payload = { ...{ acc_number: client_jwt_decoded.acc_number }, ...params };
|
||||
let payload;
|
||||
if(array)
|
||||
{
|
||||
payload = params;
|
||||
}
|
||||
else
|
||||
{
|
||||
payload = { ...{ acc_number: client_jwt_decoded.acc_number }, ...params };
|
||||
}
|
||||
//console.log("path", path);
|
||||
|
||||
//console.log("payload", payload);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
await axios.post(path, payload,
|
||||
|
||||
@ -41,6 +41,28 @@ class Doc extends Document
|
||||
<body>
|
||||
<Main/>
|
||||
<NextScript />
|
||||
|
||||
<script type="text/javascript" dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
||||
m[i].l=1*new Date();
|
||||
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
||||
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
|
||||
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
|
||||
|
||||
ym(94928044, "init", {
|
||||
clickmap:true,
|
||||
trackLinks:true,
|
||||
accurateTrackBounce:true,
|
||||
webvisor:true,
|
||||
});
|
||||
`, }}
|
||||
/>
|
||||
<noscript>
|
||||
<div>
|
||||
<img src="https://mc.yandex.ru/watch/94928044" style={{ position:'absolute', left:'-9999px' }} alt=""/>
|
||||
</div>
|
||||
</noscript>
|
||||
</body>
|
||||
</Html>
|
||||
)
|
||||
|
||||
@ -10,7 +10,10 @@ export default async function handler(req, res)
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
|
||||
const { deal_id, offer_id } = req.body;
|
||||
const { deal_id, offers } = req.body;
|
||||
|
||||
await CRMRequestPost(req, res, `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/quote/`, { ...{ opp_number: deal_id, quote_number: offer_id, agreed: true } });
|
||||
console.log("/accept");
|
||||
console.log({ offers });
|
||||
|
||||
await CRMRequestPost(req, res, `${ process.env.CRM_API_HOST }/lk/ConsiderationOpportunity/quote?opp_number=${ deal_id }`, offers, true);
|
||||
}
|
||||
10
pages/api/logs/track.js
Normal file
10
pages/api/logs/track.js
Normal file
@ -0,0 +1,10 @@
|
||||
import CRMRequestPost from '../../../lib/CRMRequestPost';
|
||||
|
||||
export default async function handler(req, res)
|
||||
{
|
||||
console.log("API", "LOGS", "track");
|
||||
console.log(req.body);
|
||||
console.log("-".repeat(50));
|
||||
|
||||
await CRMRequestPost(req, res, `${ process.env.LOGS_API_HOST }/lk/DownloadDocumentFromLK`, req.body, true);
|
||||
}
|
||||
@ -2,8 +2,9 @@ import React from "react";
|
||||
import { SpinnerCircular } from 'spinners-react';
|
||||
|
||||
import { getFile } from "../../../actions";
|
||||
import LogFileDownload from "../../../components/LogFileDownload";
|
||||
|
||||
export default class DownloadFileById extends React.Component
|
||||
export default class DownloadFileById extends LogFileDownload
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
@ -23,7 +24,11 @@ export default class DownloadFileById extends React.Component
|
||||
this.setState({ downloading: true }, () =>
|
||||
{
|
||||
getFile({ id, filename })
|
||||
.then(() => { this.setState({ downloading: false }); })
|
||||
.then(() =>
|
||||
{
|
||||
if(this._log !== undefined) { this._log(); }
|
||||
this.setState({ downloading: false });
|
||||
})
|
||||
.catch(() => { this.setState({ downloading: false }); });
|
||||
});
|
||||
}
|
||||
|
||||
@ -2,8 +2,9 @@ import React from "react";
|
||||
import { SpinnerCircular } from 'spinners-react';
|
||||
|
||||
import { getFineBeforeAccrualFile, getFineAfterAccrualFile } from "../../../actions";
|
||||
import LogFileDownload from "../../../components/LogFileDownload";
|
||||
|
||||
export default class DownloadFinesPdfButton extends React.Component
|
||||
export default class DownloadFinesPdfButton extends LogFileDownload
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
@ -25,13 +26,21 @@ export default class DownloadFinesPdfButton extends React.Component
|
||||
if(before)
|
||||
{
|
||||
getFineBeforeAccrualFile({ contract, num, filename })
|
||||
.then(() => { this.setState({ downloading: false }); })
|
||||
.then(() =>
|
||||
{
|
||||
if(this._log !== undefined) { this._log(); }
|
||||
this.setState({ downloading: false });
|
||||
})
|
||||
.catch(() => { this.setState({ downloading: false }); });
|
||||
}
|
||||
else
|
||||
{
|
||||
getFineAfterAccrualFile({ contract, num, filename })
|
||||
.then(() => { this.setState({ downloading: false }); })
|
||||
.then(() =>
|
||||
{
|
||||
if(this._log !== undefined) { this._log(); }
|
||||
this.setState({ downloading: false });
|
||||
})
|
||||
.catch(() => { this.setState({ downloading: false }); });
|
||||
}
|
||||
});
|
||||
|
||||
@ -2,8 +2,9 @@ import React from "react";
|
||||
import { SpinnerCircular } from 'spinners-react';
|
||||
|
||||
import { getFile, getBitrixFile } from "../../../actions";
|
||||
import LogFileDownload from "../../../components/LogFileDownload";
|
||||
|
||||
export default class DownloadPdfButton extends React.Component
|
||||
export default class DownloadPdfButton extends LogFileDownload
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
@ -25,13 +26,21 @@ export default class DownloadPdfButton extends React.Component
|
||||
if(bitrix)
|
||||
{
|
||||
getBitrixFile({ url, filename })
|
||||
.then(() => { this.setState({ downloading: false }); })
|
||||
.then(() =>
|
||||
{
|
||||
if(this._log !== undefined) { this._log(); }
|
||||
this.setState({ downloading: false });
|
||||
})
|
||||
.catch(() => { this.setState({ downloading: false }); });
|
||||
}
|
||||
else
|
||||
{
|
||||
getFile({ id, filename })
|
||||
.then(() => { this.setState({ downloading: false }); })
|
||||
.then(() =>
|
||||
{
|
||||
if(this._log !== undefined) { this._log(); }
|
||||
this.setState({ downloading: false });
|
||||
})
|
||||
.catch(() => { this.setState({ downloading: false }); });
|
||||
}
|
||||
});
|
||||
|
||||
@ -2,8 +2,9 @@ import React from "react";
|
||||
import { SpinnerCircular } from 'spinners-react';
|
||||
|
||||
import { getPrintFile } from "../../../actions";
|
||||
import LogFileDownload from "../../../components/LogFileDownload";
|
||||
|
||||
export default class DownloadPrintFormPdfButton extends React.Component
|
||||
export default class DownloadPrintFormPdfButton extends LogFileDownload
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
@ -25,6 +26,7 @@ export default class DownloadPrintFormPdfButton extends React.Component
|
||||
getPrintFile({ contract, num, date, type, filename })
|
||||
.then(() =>
|
||||
{
|
||||
if(this._log !== undefined) { this._log(); }
|
||||
this.setState({ downloading: false });
|
||||
})
|
||||
.catch(() =>
|
||||
|
||||
@ -106,6 +106,7 @@ class ContractPage extends React.Component
|
||||
return documents[ type ].map((file, file_index) =>
|
||||
{
|
||||
//console.log("file", file);
|
||||
console.log({ file });
|
||||
|
||||
return (
|
||||
<div className="row" key={ file_index }>
|
||||
@ -116,7 +117,16 @@ class ContractPage extends React.Component
|
||||
</span>
|
||||
{ file.type !== undefined && (<span>{ file.type }</span>) }
|
||||
</p>
|
||||
<DownloadPdfButton id={ file.url } filename={`evoleasing_${ types[ type ] }_${ file.type }_${ file.number }_${ file.date }.${ file.extension }`} />
|
||||
<DownloadPdfButton
|
||||
id={ file.url }
|
||||
filename={`evoleasing_${ types[ type ] }_${ file.type }_${ file.number }_${ file.date }.${ file.extension }`}
|
||||
log={{
|
||||
contract_number: this.props.number,
|
||||
document_type: type,
|
||||
document_date: file.date,
|
||||
description: file.type,
|
||||
}}
|
||||
/>
|
||||
{/*}
|
||||
<a className="button button-blue">Подписать по ЭДО</a>
|
||||
{*/}
|
||||
@ -133,12 +143,9 @@ class ContractPage extends React.Component
|
||||
let { date, car, status } = contracts_info[ number ] !== undefined ? contracts_info[ number ] : {};
|
||||
|
||||
//console.log("rules", rules);
|
||||
|
||||
//console.log("unsigned", unsigned);
|
||||
|
||||
//console.log("signed", signed);
|
||||
|
||||
|
||||
const types = {
|
||||
contracts: "Договор",
|
||||
redemptions: "Выкупные документы",
|
||||
@ -147,6 +154,8 @@ class ContractPage extends React.Component
|
||||
act_pp: "Акт приема-передачи",
|
||||
};
|
||||
|
||||
console.log({ agreement_props: this.props });
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Head>
|
||||
@ -198,7 +207,11 @@ class ContractPage extends React.Component
|
||||
Дата вступления в силу: { document.active_from }
|
||||
</span>
|
||||
</p>
|
||||
<DownloadPdfButton url={ document.url } filename={ document.filename } bitrix={ true } />
|
||||
<DownloadPdfButton
|
||||
url={ document.url }
|
||||
filename={ document.filename }
|
||||
bitrix={ true }
|
||||
/>
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
|
||||
@ -167,13 +167,17 @@ class ContractDocumentsPage extends React.Component
|
||||
>
|
||||
{doc.num} от {moment(doc.date).format("DD.MM.YYYY")}
|
||||
</p>
|
||||
<DownloadPrintFormPdfButton
|
||||
className="download-icon"
|
||||
filename={`${number}_${doc.type}_${doc.num}.${doc.extension}`}
|
||||
contract={number}
|
||||
num={doc.num}
|
||||
date={doc.date}
|
||||
type={doc.type}
|
||||
<DownloadPrintFormPdfButton
|
||||
className="download-icon"
|
||||
filename={ `${ number }_${ doc.type }_${ doc.num }.${ doc.extension }` }
|
||||
contract={ number }
|
||||
num={ doc.num }
|
||||
date={ doc.date }
|
||||
type={ doc.type }
|
||||
contract_number={ number }
|
||||
document_type={ doc.type }
|
||||
document_name={ doc.num }
|
||||
document_date={ doc.date }
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -123,6 +123,8 @@ class ContractFinesPage extends React.Component
|
||||
|
||||
if (fines.length > 0)
|
||||
{
|
||||
console.log({ fines });
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="dropdown_blocks_list">
|
||||
@ -140,14 +142,12 @@ class ContractFinesPage extends React.Component
|
||||
{moment(fine.violation_date).format("DD.MM.YYYY")}
|
||||
</b>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Сумма:{" "}
|
||||
<b style={{ whiteSpace: "nowrap" }}>
|
||||
{numeral(fine.amount).format(" ., ")} ₽
|
||||
</b>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Статус:{" "}
|
||||
<b className={status[fine.status_code]}>
|
||||
@ -155,7 +155,6 @@ class ContractFinesPage extends React.Component
|
||||
</b>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
{ fine.violation_place !== undefined && fine.violation_place !== null && (
|
||||
<li>
|
||||
@ -169,7 +168,7 @@ class ContractFinesPage extends React.Component
|
||||
)}
|
||||
</ul>
|
||||
<p className="fines_doc">
|
||||
Штраф: {fine.fine_title}
|
||||
Штраф: { fine.fine_title }
|
||||
</p>
|
||||
</div>
|
||||
{ fine.status_code !== "PaidIndependently" && (
|
||||
@ -181,14 +180,17 @@ class ContractFinesPage extends React.Component
|
||||
>
|
||||
Счет на оплату
|
||||
</p>
|
||||
<DownloadFinesPdfButton
|
||||
className="download-icon"
|
||||
filename={`evolution_fine_${fine.fine_number}.pdf`}
|
||||
before={
|
||||
fine.status_code === "NotPaid" ? true : false
|
||||
}
|
||||
contract={number}
|
||||
num={fine.fine_number}
|
||||
<DownloadFinesPdfButton
|
||||
className="download-icon"
|
||||
filename={ `evolution_fine_${ fine.fine_number }.pdf` }
|
||||
before={ fine.status_code === "NotPaid" ? true : false }
|
||||
contract={ number }
|
||||
num={ fine.fine_number }
|
||||
contract_number={ number }
|
||||
document_type={ "finegibdd" }
|
||||
document_name={ fine.fine_number }
|
||||
document_date={ fine.fine_date }
|
||||
description={ `Место нарушения: ${ fine.violation_place } Дата нарушения: ${ fine.violation_date }` }
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -20,6 +20,71 @@ import AccountLayout from "../components/Layout/Account";
|
||||
import ContractHeader from "./components/ContractHeader";
|
||||
import DownloadFileById from "../components/DownloadFileById";
|
||||
|
||||
class Insurance extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props);
|
||||
}
|
||||
|
||||
render()
|
||||
{
|
||||
const { type, title, entry, index, } = this.props;
|
||||
|
||||
return (
|
||||
<React.Fragment key={ index }>
|
||||
<div className={ `company ${ entry.period_type === "prolong" && "filled" }` }>
|
||||
<p className="title">{ title }</p>
|
||||
<ul>
|
||||
{ entry.company && (<li>Страховая компания: <b>{ entry.company }</b></li>) }
|
||||
{ entry.site && (<li>Сайт: <b>{ entry.site }</b></li>) }
|
||||
{ entry.phone && (<li>Телефон: <b>{ entry.phone }</b></li>) }
|
||||
{ entry.number && (
|
||||
<li>Номер полиса: { entry.url !== null ? (
|
||||
<DownloadFileById
|
||||
id={ entry.url }
|
||||
filename={ `${ entry.number }.${ entry.extension}` }
|
||||
log={{
|
||||
contract_number: number,
|
||||
document_type: `${ entry.period_type }_polis_${ type }`,
|
||||
document_name: entry.number,
|
||||
description: entry.period,
|
||||
}}
|
||||
>
|
||||
<b style={{ color: "#1C01A9", cursor: "pointer", }}>{ entry.number }</b>
|
||||
</DownloadFileById>
|
||||
) : (<b>{ entry.number }</b>) }
|
||||
</li>
|
||||
) }
|
||||
{ entry.period && (<li>Период действия: <b>{ entry.period }</b></li>) }
|
||||
{ entry.amount && (<li>Страховая сумма: <b style={{ whiteSpace: "nowrap" }}>{ numeral(entry.amount).format(' ., ') } ₽</b></li>) }
|
||||
{ type === "kasko" && entry.period_type === "prolong" && (
|
||||
<li className="alert">Обращаем Ваше внимание, что пролонгация полиса ОСАГО на второй и последующие периоды осуществляется Лизингополучателем самостоятельно</li>
|
||||
) }
|
||||
</ul>
|
||||
{ entry.period_type === "prolong" && entry.invoice_url !== null && (
|
||||
<div className="action">
|
||||
<DownloadPdfButton
|
||||
id={ entry.invoice_url }
|
||||
filename={ `${ entry.number }.${ entry.invoice_extension}` }
|
||||
title="Скачать счет на оплату"
|
||||
class={ "services_invoice_button" }
|
||||
log={{
|
||||
contract_number: number,
|
||||
document_type: `${ entry.period_type }_polis_${ type }_invoice`,
|
||||
document_name: entry.number,
|
||||
description: entry.period,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
{ entry.description && (<p>{ entry.description }</p>) }
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class ContractServicesPage extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
@ -170,8 +235,7 @@ class ContractServicesPage extends React.Component
|
||||
|
||||
let { date, car, status } = contracts_info[ number ] !== undefined ? contracts_info[ number ] : {};
|
||||
|
||||
//console.log("insurance", insurance);
|
||||
|
||||
console.log("insurance", { insurance, props: this.props });
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
@ -248,115 +312,16 @@ class ContractServicesPage extends React.Component
|
||||
{ this._checkInsuranceAvailable() ? (
|
||||
<div className="block_body full">
|
||||
{ insurance.kasko !== undefined && insurance.kasko !== null && insurance.kasko !== "" && insurance.kasko.map !== undefined && insurance.kasko.map((entry, index) => (
|
||||
<React.Fragment key={ index }>
|
||||
<div className={ `company ${ entry.period_type === "prolong" && "filled" }` }>
|
||||
<p className="title">КАСКО</p>
|
||||
<ul>
|
||||
{ entry.company && (<li>Страховая компания: <b>{ entry.company }</b></li>) }
|
||||
{ entry.site && (<li>Сайт: <b>{ entry.site }</b></li>) }
|
||||
{ entry.phone && (<li>Телефон: <b>{ entry.phone }</b></li>) }
|
||||
{ entry.number && (
|
||||
<li>Номер полиса: { entry.url !== null ? (<DownloadFileById id={ entry.url } filename={ `${ entry.number }.${ entry.extension}` }>
|
||||
<b style={{ color: "#1C01A9", cursor: "pointer", }}>{ entry.number }</b>
|
||||
</DownloadFileById>
|
||||
) : (<b>{ entry.number }</b>) }
|
||||
</li>
|
||||
) }
|
||||
{ entry.period && (<li>Период действия: <b>{ entry.period }</b></li>) }
|
||||
{ entry.amount && (<li>Страховая сумма: <b style={{ whiteSpace: "nowrap" }}>{ numeral(entry.amount).format(' ., ') } ₽</b></li>) }
|
||||
</ul>
|
||||
{ entry.period_type === "prolong" && entry.invoice_url !== null && (
|
||||
<div className="action">
|
||||
<DownloadPdfButton id={ entry.invoice_url } filename={ `${ entry.number }.${ entry.invoice_extension}` } title="Скачать счет на оплату" class={ "services_invoice_button" }/>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
{ entry.description && (<p>{ entry.description }</p>) }
|
||||
</React.Fragment>
|
||||
<Insurance type="kasko" title="КАСКО" entry={ entry } index={ index } />
|
||||
)) }
|
||||
{ insurance.osago !== undefined && insurance.osago !== null && insurance.osago !== "" && insurance.osago.map !== undefined && insurance.osago.map((entry, index) => (
|
||||
<React.Fragment key={ index }>
|
||||
<div className={ `company ${ entry.period_type === "prolong" && "filled" }` }>
|
||||
<p className="title">ОСАГО</p>
|
||||
<ul>
|
||||
{ entry.company && (<li>Страховая компания: <b>{ entry.company }</b></li>) }
|
||||
{ entry.site && (<li>Сайт: <b>{ entry.site }</b></li>) }
|
||||
{ entry.phone && (<li>Телефон: <b>{ entry.phone }</b></li>) }
|
||||
{ entry.number && (
|
||||
<li>Номер полиса: { entry.url !== null ? (<DownloadFileById id={ entry.url } filename={ `${ entry.number }.${ entry.extension}` }>
|
||||
<b style={{ color: "#1C01A9", cursor: "pointer", }}>{ entry.number }</b>
|
||||
</DownloadFileById>
|
||||
) : (<b>{ entry.number }</b>) }
|
||||
</li>
|
||||
) }
|
||||
{ entry.period && (<li>Период действия: <b>{ entry.period }</b></li>) }
|
||||
{ entry.amount && (<li>Страховая сумма: <b style={{ whiteSpace: "nowrap" }}>{ numeral(entry.amount).format(' ., ') } ₽</b></li>) }
|
||||
{ entry.period_type === "prolong" && (
|
||||
<li className="alert">Обращаем Ваше внимание, что пролонгация полиса ОСАГО на второй и последующие периоды осуществляется Лизингополучателем самостоятельно</li>
|
||||
) }
|
||||
</ul>
|
||||
{ entry.period_type === "prolong" && entry.invoice_url !== null && (
|
||||
<div className="action">
|
||||
<DownloadPdfButton id={ entry.invoice_url } filename={ `${ entry.number }.${ entry.invoice_extension}` } title="Скачать счет на оплату" class={ "services_invoice_button" }/>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
{ entry.description && (<p>{ entry.description }</p>) }
|
||||
</React.Fragment>
|
||||
<Insurance type="osago" title="ОСАГО" entry={ entry } index={ index } />
|
||||
)) }
|
||||
{ insurance.nsib !== undefined && insurance.nsib !== null && insurance.nsib !== "" && insurance.nsib.map !== undefined && insurance.nsib.map((entry, index) => (
|
||||
<React.Fragment key={ index }>
|
||||
<div className={ `company ${ entry.period_type === "prolong" && "filled" }` }>
|
||||
<p className="title">НСИБ</p>
|
||||
<ul>
|
||||
{ entry.company && (<li>Страховая компания: <b>{ entry.company }</b></li>) }
|
||||
{ entry.site && (<li>Сайт: <b>{ entry.site }</b></li>) }
|
||||
{ entry.phone && (<li>Телефон: <b>{ entry.phone }</b></li>) }
|
||||
{ entry.number && (
|
||||
<li>Номер полиса: { entry.url !== null ? (<DownloadFileById id={ entry.url } filename={ `${ entry.number }.${ entry.extension}` }>
|
||||
<b style={{ color: "#1C01A9", cursor: "pointer", }}>{ entry.number }</b>
|
||||
</DownloadFileById>
|
||||
) : (<b>{ entry.number }</b>) }
|
||||
</li>
|
||||
) }
|
||||
{ entry.period && (<li>Период действия: <b>{ entry.period }</b></li>) }
|
||||
{ entry.amount && (<li>Страховая сумма: <b style={{ whiteSpace: "nowrap" }}>{ numeral(entry.amount).format(' ., ') } ₽</b></li>) }
|
||||
</ul>
|
||||
{ entry.period_type === "prolong" && entry.invoice_url !== null && (
|
||||
<div className="action">
|
||||
<DownloadPdfButton id={ entry.invoice_url } filename={ `${ entry.number }.${ entry.invoice_extension}` } title="Скачать счет на оплату" class={ "services_invoice_button" }/>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
{ entry.description && (<p>{ entry.description }</p>) }
|
||||
</React.Fragment>
|
||||
<Insurance type="nsib" title="НСИБ" entry={ entry } index={ index } />
|
||||
)) }
|
||||
{ insurance.fingap !== undefined && insurance.fingap !== null && insurance.fingap !== "" && insurance.fingap.map !== undefined && insurance.fingap.map((entry, index) => (
|
||||
<React.Fragment key={ index }>
|
||||
<div className= { `company ${ entry.period_type === "prolong" && "filled" }` }>
|
||||
<p className="title">Safe Finance</p>
|
||||
<ul>
|
||||
{ entry.company && (<li>Страховая компания: <b>{ entry.company }</b></li>) }
|
||||
{ entry.site && (<li>Сайт: <b>{ entry.site }</b></li>) }
|
||||
{ entry.phone && (<li>Телефон: <b>{ entry.phone }</b></li>) }
|
||||
{ entry.number && (
|
||||
<li>Номер полиса: { entry.url !== null ? (<DownloadFileById id={ entry.url } filename={ `${ entry.number }.${ entry.extension}` }>
|
||||
<b style={{ color: "#1C01A9", cursor: "pointer", }}>{ entry.number }</b>
|
||||
</DownloadFileById>
|
||||
) : (<b>{ entry.number }</b>) }
|
||||
</li>
|
||||
) }
|
||||
{ entry.period && (<li>Период действия: <b>{ entry.period }</b></li>) }
|
||||
{ entry.amount && (<li>Страховая сумма: <b style={{ whiteSpace: "nowrap" }}>{ numeral(entry.amount).format(' ., ') } ₽</b></li>) }
|
||||
</ul>
|
||||
{ entry.period_type === "prolong" && entry.invoice_url !== null && (
|
||||
<div className="action">
|
||||
<DownloadPdfButton id={ entry.invoice_url } filename={ `${ entry.number }.${ entry.invoice_extension}` } title="Скачать счет на оплату" class={ "services_invoice_button" }/>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
{ entry.description && (<p>{ entry.description }</p>) }
|
||||
</React.Fragment>
|
||||
<Insurance type="fingap" title="Safe Finance" entry={ entry } index={ index } />
|
||||
)) }
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@ -166,7 +166,15 @@ class SupportAppealsPage extends React.Component
|
||||
<div className="dosc_list medium-icon">
|
||||
{ appeal.documents.map((file, index) => {
|
||||
if(file.doc_direction !== "incoming") { return null; }
|
||||
return (<RequestFile key={ `template_${ index }` } file={ file }/>)
|
||||
return (
|
||||
<RequestFile
|
||||
key={ `template_${ index }` }
|
||||
file={ file }
|
||||
log={{
|
||||
incident_number: file.number,
|
||||
document_name: file.doc_number,
|
||||
}}
|
||||
/>)
|
||||
}) }
|
||||
</div>
|
||||
) }
|
||||
@ -182,7 +190,15 @@ class SupportAppealsPage extends React.Component
|
||||
<div className="dosc_list medium-icon">
|
||||
{ appeal.documents.map((file, index) => {
|
||||
if(file.doc_direction !== "outgoing") { return null; }
|
||||
return (<RequestFile key={ `template_${ index }` } file={ file }/>)
|
||||
return (
|
||||
<RequestFile
|
||||
key={ `template_${ index }` }
|
||||
file={ file }
|
||||
log={{
|
||||
incident_number: file.number,
|
||||
document_name: file.doc_number,
|
||||
}}
|
||||
/>)
|
||||
}) }
|
||||
</div>
|
||||
) }
|
||||
|
||||
@ -2,8 +2,9 @@ import React from "react";
|
||||
import { SpinnerCircular } from "spinners-react";
|
||||
|
||||
import { getFile } from "../../../../actions";
|
||||
import LogFileDownload from "../../../../components/LogFileDownload";
|
||||
|
||||
export default class RequestFile extends React.Component
|
||||
export default class RequestFile extends LogFileDownload
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
@ -23,7 +24,10 @@ export default class RequestFile extends React.Component
|
||||
this.setState({ downloading: true }, () =>
|
||||
{
|
||||
getFile({ id: file.doc_url, filename: `${ file.doc_name }.${ file.doc_extension }` })
|
||||
.then(() => { this.setState({ downloading: false }); })
|
||||
.then(() => {
|
||||
if(this._log !== undefined) { this._log(); }
|
||||
this.setState({ downloading: false });
|
||||
})
|
||||
.catch(() => { this.setState({ downloading: false }); });
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user