feat: implement two-step category and product picker with private product creation support
This commit is contained in:
@@ -73,7 +73,7 @@ class CategoryThenProductPicker {
|
||||
}
|
||||
|
||||
// Samla alla kategori-IDs i den valda grenen (inkl. ättlingar)
|
||||
final categoryIds = _collectIds(selectedCategory);
|
||||
final categoryIds = _collectIds(selectedCategory!);
|
||||
|
||||
// Filtrera produkter på dessa kategorier
|
||||
final filtered = products
|
||||
@@ -84,7 +84,7 @@ class CategoryThenProductPicker {
|
||||
// Bygg eventuell onCreate-callback med categoryId inbunden
|
||||
final onCreateBound = onCreate == null
|
||||
? null
|
||||
: (String name) => onCreate(name, selectedCategory.id);
|
||||
: (String name) => onCreate(name, selectedCategory!.id);
|
||||
|
||||
// Steg 2 — välj produkt
|
||||
if (!context.mounted) return null;
|
||||
@@ -92,7 +92,7 @@ class CategoryThenProductPicker {
|
||||
context,
|
||||
products: useList,
|
||||
value: currentProductId,
|
||||
label: 'Produkt i "${selectedCategory.name}"',
|
||||
label: 'Produkt i "${selectedCategory!.name}"',
|
||||
categoryFilter: null, // redan förfiltrerat
|
||||
onCreate: onCreateBound,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user