Agregar en el Modal campo de Nro Operario back y front
This commit is contained in:
@@ -886,8 +886,12 @@ def create_inspection(
|
||||
if not checklist:
|
||||
raise HTTPException(status_code=404, detail="Checklist no encontrado")
|
||||
|
||||
# Crear inspección con el employee_code del mecánico actual
|
||||
inspection_data = inspection.dict()
|
||||
inspection_data['mechanic_employee_code'] = current_user.employee_code # Agregar código de operario automáticamente
|
||||
|
||||
db_inspection = models.Inspection(
|
||||
**inspection.dict(),
|
||||
**inspection_data,
|
||||
mechanic_id=current_user.id,
|
||||
max_score=checklist.max_score
|
||||
)
|
||||
|
||||
@@ -110,6 +110,9 @@ class Inspection(Base):
|
||||
vehicle_km = Column(Integer)
|
||||
client_name = Column(String(200))
|
||||
|
||||
# Datos del mecánico
|
||||
mechanic_employee_code = Column(String(50)) # Código de operario del mecánico
|
||||
|
||||
# Scoring
|
||||
score = Column(Integer, default=0)
|
||||
max_score = Column(Integer, default=0)
|
||||
|
||||
@@ -152,6 +152,7 @@ class InspectionBase(BaseModel):
|
||||
vehicle_model: Optional[str] = None
|
||||
vehicle_km: Optional[int] = None
|
||||
client_name: Optional[str] = None
|
||||
mechanic_employee_code: Optional[str] = None
|
||||
|
||||
class InspectionCreate(InspectionBase):
|
||||
checklist_id: int
|
||||
@@ -167,6 +168,7 @@ class Inspection(InspectionBase):
|
||||
id: int
|
||||
checklist_id: int
|
||||
mechanic_id: int
|
||||
mechanic_employee_code: Optional[str] = None
|
||||
score: int
|
||||
max_score: int
|
||||
percentage: float
|
||||
|
||||
Reference in New Issue
Block a user