diff --git a/.env b/.env index 49a893b..98e027e 100644 --- a/.env +++ b/.env @@ -1,3 +1,5 @@ REACT_APP_COLOR_PRIMARY=#BF3676 REACT_APP_COLOR_SECONDARY=#FD4047 -REACT_APP_COLOR_TERTIARTY=#FF9112 \ No newline at end of file +REACT_APP_COLOR_TERTIARTY=#FF9112 + +WDS_SOCKET_HOST=localhost \ No newline at end of file diff --git a/src/client/App.jsx b/src/client/App.jsx index bb4cad6..0756f61 100644 --- a/src/client/App.jsx +++ b/src/client/App.jsx @@ -8,6 +8,7 @@ import Layout from './Layout'; message.config({ top: 70, + maxCount: 3, }); function App() { diff --git a/src/client/Elements/Notification.ts b/src/client/Elements/Notification.ts index c40f1bb..fa4330d 100644 --- a/src/client/Elements/Notification.ts +++ b/src/client/Elements/Notification.ts @@ -1,7 +1,6 @@ import { notification } from 'antd'; import { ArgsProps, NotificationInstance } from 'antd/lib/notification'; import { NOTIFICATION_DEBOUNCE } from 'core/constants/debounce'; -import { debounce } from 'lodash'; const defaultOptions: Partial = { placement: 'bottomRight', @@ -11,7 +10,9 @@ type NotificationOptions = ArgsProps & { type: keyof NotificationInstance; }; -export const openNotification = debounce((options: NotificationOptions) => { - if (!options.key) options.key = JSON.stringify(options); - notification[options.type]({ ...defaultOptions, ...options }); -}, NOTIFICATION_DEBOUNCE); +export const openNotification = (options: NotificationOptions) => { + setTimeout(() => { + if (!options.key) options.key = JSON.stringify(options); + notification[options.type]({ ...defaultOptions, ...options }); + }, NOTIFICATION_DEBOUNCE); +}; diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index 06687aa..16e8399 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -1142,10 +1142,28 @@ const reactionEffects: IReactionEffect[] = [ calculationStore => ({ expression: () => { - const { product, leasingPeriod, deliveryTime } = calculationStore.values; - return { product_evo_id: product, leasingPeriod, deliveryTime }; + const { + product, + leasingPeriod, + deliveryTime, + firstPaymentPerc, + lastPaymentPerc, + } = calculationStore.values; + return { + product_evo_id: product, + leasingPeriod, + deliveryTime, + firstPaymentPerc, + lastPaymentPerc, + }; }, - effect: ({ product_evo_id, leasingPeriod, deliveryTime }) => { + effect: ({ + product_evo_id, + leasingPeriod, + deliveryTime, + firstPaymentPerc, + lastPaymentPerc, + }) => { if (product_evo_id && leasingPeriod && deliveryTime) { const product = calculationStore.getOption('selectProduct', { evo_id: product_evo_id, @@ -1154,11 +1172,13 @@ const reactionEffects: IReactionEffect[] = [ const tarif = calculationStore.options.selectTarif?.find( x => x.evo_baseproductid === product.evo_baseproductid && - x.evo_min_period && x.evo_min_period <= leasingPeriod && - x.evo_max_period && x.evo_max_period >= leasingPeriod && - x.evo_delivery_time?.includes(deliveryTime), + x.evo_delivery_time?.includes(deliveryTime) && + x.evo_min_first_payment <= firstPaymentPerc && + x.evo_max_first_payment >= firstPaymentPerc && + x.evo_min_last_payment <= lastPaymentPerc && + x.evo_max_last_payment >= lastPaymentPerc, ); calculationStore.setValue('tarif', tarif?.evo_tarifid); } @@ -1562,18 +1582,52 @@ const reactionEffects: IReactionEffect[] = [ }, }), + /** + * + * @description + #1 + * DYN-190 При выборе значения в поле selectSubsidy необходимо добавить + * фильтрацию в полях при условии что selectSubsidy не равно null: + +Тип предмета лизинга selectLeaseObjectType +если с записью Субсидия нет связанных Типов предмета лизинга, +то указываются все записи согласно текущей фильтрации, +иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectSubsidy + + #2 + * На изменение поля Продукт selectProduct добавляем фильтрацию списков: +в поле Тип предмета лизинга selectLeaseObjectType - указываются те, которые связаны с продуктом. +Если с Продуктом нет связанных Типов предмета лизинга, +то указывается весь список. Это надо добавить в текущие условия фильтрации данного поля + */ calculationStore => ({ expression: () => { - return calculationStore.getOption('selectSubsidy'); + return { + product: calculationStore.getOption('selectProduct'), + subsidy: calculationStore.getOption('selectSubsidy'), + }; }, - effect: subsidy => { + effect: ({ product, subsidy }) => { calculationStore.setFilter('selectLeaseObjectType', types => types.filter( - type => - !subsidy?.evo_leasingobject_types?.length || - subsidy.evo_leasingobject_types.filter( - x => x.evo_leasingobject_typeid === type.evo_leasingobject_typeid, - )?.length, + pipe( + type => + (!product?.evo_leasingobject_types?.length || + product.evo_leasingobject_types.filter( + x => + x.evo_leasingobject_typeid === + type?.evo_leasingobject_typeid, + )?.length) && + type, + type => + type && + (!subsidy?.evo_leasingobject_types?.length || + subsidy.evo_leasingobject_types.filter( + x => + x.evo_leasingobject_typeid === + type.evo_leasingobject_typeid, + )?.length), + ), ), ); diff --git a/src/core/constants/debounce.js b/src/core/constants/debounce.js index fd7ab33..c5adbda 100644 --- a/src/core/constants/debounce.js +++ b/src/core/constants/debounce.js @@ -1,3 +1,3 @@ export const DEFAULT_DEBOUNCE_DELAY = 350; -export const NOTIFICATION_DEBOUNCE = 750; +export const NOTIFICATION_DEBOUNCE = 100; export const ACTION_DELAY = 1200; diff --git a/src/core/services/CrmService/graphql/query/options/main_options.graphql b/src/core/services/CrmService/graphql/query/options/main_options.graphql index 5cc0c55..e902441 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -172,6 +172,13 @@ query GetMainOptions( evo_leasingobject_typeid } evo_delivery_time + evo_graphtype_exception + evo_seasons_type_exception + evo_min_decreasing_perc + evo_min_first_payment + evo_max_first_payment + evo_min_last_payment + evo_max_last_payment } selectRate: evo_rates( statecode: $statecode