process/gibdd: make label for selectRegistration filter

This commit is contained in:
vchikalkin 2023-02-23 11:43:12 +03:00
parent 1d73a6d8e2
commit 1e0c40a5a0
2 changed files with 33 additions and 32 deletions

View File

@ -288,33 +288,34 @@ export function common({ store, apolloClient, queryClient }: ProcessContext) {
variables: { currentDate },
});
$calculation
.element('selectRegistration')
.setOptions(
normalizeOptions(
evo_addproduct_types?.filter(
(x) =>
x?.evo_leasingobject_types?.find(
(evo_leasingobject_type) =>
evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType
) &&
x.evo_whom_register === objectRegistration &&
Boolean(
leaseObjectCategory === 100_000_001
? x.evo_towtruck === true || x.evo_towtruck === false
: x.evo_towtruck === false
) &&
x.evo_gibdd_region === (objectRegionRegistrationId === regionRegistrationId) &&
Boolean(typePTS && x.evo_pts_type?.includes(typePTS)) &&
Boolean(
x.evo_accountid &&
evo_region?.accounts?.some(
(evo_region_account) => evo_region_account?.accountid === x.evo_accountid
)
const options = evo_addproduct_types
?.filter(
(x) =>
x?.evo_leasingobject_types?.find(
(evo_leasingobject_type) =>
evo_leasingobject_type?.evo_leasingobject_typeid === leaseObjectType
) &&
x.evo_whom_register === objectRegistration &&
Boolean(
leaseObjectCategory === 100_000_001
? x.evo_towtruck === true || x.evo_towtruck === false
: x.evo_towtruck === false
) &&
x.evo_gibdd_region === (objectRegionRegistrationId === regionRegistrationId) &&
Boolean(typePTS && x.evo_pts_type?.includes(typePTS)) &&
Boolean(
x.evo_accountid &&
evo_region?.accounts?.some(
(evo_region_account) => evo_region_account?.accountid === x.evo_accountid
)
)
)
);
)
.map((x) => ({
...x,
label: `${x?.label} (${x?.evo_graph_price} руб.)`,
}));
$calculation.element('selectRegistration').setOptions(normalizeOptions(options));
}
);
}

View File

@ -103,12 +103,12 @@ function getMainData({ query }, onCompleted) {
currentDate,
},
}).then(({ data }) => {
const selectRegistration = data.evo_addproduct_types
?.filter((x) => x?.evo_product_type === 100_000_001)
.map((x) => ({
...x,
label: `${x?.label} (${x?.evo_graph_price} руб.)`,
}));
// const selectRegistration = data.evo_addproduct_types
// ?.filter((x) => x?.evo_product_type === 100_000_001)
// .map((x) => ({
// ...x,
// label: `${x?.label} (${x?.evo_graph_price} руб.)`,
// }));
const selectTechnicalCard = data.evo_addproduct_types
?.filter((x) => x?.evo_product_type === 100_000_000)
@ -140,7 +140,7 @@ function getMainData({ query }, onCompleted) {
);
onCompleted({
selectRegistration,
// selectRegistration,
selectTechnicalCard,
selectTelematic,
selectTracker,