process/payments(degression): set default seasonType value

This commit is contained in:
Chika 2022-10-05 11:44:44 +03:00
parent c8afffe5b2
commit 8f47cc44f8

View File

@ -4,7 +4,7 @@ import type { ApolloClient } from '@apollo/client';
import type { QueryClient } from '@tanstack/react-query';
import { selectSeasonType } from 'config/default-options';
import { reaction, toJS } from 'mobx';
import { sort } from 'radash/dist/array';
import { last, sort } from 'radash/dist/array';
import type RootStore from 'stores/root';
import type { Row } from 'stores/tables/payments/types';
import { areEqual } from 'tools/array';
@ -214,9 +214,7 @@ export default function paymentsReactions(
/**
* Дегрессия
*/
const degressionSeasonTypes = new Set([
100_000_003, 100_000_004, 100_000_005, 100_000_006, 100_000_007,
]);
const degressionSeasonTypes = [100_000_003, 100_000_004, 100_000_005, 100_000_006, 100_000_007];
reaction(
() => {
@ -232,9 +230,10 @@ export default function paymentsReactions(
}
const selectSeasonTypeOptions = selectSeasonType.filter((option) =>
degressionSeasonTypes.has(option.value)
degressionSeasonTypes.includes(option.value)
);
$calculation.setElementOptions('selectSeasonType', selectSeasonTypeOptions);
$calculation.setElementValue('selectSeasonType', last(degressionSeasonTypes));
}
);