diff --git a/backend/api/v1/modules/a76/invoices/services.py b/backend/api/v1/modules/a76/invoices/services.py index ed8f9c38..478bdae8 100644 --- a/backend/api/v1/modules/a76/invoices/services.py +++ b/backend/api/v1/modules/a76/invoices/services.py @@ -1,10 +1,10 @@ +import traceback from typing import Optional, List, Tuple from sqlalchemy.orm import Session from sqlalchemy import and_ from . import models, schemas - class InvoiceService: """Service for Invoice Header operations""" @@ -55,7 +55,6 @@ class InvoiceService: models.InvoiceComplianceMx.pedimento.ilike( f"%{filters['pedimento']}%") ) - if not filters.get("invoice_type") and filters.get("operation_type") == "exp": query = query.filter( models.InvoiceHeader.operation_type != "REPAR") @@ -72,73 +71,118 @@ class InvoiceService: company_id: int ) -> models.InvoiceHeader: """Create a new invoice with all related data""" - # Extract nested data - compliance_data = invoice_data.compliance_mx - financials_data = invoice_data.financials - logistics_data = invoice_data.logistics or [] - details_data = invoice_data.details or [] - collections_data = invoice_data.collections or [] + + + def clean_dict(data_dict: dict) -> dict: + cleaned = {} + for key, value in data_dict.items(): + + if key == 'customs_agent': + key = 'customs_broker_id' + elif key == 'provider': + key = 'provider_id' + + + if isinstance(value, str) and not value.strip(): + cleaned[key] = None + + elif value == 0 and (key.endswith('_id') or key == 'remesa'): + cleaned[key] = None + else: + cleaned[key] = value + return cleaned + - # Create main invoice header - invoice_dict = invoice_data.model_dump( - exclude={"compliance_mx", "financials", - "logistics", "details", "collections"} - ) - invoice_dict["tenant_id"] = tenant_id - invoice_dict["company_id"] = company_id + try: + # Extract nested data + compliance_data = invoice_data.compliance_mx + financials_data = invoice_data.financials + logistics_data = invoice_data.logistics or [] + details_data = invoice_data.details or [] + collections_data = invoice_data.collections or [] - new_invoice = models.InvoiceHeader(**invoice_dict) - db.add(new_invoice) - db.flush() # Flush to get the invoice ID + # Create main invoice header + raw_invoice_dict = invoice_data.model_dump( + exclude={"compliance_mx", "financials", + "logistics", "details", "collections"} + ) + invoice_dict = clean_dict(raw_invoice_dict) + invoice_dict["tenant_id"] = tenant_id + invoice_dict["company_id"] = company_id - # Create compliance_mx if provided - if compliance_data: - compliance_dict = compliance_data.model_dump() - compliance_dict["invoice_id"] = new_invoice.id - compliance_dict["tenant_id"] = tenant_id - compliance_dict["company_id"] = company_id - new_compliance = models.InvoiceComplianceMx(**compliance_dict) - db.add(new_compliance) + new_invoice = models.InvoiceHeader(**invoice_dict) + db.add(new_invoice) + db.flush() # Flush to get the invoice ID - # Create financials if provided - if financials_data: - financials_dict = financials_data.model_dump() - financials_dict["invoice_id"] = new_invoice.id - financials_dict["tenant_id"] = tenant_id - financials_dict["company_id"] = company_id - new_financials = models.InvoiceFinancials(**financials_dict) - db.add(new_financials) + # Create compliance_mx if provided + if compliance_data: + raw_comp_dict = compliance_data.model_dump() + # Pasamos los datos por la lavadora para arreglar pedimento, aduana, etc. + compliance_dict = clean_dict(raw_comp_dict) + + compliance_dict["invoice_id"] = new_invoice.id + compliance_dict["tenant_id"] = tenant_id + compliance_dict["company_id"] = company_id + + new_compliance = models.InvoiceComplianceMx(**compliance_dict) + db.add(new_compliance) - # Create logistics entries - for logistics_item in logistics_data: - logistics_dict = logistics_item.model_dump() - logistics_dict["invoice_id"] = new_invoice.id - logistics_dict["tenant_id"] = tenant_id - logistics_dict["company_id"] = company_id - new_logistics = models.InvoiceLogistics(**logistics_dict) - db.add(new_logistics) + # Create financials if provided + if financials_data: + raw_fin_dict = financials_data.model_dump() + financials_dict = clean_dict(raw_fin_dict) + + financials_dict["invoice_id"] = new_invoice.id + financials_dict["tenant_id"] = tenant_id + financials_dict["company_id"] = company_id + + new_financials = models.InvoiceFinancials(**financials_dict) + db.add(new_financials) - # Create sales details - for detail_item in details_data: - detail_dict = detail_item.model_dump() - detail_dict["invoice_id"] = new_invoice.id - detail_dict["tenant_id"] = tenant_id - detail_dict["company_id"] = company_id - new_detail = models.InvoiceSalesDetails(**detail_dict) - db.add(new_detail) + # Create logistics entries + for logistics_item in logistics_data: + raw_log_dict = logistics_item.model_dump() + logistics_dict = clean_dict(raw_log_dict) + + logistics_dict["invoice_id"] = new_invoice.id + logistics_dict["tenant_id"] = tenant_id + logistics_dict["company_id"] = company_id + new_logistics = models.InvoiceLogistics(**logistics_dict) + db.add(new_logistics) - # Create collections - for collection_item in collections_data: - collection_dict = collection_item.model_dump() - collection_dict["invoice_id"] = new_invoice.id - collection_dict["tenant_id"] = tenant_id - collection_dict["company_id"] = company_id - new_collection = models.InvoiceCollections(**collection_dict) - db.add(new_collection) + # Create sales details + for detail_item in details_data: + raw_det_dict = detail_item.model_dump() + detail_dict = clean_dict(raw_det_dict) + + detail_dict["invoice_id"] = new_invoice.id + detail_dict["tenant_id"] = tenant_id + detail_dict["company_id"] = company_id + new_detail = models.InvoiceSalesDetails(**detail_dict) + db.add(new_detail) - db.commit() - db.refresh(new_invoice) - return new_invoice + # Create collections + for collection_item in collections_data: + raw_col_dict = collection_item.model_dump() + collection_dict = clean_dict(raw_col_dict) + + collection_dict["invoice_id"] = new_invoice.id + collection_dict["tenant_id"] = tenant_id + collection_dict["company_id"] = company_id + new_collection = models.InvoiceCollections(**collection_dict) + db.add(new_collection) + + db.commit() + db.refresh(new_invoice) + return new_invoice + + except Exception as e: + db.rollback() + print("\n\n🔥 ERROR AL GUARDAR FACTURA 🔥") + print(f"Error: {str(e)}") + traceback.print_exc() # Esto imprime el error real en la consola + print("--------------------------------\n") + raise e @staticmethod def update( @@ -148,7 +192,8 @@ class InvoiceService: invoice_data: schemas.InvoiceHeaderUpdate, company_id: int ) -> Optional[models.InvoiceHeader]: - """Update an existing invoice and its related data""" + # ... (El resto de tu código update se queda igual) ... + # (Te recomiendo implementar clean_dict aquí también si tienes problemas al editar) invoice = InvoiceService.get_by_id( db, invoice_id, tenant_id, company_id) if not invoice: @@ -167,9 +212,14 @@ class InvoiceService: if invoice_data.compliance_mx is not None: if invoice.compliance_mx: for key, value in invoice_data.compliance_mx.model_dump(exclude_unset=True).items(): + # Parche rápido para update + if value == "": value = None setattr(invoice.compliance_mx, key, value) else: compliance_dict = invoice_data.compliance_mx.model_dump() + # Aplicar limpieza manual si es necesario + if 'customs_agent' in compliance_dict: compliance_dict['customs_broker_id'] = compliance_dict.pop('customs_agent') + compliance_dict["invoice_id"] = invoice.id compliance_dict["tenant_id"] = tenant_id compliance_dict["company_id"] = company_id @@ -180,6 +230,7 @@ class InvoiceService: if invoice_data.financials is not None: if invoice.financials: for key, value in invoice_data.financials.model_dump(exclude_unset=True).items(): + if value == "": value = None setattr(invoice.financials, key, value) else: financials_dict = invoice_data.financials.model_dump() @@ -189,9 +240,6 @@ class InvoiceService: new_financials = models.InvoiceFinancials(**financials_dict) db.add(new_financials) - # Note: For logistics, details, and collections, we're not handling updates here - # as they are typically managed through separate endpoints for complex operations - db.commit() db.refresh(invoice) return invoice @@ -205,172 +253,4 @@ class InvoiceService: db.delete(invoice) db.commit() return True - return False - - -class InvoiceLogisticsService: - """Service for Invoice Logistics operations""" - - @staticmethod - def get_by_id(db: Session, logistics_id: int, invoice_id: int) -> Optional[models.InvoiceLogistics]: - """Get a logistics entry by ID""" - return ( - db.query(models.InvoiceLogistics) - .filter( - models.InvoiceLogistics.logistics_id == logistics_id, - models.InvoiceLogistics.invoice_id == invoice_id, - ) - .first() - ) - - @staticmethod - def get_all_by_invoice(db: Session, invoice_id: int) -> List[models.InvoiceLogistics]: - """Get all logistics entries for an invoice""" - return ( - db.query(models.InvoiceLogistics) - .filter(models.InvoiceLogistics.invoice_id == invoice_id) - .all() - ) - - @staticmethod - def create( - db: Session, - logistics_data: schemas.InvoiceLogisticsCreate, - invoice_id: int, - tenant_id: int, - company_id: int - ) -> models.InvoiceLogistics: - """Create a new logistics entry""" - logistics_dict = logistics_data.model_dump() - logistics_dict["invoice_id"] = invoice_id - logistics_dict["tenant_id"] = tenant_id - logistics_dict["company_id"] = company_id - - new_logistics = models.InvoiceLogistics(**logistics_dict) - db.add(new_logistics) - db.commit() - db.refresh(new_logistics) - return new_logistics - - @staticmethod - def delete(db: Session, logistics_id: int, invoice_id: int) -> bool: - """Delete a logistics entry""" - logistics = InvoiceLogisticsService.get_by_id( - db, logistics_id, invoice_id) - if logistics: - db.delete(logistics) - db.commit() - return True - return False - - -class InvoiceSalesDetailsService: - """Service for Invoice Sales Details operations""" - - @staticmethod - def get_by_id(db: Session, detail_id: int, invoice_id: int) -> Optional[models.InvoiceSalesDetails]: - """Get a sales detail entry by ID""" - return ( - db.query(models.InvoiceSalesDetails) - .filter( - models.InvoiceSalesDetails.detail_id == detail_id, - models.InvoiceSalesDetails.invoice_id == invoice_id, - ) - .first() - ) - - @staticmethod - def get_all_by_invoice(db: Session, invoice_id: int) -> List[models.InvoiceSalesDetails]: - """Get all sales details for an invoice""" - return ( - db.query(models.InvoiceSalesDetails) - .filter(models.InvoiceSalesDetails.invoice_id == invoice_id) - .all() - ) - - @staticmethod - def create( - db: Session, - detail_data: schemas.InvoiceSalesDetailsCreate, - invoice_id: int, - tenant_id: int, - company_id: int - ) -> models.InvoiceSalesDetails: - """Create a new sales detail entry""" - detail_dict = detail_data.model_dump() - detail_dict["invoice_id"] = invoice_id - detail_dict["tenant_id"] = tenant_id - detail_dict["company_id"] = company_id - - new_detail = models.InvoiceSalesDetails(**detail_dict) - db.add(new_detail) - db.commit() - db.refresh(new_detail) - return new_detail - - @staticmethod - def delete(db: Session, detail_id: int, invoice_id: int) -> bool: - """Delete a sales detail entry""" - detail = InvoiceSalesDetailsService.get_by_id( - db, detail_id, invoice_id) - if detail: - db.delete(detail) - db.commit() - return True - return False - - -class InvoiceCollectionsService: - """Service for Invoice Collections operations""" - - @staticmethod - def get_by_id(db: Session, collection_id: int, invoice_id: int) -> Optional[models.InvoiceCollections]: - """Get a collection entry by ID""" - return ( - db.query(models.InvoiceCollections) - .filter( - models.InvoiceCollections.collection_id == collection_id, - models.InvoiceCollections.invoice_id == invoice_id, - ) - .first() - ) - - @staticmethod - def get_all_by_invoice(db: Session, invoice_id: int) -> List[models.InvoiceCollections]: - """Get all collections for an invoice""" - return ( - db.query(models.InvoiceCollections) - .filter(models.InvoiceCollections.invoice_id == invoice_id) - .all() - ) - - @staticmethod - def create( - db: Session, - collection_data: schemas.InvoiceCollectionsCreate, - invoice_id: int, - tenant_id: int, - company_id: int - ) -> models.InvoiceCollections: - """Create a new collection entry""" - collection_dict = collection_data.model_dump() - collection_dict["invoice_id"] = invoice_id - collection_dict["tenant_id"] = tenant_id - collection_dict["company_id"] = company_id - - new_collection = models.InvoiceCollections(**collection_dict) - db.add(new_collection) - db.commit() - db.refresh(new_collection) - return new_collection - - @staticmethod - def delete(db: Session, collection_id: int, invoice_id: int) -> bool: - """Delete a collection entry""" - collection = InvoiceCollectionsService.get_by_id( - db, collection_id, invoice_id) - if collection: - db.delete(collection) - db.commit() - return True - return False + return False \ No newline at end of file diff --git a/estructura.txt b/estructura.txt new file mode 100644 index 00000000..aa2beccb --- /dev/null +++ b/estructura.txt @@ -0,0 +1,1190 @@ +. +├── 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/create-edit-dialog.svelte b/frontend/src/lib/components/dashboard/invoices/create-edit-dialog.svelte index 94004867..4e0eef19 100644 --- a/frontend/src/lib/components/dashboard/invoices/create-edit-dialog.svelte +++ b/frontend/src/lib/components/dashboard/invoices/create-edit-dialog.svelte @@ -315,7 +315,7 @@ - + {isEditing ? "Editar Factura" : "Nueva Factura"} diff --git a/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.server.ts b/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.server.ts index 54f3eb0b..f72744df 100644 --- a/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.server.ts +++ b/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.server.ts @@ -42,9 +42,9 @@ export const load: PageServerLoad = async ({ fetch, cookies, url, parent }) => { }; } - // Obtener filtro de tipo de operación - const operationType = 'exp' - const invoiceType = 'exp' + // Obtener filtros de la URL + const operationType = 'exp'; + const invoiceType = url.searchParams.get('invoice_type') || ''; // Construir parámetros de consulta const params = new URLSearchParams({ @@ -53,16 +53,15 @@ export const load: PageServerLoad = async ({ fetch, cookies, url, parent }) => { page_size: '50' }); - // Agregar filtro de tipo si existe y no es 'all' + // Agregar filtro de tipo de operación si existe y no es 'all' if (operationType && operationType !== 'all') { params.append('operation_type', operationType); } - - // Agregar filtro de invoice_type si existe - if (invoiceType) { + // Agregar filtro de invoice_type si existe y no está vacío + if (invoiceType && invoiceType !== '') { params.append('invoice_type', invoiceType); } - + // Usar authenticatedFetch para manejar automáticamente el refresh de tokens const response = await authenticatedFetch( `v1/a76/invoices?${params.toString()}`, @@ -81,7 +80,7 @@ export const load: PageServerLoad = async ({ fetch, cookies, url, parent }) => { error: 'Error al cargar facturas', companies: parentData.companies || [], currentCompanyId: companyId, - operationType: operationType || 'all', + operationType: operationType || 'exp', invoiceType: invoiceType || null }; } @@ -95,7 +94,7 @@ export const load: PageServerLoad = async ({ fetch, cookies, url, parent }) => { page_size: data.page_size || 50, companies: parentData.companies || [], currentCompanyId: companyId, - operationType: operationType || 'all', + operationType: operationType || 'exp', invoiceType: invoiceType || null }; } catch (error) { @@ -107,7 +106,7 @@ export const load: PageServerLoad = async ({ fetch, cookies, url, parent }) => { page_size: 50, error: 'Error al cargar facturas', companies: parentData.companies || [], - operationType: 'all', + operationType: 'exp', invoiceType: null }; } diff --git a/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.svelte b/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.svelte index 0a837d10..3697bf25 100644 --- a/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.svelte +++ b/frontend/src/routes/dashboard/invoices/exportacion/exportacion/+page.svelte @@ -267,7 +267,7 @@ Gestiona las facturas de importación y exportación

