Improve the frontend

This commit is contained in:
Urtzi Alfaro
2025-10-21 19:50:07 +02:00
parent 05da20357d
commit 8d30172483
105 changed files with 14699 additions and 4630 deletions

View File

@@ -546,7 +546,21 @@ class InventoryService:
ingredients = await ingredient_repo.get_ingredients_by_tenant(tenant_id, 0, 1000)
for ingredient in ingredients:
category = ingredient.category.value if ingredient.category else 'other'
# Determine category based on product type, similar to to_dict() method
category = 'other'
if ingredient.product_type and ingredient.product_type.value == 'finished_product':
# For finished products, use product_category
if ingredient.product_category:
category = ingredient.product_category.value
elif ingredient.ingredient_category and ingredient.ingredient_category.value != 'other':
category = ingredient.ingredient_category.value
else:
# For ingredients, use ingredient_category
if ingredient.ingredient_category and ingredient.ingredient_category.value != 'other':
category = ingredient.ingredient_category.value
elif ingredient.product_category:
category = ingredient.product_category.value
if category not in stock_by_category:
stock_by_category[category] = {
'count': 0,
@@ -826,4 +840,4 @@ class InventoryService:
# This is now handled in stock creation/update validation
# Add more validations as needed
pass
pass