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) }}) +