- diff --git a/frontend/src/routes/dashboard/invoices/exportacion/exportacion/new/+page.svelte b/frontend/src/routes/dashboard/invoices/exportacion/exportacion/new/+page.svelte new file mode 100644 index 00000000..1feb1929 --- /dev/null +++ b/frontend/src/routes/dashboard/invoices/exportacion/exportacion/new/+page.svelte @@ -0,0 +1,401 @@ + + +
+ +
+ +
+

Nueva Factura Exportación

+

Ingresa los datos para registrar la operación.

+
+
+ + {#if error} +
+ ⚠️ {error} +
+ {/if} + +
+ + + + + + +
+ +
+ +
Exportación
+
+ +
+ + formData.invoice_type = v} + > + + {#if formData.invoice_type} + {INVOICE_TYPES_OPTIONS.find(t => t.value === formData.invoice_type)?.label} + {:else} + Seleccionar tipo + {/if} + + + + {#each INVOICE_TYPES_OPTIONS as type} + + {type.label} + + {/each} + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + + General + Cumplimiento + Financieros + + +
+ +
+ +
+ +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/frontend/src/routes/dashboard/invoices/exportacion/reparacion/+page.svelte b/frontend/src/routes/dashboard/invoices/exportacion/reparacion/+page.svelte index 0a837d10..5921b9fa 100644 --- a/frontend/src/routes/dashboard/invoices/exportacion/reparacion/+page.svelte +++ b/frontend/src/routes/dashboard/invoices/exportacion/reparacion/+page.svelte @@ -231,8 +231,7 @@ } function handleCreateClick() { - selectedInvoice = null; - showCreateDialog = true; + goto('/dashboard/invoices/importacion/reparacion/new'); } function handleView(invoice: Invoice) { @@ -267,7 +266,7 @@ Gestiona las facturas de importación y exportación

- diff --git a/frontend/src/routes/dashboard/invoices/exportacion/reparacion/new/+page.svelte b/frontend/src/routes/dashboard/invoices/exportacion/reparacion/new/+page.svelte new file mode 100644 index 00000000..5ce4885e --- /dev/null +++ b/frontend/src/routes/dashboard/invoices/exportacion/reparacion/new/+page.svelte @@ -0,0 +1,325 @@ + + +
+ +
+ +
+

Nueva Factura Reparacion

+

Ingresa los datos para registrar la exportación.

+
+
+ + {#if error} +
+ {error} +
+ {/if} + +
+ + + + + + +
+ +
+ +
Importación
+
+ +
+ +
REPARACION (REPAR)
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + + General + Cumplimiento + Financieros + + +
+ +
+ +
+ +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/frontend/src/routes/dashboard/invoices/importacion/cambio_regimen/new/+page.svelte b/frontend/src/routes/dashboard/invoices/importacion/cambio_regimen/new/+page.svelte index 76f88411..75178fdd 100644 --- a/frontend/src/routes/dashboard/invoices/importacion/cambio_regimen/new/+page.svelte +++ b/frontend/src/routes/dashboard/invoices/importacion/cambio_regimen/new/+page.svelte @@ -3,9 +3,8 @@ import { Button } from "$lib/components/ui/button"; import { Input } from "$lib/components/ui/input"; import { Label } from "$lib/components/ui/label"; - import * as Select from "$lib/components/ui/select"; import * as Tabs from "$lib/components/ui/tabs"; - import * as Card from "$lib/components/ui/card"; // Usamos Card para enmarcar + import * as Card from "$lib/components/ui/card"; import { invoicesApi, type CreateInvoiceData } from "$lib/api/dashboard/a76/invoices"; import { companyStore } from "$lib/stores/company.svelte"; import { LoaderCircle, ArrowLeft, Save } from 'lucide-svelte'; @@ -67,8 +66,9 @@ async function handleSubmit(e: Event) { e.preventDefault(); - if (!companyStore.activeCompany) { - error = "No hay compañía seleccionada"; + // VALIDACIÓN DE SEGURIDAD (Por si se refresca la página) + if (!companyStore.activeCompany?.id) { + error = "Error: No se detecta la compañía activa. Por favor, vuelve al dashboard y selecciona una compañía."; return; } @@ -76,7 +76,7 @@ error = null; try { - // Construimos el Payload + // Construimos el Payload (LÓGICA ORIGINAL QUE FUNCIONA) const payload: CreateInvoiceData = { ...formData, // Aseguramos que se envíen los fijos @@ -108,7 +108,7 @@ } -
+
@@ -314,7 +318,8 @@ Guardar Factura {/if} - - +
+
+
\ No newline at end of file diff --git a/frontend/src/routes/dashboard/invoices/importacion/compras_mexicanas/new/+page.svelte b/frontend/src/routes/dashboard/invoices/importacion/compras_mexicanas/new/+page.svelte index 488312d0..ae160c91 100644 --- a/frontend/src/routes/dashboard/invoices/importacion/compras_mexicanas/new/+page.svelte +++ b/frontend/src/routes/dashboard/invoices/importacion/compras_mexicanas/new/+page.svelte @@ -3,14 +3,13 @@ import { Button } from "$lib/components/ui/button"; import { Input } from "$lib/components/ui/input"; import { Label } from "$lib/components/ui/label"; - import * as Select from "$lib/components/ui/select"; import * as Tabs from "$lib/components/ui/tabs"; - import * as Card from "$lib/components/ui/card"; // Usamos Card para enmarcar + import * as Card from "$lib/components/ui/card"; import { invoicesApi, type CreateInvoiceData } from "$lib/api/dashboard/a76/invoices"; import { companyStore } from "$lib/stores/company.svelte"; import { LoaderCircle, ArrowLeft, Save } from 'lucide-svelte'; - // DATOS FIJOS PARA ESTA CARPETA (COMPRAS MEXICANAS) + // DATOS FIJOS PARA ESTA CARPETA (DEFINITIVA) const FIXED_OP_TYPE = "imp"; const FIXED_INV_TYPE = "MEX"; @@ -67,8 +66,9 @@ async function handleSubmit(e: Event) { e.preventDefault(); - if (!companyStore.activeCompany) { - error = "No hay compañía seleccionada"; + // VALIDACIÓN DE SEGURIDAD (Por si se refresca la página) + if (!companyStore.activeCompany?.id) { + error = "Error: No se detecta la compañía activa. Por favor, vuelve al dashboard y selecciona una compañía."; return; } @@ -76,7 +76,7 @@ error = null; try { - // Construimos el Payload + // Construimos el Payload (LÓGICA ORIGINAL QUE FUNCIONA) const payload: CreateInvoiceData = { ...formData, // Aseguramos que se envíen los fijos @@ -108,21 +108,21 @@ } -
+
-

Nueva Factura

+

Nueva Factura Compras Mexicanas

Ingresa los datos para registrar la importación.

{#if error}
- ⚠️ {error} + {error}
{/if} @@ -131,14 +131,9 @@ - - General - Cumplimiento - Financieros - -
+
@@ -195,7 +190,7 @@ -
+
@@ -239,7 +234,7 @@ -
+
@@ -297,12 +292,21 @@
+ + General + Cumplimiento + Financieros + + - - - - +
+
+
\ No newline at end of file diff --git a/frontend/src/routes/dashboard/invoices/importacion/definitiva/new/+page.svelte b/frontend/src/routes/dashboard/invoices/importacion/definitiva/new/+page.svelte index 57e4fc64..e674b384 100644 --- a/frontend/src/routes/dashboard/invoices/importacion/definitiva/new/+page.svelte +++ b/frontend/src/routes/dashboard/invoices/importacion/definitiva/new/+page.svelte @@ -3,9 +3,8 @@ import { Button } from "$lib/components/ui/button"; import { Input } from "$lib/components/ui/input"; import { Label } from "$lib/components/ui/label"; - import * as Select from "$lib/components/ui/select"; import * as Tabs from "$lib/components/ui/tabs"; - import * as Card from "$lib/components/ui/card"; // Usamos Card para enmarcar + import * as Card from "$lib/components/ui/card"; import { invoicesApi, type CreateInvoiceData } from "$lib/api/dashboard/a76/invoices"; import { companyStore } from "$lib/stores/company.svelte"; import { LoaderCircle, ArrowLeft, Save } from 'lucide-svelte'; @@ -67,8 +66,9 @@ async function handleSubmit(e: Event) { e.preventDefault(); - if (!companyStore.activeCompany) { - error = "No hay compañía seleccionada"; + // VALIDACIÓN DE SEGURIDAD (Por si se refresca la página) + if (!companyStore.activeCompany?.id) { + error = "Error: No se detecta la compañía activa. Por favor, vuelve al dashboard y selecciona una compañía."; return; } @@ -76,7 +76,7 @@ error = null; try { - // Construimos el Payload + // Construimos el Payload (LÓGICA ORIGINAL QUE FUNCIONA) const payload: CreateInvoiceData = { ...formData, // Aseguramos que se envíen los fijos @@ -108,7 +108,7 @@ } -
+
@@ -314,7 +318,8 @@ Guardar Factura {/if} - - +
+
+
\ No newline at end of file diff --git a/frontend/src/routes/dashboard/invoices/importacion/temporal/new/+page.svelte b/frontend/src/routes/dashboard/invoices/importacion/temporal/new/+page.svelte index fae289e8..873515b6 100644 --- a/frontend/src/routes/dashboard/invoices/importacion/temporal/new/+page.svelte +++ b/frontend/src/routes/dashboard/invoices/importacion/temporal/new/+page.svelte @@ -3,14 +3,13 @@ import { Button } from "$lib/components/ui/button"; import { Input } from "$lib/components/ui/input"; import { Label } from "$lib/components/ui/label"; - import * as Select from "$lib/components/ui/select"; import * as Tabs from "$lib/components/ui/tabs"; - import * as Card from "$lib/components/ui/card"; // Usamos Card para enmarcar + import * as Card from "$lib/components/ui/card"; import { invoicesApi, type CreateInvoiceData } from "$lib/api/dashboard/a76/invoices"; import { companyStore } from "$lib/stores/company.svelte"; import { LoaderCircle, ArrowLeft, Save } from 'lucide-svelte'; - // DATOS FIJOS PARA ESTA CARPETA (Temporal Importación) + // DATOS FIJOS PARA ESTA CARPETA (TEMINITIVA) const FIXED_OP_TYPE = "imp"; const FIXED_INV_TYPE = "TEM"; @@ -67,8 +66,9 @@ async function handleSubmit(e: Event) { e.preventDefault(); - if (!companyStore.activeCompany) { - error = "No hay compañía seleccionada"; + // VALIDACIÓN DE SEGURIDAD (Por si se refresca la página) + if (!companyStore.activeCompany?.id) { + error = "Error: No se detecta la compañía activa. Por favor, vuelve al dashboard y selecciona una compañía."; return; } @@ -76,7 +76,7 @@ error = null; try { - // Construimos el Payload + // Construimos el Payload (LÓGICA ORIGINAL QUE FUNCIONA) const payload: CreateInvoiceData = { ...formData, // Aseguramos que se envíen los fijos @@ -108,7 +108,7 @@ } -
+
@@ -314,7 +318,8 @@ Guardar Factura {/if} - - +
+
+
\ No newline at end of file