feat: Implement comprehensive edit functionality and standardize UI components
• Add full edit functionality for groceries with modal support
• Standardize delete confirmations across all components using ConfirmDeleteModal
• Implement complete shopping event edit functionality:
- Create EditShoppingEvent component with full form capabilities
- Add missing backend PUT endpoint for shopping events
- Support editing all event data (shop, date, groceries, amounts, prices, notes)
• Add inline grocery edit functionality in shopping event forms:
- Allow editing grocery items within add/edit forms
- Load selected items back into input fields for modification
• Fix date timezone issues in edit forms to prevent date shifting
• Remove non-functional "View Details" button in favor of working Edit button
• Enhance user experience with consistent edit/delete patterns across the app
Breaking changes: None
Backend: Added PUT /shopping-events/{id} and DELETE /shopping-events/{id} endpoints
Frontend: Complete edit workflow for all entities with improved UX
This commit is contained in:
@@ -5,7 +5,6 @@ from datetime import datetime
|
||||
# Base schemas
|
||||
class GroceryBase(BaseModel):
|
||||
name: str
|
||||
price: float = Field(..., gt=0)
|
||||
category: str
|
||||
organic: bool = False
|
||||
weight: Optional[float] = None
|
||||
@@ -16,7 +15,6 @@ class GroceryCreate(GroceryBase):
|
||||
|
||||
class GroceryUpdate(BaseModel):
|
||||
name: Optional[str] = None
|
||||
price: Optional[float] = Field(None, gt=0)
|
||||
category: Optional[str] = None
|
||||
organic: Optional[bool] = None
|
||||
weight: Optional[float] = None
|
||||
@@ -55,6 +53,20 @@ class Shop(ShopBase):
|
||||
class GroceryInEvent(BaseModel):
|
||||
grocery_id: int
|
||||
amount: float = Field(..., gt=0)
|
||||
price: float = Field(..., gt=0) # Price at the time of this shopping event
|
||||
|
||||
class GroceryWithEventData(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
category: str
|
||||
organic: bool
|
||||
weight: Optional[float] = None
|
||||
weight_unit: str
|
||||
amount: float # Amount purchased in this event
|
||||
price: float # Price at the time of this event
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
class ShoppingEventBase(BaseModel):
|
||||
shop_id: int
|
||||
@@ -76,7 +88,7 @@ class ShoppingEventResponse(ShoppingEventBase):
|
||||
id: int
|
||||
created_at: datetime
|
||||
shop: Shop
|
||||
groceries: List[Grocery] = []
|
||||
groceries: List[GroceryWithEventData] = []
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
Reference in New Issue
Block a user