From f8880d75c66e1efcd6adc12e750e850dc6c2a435 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:13:56 +0700 Subject: [PATCH] Show variant counts in catalog toggle --- .../catalog/CatalogConfigurator.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/components/catalog/CatalogConfigurator.vue b/app/components/catalog/CatalogConfigurator.vue index 568b71b..bd90df0 100644 --- a/app/components/catalog/CatalogConfigurator.vue +++ b/app/components/catalog/CatalogConfigurator.vue @@ -426,6 +426,21 @@ function articleLabel(group: ProductGroup) { return selectedProduct(group)?.sku ?? '—'; } +function variantCountLabel(count: number) { + const mod10 = count % 10; + const mod100 = count % 100; + + if (mod10 === 1 && mod100 !== 11) { + return `${count} вариант`; + } + + if (mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) { + return `${count} варианта`; + } + + return `${count} вариантов`; +} + function toggleExpanded(group: ProductGroup) { getGroupState(group).isExpanded = !getGroupState(group).isExpanded; } @@ -653,7 +668,10 @@ function decrementSelected(group: ProductGroup) { stroke-linejoin="round" /> - {{ getGroupState(group).isExpanded ? 'Свернуть все варианты' : 'Развернуть все варианты' }} + + {{ getGroupState(group).isExpanded ? 'Свернуть все варианты' : 'Развернуть все варианты' }} + ({{ variantCountLabel(group.products.length) }}) +