more reactions

This commit is contained in:
Владислав Чикалкин 2020-09-23 19:53:34 +03:00
parent eea517dae1
commit f1a2afe2f8
3 changed files with 139 additions and 11 deletions

View File

@ -34,7 +34,7 @@ const reactionEffects: IReactionEffect[] = [
CalculationService.getEntityOptions({
entityName: 'quote',
where: {
evo_leadid: leadId,
evo_leadid: leadId || null,
},
})
.then(quotes => {
@ -44,6 +44,78 @@ const reactionEffects: IReactionEffect[] = [
.catch(err => {
throw err;
});
CalculationService.getEntityOptions({
entityName: 'account',
where: {
accountid: lead.evo_agent_accountid || null,
},
})
.then(agents => {
calculationStore.setOptions('selectIndAgent', agents);
calculationStore.setValue(
'indAgent',
agents[0] ? agents[0].accountid : null,
);
})
.catch(err => {
throw err;
});
CalculationService.getEntityOptions({
entityName: 'account',
where: {
accountid: lead.evo_double_agent_accountid || null,
},
})
.then(doubleAgents => {
console.log('doubleAgents', doubleAgents);
calculationStore.setOptions('selectCalcDoubleAgent', doubleAgents);
calculationStore.setValue(
'calcDoubleAgent',
doubleAgents[0] ? doubleAgents[0].accountid : null,
);
})
.catch(err => {
throw err;
});
CalculationService.getEntityOptions({
entityName: 'account',
where: {
accountid: lead.evo_broker_accountid || null,
},
})
.then(brokers => {
calculationStore.setOptions('selectCalcBroker', brokers);
calculationStore.setValue(
'calcBroker',
brokers[0] ? brokers[0].accountid : null,
);
})
.catch(err => {
throw err;
});
CalculationService.getEntityOptions({
entityName: 'account',
where: {
accountid: lead.evo_fin_department_accountid || null,
},
})
.then(finDepartments => {
calculationStore.setOptions(
'selectCalcFinDepartment',
finDepartments,
);
calculationStore.setValue(
'calcFinDepartment',
finDepartments[0] ? finDepartments[0].accountid : null,
);
})
.catch(err => {
throw err;
});
}
},
}),

View File

@ -11,15 +11,22 @@ const ACCOUNT_2_ID = faker.random.uuid();
const ACCOUNT_3_ID = faker.random.uuid();
const ACCOUNT_4_ID = faker.random.uuid();
const ACCOUNT_5_ID = faker.random.uuid();
const ACCOUNT_6_ID = faker.random.uuid();
const ACCOUNT_7_ID = faker.random.uuid();
const ACCOUNT_8_ID = faker.random.uuid();
const ACCOUNT_9_ID = faker.random.uuid();
const LEAD_1_ID = faker.random.uuid();
const LEAD_2_ID = faker.random.uuid();
const LEAD_3_ID = faker.random.uuid();
const OPPORTUNITY_1_ID = faker.random.uuid();
const OPPORTUNITY_2_ID = faker.random.uuid();
const QUOTE_1_ID = faker.random.uuid();
const QUOTE_2_ID = faker.random.uuid();
const QUOTE_3_ID = faker.random.uuid();
const QUOTE_4_ID = faker.random.uuid();
const TRANSACTION_CURRENTCY_1_ID = faker.random.uuid();
const TRANSACTION_CURRENTCY_2_ID = faker.random.uuid();
@ -82,18 +89,46 @@ const entityFakeData: {
},
{
accountid: ACCOUNT_4_ID,
name: 'Финотдел1Салона1',
name: 'Финотдел1',
evo_account_type: 100000005,
evo_supplier_type: 100000000,
statecode: 0,
},
{
accountid: ACCOUNT_5_ID,
name: 'ФинотделСалона2',
name: 'Финотдел2',
evo_account_type: 100000005,
evo_supplier_type: 100000000,
statecode: 0,
},
{
accountid: ACCOUNT_6_ID,
name: 'Агент1',
evo_account_type: 100000005,
evo_legal_form: 100000004,
statecode: 0,
},
{
accountid: ACCOUNT_7_ID,
name: 'Агент2',
evo_account_type: 100000005,
evo_legal_form: 100000004,
statecode: 0,
},
{
accountid: ACCOUNT_8_ID,
name: 'Агент3',
evo_account_type: 100000005,
evo_legal_form: 100000004,
statecode: 0,
},
{
accountid: ACCOUNT_9_ID,
name: 'Агент4',
evo_account_type: 100000005,
evo_legal_form: 100000004,
statecode: 0,
},
],
transactioncurrency: [
{
@ -133,36 +168,56 @@ const entityFakeData: {
],
lead: [
{
fullname: '100_ООО "Архимаг',
fullname: '100_ООО "с агентами ФЛ',
leadid: LEAD_1_ID,
evo_opportunityid: OPPORTUNITY_1_ID,
evo_agent_accountid: ACCOUNT_6_ID,
evo_double_agent_accountid: ACCOUNT_7_ID,
},
{
fullname: '150_ООО "Некромант',
fullname: '150_ООО "с брокером',
leadid: LEAD_2_ID,
// evo_opportunityid: OPPORTUNITY_2_ID,
evo_broker_accountid: ACCOUNT_4_ID,
},
{
fullname: '176_ООО "С финотделом',
leadid: LEAD_3_ID,
// evo_opportunityid: OPPORTUNITY_2_ID,
evo_fin_department_accountid: ACCOUNT_5_ID,
},
],
opportunity: [
{
name: '112345_ООО "Архимаг',
name: '112345_ООО "с агентами ФЛ',
opportunityid: OPPORTUNITY_1_ID,
},
{
name: '145678_ООО "Некромант',
name: '145678_ООО "с брокером',
opportunityid: OPPORTUNITY_2_ID,
},
],
quote: [
{
name: '2345_ООО "Архимаг"',
name: '2345_ООО "с агентами ФЛ"',
quoteid: QUOTE_1_ID,
evo_leadid: LEAD_1_ID,
},
{
name: '6789_ООО "Некромант"',
name: '6789_ООО "с брокером"',
quoteid: QUOTE_2_ID,
// evo_leadid: LEAD_2_ID,
evo_leadid: LEAD_2_ID,
},
{
name: '4567_ООО "с агентами ФЛ"',
quoteid: QUOTE_3_ID,
evo_leadid: LEAD_1_ID,
},
{
name: '5678_ООО "с агентами ФЛ"',
quoteid: QUOTE_4_ID,
evo_leadid: LEAD_1_ID,
evo_broker_accountid: ACCOUNT_5_ID,
},
],
evo_gps_brand: [

View File

@ -7,7 +7,7 @@ export interface IAccount extends IBaseOption {
evo_supplier_type?: number;
statecode?: number;
evo_fin_department_accountid?: string;
evo_legal_form?: string;
evo_legal_form?: number;
ownerid?: string;
evo_broker_accountid?: string;
}
@ -84,6 +84,7 @@ export interface IEvoRewardCondition extends IBaseOption {
evo_datefrom?: Date;
evo_dateto?: Date;
evo_agent_accountid?: string;
evo_double_agent_accountid?: string;
statecode?: number;
}