diff --git a/actions/dealsActions.js b/actions/dealsActions.js
index 9f3e26b..456fd3c 100644
--- a/actions/dealsActions.js
+++ b/actions/dealsActions.js
@@ -3,49 +3,12 @@ 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';
-/*DEALS_LIST
-/lk/ConsiderationOpportunity/quote
-
-[{
- "quote_number": "582189",
- "price": 5490000,
- "first_payment_perc": 30,
- "first_payment_rub": 1647000,
- "brand_name": "Volkswagen",
- "model_name": "Touareg",
- "object_count": 1,
-}, {
- "quote_number": "580008",
- "price": 5341770,
- "first_payment_perc": 30,
- "first_payment_rub": 1647000,
- "brand_name": "Volkswagen",
- "model_name": "Touareg",
- "object_count": 1,
-}]
-
-[{
- "opp_number": "780",
- "statuscode_id": 107,
- "statuscode_name": " ",
- "comment": null,
-}, {
- "opp_number": "37197",
- "statuscode_id": 101,
- "statuscode_name": " ",
- "comment": null,
-}]
-opp_number- номер Лизинговой сделки
-statuscode_id - номер этапа
-statuscode_name - имя этапа
-comment - сопроводительный текст для данного этапа, который надо выводить
-*/
-
-export const getDeals = ({ dispatch }) =>
+export const getDeals = ({ dispatch, update = false }) =>
{
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/deals`;
@@ -59,6 +22,20 @@ export const getDeals = ({ dispatch }) =>
.then((response) =>
{
console.log("ACTION", "deals", "getDeals()", "response", response.data);
+
+ /*
+ if(update)
+ {
+ for(let i in response.data)
+ {
+ if(response.data[i].opp_number == "20325")
+ {
+ response.data[i].statuscode_id = 101;
+ }
+ }
+ }
+ */
+
dispatch({
type: actionTypes.DEALS_LIST,
data: {
@@ -129,6 +106,40 @@ export const getDealOffers = ({ dispatch, deal_id }) =>
});
}
+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, });
+
+ return new Promise((resolve, reject) =>
+ {
+ eachSeries(offers, (offer_id, callback) =>
+ {
+ axios.post(url, { deal_id, offer_id }, {
+ withCredentials: true,
+ })
+ .then((response) =>
+ {
+ console.log("ACTION", "deals", "acceptDealOffers()", "response", response.data);
+
+ callback();
+ })
+ .catch((error) =>
+ {
+ console.error("ACTION", "deals", "acceptDealOffers()", "ERROR");
+ console.error(error);
+
+ callback();
+ });
+ }, () =>
+ {
+ resolve();
+ });
+ });
+}
+
export const getDealDocuments = ({ dispatch, deal_id }) =>
{
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/deals/documents`;
diff --git a/components/DealsStatus/DealsList.js b/components/DealsStatus/DealsList.js
index 24cdd40..7af8901 100644
--- a/components/DealsStatus/DealsList.js
+++ b/components/DealsStatus/DealsList.js
@@ -39,7 +39,7 @@ export default class DealsList extends React.Component
render()
{
- const { status, deals, questionnaire_status, dealSelected, onCloseDeal } = this.props;
+ const { status, deals, questionnaire_status, dealSelected, onCloseDeal, onDealsUpdate } = this.props;
console.log({ deals });
@@ -58,6 +58,8 @@ export default class DealsList extends React.Component
deals={ deals }
questionnaire_status={ questionnaire_status }
onCloseDeal={ this._handle_onCloseDeal }
+ onDealsUpdate={ onDealsUpdate }
+ { ...deal }
/>)
}
else
diff --git a/components/DealsStatus/DealsListDeal.js b/components/DealsStatus/DealsListDeal.js
index ac88d81..c5209ff 100644
--- a/components/DealsStatus/DealsListDeal.js
+++ b/components/DealsStatus/DealsListDeal.js
@@ -2,40 +2,45 @@ import React from "react";
import pluralize from 'pluralize-ru';
const statuses = {
- "0": {
+ "100": {
index: undefined,
title: "Выбор КП",
- icon: "/assets/images/status/1.svg",
+ icon: "/assets/images/status/icon_deal_status_100.svg",
},
"101": {
index: 1,
title: "Выбор программы финансирования",
- icon: "/assets/images/status/2.svg",
+ icon: "/assets/images/status/icon_deal_status_101.svg",
},
"102": {
index: 2,
title: "Сбор пакета документов",
- icon: "/assets/images/status/3.svg",
+ icon: "/assets/images/status/icon_deal_status_102.svg",
},
- "3": {
+ "103": {
index: 3,
title: "Проверка документов",
- icon: "/assets/images/status/4.svg",
+ icon: "/assets/images/status/icon_deal_status_103.svg",
},
- "1": {
+ "104": {
index: 4,
- title: "Принятие решения по заявке",
- icon: "/assets/images/status/5.svg",
+ title: "Принятие решения по сделке",
+ icon: "/assets/images/status/icon_deal_status_104.svg",
+ },
+ "105": {
+ index: 5,
+ title: "Требуется изменение параметров",
+ icon: "/assets/images/status/icon_deal_status_105.svg",
+ },
+ "106": {
+ index: 5,
+ title: "Принято положительное решение",
+ icon: "/assets/images/status/icon_deal_status_106.svg",
},
"107": {
- index: 5,
- title: "Оформление лизинга",
- icon: "/assets/images/status/6.svg",
- },
- "2": {
index: 6,
- title: "Выбор типа подписания",
- icon: "/assets/images/status/7.svg",
+ title: "Оформление лизинга",
+ icon: "/assets/images/status/icon_deal_status_107.svg",
},
};
@@ -62,7 +67,7 @@ export default class DealsListDeal extends React.Component
- { statuses[ statuscode_id ] === undefined ? "Не начата" : `${ statuses[ statuscode_id ].index } ${ pluralize(step, 'этапа', 'этап', 'этапа', 'этапов') } ${ pluralize(statuses[ statuscode_id ].index, 'пройдено', 'пройден', 'пройдено', 'пройдено') }` }
+ { statuses[ statuscode_id ].index === undefined ? "Не начата" : `${ statuses[ statuscode_id ].index } ${ pluralize(step, 'этапа', 'этап', 'этапа', 'этапов') } ${ pluralize(statuses[ statuscode_id ].index, 'пройдено', 'пройден', 'пройдено', 'пройдено') }` }
{/*}

-
{ statuscode_name }
+ {/*}
{ statuscode_name }
{*/}
+
{ statuses[ statuscode_id ].title }