Compare commits
1 Commits
dev
...
fix/dyn-33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7539c7239c |
@ -114,8 +114,14 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
);
|
||||
|
||||
debouncedReaction(
|
||||
() => $calculation.$values.getValues(['leasingPeriod', 'leasingWithoutKasko']),
|
||||
async ({ leasingPeriod, leasingWithoutKasko }) => {
|
||||
() =>
|
||||
$calculation.$values.getValues([
|
||||
'leasingPeriod',
|
||||
'leasingWithoutKasko',
|
||||
'dealer',
|
||||
'leaseObjectCategory',
|
||||
]),
|
||||
async ({ leasingPeriod, leasingWithoutKasko, dealer: dealerId, leaseObjectCategory }) => {
|
||||
const {
|
||||
data: { accounts },
|
||||
} = 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('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';
|
||||
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
const { $calculation } = store;
|
||||
/**
|
||||
* Дополнить реакцию на изменение поля Салон приобретения selectDealer:
|
||||
*
|
||||
@ -35,41 +35,9 @@ export function common({ store, apolloClient }: ProcessContext) {
|
||||
|
||||
if (dealer?.evo_return_leasing_dealer === true) {
|
||||
$calculation.element('selectDealerPerson').block().resetValue();
|
||||
$tables.insurance.row('kasko').setValue('insured', 100_000_000).block('insured');
|
||||
$calculation.element('cbxLeaseObjectUsed').setValue(true);
|
||||
} else {
|
||||
$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