From 29f637a5eeb5445d5c28c38c9428119cc542c090 Mon Sep 17 00:00:00 2001 From: acazares Date: Fri, 7 Nov 2025 10:08:55 -0600 Subject: [PATCH] Refactor pedimento-related interfaces and forms to standardize date and payment fields - Updated `PedimentoDates`, `PedimentoPayments`, `PedimentoTransportMeans`, and `PedimentoValidation` interfaces to include new fields and rename existing ones for consistency. - Modified forms in Svelte components to reflect the updated interfaces, including new input fields for various dates and payment details. - Enhanced status handling in the dashboard to accommodate new status options and improve user feedback. - Implemented token validation on the server-side to ensure secure access to the dashboard. - Cleaned up login logic to prevent redirection loops when tokens are present but potentially expired. --- .../modules/a76/client_and_provider/models.py | 17 +- .../a76/client_and_provider/service.py | 14 +- backend/api/v1/modules/a76/company/models.py | 6 +- backend/api/v1/modules/a76/company/service.py | 16 +- .../a76/pedmientos/dtos/pedimento_dates.py | 4 +- .../a76/pedmientos/routes/pedimento_dates.py | 12 +- .../pedmientos/services/pedimento_dates.py | 2 + docs/SCHEMA_A76_UPDATE.md | 20 +- .../lib/api/dashboard/a76/pedimento-dates.ts | 34 +++- .../api/dashboard/a76/pedimento-payments.ts | 43 +++- .../api/dashboard/a76/pedimento-transport.ts | 25 ++- .../api/dashboard/a76/pedimento-validation.ts | 28 ++- .../dashboard/pedimentos/columns.ts | 44 +++- .../pedimentos/edit/dates-tab-form.svelte | 150 ++++++++++++-- .../pedimentos/edit/general-tab-form.svelte | 22 +- .../pedimentos/edit/payments-tab-form.svelte | 188 ++++++++++++++++-- .../pedimentos/edit/transport-tab-form.svelte | 76 +++---- .../edit/validation-tab-form.svelte | 133 ++++++++++++- .../components/sidebar/team-switcher.svelte | 2 +- frontend/src/routes/+page.server.ts | 39 +++- frontend/src/routes/dashboard/+layout.svelte | 2 + .../routes/dashboard/pedimentos/+page.svelte | 20 +- .../pedimentos/edit/[id]/+page.svelte | 4 +- frontend/src/routes/login/+page.server.ts | 11 +- 24 files changed, 727 insertions(+), 185 deletions(-) diff --git a/backend/api/v1/modules/a76/client_and_provider/models.py b/backend/api/v1/modules/a76/client_and_provider/models.py index af4df115..271342f0 100644 --- a/backend/api/v1/modules/a76/client_and_provider/models.py +++ b/backend/api/v1/modules/a76/client_and_provider/models.py @@ -1,11 +1,10 @@ """ Modelos ORM para gestión de clientes y proveedores """ -from sqlalchemy import Column, Integer, String, DateTime, Boolean, Text, SmallInteger, Numeric, ForeignKey +from sqlalchemy import Column, Integer, String, SmallInteger, Numeric, ForeignKey from sqlalchemy.sql import func from sqlalchemy.orm import relationship from core.database import Base -import enum class ClientProvider(Base): @@ -17,7 +16,7 @@ class ClientProvider(Base): # Primary key client_id = Column(String(8), primary_key=True, nullable=False) - + # Basic information type_nat_foreign = Column(String(1), nullable=True) # TIPO NACIONAL/EXTRANJERO name = Column(String(256), nullable=True) @@ -36,15 +35,15 @@ class ClientProvider(Base): enabled_disabled = Column(SmallInteger, nullable=True) # Relationships - address = relationship("GClientProviderAddress", back_populates="client_provider", uselist=False, cascade="all, delete-orphan") - programs = relationship("GClientProviderPrograms", back_populates="client_provider", uselist=False, cascade="all, delete-orphan") + address = relationship("ClientProviderAddress", back_populates="client_provider", uselist=False, cascade="all, delete-orphan") + programs = relationship("ClientProviderPrograms", back_populates="client_provider", uselist=False, cascade="all, delete-orphan") -class GClientProviderAddress(Base): +class ClientProviderAddress(Base): """ Modelo para la tabla GClientesPro_Direccion - Dirección de clientes y proveedores """ - __tablename__ = "gclient_provider_address" + __tablename__ = "client_provider_address" __table_args__ = {"schema": "a76"} # Primary key (foreign key) @@ -70,11 +69,11 @@ class GClientProviderAddress(Base): client_provider = relationship("ClientProvider", back_populates="address") -class GClientProviderPrograms(Base): +class ClientProviderPrograms(Base): """ Modelo para la tabla GClientesPro_Programas - Programas de clientes y proveedores """ - __tablename__ = "gclient_provider_programs" + __tablename__ = "client_provider_programs" __table_args__ = {"schema": "a76"} # Primary key (foreign key) diff --git a/backend/api/v1/modules/a76/client_and_provider/service.py b/backend/api/v1/modules/a76/client_and_provider/service.py index 99340da0..f12763b7 100644 --- a/backend/api/v1/modules/a76/client_and_provider/service.py +++ b/backend/api/v1/modules/a76/client_and_provider/service.py @@ -8,7 +8,7 @@ from fastapi import HTTPException from typing import List, Optional import logging -from .models import ClientProvider, GClientProviderAddress, GClientProviderPrograms +from .models import ClientProvider, ClientProviderAddress, ClientProviderPrograms from .dto import ( ClientProviderCreateDTO, ClientProviderUpdateDTO, @@ -72,7 +72,7 @@ class ClientProviderService: # Crear dirección si se proporciona if client_data.address: - db_address = GClientProviderAddress( + db_address = ClientProviderAddress( client_id=client_data.client_id, **client_data.address.model_dump(exclude_unset=True) ) @@ -80,7 +80,7 @@ class ClientProviderService: # Crear programas si se proporciona if client_data.programs: - db_programs = GClientProviderPrograms( + db_programs = ClientProviderPrograms( client_id=client_data.client_id, **client_data.programs.model_dump(exclude_unset=True) ) @@ -207,7 +207,7 @@ class ClientProviderService: # Actualizar dirección if client_data.address: - address = self.db.query(GClientProviderAddress).filter(GClientProviderAddress.client_id == client_id).first() + address = self.db.query(ClientProviderAddress).filter(ClientProviderAddress.client_id == client_id).first() if address: # Actualizar dirección existente address_data = client_data.address.model_dump(exclude_unset=True) @@ -215,7 +215,7 @@ class ClientProviderService: setattr(address, field, value) else: # Crear nueva dirección - address = GClientProviderAddress( + address = ClientProviderAddress( client_id=client_id, **client_data.address.model_dump(exclude_unset=True) ) @@ -223,7 +223,7 @@ class ClientProviderService: # Actualizar programas if client_data.programs: - programs = self.db.query(GClientProviderPrograms).filter(GClientProviderPrograms.client_id == client_id).first() + programs = self.db.query(ClientProviderPrograms).filter(ClientProviderPrograms.client_id == client_id).first() if programs: # Actualizar programas existentes programs_data = client_data.programs.model_dump(exclude_unset=True) @@ -231,7 +231,7 @@ class ClientProviderService: setattr(programs, field, value) else: # Crear nuevos programas - programs = GClientProviderPrograms( + programs = ClientProviderPrograms( client_id=client_id, **client_data.programs.model_dump(exclude_unset=True) ) diff --git a/backend/api/v1/modules/a76/company/models.py b/backend/api/v1/modules/a76/company/models.py index 3d8c6587..3d830bb0 100644 --- a/backend/api/v1/modules/a76/company/models.py +++ b/backend/api/v1/modules/a76/company/models.py @@ -7,11 +7,11 @@ from core.database import Base import enum -class GCompany(Base): +class Company(Base): """ - Modelo para la tabla GCompany - Información de la empresa + Modelo para la tabla Company - Información de la empresa """ - __tablename__ = "gcompany" + __tablename__ = "company" __table_args__ = {"schema": "a76"} # Primary key diff --git a/backend/api/v1/modules/a76/company/service.py b/backend/api/v1/modules/a76/company/service.py index 405ad1a2..249f7803 100644 --- a/backend/api/v1/modules/a76/company/service.py +++ b/backend/api/v1/modules/a76/company/service.py @@ -7,7 +7,7 @@ from fastapi import HTTPException from typing import List, Optional import logging -from .models import GCompany +from .models import Company from .dto import CompanyCreateDTO, CompanyUpdateDTO, CompanyResponseDTO logger = logging.getLogger(__name__) @@ -34,12 +34,12 @@ class CompanyService: """ try: # Verificar que no exista ya una empresa (solo puede haber una por el consecutivo único) - existing = self.db.query(GCompany).filter(GCompany.consecutive == True).first() + existing = self.db.query(Company).filter(Company.consecutive == True).first() if existing: raise HTTPException(status_code=400, detail="A company is already registered in the system") # Crear empresa - db_company = GCompany( + db_company = Company( id=company_data.id, consecutive=company_data.consecutive, name=company_data.name, @@ -98,7 +98,7 @@ class CompanyService: Returns: CompanyResponseDTO o None si no existe """ - company = self.db.query(GCompany).filter(GCompany.consecutive == True).first() + company = self.db.query(Company).filter(Company.consecutive == True).first() if not company: return None return CompanyResponseDTO.model_validate(company) @@ -113,7 +113,7 @@ class CompanyService: Returns: CompanyResponseDTO o None si no existe """ - company = self.db.query(GCompany).filter(GCompany.id == company_id).first() + company = self.db.query(Company).filter(Company.id == company_id).first() if not company: return None return CompanyResponseDTO.model_validate(company) @@ -129,7 +129,7 @@ class CompanyService: Returns: CompanyResponseDTO actualizada o None si no existe """ - company = self.db.query(GCompany).filter(GCompany.id == company_id).first() + company = self.db.query(Company).filter(Company.id == company_id).first() if not company: return None @@ -158,7 +158,7 @@ class CompanyService: Returns: True si se eliminó, False si no existe """ - company = self.db.query(GCompany).filter(GCompany.id == company_id).first() + company = self.db.query(Company).filter(Company.id == company_id).first() if not company: return False @@ -179,6 +179,6 @@ class CompanyService: Returns: True si existe una empresa, False en caso contrario """ - return self.db.query(GCompany).filter(GCompany.consecutive == True).first() is not None + return self.db.query(Company).filter(Company.consecutive == True).first() is not None diff --git a/backend/api/v1/modules/a76/pedmientos/dtos/pedimento_dates.py b/backend/api/v1/modules/a76/pedmientos/dtos/pedimento_dates.py index 7cf2f9dc..98d0c593 100644 --- a/backend/api/v1/modules/a76/pedmientos/dtos/pedimento_dates.py +++ b/backend/api/v1/modules/a76/pedmientos/dtos/pedimento_dates.py @@ -5,8 +5,6 @@ from datetime import datetime, time class PedimentoDatesBase(BaseModel): """Base schema for Pedimento Dates""" - pedimento_id: int = Field(..., description="Pedimento ID") - tenant_id: int = Field(..., description="Tenant ID") entry_date: Optional[datetime] = Field(None, description="Entry date") pedimento_date: Optional[datetime] = Field(None, description="Pedimento date") payment_date: Optional[datetime] = Field(None, description="Payment date") @@ -45,6 +43,8 @@ class PedimentoDatesUpdate(BaseModel): class PedimentoDatesResponse(PedimentoDatesBase): """Schema for Pedimento Dates response""" id: int + pedimento_id: int = Field(..., description="Pedimento ID") + tenant_id: int = Field(..., description="Tenant ID") created_at: datetime model_config = ConfigDict(from_attributes=True) diff --git a/backend/api/v1/modules/a76/pedmientos/routes/pedimento_dates.py b/backend/api/v1/modules/a76/pedmientos/routes/pedimento_dates.py index ae83a91e..2d3f5990 100644 --- a/backend/api/v1/modules/a76/pedmientos/routes/pedimento_dates.py +++ b/backend/api/v1/modules/a76/pedmientos/routes/pedimento_dates.py @@ -1,6 +1,7 @@ """ Routes for PedimentoDates CRUD operations """ +import logging from fastapi import APIRouter, Depends, HTTPException from sqlalchemy.orm import Session from core.database import get_core_db @@ -15,7 +16,7 @@ from ..dtos.pedimento_dates import ( router = APIRouter(prefix="/{pedimento_id}/dates") - +logger = logging.getLogger(__name__) @router.get("/", response_model=PedimentoDatesResponse) async def get_dates( @@ -36,8 +37,7 @@ async def get_dates( @router.post("/", response_model=PedimentoDatesResponse, status_code=201) -async def create_dates( - pedimento_id: int, +async def create_dates( data: PedimentoDatesCreate, db: Session = Depends(get_core_db), current_user: dict = Depends(get_current_user) @@ -46,11 +46,7 @@ async def create_dates( tenant_id = get_tenant_from_token(current_user) if not tenant_id: raise HTTPException(status_code=400, detail="Tenant ID not found in token") - - # Ensure pedimento_id matches - if data.pedimento_id != pedimento_id: - raise HTTPException(status_code=400, detail="Pedimento ID mismatch") - + dates = PedimentoDatesService.create(db, data, tenant_id) return dates diff --git a/backend/api/v1/modules/a76/pedmientos/services/pedimento_dates.py b/backend/api/v1/modules/a76/pedmientos/services/pedimento_dates.py index 84708efd..2e928978 100644 --- a/backend/api/v1/modules/a76/pedmientos/services/pedimento_dates.py +++ b/backend/api/v1/modules/a76/pedmientos/services/pedimento_dates.py @@ -1,12 +1,14 @@ """ Service layer for PedimentoDates CRUD operations """ +import logging from typing import Optional from sqlalchemy.orm import Session from ..models.pedimento_dates import PedimentoDates from ..dtos.pedimento_dates import PedimentoDatesCreate, PedimentoDatesUpdate +logger = logging.getLogger(__name__) class PedimentoDatesService: """Service class for PedimentoDates business logic""" diff --git a/docs/SCHEMA_A76_UPDATE.md b/docs/SCHEMA_A76_UPDATE.md index c4587692..b0b6ca65 100644 --- a/docs/SCHEMA_A76_UPDATE.md +++ b/docs/SCHEMA_A76_UPDATE.md @@ -12,10 +12,10 @@ Se han actualizado todos los modelos en `api/v1/modules/a76/` para usar el schem | Módulo | Tabla | Schema | Estado | |--------|-------|---------|---------| -| **Company** | `gcompany` | `a76` | ✅ Actualizada | +| **Company** | `company` | `a76` | ✅ Actualizada | | **Client & Provider** | `client_provider` | `a76` | ✅ Actualizada | -| **Client & Provider** | `gclient_provider_address` | `a76` | ✅ Actualizada | -| **Client & Provider** | `gclient_provider_programs` | `a76` | ✅ Actualizada | +| **Client & Provider** | `client_provider_address` | `a76` | ✅ Actualizada | +| **Client & Provider** | `client_provider_programs` | `a76` | ✅ Actualizada | | **GParts** | `parts` | `a76` | ✅ Actualizada | | **Class** | `classes` | `a76` | ✅ Actualizada | | **Licenses** | `licenses` | `a76` | ✅ Ya estaba | @@ -27,12 +27,12 @@ Se han actualizado todos los modelos en `api/v1/modules/a76/` para usar el schem #### 1. Configuración de Schema ```python # ANTES -class GCompany(Base): - __tablename__ = "gcompany" +class Company(Base): + __tablename__ = "company" # DESPUÉS -class GCompany(Base): - __tablename__ = "gcompany" +class Company(Base): + __tablename__ = "company" __table_args__ = {"schema": "a76"} ``` @@ -59,10 +59,10 @@ PostgreSQL Database ├── tenants ├── licenses ├── license_usage - ├── gcompany + ├── company ├── client_provider - ├── gclient_provider_address - ├── gclient_provider_programs + ├── client_provider_address + ├── client_provider_programs ├── parts └── classes ``` diff --git a/frontend/src/lib/api/dashboard/a76/pedimento-dates.ts b/frontend/src/lib/api/dashboard/a76/pedimento-dates.ts index d6a33b11..7e99ef9e 100644 --- a/frontend/src/lib/api/dashboard/a76/pedimento-dates.ts +++ b/frontend/src/lib/api/dashboard/a76/pedimento-dates.ts @@ -8,22 +8,48 @@ export interface PedimentoDates { pedimento_id: number; tenant_id: number; entry_date?: string | null; - presentation_date?: string | null; + pedimento_date?: string | null; payment_date?: string | null; + rectification_payment_date?: string | null; + extraction_date?: string | null; + submission_date?: string | null; + eucan_date?: string | null; + original_date?: string | null; + start_date?: string | null; + end_date?: string | null; + capture_date?: string | null; + capture_time?: string | null; created_at: string; - updated_at: string; } export interface CreatePedimentoDatesData { entry_date?: string | null; - presentation_date?: string | null; + pedimento_date?: string | null; payment_date?: string | null; + rectification_payment_date?: string | null; + extraction_date?: string | null; + submission_date?: string | null; + eucan_date?: string | null; + original_date?: string | null; + start_date?: string | null; + end_date?: string | null; + capture_date?: string | null; + capture_time?: string | null; } export interface UpdatePedimentoDatesData { entry_date?: string | null; - presentation_date?: string | null; + pedimento_date?: string | null; payment_date?: string | null; + rectification_payment_date?: string | null; + extraction_date?: string | null; + submission_date?: string | null; + eucan_date?: string | null; + original_date?: string | null; + start_date?: string | null; + end_date?: string | null; + capture_date?: string | null; + capture_time?: string | null; } export const pedimentoDatesApi = { diff --git a/frontend/src/lib/api/dashboard/a76/pedimento-payments.ts b/frontend/src/lib/api/dashboard/a76/pedimento-payments.ts index 6d5221a2..cbe39e93 100644 --- a/frontend/src/lib/api/dashboard/a76/pedimento-payments.ts +++ b/frontend/src/lib/api/dashboard/a76/pedimento-payments.ts @@ -7,20 +7,49 @@ export interface PedimentoPayments { id: number; pedimento_id: number; tenant_id: number; - payment_form?: string | null; - bank_identifier?: string | null; + acknowledgment?: string | null; + operation_number?: string | null; + bank_code?: number | null; + cashier?: string | null; + date?: string | null; + time?: string | null; + shift?: string | null; + total_cash_paid?: number | null; + total_contributions?: number | null; + counter_payment?: number | null; + pece_code?: string | null; + payment_id?: number | null; created_at: string; - updated_at: string; } export interface CreatePedimentoPaymentsData { - payment_form?: string | null; - bank_identifier?: string | null; + acknowledgment?: string | null; + operation_number?: string | null; + bank_code?: number | null; + cashier?: string | null; + date?: string | null; + time?: string | null; + shift?: string | null; + total_cash_paid?: number | null; + total_contributions?: number | null; + counter_payment?: number | null; + pece_code?: string | null; + payment_id?: number | null; } export interface UpdatePedimentoPaymentsData { - payment_form?: string | null; - bank_identifier?: string | null; + acknowledgment?: string | null; + operation_number?: string | null; + bank_code?: number | null; + cashier?: string | null; + date?: string | null; + time?: string | null; + shift?: string | null; + total_cash_paid?: number | null; + total_contributions?: number | null; + counter_payment?: number | null; + pece_code?: string | null; + payment_id?: number | null; } export const pedimentoPaymentsApi = { diff --git a/frontend/src/lib/api/dashboard/a76/pedimento-transport.ts b/frontend/src/lib/api/dashboard/a76/pedimento-transport.ts index 22b1f7ee..b5f7d424 100644 --- a/frontend/src/lib/api/dashboard/a76/pedimento-transport.ts +++ b/frontend/src/lib/api/dashboard/a76/pedimento-transport.ts @@ -7,26 +7,25 @@ export interface PedimentoTransportMeans { id: number; pedimento_id: number; tenant_id: number; - arrival_key?: string | null; - arrival_data?: string | null; - departure_key?: string | null; - departure_data?: string | null; + destination?: number | null; + entry_exit?: string | null; + arrival?: string | null; + departure?: string | null; created_at: string; - updated_at: string; } export interface CreatePedimentoTransportMeansData { - arrival_key?: string | null; - arrival_data?: string | null; - departure_key?: string | null; - departure_data?: string | null; + destination?: number | null; + entry_exit?: string | null; + arrival?: string | null; + departure?: string | null; } export interface UpdatePedimentoTransportMeansData { - arrival_key?: string | null; - arrival_data?: string | null; - departure_key?: string | null; - departure_data?: string | null; + destination?: number | null; + entry_exit?: string | null; + arrival?: string | null; + departure?: string | null; } export const pedimentoTransportApi = { diff --git a/frontend/src/lib/api/dashboard/a76/pedimento-validation.ts b/frontend/src/lib/api/dashboard/a76/pedimento-validation.ts index 647b4c80..8d78de9c 100644 --- a/frontend/src/lib/api/dashboard/a76/pedimento-validation.ts +++ b/frontend/src/lib/api/dashboard/a76/pedimento-validation.ts @@ -7,17 +7,37 @@ export interface PedimentoValidation { id: number; pedimento_id: number; tenant_id: number; - document?: string | null; + validator?: string | null; + validation_ack?: string | null; + pre_ack?: string | null; + line_signature?: string | null; + electronic_signature?: string | null; + certificate_number?: string | null; + validator_id?: number | null; + responsible_id?: number | null; created_at: string; - updated_at: string; } export interface CreatePedimentoValidationData { - document?: string | null; + validator?: string | null; + validation_ack?: string | null; + pre_ack?: string | null; + line_signature?: string | null; + electronic_signature?: string | null; + certificate_number?: string | null; + validator_id?: number | null; + responsible_id?: number | null; } export interface UpdatePedimentoValidationData { - document?: string | null; + validator?: string | null; + validation_ack?: string | null; + pre_ack?: string | null; + line_signature?: string | null; + electronic_signature?: string | null; + certificate_number?: string | null; + validator_id?: number | null; + responsible_id?: number | null; } export const pedimentoValidationApi = { diff --git a/frontend/src/lib/components/dashboard/pedimentos/columns.ts b/frontend/src/lib/components/dashboard/pedimentos/columns.ts index 32d478b6..4c4bb93e 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/columns.ts +++ b/frontend/src/lib/components/dashboard/pedimentos/columns.ts @@ -67,15 +67,40 @@ function formatDate(date?: string | null): string { function getStatusColor(status?: string | null): string { if (!status) return 'bg-gray-100 text-gray-800'; - const statusLower = status.toLowerCase(); - if (statusLower.includes('activo') || statusLower.includes('completado')) { + const statusUpper = status.toUpperCase(); + + // Estados completados/exitosos - Verde + if (statusUpper === 'VALIDADO' || statusUpper === 'PAGADO' || statusUpper === 'CARTA CUPO') { return 'bg-green-100 text-green-800'; - } else if (statusLower.includes('pendiente') || statusLower.includes('proceso')) { + } + + // Estados en espera/proceso - Amarillo + if (statusUpper.startsWith('ESPERA')) { return 'bg-yellow-100 text-yellow-800'; - } else if (statusLower.includes('cancelado') || statusLower.includes('rechazado')) { + } + + // Estados con firma - Azul + if (statusUpper === 'CON FIRMA DE PREVIO') { + return 'bg-blue-100 text-blue-800'; + } + + // Estados modificables/editables - Índigo + if (statusUpper === 'MODIFICABLE') { + return 'bg-indigo-100 text-indigo-800'; + } + + // Estados de borrado - Naranja + if (statusUpper.includes('BORRADA')) { + return 'bg-orange-100 text-orange-800'; + } + + // Estados cancelados/desistidos - Rojo + if (statusUpper === 'DESISTIO') { return 'bg-red-100 text-red-800'; } - return 'bg-blue-100 text-blue-800'; + + // Default - Gris + return 'bg-gray-100 text-gray-800'; } export function createColumns(onSuccess?: () => void): ColumnDef[] { @@ -131,17 +156,20 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] { cell: ({ row }) => { const status = row.original.status; const colorClass = getStatusColor(status); + const formattedStatus = status + ? status.charAt(0).toUpperCase() + status.slice(1).toLowerCase() + : 'N/A'; - const statusSnippet = createRawSnippet<[{ status?: string | null; colorClass: string }]>((getStatus) => { + const statusSnippet = createRawSnippet<[{ status: string; colorClass: string }]>((getStatus) => { const { status, colorClass } = getStatus(); return { render: () => ` - ${status || 'N/A'} + ${status} ` }; }); - return renderSnippet(statusSnippet, { status, colorClass }); + return renderSnippet(statusSnippet, { status: formattedStatus, colorClass }); } }, { diff --git a/frontend/src/lib/components/dashboard/pedimentos/edit/dates-tab-form.svelte b/frontend/src/lib/components/dashboard/pedimentos/edit/dates-tab-form.svelte index fc1f9ca5..e8847fc9 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/edit/dates-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/edit/dates-tab-form.svelte @@ -27,8 +27,17 @@ if (!pedimentoId) { formData = { entry_date: '', - presentation_date: '', - payment_date: '' + pedimento_date: '', + payment_date: '', + rectification_payment_date: '', + extraction_date: '', + submission_date: '', + eucan_date: '', + original_date: '', + start_date: '', + end_date: '', + capture_date: '', + capture_time: '' }; exists = false; loading = false; @@ -44,15 +53,33 @@ exists = false; formData = { entry_date: '', - presentation_date: '', - payment_date: '' + pedimento_date: '', + payment_date: '', + rectification_payment_date: '', + extraction_date: '', + submission_date: '', + eucan_date: '', + original_date: '', + start_date: '', + end_date: '', + capture_date: '', + capture_time: '' }; } else if (response.data) { exists = true; formData = { entry_date: response.data.entry_date ? response.data.entry_date.substring(0, 10) : '', - presentation_date: response.data.presentation_date ? response.data.presentation_date.substring(0, 10) : '', - payment_date: response.data.payment_date ? response.data.payment_date.substring(0, 10) : '' + pedimento_date: response.data.pedimento_date ? response.data.pedimento_date.substring(0, 10) : '', + payment_date: response.data.payment_date ? response.data.payment_date.substring(0, 10) : '', + rectification_payment_date: response.data.rectification_payment_date ? response.data.rectification_payment_date.substring(0, 10) : '', + extraction_date: response.data.extraction_date ? response.data.extraction_date.substring(0, 10) : '', + submission_date: response.data.submission_date ? response.data.submission_date.substring(0, 10) : '', + eucan_date: response.data.eucan_date ? response.data.eucan_date.substring(0, 10) : '', + original_date: response.data.original_date ? response.data.original_date.substring(0, 10) : '', + start_date: response.data.start_date ? response.data.start_date.substring(0, 10) : '', + end_date: response.data.end_date ? response.data.end_date.substring(0, 10) : '', + capture_date: response.data.capture_date ? response.data.capture_date.substring(0, 10) : '', + capture_time: response.data.capture_time || '' }; } } catch (e) { @@ -60,8 +87,17 @@ exists = false; formData = { entry_date: '', - presentation_date: '', - payment_date: '' + pedimento_date: '', + payment_date: '', + rectification_payment_date: '', + extraction_date: '', + submission_date: '', + eucan_date: '', + original_date: '', + start_date: '', + end_date: '', + capture_date: '', + capture_time: '' }; } finally { loading = false; @@ -85,7 +121,7 @@ {:else}
-
+
@@ -98,11 +134,11 @@
- +
@@ -115,6 +151,96 @@ bind:value={formData.payment_date} />
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
{/if} diff --git a/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte b/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte index 4466f18d..02123c1b 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/edit/general-tab-form.svelte @@ -33,11 +33,21 @@ } const statusOptions = [ - { value: 'Activo', label: 'Activo' }, - { value: 'Pendiente', label: 'Pendiente' }, - { value: 'En Proceso', label: 'En Proceso' }, - { value: 'Completado', label: 'Completado' }, - { value: 'Cancelado', label: 'Cancelado' } + { value: 'MODIFICABLE', label: 'Modificable' }, + { value: 'ESPERA FIRMA PREVIO', label: 'Espera de firma previo' }, + { value: 'ESPERA VALIDACION', label: 'Espera validacion' }, + { value: 'VALIDADO', label: 'Validado' }, + { value: 'ESPERA BORRAR FIRMA PREVIO', label: 'Espera borrar firma previo' }, + { value: 'ESPERA BORRAR FIRMA VALIDACION', label: 'Espera borrar firma validacion ' }, + { value: 'ESPERA PAGO', label: 'Espera pago' }, + { value: 'CON FIRMA DE PREVIO', label: 'Con firma de previo' }, + { value: 'F DE PREVIO BORRADA', label: 'Forma de previo borrada' }, + { value: 'F VALIDACION BORRADA', label: 'Forma validacion borrada' }, + { value: 'PAGADO', label: 'Pagado' }, + { value: 'DESISTIO', label: 'Desistio' }, + { value: 'ESPERA CARTA CUPO', label: 'Espera carta cupo' }, + { value: 'CARTA CUPO', label: 'Carta cupo' }, + { value: 'ESPERA CANCELAR CARTA CUPO', label: 'Espera cancelar carta cupo' } ]; @@ -160,7 +170,7 @@
diff --git a/frontend/src/lib/components/dashboard/pedimentos/edit/payments-tab-form.svelte b/frontend/src/lib/components/dashboard/pedimentos/edit/payments-tab-form.svelte index b137c64e..430726a4 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/edit/payments-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/edit/payments-tab-form.svelte @@ -26,8 +26,18 @@ // Si no hay pedimentoId (modo creación), inicializar vacío if (!pedimentoId) { formData = { - payment_form: '', - bank_identifier: '' + acknowledgment: '', + operation_number: '', + bank_code: null, + cashier: '', + date: '', + time: '', + shift: '', + total_cash_paid: null, + total_contributions: null, + counter_payment: null, + pece_code: '', + payment_id: null }; exists = false; loading = false; @@ -42,22 +52,52 @@ // No existe o hay error - inicializar vacío exists = false; formData = { - payment_form: '', - bank_identifier: '' + acknowledgment: '', + operation_number: '', + bank_code: null, + cashier: '', + date: '', + time: '', + shift: '', + total_cash_paid: null, + total_contributions: null, + counter_payment: null, + pece_code: '', + payment_id: null }; } else if (response.data) { exists = true; formData = { - payment_form: response.data.payment_form || '', - bank_identifier: response.data.bank_identifier || '' + acknowledgment: response.data.acknowledgment || '', + operation_number: response.data.operation_number || '', + bank_code: response.data.bank_code || null, + cashier: response.data.cashier || '', + date: response.data.date || '', + time: response.data.time || '', + shift: response.data.shift || '', + total_cash_paid: response.data.total_cash_paid || null, + total_contributions: response.data.total_contributions || null, + counter_payment: response.data.counter_payment || null, + pece_code: response.data.pece_code || '', + payment_id: response.data.payment_id || null }; } } catch (e) { console.error('Error loading payments:', e); exists = false; formData = { - payment_form: '', - bank_identifier: '' + acknowledgment: '', + operation_number: '', + bank_code: null, + cashier: '', + date: '', + time: '', + shift: '', + total_cash_paid: null, + total_contributions: null, + counter_payment: null, + pece_code: '', + payment_id: null }; } finally { loading = false; @@ -80,24 +120,134 @@ {:else}
-
- +
+
- +
- +
- + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
diff --git a/frontend/src/lib/components/dashboard/pedimentos/edit/transport-tab-form.svelte b/frontend/src/lib/components/dashboard/pedimentos/edit/transport-tab-form.svelte index 896cac37..3c42a633 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/edit/transport-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/edit/transport-tab-form.svelte @@ -26,10 +26,10 @@ // Si no hay pedimentoId (modo creación), inicializar vacío if (!pedimentoId) { formData = { - arrival_key: '', - arrival_data: '', - departure_key: '', - departure_data: '' + destination: null, + entry_exit: '', + arrival: '', + departure: '' }; exists = false; loading = false; @@ -44,28 +44,28 @@ // No existe o hay error - inicializar vacío exists = false; formData = { - arrival_key: '', - arrival_data: '', - departure_key: '', - departure_data: '' + destination: null, + entry_exit: '', + arrival: '', + departure: '' }; } else if (response.data) { exists = true; formData = { - arrival_key: response.data.arrival_key || '', - arrival_data: response.data.arrival_data || '', - departure_key: response.data.departure_key || '', - departure_data: response.data.departure_data || '' + destination: response.data.destination || null, + entry_exit: response.data.entry_exit || '', + arrival: response.data.arrival || '', + departure: response.data.departure || '' }; } } catch (e) { console.error('Error loading transport:', e); exists = false; formData = { - arrival_key: '', - arrival_data: '', - departure_key: '', - departure_data: '' + destination: null, + entry_exit: '', + arrival: '', + departure: '' }; } finally { loading = false; @@ -91,43 +91,47 @@ {:else}
- +
- +
- +
- +
- +
- +
- +
- +
diff --git a/frontend/src/lib/components/dashboard/pedimentos/edit/validation-tab-form.svelte b/frontend/src/lib/components/dashboard/pedimentos/edit/validation-tab-form.svelte index eabfc447..baabf978 100644 --- a/frontend/src/lib/components/dashboard/pedimentos/edit/validation-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/pedimentos/edit/validation-tab-form.svelte @@ -1,6 +1,7 @@