diff --git a/app/components/catalog/CatalogConfigurator.vue b/app/components/catalog/CatalogConfigurator.vue index 398c418..eec64dc 100644 --- a/app/components/catalog/CatalogConfigurator.vue +++ b/app/components/catalog/CatalogConfigurator.vue @@ -263,6 +263,21 @@ function visibleFields(group: ProductGroup) { } const selectedGroup = computed(() => productGroups.value.find((group) => group.key === props.productTypeSlug) ?? null); +const currentGroupIndex = computed(() => productGroups.value.findIndex((group) => group.key === props.productTypeSlug)); +const previousGroup = computed(() => { + if (currentGroupIndex.value <= 0) { + return null; + } + + return productGroups.value[currentGroupIndex.value - 1] ?? null; +}); +const nextGroup = computed(() => { + if (currentGroupIndex.value < 0 || currentGroupIndex.value >= productGroups.value.length - 1) { + return null; + } + + return productGroups.value[currentGroupIndex.value + 1] ?? null; +}); function requiredKeys(group: ProductGroup) { return visibleFields(group).map((field) => field.key); @@ -564,177 +579,206 @@ function decrementSelected(group: ProductGroup) { decrementProduct(product.id); } } + +function productDetailPath(group: ProductGroup) { + return `/products/${group.key}`; +}