Categories¶
Source: pharmanet-admin/src/pages/Categories/Categories.jsx
Overview¶
The categories page manages the product taxonomy with a hierarchical tree structure supporting infinite nesting.
Components¶
| Component | File | Description |
|---|---|---|
CategoryTree |
components/categories/CategoryTree.jsx |
Drag-and-drop sortable tree |
CategoryForm |
components/categories/CategoryForm.jsx |
Add/edit form with image upload |
CategoryProductList |
components/categories/CategoryProductList.jsx |
Products in selected category |
Features¶
- Drag-and-drop reordering (uses
react-beautiful-dnd) - Infinite nesting via
parent_idself-reference - Image upload for category icons
- Delete with dependency checking — warns if subcategories or products exist
Redux Slice¶
Source: pharmanet-admin/src/store/categorySlice.js
| Action | Description |
|---|---|
fetchCategories() |
Load full tree |
createCategory(data) |
Add new category |
updateCategory(id, data) |
Edit category |
deleteCategory(id) |
Remove (with checks) |
reorderCategories(order) |
Bulk upsert sort_order |
Related¶
- Products — Product categories