From 1b856a2713418fe14369573925db2e00fff31596 Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Fri, 19 Dec 2025 09:18:30 -0600 Subject: [PATCH 1/7] feat: Add models for line items and their series, including detailed attributes for item tracking and classification --- .../v1/modules/a24/fa/fa_item_lines/models.py | 34 + backend/api/v1/modules/a76/items/models.py | 620 ++++++++++++++++++ .../api/v1/modules/a76/items/series/models.py | 23 + backend/api/v1/modules/a76/parts/models.py | 4 +- backend/main.py | 3 + docker-compose.yml | 6 +- 6 files changed, 683 insertions(+), 7 deletions(-) create mode 100644 backend/api/v1/modules/a24/fa/fa_item_lines/models.py create mode 100644 backend/api/v1/modules/a76/items/models.py create mode 100644 backend/api/v1/modules/a76/items/series/models.py diff --git a/backend/api/v1/modules/a24/fa/fa_item_lines/models.py b/backend/api/v1/modules/a24/fa/fa_item_lines/models.py new file mode 100644 index 00000000..5aa2d038 --- /dev/null +++ b/backend/api/v1/modules/a24/fa/fa_item_lines/models.py @@ -0,0 +1,34 @@ +from typing import Optional +from sqlalchemy import Boolean, ForeignKey, Integer, String +from sqlalchemy.orm import Mapped, mapped_column +from core.database import Base + +class LineItem(Base): + __tablename__ = "line_items" + __table_args__ = ( + {"schema": "a24"} + ) + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_id: Mapped[int] = mapped_column(ForeignKey("a76.items.id")) + + # Asset information (SCAF specific) + asset_number: Mapped[Optional[str]] = mapped_column(String(25)) # ASSETNUMBER + asset_photo: Mapped[Optional[str]] = mapped_column(String(255)) # FOTOACTIVOFIJO + equipment_message: Mapped[Optional[str]] = mapped_column(String(40)) # EQI_MENSAJE + invoice_type_asset: Mapped[Optional[str]] = mapped_column(String(6)) # TIPOFACTURAASSET + return_import_invoice: Mapped[Optional[str]] = mapped_column(String(15)) # FACTURAIMPORET + return_import_date: Mapped[Optional[int]] = mapped_column(Integer) # FECHAFACIMPORET + movement_type_import: Mapped[Optional[str]] = mapped_column(String(3)) # TIPOMOVIMPO + + # Cross-references IN CASE OF IMPORT REPAIR + search_invoice: Mapped[Optional[str]] = mapped_column(String(15)) # FACTURAEXPO (when line is import) / FACTURAIMPO (when line is export) + search_line: Mapped[Optional[int]] = mapped_column(Integer) # LINEAEXPO (when line is import) / LINEAIMPO (when line is export) + + # Search type + search_type: Mapped[Optional[str]] = mapped_column(String(10)) # TIPOBUSQUEDA + + # Special flags + download: Mapped[Optional[bool]] = mapped_column(Boolean) # DESCARGA + own_equipment: Mapped[Optional[bool]] = mapped_column(Boolean) # EQUIPOPROPIO + omit_annex31: Mapped[Optional[bool]] = mapped_column(Boolean) # OMITITENANEXO31 \ No newline at end of file diff --git a/backend/api/v1/modules/a76/items/models.py b/backend/api/v1/modules/a76/items/models.py new file mode 100644 index 00000000..1439f6a0 --- /dev/null +++ b/backend/api/v1/modules/a76/items/models.py @@ -0,0 +1,620 @@ +""" +Normalized Database Schema for SCAF (Fixed Assets) and SCAII (Parts Inventory) +SQLAlchemy v2 - Annex 24 Compliance +""" + +from datetime import datetime +from decimal import Decimal +from typing import Optional, TYPE_CHECKING +from enum import Enum +from sqlalchemy import Boolean, String, Integer, Numeric, Text, SmallInteger, ForeignKey +from sqlalchemy.orm import Mapped, mapped_column, relationship +from core.database import Base + +if TYPE_CHECKING: + from .series.models import Serie + +# ============================================================================ +# CORE ENTITIES +# ============================================================================ + +class Item(Base): + """ + Unified item header table for all import/export operations + Consolidates headers from both SCAF and SCAII systems + """ + __tablename__ = "items" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + invoice_id: Mapped[int] = mapped_column(ForeignKey("a76.invoice_header.id")) # CONSECUTIVO + item_type: Mapped[str] = mapped_column(String(20)) # Type: IMPORT_TEMP, IMPORT_DEF, EXPORT, REPAIR, etc. + system_origin: Mapped[str] = mapped_column(String(10)) # SCAF or SCAII + + # Item references + invoice_number: Mapped[Optional[str]] = mapped_column(String(15)) # FACTURAIMPO/FACTURAEXPO + reference_number: Mapped[Optional[str]] = mapped_column(String(20)) # NUMREFERENCIA + order: Mapped[Optional[str]] = mapped_column(String(50)) # ORDENCOMPRA / ORDENVENTA + guide_number: Mapped[Optional[str]] = mapped_column(String(50)) # NUMEROGUIA/NUMERODEGUIA + + # Dates + invoice_date: Mapped[Optional[int]] = mapped_column(Integer) # FECHAFACTURA + depreciation_date: Mapped[Optional[int]] = mapped_column(Integer) # FECHADEPRECIACION + + # Administrative fields + rectification: Mapped[Optional[int]] = mapped_column(SmallInteger) # RECTIFICACION + warehouse: Mapped[Optional[str]] = mapped_column(String(30)) # BODEGA + location: Mapped[Optional[str]] = mapped_column(String(200)) # LOCALIZACION + + # Relationships + lines: Mapped[list["LineItem"]] = relationship(back_populates="item", cascade="all, delete-orphan") + + +class LineItem(Base): + """ + Unified line items for all items + Consolidates all line-level data from Q and S tables + """ + __tablename__ = "item_lines" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_id: Mapped[int] = mapped_column(ForeignKey("a76.items.id")) + line_number: Mapped[int] = mapped_column(Integer) # LINEAIMPO/LINEAEXPO/LINEA + + # Part identification + part_number: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.parts.id")) # NUMPARTE + component_part_number: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.parts.id")) # NUMPARTECOM + class_code: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.classes.id")) # CLASE + + # Unit of measure + unit_of_measure: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.units_of_measure_general.id")) # UNIDADMEDIDA/UNIMED + alternate_unit: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.units_of_measure_general.id")) # UNIMEDALTERNA + uma_key: Mapped[Optional[str]] = mapped_column(String(2)) # CLAVEUMA + auxiliary_unit: Mapped[Optional[str]] = mapped_column(String(5)) # UNIMEDAUXILIAR + + # Permits and certificates + permit_number: Mapped[Optional[str]] = mapped_column(String(20)) # NUMPERMISO + page_line: Mapped[Optional[str]] = mapped_column(String(10)) # PAGRENGLON + has_certificate: Mapped[Optional[bool]] = mapped_column(Boolean) # TIENECO/CERTORIGEN + certificate_number: Mapped[Optional[str]] = mapped_column(String(10)) # NOCERTIFICADO + octave_permit: Mapped[Optional[str]] = mapped_column(String(20)) # PERMISOROCTAVA + permits_ped: Mapped[Optional[str]] = mapped_column(String(500)) # PERMISOSPED + + # FDA + has_fda_code: Mapped[Optional[bool]] = mapped_column(Boolean) # LLEVACODFDA + fda_key: Mapped[Optional[str]] = mapped_column(String(10)) # CLAVEFDA + + # Subitem flags + is_subitem: Mapped[Optional[bool]] = mapped_column(Boolean) # ESSUBPARTIDA + contains_subitems: Mapped[Optional[bool]] = mapped_column(Boolean) # CONTIENESUBP + includes_subitems: Mapped[Optional[bool]] = mapped_column(Boolean) # INCUYESUBPARTIDAS + subitem_number: Mapped[Optional[bool]] = mapped_column(Boolean) # SUBPARTIDA + + # Special flags + is_military_mcia: Mapped[Optional[bool]] = mapped_column(Boolean) # ESMCIAMILITAR + + # IV32 (Tax identification) + iv32_type_key: Mapped[Optional[str]] = mapped_column(String(5)) # CLAVETIPOIV32 + iv32_number: Mapped[Optional[str]] = mapped_column(String(35)) # NUMEROIV32 + + + + # IN CASE OF EXPO + scrap_invoice: Mapped[Optional[str]] = mapped_column(String(15)) # FACTURASCRAP + consecutive_destination: Mapped[Optional[int]] = mapped_column(Integer) # CONSECUTIVODES + ctm_section: Mapped[Optional[str]] = mapped_column(String(3)) # APARTADOCTM + + # Tax payment + tax_payment: Mapped[Optional[bool]] = mapped_column(Boolean) # PAGOIMPUESTO + payment_method: Mapped[Optional[str]] = mapped_column(String(9)) # FORMAPAGO/FORMAPAGOTIGI + igi_amount: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # MONTOIGI + igi_payment_method: Mapped[Optional[str]] = mapped_column(String(9)) # FORMAPAGOTIGI + + # FCC + fcc_key: Mapped[Optional[str]] = mapped_column(String(30)) # CLAVEFCC + + # Valuation method + valuation_method: Mapped[Optional[str]] = mapped_column(String(2)) # METVALOR + valuation_determined_value: Mapped[Optional[Decimal]] = mapped_column(Numeric(29, 8)) # METVALORVALORDETERMINADO/METVALORACIONVALORDETERMINADO + valuation_reason: Mapped[Optional[str]] = mapped_column(String(500)) # METVALORMOTIVODEUSO/METVALORACIONMOTIVODEUSO + + # Container rules + container_rule: Mapped[Optional[str]] = mapped_column(String(50)) # CONTENEDORREGLA + container_parts_ii: Mapped[Optional[str]] = mapped_column(String(50)) # CONTENEDORPARTESII + + # APHIS + consecutive_aphis: Mapped[Optional[int]] = mapped_column(Integer) # CONSECUTIVOAPHIS + + # BOM/Commercial + bom_version: Mapped[Optional[int]] = mapped_column(Integer) # VERSIONBOM + bill_version: Mapped[Optional[int]] = mapped_column(Integer) # VERSIONBILL + + # TLCAN value + tlcan_value: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORTLCAN + + # Identifier + identifier: Mapped[Optional[str]] = mapped_column(String(2)) # IDENTIFICADOR + + # Validation fields + validation_zero: Mapped[Optional[int]] = mapped_column(Integer) # VALIDACIONZERO + validation_one: Mapped[Optional[int]] = mapped_column(Integer) # VALIDACIONUNO + + # Material type + material_type: Mapped[Optional[str]] = mapped_column(String(50)) # TIPOMAT/TIPODENUMPARTE + + # Order concept + order_type: Mapped[Optional[str]] = mapped_column(String(50)) # TIPODEORDEN + line_concept: Mapped[Optional[str]] = mapped_column(String(50)) # CONCEPTODELAPARTIDA + + # Review dispatch + review_dispatch: Mapped[Optional[str]] = mapped_column(String(10)) # REVISARDESP + + # Take component from PT + take_component_pt: Mapped[Optional[int]] = mapped_column(Integer) # TOMARCOMOPT + + # Pallet + pallet2: Mapped[Optional[int]] = mapped_column(SmallInteger) # PALLET2 + + # Wildcard field + wildcard_field: Mapped[Optional[str]] = mapped_column(String(100)) # CAMPOCOMODIN + + # Relationships + item: Mapped["Item"] = relationship(back_populates="lines") + +class LineFinancial(Base): + """ + Financial details for line items + Consolidates all line-level data from Q and S tables + """ + __tablename__ = "line_financials" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) + + # Costs - Capture + unit_cost_capture: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUNITARIOCAPTURA + + # Costs - USD + unit_cost_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUNITARIODLLS/COSTOUNITARIOME + unit_cost_commercial_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUCOMDLLS + unit_cost_current_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOACTUALDLLS + unit_cost_depreciated_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTODEPRECME + unit_cost_subitem_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUNITARIOSUBPDLLS + unit_cost_auxiliary_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUAUXILIARME + sales_cost_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOVENTAME + commercial_unit_cost: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUNICOMERCIAL + + # Costs - MXN + unit_cost_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUNITARIOPESOS/COSTOUNITARIOMN + unit_cost_commercial_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUCOMPESOS + unit_cost_current_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOACTUALMN + unit_cost_depreciated_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTODEPRECMN + unit_cost_subitem_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOUNITARIOSUBPPESOS + sales_cost_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # COSTOVENTAMN + + # Costs - MC (Custom Currency) + unit_cost_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(29, 8)) # COSTOUNITARIOMC + + # Values - MXN + value_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORMN/VALORIMPOMN/VALOREXPOMN + value_commercial_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALOREXPOCOMMN + value_updated_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORACTUALIZADOMN + value_subitem_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORSUBPMN + sub_import_value_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # SUBVALORIMPOMN + value_returned_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORRETORNADOMN + value_depreciated_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORDEPRECIADOMN + customs_value_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORADUANASMN + value_total_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORTOTALMN + value_temp_material_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORMPTEMPMN + value_def_material_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORMPDEFMN + value_added_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORAGREMN + value_national_packing_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALEMPAQUENACMN + vat_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # IVAIMPOMN/IVAEXPOMN/VALORIVAMN + vat_used_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORIVAMNUSADO + advalorem_line_mxn: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # ADVALORMNLINEAPED + + # Values - USD + value_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(29, 8)) # VALORME/VALORIMPOME/VALOREXPOME + value_commercial_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALOREXPOCOMME + value_updated_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORACTUALIZADOME + value_subitem_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORSUBPME + sub_import_value_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # SUBVALORIMPOME + value_returned_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORRETORNADOME + value_depreciated_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORDEPRECIADOME + customs_value_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORADUANASME + value_auxiliary_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORIMPOAUXILIARME / VALOREXPORAUXILIARME + value_total_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORTOTALME + value_temp_material_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORMPTEMPME + value_def_material_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORMPDEFME + value_added_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORAGREME + value_national_packing_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALEMPAQUENACME + value_us_packing_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALEMPAQUEUSME + vat_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # IVAIMPOME/IVAEXPOME/VALORIVAME + vat_used_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORIVAMEUSADO + value_non_originating_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORNOORIGINARIOME + value_originating_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORORIGINARIOME + igi_amount_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # MONTOIGIME + exempt_amount_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # MONTOEXCENTOME + total_commercial_value: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORTOTALCOMERCIAL + advalorem_line_usd: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # ADVALORMELINEAPED + + # Values - MC + value_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(29, 8)) # VALORIMPOMC/VALOREXPOMC + sub_import_value_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # SUBVALORIMPOMC + vat_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # IVAIMPOMC/IVAEXPOMC + value_added_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORAGREMC + value_national_packing_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALEMPAQUENACMC + value_total_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORTOTALMC + value_temp_material_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORMPTEMPMC + value_def_material_mc: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) # VALORMPDEFMC + + # Relationship + item_line: Mapped["LineItem"] = relationship() + +class LineQuantity(Base): + """ + Quantity details for line items + Consolidates all line-level data from Q and S tables + """ + __tablename__ = "line_quantities" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) + + # Quantities + quantity: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTIMPO / CANTEXPO / CANTIMPODEF + alternate_quantity: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTALTERNA + quantity_uma: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTIMPOUMA / CANTEXPOUMA + auxiliary_quantity: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTIMPOAUXILIAR / CANTEXPOAUXILIAR + + # Quantities - Special (SCAF specific) + quantity_temp_export: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTEXPOTEMP + quantity_existence: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTEXISTENCIA + quantity_returned: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTRETORNADA + quantity_returned_temp: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # CANTRETORNADATEMP + serial_count: Mapped[Optional[int]] = mapped_column(Integer) # CANT_SERIES/CANT_SERIESDEF + + # Weight + weight_unit: Mapped[Optional[str]] = mapped_column(String(3)) # 'KG' o 'LB' + net_weight: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # PESONETO + gross_weight: Mapped[Optional[Decimal]] = mapped_column(Numeric(19, 8)) # PESOBRUTO + + # Packaging + package_key: Mapped[Optional[str]] = mapped_column(String(5)) # CLAVEBULTOS + package_quantity: Mapped[Optional[int]] = mapped_column(Integer) # CANTBULTOS + package_description: Mapped[Optional[str]] = mapped_column(String(40)) # DESCBULTOS + container_quantity: Mapped[Optional[int]] = mapped_column(SmallInteger) # CANTBULCONT + container_description: Mapped[Optional[str]] = mapped_column(String(40)) # DESCCONTENEDOR + box_count: Mapped[Optional[str]] = mapped_column(String(30)) # NOCAJAS + + # Relationship + item_line: Mapped["LineItem"] = relationship() + +class LineCustoms(Base): + """ + Customs details for line items + Consolidates all line-level data from Q and S tables + """ + __tablename__ = "line_customs" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) + + # Tariff/Customs Classifications + fraction: Mapped[Optional[str]] = mapped_column(String(10)) # FRACCION / FRACCIONIMPO / FRACCIONEXPO + fraction_type: Mapped[Optional[str]] = mapped_column(String(7)) # TIPOFRACCION / TIPOFRACCIONIMPO / TIPOFRACCIONEXPO + american_fraction: Mapped[Optional[str]] = mapped_column(String(16)) # FRACCIONAMERICANA + alternate_fraction: Mapped[Optional[str]] = mapped_column(String(10)) # FRACCIONALTERNA + reference_fraction: Mapped[Optional[str]] = mapped_column(String(10)) # FRACCIONREFERENCIA + octave_fraction: Mapped[Optional[str]] = mapped_column(String(10)) # FRACCIONROCTAVA + tlcan_fraction: Mapped[Optional[str]] = mapped_column(String(13)) # FRACCIONTLCAN + extra_american_fraction: Mapped[Optional[str]] = mapped_column(String(16)) # FRACAMESELEXTRA + garment_fraction: Mapped[Optional[str]] = mapped_column(String(19)) # FRACCIONDELAPRENDA/FRACCIONDELAPARTIDA + + # Ad Valorem + advalorem: Mapped[Optional[str]] = mapped_column(String(10)) # ADVIMPO / ADVEXPO + advalorem_numeric: Mapped[Optional[Decimal]] = mapped_column(Numeric(7, 2)) # ADVIMPONUM / ADVEXPONUM + advalorem_american: Mapped[Optional[Decimal]] = mapped_column(Numeric(5, 2)) # ADVAME + advalorem_tlcan: Mapped[Optional[Decimal]] = mapped_column(Numeric(5, 2)) # ADVTLCAN + + # Rates + rate: Mapped[Optional[str]] = mapped_column(String(10)) # TASAIM / TASAEX + depreciation_rate: Mapped[Optional[Decimal]] = mapped_column(Numeric(5, 2)) # TASADEPRECIA + + # Origin/Destination + origin_country: Mapped[Optional[str]] = mapped_column(String(3)) # PAISORIGEN + destination_country: Mapped[Optional[str]] = mapped_column(String(3)) # PAISDESTINO + optional_country: Mapped[Optional[str]] = mapped_column(String(3)) # PAISOPCIONAL + origin_procedure: Mapped[Optional[str]] = mapped_column(String(3)) # PROCEDENCIA + scrap_procedure: Mapped[Optional[str]] = mapped_column(String(3)) # PROCSCRAP + + # Sector + sector: Mapped[Optional[str]] = mapped_column(String(8)) # SECTOR + + # Relationship + item_line: Mapped["LineItem"] = relationship() + +class LineDescription(Base): + """ + Description details for line items + Consolidates all line-level data from Q and S tables + """ + __tablename__ = "line_descriptions" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) + + # Descriptions + description_spanish: Mapped[Optional[str]] = mapped_column(String(4999)) # DESCRIPCIONE + description_english: Mapped[Optional[str]] = mapped_column(String(4999)) # DESCRIPCIONI + extra_description: Mapped[Optional[str]] = mapped_column(Text) # DESCRIPCIONEEXTRA + part_description: Mapped[Optional[str]] = mapped_column(String(500)) # DESCRIPCIONPARTE + class_description: Mapped[Optional[str]] = mapped_column(String(500)) # DESCRIPCIONCLASE + + # Product attributes + brand: Mapped[Optional[str]] = mapped_column(String(50)) # MARCA + model: Mapped[Optional[str]] = mapped_column(String(50)) # MODELO + has_serial: Mapped[Optional[bool]] = mapped_column(Boolean) # LLEVASERIE + + # Additional information + additional_info_spanish: Mapped[Optional[str]] = mapped_column(String(1000)) # INFOADICIONESP + additional_info_english: Mapped[Optional[str]] = mapped_column(String(1000)) # INFOADICIONING + + # Lot and entry tracking + lot: Mapped[Optional[str]] = mapped_column(String(254)) # LOTE + entry_number: Mapped[Optional[str]] = mapped_column(String(50)) # NUMENTRADA/NUMERODEENTRADA + + # Relationship + item_line: Mapped["LineItem"] = relationship() + +class LineReference(Base): + """ + Reference details for line items + Consolidates all line-level data from Q and S tables + """ + __tablename__ = "line_references" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_line_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) + + serie_id: Mapped[Optional[int]] = mapped_column(ForeignKey("a76.item_line_series.id")) # SERIEPARTIDA + + # Customer/Vendor + customer_invoice: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # CLIENTEFACTURAR + assigned_client: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # CLIENTEASIGNADO + supplier: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # PROVEEDOR + requisitioner: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # REQUISITOR + sent_to: Mapped[Optional[str]] = mapped_column(ForeignKey("a76.clients_and_providers.id")) # ENVIADOA + + # PED line reference + ped_line: Mapped[Optional[int]] = mapped_column(Integer) # LINEAPED + ro_line: Mapped[Optional[int]] = mapped_column(Integer) # LINEARO + + # Relationship + item_line: Mapped["LineItem"] = relationship() + +# ============================================================================ +# SUPPORTING TABLES +# ============================================================================ + +class PackingList(Base): + """ + Packing list items + From: SPartidasPackingList + """ + __tablename__ = "packing_lists" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + item_line_id: Mapped[int] = mapped_column(Integer) # LINEA + packing_list_number: Mapped[Optional[str]] = mapped_column(String(100)) # NUMPACKINGLIST + + +class RepairPart(Base): + """ + Repair parts (orphan table without primary key in original) + From: SPartidasRep + """ + __tablename__ = "repair_parts" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + import_line: Mapped[int] = mapped_column(Integer) # LINEAIMPO + + +class CTMShipment(Base): + """ + CTM Shipment lines (temporary manufacturing) + From: SPartidasEnviaCTM + """ + __tablename__ = "ctm_shipments" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + shipment_line: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) # LINEAENVIO + brand: Mapped[Optional[str]] = mapped_column(String(50)) # MARCA + model: Mapped[Optional[str]] = mapped_column(String(50)) # MODELO + serial_numbers: Mapped[Optional[str]] = mapped_column(String(50)) # SERIES + + +class CTMReceipt(Base): + """ + CTM Receipt lines (temporary manufacturing) + From: SPartidasReciboCTM + """ + __tablename__ = "ctm_receipts" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + receipt_line: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) # LINEARECIBO + + option: Mapped[Optional[str]] = mapped_column(String(3)) # OPCION + exit_invoice: Mapped[Optional[str]] = mapped_column(String(19)) # FACTURASALIDA + + +class SubassemblyEntry(Base): + """ + Subassembly/Submanufacturing Entry lines + From: SPartidasEntradaSM + """ + __tablename__ = "subassembly_entries" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + remission_line: Mapped[int] = mapped_column(Integer) # LINEAREMISION + exit_invoice: Mapped[Optional[str]] = mapped_column(String(15)) # FACTURASALIDA + exit_line: Mapped[Optional[int]] = mapped_column(Integer) # LINEASALIDA + + +class SubassemblyExit(Base): + """ + Subassembly/Submanufacturing Exit lines + From: SPartidasSalidaSM + """ + __tablename__ = "subassembly_exits" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + exit_line: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) # LINEASALIDA + + +class ImpositionPart(Base): + """ + Imposition parts (orphan table without primary key constraint) + From: SPartidasImposion + """ + __tablename__ = "imposition_parts" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + import_line: Mapped[int] = mapped_column(Integer) # LINEAIMPO + + + +# ============================================================================ +# INDEXES AND CONSTRAINTS +# ============================================================================ + +""" +Recommended indexes for optimal query performance: + +CREATE INDEX idx_items_consecutive ON items(consecutive); +CREATE INDEX idx_items_invoice ON items(invoice_number); +CREATE INDEX idx_items_type_system ON items(item_type, system_origin); +CREATE INDEX idx_items_dates ON items(invoice_date, depreciation_date); + +CREATE INDEX idx_lines_item ON item_lines(item_id); +CREATE INDEX idx_lines_part ON item_lines(part_number); +CREATE INDEX idx_lines_class ON item_lines(class_code); +CREATE INDEX idx_lines_invoice_refs ON item_lines(import_invoice, export_invoice); +CREATE INDEX idx_lines_fractions ON item_lines(import_fraction, export_fraction); + +CREATE INDEX idx_packing_consecutive ON packing_lists(consecutive); +CREATE INDEX idx_packing_part ON packing_lists(part_number); + +CREATE INDEX idx_repair_invoice ON repair_parts(import_invoice, import_line); +CREATE INDEX idx_ctm_ship_consec ON ctm_shipments(consecutive); +CREATE INDEX idx_ctm_rcpt_consec ON ctm_receipts(consecutive); +CREATE INDEX idx_sub_entry_consec ON subassembly_entries(consecutive); +CREATE INDEX idx_sub_exit_consec ON subassembly_exits(consecutive); +CREATE INDEX idx_imposition_consec ON imposition_parts(consecutive); +""" + + +# ============================================================================ +# MIGRATION NOTES +# ============================================================================ + +""" +MIGRATION STRATEGY FROM ORIGINAL TABLES TO NORMALIZED SCHEMA: + +1. DOCUMENT MAPPING: + - QEqeMaq (Equipment Import Temp) → items (type='EQUIPMENT_IMPORT_TEMP', system='SCAF') + - QEqeMaqRep (Equipment Repair Export) → items (type='EQUIPMENT_REPAIR_EXPORT', system='SCAF') + - QEqiDef (Equipment Import Definitive) → items (type='EQUIPMENT_IMPORT_DEF', system='SCAF') + - QEqiMaq (Equipment Machinery) → items (type='EQUIPMENT_MACHINERY', system='SCAF') + - QEqiMaqRep (Equipment Machinery Repair) → items (type='EQUIPMENT_REPAIR_IMPORT', system='SCAF') + - SPartidasCM (Common Commerce) → items (type='COMMON_COMMERCE', system='SCAII') + - SPartidasExpo (Export) → items (type='EXPORT', system='SCAII') + - SPartidasImpo (Import) → items (type='IMPORT', system='SCAII') + +2. LINE MAPPING: + All line items from Q* and SPartidas* tables map to item_lines with appropriate + field mapping based on the original column names (preserved as comments). + +3. FIELD CONSOLIDATION RULES: + - Costs: Unified under unit_cost_* with currency suffix (usd/mxn/mc) + - Values: Unified under value_* with currency suffix + - Quantities: Unified under quantity_* with specific purpose suffixes + - Descriptions: Consolidated into description_spanish/english/extra + - Fractions: All fraction fields preserved with clear naming + +4. DATA INTEGRITY: + - Original CONSECUTIVO + LINE number preserved for traceability + - Foreign key relationships established via item_id + - All original fields retained to prevent data loss + +5. SPECIAL TABLES: + - PackingList, RepairPart, CTM*, Subassembly*, ImpositionPart remain separate + as they serve specific purposes and don't fit the main item/line pattern + +6. BENEFITS: + - Eliminates redundancy across 13 original tables + - Unified query interface for all operations + - Maintains full audit trail with original field names + - Enables cross-system reporting (SCAF + SCAII) + - Simplifies maintenance with single schema + +7. QUERYING EXAMPLES: + ```python + # Get all imports (both systems) + session.query(Item).filter( + Item.item_type.in_(['IMPORT', 'EQUIPMENT_IMPORT_TEMP', 'EQUIPMENT_IMPORT_DEF']) + ) + + # Get all lines for a specific part across all items + session.query(LineItem).filter( + LineItem.part_number == 'ABC123' + ) + + # Get SCAF equipment with depreciation + session.query(Item).join(LineItem).filter( + Item.system_origin == 'SCAF', + LineItem.value_depreciated_usd.isnot(None) + ) + ``` +""" \ No newline at end of file diff --git a/backend/api/v1/modules/a76/items/series/models.py b/backend/api/v1/modules/a76/items/series/models.py new file mode 100644 index 00000000..a944b080 --- /dev/null +++ b/backend/api/v1/modules/a76/items/series/models.py @@ -0,0 +1,23 @@ +from typing import Optional +from sqlalchemy import Boolean, DateTime, ForeignKey, Integer, Numeric, String +from sqlalchemy.orm import Mapped, mapped_column +from core.database import Base + +class Serie(Base): + __tablename__ = "item_line_series" + __table_args__ = { + "schema": "a76", + } + + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + line_item_id: Mapped[int] = mapped_column(ForeignKey("a76.item_lines.id")) # LINEAIMPO / LINEAEXPO + row: Mapped[int] = mapped_column(Integer) # RENGLON + serial_numbers: Mapped[Optional[str]] = mapped_column(String(50)) # SERIEEXPO + model: Mapped[Optional[str]] = mapped_column(String(50)) # MODELOEXPO + sub_model: Mapped[Optional[str]] = mapped_column(String(50)) # SUBMODELOEXPO + brand: Mapped[Optional[str]] = mapped_column(String(50)) # MARCA + expo_brad: Mapped[Optional[str]] = mapped_column(String(50)) # MARCAEXPO + number_id: Mapped[Optional[str]] = mapped_column(String(25)) # NUMIDEXPO + + + \ No newline at end of file diff --git a/backend/api/v1/modules/a76/parts/models.py b/backend/api/v1/modules/a76/parts/models.py index a536d897..12750dca 100644 --- a/backend/api/v1/modules/a76/parts/models.py +++ b/backend/api/v1/modules/a76/parts/models.py @@ -9,12 +9,10 @@ from typing import TYPE_CHECKING, Optional from api.v1.common.base_models import TenantScopedMixin, TimestampMixin from core.database import Base from sqlalchemy import ( - ForeignKey, ForeignKeyConstraint, Integer, Numeric, PrimaryKeyConstraint, - SmallInteger, String, UniqueConstraint, Boolean, @@ -57,7 +55,7 @@ class Part(Base, TenantScopedMixin, TimestampMixin): # Unique constraint compuesta client_id: Mapped[int] = mapped_column(Integer) - part_number: Mapped[str] = mapped_column(String(49)) + part_number: Mapped[str] = mapped_column(String(50)) # Basic information fraction: Mapped[Optional[str]] = mapped_column(String(10)) diff --git a/backend/main.py b/backend/main.py index 197a111b..0959a83d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -16,6 +16,9 @@ from core.middleware import ( from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware +from api.v1.modules.a76.items.models import Item # Importar rutas para registrar con el router +from api.v1.modules.a76.items.series.models import Serie # Importar modelos para registrar con SQLAlchemy + # Configurar logging logging.basicConfig( level=logging.INFO if not settings.DEBUG else logging.DEBUG, diff --git a/docker-compose.yml b/docker-compose.yml index 6d4d1ffb..18215907 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,13 @@ services: # PostgreSQL - Base de datos core (app) postgres-a76: - image: postgres:16-alpine + image: postgres:18-alpine container_name: anexo76-postgres-a76 environment: POSTGRES_DB: anexo76_core POSTGRES_USER: postgres POSTGRES_PASSWORD: ${POSTGRES_APP_PASSWORD:-postgres} POSTGRES_INITDB_ARGS: "--encoding=UTF8" - PGDATA: /var/lib/postgresql/data/pgdata ports: - "5432:5432" volumes: @@ -38,14 +37,13 @@ services: # PostgreSQL - Base de datos Keycloak postgres-keycloak: - image: postgres:16-alpine + image: postgres:18-alpine container_name: anexo76-postgres-keycloak environment: POSTGRES_DB: keycloak POSTGRES_USER: postgres POSTGRES_PASSWORD: ${POSTGRES_KEYCLOAK_PASSWORD:-postgres} POSTGRES_INITDB_ARGS: "--encoding=UTF8" - PGDATA: /var/lib/postgresql/data/pgdata ports: - "5433:5432" volumes: From e937f48de44d73d4f9507bd232e81e882282edb6 Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Fri, 19 Dec 2025 10:52:09 -0600 Subject: [PATCH 2/7] feat: add logistics tab form for invoice editing feat: implement server-side loading for invoices page with authentication and filters feat: create invoices page with filtering, infinite scroll, and data table feat: add server-side loading for invoice edit page with data fetching feat: implement invoice edit page with tabbed interface and form handling --- .gitignore | 1 + estructura.txt | 1190 ----------------- .../components/dashboard/invoices/columns.ts | 295 +++- .../invoices/data-table-actions.svelte | 46 +- .../dashboard/invoices/data-table.svelte | 16 +- .../dashboard/invoices/delete-dialog.svelte | 39 +- .../dashboard/invoices/details-dialog.svelte | 16 +- .../invoices/edit/compliance-tab-form.svelte | 60 + .../invoices/edit/financials-tab-form.svelte | 53 + .../invoices/edit/general-tab-form.svelte | 224 ++++ .../invoices/edit/logistics-tab-form.svelte | 73 + .../src/lib/components/sidebar/modules.ts | 18 +- .../reparacion => }/+page.server.ts | 75 +- .../routes/dashboard/invoices/+page.svelte | 469 +++++++ .../invoices/edit/[id]/+page.server.ts | 143 ++ .../dashboard/invoices/edit/[id]/+page.svelte | 399 ++++++ .../exportacion/exportacion/+page.server.ts | 113 -- .../exportacion/exportacion/+page.svelte | 382 ------ .../exportacion/exportacion/new/+page.svelte | 401 ------ .../exportacion/reparacion/+page.svelte | 381 ------ .../exportacion/reparacion/new/+page.svelte | 325 ----- .../cambio_regimen/+page.server.ts | 114 -- .../importacion/cambio_regimen/+page.svelte | 382 ------ .../cambio_regimen/new/+page.svelte | 325 ----- .../compras_mexicanas/+page.server.ts | 114 -- .../compras_mexicanas/+page.svelte | 382 ------ .../compras_mexicanas/new/+page.svelte | 325 ----- .../importacion/definitiva/+page.server.ts | 114 -- .../importacion/definitiva/+page.svelte | 390 ------ .../importacion/definitiva/new/+page.svelte | 325 ----- .../importacion/temporal/+page.server.ts | 114 -- .../importacion/temporal/+page.svelte | 382 ------ .../importacion/temporal/new/+page.svelte | 325 ----- 33 files changed, 1764 insertions(+), 6247 deletions(-) delete mode 100644 estructura.txt create mode 100644 frontend/src/lib/components/dashboard/invoices/edit/compliance-tab-form.svelte create mode 100644 frontend/src/lib/components/dashboard/invoices/edit/financials-tab-form.svelte create mode 100644 frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte create mode 100644 frontend/src/lib/components/dashboard/invoices/edit/logistics-tab-form.svelte rename frontend/src/routes/dashboard/invoices/{exportacion/reparacion => }/+page.server.ts (55%) create mode 100644 frontend/src/routes/dashboard/invoices/+page.svelte create mode 100644 frontend/src/routes/dashboard/invoices/edit/[id]/+page.server.ts create mode 100644 frontend/src/routes/dashboard/invoices/edit/[id]/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.server.ts delete mode 100644 frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/exportacion/exportacion/new/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/exportacion/reparacion/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/exportacion/reparacion/new/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/cambio_regimen/+page.server.ts delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/cambio_regimen/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/cambio_regimen/new/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/compras_mexicanas/+page.server.ts delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/compras_mexicanas/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/compras_mexicanas/new/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/definitiva/+page.server.ts delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/definitiva/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/definitiva/new/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/temporal/+page.server.ts delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/temporal/+page.svelte delete mode 100644 frontend/src/routes/dashboard/invoices/importacion/temporal/new/+page.svelte diff --git a/.gitignore b/.gitignore index 0af971f5..17d85cdc 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ node_modules/ # Docker *.dockerignore +postgres-data/ \ No newline at end of file diff --git a/estructura.txt b/estructura.txt deleted file mode 100644 index aa2beccb..00000000 --- a/estructura.txt +++ /dev/null @@ -1,1190 +0,0 @@ -. -├── azure.crt -├── backend -│   ├── alembic -│   │   ├── env.py -│   │   ├── README -│   │   ├── script.py.mako -│   │   └── versions -│   │   ├── 531bf8cdae06_create_material_types_table.py -│   │   └── 7937209f9718_seed_initial_data.py -│   ├── alembic.ini -│   ├── api -│   │   └── v1 -│   │   ├── common -│   │   │   ├── base_models.py -│   │   │   ├── crud_routes.py -│   │   │   ├── dto_mixins.py -│   │   │   └── tenant_crud_routes.py -│   │   ├── modules -│   │   │   ├── a24 -│   │   │   │   ├── fa -│   │   │   │   │   └── fa_classes -│   │   │   │   │   └── models.py -│   │   │   │   └── inv -│   │   │   │   ├── inv_classes -│   │   │   │   │   └── models.py -│   │   │   │   └── location -│   │   │   │   ├── dto.py -│   │   │   │   ├── __init__.py -│   │   │   │   ├── models.py -│   │   │   │   ├── routes.py -│   │   │   │   └── service.py -│   │   │   ├── a76 -│   │   │   │   ├── classes -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── __init__.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── service.py -│   │   │   │   │   └── test_classes.py -│   │   │   │   ├── clients_and_providers -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── __init__.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── service.py -│   │   │   │   │   └── test_client_and_provider.py -│   │   │   │   ├── country_rule_oct -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── services.py -│   │   │   │   │   └── test_country_rule_oct.py -│   │   │   │   ├── customs_brokers -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── services.py -│   │   │   │   ├── fraction_rule_octave -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── services.py -│   │   │   │   │   └── test_fraction_rule_octave.py -│   │   │   │   ├── general_catalogs -│   │   │   │   │   ├── classification_concepts -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── company -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   ├── service.py -│   │   │   │   │   │   └── test_company.py -│   │   │   │   │   ├── concepts -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── customs_broker_concepts -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── doda -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── electronic_notices -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── equivalencies -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── error_catalogs -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── exchange_rate -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   ├── services.py -│   │   │   │   │   │   └── test_exchange_rate.py -│   │   │   │   │   ├── identifiers -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── inpc -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── legends -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── multi_currency_types -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── packages -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   ├── services.py -│   │   │   │   │   │   └── test_package.py -│   │   │   │   │   ├── ports -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── prevalidators -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── seal -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   ├── services.py -│   │   │   │   │   │   └── test_seal.py -│   │   │   │   │   ├── signatures -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   ├── unit_conversions -│   │   │   │   │   │   ├── dto.py -│   │   │   │   │   │   ├── __init__.py -│   │   │   │   │   │   ├── models.py -│   │   │   │   │   │   ├── routes.py -│   │   │   │   │   │   └── service.py -│   │   │   │   │   └── units_of_measure -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── __init__.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── service.py -│   │   │   │   ├── invoices -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── schemas.py -│   │   │   │   │   └── services.py -│   │   │   │   ├── parts -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── __init__.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── service.py -│   │   │   │   │   └── test_parts.py -│   │   │   │   ├── pedmientos -│   │   │   │   │   ├── dtos -│   │   │   │   │   │   ├── pedimento_config_additional.py -│   │   │   │   │   │   ├── pedimento_config_calculations.py -│   │   │   │   │   │   ├── pedimento_config_parameters.py -│   │   │   │   │   │   ├── pedimento_config_surcharges.py -│   │   │   │   │   │   ├── pedimento_config_update_rectification.py -│   │   │   │   │   │   ├── pedimento_config_updates.py -│   │   │   │   │   │   ├── pedimento_customs_offices.py -│   │   │   │   │   │   ├── pedimento_dates.py -│   │   │   │   │   │   ├── pedimento_decrementables.py -│   │   │   │   │   │   ├── pedimento_incrementables.py -│   │   │   │   │   │   ├── pedimento_indexes.py -│   │   │   │   │   │   ├── pedimento_payments.py -│   │   │   │   │   │   ├── pedimento_rectification_destination.py -│   │   │   │   │   │   ├── pedimento_rectification_origin.py -│   │   │   │   │   │   ├── pedimentos.py -│   │   │   │   │   │   ├── pedimento_transport_means.py -│   │   │   │   │   │   └── pedimento_validation.py -│   │   │   │   │   ├── models -│   │   │   │   │   │   ├── pedimento_config_additional.py -│   │   │   │   │   │   ├── pedimento_config_calculations.py -│   │   │   │   │   │   ├── pedimento_config_parameters.py -│   │   │   │   │   │   ├── pedimento_config_surcharges.py -│   │   │   │   │   │   ├── pedimento_config_update_rectification.py -│   │   │   │   │   │   ├── pedimento_config_updates.py -│   │   │   │   │   │   ├── pedimento_customs_offices.py -│   │   │   │   │   │   ├── pedimento_dates.py -│   │   │   │   │   │   ├── pedimento_decrementables.py -│   │   │   │   │   │   ├── pedimento_incrementables.py -│   │   │   │   │   │   ├── pedimento_indexes.py -│   │   │   │   │   │   ├── pedimento_payments.py -│   │   │   │   │   │   ├── pedimento_rectification_destination.py -│   │   │   │   │   │   ├── pedimento_rectification_origin.py -│   │   │   │   │   │   ├── pedimentos.py -│   │   │   │   │   │   ├── pedimento_transport_means.py -│   │   │   │   │   │   └── pedimento_validation.py -│   │   │   │   │   ├── router.py -│   │   │   │   │   ├── routes -│   │   │   │   │   │   ├── pedimento_config_additional.py -│   │   │   │   │   │   ├── pedimento_config_calculations.py -│   │   │   │   │   │   ├── pedimento_config_parameters.py -│   │   │   │   │   │   ├── pedimento_config_surcharges.py -│   │   │   │   │   │   ├── pedimento_config_update_rectification.py -│   │   │   │   │   │   ├── pedimento_config_updates.py -│   │   │   │   │   │   ├── pedimento_customs_offices.py -│   │   │   │   │   │   ├── pedimento_dates.py -│   │   │   │   │   │   ├── pedimento_decrementables.py -│   │   │   │   │   │   ├── pedimento_incrementables.py -│   │   │   │   │   │   ├── pedimento_indexes.py -│   │   │   │   │   │   ├── pedimento_payments.py -│   │   │   │   │   │   ├── pedimento_rectification_destination.py -│   │   │   │   │   │   ├── pedimento_rectification_origin.py -│   │   │   │   │   │   ├── pedimentos.py -│   │   │   │   │   │   ├── pedimento_transport_means.py -│   │   │   │   │   │   └── pedimento_validation.py -│   │   │   │   │   └── services -│   │   │   │   │   ├── pedimento_config_additional.py -│   │   │   │   │   ├── pedimento_config_calculations.py -│   │   │   │   │   ├── pedimento_config_parameters.py -│   │   │   │   │   ├── pedimento_config_surcharges.py -│   │   │   │   │   ├── pedimento_config_update_rectification.py -│   │   │   │   │   ├── pedimento_config_updates.py -│   │   │   │   │   ├── pedimento_customs_offices.py -│   │   │   │   │   ├── pedimento_dates.py -│   │   │   │   │   ├── pedimento_decrementables.py -│   │   │   │   │   ├── pedimento_incrementables.py -│   │   │   │   │   ├── pedimento_indexes.py -│   │   │   │   │   ├── pedimento_payments.py -│   │   │   │   │   ├── pedimento_rectification_destination.py -│   │   │   │   │   ├── pedimento_rectification_origin.py -│   │   │   │   │   ├── pedimentos.py -│   │   │   │   │   ├── pedimento_transport_means.py -│   │   │   │   │   └── pedimento_validation.py -│   │   │   │   ├── permission_rule_oct -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── services.py -│   │   │   │   │   └── test_permission_rule_oct.py -│   │   │   │   ├── router.py -│   │   │   │   └── transportation -│   │   │   │   ├── drivers -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── services.py -│   │   │   │   ├── trailers -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── services.py -│   │   │   │   ├── transporters -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── services.py -│   │   │   │   └── vehicles -│   │   │   │   ├── dto.py -│   │   │   │   ├── models.py -│   │   │   │   ├── routes.py -│   │   │   │   └── services.py -│   │   │   ├── core -│   │   │   │   ├── auth -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── __init__.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── service.py -│   │   │   │   ├── licenses -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── __init__.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── service.py -│   │   │   │   ├── router.py -│   │   │   │   ├── tenants -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── __init__.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── service.py -│   │   │   │   └── user_tenant -│   │   │   │   ├── dto.py -│   │   │   │   ├── models.py -│   │   │   │   ├── routes.py -│   │   │   │   └── service.py -│   │   │   └── public -│   │   │   ├── __init__.py -│   │   │   ├── reference_data -│   │   │   │   ├── code_pedimento_regimens -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_code_pedimento_regimens.py -│   │   │   │   ├── conftest.py -│   │   │   │   ├── containers -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_containers.py -│   │   │   │   ├── countries -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_countries.py -│   │   │   │   ├── currency_types -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_currency_types.py -│   │   │   │   ├── customs_sections -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_customs_sections.py -│   │   │   │   ├── customs_warehouses -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_customs_warehouses.py -│   │   │   │   ├── incoterms -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_incoterms.py -│   │   │   │   ├── invoice_types -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_invoice_types.py -│   │   │   │   ├── material_types -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_material_types.py -│   │   │   │   ├── payment_methods -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_payment_methods.py -│   │   │   │   ├── pedimento_codes -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_pedimento_codes.py -│   │   │   │   ├── pedimento_regimens -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_pedimento_regimens.py -│   │   │   │   ├── router.py -│   │   │   │   ├── sectors -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_sectors.py -│   │   │   │   ├── states -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_states.py -│   │   │   │   ├── trailer_types -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   └── services.py -│   │   │   │   ├── transport_modes -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_transport_modes.py -│   │   │   │   ├── transport_types -│   │   │   │   │   ├── dto.py -│   │   │   │   │   ├── models.py -│   │   │   │   │   ├── routes.py -│   │   │   │   │   ├── seed.py -│   │   │   │   │   └── test_transport_types.py -│   │   │   │   └── valuation_methods -│   │   │   │   ├── dto.py -│   │   │   │   ├── models.py -│   │   │   │   ├── routes.py -│   │   │   │   ├── seed.py -│   │   │   │   └── test_valuation_methods.py -│   │   │   └── router.py -│   │   └── router.py -│   ├── core -│   │   ├── config.py -│   │   ├── database.py -│   │   ├── __init__.py -│   │   ├── middleware.py -│   │   └── security.py -│   ├── Dockerfile -│   ├── main.py -│   ├── __pycache__ -│   └── requirements.txt -├── docker-compose.yml -├── docs -│   ├── a76.json -│   ├── ARCHITECTURE.md -│   ├── KEYCLOAK_SETUP.md -│   ├── MICROSOFT_SSO_SETUP.md -│   └── VERIFICAR_MICROSOFT_CONFIG.md -├── estructura.txt -├── frontend -│   ├── components.json -│   ├── Dockerfile -│   ├── e2e -│   │   └── demo.test.ts -│   ├── eslint.config.js -│   ├── messages -│   │   ├── en.json -│   │   └── es.json -│   ├── node_modules -│   ├── package.json -│   ├── playwright.config.ts -│   ├── pnpm-lock.yaml -│   ├── pnpm-workspace.yaml -│   ├── project.inlang -│   │   ├── cache -│   │   │   └── plugins -│   │   │   ├── 2sy648wh9sugi -│   │   │   └── ygx0uiahq6uw -│   │   ├── project_id -│   │   └── settings.json -│   ├── README.md -│   ├── src -│   │   ├── app.css -│   │   ├── app.d.ts -│   │   ├── app.html -│   │   ├── demo.spec.ts -│   │   ├── hooks.server.ts -│   │   ├── hooks.ts -│   │   ├── lib -│   │   │   ├── api -│   │   │   │   └── dashboard -│   │   │   │   ├── a76 -│   │   │   │   │   ├── classes.ts -│   │   │   │   │   ├── clients-providers.ts -│   │   │   │   │   ├── customs-brokers.ts -│   │   │   │   │   ├── general_catalogs -│   │   │   │   │   │   ├── classification-concepts.ts -│   │   │   │   │   │   ├── company.ts -│   │   │   │   │   │   ├── concepts.ts -│   │   │   │   │   │   ├── customs-broker-concepts.ts -│   │   │   │   │   │   ├── doda.ts -│   │   │   │   │   │   ├── electronic-notices.ts -│   │   │   │   │   │   ├── equivalencies.ts -│   │   │   │   │   │   ├── error-catalogs.ts -│   │   │   │   │   │   ├── exchange-rate.ts -│   │   │   │   │   │   ├── identifiers.ts -│   │   │   │   │   │   ├── index.ts -│   │   │   │   │   │   ├── inpc.ts -│   │   │   │   │   │   ├── legends.ts -│   │   │   │   │   │   ├── locations.ts -│   │   │   │   │   │   ├── multi-currency-types.ts -│   │   │   │   │   │   ├── packages.ts -│   │   │   │   │   │   ├── ports.ts -│   │   │   │   │   │   ├── prevalidators.ts -│   │   │   │   │   │   ├── seal.ts -│   │   │   │   │   │   ├── signatures.ts -│   │   │   │   │   │   ├── um-ace.ts -│   │   │   │   │   │   ├── um-customs-ame.ts -│   │   │   │   │   │   ├── um-customs-mex.ts -│   │   │   │   │   │   ├── um-oma.ts -│   │   │   │   │   │   ├── unit-conversions.ts -│   │   │   │   │   │   ├── unit-measures.ts -│   │   │   │   │   │   └── units-of-measure.ts -│   │   │   │   │   ├── index.ts -│   │   │   │   │   ├── invoices.ts -│   │   │   │   │   ├── pedimento-dates.ts -│   │   │   │   │   ├── pedimento-payments.ts -│   │   │   │   │   ├── pedimentos.ts -│   │   │   │   │   ├── pedimento-transport.ts -│   │   │   │   │   └── pedimento-validation.ts -│   │   │   │   └── refrence_data -│   │   │   │   ├── code_pedimento_regimens.ts -│   │   │   │   ├── containers.ts -│   │   │   │   ├── countries.ts -│   │   │   │   ├── currency_types.ts -│   │   │   │   ├── customs_sections.ts -│   │   │   │   ├── customs_warehouses.ts -│   │   │   │   ├── incoterms.ts -│   │   │   │   ├── invoice_types.ts -│   │   │   │   ├── material_types.ts -│   │   │   │   ├── payment_methods.ts -│   │   │   │   ├── pedimento_codes.ts -│   │   │   │   ├── pedimento_regimens.ts -│   │   │   │   ├── sectors.ts -│   │   │   │   ├── states.ts -│   │   │   │   ├── transport_modes.ts -│   │   │   │   ├── transport_types.ts -│   │   │   │   └── valuation_methods.ts -│   │   │   ├── api.ts -│   │   │   ├── assets -│   │   │   │   └── favicon.svg -│   │   │   ├── auth.ts -│   │   │   ├── components -│   │   │   │   ├── dashboard -│   │   │   │   │   ├── classes -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   ├── clients_and_providers -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   ├── company -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   └── data-table-actions.svelte -│   │   │   │   │   ├── customs_brokers -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   ├── details-dialog.svelte -│   │   │   │   │   │   └── edit-dialog.svelte -│   │   │   │   │   ├── exchange-rate -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   ├── general_catalogs -│   │   │   │   │   │   └── simple-data-table.svelte -│   │   │   │   │   ├── identifiers -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   ├── invoices -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   ├── locations -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   ├── packages -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   ├── pedimentos -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   └── edit -│   │   │   │   │   │   ├── dates-tab-form.svelte -│   │   │   │   │   │   ├── general-tab-form.svelte -│   │   │   │   │   │   ├── payments-tab-form.svelte -│   │   │   │   │   │   ├── transport-tab-form.svelte -│   │   │   │   │   │   └── validation-tab-form.svelte -│   │   │   │   │   ├── ports -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   └── data-table-actions.svelte -│   │   │   │   │   ├── reference_data -│   │   │   │   │   │   ├── code_pedimento_regimens -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── containers -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── countries -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── currency_types -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── customs_sections -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── customs_warehouses -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── incoterms -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── invoice_types -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── material_types -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── payment_methods -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── pedimento_codes -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── pedimento_regimens -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── sectors -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── states -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── transport_modes -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   ├── transport_types -│   │   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   │   └── valuation_methods -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   ├── delete-dialog.svelte -│   │   │   │   │   │   └── details-dialog.svelte -│   │   │   │   │   ├── seal -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   ├── data-table.svelte -│   │   │   │   │   │   └── index.ts -│   │   │   │   │   └── units_of_measure -│   │   │   │   │   ├── ace -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   ├── american -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   └── data-table-actions.svelte -│   │   │   │   │   ├── customs -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   ├── general -│   │   │   │   │   │   ├── columns.ts -│   │   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   │   ├── data-table-actions.svelte -│   │   │   │   │   │   └── data-table.svelte -│   │   │   │   │   └── oma -│   │   │   │   │   ├── columns.ts -│   │   │   │   │   ├── create-edit-dialog.svelte -│   │   │   │   │   └── data-table-actions.svelte -│   │   │   │   ├── login-form.svelte -│   │   │   │   ├── sidebar -│   │   │   │   │   ├── app-sidebar.svelte -│   │   │   │   │   ├── modules.ts -│   │   │   │   │   ├── nav-main.svelte -│   │   │   │   │   ├── nav-projects.svelte -│   │   │   │   │   ├── nav-user.svelte -│   │   │   │   │   └── team-switcher.svelte -│   │   │   │   └── ui -│   │   │   │   ├── alert -│   │   │   │   │   ├── alert-description.svelte -│   │   │   │   │   ├── alert.svelte -│   │   │   │   │   ├── alert-title.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── alert-dialog -│   │   │   │   │   ├── alert-dialog-action.svelte -│   │   │   │   │   ├── alert-dialog-cancel.svelte -│   │   │   │   │   ├── alert-dialog-content.svelte -│   │   │   │   │   ├── alert-dialog-description.svelte -│   │   │   │   │   ├── alert-dialog-footer.svelte -│   │   │   │   │   ├── alert-dialog-header.svelte -│   │   │   │   │   ├── alert-dialog-overlay.svelte -│   │   │   │   │   ├── alert-dialog-title.svelte -│   │   │   │   │   ├── alert-dialog-trigger.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── avatar -│   │   │   │   │   ├── avatar-fallback.svelte -│   │   │   │   │   ├── avatar-image.svelte -│   │   │   │   │   ├── avatar.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── badge -│   │   │   │   │   ├── badge.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── breadcrumb -│   │   │   │   │   ├── breadcrumb-ellipsis.svelte -│   │   │   │   │   ├── breadcrumb-item.svelte -│   │   │   │   │   ├── breadcrumb-link.svelte -│   │   │   │   │   ├── breadcrumb-list.svelte -│   │   │   │   │   ├── breadcrumb-page.svelte -│   │   │   │   │   ├── breadcrumb-separator.svelte -│   │   │   │   │   ├── breadcrumb.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── button -│   │   │   │   │   ├── button.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── card -│   │   │   │   │   ├── card-action.svelte -│   │   │   │   │   ├── card-content.svelte -│   │   │   │   │   ├── card-description.svelte -│   │   │   │   │   ├── card-footer.svelte -│   │   │   │   │   ├── card-header.svelte -│   │   │   │   │   ├── card.svelte -│   │   │   │   │   ├── card-title.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── collapsible -│   │   │   │   │   ├── collapsible-content.svelte -│   │   │   │   │   ├── collapsible.svelte -│   │   │   │   │   ├── collapsible-trigger.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── data-table -│   │   │   │   │   ├── data-table.svelte.ts -│   │   │   │   │   ├── flex-render.svelte -│   │   │   │   │   ├── index.ts -│   │   │   │   │   └── render-helpers.ts -│   │   │   │   ├── dialog -│   │   │   │   │   ├── dialog-close.svelte -│   │   │   │   │   ├── dialog-content.svelte -│   │   │   │   │   ├── dialog-description.svelte -│   │   │   │   │   ├── dialog-footer.svelte -│   │   │   │   │   ├── dialog-header.svelte -│   │   │   │   │   ├── dialog-overlay.svelte -│   │   │   │   │   ├── dialog-title.svelte -│   │   │   │   │   ├── dialog-trigger.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── dropdown-menu -│   │   │   │   │   ├── dropdown-menu-checkbox-item.svelte -│   │   │   │   │   ├── dropdown-menu-content.svelte -│   │   │   │   │   ├── dropdown-menu-group-heading.svelte -│   │   │   │   │   ├── dropdown-menu-group.svelte -│   │   │   │   │   ├── dropdown-menu-item.svelte -│   │   │   │   │   ├── dropdown-menu-label.svelte -│   │   │   │   │   ├── dropdown-menu-radio-group.svelte -│   │   │   │   │   ├── dropdown-menu-radio-item.svelte -│   │   │   │   │   ├── dropdown-menu-separator.svelte -│   │   │   │   │   ├── dropdown-menu-shortcut.svelte -│   │   │   │   │   ├── dropdown-menu-sub-content.svelte -│   │   │   │   │   ├── dropdown-menu-sub-trigger.svelte -│   │   │   │   │   ├── dropdown-menu-trigger.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── field -│   │   │   │   │   ├── field-content.svelte -│   │   │   │   │   ├── field-description.svelte -│   │   │   │   │   ├── field-error.svelte -│   │   │   │   │   ├── field-group.svelte -│   │   │   │   │   ├── field-label.svelte -│   │   │   │   │   ├── field-legend.svelte -│   │   │   │   │   ├── field-separator.svelte -│   │   │   │   │   ├── field-set.svelte -│   │   │   │   │   ├── field.svelte -│   │   │   │   │   ├── field-title.svelte -│   │   │   │   │   └── index.ts -│   │   │   │   ├── input -│   │   │   │   │   ├── index.ts -│   │   │   │   │   └── input.svelte -│   │   │   │   ├── label -│   │   │   │   │   ├── index.ts -│   │   │   │   │   └── label.svelte -│   │   │   │   ├── select -│   │   │   │   │   ├── index.ts -│   │   │   │   │   ├── select-content.svelte -│   │   │   │   │   ├── select-group-heading.svelte -│   │   │   │   │   ├── select-group.svelte -│   │   │   │   │   ├── select-item.svelte -│   │   │   │   │   ├── select-label.svelte -│   │   │   │   │   ├── select-scroll-down-button.svelte -│   │   │   │   │   ├── select-scroll-up-button.svelte -│   │   │   │   │   ├── select-separator.svelte -│   │   │   │   │   └── select-trigger.svelte -│   │   │   │   ├── separator -│   │   │   │   │   ├── index.ts -│   │   │   │   │   └── separator.svelte -│   │   │   │   ├── sheet -│   │   │   │   │   ├── index.ts -│   │   │   │   │   ├── sheet-close.svelte -│   │   │   │   │   ├── sheet-content.svelte -│   │   │   │   │   ├── sheet-description.svelte -│   │   │   │   │   ├── sheet-footer.svelte -│   │   │   │   │   ├── sheet-header.svelte -│   │   │   │   │   ├── sheet-overlay.svelte -│   │   │   │   │   ├── sheet-title.svelte -│   │   │   │   │   └── sheet-trigger.svelte -│   │   │   │   ├── sidebar -│   │   │   │   │   ├── constants.ts -│   │   │   │   │   ├── context.svelte.ts -│   │   │   │   │   ├── index.ts -│   │   │   │   │   ├── sidebar-content.svelte -│   │   │   │   │   ├── sidebar-footer.svelte -│   │   │   │   │   ├── sidebar-group-action.svelte -│   │   │   │   │   ├── sidebar-group-content.svelte -│   │   │   │   │   ├── sidebar-group-label.svelte -│   │   │   │   │   ├── sidebar-group.svelte -│   │   │   │   │   ├── sidebar-header.svelte -│   │   │   │   │   ├── sidebar-input.svelte -│   │   │   │   │   ├── sidebar-inset.svelte -│   │   │   │   │   ├── sidebar-menu-action.svelte -│   │   │   │   │   ├── sidebar-menu-badge.svelte -│   │   │   │   │   ├── sidebar-menu-button.svelte -│   │   │   │   │   ├── sidebar-menu-item.svelte -│   │   │   │   │   ├── sidebar-menu-skeleton.svelte -│   │   │   │   │   ├── sidebar-menu-sub-button.svelte -│   │   │   │   │   ├── sidebar-menu-sub-item.svelte -│   │   │   │   │   ├── sidebar-menu-sub.svelte -│   │   │   │   │   ├── sidebar-menu.svelte -│   │   │   │   │   ├── sidebar-provider.svelte -│   │   │   │   │   ├── sidebar-rail.svelte -│   │   │   │   │   ├── sidebar-separator.svelte -│   │   │   │   │   ├── sidebar.svelte -│   │   │   │   │   └── sidebar-trigger.svelte -│   │   │   │   ├── skeleton -│   │   │   │   │   ├── index.ts -│   │   │   │   │   └── skeleton.svelte -│   │   │   │   ├── switch -│   │   │   │   │   ├── index.ts -│   │   │   │   │   └── switch.svelte -│   │   │   │   ├── table -│   │   │   │   │   ├── index.ts -│   │   │   │   │   ├── table-body.svelte -│   │   │   │   │   ├── table-caption.svelte -│   │   │   │   │   ├── table-cell.svelte -│   │   │   │   │   ├── table-footer.svelte -│   │   │   │   │   ├── table-header.svelte -│   │   │   │   │   ├── table-head.svelte -│   │   │   │   │   ├── table-row.svelte -│   │   │   │   │   └── table.svelte -│   │   │   │   ├── tabs -│   │   │   │   │   ├── index.ts -│   │   │   │   │   ├── tabs-content.svelte -│   │   │   │   │   ├── tabs-list.svelte -│   │   │   │   │   ├── tabs.svelte -│   │   │   │   │   └── tabs-trigger.svelte -│   │   │   │   ├── textarea -│   │   │   │   │   ├── index.ts -│   │   │   │   │   └── textarea.svelte -│   │   │   │   └── tooltip -│   │   │   │   ├── index.ts -│   │   │   │   ├── tooltip-content.svelte -│   │   │   │   └── tooltip-trigger.svelte -│   │   │   ├── hooks -│   │   │   │   └── is-mobile.svelte.ts -│   │   │   ├── paraglide -│   │   │   │   ├── messages -│   │   │   │   │   ├── en.js -│   │   │   │   │   ├── es.js -│   │   │   │   │   └── _index.js -│   │   │   │   ├── messages.js -│   │   │   │   ├── registry.js -│   │   │   │   ├── runtime.js -│   │   │   │   └── server.js -│   │   │   ├── server -│   │   │   │   └── api.ts -│   │   │   ├── sso.ts -│   │   │   ├── stores -│   │   │   │   └── company.svelte.ts -│   │   │   └── utils.ts -│   │   └── routes -│   │   ├── api -│   │   │   └── company -│   │   │   └── my-companies -│   │   │   └── +server.ts -│   │   ├── auth -│   │   │   └── callback -│   │   │   ├── +page.server.ts -│   │   │   └── +page.svelte -│   │   ├── dashboard -│   │   │   ├── classes -│   │   │   │   └── +page.svelte -│   │   │   ├── clients_and_providers -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── customs_brokers -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── general_catalogs -│   │   │   │   ├── classification_concepts -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── company_information -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── concepts -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── customs_broker_concepts -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── doda -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── electronic_notices -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── equivalencies -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── error_catalogs -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── exchange-rate -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── identifiers -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── inpc -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── legends -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── locations -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── multi_currency_types -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── packages -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── +page.svelte -│   │   │   │   ├── ports -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── prevalidators -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── seal -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── signatures -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── unit_conversions -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   └── units_of_measure -│   │   │   │   ├── ace -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── american -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── customs -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── general -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   └── oma -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── invoices -│   │   │   │   ├── exportacion -│   │   │   │   │   ├── exportacion -│   │   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   │   └── +page.svelte -│   │   │   │   │   └── reparacion -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   └── importacion -│   │   │   │   ├── cambio_regimen -│   │   │   │   │   ├── new -│   │   │   │   │   │   └── +page.svelte -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── compras_mexicanas -│   │   │   │   │   ├── new -│   │   │   │   │   │   └── +page.svelte -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── definitiva -│   │   │   │   │   ├── new -│   │   │   │   │   │   └── +page.svelte -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   └── temporal -│   │   │   │   ├── new -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── +layout.server.ts -│   │   │   ├── +layout.svelte -│   │   │   ├── +layout.ts -│   │   │   ├── +page.svelte -│   │   │   ├── pedimentos -│   │   │   │   ├── edit -│   │   │   │   │   └── [id] -│   │   │   │   │   ├── +page.server.ts -│   │   │   │   │   └── +page.svelte -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   └── reference_data -│   │   │   ├── code_pedimento_regimens -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── containers -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── countries -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── currency_types -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── customs_sections -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── customs_warehouses -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── incoterms -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── invoice_types -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── material_types -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── +page.svelte -│   │   │   ├── payment_methods -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── pedimento_codes -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── pedimento_regimens -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── sectors -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── states -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── transport_modes -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   ├── transport_types -│   │   │   │   ├── +page.server.ts -│   │   │   │   └── +page.svelte -│   │   │   └── valuation_methods -│   │   │   ├── +page.server.ts -│   │   │   └── +page.svelte -│   │   ├── demo -│   │   │   ├── +page.svelte -│   │   │   └── paraglide -│   │   │   └── +page.svelte -│   │   ├── +layout.svelte -│   │   ├── login -│   │   │   ├── +page.server.ts -│   │   │   └── +page.svelte -│   │   ├── logout -│   │   │   └── +server.ts -│   │   ├── +page.server.ts -│   │   ├── +page.svelte -│   │   ├── page.svelte.spec.ts -│   │   └── register -│   │   └── +page.svelte -│   ├── svelte.config.js -│   ├── tsconfig.json -│   ├── vite.config.ts -│   └── vitest-setup-client.ts -├── pnpm-lock.yaml -├── README.md -├── scripts -│   ├── backend-entrypoint.sh -│   ├── frontend-entrypoint.sh -│   ├── health-check.sh -│   ├── init_first_time.sh -│   ├── keycloak-entrypoint.sh -│   ├── postgres-app-entrypoint.sh -│   └── postgres-keycloak-entrypoint.sh -└── start.sh - -245 directories, 943 files diff --git a/frontend/src/lib/components/dashboard/invoices/columns.ts b/frontend/src/lib/components/dashboard/invoices/columns.ts index d7f03fc5..bee37d2d 100644 --- a/frontend/src/lib/components/dashboard/invoices/columns.ts +++ b/frontend/src/lib/components/dashboard/invoices/columns.ts @@ -1,89 +1,250 @@ -/** - * Definición de columnas para la tabla de facturas - */ +import type { ColumnDef } from "@tanstack/table-core"; +import { renderComponent, renderSnippet } from "$lib/components/ui/data-table/index.js"; +import { createRawSnippet } from "svelte"; +import DataTableActions from "./data-table-actions.svelte"; import type { Invoice } from '$lib/api/dashboard/a76/invoices'; -import DataTableActions from './data-table-actions.svelte'; -export function createColumns() { +/** + * Formatea un número como moneda MXN + */ +function formatCurrencyMXN(value?: number | null): string { + if (value === null || value === undefined) return '-'; + return new Intl.NumberFormat('es-MX', { + style: 'currency', + currency: 'MXN', + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }).format(value); +} + +/** + * Formatea un número como moneda USD + */ +function formatCurrencyUSD(value?: number | null): string { + if (value === null || value === undefined) return '-'; + return new Intl.NumberFormat('es-MX', { + style: 'currency', + currency: 'USD', + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }).format(value); +} + +/** + * Formatea una fecha + */ +function formatDate(date?: string | null): string { + if (!date) return '-'; + return new Date(date).toLocaleDateString('es-MX', { + year: 'numeric', + month: '2-digit', + day: '2-digit' + }); +} + +/** + * Obtiene el color del badge según el tipo de operación + */ +function getOperationTypeColor(type?: string | null): string { + if (!type) return 'bg-gray-100 text-gray-800'; + return type === 'imp' ? 'bg-blue-100 text-blue-800' : 'bg-green-100 text-green-800'; +} + +/** + * Obtiene el color del badge según el semáforo fiscal + */ +function getTrafficLightColor(status?: string | null): string { + if (!status) return 'bg-gray-100 text-gray-800'; + + const statusLower = status.toLowerCase(); + if (statusLower.includes('verde') || statusLower === 'green') return 'bg-green-100 text-green-800'; + if (statusLower.includes('amarillo') || statusLower === 'yellow') return 'bg-yellow-100 text-yellow-800'; + if (statusLower.includes('rojo') || statusLower === 'red') return 'bg-red-100 text-red-800'; + + return 'bg-gray-100 text-gray-800'; +} + +export function createColumns(onSuccess?: () => void): ColumnDef[] { return [ { - accessorKey: 'id', - header: 'ID', - cell: (info: any) => info.getValue(), - enableSorting: true - }, - { - accessorKey: 'operation_type', - header: 'Tipo', - cell: (info: any) => { - const type = info.getValue(); - return type === 'imp' ? 'Importación' : type === 'exp' ? 'Exportación' : '-'; + accessorKey: "id", + header: "ID", + cell: ({ row }) => { + const idSnippet = createRawSnippet<[{ id: number }]>((getId) => { + const { id } = getId(); + return { + render: () => + `
#${id}
` + }; + }); + return renderSnippet(idSnippet, { id: row.original.id }); } }, { - accessorKey: 'invoice_number', - header: 'Número de Factura', - cell: (info: any) => info.getValue() || '-' - }, - { - accessorKey: 'invoice_type', - header: 'Tipo Factura', - cell: (info: any) => info.getValue() || '-' - }, - { - accessorKey: 'project_number', - header: 'Proyecto', - cell: (info: any) => info.getValue() || '-' - }, - { - accessorKey: 'compliance_mx.pedimento', - header: 'Pedimento', - cell: (info: any) => { - const row = info.row.original; - return row.compliance_mx?.pedimento || '-'; + accessorKey: "operation_type", + header: "Operación", + cell: ({ row }) => { + const type = row.original.operation_type; + const colorClass = getOperationTypeColor(type); + const label = type === 'imp' ? 'IMP' : type === 'exp' ? 'EXP' : 'N/A'; + + const typeSnippet = createRawSnippet<[{ label: string; colorClass: string }]>((getType) => { + const { label, colorClass } = getType(); + return { + render: () => + ` + ${label} + ` + }; + }); + return renderSnippet(typeSnippet, { label, colorClass }); } }, { - accessorKey: 'invoice_date', - header: 'Fecha Factura', - cell: (info: any) => { - const date = info.getValue(); - if (!date) return '-'; - return new Date(date).toLocaleDateString('es-MX'); + accessorKey: "invoice_number", + header: "Número de Factura", + cell: ({ row }) => { + const numberSnippet = createRawSnippet<[{ number?: string | null }]>((getNumber) => { + const { number } = getNumber(); + return { + render: () => + `${number || 'N/A'}` + }; + }); + return renderSnippet(numberSnippet, { number: row.original.invoice_number }); } }, { - accessorKey: 'financials.value_mn', - header: 'Valor MN', - cell: (info: any) => { - const row = info.row.original; - const value = row.financials?.value_mn; - if (value === null || value === undefined) return '-'; - return new Intl.NumberFormat('es-MX', { - style: 'currency', - currency: 'MXN' - }).format(value); + accessorKey: "invoice_type", + header: "Tipo", + cell: ({ row }) => { + const typeSnippet = createRawSnippet<[{ type?: string | null }]>((getType) => { + const { type } = getType(); + return { + render: () => + `
${type || '-'}
` + }; + }); + return renderSnippet(typeSnippet, { type: row.original.invoice_type }); } }, { - accessorKey: 'traffic_light_status', - header: 'Semáforo', - cell: (info: any) => info.getValue() || '-' - }, - { - accessorKey: 'capture_date', - header: 'Fecha Captura', - cell: (info: any) => { - const date = info.getValue(); - if (!date) return '-'; - return new Date(date).toLocaleDateString('es-MX'); + accessorKey: "project_number", + header: "Proyecto", + cell: ({ row }) => { + const projectSnippet = createRawSnippet<[{ project?: string | null }]>((getProject) => { + const { project } = getProject(); + return { + render: () => + `
${project || '-'}
` + }; + }); + return renderSnippet(projectSnippet, { project: row.original.project_number }); } }, { - id: 'actions', - header: 'Acciones', - cell: (info: any) => DataTableActions, - enableSorting: false + accessorKey: "compliance_mx.pedimento", + header: "Pedimento", + cell: ({ row }) => { + const pedimento = row.original.compliance_mx?.pedimento; + + const pedimentoSnippet = createRawSnippet<[{ pedimento?: string | null }]>((getPedimento) => { + const { pedimento } = getPedimento(); + return { + render: () => + `
${pedimento || '-'}
` + }; + }); + return renderSnippet(pedimentoSnippet, { pedimento }); + } + }, + { + accessorKey: "financials.value_mn", + header: () => { + const headerSnippet = createRawSnippet(() => { + return { + render: () => `
Valor MN
` + }; + }); + return renderSnippet(headerSnippet, {}); + }, + cell: ({ row }) => { + const valueMN = row.original.financials?.value_mn; + + const valueSnippet = createRawSnippet<[{ value: string }]>((getValue) => { + const { value } = getValue(); + return { + render: () => + `
${value}
` + }; + }); + return renderSnippet(valueSnippet, { value: formatCurrencyMXN(valueMN) }); + } + }, + { + accessorKey: "financials.value_me", + header: () => { + const headerSnippet = createRawSnippet(() => { + return { + render: () => `
Valor ME
` + }; + }); + return renderSnippet(headerSnippet, {}); + }, + cell: ({ row }) => { + const valueME = row.original.financials?.value_me; + + const valueSnippet = createRawSnippet<[{ value: string }]>((getValue) => { + const { value } = getValue(); + return { + render: () => + `
${value}
` + }; + }); + return renderSnippet(valueSnippet, { value: formatCurrencyUSD(valueME) }); + } + }, + { + accessorKey: "traffic_light_status", + header: "Semáforo", + cell: ({ row }) => { + const status = row.original.traffic_light_status; + const colorClass = getTrafficLightColor(status); + + const statusSnippet = createRawSnippet<[{ status?: string | null; colorClass: string }]>((getStatus) => { + const { status, colorClass } = getStatus(); + return { + render: () => + ` + ${status || '-'} + ` + }; + }); + return renderSnippet(statusSnippet, { status, colorClass }); + } + }, + { + accessorKey: "invoice_date", + header: "Fecha Factura", + cell: ({ row }) => { + const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => { + const { date } = getDate(); + return { + render: () => + `
${date}
` + }; + }); + return renderSnippet(dateSnippet, { date: formatDate(row.original.invoice_date) }); + } + }, + { + id: "actions", + cell: ({ row }) => { + return renderComponent(DataTableActions, { invoice: row.original, onSuccess }); + } } ]; } + +// Mantener compatibilidad hacia atrás +export const columns = createColumns(); diff --git a/frontend/src/lib/components/dashboard/invoices/data-table-actions.svelte b/frontend/src/lib/components/dashboard/invoices/data-table-actions.svelte index 4b5f2e65..bbb7a09f 100644 --- a/frontend/src/lib/components/dashboard/invoices/data-table-actions.svelte +++ b/frontend/src/lib/components/dashboard/invoices/data-table-actions.svelte @@ -3,26 +3,24 @@ import { Button } from '$lib/components/ui/button'; import * as DropdownMenu from '$lib/components/ui/dropdown-menu'; import { Ellipsis, Eye, Pencil, Trash2 } from 'lucide-svelte'; - import { goto } from '$app/navigation'; + import DetailsDialog from './details-dialog.svelte'; + import DeleteDialog from './delete-dialog.svelte'; interface Props { invoice: Invoice; + onSuccess?: () => void; } - let { invoice }: Props = $props(); + let { invoice, onSuccess }: Props = $props(); + + let showDetails = $state(false); + let showDelete = $state(false); - function dispatchView() { - window.dispatchEvent(new CustomEvent('invoiceView', { detail: invoice })); + function handleEdit() { + // Redirigir a la página de edición + window.location.href = `/dashboard/invoices/edit/${invoice.id}`; } - function dispatchDelete() { - window.dispatchEvent(new CustomEvent('invoiceDelete', { detail: invoice })); - } - - function dispatchEdit() { - window.dispatchEvent(new CustomEvent('invoiceEdit', { detail: invoice })); - } - @@ -38,20 +36,36 @@ Acciones - + showDetails = true}> Ver Detalles - + Editar - + showDelete = true} class="text-destructive"> Eliminar - \ No newline at end of file + + + +{#if showDetails} + showDetails = false} + /> +{/if} + +{#if showDelete} + showDelete = false} + {onSuccess} + /> +{/if} \ No newline at end of file diff --git a/frontend/src/lib/components/dashboard/invoices/data-table.svelte b/frontend/src/lib/components/dashboard/invoices/data-table.svelte index 14c41b7e..ef98de23 100644 --- a/frontend/src/lib/components/dashboard/invoices/data-table.svelte +++ b/frontend/src/lib/components/dashboard/invoices/data-table.svelte @@ -83,18 +83,10 @@ {#each row.getVisibleCells() as cell (cell.id)} - {#if cell.column.id === 'actions'} - {@const cellDef = cell.column.columnDef.cell} - {#if cellDef && typeof cellDef === 'function'} - {@const Component = cellDef(cell.getContext())} - - {/if} - {:else} - - {/if} + {/each} diff --git a/frontend/src/lib/components/dashboard/invoices/delete-dialog.svelte b/frontend/src/lib/components/dashboard/invoices/delete-dialog.svelte index f33d7937..c813bbae 100644 --- a/frontend/src/lib/components/dashboard/invoices/delete-dialog.svelte +++ b/frontend/src/lib/components/dashboard/invoices/delete-dialog.svelte @@ -5,27 +5,26 @@ import { companyStore } from "$lib/stores/company.svelte"; import { LoaderCircle } from 'lucide-svelte'; - let { - open = $bindable(false), - item, - onSuccess - }: { - open: boolean; - item: Invoice | null; + interface Props { + invoice: Invoice; + onClose: () => void; onSuccess?: () => void; - } = $props(); + } + + let { invoice, onClose, onSuccess }: Props = $props(); + let open = $state(true); let loading = $state(false); let error = $state(null); async function handleDelete() { - if (!item || !companyStore.activeCompany) return; + if (!invoice || !companyStore.activeCompany) return; loading = true; error = null; try { - const response = await invoicesApi.delete(item.id, companyStore.activeCompany.id); + const response = await invoicesApi.delete(invoice.id, companyStore.activeCompany.id); if (response.error) { error = response.error; @@ -33,7 +32,7 @@ } // Éxito - open = false; + onClose(); if (onSuccess) { onSuccess(); } @@ -48,8 +47,10 @@ function handleOpenChange(newOpen: boolean) { if (!newOpen) { error = null; + onClose(); + } else { + open = newOpen; } - open = newOpen; } @@ -59,30 +60,30 @@ ¿Estás seguro?

Esta acción no se puede deshacer. Se eliminará permanentemente esta factura:

- {#if item} + {#if invoice}
ID: - {item.id} + {invoice.id}
Número de Factura: - {item.invoice_number || 'N/A'} + {invoice.invoice_number || 'N/A'}
Tipo: - {item.operation_type === 'imp' ? 'Importación' : - item.operation_type === 'exp' ? 'Exportación' : 'N/A'} + {invoice.operation_type === 'imp' ? 'Importación' : + invoice.operation_type === 'exp' ? 'Exportación' : 'N/A'}
Proyecto: - {item.project_number || 'N/A'} + {invoice.project_number || 'N/A'}
Pedimento: - {item.compliance_mx?.pedimento || 'N/A'} + {invoice.compliance_mx?.pedimento || 'N/A'}
{/if} diff --git a/frontend/src/lib/components/dashboard/invoices/details-dialog.svelte b/frontend/src/lib/components/dashboard/invoices/details-dialog.svelte index e517faa3..12bc4862 100644 --- a/frontend/src/lib/components/dashboard/invoices/details-dialog.svelte +++ b/frontend/src/lib/components/dashboard/invoices/details-dialog.svelte @@ -5,13 +5,13 @@ import { Badge } from '$lib/components/ui/badge'; import { Button } from '$lib/components/ui/button'; - let { - open = $bindable(false), - invoice - }: { - open: boolean; - invoice: Invoice | null; - } = $props(); + interface Props { + invoice: Invoice; + onClose: () => void; + } + + let { invoice, onClose }: Props = $props(); + let open = $state(true); function formatDate(dateString: string | null | undefined): string { if (!dateString) return '-'; @@ -32,7 +32,7 @@ } - (open = v)}> + { open = v; if (!v) onClose(); }}> Detalles de Factura #{invoice?.id} diff --git a/frontend/src/lib/components/dashboard/invoices/edit/compliance-tab-form.svelte b/frontend/src/lib/components/dashboard/invoices/edit/compliance-tab-form.svelte new file mode 100644 index 00000000..15ef3ab6 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/compliance-tab-form.svelte @@ -0,0 +1,60 @@ + + + + + Cumplimiento Aduanal + Información de cumplimiento y aduanas + + +
+
+ + +
+
+ + +
+
+

Más campos por implementar...

+
+
\ No newline at end of file diff --git a/frontend/src/lib/components/dashboard/invoices/edit/financials-tab-form.svelte b/frontend/src/lib/components/dashboard/invoices/edit/financials-tab-form.svelte new file mode 100644 index 00000000..14e4b9ff --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/financials-tab-form.svelte @@ -0,0 +1,53 @@ + + + + + Información Financiera + Valores, monedas y datos financieros + + +
+
+ + +
+
+ + +
+
+

Más campos por implementar...

+
+
\ No newline at end of file diff --git a/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte b/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte new file mode 100644 index 00000000..42f9cba2 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte @@ -0,0 +1,224 @@ + + + + + Información General + + Edita los datos principales de la factura + + + +
+ +
+
+ + { + formData.operation_type = v ? parseInt(v) : null; + }} + > + + + {formData.operation_type !== null + ? operationOptions.find(o => o.value === formData.operation_type)?.label + : 'Selecciona tipo...'} + + + + {#each operationOptions as option} + {option.label} + {/each} + + +
+ +
+ + { + formData.invoice_type = v ?? ''; + }} + > + + + {formData.invoice_type + ? `${formData.invoice_type} - ${filteredInvoiceTypes().find(t => t.key === formData.invoice_type)?.description || ''}` + : 'Selecciona tipo...'} + + + + {#each filteredInvoiceTypes() as type} + + {type.key} - {type.description} + + {/each} + + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ + { + formData.traffic_light_status = v ?? 'green'; + }} + > + + + {trafficLightOptions.find(t => t.value === formData.traffic_light_status)?.label || 'Verde'} + + + + {#each trafficLightOptions as option} + {option.label} + {/each} + + +
+
+ + +
+ +