bdc360f: поправили

This commit is contained in:
vchikalkin 2023-01-30 17:25:45 +03:00
parent aab9045460
commit 81a10296a9
2 changed files with 34 additions and 31 deletions

View File

@ -46,6 +46,30 @@ export const selectHighSeasonStart = Array.from(
})
);
export const radioGraphType = [
{
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,
disabled: true,
},
];
const defaultOptions: CalculationOptions = {
radioLastPaymentRule: [
{
@ -73,28 +97,7 @@ const defaultOptions: CalculationOptions = {
},
],
radioGraphType: [
{
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,
},
],
radioGraphType,
selectSeasonType,

View File

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { gql } from '@apollo/client';
import { selectSeasonType } from 'config/default-options';
import { radioGraphType, selectSeasonType } from 'config/default-options';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import type * as CRMTypes from 'graphql/crm.types';
@ -323,15 +323,15 @@ export default function commonReactions({ store, apolloClient }: ReactionsContex
({ evo_tarif } = data);
}
const filteredGraphTypes = $calculation
.element('radioGraphType')
.getOptions()
.map((type) => ({
...type,
disabled: evo_tarif?.evo_graphtype_exception?.includes(type.value),
}));
if (evo_tarif?.evo_graphtype_exception?.length) {
const filteredGraphTypes = radioGraphType.filter(
(type) => !evo_tarif?.evo_graphtype_exception?.includes(type.value)
);
$calculation.element('radioGraphType').setOptions(filteredGraphTypes);
$calculation.element('radioGraphType').setOptions(filteredGraphTypes);
} else {
$calculation.element('radioGraphType').resetOptions();
}
}
);