Improve the frontend modals

This commit is contained in:
Urtzi Alfaro
2025-10-27 16:33:26 +01:00
parent 61376b7a9f
commit 858d985c92
143 changed files with 9289 additions and 2306 deletions

View File

@@ -60,11 +60,10 @@ class OrdersService:
self.production_client = production_client
self.sales_client = sales_client
@transactional
async def create_order(
self,
db,
order_data: OrderCreate,
self,
db,
order_data: OrderCreate,
user_id: Optional[UUID] = None
) -> OrderResponse:
"""Create a new customer order with comprehensive processing"""
@@ -170,7 +169,6 @@ class OrdersService:
error=str(e))
raise
@transactional
async def update_order_status(
self,
db,
@@ -358,10 +356,15 @@ class OrdersService:
# Detect business model
business_model = await self.detect_business_model(db, tenant_id)
# Calculate performance metrics
fulfillment_rate = Decimal("95.0") # Calculate from actual data
on_time_delivery_rate = Decimal("92.0") # Calculate from actual data
repeat_customers_rate = Decimal("65.0") # Calculate from actual data
# Calculate performance metrics from actual data
fulfillment_rate = metrics.get("fulfillment_rate", Decimal("0.0")) # Use actual calculated rate
on_time_delivery_rate = metrics.get("on_time_delivery_rate", Decimal("0.0")) # Use actual calculated rate
repeat_customers_rate = metrics.get("repeat_customers_rate", Decimal("0.0")) # Use actual calculated rate
# Use the actual calculated values from the repository
order_fulfillment_rate = metrics.get("fulfillment_rate", Decimal("0.0"))
on_time_delivery_rate_metric = metrics.get("on_time_delivery_rate", Decimal("0.0"))
repeat_customers_rate_metric = metrics.get("repeat_customers_rate", Decimal("0.0"))
return OrdersDashboardSummary(
total_orders_today=metrics["total_orders_today"],
@@ -377,10 +380,10 @@ class OrdersService:
delivered_orders=metrics["status_breakdown"].get("delivered", 0),
total_customers=total_customers,
new_customers_this_month=new_customers_this_month,
repeat_customers_rate=repeat_customers_rate,
repeat_customers_rate=repeat_customers_rate_metric,
average_order_value=metrics["average_order_value"],
order_fulfillment_rate=fulfillment_rate,
on_time_delivery_rate=on_time_delivery_rate,
order_fulfillment_rate=order_fulfillment_rate,
on_time_delivery_rate=on_time_delivery_rate_metric,
business_model=business_model,
business_model_confidence=Decimal("85.0") if business_model else None,
recent_orders=[OrderResponse.from_orm(order) for order in recent_orders],
@@ -480,4 +483,3 @@ class OrdersService:
logger.warning("Failed to send status notification",
order_id=str(order.id),
error=str(e))