diff --git a/actions/edoActions.js b/actions/edoActions.js new file mode 100644 index 0000000..6540344 --- /dev/null +++ b/actions/edoActions.js @@ -0,0 +1,50 @@ +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 getEDOList = ({ dispatch, update = false }) => +{ + const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/edo/list`; + + console.log("ACTION", "edo", "getList()", { url }); + + return new Promise((resolve, reject) => + { + axios.post(url, {}, { + withCredentials: true, + }) + .then((response) => + { + console.log("ACTION", "edo", "getList()", "response", response.data); + + dispatch({ + type: actionTypes.EDO_LIST, + data: { + list: response.data + } + }); + + resolve(); + }) + .catch((error) => + { + console.error("ACTION", "edo", "getList()", "ERROR"); + console.error(error); + + dispatch({ + type: actionTypes.EDO_LIST, + data: { + list: [] + } + }); + + reject(); + }); + }); +} \ No newline at end of file diff --git a/components/DealsStatus/SingleDeal.js b/components/DealsStatus/SingleDeal.js index 06434f8..83e3103 100644 --- a/components/DealsStatus/SingleDeal.js +++ b/components/DealsStatus/SingleDeal.js @@ -161,10 +161,10 @@ class Offers extends Step ) : ( <> { offers.length > 0 ? ( -
| + { statuscode_id === 100 && | } | № | Стоимость | Первый платеж, р. | @@ -178,12 +178,16 @@ class Offers extends Step|
|---|---|---|---|---|---|
|
-
- -1 } onChange={ () => { this._handle_onCheckOffer(offer.quote_number) } }/>
-
-
- |
+ { offer.quote_status ? (
+
+
+ -1 } onChange={ () => { this._handle_onCheckOffer(offer.quote_number) } }/>
+
+
+ |
+ ) : (
+ + )} | { offer_index + 1 } | { numeral(offer.price).format(' ., ') } р. | { numeral(offer.first_payment_rub).format(' ., ') } р. | diff --git a/constants/actionTypes.js b/constants/actionTypes.js index f64a19f..09e55ec 100644 --- a/constants/actionTypes.js +++ b/constants/actionTypes.js @@ -54,3 +54,7 @@ export const DEAL_DOCUMENTS_LIST = 'DEAL_DOCUMENTS_LIST'; export const DEAL_CONTRACTS_LIST = 'DEAL_CONTRACTS_LIST'; export const DEALS_RESET = 'DEALS_RESET'; export const DEAL_RESET = 'DEAL_RESET'; + +export const EDO_LOADED = 'EDO_LOADED'; +export const EDO_LIST = 'EDO_LIST'; +export const EDO_RESET = 'EDO_RESET'; \ No newline at end of file diff --git a/css/forms/style.css b/css/forms/style.css index 8c8db67..ab15eb7 100644 --- a/css/forms/style.css +++ b/css/forms/style.css @@ -1668,3 +1668,6 @@ margin: 0px!important; } } +.deal_offers_table { + width: 100%; +} diff --git a/css/forms/style.less b/css/forms/style.less index 28b115b..60e2825 100644 --- a/css/forms/style.less +++ b/css/forms/style.less @@ -1955,4 +1955,8 @@ margin: 0px!important; } } +} + +.deal_offers_table { + width: 100%; } \ No newline at end of file diff --git a/pages/api/edo/check.js b/pages/api/edo/check.js new file mode 100644 index 0000000..e862f76 --- /dev/null +++ b/pages/api/edo/check.js @@ -0,0 +1,3 @@ +/* +2.8.2 - Метод ограничений количества отправок Приглашений Клиенту(для ЭДО) (lk/Account/GetAccessInviteEdoBox) +*/ \ No newline at end of file diff --git a/pages/api/edo/invite/check.js b/pages/api/edo/invite/check.js new file mode 100644 index 0000000..ec121cf --- /dev/null +++ b/pages/api/edo/invite/check.js @@ -0,0 +1,3 @@ +/* +2.8.4 - Метод получения отправленных (но еще не принятых) приглашений Клиенту (для ЭДО) (lk/Account/GetInviteEdoBox) +*/ \ No newline at end of file diff --git a/pages/api/edo/invite/send.js b/pages/api/edo/invite/send.js new file mode 100644 index 0000000..eec679b --- /dev/null +++ b/pages/api/edo/invite/send.js @@ -0,0 +1,3 @@ +/* +2.8.3 - Метод отправки Приглашения Клиенту(для ЭДО) (lk/Account/InviteEdoBox) +*/ diff --git a/pages/api/edo/invite/update.js b/pages/api/edo/invite/update.js new file mode 100644 index 0000000..ed3e5e4 --- /dev/null +++ b/pages/api/edo/invite/update.js @@ -0,0 +1,3 @@ +/* +2.8.5 - Метод обновления (по кнопке!) Приглашений Клиенту(для ЭДО) (lk/Account/UpdateEdoBox) +*/ \ No newline at end of file diff --git a/pages/api/edo/list.js b/pages/api/edo/list.js new file mode 100644 index 0000000..767ba09 --- /dev/null +++ b/pages/api/edo/list.js @@ -0,0 +1,11 @@ +/* +2.8.1 - Метод получения доступных для работы в ЭДО ящиков (lk/Account/GetEdoBox) +*/ +import CRMRequestGet from '../../../lib/CRMRequestGet'; + +export default async function handler(req, res) +{ + console.log("API", "EDO", "/list"); + + await CRMRequestGet(req, res, `${ process.env.CRM_API_HOST }/lk/Account/GetEdoBox`, {}); +} \ No newline at end of file diff --git a/pages/settings/digital.js b/pages/settings/digital.js index b215371..5e9fde3 100644 --- a/pages/settings/digital.js +++ b/pages/settings/digital.js @@ -22,6 +22,7 @@ import Company from "../components/Company"; import { sendPhoneChangeNumber, sendPhoneChangeNumberSmsCode, setUserPhone } from '../../actions'; import AccountLayout from "../components/Layout/Account"; +import { getEDOList } from "../../actions/edoActions"; class IndexPage extends React.Component { @@ -52,6 +53,17 @@ class IndexPage extends React.Component componentDidMount() { + const { dispatch } = this.props; + + getEDOList({ dispatch }) + .then(() => + { + + }) + .catch(() => + { + + }); } _handle_onFormSubmit = (event) => diff --git a/reducers/edoReducer.js b/reducers/edoReducer.js new file mode 100644 index 0000000..2158d1e --- /dev/null +++ b/reducers/edoReducer.js @@ -0,0 +1,46 @@ +import { HYDRATE } from 'next-redux-wrapper'; + +import * as actionTypes from '../constants/actionTypes'; +import initialState from "./initialState"; + +const edoReducer = (state = initialState.edo, action) => +{ + switch (action.type) + { + case actionTypes.EDO_LOADED: + { + return { + ...state, + loaded: action.data.loaded, + }; + } + + case actionTypes.EDO_LIST: + { + console.log("actionTypes.EDO_LIST", actionTypes.EDO_LIST, { action }); + console.log({ + ...state, + list: action.data.list, + }); + + return { + ...state, + list: action.data.list, + }; + } + + case actionTypes.EDO_RESET: + { + return { + loaded: false, + list: null, + }; + } + + default: { + return state; + } + } +}; + +export default edoReducer; \ No newline at end of file diff --git a/reducers/initialState.js b/reducers/initialState.js index ae24348..387d84c 100644 --- a/reducers/initialState.js +++ b/reducers/initialState.js @@ -252,6 +252,11 @@ export const defaultState = { }, */ }, + edo: + { + loaded: false, + list: null, + } }; export default JSON.parse(JSON.stringify({ ...defaultState, ...{ questionnaire: questionnaire_template } })); \ No newline at end of file diff --git a/store/index.js b/store/index.js index 2e378ab..3de312c 100644 --- a/store/index.js +++ b/store/index.js @@ -16,6 +16,7 @@ import contractEventsReducer from '../reducers/contractEventsReducer'; import contractFinesReducer from '../reducers/contractFinesReducer'; import questionnaireReducer from '../reducers/questionnaireReducer'; import dealsReducer from '../reducers/dealsReducer'; +import edoReducer from '../reducers/edoReducer'; const combinedReducer = combineReducers({ auth: authReducer, @@ -33,6 +34,7 @@ const combinedReducer = combineReducers({ contract_fines: contractFinesReducer, questionnaire: questionnaireReducer, deals: dealsReducer, + edo: edoReducer, }); const makeStore = (context) =>