Category Master — Sub-Category Form (Level 1)

What the admin sees
CategorySubcatsLeafPage.tsx, rendered inside the drawer when a Level 1 node is being added or edited. The form has:
- A read-only “PARENT ROOT” chip showing the currently-selected root’s name — never editable here, since it’s set automatically from the tree selection.
- Name and Slug — same free-text/auto-slug behavior as the root form.
- Display Order — a numeric field.
- Variant Attributes — a repeatable list of attribute cards. Each card has a Name field and a Type dropdown (
selectorswatch):selecttype shows a chip-based “Standard Values” list (type + Enter to add, same pattern as the root form’s Spec Template field).swatchtype shows a repeatable name + hex input pair with a live color-dot preview, building up a list of named swatch values.
What the admin does here
Submitting validates: Name required, Slug required, at least one Variant Attribute present, each attribute’s Name required, and each attribute must have at least one value (standard value for select, swatch value for swatch). On success it calls onAdd/onUpdate with nodeLevel: 1, parentId set to the selected root’s ID, mainDisplayCategory: true (always, for this level), and specTemplate: [] — sub-categories never carry a spec template, that’s root-only.
In edit mode, useCategorySubcatsLeafController pre-fills name, slug, displayOrder, and reconstructs each VariantAttributeForm card from the fetched variantAttributes array (via fromApiVariantAttr) — including correctly routing each attribute’s stored values back into either the select-chip list or the swatch-value list depending on its type.
Related Documents
- SR-024 FR-05 — sub-category field rules
- Architecture — Category Master: Three-Level Hierarchy Administration
- Microservices: product-catalog
- Previous: Root Category Form (Level 0)
- Next: Leaf Node Form (Level 2)