"fake" reaction
This commit is contained in:
parent
e26f709f5c
commit
f2074ad516
@ -1001,6 +1001,82 @@ const reactionEffects: IReactionEffect[] = [
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
// TODO: Fake fake
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { dealer } = calculationStore.values;
|
||||
return dealer;
|
||||
},
|
||||
effect: dealerId => {
|
||||
if (dealerId) {
|
||||
const dealer = calculationStore.options.selectDealer?.find(
|
||||
x => x.accountid === dealerId,
|
||||
);
|
||||
if (dealer && dealer.evo_broker_accountid) {
|
||||
CalculationService.getEntityOptions({
|
||||
entityName: 'account',
|
||||
where: {
|
||||
accountid: dealer.evo_broker_accountid,
|
||||
},
|
||||
})
|
||||
.then(brokers => {
|
||||
if (brokers && brokers.length > 0) {
|
||||
calculationStore.setOptions('selectDealerPerson', brokers);
|
||||
calculationStore.setValue('dealerPerson', brokers[0].accountid);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
} else {
|
||||
calculationStore.setOptions('selectDealerPerson', []);
|
||||
calculationStore.setValue('dealerPerson', null);
|
||||
}
|
||||
} else {
|
||||
calculationStore.setOptions('selectDealerPerson', []);
|
||||
calculationStore.setValue('dealerPerson', null);
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { dealerPerson } = calculationStore.values;
|
||||
return dealerPerson;
|
||||
},
|
||||
effect: dealerPersonId => {
|
||||
if (dealerPersonId) {
|
||||
const dealerPerson = calculationStore.options.selectDealerPerson?.find(
|
||||
x => x.accountid === dealerPersonId,
|
||||
);
|
||||
if (dealerPerson && dealerPerson.evo_broker_accountid) {
|
||||
CalculationService.getEntityOptions({
|
||||
entityName: 'account',
|
||||
where: {
|
||||
statecode: 0,
|
||||
accountid: dealerPerson.evo_broker_accountid,
|
||||
},
|
||||
})
|
||||
.then(brokers => {
|
||||
if (brokers && brokers.length > 0) {
|
||||
calculationStore.setOptions('selectDealerBroker', brokers);
|
||||
calculationStore.setValue('dealerBroker', brokers[0].accountid);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
} else {
|
||||
calculationStore.setOptions('selectDealerBroker', []);
|
||||
calculationStore.setValue('dealerBroker', null);
|
||||
}
|
||||
} else {
|
||||
calculationStore.setOptions('selectDealerBroker', []);
|
||||
calculationStore.setValue('dealerBroker', null);
|
||||
}
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export default reactionEffects;
|
||||
|
||||
@ -96,6 +96,7 @@ const entityFakeData: {
|
||||
evo_supplier_type: 100000000,
|
||||
statecode: 0,
|
||||
evo_fin_department_accountid: ACCOUNT_4_ID,
|
||||
evo_broker_accountid: ACCOUNT_11_ID,
|
||||
},
|
||||
{
|
||||
accountid: ACCOUNT_2_ID,
|
||||
@ -104,6 +105,7 @@ const entityFakeData: {
|
||||
evo_supplier_type: 100000000,
|
||||
statecode: 0,
|
||||
evo_fin_department_accountid: ACCOUNT_5_ID,
|
||||
evo_broker_accountid: ACCOUNT_12_ID,
|
||||
},
|
||||
{
|
||||
accountid: ACCOUNT_3_ID,
|
||||
@ -111,6 +113,7 @@ const entityFakeData: {
|
||||
evo_account_type: 100000001,
|
||||
evo_supplier_type: 100000000,
|
||||
statecode: 0,
|
||||
// evo_broker_accountid: ACCOUNT_13_ID,
|
||||
},
|
||||
{
|
||||
accountid: ACCOUNT_4_ID,
|
||||
@ -167,6 +170,7 @@ const entityFakeData: {
|
||||
accountid: ACCOUNT_11_ID,
|
||||
evo_supplier_type: 100000001,
|
||||
statecode: 0,
|
||||
evo_broker_accountid: ACCOUNT_4_ID,
|
||||
},
|
||||
{
|
||||
name: 'ЮЛ поставщика 2',
|
||||
|
||||
Reference in New Issue
Block a user