- Throughput: new "Throughput Overview" header with Gauge icon and brand-green badge icons on each card (Today, This week, 4-week average, Horse Mix, Grain Mix) - Throughput: inline rolling-range selector (7d / 4w / 6w / 12w, default 4 weeks) driving the customer-mix cards; stats window widened to 12 weeks so switching range is a pure client-side re-filter - Throughput: cards collapse to a single even 5-across row on laptop and up, with container-query value text that scales to each card's width - Throughput: date logic pinned to Australian Eastern time (fixes the day-early date); This week subtitle shows the Mon-Sun date range - Throughput: subtler tinted add-form; removed the inline-entry kicker and the "Open full form" link - Topbar: fix cramped laptop header - action toggles no longer wrap above the user button; search drops to its own row earlier Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
107 lines
2.7 KiB
Python
107 lines
2.7 KiB
Python
from datetime import date, datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class MixCalculatorProductOptionRead(BaseModel):
|
|
product_id: int
|
|
client_name: str
|
|
product_name: str
|
|
mix_id: int
|
|
mix_name: str
|
|
unit_of_measure: str
|
|
unit_size_kg: float
|
|
mix_total_kg: float
|
|
|
|
|
|
class MixCalculatorOptionsRead(BaseModel):
|
|
clients: list[str]
|
|
products: list[MixCalculatorProductOptionRead]
|
|
|
|
|
|
class MixCalculatorSessionLineRead(BaseModel):
|
|
id: int | None = None
|
|
raw_material_id: int | None
|
|
raw_material_name: str
|
|
required_kg: float
|
|
mix_percentage: float
|
|
unit: str
|
|
rounding_decimals: int = 2
|
|
sort_order: int
|
|
|
|
|
|
class MixCalculatorSessionBase(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
mix_date: date
|
|
client_name: str = Field(min_length=1, max_length=255)
|
|
product_id: int
|
|
batch_size_kg: float = Field(gt=0)
|
|
prepared_by_name: str = Field(min_length=1, max_length=255)
|
|
status: str = "saved"
|
|
notes: str | None = Field(default=None, max_length=2000)
|
|
|
|
|
|
class MixCalculatorSessionCreate(MixCalculatorSessionBase):
|
|
pass
|
|
|
|
|
|
class MixCalculatorSessionUpdate(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
mix_date: date | None = None
|
|
client_name: str | None = Field(default=None, min_length=1, max_length=255)
|
|
product_id: int | None = None
|
|
batch_size_kg: float | None = Field(default=None, gt=0)
|
|
prepared_by_name: str | None = Field(default=None, min_length=1, max_length=255)
|
|
status: str | None = None
|
|
notes: str | None = Field(default=None, max_length=2000)
|
|
|
|
|
|
class MixCalculatorPreviewRead(BaseModel):
|
|
client_name: str
|
|
product_id: int
|
|
product_name: str
|
|
mix_id: int
|
|
mix_name: str
|
|
mix_date: date
|
|
batch_size_kg: float
|
|
total_bags: float
|
|
total_kg: float
|
|
product_unit_of_measure: str
|
|
product_unit_size_kg: float
|
|
prepared_by_name: str
|
|
status: str
|
|
notes: str | None
|
|
warnings: list[str]
|
|
lines: list[MixCalculatorSessionLineRead]
|
|
|
|
|
|
class MixCalculatorSessionSummaryRead(BaseModel):
|
|
id: int
|
|
tenant_id: str
|
|
session_number: str
|
|
client_name: str
|
|
product_id: int
|
|
product_name: str
|
|
mix_id: int
|
|
mix_name: str
|
|
mix_date: date
|
|
batch_size_kg: float
|
|
total_bags: float
|
|
total_kg: float
|
|
product_unit_of_measure: str
|
|
product_unit_size_kg: float
|
|
prepared_by_user_id: int | None
|
|
prepared_by_name: str
|
|
created_by: str
|
|
status: str
|
|
notes: str | None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
warnings: list[str]
|
|
is_owner: bool
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class MixCalculatorSessionRead(MixCalculatorSessionSummaryRead):
|
|
lines: list[MixCalculatorSessionLineRead]
|