костыли регистрации
This commit is contained in:
parent
8cac5fa120
commit
53f60e15c3
@ -439,151 +439,259 @@ const gibddReactions: IReactionEffect[] = [
|
||||
},
|
||||
}),
|
||||
|
||||
(calculationStore, calculationProcess) => ({
|
||||
// (calculationStore, calculationProcess) => ({
|
||||
// expression: () => {
|
||||
// return {
|
||||
// lead: calculationStore.getOption('selectLead'),
|
||||
// opportunity: calculationStore.getOption('selectOpportunity'),
|
||||
// objectRegistration: calculationStore.getValue('objectRegistration'),
|
||||
// regionRegistration: calculationStore.getValue('regionRegistration'),
|
||||
// };
|
||||
// },
|
||||
// effect: ({ lead, opportunity, objectRegistration, regionRegistration }) => {
|
||||
// if (calculationProcess.hasProcess(Process.LoadKp)) {
|
||||
// return;
|
||||
// }
|
||||
// calculationStore.setStatus(
|
||||
// 'selectLegalClientRegion',
|
||||
// ElementStatus.Default,
|
||||
// );
|
||||
|
||||
// let evo_legal_regionid = calculationStore.getOption('selectQuote')
|
||||
// ?.evo_legal_regionid;
|
||||
// if (objectRegistration === 100000000) {
|
||||
// evo_legal_regionid = regionRegistration;
|
||||
// calculationStore.setStatus(
|
||||
// 'selectLegalClientRegion',
|
||||
// ElementStatus.Disabled,
|
||||
// );
|
||||
// } else {
|
||||
// const evo_region_fias_id = get(
|
||||
// lead.accountidData || opportunity.accountidData,
|
||||
// 'evo_address_legalidData.evo_region_fias_id',
|
||||
// undefined,
|
||||
// );
|
||||
// if (evo_region_fias_id) {
|
||||
// calculationStore.setValue('legalClientRegion', evo_region_fias_id);
|
||||
// calculationStore.setStatus(
|
||||
// 'selectLegalClientRegion',
|
||||
// ElementStatus.Disabled,
|
||||
// );
|
||||
|
||||
// const targetLegalClientRegion = calculationStore.getOption(
|
||||
// 'selectLegalClientRegion',
|
||||
// {
|
||||
// evo_fias_id: evo_region_fias_id,
|
||||
// },
|
||||
// );
|
||||
// if (targetLegalClientRegion) {
|
||||
// evo_legal_regionid = targetLegalClientRegion.evo_regionid;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// calculationStore.setValue('legalClientRegion', evo_legal_regionid);
|
||||
// },
|
||||
// options: {
|
||||
// fireImmediately: true,
|
||||
// },
|
||||
// }),
|
||||
|
||||
// temp
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
return {
|
||||
lead: calculationStore.getOption('selectLead'),
|
||||
opportunity: calculationStore.getOption('selectOpportunity'),
|
||||
objectRegistration: calculationStore.getValue('objectRegistration'),
|
||||
regionRegistration: calculationStore.getValue('regionRegistration'),
|
||||
};
|
||||
},
|
||||
effect: ({ lead, opportunity, objectRegistration, regionRegistration }) => {
|
||||
if (calculationProcess.hasProcess(Process.LoadKp)) {
|
||||
return;
|
||||
}
|
||||
calculationStore.setStatus(
|
||||
'selectLegalClientRegion',
|
||||
ElementStatus.Default,
|
||||
);
|
||||
effect: ({ lead, opportunity }) => {
|
||||
let evo_legal_regionid;
|
||||
|
||||
let evo_legal_regionid = calculationStore.getOption('selectQuote')
|
||||
?.evo_legal_regionid;
|
||||
if (objectRegistration === 100000000) {
|
||||
evo_legal_regionid = regionRegistration;
|
||||
calculationStore.setStatus(
|
||||
let accountidData = {};
|
||||
|
||||
if (lead) {
|
||||
accountidData = lead.accountidData;
|
||||
}
|
||||
|
||||
if (opportunity) {
|
||||
accountidData = opportunity.accountidData;
|
||||
}
|
||||
const evo_region_fias_id = get(
|
||||
accountidData,
|
||||
'evo_address_legalidData.evo_region_fias_id',
|
||||
undefined,
|
||||
);
|
||||
if (evo_region_fias_id) {
|
||||
calculationStore.setValue('legalClientRegion', evo_region_fias_id);
|
||||
|
||||
const targetLegalClientRegion = calculationStore.getOption(
|
||||
'selectLegalClientRegion',
|
||||
ElementStatus.Disabled,
|
||||
{
|
||||
evo_fias_id: evo_region_fias_id,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
const evo_region_fias_id = get(
|
||||
lead.accountidData || opportunity.accountidData,
|
||||
'evo_address_legalidData.evo_region_fias_id',
|
||||
undefined,
|
||||
);
|
||||
if (evo_region_fias_id) {
|
||||
calculationStore.setValue('legalClientRegion', evo_region_fias_id);
|
||||
if (targetLegalClientRegion) {
|
||||
calculationStore.setStatus(
|
||||
'selectLegalClientRegion',
|
||||
ElementStatus.Disabled,
|
||||
);
|
||||
|
||||
const targetLegalClientRegion = calculationStore.getOption(
|
||||
'selectLegalClientRegion',
|
||||
{
|
||||
evo_fias_id: evo_region_fias_id,
|
||||
},
|
||||
);
|
||||
if (targetLegalClientRegion) {
|
||||
evo_legal_regionid = targetLegalClientRegion.evo_regionid;
|
||||
}
|
||||
evo_legal_regionid = targetLegalClientRegion.evo_regionid;
|
||||
}
|
||||
|
||||
calculationStore.setValue('legalClientRegion', evo_legal_regionid);
|
||||
} else {
|
||||
calculationStore.setStatus(
|
||||
'selectLegalClientRegion',
|
||||
ElementStatus.Default,
|
||||
);
|
||||
|
||||
calculationStore.setValue('legalClientRegion', null);
|
||||
}
|
||||
calculationStore.setValue('legalClientRegion', evo_legal_regionid);
|
||||
},
|
||||
options: {
|
||||
fireImmediately: true,
|
||||
},
|
||||
}),
|
||||
|
||||
(calculationStore, calculationProcess) => ({
|
||||
// (calculationStore, calculationProcess) => ({
|
||||
// expression: () => {
|
||||
// return {
|
||||
// lead: calculationStore.getOption('selectLead'),
|
||||
// opportunity: calculationStore.getOption('selectOpportunity'),
|
||||
// townOptions: calculationStore.getOptions('selectLegalClientTown'),
|
||||
// };
|
||||
// },
|
||||
// effect: ({ lead, opportunity, townOptions }) => {
|
||||
// if (
|
||||
// calculationProcess.hasProcess(Process.LoadKp) ||
|
||||
// !townOptions ||
|
||||
// townOptions.length === 0
|
||||
// ) {
|
||||
// return;
|
||||
// }
|
||||
// calculationStore.setStatus(
|
||||
// 'selectLegalClientTown',
|
||||
// ElementStatus.Default,
|
||||
// );
|
||||
|
||||
// let evo_legal_townid = calculationStore.getOption('selectQuote')
|
||||
// ?.evo_legal_townid;
|
||||
|
||||
// const evo_city_fias_id = get(
|
||||
// lead.accountidData || opportunity.accountidData,
|
||||
// 'evo_address_legalidData.evo_city_fias_id',
|
||||
// undefined,
|
||||
// );
|
||||
// if (evo_city_fias_id) {
|
||||
// calculationStore.setStatus(
|
||||
// 'selectLegalClientTown',
|
||||
// ElementStatus.Disabled,
|
||||
// );
|
||||
|
||||
// const targetLegalClientTown = calculationStore.getOption(
|
||||
// 'selectLegalClientTown',
|
||||
// {
|
||||
// evo_fias_id: evo_city_fias_id,
|
||||
// },
|
||||
// );
|
||||
// if (targetLegalClientTown) {
|
||||
// evo_legal_townid = targetLegalClientTown.evo_townid;
|
||||
// calculationStore.setValue(
|
||||
// 'legalClientTown',
|
||||
// targetLegalClientTown.evo_townid,
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// calculationStore.setValue('legalClientTown', evo_legal_townid);
|
||||
// },
|
||||
// }),
|
||||
|
||||
// temp
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
return {
|
||||
lead: calculationStore.getOption('selectLead'),
|
||||
opportunity: calculationStore.getOption('selectOpportunity'),
|
||||
townOptions: calculationStore.getOptions('selectLegalClientTown'),
|
||||
};
|
||||
},
|
||||
effect: ({ lead, opportunity, townOptions }) => {
|
||||
if (
|
||||
calculationProcess.hasProcess(Process.LoadKp) ||
|
||||
!townOptions ||
|
||||
townOptions.length === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
calculationStore.setStatus(
|
||||
'selectLegalClientTown',
|
||||
ElementStatus.Default,
|
||||
);
|
||||
effect: ({ lead, opportunity }) => {
|
||||
setTimeout(() => {
|
||||
let evo_legal_townid;
|
||||
|
||||
let evo_legal_townid = calculationStore.getOption('selectQuote')
|
||||
?.evo_legal_townid;
|
||||
let accountidData = {};
|
||||
|
||||
const evo_city_fias_id = get(
|
||||
lead.accountidData || opportunity.accountidData,
|
||||
'evo_address_legalidData.evo_city_fias_id',
|
||||
undefined,
|
||||
);
|
||||
if (evo_city_fias_id) {
|
||||
calculationStore.setStatus(
|
||||
'selectLegalClientTown',
|
||||
ElementStatus.Disabled,
|
||||
if (lead) {
|
||||
accountidData = lead.accountidData;
|
||||
}
|
||||
|
||||
if (opportunity) {
|
||||
accountidData = opportunity.accountidData;
|
||||
}
|
||||
|
||||
const evo_city_fias_id = get(
|
||||
accountidData,
|
||||
'evo_address_legalidData.evo_city_fias_id',
|
||||
undefined,
|
||||
);
|
||||
|
||||
const targetLegalClientTown = calculationStore.getOption(
|
||||
'selectLegalClientTown',
|
||||
{
|
||||
evo_fias_id: evo_city_fias_id,
|
||||
},
|
||||
);
|
||||
if (targetLegalClientTown) {
|
||||
evo_legal_townid = targetLegalClientTown.evo_townid;
|
||||
calculationStore.setValue(
|
||||
'legalClientTown',
|
||||
targetLegalClientTown.evo_townid,
|
||||
if (evo_city_fias_id) {
|
||||
const targetLegalClientTown = calculationStore.getOption(
|
||||
'selectLegalClientTown',
|
||||
{
|
||||
evo_fias_id: evo_city_fias_id,
|
||||
},
|
||||
);
|
||||
if (targetLegalClientTown) {
|
||||
calculationStore.setStatus(
|
||||
'selectLegalClientTown',
|
||||
ElementStatus.Disabled,
|
||||
);
|
||||
evo_legal_townid = targetLegalClientTown.evo_townid;
|
||||
}
|
||||
calculationStore.setValue('legalClientTown', evo_legal_townid);
|
||||
} else {
|
||||
calculationStore.setStatus(
|
||||
'selectLegalClientTown',
|
||||
ElementStatus.Default,
|
||||
);
|
||||
|
||||
calculationStore.setValue('legalClientTown', null);
|
||||
}
|
||||
}
|
||||
calculationStore.setValue('legalClientTown', evo_legal_townid);
|
||||
}, 2000);
|
||||
},
|
||||
}),
|
||||
|
||||
(calculationStore, calculationProcess) => ({
|
||||
expression: () => {
|
||||
return {
|
||||
...calculationStore.getValues([
|
||||
'regionRegistration',
|
||||
'objectRegistration',
|
||||
'legalClientTown',
|
||||
]),
|
||||
townRegistrationOptions: calculationStore.getOption(
|
||||
'selectTownRegistration',
|
||||
),
|
||||
};
|
||||
},
|
||||
effect: ({ objectRegistration, legalClientTown }) => {
|
||||
if (objectRegistration === 100000001) {
|
||||
calculationStore.setStatus(
|
||||
'selectTownRegistration',
|
||||
ElementStatus.Default,
|
||||
);
|
||||
calculationStore.setFilter('selectTownRegistration', towns =>
|
||||
towns.filter(town => town.evo_businessunit_evolution === true),
|
||||
);
|
||||
} else {
|
||||
calculationStore.setStatus(
|
||||
'selectTownRegistration',
|
||||
ElementStatus.Disabled,
|
||||
);
|
||||
calculationStore.setFilter('selectTownRegistration', undefined);
|
||||
// (calculationStore, calculationProcess) => ({
|
||||
// expression: () => {
|
||||
// return {
|
||||
// ...calculationStore.getValues([
|
||||
// 'regionRegistration',
|
||||
// 'objectRegistration',
|
||||
// 'legalClientTown',
|
||||
// ]),
|
||||
// townRegistrationOptions: calculationStore.getOption(
|
||||
// 'selectTownRegistration',
|
||||
// ),
|
||||
// };
|
||||
// },
|
||||
// effect: ({ objectRegistration, legalClientTown }) => {
|
||||
// if (objectRegistration === 100000001) {
|
||||
// calculationStore.setStatus(
|
||||
// 'selectTownRegistration',
|
||||
// ElementStatus.Default,
|
||||
// );
|
||||
// calculationStore.setFilter('selectTownRegistration', towns =>
|
||||
// towns.filter(town => town.evo_businessunit_evolution === true),
|
||||
// );
|
||||
// } else {
|
||||
// calculationStore.setStatus(
|
||||
// 'selectTownRegistration',
|
||||
// ElementStatus.Disabled,
|
||||
// );
|
||||
// calculationStore.setFilter('selectTownRegistration', undefined);
|
||||
|
||||
if (!calculationProcess.hasProcess(Process.LoadKp)) {
|
||||
calculationStore.setValue('townRegistration', legalClientTown);
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
// if (!calculationProcess.hasProcess(Process.LoadKp)) {
|
||||
// calculationStore.setValue('townRegistration', legalClientTown);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// }),
|
||||
];
|
||||
|
||||
export default gibddReactions;
|
||||
|
||||
Reference in New Issue
Block a user