Skip to content

feat: вкладка «Категории» товара на Vue (#113) - #479

Open
Ibochkarev wants to merge 5 commits into
betafrom
feat/issue-113-product-categories-vue
Open

feat: вкладка «Категории» товара на Vue (#113)#479
Ibochkarev wants to merge 5 commits into
betafrom
feat/issue-113-product-categories-vue

Conversation

@Ibochkarev

Copy link
Copy Markdown
Member

Описание

Вкладка «Категории» на странице редактирования товара переведена с ExtJS (ms3-tree-categories) на Vue. Добавлен переиспользуемый виджет ResourceCategoryTree (PrimeVue Tree + независимые чекбоксы), REST endpoint для lazy-дерева и hidden input categories для сохранения через существующий контракт ProductDataService::saveCategories().

Тип изменений

  • Исправление бага (non-breaking change)
  • Новая функциональность (non-breaking change)
  • Breaking change (изменение, ломающее обратную совместимость)
  • Рефакторинг (без изменения функциональности)
  • Документация
  • Другое (опишите):

Связанные Issues

Closes #113

Refs #350 — после merge остаются ExtJS: вкладка «Связи» (links.grid.js), shell формы товара (product.common.js, ms3.combo.js), combos справочников. Shell и #114 — отдельные PR.

Как это было протестировано?

Локальный CI-гейт:

cd core/components/minishop3 && composer ci:php   # exit 0, 18 smoke tests
cd vueManager && npm run lint:ci                  # exit 0
cd vueManager && npm run build                    # exit 0
php -l core/components/minishop3/src/Services/Product/ProductCategoryTreeService.php  # exit 0
php -l core/components/minishop3/src/Controllers/Api/ProductDataController.php       # exit 0
  • Ручное тестирование (нужен MODX mgr: открыть товар → вкладка Категории → выбор → Save → reload)
  • Автоматические тесты (composer ci:php, npm run lint:ci)
  • Тестирование на разных версиях PHP/MODX

Конфигурация тестирования:

  • MiniShop3: branch feat/issue-113-product-categories-vue
  • MODX: не запускался в этой сессии
  • PHP: 8.2+ (локальный php -l)

Скриншоты (если применимо)

До После
ExtJS ms3-tree-categories Vue ProductCategoriesTab + ResourceCategoryTree

Чеклист

  • Код соответствует стилю проекта
  • Добавлены/обновлены комментарии в сложных местах
  • Изменения не ломают существующую функциональность (контракт POST categories сохранён)
  • Лексиконы: новые ключи не требовались (используются manager.inc.php / MODX core)
  • PHPStan проходит без новых ошибок (локально; в CI пока нет)
  • ESLint проходит без ошибок (npm run lint:ci)
  • Обновлён CHANGELOG.md (release-time)

Дополнительные заметки

Gate A (#113):

AC Code Test
Vue-вкладка Категории ProductCategoriesTab.vue, ProductTabs.vue lint + build
Переиспользуемое дерево ResourceCategoryTree.vue, рефактор OptionCategoryTree.vue lint + build
Сохранение memberships hidden name="categories", saveCategories() без изменений smoke (контракт в коде)
REST tree API GET /api/mgr/product-data/{id}/categories/tree composer ci:php

Deferred (non-blockers): единый CategoryTreeNodeProvider для GetNodes + REST; registry DI для ProductCategoryTreeService; рефактор dispatch built-in tabs в ProductTabs.vue.

@Ibochkarev Ibochkarev added enhancement New feature or request javascript Pull requests that update javascript code priority: medium Средний приоритет tech-debt Maintainability / refactor / architecture debt labels Jul 29, 2026
Replace ms3-tree-categories with a Vue tab backed by a reusable
ResourceCategoryTree widget and REST tree endpoint. Closes #113.
@Ibochkarev
Ibochkarev force-pushed the feat/issue-113-product-categories-vue branch from 700385d to b7aba67 Compare July 29, 2026 11:31
Satisfy PHPStan for constructor/property typing and select() column aliases.
When the Vue tree sends categories, checked state follows the client
allowlist instead of stale msCategoryMember rows from the database.
- Drop invalid addCss for ResourceCategoryTree.min.css from product
  update and settings controllers; the widget styles ship inside the
  product-tabs and options CSS bundles, so the dedicated file 404'd.
- Register ProductCategoryTreeService as ms3_product_category_tree in
  ServiceRegistry and inject it via the container in
  ProductDataController::getCategoriesTree instead of `new`.
- Extract MiniShop3\Utils\IntArrayDecoder and route both
  BaseApiController::decodeIntArray and OptionsController::decodeIntArray
  through it, removing the duplicated ad-hoc implementations. The shared
  decoder deduplicates and keeps only positive ids.
- Extract MiniShop3\Utils\ResourceCategoryTreeQueryTrait with the
  category/container class-key sets and SQL helpers, used by both
  ProductCategoryTreeService and OptionsController::getTree.
PHPStan: $out is already a list built via sequential append.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request javascript Pull requests that update javascript code priority: medium Средний приоритет tech-debt Maintainability / refactor / architecture debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Переезд вкладки Категории на Vue

1 participant