selectRegistration filter

This commit is contained in:
vchikalkin 2021-06-03 18:07:59 +03:00
parent 437e8a8a2f
commit f2c647a44d

View File

@ -355,21 +355,41 @@ const gibddReactions: IReactionEffect[] = [
typePTS,
}) => {
calculationStore.setFilter('selectRegistration', options =>
options.filter(x => {
return (
x.evo_whom_register === objectRegistration &&
(typePTS
? x.evo_pts_type &&
x.evo_pts_type.filter(x => x > 0).includes(typePTS)
: true) &&
x.evo_gibdd_region ===
(objectRegionRegistration.evo_regionid === regionRegistration) &&
(x.accountid
? objectRegionRegistration.accounts
.map(x => x.accountid)
.includes(x.evo_accountid)
: true)
);
options.filter((x, i) => {
if (!(x.evo_whom_register === objectRegistration)) {
return false;
}
if (
!(
x.evo_gibdd_region ===
(objectRegionRegistration.evo_regionid === regionRegistration)
)
) {
return false;
}
if (
(typePTS &&
(!x.evo_pts_type ||
x.evo_pts_type.filter(t => t > 0).length === 0)) ||
x.evo_pts_type?.filter(t => t > 0).includes(typePTS) === false
) {
return false;
}
if (
(x.evo_accountid &&
(!objectRegionRegistration.accounts ||
objectRegionRegistration.accounts.length === 0)) ||
objectRegionRegistration.accounts
.map(r => r.accountid)
.includes(x.evo_accountid) === false
) {
return false;
}
return true;
}),
);
},