на изменение списка в поле selectDealerRewardCondition :
Если selectDealerRewardCondition пусто, то DealerRewardSumm обнуляется и закрывается для редактирования Если в списке selectDealerRewardCondition есть запись, у которой evo_reward_condition.evo_agency_agreementid. Выплата без других агентов (evo_reward_without_other_agent) = True, то сбрасывают значение и закрываются для выбора поля: тест15.11 - указываю Авилон - сбрасывает другие АВ, но при этом я после этого могу их выбрать заново selectDealerBroker selectIndAgent selectCalcDoubleAgent selectCalcBroker selectCalcFinDepartment иначе selectDealerBroker открываем для редактирования selectIndAgent заполняется значением из Интереса selectCalcDoubleAgent заполняется значением из Интереса selectCalcBroker заполняется значением из Интереса selectCalcFinDepartment заполняется значением из Интереса
This commit is contained in:
parent
4f23fc964c
commit
670978cb0b
@ -92,6 +92,20 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) {
|
||||
});
|
||||
}
|
||||
|
||||
class Helper {
|
||||
enabled: boolean;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
constructor() {
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
trigger = () => {
|
||||
this.enabled = !this.enabled;
|
||||
};
|
||||
}
|
||||
|
||||
export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
@ -119,47 +133,56 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
selectFinDepartment
|
||||
*/
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectDealerRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
{
|
||||
const helper = new Helper();
|
||||
reaction(
|
||||
() => $calculation.element('selectDealerRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
if (helper.enabled === true) {
|
||||
helper.trigger();
|
||||
fillAgents();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerBroker').resetValue();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
helper.trigger();
|
||||
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
fillAgents();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
$calculation.element('selectDealerBroker').reset();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Добавить реакцию на изменение списка в поле selectDealerBrokerRewardCondition :
|
||||
|
||||
@ -181,48 +204,58 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
selectCalcBrokerRewardCondition заполняется значением из Интереса
|
||||
selectFinDepartmentRewardCondtion заполняется значением из Интереса
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.element('selectDealerBrokerRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
|
||||
{
|
||||
const helper = new Helper();
|
||||
reaction(
|
||||
() => $calculation.element('selectDealerBrokerRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
if (helper.enabled === true) {
|
||||
helper.trigger();
|
||||
fillAgents();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
fillAgents();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Добавить реакцию на изменение списка в поле selectIndAgentRewardCondition :
|
||||
|
||||
@ -245,46 +278,56 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
selectCalcFinDepartment заполняется значением из Интереса
|
||||
*/
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectIndAgentRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
{
|
||||
const helper = new Helper();
|
||||
reaction(
|
||||
() => $calculation.element('selectIndAgentRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
if (helper.enabled === true) {
|
||||
helper.trigger();
|
||||
fillAgents();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').resetValue();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
fillAgents();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавить реакцию на изменение списка в поле selectCalcDoubleAgentRewardCondition :
|
||||
@ -308,48 +351,57 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
selectCalcFinDepartment заполняется значением из Интереса
|
||||
*/
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectCalcDoubleAgentRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
{
|
||||
const helper = new Helper();
|
||||
reaction(
|
||||
() => $calculation.element('selectCalcDoubleAgentRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcBroker(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
if (helper.enabled === true) {
|
||||
helper.trigger();
|
||||
fillAgents();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').resetValue();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
$calculation.element('selectDealerBroker').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
fillAgents();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').reset();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
$calculation.element('selectDealerBroker').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @description
|
||||
* Добавить реакцию на изменение списка в поле selectCalcBrokerRewardCondition:
|
||||
@ -372,47 +424,57 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
selectCalcDoubleAgent заполняется значением из Интереса
|
||||
selectCalcFinDepartment заполняется значением из Интереса
|
||||
*/
|
||||
reaction(
|
||||
() => $calculation.element('selectCalcBrokerRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
{
|
||||
const helper = new Helper();
|
||||
reaction(
|
||||
() => $calculation.element('selectCalcBrokerRewardCondition').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
if (helper.enabled === true) {
|
||||
helper.trigger();
|
||||
fillAgents();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').resetValue();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
$calculation.element('selectDealerBroker').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
fillAgents();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').reset();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcFinDepartment').reset();
|
||||
} else {
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
$calculation.element('selectDealerBroker').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавить реакцию на изменение списка в поле selectFinDepartmentRewardCondtion:
|
||||
@ -436,47 +498,56 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) {
|
||||
selectCalcBroker заполняется значением из Интереса
|
||||
*/
|
||||
|
||||
reaction(
|
||||
() => $calculation.element('selectFinDepartmentRewardCondtion').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
{
|
||||
const helper = new Helper();
|
||||
reaction(
|
||||
() => $calculation.element('selectFinDepartmentRewardCondtion').getValue(),
|
||||
async (rewardConditionId) => {
|
||||
function fillAgents() {
|
||||
const leadid = $calculation.element('selectLead').getValue();
|
||||
fillAgentsFromLead.fillIndAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillCalcDoubleAgent(store, apolloClient, leadid);
|
||||
fillAgentsFromLead.fillFinDepartment(store, apolloClient, leadid);
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
if (helper.enabled === true) {
|
||||
helper.trigger();
|
||||
fillAgents();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').resetValue();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
} else {
|
||||
helper.trigger();
|
||||
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
$calculation.element('selectDealerBroker').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
|
||||
if (!rewardConditionId) {
|
||||
fillAgents();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
data: { evo_reward_condition },
|
||||
} = await apolloClient.query<
|
||||
CRMTypes.GetRewardWithoutOtherAgentQuery,
|
||||
CRMTypes.GetRewardWithoutOtherAgentQueryVariables
|
||||
>({
|
||||
query: QUERY_GET_REWARD_WITHOUT_OTHER_AGENT,
|
||||
variables: {
|
||||
conditionId: rewardConditionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (evo_reward_condition?.evo_agency_agreementidData?.evo_reward_without_other_agent) {
|
||||
$calculation.element('selectDealerPerson').block();
|
||||
$calculation.element('selectDealerBroker').reset();
|
||||
$calculation.element('selectIndAgent').reset();
|
||||
$calculation.element('selectCalcDoubleAgent').reset();
|
||||
$calculation.element('selectCalcBroker').reset();
|
||||
} else {
|
||||
$calculation.element('selectDealerPerson').unblock();
|
||||
$calculation.element('selectDealerBroker').unblock();
|
||||
fillAgents();
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function validationReactions({ store, apolloClient }: ReactionsContext) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user