- Implemented PaymentsTabForm component for managing payment information. - Implemented TransportTabForm component for managing transport details. - Implemented ValidationTabForm component for managing validation documents. - Enhanced the main edit page to include new tabs and handle data saving for each section. - Added alert components for success and error messages during save operations. - Updated server-side logic to handle fetching and saving of pedimento data.
55 lines
2.3 KiB
Python
55 lines
2.3 KiB
Python
from pydantic import BaseModel, Field, ConfigDict
|
|
from typing import Optional
|
|
from decimal import Decimal
|
|
from datetime import datetime
|
|
|
|
|
|
class PedimentosBase(BaseModel):
|
|
"""Base schema for Pedimentos"""
|
|
year: Optional[str] = Field(None, max_length=2, description="Year")
|
|
customs_office: Optional[str] = Field(None, max_length=2, description="Customs office")
|
|
license: Optional[str] = Field(None, max_length=4, description="License")
|
|
pedimento_number: Optional[str] = Field(None, max_length=7, description="Pedimento number")
|
|
client_id: Optional[int] = Field(None, description="Client ID")
|
|
operation_type: Optional[int] = Field(None, description="Operation type")
|
|
pedimento_type: Optional[int] = Field(None, description="Pedimento type")
|
|
pedimento_code: Optional[str] = Field(None, max_length=2, description="Pedimento key")
|
|
regime: Optional[str] = Field(None, max_length=3, description="Regime")
|
|
status: Optional[str] = Field(None, max_length=30, description="Status")
|
|
usd_value: Optional[Decimal] = Field(None, description="USD value")
|
|
paid_price: Optional[Decimal] = Field(None, description="Paid price")
|
|
gross_weight: Optional[Decimal] = Field(None, description="Gross weight")
|
|
exchange_rate: Optional[Decimal] = Field(None, description="Exchange rate")
|
|
|
|
|
|
class PedimentosCreate(PedimentosBase):
|
|
"""Schema for creating a new Pedimento"""
|
|
pass
|
|
|
|
|
|
class PedimentosUpdate(BaseModel):
|
|
"""Schema for updating a Pedimento"""
|
|
year: Optional[str] = Field(None, max_length=2)
|
|
customs_office: Optional[str] = Field(None, max_length=2)
|
|
license: Optional[str] = Field(None, max_length=4)
|
|
pedimento_number: Optional[str] = Field(None, max_length=7)
|
|
client_id: Optional[int] = None
|
|
operation_type: Optional[int] = None
|
|
pedimento_type: Optional[int] = None
|
|
pedimento_code: Optional[str] = Field(None, max_length=2)
|
|
regime: Optional[str] = Field(None, max_length=3)
|
|
status: Optional[str] = Field(None, max_length=30)
|
|
usd_value: Optional[Decimal] = None
|
|
paid_price: Optional[Decimal] = None
|
|
gross_weight: Optional[Decimal] = None
|
|
exchange_rate: Optional[Decimal] = None
|
|
|
|
|
|
class PedimentosResponse(PedimentosBase):
|
|
"""Schema for Pedimento response"""
|
|
id: int
|
|
tenant_id: int
|
|
created_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|