process: add insurance reactions
This commit is contained in:
parent
f93426767c
commit
86c9bdb113
@ -6,7 +6,7 @@ export const title = 'Страхование';
|
||||
export const rows: FormTabRows = [
|
||||
[['tbxLeaseObjectYear', 'selectLeaseObjectUseFor', 'selectLegalClientRegion']],
|
||||
[['selectEngineType', 'tbxInsFranchise', 'selectLegalClientTown']],
|
||||
[['selectLeaseObjectCategory', 'tbxMileage', 'tbxINNForCalc']],
|
||||
[['selectLeaseObjectCategory', 'tbxMileage']],
|
||||
[['tbxLeaseObjectMotorPower', 'cbxWithTrailer', 'selectGPSBrand']],
|
||||
[['tbxEngineVolume', 'cbxInsDecentral', 'selectGPSModel']],
|
||||
[['selectLeasingWithoutKasko', 'selectInsNSIB']],
|
||||
|
||||
@ -79,12 +79,10 @@ const components = wrapComponentsMap({
|
||||
cbxInsUnlimitDrivers: e.Switch,
|
||||
tbxInsAgeDrivers: e.InputNumber,
|
||||
tbxInsExpDrivers: e.InputNumber,
|
||||
tbxINNForCalc: e.InputNumber,
|
||||
selectGPSBrand: e.Select,
|
||||
selectGPSModel: e.Select,
|
||||
selectRegionRegistration: e.Select,
|
||||
selectTownRegistration: e.Select,
|
||||
radioInfuranceOPF: e.Radio,
|
||||
selectRegistration: e.Select,
|
||||
selectInsNSIB: e.Select,
|
||||
selectRequirementTelematic: e.Select,
|
||||
|
||||
@ -425,10 +425,6 @@ const props: Partial<ElementsProps> = {
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
},
|
||||
radioInfuranceOPF: {
|
||||
optionType: 'button',
|
||||
buttonStyle: 'solid',
|
||||
},
|
||||
radioGraphType: {
|
||||
spaceProps: {
|
||||
direction: 'vertical',
|
||||
|
||||
@ -74,7 +74,6 @@ const titles: Record<ActionElements | ValuesElements, string> = {
|
||||
selectGPSModel: 'Модель GPS',
|
||||
selectRegionRegistration: 'Регион регистрации',
|
||||
selectTownRegistration: 'Город регистрации',
|
||||
radioInfuranceOPF: 'ОПФ для расчета страховки',
|
||||
radioInsKaskoType: 'Тип страхования КАСКО',
|
||||
cbxInsDecentral: 'Децентрализованное страхование',
|
||||
tbxInsFranchise: 'Франшиза',
|
||||
@ -116,7 +115,6 @@ const titles: Record<ActionElements | ValuesElements, string> = {
|
||||
selectObjectCategoryTax: 'Кат. по ТР ТС 018/2011',
|
||||
selectObjectTypeTax: 'Тип ТС для ТН',
|
||||
radioTypePTS: 'Тип ПТС',
|
||||
tbxINNForCalc: 'ИНН контрагента',
|
||||
selectLegalClientRegion: 'Регион по юр.адресу клиента',
|
||||
selectLegalClientTown: 'Город по юр.адресу клиента',
|
||||
selectSubsidy: 'Субсидия',
|
||||
|
||||
@ -81,7 +81,6 @@ const types = wrapElementsTypes({
|
||||
cbxInsUnlimitDrivers: t.Value,
|
||||
tbxInsAgeDrivers: t.Value,
|
||||
tbxInsExpDrivers: t.Value,
|
||||
tbxINNForCalc: t.Value,
|
||||
cbxLastPaymentRedemption: t.Value,
|
||||
cbxPriceWithDiscount: t.Value,
|
||||
cbxFullPriceWithDiscount: t.Value,
|
||||
@ -156,7 +155,6 @@ const types = wrapElementsTypes({
|
||||
radioGraphType: t.Options,
|
||||
radioDeliveryTime: t.Options,
|
||||
radioInsKaskoType: t.Options,
|
||||
radioInfuranceOPF: t.Options,
|
||||
selectRequirementTelematic: t.Options,
|
||||
radioQuoteContactGender: t.Options,
|
||||
radioCalcType: t.Options,
|
||||
|
||||
@ -80,14 +80,12 @@ const elementsToValues = wrapElementsMap({
|
||||
selectGPSModel: 'GPSModel',
|
||||
selectRegionRegistration: 'regionRegistration',
|
||||
selectTownRegistration: 'townRegistration',
|
||||
radioInfuranceOPF: 'infuranceOPF',
|
||||
radioInsKaskoType: 'insKaskoType',
|
||||
cbxInsDecentral: 'insDecentral',
|
||||
tbxInsFranchise: 'insFranchise',
|
||||
cbxInsUnlimitDrivers: 'insUnlimitDrivers',
|
||||
tbxInsAgeDrivers: 'insAgeDrivers',
|
||||
tbxInsExpDrivers: 'insExpDrivers',
|
||||
tbxINNForCalc: 'INNForCalc',
|
||||
cbxLastPaymentRedemption: 'lastPaymentRedemption',
|
||||
cbxPriceWithDiscount: 'priceWithDiscount',
|
||||
cbxFullPriceWithDiscount: 'fullPriceWithDiscount',
|
||||
|
||||
@ -97,6 +97,93 @@ export const selectObjectCategoryTax = [
|
||||
value: 100_000_000 + i,
|
||||
}));
|
||||
|
||||
export const selectLeaseObjectUseFor = alphabetical(
|
||||
[
|
||||
{
|
||||
label: 'Для представительских целей',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'Для использования в качестве «такси»',
|
||||
value: 100_000_001,
|
||||
},
|
||||
{
|
||||
label: 'Для передачи третьим лицам (прокат; аренда)',
|
||||
value: 100_000_002,
|
||||
},
|
||||
{
|
||||
label: 'Каршеринг',
|
||||
value: 100_000_003,
|
||||
},
|
||||
{
|
||||
label: 'Тест-драйв',
|
||||
value: 100_000_004,
|
||||
},
|
||||
{
|
||||
label: 'Для доставки продуктов конечному потребителю',
|
||||
value: 100_000_005,
|
||||
},
|
||||
{
|
||||
label: 'Для обучения вождению',
|
||||
value: 100_000_006,
|
||||
},
|
||||
{
|
||||
label: 'Маршрутные такси / Рейсовые автобусы',
|
||||
value: 100_000_007,
|
||||
},
|
||||
{
|
||||
label: 'Междугородние перевозки',
|
||||
value: 100_000_008,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки крупногабаритных грузов',
|
||||
value: 100_000_009,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки малогабаритных грузов',
|
||||
value: 100_000_010,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
|
||||
value: 100_000_011,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки сотрудников ЛП',
|
||||
value: 100_000_012,
|
||||
},
|
||||
{
|
||||
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
|
||||
value: 100_000_013,
|
||||
},
|
||||
{
|
||||
label: 'Дорожно-строительная техника',
|
||||
value: 100_000_014,
|
||||
},
|
||||
{
|
||||
label: 'Жилищно-коммунальное хозяйство',
|
||||
value: 100_000_015,
|
||||
},
|
||||
{
|
||||
label: 'Лесное хозяйство',
|
||||
value: 100_000_016,
|
||||
},
|
||||
{
|
||||
label: 'Подъёмно-транспортная отрасль',
|
||||
value: 100_000_017,
|
||||
},
|
||||
{
|
||||
label: 'Сельское хозяйство',
|
||||
value: 100_000_018,
|
||||
},
|
||||
{
|
||||
label: 'Строительство',
|
||||
value: 100_000_019,
|
||||
},
|
||||
],
|
||||
(objectUseFor) => objectUseFor.label.toLowerCase(),
|
||||
'asc'
|
||||
);
|
||||
|
||||
const defaultOptions: CalculationOptions = {
|
||||
radioLastPaymentRule: [
|
||||
{
|
||||
@ -187,103 +274,7 @@ const defaultOptions: CalculationOptions = {
|
||||
},
|
||||
],
|
||||
|
||||
selectLeaseObjectUseFor: alphabetical(
|
||||
[
|
||||
{
|
||||
label: 'Для представительских целей',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'Для использования в качестве «такси»',
|
||||
value: 100_000_001,
|
||||
},
|
||||
{
|
||||
label: 'Для передачи третьим лицам (прокат; аренда)',
|
||||
value: 100_000_002,
|
||||
},
|
||||
{
|
||||
label: 'Каршеринг',
|
||||
value: 100_000_003,
|
||||
},
|
||||
{
|
||||
label: 'Тест-драйв',
|
||||
value: 100_000_004,
|
||||
},
|
||||
{
|
||||
label: 'Для доставки продуктов конечному потребителю',
|
||||
value: 100_000_005,
|
||||
},
|
||||
{
|
||||
label: 'Для обучения вождению',
|
||||
value: 100_000_006,
|
||||
},
|
||||
{
|
||||
label: 'Маршрутные такси / Рейсовые автобусы',
|
||||
value: 100_000_007,
|
||||
},
|
||||
{
|
||||
label: 'Междугородние перевозки',
|
||||
value: 100_000_008,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки крупногабаритных грузов',
|
||||
value: 100_000_009,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки малогабаритных грузов',
|
||||
value: 100_000_010,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки сотрудников других организаций (водитель ЛП)',
|
||||
value: 100_000_011,
|
||||
},
|
||||
{
|
||||
label: 'Для перевозки сотрудников ЛП',
|
||||
value: 100_000_012,
|
||||
},
|
||||
{
|
||||
label: 'Для экскурсионных перевозок в т.ч. на торжества; трансфер в аэропорт и пр.',
|
||||
value: 100_000_013,
|
||||
},
|
||||
{
|
||||
label: 'Дорожно-строительная техника',
|
||||
value: 100_000_014,
|
||||
},
|
||||
{
|
||||
label: 'Жилищно-коммунальное хозяйство',
|
||||
value: 100_000_015,
|
||||
},
|
||||
{
|
||||
label: 'Лесное хозяйство',
|
||||
value: 100_000_016,
|
||||
},
|
||||
{
|
||||
label: 'Подъёмно-транспортная отрасль',
|
||||
value: 100_000_017,
|
||||
},
|
||||
{
|
||||
label: 'Сельское хозяйство',
|
||||
value: 100_000_018,
|
||||
},
|
||||
{
|
||||
label: 'Строительство',
|
||||
value: 100_000_019,
|
||||
},
|
||||
],
|
||||
(objectUseFor) => objectUseFor.label.toLowerCase(),
|
||||
'asc'
|
||||
),
|
||||
|
||||
radioInfuranceOPF: [
|
||||
{
|
||||
label: 'ЮЛ',
|
||||
value: 100_000_000,
|
||||
},
|
||||
{
|
||||
label: 'ИП',
|
||||
value: 100_000_001,
|
||||
},
|
||||
],
|
||||
selectLeaseObjectUseFor,
|
||||
|
||||
radioInsKaskoType: [
|
||||
{
|
||||
@ -461,7 +452,6 @@ const defaultOptions: CalculationOptions = {
|
||||
cbxInsUnlimitDrivers: [],
|
||||
tbxInsAgeDrivers: [],
|
||||
tbxInsExpDrivers: [],
|
||||
tbxINNForCalc: [],
|
||||
cbxLastPaymentRedemption: [],
|
||||
cbxPriceWithDiscount: [],
|
||||
cbxFullPriceWithDiscount: [],
|
||||
|
||||
@ -102,7 +102,6 @@ const defaultStatuses: CalculationStatuses = {
|
||||
tbxFinDepartmentRewardSumm: 'Disabled',
|
||||
tbxFirstPaymentPerc: 'Default',
|
||||
tbxFirstPaymentRub: 'Default',
|
||||
tbxINNForCalc: 'Disabled',
|
||||
tbxIRR_Perc: 'Default',
|
||||
tbxImportProgramSum: 'Default',
|
||||
tbxImporterRewardPerc: 'Disabled',
|
||||
|
||||
@ -55,8 +55,6 @@ const defaultValues: CalculationValues = {
|
||||
indAgent: null,
|
||||
indAgentRewardCondition: null,
|
||||
indAgentRewardSumm: 0,
|
||||
infuranceOPF: null,
|
||||
INNForCalc: 0,
|
||||
insAgeDrivers: 0,
|
||||
insDecentral: false,
|
||||
insExpDrivers: 0,
|
||||
|
||||
@ -6,6 +6,7 @@ import * as createKP from '@/process/create-kp';
|
||||
import * as fingap from '@/process/fingap';
|
||||
import * as gibdd from '@/process/gibdd';
|
||||
import { useProcess } from '@/process/hooks';
|
||||
import * as insurance from '@/process/insurance';
|
||||
import * as leadOpportunity from '@/process/lead-opportunity';
|
||||
import * as leasingObject from '@/process/leasing-object';
|
||||
import * as leasingWithoutKasko from '@/process/leasing-without-kasko';
|
||||
@ -35,4 +36,5 @@ export default function useReactions() {
|
||||
useProcess(payments);
|
||||
useProcess(gibdd);
|
||||
useProcess(addProduct);
|
||||
useProcess(insurance);
|
||||
}
|
||||
|
||||
@ -52,8 +52,6 @@ const ValuesSchema = z
|
||||
indAgent: z.string().nullable(),
|
||||
indAgentRewardCondition: z.string().nullable(),
|
||||
indAgentRewardSumm: z.number(),
|
||||
infuranceOPF: z.number().nullable(),
|
||||
INNForCalc: z.number(),
|
||||
insAgeDrivers: z.number(),
|
||||
insDecentral: z.boolean(),
|
||||
insExpDrivers: z.number(),
|
||||
|
||||
@ -249,6 +249,13 @@ query GetGPSBrands {
|
||||
}
|
||||
}
|
||||
|
||||
query GetGPSModels($gpsBrandId: Uuid!) {
|
||||
evo_gps_models(evo_gps_brandid: $gpsBrandId) {
|
||||
label: evo_name
|
||||
value: evo_gps_modelid
|
||||
}
|
||||
}
|
||||
|
||||
query GetLeaseObjectTypes {
|
||||
evo_leasingobject_types(statecode: 0) {
|
||||
label: evo_name
|
||||
|
||||
@ -264,6 +264,13 @@ export type GetGpsBrandsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
export type GetGpsBrandsQuery = { __typename?: 'Query', evo_gps_brands: Array<{ __typename?: 'evo_gps_brand', label: string | null, value: string | null } | null> | null };
|
||||
|
||||
export type GetGpsModelsQueryVariables = Exact<{
|
||||
gpsBrandId: Scalars['Uuid'];
|
||||
}>;
|
||||
|
||||
|
||||
export type GetGpsModelsQuery = { __typename?: 'Query', evo_gps_models: Array<{ __typename?: 'evo_gps_model', label: string | null, value: string | null } | null> | null };
|
||||
|
||||
export type GetLeaseObjectTypesQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
@ -593,6 +600,7 @@ export const GetRegionsDocument = {"kind":"Document","definitions":[{"kind":"Ope
|
||||
export const GetRegionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRegion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_oktmo"}},{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}}]}}]}}]} as unknown as DocumentNode<GetRegionQuery, GetRegionQueryVariables>;
|
||||
export const GetTownsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTowns"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_towns"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_regionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"regionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_fias_id"}},{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_businessunit_evolution"}}]}}]}}]} as unknown as DocumentNode<GetTownsQuery, GetTownsQueryVariables>;
|
||||
export const GetGpsBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_brandid"}}]}}]}}]} as unknown as DocumentNode<GetGpsBrandsQuery, GetGpsBrandsQueryVariables>;
|
||||
export const GetGpsModelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGPSModels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"gpsBrandId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_gps_models"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_gps_brandid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"gpsBrandId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_gps_modelid"}}]}}]}}]} as unknown as DocumentNode<GetGpsModelsQuery, GetGpsModelsQueryVariables>;
|
||||
export const GetLeaseObjectTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypesQuery, GetLeaseObjectTypesQueryVariables>;
|
||||
export const GetLeaseObjectTypeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeaseObjectType"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_type"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leasingobject_typeid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leaseObjectTypeId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}}]}}]}}]} as unknown as DocumentNode<GetLeaseObjectTypeQuery, GetLeaseObjectTypeQueryVariables>;
|
||||
export const GetBrandsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBrands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type"}}]}}]}}]} as unknown as DocumentNode<GetBrandsQuery, GetBrandsQueryVariables>;
|
||||
|
||||
@ -1 +1,2 @@
|
||||
export * from './get-kp-data';
|
||||
export * as reactions from './reactions';
|
||||
|
||||
112
apps/web/process/insurance/reactions.ts
Normal file
112
apps/web/process/insurance/reactions.ts
Normal file
@ -0,0 +1,112 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import type { ProcessContext } from '../types';
|
||||
import { normalizeOptions } from '@/../../packages/tools';
|
||||
import { selectLeaseObjectUseFor } from '@/config/default-options';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { reaction } from 'mobx';
|
||||
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectGPSBrand').getValue(),
|
||||
async (gpsBrandId) => {
|
||||
if (!gpsBrandId) {
|
||||
$calculation.element('selectGPSModel').resetValue();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_gps_models },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetGpsModelsDocument,
|
||||
variables: {
|
||||
gpsBrandId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_gps_models) {
|
||||
$calculation.element('selectGPSModel').setOptions(normalizeOptions(evo_gps_models));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectLeaseObjectCategory').getValue(),
|
||||
(leaseObjectCategory) => {
|
||||
switch (leaseObjectCategory) {
|
||||
case 100_000_000: {
|
||||
$calculation
|
||||
.element('selectLeaseObjectUseFor')
|
||||
.setOptions(
|
||||
selectLeaseObjectUseFor.filter((x) => [100_000_000, 100_000_002].includes(x.value))
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 100_000_001: {
|
||||
$calculation
|
||||
.element('selectLeaseObjectUseFor')
|
||||
.setOptions(
|
||||
selectLeaseObjectUseFor.filter((x) =>
|
||||
[
|
||||
100_000_000, 100_000_001, 100_000_002, 100_000_003, 100_000_004, 100_000_005,
|
||||
100_000_006, 100_000_007, 100_000_008, 100_000_009, 100_000_010, 100_000_011,
|
||||
100_000_012, 100_000_013,
|
||||
].includes(x.value)
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 100_000_002: {
|
||||
$calculation
|
||||
.element('selectLeaseObjectUseFor')
|
||||
.setOptions(
|
||||
selectLeaseObjectUseFor.filter((x) =>
|
||||
[
|
||||
100_000_002, 100_000_004, 100_000_005, 100_000_006, 100_000_009, 100_000_010,
|
||||
].includes(x.value)
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 100_000_003: {
|
||||
$calculation
|
||||
.element('selectLeaseObjectUseFor')
|
||||
.setOptions(
|
||||
selectLeaseObjectUseFor.filter((x) =>
|
||||
[
|
||||
100_000_002, 100_000_004, 100_000_006, 100_000_007, 100_000_008, 100_000_011,
|
||||
100_000_012, 100_000_013,
|
||||
].includes(x.value)
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 100_000_004: {
|
||||
$calculation
|
||||
.element('selectLeaseObjectUseFor')
|
||||
.setOptions(
|
||||
selectLeaseObjectUseFor.filter((x) => [100_000_002, 100_000_009].includes(x.value))
|
||||
);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
$calculation
|
||||
.element('selectLeaseObjectUseFor')
|
||||
.setOptions(
|
||||
selectLeaseObjectUseFor.filter((x) =>
|
||||
[
|
||||
100_000_014, 100_000_015, 100_000_016, 100_000_017, 100_000_018, 100_000_019,
|
||||
].includes(x.value)
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -110,28 +110,4 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectLead').getValue(),
|
||||
async (leadid) => {
|
||||
if (!leadid) {
|
||||
$calculation.element('tbxINNForCalc').resetValue();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { lead },
|
||||
} = await apolloClient.query({
|
||||
query: CRMTypes.GetLeadDocument,
|
||||
variables: { leadid },
|
||||
});
|
||||
|
||||
if (lead?.evo_inn) {
|
||||
$calculation.element('tbxINNForCalc').setValue(Number.parseInt(lead?.evo_inn, 10));
|
||||
} else {
|
||||
$calculation.element('tbxINNForCalc').resetValue();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user