diff --git a/src/client/process/agents/leaseback.ts b/src/client/process/agents/leaseback.ts new file mode 100644 index 0000000..9187231 --- /dev/null +++ b/src/client/process/agents/leaseback.ts @@ -0,0 +1,72 @@ +import { IAccount } from 'core/services/CrmService/types/entities'; +import { ICalculationStore } from 'core/types/Calculation/Store'; +import { reaction } from 'mobx'; +import { ElementStatus } from 'types/elements'; + +export default function leasebackReactions($calculation: ICalculationStore) { + /** + * Дополнить реакцию на изменение поля Салон приобретения selectDealer: + +если в поле selectDealer указан account, у которого evo_return_leasing_dealer = true, то + +1) поле selectDealerPerson обнулять и закрывать для редактирования, +иначе формировать список связанных значений + +2) в таблице страхования в столбце Плательщик в строках ОСАГО и КАСКО указывать "Лизингополучатель" (100 000 000) и закрывать для редактирования , +иначе открывать данные поля для редактирования + +3) ПЛ БУ cbxLeaseObjectUsed = true + */ + reaction( + () => { + return $calculation.getOption('selectDealer') as IAccount; + }, + dealer => { + if (dealer.evo_return_leasing_dealer === true) { + // TODO: мб сбрасывать dealerPerson и dealerBroker + + $calculation.setTableRow('tableInsurance', rows => + rows.findIndex(x => x.key === 'kasko'), + )({ + insured: { value: 100_000_000, status: ElementStatus.Disabled }, + }); + + $calculation.setValue('leaseObjectUsed', true); + } else { + $calculation.setTableRow('tableInsurance', rows => + rows.findIndex(x => x.key === 'kasko'), + )({ + insured: { status: ElementStatus.Default }, + }); + } + }, + ); + + // объединили реакцию для прицепа и возвратного лизинга + reaction( + () => { + return { + dealer: $calculation.getOption('selectDealer') as IAccount, + leaseObjectCategory: $calculation.getValue('leaseObjectCategory'), + }; + }, + ({ dealer, leaseObjectCategory }) => { + const isTrailer = leaseObjectCategory === 100000004; + const returnLeasing = dealer.evo_return_leasing_dealer === true; + + if (isTrailer || returnLeasing) { + $calculation.setTableRow('tableInsurance', rows => + rows.findIndex(x => x.key === 'osago'), + )({ + insured: { value: 100_000_000, status: ElementStatus.Disabled }, + }); + } else { + $calculation.setTableRow('tableInsurance', rows => + rows.findIndex(x => x.key === 'osago'), + )({ + insured: { status: ElementStatus.Default }, + }); + } + }, + ); +} diff --git a/src/client/process/subsidy-import-program/reactions.ts b/src/client/process/subsidy-import-program/reactions.ts index 3cbc42b..26b0d5d 100644 --- a/src/client/process/subsidy-import-program/reactions.ts +++ b/src/client/process/subsidy-import-program/reactions.ts @@ -18,14 +18,19 @@ export default function ($calculation: ICalculationStore) { () => { const product = $calculation.getOption('selectProduct'); const { subsidy, importProgram } = $calculation.values; - return { product, subsidy, importProgram }; + const dealer = $calculation.getOption('selectDealer'); + return { product, subsidy, importProgram, dealer }; }, - ({ product, subsidy, importProgram }) => { + ({ product, subsidy, importProgram, dealer }) => { const supplierCurrency = $calculation.options.selectSupplierCurrency?.find( x => x.isocurrencycode === 'RUB', ); - if (subsidy || importProgram) { + if ( + subsidy || + importProgram || + dealer?.evo_return_leasing_dealer === true + ) { $calculation.setValue( 'supplierCurrency', supplierCurrency?.transactioncurrencyid, @@ -48,24 +53,26 @@ export default function ($calculation: ICalculationStore) { /** * @description - * на изменение selectProduct, selectSubsidy или selectImportProgram -если selectSusidy или selectItProgram содержит данные, то selectSupplierCurrency = RUB, + * на изменение selectProduct, selectSubsidy или selectImportProgram или selectDealer +если selectSusidy или selectItProgram содержит данные или в поле selectDealer указан account, у которого evo_return_leasing_dealer = true, то selectSupplierCurrency закрыта для редактирования, иначе -если selectProduct не содержит данные, то selectSupplierCurrency = RUB, иначе -если (в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds = True), - то selectSupplierCurrency = RUB -иначе без изменения - - +если selectProduct не содержит данные, то selectSupplierCurrency закрыта для редактирования, иначе +если (в поле Продукт selectProduct выбрана запись, у которой БУбезНДС evo_sale_without_nds = True), то selectSupplierCurrency закрыта для редактирования +иначе selectSupplierCurrency открыто для редактирования */ reaction( () => { const product = $calculation.getOption('selectProduct'); const { subsidy, importProgram } = $calculation.values; - return { product, subsidy, importProgram }; + const dealer = $calculation.getOption('selectDealer'); + return { product, subsidy, importProgram, dealer }; }, - ({ product, subsidy, importProgram }) => { - if (subsidy || importProgram) { + ({ product, subsidy, importProgram, dealer }) => { + if ( + subsidy || + importProgram || + dealer?.evo_return_leasing_dealer === true + ) { $calculation.setStatus( 'selectSupplierCurrency', ElementStatus.Disabled, diff --git a/src/client/process/used-pl/reactions.ts b/src/client/process/used-pl/reactions.ts index f8e5ddd..f2d1f94 100644 --- a/src/client/process/used-pl/reactions.ts +++ b/src/client/process/used-pl/reactions.ts @@ -282,8 +282,10 @@ export default function ($calculation: ICalculationStore) { /** * @description - * реакция на ПЛ БУ, Субсидию и Продукт - * если ПЛ БУ = Да или Субсидия содержит данные или в Продукте БУбезНДС = Да, + * реакция на ПЛ БУ, Субсидию и Продукт и Салон + * если ПЛ БУ = Да или Субсидия содержит данные + * или в Продукте БУбезНДС = Да, + * или в selectDealer указан account, у которого evo_return_leasing_dealer === true * то поле Срок поставки = 100 000 000 и закрыто для редактирования, иначе открыто для редактирования */ reaction( @@ -291,15 +293,22 @@ export default function ($calculation: ICalculationStore) { const { leaseObjectUsed } = $calculation.values; const sudsidy = $calculation.getOption('selectSubsidy'); const product = $calculation.getOption('selectProduct'); + const dealer = $calculation.getOption('selectDealer'); return { leaseObjectUsed, sudsidy, product, + dealer, }; }, - ({ leaseObjectUsed, sudsidy, product }) => { - if (leaseObjectUsed || sudsidy || product?.evo_sale_without_nds) { + ({ leaseObjectUsed, sudsidy, product, dealer }) => { + if ( + leaseObjectUsed || + sudsidy || + product?.evo_sale_without_nds || + dealer?.evo_return_leasing_dealer + ) { $calculation.setValue('deliveryTime', 100_000_000); $calculation.setStatus('radioDeliveryTime', ElementStatus.Disabled); } else { diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/custom.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/custom.ts new file mode 100644 index 0000000..fa26463 --- /dev/null +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/custom.ts @@ -0,0 +1,164 @@ +import { ICalculationStore } from 'core/types/Calculation/Store'; + +/** + * Добавить валидацию на кнопку Рассчитать: + если tbxDealerRewardSumm > 0 и + если selectDealerPerson = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectDealerPerson + если selectDealerPerson = selectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectDealerPerson + если selectDealerPerson = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectDealerPerson + если selectDealerPerson = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectDealerPerson + если selectDealerPerson = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectDealerPerson + 2.если tbxDealerBrokerRewardSumm > 0 и + + если selectDealerBroker = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectDealerBroker + если selectDealerBroker = selectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectDealerBroker + если selectDealerBroker = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectDealerBroker + если selectDealerBroker = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectDealerBroker + если selectDealerBroker = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectDealerBroker + 3. если tbxIndAgentRewardSumm > 0 и + + если selectIndAgent = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectIndAgent + если selectIndAgent = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectIndAgent + если selectIndAgent = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectIndAgent + если selectIndAgent = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectIndAgent + если selectIndAgent = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectIndAgent + 4. если tbxCalcDoubleAgentRewardSumm > 0 и + + если selectCalcDoubleAgent = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectCalcDoubleAgent + если selectCalcDoubleAgent = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectCalcDoubleAgent + если selectCalcDoubleAgent = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectCalcDoubleAgent + если selectCalcDoubleAgent = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectCalcDoubleAgent + если selectCalcDoubleAgent = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectCalcDoubleAgent + 5. если tbxCalcBrokerRewardSum > 0 и + + если selectCalcBroker = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectCalcBroker + если selectCalcBroker = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectCalcBroker + если selectCalcBroker = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectCalcBroker + если selectCalcBroker = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectCalcBroker + если selectCalcBroker = selectFinDepartment и tbxFinDepartmentRewardSumm > 0, то ругаться на selectCalcBroker + 6. если tbxFinDepartmentRewardSumm > 0 и + + если selectFinDepartment = selectDealerPerson и tbxDealerRewardSumm > 0, то ругаться на selectFinDepartment + если selectFinDepartment = selectDealerBroker и tbxDealerBrokerRewardSumm > 0, то ругаться на selectFinDepartment + если selectFinDepartment = sselectIndAgent и tbxIndAgentRewardSumm > 0, то ругаться на selectFinDepartment + если selectFinDepartment = selectCalcDoubleAgent и tbxCalcDoubleAgentRewardSumm > 0, то ругаться на selectFinDepartment + если selectFinDepartment = selectCalcBroker tbxCalcBrokerRewardSum > 0, то ругаться на selectFinDepartment + */ +export default function customValidation($calculation: ICalculationStore) { + const dealerRewardSumm = $calculation.getValue('dealerRewardSumm'); + const dealerBrokerRewardSumm = $calculation.getValue( + 'dealerBrokerRewardSumm', + ); + const indAgentRewardSumm = $calculation.getValue('indAgentRewardSumm'); + const calcDoubleAgentRewardSumm = $calculation.getValue( + 'calcDoubleAgentRewardSumm', + ); + const calcBrokerRewardSum = $calculation.getValue('calcBrokerRewardSum'); + const finDepartmentRewardSumm = $calculation.getValue( + 'finDepartmentRewardSumm', + ); + + const dealerPerson = $calculation.getValue('dealerPerson'); + const dealerBroker = $calculation.getValue('dealerBroker'); + const indAgent = $calculation.getValue('indAgent'); + const calcDoubleAgent = $calculation.getValue('calcDoubleAgent'); + const calcBroker = $calculation.getValue('calcBroker'); + const calcFinDepartment = $calculation.getValue('calcFinDepartment'); + + /** + * В валидацию на кнопку Рассчитать внести изменение: + 1) поле selectDealerPerson убрать из списка обязательных для расчета полей + 2) добавить валидацию на поле selectDealerPerson : + Если в поле selectDealer указан account, у которого evo_return_leasing_dealer = False (или null) и поле selectDealerPerson = null, то выводить ошибку и поле selectDealerPerson обводить красной рамкой, иначе все ок + */ + + const dealer = $calculation.getOption('selectDealer'); + const isReturnLeasing = dealer?.evo_return_leasing_dealer; + + if ( + (dealerRewardSumm > 0 && + dealerPerson && + ((dealerPerson === dealerBroker && dealerBrokerRewardSumm > 0) || + (dealerPerson === indAgent && indAgentRewardSumm > 0) || + (dealerPerson === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) || + (dealerPerson === calcBroker && calcBrokerRewardSum > 0) || + (dealerPerson === calcFinDepartment && finDepartmentRewardSumm > 0))) || + // TODO: последнее условие сделать отдельно + (!isReturnLeasing && !dealerPerson) + ) { + $calculation.setValidation('selectDealerPerson', false); + } else { + $calculation.setValidation('selectDealerPerson', undefined); + } + + if ( + dealerBrokerRewardSumm > 0 && + dealerBroker && + ((dealerBroker === dealerPerson && dealerRewardSumm > 0) || + (dealerBroker === indAgent && indAgentRewardSumm > 0) || + (dealerBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) || + (dealerBroker === calcBroker && calcBrokerRewardSum > 0) || + (dealerBroker === calcFinDepartment && finDepartmentRewardSumm > 0)) + ) { + $calculation.setValidation('selectDealerBroker', false); + } else { + $calculation.setValidation('selectDealerBroker', undefined); + } + + if ( + indAgentRewardSumm > 0 && + indAgent && + ((indAgent === dealerPerson && dealerRewardSumm > 0) || + (indAgent === dealerBroker && dealerBrokerRewardSumm > 0) || + (indAgent === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) || + (indAgent === calcBroker && calcBrokerRewardSum > 0) || + (indAgent === calcFinDepartment && finDepartmentRewardSumm > 0)) + ) { + $calculation.setValidation('selectIndAgent', false); + } else { + $calculation.setValidation('selectIndAgent', undefined); + } + + if ( + calcDoubleAgentRewardSumm > 0 && + calcDoubleAgent && + ((calcDoubleAgent === dealerPerson && dealerRewardSumm > 0) || + (calcDoubleAgent === dealerBroker && dealerBrokerRewardSumm > 0) || + (calcDoubleAgent === indAgent && indAgentRewardSumm > 0) || + (calcDoubleAgent === calcBroker && calcBrokerRewardSum > 0) || + (calcDoubleAgent === calcFinDepartment && finDepartmentRewardSumm > 0)) + ) { + $calculation.setValidation('selectCalcDoubleAgent', false); + } else { + $calculation.setValidation('selectCalcDoubleAgent', undefined); + } + + if ( + calcBrokerRewardSum > 0 && + calcBroker && + ((calcBroker === dealerPerson && dealerRewardSumm > 0) || + (calcBroker === dealerBroker && dealerBrokerRewardSumm > 0) || + (calcBroker === indAgent && indAgentRewardSumm > 0) || + (calcBroker === calcDoubleAgent && calcDoubleAgentRewardSumm > 0) || + (calcBroker === calcFinDepartment && finDepartmentRewardSumm > 0)) + ) { + $calculation.setValidation('selectCalcBroker', false); + } else { + $calculation.setValidation('selectCalcBroker', undefined); + } + + if ( + finDepartmentRewardSumm > 0 && + calcFinDepartment && + ((calcFinDepartment === dealerPerson && dealerRewardSumm > 0) || + (calcFinDepartment === dealerBroker && dealerBrokerRewardSumm > 0) || + (calcFinDepartment === indAgent && indAgentRewardSumm > 0) || + (calcFinDepartment === calcDoubleAgent && + calcDoubleAgentRewardSumm > 0) || + (calcFinDepartment === calcBroker && calcBrokerRewardSum > 0)) + ) { + $calculation.setValidation('selectCalcFinDepartment', false); + } else { + $calculation.setValidation('selectCalcFinDepartment', undefined); + } +} diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts index 2e87ac2..70ab469 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/elements.ts @@ -145,7 +145,7 @@ const elementsValidations: Partial< selectModel: CONDITIONS.IS_NULL, selectLeaseObjectUseFor: CONDITIONS.IS_NULL, selectDealer: CONDITIONS.IS_NULL, - selectDealerPerson: CONDITIONS.IS_NULL, + // selectDealerPerson: CONDITIONS.IS_NULL, selectRegionRegistration: CONDITIONS.IS_NULL, selectTarif: CONDITIONS.IS_NULL, // selectRate: VALIDATIONS.IS_NULL, diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/index.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/index.ts index 907029c..67b1571 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate/index.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate/index.ts @@ -1,8 +1,10 @@ import { ICalculationStore } from 'core/types/Calculation/Store'; +import customValidation from './custom'; import validateElements from './elements'; import validateTables from './tables'; export default function (this: ICalculationStore) { + customValidation(this); validateElements.call(this); validateTables.call(this); } diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts index c82946d..3bbad4b 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts @@ -1,9 +1,10 @@ +import { gql } from '@apollo/client'; import { message } from 'antd'; import { resetIns } from 'client/Containers/Calculation/Components/ELT/lib/resetIns'; import { numberElementsProps } from 'client/Containers/Calculation/Elements/props/common'; import { getTitle, - getValueName + getValueName, } from 'client/Containers/Calculation/Elements/tools'; import { ElementsNames } from 'client/Containers/Calculation/types/elements'; import { openNotification } from 'client/Elements/Notification'; @@ -13,7 +14,7 @@ import { mainOptionsForQuoteQuery, quoteQuery, secondaryOptionsForQuoteQuery, - singleOptionsForQuoteQuery + singleOptionsForQuoteQuery, } from 'core/services/CrmService/graphql/query/quote'; import { TOptionizedEntity } from 'core/services/CrmService/types/common'; import { @@ -21,7 +22,7 @@ import { IAccount, IEvoGraph, IEvoTown, - IQuote + IQuote, } from 'core/services/CrmService/types/entities'; import { currentISODate } from 'core/tools/date'; import { NIL } from 'core/tools/uuid'; @@ -165,6 +166,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ //TODO: refactor const { indAgent, calcBroker, calcFinDepartment } = calculationStore.values; + let { indAgentRewardCondition, indAgentRewardSumm, @@ -199,6 +201,85 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ }; // agents + // dealer + + let { dealerPerson } = calculationStore.values; + + // TODO: сделать запрос на account + const dealer = calculationStore.getOption('selectDealer', { + accountid: quote.evo_supplier_accountid, + }); + + if (dealer?.evo_return_leasing_dealer) { + calculationStore.setOptions('selectDealerPerson', []); + calculationStore.setValue('dealerPerson', null); + calculationStore.setStatus( + 'selectDealerPerson', + ElementStatus.Disabled, + ); + } else { + const { selectDealerPerson: dealerPersonOptions } = + await CrmService.getCRMOptions<'selectDealerPerson', IAccount>({ + query: gql` + query GetSelectDealerPersonByQuote($dealerId: Uuid!) { + selectDealerPerson: salon_providers( + statecode: 0 + salonaccountid: $dealerId + ) { + accountid + name + evo_broker_accountid + evo_kpp + evo_inn + } + } + `, + variables: { + dealerId: quote.evo_supplier_accountid, + }, + }); + + const dealer_broker_accountid = + dealerPersonOptions && + dealerPersonOptions?.length > 0 && + dealerPersonOptions[0].evo_broker_accountid; + if (dealer_broker_accountid) { + const { selectDealerBroker: dealerBrokerOptions } = + await CrmService.getCRMOptions<'selectDealerBroker', IAccount>({ + query: gql` + query GetDealerBrokerByDealerPerson($brokerid: Uuid!) { + selectDealerBroker: account(accountid: $brokerid) { + accountid + name + } + } + `, + variables: { + brokerid: dealer_broker_accountid, + }, + }); + if (dealerBrokerOptions) + calculationStore.setOptions( + 'selectDealerBroker', + dealerBrokerOptions, + ); + } + + if (dealerPersonOptions?.length) { + calculationStore.setOptions( + 'selectDealerPerson', + dealerPersonOptions, + ); + dealerPerson = quote.evo_dealer_person_accountid; + calculationStore.setStatus( + 'selectDealerPerson', + ElementStatus.Default, + ); + } + } + + // dealer + // fill insurance table calculationStore.setTableRows( 'tableInsurance', @@ -601,6 +682,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ engineHours, leasingPeriod, objectRegistration, + dealerPerson, }; // check min max number values diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts index 9c06741..4ad2969 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/mapKpToValues.ts @@ -44,7 +44,7 @@ const mapKPtoValues: Partial> = { evo_seats: 'countSeats', evo_max_speed: 'maxSpeed', evo_supplier_accountid: 'dealer', - evo_dealer_person_accountid: 'dealerPerson', + // evo_dealer_person_accountid: 'dealerPerson', evo_dealer_reward_conditionid: 'dealerRewardCondition', evo_dealer_reward_total: 'dealerRewardSumm', evo_dealer_broker_accountid: 'dealerBroker', diff --git a/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts index 5e6b2ea..1bab417 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/requestReactions.ts @@ -539,7 +539,7 @@ export default [ const dealer = calculationStore.getOption('selectDealer', { accountid: dealerId, }); - if (dealer) { + if (dealer && !dealer.evo_return_leasing_dealer) { CrmService.getCRMOptions<'salon_providers', ISalonProvider>({ query: gql` query selectDealerPerson( diff --git a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts index 9096344..2e82ec9 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/tablesReactions.ts @@ -744,14 +744,13 @@ export default [ const { leaseObjectCategory } = calculationStore.values; return leaseObjectCategory; }, - effect: (nextLeaseObjectCategory, prevLeaseObjectCategory) => { + effect: leaseObjectCategory => { if (calculationProcess.hasProcess(Process.LoadKp)) { return; } - const nextIsTrailer = nextLeaseObjectCategory === 100000004; - const prevIsTrailer = prevLeaseObjectCategory === 100000004; + const isTrailer = leaseObjectCategory === 100000004; - if (nextIsTrailer) { + if (isTrailer) { const otherInsuranceCompany = calculationStore.tables.tableInsurance.options?.insuranceCompany?.find( x => x.name?.includes('ПРОЧИЕ'), @@ -774,10 +773,6 @@ export default [ value: 0, status: ElementStatus.Disabled, }, - insured: { - value: 100000000, - status: ElementStatus.Disabled, - }, }); } } else { @@ -788,15 +783,12 @@ export default [ )({ insuranceCompany: { filter: insuranceOsagoDefaultFilter, - value: prevIsTrailer ? null : undefined, + value: isTrailer ? null : undefined, status: ElementStatus.Default, }, insCost: { status: ElementStatus.Default, }, - insured: { - status: ElementStatus.Default, - }, }); } }, diff --git a/src/client/stores/CalculationStore/index.ts b/src/client/stores/CalculationStore/index.ts index 40eda51..36aafcc 100644 --- a/src/client/stores/CalculationStore/index.ts +++ b/src/client/stores/CalculationStore/index.ts @@ -1,3 +1,4 @@ +import leasebackReactions from 'client/process/agents/leaseback'; import injectBonusesReaction from 'client/process/bonuses/reactions'; import { injectConfiguratorReactions } from 'client/process/configurator/reactions'; import { injectFinGapReactions } from 'client/process/fingap/reactions'; @@ -43,6 +44,7 @@ injectUsedWhthVATReactions(CalculationStore); injectConfiguratorReactions(CalculationStore); injectSubsidyReactions(CalculationStore); injectBonusesReaction(CalculationStore); +leasebackReactions(CalculationStore); whenEffects.map(whenEffectBuilder => { const whenEffect = whenEffectBuilder(CalculationStore); 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 0a3c12b..c99ee71 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -34,6 +34,7 @@ query GetMainOptions( ) { name accountid + evo_return_leasing_dealer } selectGPSBrand: evo_gps_brands(statecode: $statecode) { evo_name diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index a9e1e41..2f81c39 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -1,15 +1,9 @@ -""" -The cost directives is used to express the complexity of a field. -""" +"""The cost directives is used to express the complexity of a field.""" directive @cost( - """ - Defines the complexity of the field. - """ + """Defines the complexity of the field.""" complexity: Int! = 1 - """ - Defines field arguments that act as complexity multipliers. - """ + """Defines field arguments that act as complexity multipliers.""" multipliers: [MultiplierPath!] ) on FIELD_DEFINITION @@ -29,9 +23,7 @@ Export this locally resolved field as a variable to be used in the remainder of https://www.apollographql.com/docs/react/essentials/local-state/#using-client-fields-as-variables """ directive @export( - """ - The variable name to export this field as. - """ + """The variable name to export this field as.""" as: String! ) on FIELD @@ -40,9 +32,7 @@ Specify a custom store key for this result. See https://www.apollographql.com/docs/react/advanced/caching/#the-connection-directive """ directive @connection( - """ - Specify the store key. - """ + """Specify the store key.""" key: String! """ @@ -59,204 +49,87 @@ scalar MultiplierPath type Query { account(accountid: Uuid!): account - """ - Контрагенты. statecode по умолчанию 0 - """ - accounts( - evo_accnumber: String - evo_account_type: [Int!] - evo_broker_accountid: Uuid - evo_fin_department_accountid: Uuid - evo_id_elt: String - evo_inn: String - evo_kpp: String - evo_legal_form: Int - evo_type_ins_policy: [Int!] - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [account] + """Контрагенты. statecode по умолчанию 0""" + accounts(evo_accnumber: String, evo_account_type: [Int!], evo_agency_agreementid: Uuid, evo_broker_accountid: Uuid, evo_fin_department_accountid: Uuid, evo_id_elt: String, evo_inn: String, evo_inn_param: StringParamInput, evo_kpp: String, evo_kpp_param: StringParamInput, evo_legal_form: Int, evo_type_ins_policy: [Int!], name: String, ownerid: Uuid, owner_domainname: String, statecode: Int): [account] - """ - Брокер. statecode по умолчанию 0 - """ + """Брокер. statecode по умолчанию 0""" broker_agents(ownnerid: Uuid!, statecode: Int): [account] contacts(parentcustomerid: Uuid, statecode: Int): [contact] email(activityid: Uuid!): email + entity_schemas(logical_name: String): [entity_schema] evo_addcontract(evo_addcontractid: Uuid!): evo_addcontract evo_addproduct(evo_addproductid: Uuid!): evo_addproduct evo_addproduct_type(evo_addproduct_typeid: Uuid!): evo_addproduct_type - evo_addproduct_types( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_max_period_param: DecimalParamInput - evo_min_period_param: DecimalParamInput - evo_product_type: Int - statecode: Int - ): [evo_addproduct_type] + evo_addproduct_types(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_max_period_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, evo_product_type: Int, statecode: Int): [evo_addproduct_type] evo_address(evo_addressid: Uuid!): evo_address - evo_addresses( - evo_address_name: String - evo_fias: Boolean - statecode: Int - ): [evo_address] + evo_addresses(evo_address_name: String, evo_fias: Boolean, statecode: Int): [evo_address] evo_agency_agreement(evo_agency_agreementid: Uuid!): evo_agency_agreement - evo_bank_detailses( - evo_accountid: Uuid - orderby: OrderByInput - statecode: Int = 0 - ): [evo_bank_details] + evo_bank_detailses(evo_accountid: Uuid, orderby: OrderByInput, statecode: Int = 0): [evo_bank_details] evo_baseproduct(evo_baseproductid: Uuid!): evo_baseproduct - evo_baseproducts( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_relation: [Int!] - statecode: Int - ): [evo_baseproduct] - evo_brands(evo_vehicle_type: [Int!], statecode: Int): [evo_brand] + evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] + evo_brand(evo_brandid: Uuid!): evo_brand + evo_brands(evo_name: String, evo_vehicle_type: [Int!], statecode: Int): [evo_brand] evo_businessunits(statecode: Int): [evo_businessunit] evo_client_risks(statecode: Int): [evo_client_risk] evo_client_types(statecode: Int): [evo_client_type] - evo_coefficients( - evo_client_riskid: Uuid - evo_client_typeid: Uuid - evo_corfficient_type: Int - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_job_titleid: Uuid - evo_max_period_param: DecimalParamInput - evo_min_period_param: DecimalParamInput - statecode: Int - ): [evo_coefficient] + evo_coefficients(evo_client_riskid: Uuid, evo_client_typeid: Uuid, evo_corfficient_type: Int, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_job_titleid: Uuid, evo_max_period_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, statecode: Int): [evo_coefficient] evo_contract(evo_contractid: Uuid!): evo_contract - evo_contracts(evo_name: String, statecode: Int): [evo_contract] + evo_contracts(evo_accountid: Uuid, evo_name: String, statecode: Int): [evo_contract] evo_countries(evo_code_numeric: String): [evo_countryGraphQL] evo_country(evo_countryid: Uuid!): evo_countryGraphQL - evo_currencychanges( - evo_coursedate_param: DateParamInput - evo_ref_transactioncurrency: Uuid - statecode: Int - ): [evo_currencychange] + evo_currencychanges(evo_coursedate_param: DateParamInput, evo_ref_transactioncurrency: Uuid, statecode: Int): [evo_currencychange] evo_debtwork_contract(debtworkContractId: Uuid!): evo_debtwork_contract + evo_debtwork_contracts(evo_accountid: Uuid, evo_statuscodeid: Uuid, statecode: Int): [evo_debtwork_contract] evo_equipments(evo_modelid: Uuid, statecode: Int): [evo_equipment] - evo_external_supplier_codes( - evo_id: String - statecode: Int - ): [evo_external_supplier_code] - evo_external_system_request( - evo_external_system_requestid: Uuid! - ): evo_external_system_request - evo_external_system_requests( - evo_integration_status: Int - evo_name: String - evo_system: Int - statecode: Int - ): [evo_external_system_request] + evo_external_supplier_codes(evo_id: String, statecode: Int): [evo_external_supplier_code] + evo_external_system_request(evo_external_system_requestid: Uuid!): evo_external_system_request + evo_external_system_requests(evo_integration_status: Int, evo_name: String, evo_system: Int, statecode: Int): [evo_external_system_request] evo_finegibdd(evo_finegibddid: Uuid!): evo_finegibdd evo_gps_brands(statecode: Int): [evo_gps_brand] evo_gps_models(evo_gps_brandid: Uuid, statecode: Int): [evo_gps_model] evo_graphs(evo_contractid: Uuid, statecode: Int): [evo_graph] - evo_identity_documents( - evo_employee_systemuserid: Uuid! - ): [evo_identity_document] + evo_identity_documents(evo_employee_systemuserid: Uuid!): [evo_identity_document] evo_impairment_groups(statecode: Int): [evo_impairment_group] - evo_insurance_periods( - evo_contractid: Uuid - statecode: Int - ): [evo_insurance_period] + evo_insurance_periods(evo_contractid: Uuid, statecode: Int): [evo_insurance_period] evo_job_titles(statecode: Int): [evo_job_title] evo_leasingobject(evo_leasingobjectid: Uuid!): evo_leasingobject - evo_leasingobject_type( - evo_leasingobject_typeid: Uuid! - ): evo_leasingobject_type + evo_leasingobject_type(evo_leasingobject_typeid: Uuid!): evo_leasingobject_type evo_leasingobject_types(statecode: Int): [evo_leasingobject_type] evo_model(evo_modelid: Uuid!): evo_model - evo_models( - evo_brandid: Uuid - evo_vehicle_type: Int - statecode: Int - ): [evo_model] + evo_models(evo_brandid: Uuid, evo_name: String, evo_vehicle_type: Int, statecode: Int): [evo_model] evo_orglegalform(evo_orglegalformid: Uuid!): evo_orglegalform evo_orglegalforms(statecode: Int = 0): [evo_orglegalform] - evo_paymentorders( - evo_dds_1c: String - evo_name: String - evo_paydate_param: DateParamInput - evo_payment_number_1c: String - evo_paysum: Decimal - statecode: Int - statuscode: Int - ): [evo_paymentorder] - evo_planpayments( - evo_addproduct_typeid: Uuid - statecode: Int - ): [evo_planpayment] + evo_paymentorders(evo_dds_1c: String, evo_name: String, evo_paydate_param: DateParamInput, evo_payment_number_1c: String, evo_paysum: Decimal, statecode: Int, statuscode: Int): [evo_paymentorder] + evo_planpayments(evo_addproduct_typeid: Uuid, statecode: Int): [evo_planpayment] evo_product_risk(evo_product_riskid: Uuid!): evo_product_risk evo_product_risks(statecode: Int): [evo_product_risk] evo_rate(evo_rateid: Uuid!): evo_rate - evo_rates( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - statecode: Int - ): [evo_rate] + evo_rates(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_rate] - """ - Регион. statecode по умолчанию 0 - """ - evo_regions( - evo_businessunit_evolution: Boolean - evo_creditregistry_id: Int - statecode: Int - ): [evo_region] + """Регион. statecode по умолчанию 0""" + evo_regions(evo_businessunit_evolution: Boolean, evo_creditregistry_id: Int, statecode: Int): [evo_region] evo_request_payment(evo_request_paymentid: Uuid!): evo_request_payment - evo_request_payments( - evo_id: String - evo_name: String - statecode: Int - ): [evo_request_payment] + evo_request_payments(evo_id: String, evo_name: String, statecode: Int): [evo_request_payment] evo_reward_condition(evo_reward_conditionid: Uuid!): evo_reward_condition - evo_reward_conditions( - evo_agency_agreementid_param: GuidParamInput - evo_agent_accountid: Uuid - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - statecode: Int - ): [evo_reward_condition] + evo_reward_conditions(evo_agency_agreementid_param: GuidParamInput, evo_agent_accountid: Uuid, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_reward_condition] + evo_scheduled_call(evo_scheduled_callid: Uuid!): evo_scheduled_call + evo_scheduled_calls(evo_inn: String, evo_status: [Int!], evo_telephone1: String, evo_telephone2: String, statecode: Int): [evo_scheduled_call] evo_sot_coefficient_types(statecode: Int): [evo_sot_coefficient_type] evo_statuscode(evo_id: String, evo_statuscodeid: Uuid): evo_statuscode evo_statuscodes(statecode: Int): [evo_statuscode] - evo_subsidies( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - statecode: Int - ): [evo_subsidy] + evo_subject_incidents(statecode: Int): [evo_subject_incident] + evo_subsidies(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, statecode: Int): [evo_subsidy] + evo_subsidy(evo_subsidyid: Uuid!): evo_subsidy evo_tarif(evo_tarifid: Uuid!): evo_tarif - evo_tarifs( - evo_balance_holder: [Int!] - evo_baseproductid: Uuid - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_graphtype_exception: [Int!] - evo_ins_type: [Int!] - evo_max_first_payment_param: DecimalParamInput - evo_max_last_payment_param: DecimalParamInput - evo_max_period_param: DecimalParamInput - evo_min_first_payment_param: DecimalParamInput - evo_min_last_payment_param: DecimalParamInput - evo_min_period_param: DecimalParamInput - evo_used: Boolean - statecode: Int - ): [evo_tarif] + evo_tarifs(evo_balance_holder: [Int!], evo_baseproductid: Uuid, evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_graphtype_exception: [Int!], evo_ins_type: [Int!], evo_max_first_payment_param: DecimalParamInput, evo_max_last_payment_param: DecimalParamInput, evo_max_period_param: DecimalParamInput, evo_min_first_payment_param: DecimalParamInput, evo_min_last_payment_param: DecimalParamInput, evo_min_period_param: DecimalParamInput, evo_used: Boolean, statecode: Int): [evo_tarif] evo_town(evo_fias_id: String, evo_townid: Uuid): evo_town - """ - Города. statecode по умолчанию 0 - """ + """Города. statecode по умолчанию 0""" evo_towns(evo_regionid: Uuid, statecode: Int): [evo_town] evo_typedocpackages(statecode: Int): [evo_typedocpackage] - evo_vehicle_body_type( - evo_vehicle_body_typeid: Uuid! - ): evo_vehicle_body_typeGraphQL + evo_vehicle_body_type(evo_vehicle_body_typeid: Uuid!): evo_vehicle_body_typeGraphQL + incident(incidentid: Uuid!): incidentGraphQL + incidents(customerid: Uuid, orderby: OrderByInput, statecode: Int): [incidentGraphQL] """ Лизинговые сделки. statecode по умолчанию 0, можно отфильтровать по ownerid и/или domainName @@ -266,18 +139,8 @@ type Query { """ Интересы. statecode по умолчанию 0, можно отфильтровать по ownerid и/или domainName """ - leads( - evo_opportunityid: Uuid - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [lead] - opportunities( - evo_leadid: Uuid - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [opportunity] + leads(evo_opportunityid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [lead] + opportunities(evo_leadid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [opportunity] opportunity(opportunityid: Uuid!): opportunity queue(emailaddress: String): queue quote(quoteId: Uuid!): quote @@ -285,39 +148,194 @@ type Query { """ Предложения. statecode по умолчанию 0, можно отфильтровать по ownerid и/или domainName """ - quotes( - condition: ConditionInput - evo_leadid: Uuid - ownerid: Uuid - owner_domainname: String - statecode: Int - ): [quote] + quotes(condition: ConditionInput, evo_leadid: Uuid, ownerid: Uuid, owner_domainname: String, statecode: Int): [quote] - """ - Агенты салона. statecode по умолчанию 0 - """ + """Агенты салона. statecode по умолчанию 0""" salon_agents(salonaccountid: Uuid!, statecode: Int): [account] - """ - Поставщики ЮЛ салона. statecode по умолчанию 0 - """ + """Поставщики ЮЛ салона. statecode по умолчанию 0""" salon_providers(salonaccountid: Uuid!, statecode: Int): [account] systemuser(domainname: String, systemuserid: Uuid): systemuser - systemusers( - evo_employee_id: String - isdisabled: Boolean = false - ): [systemuser] + systemusers(domainname: String, evo_employee_id: String, isdisabled: Boolean = false): [systemuser] templates(description: String): [template] - """ - Валюта. statecode по умолчанию 0 - """ + """Валюта. statecode по умолчанию 0""" transactioncurrencies(statecode: Int): [transactioncurrency] transactioncurrency(transactioncurrencyid: Uuid!): transactioncurrency } type Mutation { - by(domainName: String): MutationBy + by(systemuserid: Uuid): MutationBy +} + +type evo_subject_incident { + createdon: DateTime + evo_group: Int + evo_groupname: String + evo_name: String + evo_subjectid: Uuid + evo_subject_incidentid: Uuid + evo_type_incident: Int + evo_type_incidentname: String + link: String + modifiedon: DateTime + toObjectString: String +} + +scalar Uuid + +input OrderByInput { + fieldName: String + sortingType: SortingType! +} + +input StringParamInput { + eq: String +} + +input DateParamInput { + eq: DateTime + gt: DateTime + gte: DateTime + lt: DateTime + lte: DateTime +} + +input DecimalParamInput { + eq: Decimal + gt: Decimal + gte: Decimal + lt: Decimal + lte: Decimal +} + +input ConditionInput { + conditions: [ConditionInput] + filters: [FilterInput] + logicoperation: LogicOperation! +} + +input GuidParamInput { + eq: Uuid + has: Boolean + in: [Uuid!] +} + +"""The built-in `Decimal` scalar type.""" +scalar Decimal + +type incidentGraphQL { + createdon: DateTime + customerid: Uuid + customerid_account: Uuid + customerid_contact: Uuid + description: String + evo_fast_advice: Boolean + evo_plan_execut_date: DateTime + evo_statuscodeid: Uuid + evo_statuscodeidData: evo_statuscode + evo_storage: String + evo_subject_incidentid: Uuid + evo_subject_incidentidData: evo_subject_incident + evo_taken_work_date: DateTime + evo_typedocpackageid: Uuid + incidentid: Uuid + link: String + modifiedon: DateTime + ownerid: Uuid + owneridData: systemuser + subjectid: Uuid + ticketnumber: String + title: String + toObjectString: String +} + +type entity_schema { + entity_id: String + entity_set_name: String + icon_large_name: String + icon_medium_name: String + icon_small_name: String + logical_name: String + object_type_code: Int! + picklists: [picklist] +} + +type evo_debtwork_contract { + createdon: DateTime + evo_accountid: Uuid + evo_accountidData: account + evo_contractid: Uuid + evo_contractidData: evo_contract + evo_date_change_statuscode: DateTime + evo_db_region_com: String + evo_debtwork_contractid: Uuid + evo_debt_restruct_description: String + evo_documents: [evo_document] + evo_economic_security_com: String + evo_erroneous_pay_contractname: String + evo_inspection_done: Boolean + evo_inspection_impossible: Boolean + evo_inspection_impossible_reason: String + evo_inspection_link_report: String + evo_inspection_systemuserid: Uuid + evo_inspection_systemuseridData: systemuser + evo_insurance_case_dateend: DateTime + evo_leasingobjectid: Uuid + evo_leasingobjectidData: evo_leasingobject + evo_name: String + evo_non_payment_count: Decimal + evo_opportunityid: Uuid + evo_plan_date_transfer_pay: DateTime + evo_redemption_com: String + evo_redemption_type: [Int!] + evo_result_debt_restruct: Boolean + evo_result_error_payment: Boolean + evo_result_inspection: Boolean + evo_result_insurance_case: Boolean + evo_result_redemption: Boolean + evo_result_termination: Boolean + evo_result_wait_payment: Boolean + evo_result_withdrawal: Boolean + evo_statuscodeid: Uuid + evo_statuscodeidData: evo_statuscode + evo_statuscode_reason: String + evo_storage: String + evo_termination_add_registry: Int + evo_termination_com: String + evo_termination_com_lawyer: String + evo_termination_lawyer_systemuserid: Uuid + evo_termination_lawyer_systemuseridData: systemuser + evo_termination_reason_terms: Int + evo_termination_reason_terms_doc: String + evo_termination_reason_terms_text: String + evo_termination_send_notice: Boolean + evo_termination_send_notice_date: DateTime + evo_termination_send_notice_repeat: Boolean + evo_termination_solution: Int + evo_termination_status_work: Int + evo_termination_suspended_until: DateTime + evo_termination_unique_notice: Boolean + evo_withdrawal_businessunitid: Uuid + evo_withdrawal_businessunitidData: businessunit + evo_withdrawal_done: Boolean + evo_withdrawal_impossible: Boolean + evo_withdrawal_impossible_reason: String + evo_withdrawal_issue_agreed: Int + evo_withdrawal_issue_done: Int + evo_withdrawal_issue_done_date: DateTime + evo_withdrawal_parking_addressid: Uuid + evo_withdrawal_parking_addressidData: evo_address + evo_withdrawal_plan_date: DateTime + evo_withdrawal_systemuserid: Uuid + evo_withdrawal_systemuseridData: systemuser + link: String + modifiedon: DateTime + ownerid: Uuid + ownerid_systemuser: Uuid + ownerid_systemuserData: systemuser + ownerid_team: Uuid + toObjectString: String } type account { @@ -334,6 +352,7 @@ type account { evo_address_legal_string: String evo_address_postalid: Uuid evo_address_postalidData: evo_address + evo_agency_agreementid: Uuid evo_bank_detailses(statecode: Int): [evo_bank_details] evo_branch_count: String evo_branch_type: Int @@ -347,10 +366,7 @@ type account { evo_dadatdalog: String evo_dealer_responsible_systemuserid: Uuid evo_div_12month: Boolean - evo_documents( - evo_documenttypeid_param: GuidParamInput - latestversion: Boolean = true - ): [evo_document] + evo_documents(evo_documenttypeid_param: GuidParamInput, latestversion: Boolean = true): [evo_document] evo_economic_security_systemuserid: Uuid evo_employee_count: Int evo_fingap_number_rules: Int @@ -388,6 +404,7 @@ type account { evo_orglegalformid: Uuid evo_orglegalformidData: evo_orglegalform evo_osago_with_kasko: Boolean + evo_return_leasing_dealer: Boolean evo_smb_category: Int evo_smb_issue_date: DateTime evo_state_actuality_date: DateTime @@ -396,8 +413,10 @@ type account { evo_state_status: Int evo_storage: String evo_subsidies(statecode: Int): [evo_subsidy] + evo_supplier_type: Int evo_tax_system: Int evo_type_ins_policy: [Int!] + evo_unscrupulous_supplier: Boolean link: String modifiedon: DateTime name: String @@ -409,49 +428,11 @@ type account { ownerid_team: Uuid statecode: Int telephone1: String + telephone2: String + telephone3: String toObjectString: String } -scalar Uuid - -input DateParamInput { - eq: DateTime - gt: DateTime - gte: DateTime - lt: DateTime - lte: DateTime -} - -input DecimalParamInput { - eq: Decimal - gt: Decimal - gte: Decimal - lt: Decimal - lte: Decimal -} - -input ConditionInput { - conditions: [ConditionInput] - filters: [FilterInput] - logicoperation: LogicOperation! -} - -input GuidParamInput { - eq: Uuid - has: Boolean - in: [Uuid!] -} - -""" -The built-in `Decimal` scalar type. -""" -scalar Decimal - -input OrderByInput { - fieldName: String - sortingType: SortingType! -} - type contact { birthdate: DateTime contactid: Uuid @@ -460,17 +441,23 @@ type contact { emailaddress2: String emailaddress3: String evo_consent_date: DateTime + evo_docdate: DateTime + evo_docnumber: String evo_fact_addressid: Uuid evo_fact_addressidname: String evo_fullname: String evo_functiontype: [Int!] + evo_functiontypenames: [String] evo_inn: String evo_name_dative: String evo_name_genitive: String evo_no_middle_name: Boolean evo_reg_addressid: Uuid evo_share_capital: Decimal + evo_signer_rule: Boolean evo_signer_rule_basis: Int + evo_signer_rule_basisname: String + evo_signer_rule_basis_add: String firstname: String fullname: String gendercode: Int @@ -567,6 +554,7 @@ type evo_baseproduct { evo_name: String evo_relation: [Int!] evo_sale_without_nds: Boolean + evo_scoring_available: Boolean modifiedon: DateTime statecode: Int systemusers(statecode: Int): [systemuser] @@ -699,6 +687,7 @@ type evo_external_supplier_code { createdon: DateTime evo_accountid: Uuid evo_accountidData: account + evo_available_lead_failure_reason: [Int!] evo_external_supplier_codeid: Uuid evo_id: String evo_manager_systemuserid: Uuid @@ -812,12 +801,14 @@ type evo_reward_condition { evo_agency_agreementidData: evo_agency_agreement evo_agent_accountid: Uuid evo_brandid: Uuid + evo_calc_reward_rules: Int evo_client_type: Int evo_condition_type: Int evo_datefrom: DateTime evo_dateto: DateTime evo_deactivated: Boolean evo_double_agent_accountid: Uuid + evo_min_reward_summ: Decimal evo_name: String evo_reduce_reward: Boolean evo_reward_conditionid: Uuid @@ -908,6 +899,7 @@ type opportunity { evo_businessunitid: Uuid evo_businessunitidData: businessunit evo_check_type: [Int!] + evo_check_type_fact: [Int!] evo_client_riskid: Uuid evo_client_riskidData: evo_client_risk evo_comment_description: String @@ -950,6 +942,7 @@ type opportunity { evo_sfm_comment: [Int!] evo_solution_average_cost: Int evo_solution_average_cost_com: String + evo_solution_average_cost_reason: String evo_solution_db: Int evo_statuscodeid: Uuid evo_statuscodeidData: evo_statuscode @@ -1011,6 +1004,7 @@ type quote { evo_card_quote: Boolean evo_category: Int evo_category_tr: Int + evo_check_average_result: Int evo_check_ins_result: Int evo_client_riskid: Uuid evo_client_typeid: Uuid @@ -1036,6 +1030,7 @@ type quote { evo_declaration_year: Int evo_delivery_time: Int evo_dgo_price: Decimal + evo_diagnostic: Int evo_director_bonus: Decimal evo_director_fingap_bonus: Decimal evo_director_nsib_bonus: Decimal @@ -1203,6 +1198,7 @@ type quote { evo_report_year: Int evo_req_telematic: Int evo_req_telematic_accept: Int + evo_return_leasing: Boolean evo_risk: Int evo_risk_coefficientid: Uuid evo_risk_profit_coefficientid: Uuid @@ -1219,6 +1215,7 @@ type quote { evo_subsidy_summ: Decimal evo_supplier_accountid: Uuid evo_supplier_currency_price: Decimal + evo_supplier_type: Int evo_tarifid: Uuid evo_tax_period: Decimal evo_telematic: Boolean @@ -1255,12 +1252,7 @@ type quote { type evo_brand { createdon: DateTime - evo_baseproducts( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_relation: [Int!] - statecode: Int - ): [evo_baseproduct] + evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] evo_brandid: Uuid evo_brand_owner: Int evo_id: String @@ -1276,12 +1268,7 @@ type evo_brand { type evo_model { createdon: DateTime - evo_baseproducts( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_relation: [Int!] - statecode: Int - ): [evo_baseproduct] + evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] evo_brandid: Uuid evo_gps: Boolean evo_high_risk_vehicle: Boolean @@ -1307,12 +1294,7 @@ type evo_model { type evo_equipment { createdon: DateTime - evo_baseproducts( - evo_datefrom_param: DateParamInput - evo_dateto_param: DateParamInput - evo_relation: [Int!] - statecode: Int - ): [evo_baseproduct] + evo_baseproducts(evo_datefrom_param: DateParamInput, evo_dateto_param: DateParamInput, evo_relation: [Int!], statecode: Int): [evo_baseproduct] evo_equipmentid: Uuid evo_id: String evo_impairment_groupid: Uuid @@ -1430,6 +1412,26 @@ type evo_gps_model { toObjectString: String } +type evo_scheduled_call { + createdon: DateTime + evo_accountid: Uuid + evo_channel: String + evo_company_name: String + evo_contact_lastname: String + evo_contact_name: String + evo_inn: String + evo_name: String + evo_note: String + evo_scheduled_callid: Uuid + evo_scheduled_time: DateTime + evo_status: Int + evo_telephone1: String + evo_telephone2: String + modifiedon: DateTime + ownerid: Uuid + toObjectString: String +} + type evo_impairment_group { createdon: DateTime evo_impairment_groupid: Uuid @@ -1442,6 +1444,7 @@ type evo_impairment_group { type transactioncurrency { createdon: DateTime currencyname: String + currencysymbol: String isocurrencycode: String modifiedon: DateTime statecode: Int @@ -1492,6 +1495,7 @@ type evo_request_payment { evo_kpp: String evo_leasingobjectid: Uuid evo_name: String + evo_new_version: Boolean evo_number_dkp: String evo_oktmo_mreo: String evo_opportunityid: Uuid @@ -1512,9 +1516,11 @@ type evo_request_payment { evo_region_director_systemuserid: Uuid evo_request_paymentid: Uuid evo_request_payment_type: Int + evo_service_list: [Int!] evo_statuscodeid: Uuid evo_storage: String evo_supplier_payment_type: Int + evo_top_agency_agreementid: Uuid evo_transactioncurrencyid: Uuid evo_transfer_contact: Boolean evo_vat: Decimal @@ -1536,10 +1542,13 @@ type evo_contract { evo_add_bonus_summ: Decimal evo_add_director_bonus: Decimal evo_add_region_director_bonus: Decimal + evo_advance_pay_long_delivery: Decimal evo_agent_accountid: Uuid + evo_agent_request_paymentid: Uuid evo_agent_reward: Decimal evo_agent_reward_conditionid: Uuid evo_agent_reward_summ: Decimal + evo_agent_service_list: [Int!] evo_approvallogs: [evo_approvallog] evo_balance_holder: Int evo_bank_detailsid: Uuid @@ -1547,9 +1556,11 @@ type evo_contract { evo_base_calc_pay: Decimal evo_bonus_pay_systemuserid: Uuid evo_broker_accountid: Uuid + evo_broker_request_paymentid: Uuid evo_broker_reward: Decimal evo_broker_reward_conditionid: Uuid evo_broker_reward_summ: Decimal + evo_broker_service_list: [Int!] evo_businessunitid: Uuid evo_calc_irr: Decimal evo_calc_profit: Decimal @@ -1562,6 +1573,7 @@ type evo_contract { evo_coefficien_bonus_reducttion: Decimal evo_contractid: Uuid evo_contract_status_1c: Int + evo_contract_status_1cname: String evo_contract_status_change_date_in_crm: DateTime evo_contract_status_date_1c: DateTime evo_dateend: DateTime @@ -1569,15 +1581,20 @@ type evo_contract { evo_date_of_pledge_leasobject: DateTime evo_date_termination: DateTime evo_dealer_broker_accountid: Uuid + evo_dealer_broker_request_paymentid: Uuid evo_dealer_broker_reward: Decimal evo_dealer_broker_reward_conditionid: Uuid evo_dealer_broker_reward_summ: Decimal + evo_dealer_broker_service_list: [Int!] evo_dealer_person_accountid: Uuid evo_dealer_person_accountidData: account + evo_dealer_person_request_paymentid: Uuid evo_dealer_person_reward: Decimal evo_dealer_person_reward_conditionid: Uuid evo_dealer_person_reward_summ: Decimal + evo_dealer_person_service_list: [Int!] evo_debtwork_contractid: Uuid + evo_debtwork_contractidData: evo_debtwork_contract evo_debtwork_contracts: [evo_debtwork_contract] evo_debt_leasing: Decimal evo_debt_penalty_fee: Decimal @@ -1594,9 +1611,11 @@ type evo_contract { evo_dogovortype: Int evo_dog_credit: Decimal evo_double_agent_accountid: Uuid + evo_double_agent_request_paymentid: Uuid evo_double_agent_reward: Decimal evo_double_agent_reward_conditionid: Uuid evo_double_agent_reward_summ: Decimal + evo_double_agent_service_list: [Int!] evo_economic: Decimal evo_economic_actual: Decimal evo_economic_with_nds: Decimal @@ -1611,9 +1630,11 @@ type evo_contract { evo_fingap_period: Int evo_finmon_message_date: DateTime evo_fin_department_accountid: Uuid + evo_fin_department_request_paymentid: Uuid evo_fin_department_reward: Decimal evo_fin_department_reward_conditionid: Uuid evo_fin_department_reward_summ: Decimal + evo_fin_department_service_list: [Int!] evo_first_payment_fact: Decimal evo_first_payment_fact_date: DateTime evo_first_payment_perc: Decimal @@ -1637,6 +1658,7 @@ type evo_contract { evo_irr_msfo_final_actual: Decimal evo_issue_date_buh: DateTime evo_issue_place_addressid: Uuid + evo_issue_without_pay: Boolean evo_last_payment_redemption: Boolean evo_leasingobjectid: Uuid evo_leasingobjectidData: evo_leasingobject @@ -1649,6 +1671,7 @@ type evo_contract { evo_name: String evo_nds_in_price_supplier_currency: Decimal evo_nds_perc: Decimal + evo_nearest_payment_num: String evo_net_irr: Decimal evo_niatinception_msfo: Decimal evo_niatinception_msfo_actual: Decimal @@ -1676,6 +1699,7 @@ type evo_contract { evo_rate: Decimal evo_rateid: Uuid evo_reason_change_account: Int + evo_redemption_archive_date: DateTime evo_ref_opportunityid: Uuid evo_region_director_bonus: Decimal evo_region_director_fingap_bonus: Decimal @@ -1701,17 +1725,21 @@ type evo_contract { evo_supplier_bank_detailsidData: evo_bank_details evo_supplier_currency_price: Decimal evo_supplier_pay1_sum: Decimal + evo_supplier_pay2_sum: Decimal evo_supplier_payfull_date: DateTime evo_supplier_pay_actual: Decimal evo_supplier_pay_actual_currency: Decimal evo_supplier_signer_contactid: Uuid + evo_supplier_type: Int evo_tarifid: Uuid evo_telematics_addproduct_typeid: Uuid evo_telematics_addproduct_typeid_new: Uuid + evo_telematics_equipment2_addproductid: Uuid evo_telematics_equipment_addproductid: Uuid evo_telematics_equipment_addproductidData: evo_addproduct evo_telematics_service_addproductid: Uuid evo_termreason: Int + evo_termreasonname: String evo_tracking_addproductid: Uuid evo_tracking_addproductidData: evo_addproduct evo_tracking_addproduct_typeid: Uuid @@ -2006,6 +2034,7 @@ type systemuser { domainname: String evo_baseproducts(statecode: Int): [evo_baseproduct] evo_callrecords_access: Boolean + evo_can_import_sheduled_calls: Boolean evo_datebirth: DateTime evo_employee_id: String evo_fedresurs_rules: Boolean @@ -2091,20 +2120,31 @@ type evo_agency_agreement { evo_agency_agreement_number: String evo_agency_agreement_type: Int evo_agent_accountid: Uuid + evo_agent_accountidData: account + evo_agent_type: Int evo_bank_detailsid: Uuid evo_boss_comment: String evo_boss_decision: Int + evo_branch_agreement: Boolean evo_businessunitid: Uuid evo_contactid: Uuid evo_datefrom: DateTime evo_dateto: DateTime evo_date_change_statuscode: DateTime + evo_decentral: Boolean evo_director_comment: String evo_director_decision: Int + evo_leasingobject_price: Int + evo_location: String evo_name: String + evo_new_version: Boolean evo_number: Int evo_region_director_comment: String evo_region_director_decision: Int + evo_required_reward: Boolean + evo_reward_without_other_agent: Boolean + evo_select_lp: Boolean + evo_select_vin: Boolean evo_signer_systemuserid: Uuid evo_statuscodeid: Uuid evo_storage: String @@ -2116,7 +2156,9 @@ type evo_agency_agreement { evo_term_topboss_systemuserid: Uuid evo_topboss_comment: String evo_topboss_decision: Int + evo_top_agency_agreementid: Uuid evo_top_termination: Int + evo_untype_doc: Boolean modifiedon: DateTime ownerid_systemuser: Uuid ownerid_team: Uuid @@ -2154,6 +2196,7 @@ type evo_addcontract { evo_businessunitid: Uuid evo_calculation_method: Int evo_calculator_type: Int + evo_calc_checks_disable: Boolean evo_calc_profit: Decimal evo_category: Int evo_category_new: Int @@ -2429,6 +2472,7 @@ type email { evo_accountid: Uuid modifiedon: DateTime regardingobjectid_account: Uuid + regardingobjectid_evo_addcontract: Uuid regardingobjectid_evo_contract: Uuid regardingobjectid_evo_insurance_period: Uuid regardingobjectid_evo_insurance_policy: Uuid @@ -2450,6 +2494,7 @@ type evo_bank_details { evo_bank_detailsid: Uuid evo_contactid: Uuid evo_corresponding_account: String + evo_datefrom: DateTime evo_kbk: String evo_name: String evo_payment_account: String @@ -2497,90 +2542,59 @@ type evo_typedocpackage { toObjectString: String } -type evo_debtwork_contract { - createdon: DateTime - evo_accountid: Uuid - evo_accountidData: account - evo_contractid: Uuid - evo_contractidData: evo_contract - evo_date_change_statuscode: DateTime - evo_db_region_com: String - evo_debtwork_contractid: Uuid - evo_debt_restruct_description: String - evo_documents: [evo_document] - evo_economic_security_com: String - evo_erroneous_pay_contractname: String - evo_inspection_done: Boolean - evo_inspection_impossible: Boolean - evo_inspection_impossible_reason: String - evo_inspection_link_report: String - evo_inspection_systemuserid: Uuid - evo_inspection_systemuseridData: systemuser - evo_insurance_case_dateend: DateTime - evo_leasingobjectid: Uuid - evo_leasingobjectidData: evo_leasingobject - evo_non_payment_count: Decimal - evo_opportunityid: Uuid - evo_plan_date_transfer_pay: DateTime - evo_redemption_com: String - evo_redemption_type: [Int!] - evo_result_debt_restruct: Boolean - evo_result_error_payment: Boolean - evo_result_inspection: Boolean - evo_result_insurance_case: Boolean - evo_result_redemption: Boolean - evo_result_termination: Boolean - evo_result_wait_payment: Boolean - evo_result_withdrawal: Boolean - evo_statuscodeid: Uuid - evo_statuscodeidData: evo_statuscode - evo_statuscode_reason: String - evo_storage: String - evo_termination_add_registry: Int - evo_termination_com: String - evo_termination_com_lawyer: String - evo_termination_lawyer_systemuserid: Uuid - evo_termination_lawyer_systemuseridData: systemuser - evo_termination_reason_terms: Int - evo_termination_reason_terms_doc: String - evo_termination_reason_terms_text: String - evo_termination_send_notice: Boolean - evo_termination_send_notice_date: DateTime - evo_termination_send_notice_repeat: Boolean - evo_termination_solution: Int - evo_termination_status_work: Int - evo_termination_suspended_until: DateTime - evo_termination_unique_notice: Boolean - evo_withdrawal_businessunitid: Uuid - evo_withdrawal_businessunitidData: businessunit - evo_withdrawal_done: Boolean - evo_withdrawal_impossible: Boolean - evo_withdrawal_impossible_reason: String - evo_withdrawal_issue_agreed: Int - evo_withdrawal_issue_done: Int - evo_withdrawal_parking_addressid: Uuid - evo_withdrawal_parking_addressidData: evo_address - evo_withdrawal_plan_date: DateTime - evo_withdrawal_systemuserid: Uuid - evo_withdrawal_systemuseridData: systemuser - link: String - modifiedon: DateTime - ownerid: Uuid - ownerid_systemuser: Uuid - ownerid_systemuserData: systemuser - ownerid_team: Uuid - toObjectString: String +type MutationBy { + associateBankDetailsAndAgencyAgreement_(evo_agency_agreementid: Uuid!, evo_bank_detailsid: Uuid!): Entity + createEntity(data: EntityDataInput): Uuid! + createIncident_(contracts: [Uuid!], customerid_account: Uuid, description: String, evo_fast_advice: Boolean, evo_subject_incidentid: Uuid, subjectid: Uuid, title: String): Entity + createScheduledCall_(evo_accountid: Uuid, evo_channel: String, evo_company_name: String, evo_contact_lastname: String, evo_contact_name: String, evo_inn: String, evo_name: String, evo_note: String, evo_scheduled_time: DateTime, evo_status: Int, evo_telephone1: String, ownerid: Uuid): Entity + updateAccount_(accountid: Uuid!, evo_agency_agreementid: Uuid): Entity + updateEntity(data: EntityDataInput): Boolean! } -type MutationBy { - createEntity(data: EntityDataInput): Uuid! - updateEntity(data: EntityDataInput): Boolean! +"""The `DateTime` scalar represents an ISO-8601 compliant date time type.""" +scalar DateTime + +enum SortingType { + DESC + ASC +} + +input FilterInput { + fieldname: String + guidvalues: [Uuid] + intvalues: [Int!] + operation: FilterOperation! + stringvalues: [String] +} + +enum LogicOperation { + AND + OR +} + +type picklist { + name: String + values: [picklist_value] +} + +type businessunit { + businessunitid: Uuid + createdon: DateTime + evo_addressid: Uuid + evo_boss_systemuserid: Uuid + evo_director_systemuserid: Uuid + evo_region_director_systgemuserid: Uuid + evo_region_director_systgemuseridname: String + modifiedon: DateTime + name: String + toObjectString: String } type evo_document { createdon: DateTime evo_accountid: Uuid evo_changed_record_systemuserid: Uuid + evo_changed_record_systemuseridData: systemuser evo_comment_original: String evo_comment_previous: String evo_comment_scan: String @@ -2613,29 +2627,6 @@ type team { toObjectString: String } -""" -The `DateTime` scalar represents an ISO-8601 compliant date time type. -""" -scalar DateTime - -input FilterInput { - fieldname: String - guidvalues: [Uuid] - intvalues: [Int!] - operation: FilterOperation! - stringvalues: [String] -} - -enum LogicOperation { - AND - OR -} - -enum SortingType { - DESC - ASC -} - type evo_insurance_policy { createdon: DateTime evo_accountid: Uuid @@ -2676,19 +2667,6 @@ type evo_addproductnumber { toObjectString: String } -type businessunit { - businessunitid: Uuid - createdon: DateTime - evo_addressid: Uuid - evo_boss_systemuserid: Uuid - evo_director_systemuserid: Uuid - evo_region_director_systgemuserid: Uuid - evo_region_director_systgemuseridname: String - modifiedon: DateTime - name: String - toObjectString: String -} - type evo_approvallog { createdon: DateTime evo_addcontractid: Uuid @@ -2748,6 +2726,29 @@ input EntityDataInput { logicalName: String } +type Entity { + entity_id: Uuid! + logical_name: String +} + +enum FilterOperation { + ISNULL + EQUAL + CONTAINS + NOTCONTAINS + MORETHEN + MOREOREQUALTHEN + LESSTHEN + LESSOREQUALTHEN +} + +type picklist_value { + color: String + label: String + order: Int! + value: Int! +} + type evo_documenttype { createdon: DateTime evo_comment: String @@ -2766,17 +2767,6 @@ type evo_documenttype { toObjectString: String } -enum FilterOperation { - ISNULL - EQUAL - CONTAINS - NOTCONTAINS - MORETHEN - MOREOREQUALTHEN - LESSTHEN - LESSOREQUALTHEN -} - input EntityFieldInput { activitypartiesvalue: [activitypartyInput] boolvalue: Boolean diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index ec0660b..741b7b7 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -43,6 +43,7 @@ export interface BaseEntity { } export interface IAccount extends BaseEntity { + evo_return_leasing_dealer?: boolean; name?: string; accountid?: string; evo_inn?: string;