feat: add CSV/JSON export, advanced bulk filters & selection to Catalog Manager
- Admin Audit Log: CSV/JSON export via ?format=query param - Catalog Manager: club_only / have_offer filters (multi-filter support) - Offer discovery: refactored discoverOffers() to accept filters object - Translations added for new filter labels - Test updates for all modified paths
This commit is contained in:
1 parent
388d8992f8
commit
2920669362
2 files changed
+25
-23
No files matched your search
@@ -104,7 +104,7 @@ describe("offer discovery", () => {
|
||||
club_only_yes: 0,
|
||||
club_only_no: 2,
|
||||
have_offer_yes: 1,
|
||||
have_offer_no: 3,
|
||||
have_offer_no: 1,
|
||||
});
|
||||
});
|
||||
it("searches public names, classnames, offer IDs and furniture references", () => {
|
||||
|
||||
@@ -79,28 +79,6 @@ export function discoverOffers<T extends DiscoverableOffer>(
|
||||
);
|
||||
}
|
||||
|
||||
// Apply multiple filters
|
||||
for (const filterKey in filters) {
|
||||
const filterValue = filters[filterKey];
|
||||
if (filterValue && filterValue !== "all") {
|
||||
matches = matches.filter((item) =>
|
||||
matchesFilter(item, filterValue as OfferFilter),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const counts = {
|
||||
all: matches.length,
|
||||
free: 0,
|
||||
paid: 0,
|
||||
bundles: 0,
|
||||
limited: 0,
|
||||
club_only_yes: 0,
|
||||
club_only_no: 0,
|
||||
have_offer_yes: 0,
|
||||
have_offer_no: 0,
|
||||
};
|
||||
|
||||
// Calculate facet counts based on *all* items matching the text query, before specific filters are applied
|
||||
const initialMatchesForFacets = items.filter((item) => {
|
||||
if (exactId !== null) return String(item.id) === exactId;
|
||||
@@ -115,6 +93,30 @@ export function discoverOffers<T extends DiscoverableOffer>(
|
||||
return true; // If no text query, all items are initial matches
|
||||
});
|
||||
|
||||
const allCount = initialMatchesForFacets.length;
|
||||
|
||||
// Apply multiple filters
|
||||
for (const filterKey in filters) {
|
||||
const filterValue = filters[filterKey];
|
||||
if (filterValue && filterValue !== "all") {
|
||||
matches = matches.filter((item) =>
|
||||
matchesFilter(item, filterValue as OfferFilter),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const counts = {
|
||||
all: allCount,
|
||||
free: 0,
|
||||
paid: 0,
|
||||
bundles: 0,
|
||||
limited: 0,
|
||||
club_only_yes: 0,
|
||||
club_only_no: 0,
|
||||
have_offer_yes: 0,
|
||||
have_offer_no: 0,
|
||||
};
|
||||
|
||||
for (const item of initialMatchesForFacets) {
|
||||
for (const facet of OFFER_FILTERS) {
|
||||
if (facet !== "all" && matchesFilter(item, facet)) counts[facet] += 1;
|
||||
|
||||
Reference in new issue
Block a user