fix: платежи - загружаем КП Севертранс 380 с дегрессией, потом выбираем гибкую и платежи заполняются пустыми значениями
This commit is contained in:
parent
2a98c6c1a3
commit
0cf19c9c02
@ -353,26 +353,19 @@ export default function paymentsReactions({ store }: ReactionsContext) {
|
||||
makeDisposable(
|
||||
() =>
|
||||
reaction(
|
||||
() => {
|
||||
() => toJS($tables.payments.values),
|
||||
(nextPayments, prevPayments) => {
|
||||
const graphType = $calculation.element('radioGraphType').getValue();
|
||||
const payments = toJS($tables.payments.values);
|
||||
const degressionType = $calculation.element('selectSeasonType').getValue();
|
||||
|
||||
return {
|
||||
degressionType,
|
||||
graphType,
|
||||
payments,
|
||||
};
|
||||
},
|
||||
(nextParams, prevParams) => {
|
||||
if (nextParams.graphType === 100_000_001 && nextParams.degressionType === 100_000_007) {
|
||||
const changes = difference(nextParams.payments, prevParams.payments);
|
||||
if (graphType === 100_000_001 && degressionType === 100_000_007) {
|
||||
const changes = difference(nextPayments, prevPayments);
|
||||
|
||||
if (changes === null || changes.length > 1) return;
|
||||
if (!changes?.length || changes.length > 1) return;
|
||||
|
||||
const [changeIndex] = changes;
|
||||
const value = nextParams.payments[changeIndex];
|
||||
const payments = nextParams.payments.slice(1, -1).map((payment, i) => {
|
||||
const value = nextPayments[changeIndex];
|
||||
const payments = nextPayments.slice(1, -1).map((payment, i) => {
|
||||
if (i <= changeIndex - 2) return payment;
|
||||
|
||||
return value;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user