на выбор Салона приобретения selectDealer - На изменение Салон приобретения selectDealer формируем список в поле ЮЛ поставщика selectDealerPerson-
если в поле selectDealer указан account, у которого evo_return_leasing_dealer = true, тест08.11 - не отработал на evo_return_leasing_dealer = true, заполнил как и на false то поле selectDealerPerson обнулять и закрывать для редактирования, иначе формировать список связанных значений - записи Контрагент, у которых статус = активный И Поставщик = Да И Тип поставщика = Юридическое лицо И связаны с карточкой Контрагент из поля "Салон приобретения" по связи Салон-ЮЛ (salon_providers)
This commit is contained in:
parent
24e4d8cd7d
commit
0d3aecbcd4
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const QUERY_GET_AGENT = gql`
|
||||
@ -9,3 +8,11 @@ export const QUERY_GET_AGENT = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_GET_DEALER_RETURN_LEASING = gql`
|
||||
query GetDealerReturnLeasing($dealerId: Uuid!) {
|
||||
dealer: account(accountid: $dealerId) {
|
||||
evo_return_leasing_dealer
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { gql } from '@apollo/client';
|
||||
import type * as CRMTypes from 'graphql/crm.types';
|
||||
import { reaction } from 'mobx';
|
||||
import type { ReactionsContext } from 'process/types';
|
||||
import * as query from '../lib/query';
|
||||
|
||||
export default function leasebackReactions({ store, apolloClient }: ReactionsContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
@ -20,14 +20,6 @@ export default function leasebackReactions({ store, apolloClient }: ReactionsCon
|
||||
3) ПЛ БУ cbxLeaseObjectUsed = true
|
||||
*/
|
||||
|
||||
const QUERY_GET_DEALER_RETURN_LEASING = gql`
|
||||
query GetDealerReturnLeasing($dealerId: Uuid!) {
|
||||
dealer: account(accountid: $dealerId) {
|
||||
evo_return_leasing_dealer
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectDealer').getValue(),
|
||||
async (dealerId) => {
|
||||
@ -39,16 +31,18 @@ export default function leasebackReactions({ store, apolloClient }: ReactionsCon
|
||||
CRMTypes.GetDealerReturnLeasingQuery,
|
||||
CRMTypes.GetDealerReturnLeasingQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_DEALER_RETURN_LEASING,
|
||||
query: query.QUERY_GET_DEALER_RETURN_LEASING,
|
||||
variables: {
|
||||
dealerId,
|
||||
},
|
||||
});
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
@ -71,7 +65,7 @@ export default function leasebackReactions({ store, apolloClient }: ReactionsCon
|
||||
CRMTypes.GetDealerReturnLeasingQuery,
|
||||
CRMTypes.GetDealerReturnLeasingQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_DEALER_RETURN_LEASING,
|
||||
query: query.QUERY_GET_DEALER_RETURN_LEASING,
|
||||
variables: {
|
||||
dealerId,
|
||||
},
|
||||
|
||||
@ -43,6 +43,22 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { dealer },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetDealerReturnLeasingQuery,
|
||||
CRMTypes.GetDealerReturnLeasingQueryVariables
|
||||
>({
|
||||
query: query.QUERY_GET_DEALER_RETURN_LEASING,
|
||||
variables: {
|
||||
dealerId,
|
||||
},
|
||||
});
|
||||
|
||||
if (dealer?.evo_return_leasing_dealer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { salon_providers },
|
||||
} = await apolloClient.query<
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user