fix error if no dealer broker id

This commit is contained in:
Chika 2020-12-10 19:55:58 +03:00
parent c3c93d3109
commit 627aa6171f
3 changed files with 16 additions and 3 deletions

View File

@ -2,6 +2,7 @@
import { message } from 'antd';
import { elementsValues } from 'client/Containers/Calculation/lib/elements/values';
import { openNotification } from 'client/Elements/Notification';
import CrmService from 'client/services/CrmService';
import { calculationProcess } from 'client/stores/CalculationStore';
import initialValues from 'client/stores/CalculationStore/config/initialValues';
@ -83,6 +84,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
currentDate,
dealer_person_accountid: quote.evo_dealer_person_accountid || NIL,
dealer_broker_accountid: quote.evo_dealer_broker_accountid || NIL,
hasDealerBroker: quote.evo_dealer_broker_accountid ? true : false,
ind_agent_accountid: quote.evo_agent_accountid || NIL,
double_agent_accountid: quote.evo_double_agent_accountid || NIL,
broker_accountid: quote.evo_broker_accountid || NIL,
@ -232,7 +234,15 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
content: `КП ${quote?.evo_quotename || ''} загружено!`,
});
}
})
})
.catch(err => {
openNotification({
type: 'error',
title: `Ошибка во время загрузки КП `,
description: `${err}`,
})();
throw err;
})
.finally(() => {
calculationStore.setStatus('selectQuote', ElementStatus.Default);
calculationStore.setStatus('btnCalculate', ElementStatus.Default);

View File

@ -9,6 +9,7 @@ export default gql`
$currentDate: DateTime
$dealer_person_accountid: Uuid!
$dealer_broker_accountid: Uuid!
$hasDealerBroker: Boolean!
$ind_agent_accountid: Uuid!
$double_agent_accountid: Uuid!
$broker_accountid: Uuid!
@ -53,7 +54,8 @@ export default gql`
evo_reward_summ
evo_reduce_reward
}
selectDealerBroker: account(accountid: $dealer_broker_accountid) {
selectDealerBroker: account(accountid: $dealer_broker_accountid)
@include(if: $hasDealerBroker) {
accountid
name
}

View File

@ -58,8 +58,9 @@ export interface IQuote {
evo_object_count?: number;
evo_osago_accountid?: string;
evo_kasko_accountid?: string;
evo_osago_payer?: number;
evo_kasko_payer?: number;
evo_kasko_price?: number;
evo_osago_payer?: number;
evo_osago_price?: number;
evo_dgo_price?: number;
evo_ns_price?: number;