diff --git a/src/client/stores/CalculationStore/Effects/reaction.ts b/src/client/stores/CalculationStore/Effects/reaction.ts index 007999b..dba2b72 100644 --- a/src/client/stores/CalculationStore/Effects/reaction.ts +++ b/src/client/stores/CalculationStore/Effects/reaction.ts @@ -1870,6 +1870,49 @@ const reactionEffects: IReactionEffect[] = [ } }, }), + + calculationStore => ({ + expression: () => { + const { quote } = calculationStore.values; + return quote; + }, + effect: quoteId => { + if (quoteId) { + const quote = calculationStore.options.selectQuote?.find( + x => x.quoteid === quoteId, + ); + if (quote) { + if (quote.evo_recalc_limit && quote.evo_recalc_limit > 0) { + if (quote.evo_statuscodeid) { + CalculationService.getEntityOptions({ + entityName: 'evo_statuscode', + where: { + evo_statuscodeid: quote.evo_statuscodeid, + statecode: 0, + }, + }) + .then(evo_statuscodes => { + if (evo_statuscodes && evo_statuscodes.length > 0) { + const evo_statuscode = evo_statuscodes[0]; + if (evo_statuscode.evo_id === '2.3') { + calculationStore.setStatus( + 'cbxRecalcWithRevision', + Status.Default, + ); + return; + } + } + }) + .catch(err => { + throw err; + }); + } + } + } + } + calculationStore.setStatus('cbxRecalcWithRevision', Status.Disabled); + }, + }), ]; export default reactionEffects; diff --git a/src/core/fakeData/entityFakes.ts b/src/core/fakeData/entityFakes.ts index 48aa0c3..d0f173f 100644 --- a/src/core/fakeData/entityFakes.ts +++ b/src/core/fakeData/entityFakes.ts @@ -93,6 +93,7 @@ const EVO_IMPAIRMENT_GROUP_ID = Array.from({ length: 10 }, () => const EVO_CURRENCY_CHANGE_ID = Array.from({ length: 5 }, () => faker.random.uuid(), ); +const EVO_STATUSCODE_ID = Array.from({ length: 5 }, () => faker.random.uuid()); /** * Fake Consts @@ -287,6 +288,8 @@ const entityFakeData: { name: '2345_ООО "с агентами ФЛ"', quoteid: QUOTE_1_ID, evo_leadid: LEAD_1_ID, + evo_recalc_limit: 2, + evo_statuscodeid: EVO_STATUSCODE_ID[0], }, { name: '6789_ООО "с брокером"', @@ -297,12 +300,16 @@ const entityFakeData: { name: '4567_ООО "с агентами ФЛ"', quoteid: QUOTE_3_ID, evo_leadid: LEAD_1_ID, + evo_recalc_limit: 1, + evo_statuscodeid: EVO_STATUSCODE_ID[1], }, { name: '5678_ООО "с агентами ФЛ"', quoteid: QUOTE_4_ID, evo_leadid: LEAD_1_ID, evo_broker_accountid: ACCOUNT_5_ID, + evo_recalc_limit: 0, + evo_statuscodeid: EVO_STATUSCODE_ID[0], }, ], evo_gps_brand: [ @@ -632,6 +639,20 @@ const entityFakeData: { statecode: 0, }, ], + evo_statuscode: [ + { + evo_statuscodeid: EVO_STATUSCODE_ID[0], + evo_id: '2.3', + evo_name: 'Положительное решение', + statecode: 0, + }, + { + evo_statuscodeid: EVO_STATUSCODE_ID[1], + evo_id: '2.2', + evo_name: 'Одобрено клиентом', + statecode: 0, + }, + ], }; export default entityFakeData; diff --git a/src/core/types/Entities/entityNames.ts b/src/core/types/Entities/entityNames.ts index 8738b66..e4d754e 100644 --- a/src/core/types/Entities/entityNames.ts +++ b/src/core/types/Entities/entityNames.ts @@ -20,4 +20,5 @@ export type EntityNames = | 'connection' | 'evo_connection_role' | 'evo_impairment_group' - | 'evo_currencychange'; + | 'evo_currencychange' + | 'evo_statuscode'; diff --git a/src/core/types/Entities/index.ts b/src/core/types/Entities/index.ts index d539652..727beb0 100644 --- a/src/core/types/Entities/index.ts +++ b/src/core/types/Entities/index.ts @@ -30,6 +30,7 @@ export interface IQuote extends IBaseOption { quoteid?: string; quotenumber?: string; evo_leadid?: string; + evo_recalc_limit?: number; } export interface ITransactionCurrency extends IBaseOption { @@ -154,6 +155,14 @@ export interface IEvoCurrencyChange extends IBaseOption { statecode?: number; } +export interface IEvoStatusCode extends IBaseOption { + evo_statuscodeid?: string; + evo_id?: string; + evo_name?: string; + importsequencenumber?: number; + statecode?: number; +} + export type TEntity = IAccount & ILead & IOpportunity & @@ -175,4 +184,5 @@ export type TEntity = IAccount & IConnection & IEvoConnectionRole & IEvoImpairmentGroup & - IEvoCurrencyChange; + IEvoCurrencyChange & + IEvoStatusCode;