fix osago, kasko block/unblock elements
This commit is contained in:
parent
10f3760c63
commit
7539c7239c
@ -114,8 +114,14 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
debouncedReaction(
|
debouncedReaction(
|
||||||
() => $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']),
|
() =>
|
||||||
async ({ leasingPeriod, leasingWithoutKasko }) => {
|
$calculation.$values.getValues([
|
||||||
|
'leasingPeriod',
|
||||||
|
'leasingWithoutKasko',
|
||||||
|
'dealer',
|
||||||
|
'leaseObjectCategory',
|
||||||
|
]),
|
||||||
|
async ({ leasingPeriod, leasingWithoutKasko, dealer: dealerId, leaseObjectCategory }) => {
|
||||||
const {
|
const {
|
||||||
data: { accounts },
|
data: { accounts },
|
||||||
} = await apolloClient.query({
|
} = await apolloClient.query({
|
||||||
@ -166,6 +172,29 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
$tables.insurance.row('kasko').column('insTerm').block();
|
$tables.insurance.row('kasko').column('insTerm').block();
|
||||||
$tables.insurance.row('kasko').column('insured').unblock();
|
$tables.insurance.row('kasko').column('insured').unblock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see 'apps\web\process\supplier-agent\reactions\leaseback.ts'
|
||||||
|
*/
|
||||||
|
if (dealerId) {
|
||||||
|
const {
|
||||||
|
data: { dealer },
|
||||||
|
} = await apolloClient.query({
|
||||||
|
query: CRMTypes.GetDealerDocument,
|
||||||
|
variables: {
|
||||||
|
dealerId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (dealer?.evo_return_leasing_dealer === true) {
|
||||||
|
$tables.insurance.row('kasko').column('insured').setValue(100_000_000).block();
|
||||||
|
}
|
||||||
|
// объединили реакцию для прицепа и возвратного лизинга
|
||||||
|
const isTrailer = leaseObjectCategory === 100_000_004;
|
||||||
|
if (isTrailer || dealer?.evo_return_leasing_dealer === true) {
|
||||||
|
$tables.insurance.row('osago').column('insured').setValue(100_000_000).block();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import type { ProcessContext } from '@/process/types';
|
|||||||
import { reaction } from 'mobx';
|
import { reaction } from 'mobx';
|
||||||
|
|
||||||
export function common({ store, apolloClient }: ProcessContext) {
|
export function common({ store, apolloClient }: ProcessContext) {
|
||||||
const { $calculation, $tables } = store;
|
const { $calculation } = store;
|
||||||
/**
|
/**
|
||||||
* Дополнить реакцию на изменение поля Салон приобретения selectDealer:
|
* Дополнить реакцию на изменение поля Салон приобретения selectDealer:
|
||||||
*
|
*
|
||||||
@ -35,41 +35,9 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
|
|
||||||
if (dealer?.evo_return_leasing_dealer === true) {
|
if (dealer?.evo_return_leasing_dealer === true) {
|
||||||
$calculation.element('selectDealerPerson').block().resetValue();
|
$calculation.element('selectDealerPerson').block().resetValue();
|
||||||
$tables.insurance.row('kasko').setValue('insured', 100_000_000).block('insured');
|
|
||||||
$calculation.element('cbxLeaseObjectUsed').setValue(true);
|
$calculation.element('cbxLeaseObjectUsed').setValue(true);
|
||||||
} else {
|
} else {
|
||||||
$calculation.element('selectDealerPerson').unblock();
|
$calculation.element('selectDealerPerson').unblock();
|
||||||
$tables.insurance.row('kasko').resetStatus('insured');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// объединили реакцию для прицепа и возвратного лизинга
|
|
||||||
reaction(
|
|
||||||
() => ({
|
|
||||||
dealerId: $calculation.element('selectDealer').getValue(),
|
|
||||||
leaseObjectCategory: $calculation.element('selectLeaseObjectCategory').getValue(),
|
|
||||||
}),
|
|
||||||
async ({ dealerId, leaseObjectCategory }) => {
|
|
||||||
const isTrailer = leaseObjectCategory === 100_000_004;
|
|
||||||
let returnLeasing = false;
|
|
||||||
|
|
||||||
if (dealerId) {
|
|
||||||
const {
|
|
||||||
data: { dealer },
|
|
||||||
} = await apolloClient.query({
|
|
||||||
query: CRMTypes.GetDealerDocument,
|
|
||||||
variables: {
|
|
||||||
dealerId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
returnLeasing = dealer?.evo_return_leasing_dealer === true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isTrailer || returnLeasing) {
|
|
||||||
$tables.insurance.row('osago').setValue('insured', 100_000_000).block('insured');
|
|
||||||
} else {
|
|
||||||
$tables.insurance.row('osago').resetStatus('insured');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user