diff --git a/actions/dealsActions.js b/actions/dealsActions.js index 456fd3c..a1c3731 100644 --- a/actions/dealsActions.js +++ b/actions/dealsActions.js @@ -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(); + }); }); } diff --git a/actions/fileActions.js b/actions/fileActions.js index c6554e3..b2c2c62 100644 --- a/actions/fileActions.js +++ b/actions/fileActions.js @@ -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) => diff --git a/actions/logsActions.js b/actions/logsActions.js new file mode 100644 index 0000000..6a320e5 --- /dev/null +++ b/actions/logsActions.js @@ -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(); + }); + }); +} \ No newline at end of file diff --git a/components/DealsStatus/DealsListDeal.js b/components/DealsStatus/DealsListDeal.js index c5209ff..fab3c68 100644 --- a/components/DealsStatus/DealsListDeal.js +++ b/components/DealsStatus/DealsListDeal.js @@ -63,7 +63,7 @@ export default class DealsListDeal extends React.Component return (
-

Сделка { index + 1 }

+

№ { opp_number }

diff --git a/components/DealsStatus/SingleDeal.js b/components/DealsStatus/SingleDeal.js index 2575e37..06434f8 100644 --- a/components/DealsStatus/SingleDeal.js +++ b/components/DealsStatus/SingleDeal.js @@ -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 (

-1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}> -

Сделка { index + 1 }

+

№ { dealSelected }

{ 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 (
-1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}> -

Сделка { index + 1 }

+

№ { dealSelected }

{ 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 (
-1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}> -

Сделка { index + 1 }

+

№ { dealSelected }

{ 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 (
-1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}> -

Сделка { index + 1 }

+

№ { dealSelected }

{ 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 (
-1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}> -

Сделка { index + 1 }

+

№ { dealSelected }

{ 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 (
-1 ? "current" : statuscode_id > this.status[ 0 ] ? "done" : "" }`}> -

Сделка { index + 1 }

+

№ { dealSelected }

{ this._renderHeader("Оформление лизинга") } diff --git a/components/LogFileDownload/index.js b/components/LogFileDownload/index.js new file mode 100644 index 0000000..83f2a8f --- /dev/null +++ b/components/LogFileDownload/index.js @@ -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(() => {}); + } + } +} \ No newline at end of file diff --git a/css/main/style.css b/css/main/style.css index 94b3daf..23942ff 100644 --- a/css/main/style.css +++ b/css/main/style.css @@ -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; } diff --git a/css/main/style.less b/css/main/style.less index e6e296d..4da128b 100644 --- a/css/main/style.less +++ b/css/main/style.less @@ -6107,6 +6107,10 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block { } } + :first-child { + min-width: 60px; + } + &:not(:last-child) { margin-bottom: 5px; diff --git a/lib/CRMRequestPost/index.js b/lib/CRMRequestPost/index.js index 3e1e78f..e50782a 100644 --- a/lib/CRMRequestPost/index.js +++ b/lib/CRMRequestPost/index.js @@ -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, diff --git a/pages/_document.js b/pages/_document.js index c114ad1..3d4903a 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -41,6 +41,28 @@ class Doc extends Document
+ +