web: process/add-product: disable selectInsNSIB reaction
This commit is contained in:
parent
4a314326fb
commit
671b25a087
@ -7,11 +7,11 @@ import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { getCurrentDateString } from '@/utils/date';
|
||||
import { normalizeOptions } from '@/utils/entity';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { reaction, toJS } from 'mobx';
|
||||
import { reaction } from 'mobx';
|
||||
import { max } from 'radash';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $tables, $process } = store;
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
reaction(
|
||||
() => $calculation.$values.getValues(['leasingPeriod', 'leaseObjectType', 'maxMass']),
|
||||
@ -160,35 +160,35 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
}
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
const values = $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']);
|
||||
const kaskoInsured = toJS($tables.insurance.row('kasko').getValue('insured'));
|
||||
const fingapInsured = toJS($tables.insurance.row('fingap').getValue('insured'));
|
||||
// reaction(
|
||||
// () => {
|
||||
// const values = $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']);
|
||||
// const kaskoInsured = toJS($tables.insurance.row('kasko').getValue('insured'));
|
||||
// const fingapInsured = toJS($tables.insurance.row('fingap').getValue('insured'));
|
||||
|
||||
return {
|
||||
...values,
|
||||
fingapInsured,
|
||||
kaskoInsured,
|
||||
};
|
||||
},
|
||||
({ leasingPeriod, fingapInsured, kaskoInsured, leasingWithoutKasko }) => {
|
||||
if (
|
||||
leasingPeriod < 12 ||
|
||||
leasingWithoutKasko ||
|
||||
kaskoInsured === 100_000_001 ||
|
||||
(fingapInsured === 100_000_001 && leasingPeriod < 36)
|
||||
) {
|
||||
$calculation.element('selectInsNSIB').resetValue().block();
|
||||
} else {
|
||||
$calculation.element('selectInsNSIB').unblock();
|
||||
}
|
||||
},
|
||||
{
|
||||
delay: 10,
|
||||
fireImmediately: true,
|
||||
}
|
||||
);
|
||||
// return {
|
||||
// ...values,
|
||||
// fingapInsured,
|
||||
// kaskoInsured,
|
||||
// };
|
||||
// },
|
||||
// ({ leasingPeriod, fingapInsured, kaskoInsured, leasingWithoutKasko }) => {
|
||||
// if (
|
||||
// leasingPeriod < 12 ||
|
||||
// leasingWithoutKasko ||
|
||||
// kaskoInsured === 100_000_001 ||
|
||||
// (fingapInsured === 100_000_001 && leasingPeriod < 36)
|
||||
// ) {
|
||||
// $calculation.element('selectInsNSIB').resetValue().block();
|
||||
// } else {
|
||||
// $calculation.element('selectInsNSIB').unblock();
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// delay: 10,
|
||||
// fireImmediately: true,
|
||||
// }
|
||||
// );
|
||||
|
||||
debouncedReaction(
|
||||
() =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user