From dada17b54c464c44852f6a90c8e4a7f2f4df0dce Mon Sep 17 00:00:00 2001 From: Kevin_Ramirez Date: Fri, 13 Mar 2026 17:38:30 -0500 Subject: [PATCH 1/4] Partidas por tipo de factura en importacion --- .../a76/general_catalogs/identifiers/dto.py | 1 + .../general_catalogs/identifiers/models.py | 8 +- backend/api/v1/modules/a76/items/models.py | 9 +- backend/api/v1/modules/a76/items/schemas.py | 13 + .../api/v1/modules/a76/items/series/models.py | 3 + .../v1/modules/a76/items/series/schemas.py | 3 + backend/api/v1/modules/a76/items/service.py | 37 ++ .../a76/general_catalogs/identifiers.ts | 52 +++ frontend/src/lib/api/dashboard/a76/items.ts | 8 + .../fa/identifier-catalog-selector.svelte | 115 ++++++ .../edit/items/fa/item-sheet-fa.svelte | 17 +- .../edit/items/fa/tab-identifiers.svelte | 388 +++++++++++++++++- .../edit/items/fa/tab-labeling.svelte | 274 +++++++++++-- .../items/fa/valuation-method-selector.svelte | 108 +++++ .../src/lib/config/invoice-item-visibility.ts | 35 +- 15 files changed, 1015 insertions(+), 56 deletions(-) create mode 100644 frontend/src/lib/components/dashboard/invoices/edit/items/fa/identifier-catalog-selector.svelte create mode 100644 frontend/src/lib/components/dashboard/invoices/edit/items/fa/valuation-method-selector.svelte diff --git a/backend/api/v1/modules/a76/general_catalogs/identifiers/dto.py b/backend/api/v1/modules/a76/general_catalogs/identifiers/dto.py index 9432a023..e65af32e 100644 --- a/backend/api/v1/modules/a76/general_catalogs/identifiers/dto.py +++ b/backend/api/v1/modules/a76/general_catalogs/identifiers/dto.py @@ -32,6 +32,7 @@ class IdentifierDetailBase(BaseModel): part_line: Optional[int] = Field(None, description="Part Line") identifier_code: Optional[str] = Field( None, max_length=2, description="Identifier Code") + item_line_id: Optional[int] = Field(None, description="Item Line ID") module: Optional[str] = Field(None, max_length=20, description="Module") complement1: Optional[str] = Field( None, max_length=50, description="Complement 1") diff --git a/backend/api/v1/modules/a76/general_catalogs/identifiers/models.py b/backend/api/v1/modules/a76/general_catalogs/identifiers/models.py index daabe759..d81e700b 100644 --- a/backend/api/v1/modules/a76/general_catalogs/identifiers/models.py +++ b/backend/api/v1/modules/a76/general_catalogs/identifiers/models.py @@ -1,10 +1,13 @@ -from typing import Optional +from typing import Optional, TYPE_CHECKING from sqlalchemy import Integer, String, UniqueConstraint, ForeignKey from sqlalchemy.orm import Mapped, mapped_column, relationship from api.v1.common.base_models import TenantScopedMixin, TimestampMixin from core.database import Base +if TYPE_CHECKING: + from api.v1.modules.a76.items.models import LineItem + class Identifier(Base, TenantScopedMixin, TimestampMixin): __tablename__ = "identifiers" __table_args__ = ( @@ -44,6 +47,8 @@ class IdentifierDetail(Base, TenantScopedMixin, TimestampMixin): Integer, nullable=True) # LINEAPARTIDA identifier_code: Mapped[Optional[str]] = mapped_column( String(2), ForeignKey("a76.identifiers.code"), nullable=True) # ID + item_line_id: Mapped[Optional[int]] = mapped_column( + ForeignKey("a76.item_lines.id"), nullable=True) module: Mapped[Optional[str]] = mapped_column( String(20), nullable=True) # MODULO complement1: Mapped[Optional[str]] = mapped_column( @@ -54,3 +59,4 @@ class IdentifierDetail(Base, TenantScopedMixin, TimestampMixin): String(50), nullable=True) # COMPLEMENTO3 identifier: Mapped["Identifier"] = relationship(back_populates="details") + line: Mapped[Optional["LineItem"]] = relationship(back_populates="identifiers") diff --git a/backend/api/v1/modules/a76/items/models.py b/backend/api/v1/modules/a76/items/models.py index c966c459..e9bcb55a 100644 --- a/backend/api/v1/modules/a76/items/models.py +++ b/backend/api/v1/modules/a76/items/models.py @@ -4,7 +4,7 @@ SQLAlchemy v2 - Annex 24 Compliance """ from datetime import datetime -from typing import Optional, TYPE_CHECKING +from typing import Optional, List, TYPE_CHECKING from core.database import Base from decimal import Decimal from sqlalchemy import Boolean, Date, String, Integer, Numeric, SmallInteger, ForeignKey @@ -24,6 +24,7 @@ if TYPE_CHECKING: from api.v1.modules.a24.fa.fa_item_lines.models import FaLineItem from api.v1.modules.a76.parts.models import Part from api.v1.modules.a76.invoices.models import InvoiceHeader + from api.v1.modules.a76.general_catalogs.identifiers.models import IdentifierDetail # ============================================================================ # CORE ENTITIES @@ -216,10 +217,14 @@ class LineItem(Base, TenantScopedMixin, TimestampMixin): ) fa_data: Mapped[Optional["FaLineItem"]] = relationship( "FaLineItem", - back_populates="master_info", cascade="all, delete-orphan", uselist=False, ) + identifiers: Mapped[List["IdentifierDetail"]] = relationship( + "IdentifierDetail", + back_populates="line", + cascade="all, delete-orphan", + ) part_info: Mapped[Optional["Part"]] = relationship( "Part", foreign_keys=[part_number_id], diff --git a/backend/api/v1/modules/a76/items/schemas.py b/backend/api/v1/modules/a76/items/schemas.py index a752701e..099a8571 100644 --- a/backend/api/v1/modules/a76/items/schemas.py +++ b/backend/api/v1/modules/a76/items/schemas.py @@ -37,6 +37,12 @@ from .line_references.schemas import ( LineReferenceResponse, ) +from api.v1.modules.a76.general_catalogs.identifiers.dto import ( + IdentifierDetailCreate, + IdentifierDetailUpdate, + IdentifierDetailResponse, +) +from api.v1.modules.a76.classes.models import Class from api.v1.modules.a24.fa.fa_item_lines.dto import ( FaLineItemCreateDTO, FaLineItemUpdateDTO, @@ -238,6 +244,9 @@ class LineItemCreate(LineItemBase): series: Optional[list[SerieCreate]] = Field( None, description="Series data for this line (multiple per line)" ) + identifiers: Optional[list[IdentifierDetailCreate]] = Field( + None, description="Identifiers for this line" + ) class LineItemUpdate(LineItemBase): @@ -267,6 +276,9 @@ class LineItemUpdate(LineItemBase): series: Optional[list[SerieUpdate]] = Field( None, description="Series data for this line (replace all)" ) + identifiers: Optional[list[IdentifierDetailUpdate]] = Field( + None, description="Identifiers for this line" + ) class LineItemResponse(LineItemBase): @@ -295,6 +307,7 @@ class LineItemResponse(LineItemBase): reference: Optional[LineReferenceResponse] = None fa_data: Optional[FaLineItemResponseDTO] = None series: Optional[list[SerieResponse]] = None + identifiers: Optional[list[IdentifierDetailResponse]] = None # Fields populated from relationships class_code: Optional[str] = None diff --git a/backend/api/v1/modules/a76/items/series/models.py b/backend/api/v1/modules/a76/items/series/models.py index 6801b43a..9c9133d7 100644 --- a/backend/api/v1/modules/a76/items/series/models.py +++ b/backend/api/v1/modules/a76/items/series/models.py @@ -19,6 +19,9 @@ class Serie(Base, TenantScopedMixin, TimestampMixin): 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 + import_invoice: Mapped[Optional[str]] = mapped_column(String(15)) # FACTURAIMPO + import_line: Mapped[Optional[int]] = mapped_column(Integer) # LINEAIMPO + image_path: Mapped[Optional[str]] = mapped_column(String(255)) # PATH DE IMAGEN (MEX) \ No newline at end of file diff --git a/backend/api/v1/modules/a76/items/series/schemas.py b/backend/api/v1/modules/a76/items/series/schemas.py index e967a1d2..53d947d7 100644 --- a/backend/api/v1/modules/a76/items/series/schemas.py +++ b/backend/api/v1/modules/a76/items/series/schemas.py @@ -10,6 +10,9 @@ class SerieBase(BaseModel): brand: Optional[str] = Field(None, max_length=50, description="Brand (MARCA)") expo_brad: Optional[str] = Field(None, max_length=50, description="Expo brand (MARCAEXPO)") number_id: Optional[str] = Field(None, max_length=25, description="Number ID (NUMIDEXPO)") + import_invoice: Optional[str] = Field(None, max_length=15, description="Import invoice (FACTURAIMPO)") + import_line: Optional[int] = Field(None, description="Import line (LINEAIMPO)") + image_path: Optional[str] = Field(None, max_length=255, description="Image path (IMAGEPATHMEX)") class SerieCreate(SerieBase): diff --git a/backend/api/v1/modules/a76/items/service.py b/backend/api/v1/modules/a76/items/service.py index 4f3cb2d3..bb93666d 100644 --- a/backend/api/v1/modules/a76/items/service.py +++ b/backend/api/v1/modules/a76/items/service.py @@ -40,6 +40,7 @@ from .models import LineItem from .series.models import Serie from api.v1.modules.a76.invoices.models import InvoiceHeader from api.v1.modules.a76.parts.models import Part +from api.v1.modules.a76.general_catalogs.identifiers.models import IdentifierDetail logger = logging.getLogger(__name__) @@ -195,6 +196,26 @@ class ItemService: serie_dict["row"] = 1 db.add(Serie(**serie_dict)) + # Identifier Detail data + if hasattr(line_data, "identifiers") and line_data.identifiers: + id_list = ( + line_data.identifiers + if isinstance(line_data.identifiers, list) + else [line_data.identifiers] + ) + for d in id_list: + id_dict = ( + d.model_dump(exclude_unset=True) + if hasattr(d, "model_dump") + else (dict(d) if isinstance(d, dict) else {}) + ) + if not id_dict: + continue + id_dict["item_line_id"] = line.id + id_dict["tenant_id"] = tenant_id + id_dict["company_id"] = company_id + db.add(IdentifierDetail(**id_dict)) + @staticmethod def _attach_series(db: Session, item: LineItem) -> None: """Query and attach all Serie rows for this item as a list.""" @@ -206,6 +227,16 @@ class ItemService: ) item.series = list(series) + @staticmethod + def _attach_identifiers(db: Session, item: LineItem) -> None: + """Query and attach all IdentifierDetail rows for this item.""" + identifiers = ( + db.query(IdentifierDetail) + .filter(IdentifierDetail.item_line_id == item.id) + .all() + ) + item.identifiers = list(identifiers) + @staticmethod def get_by_id( db: Session, item_id: int, tenant_id: int, company_id: int @@ -232,6 +263,7 @@ class ItemService: ) if result: ItemService._attach_series(db, result) + ItemService._attach_identifiers(db, result) return result @staticmethod @@ -285,6 +317,7 @@ class ItemService: items = query.offset(skip).limit(limit).all() for item in items: ItemService._attach_series(db, item) + ItemService._attach_identifiers(db, item) return items, total @staticmethod @@ -318,6 +351,7 @@ class ItemService: items = query.offset(skip).limit(limit).all() for item in items: ItemService._attach_series(db, item) + ItemService._attach_identifiers(db, item) return items, total @staticmethod @@ -443,6 +477,7 @@ class ItemService: db.commit() db.refresh(db_item) ItemService._attach_series(db, db_item) + ItemService._attach_identifiers(db, db_item) return db_item except IntegrityError as e: @@ -591,6 +626,7 @@ class ItemService: ).delete() db.query(FaLineItem).filter(FaLineItem.id == db_item.id).delete() db.query(Serie).filter(Serie.line_item_id == db_item.id).delete() + db.query(IdentifierDetail).filter(IdentifierDetail.item_line_id == db_item.id).delete() db.flush() # Create new nested data @@ -604,6 +640,7 @@ class ItemService: db.commit() db.refresh(db_item) ItemService._attach_series(db, db_item) + ItemService._attach_identifiers(db, db_item) return db_item except HTTPException: diff --git a/frontend/src/lib/api/dashboard/a76/general_catalogs/identifiers.ts b/frontend/src/lib/api/dashboard/a76/general_catalogs/identifiers.ts index 98660069..15be7cc2 100644 --- a/frontend/src/lib/api/dashboard/a76/general_catalogs/identifiers.ts +++ b/frontend/src/lib/api/dashboard/a76/general_catalogs/identifiers.ts @@ -35,6 +35,33 @@ export interface IdentifierListResponse { pages: number; } +export interface IdentifierDetail { + id: number; + invoice_consecutive: number | null; + part_line: number | null; + identifier_code: string | null; + module: string | null; + complement1: string | null; + complement2: string | null; + complement3: string | null; + item_line_id: number | null; + company_id: number; + tenant_id: number; +} + +export interface IdentifierDetailCreate { + invoice_consecutive?: number | null; + part_line?: number | null; + identifier_code?: string | null; + module?: string | null; + complement1?: string | null; + complement2?: string | null; + complement3?: string | null; + item_line_id?: number | null; +} + +export interface IdentifierDetailUpdate extends Partial { } + export async function getIdentifiers( page = 1, pageSize = 50, @@ -71,4 +98,29 @@ export async function deleteIdentifier( companyId: number ): Promise> { return await api.delete(`/v1/a76/identifiers/${id}/?company_id=${companyId}`); +} + +/** + * API for Identifier Details + */ +export async function createIdentifierDetail( + data: IdentifierDetailCreate, + companyId: number +): Promise> { + return await api.post(`/v1/a76/identifiers/details/?company_id=${companyId}`, data); +} + +export async function updateIdentifierDetail( + id: number, + data: IdentifierDetailUpdate, + companyId: number +): Promise> { + return await api.put(`/v1/a76/identifiers/details/${id}/?company_id=${companyId}`, data); +} + +export async function deleteIdentifierDetail( + id: number, + companyId: number +): Promise> { + return await api.delete(`/v1/a76/identifiers/details/${id}/?company_id=${companyId}`); } \ No newline at end of file diff --git a/frontend/src/lib/api/dashboard/a76/items.ts b/frontend/src/lib/api/dashboard/a76/items.ts index 1c7f2a75..f63dc394 100644 --- a/frontend/src/lib/api/dashboard/a76/items.ts +++ b/frontend/src/lib/api/dashboard/a76/items.ts @@ -88,6 +88,10 @@ export interface LineReferences { serie_id?: number; } +import type { + IdentifierDetail +} from './general_catalogs/identifiers'; + export interface Serie { id?: number; line_item_id?: number; @@ -98,6 +102,9 @@ export interface Serie { brand?: string; expo_brad?: string; number_id?: string; + import_invoice?: string; + import_line?: number; + image_path?: string; } export interface FaLineItem { @@ -207,6 +214,7 @@ export interface Item { reference?: LineReferences; fa_data?: FaLineItem; // Fixed Asset specific data series?: Serie[]; // Series data (multiple per line) + identifiers?: IdentifierDetail[]; // Identifiers for this line } export interface ItemListResponse { diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/identifier-catalog-selector.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/identifier-catalog-selector.svelte new file mode 100644 index 00000000..fe5f0c9d --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/identifier-catalog-selector.svelte @@ -0,0 +1,115 @@ + + + + + + Seleccionar Identificador + + Busca y selecciona un identificador del catálogo (Apéndice 8). + + + +
+
+ + +
+
+ +
+ {#if loading} +
+ +
+ {:else} + + + + Clave + Descripción + Nivel + + + + {#each filteredIdentifiers as item} + handleSelect(item)} + > + {item.code} + {item.description || '-'} + {item.level || '-'} + + {:else} + + + No se encontraron identificadores. + + + {/each} + + + {/if} +
+
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-sheet-fa.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-sheet-fa.svelte index 2ed9af1f..55aac6c8 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-sheet-fa.svelte +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-sheet-fa.svelte @@ -216,7 +216,7 @@ { value: 'generales', label: 'General', visible: true }, { value: 'continuacion', label: 'Continuación', visible: true }, { value: 'series', label: 'Series', visible: true }, - { value: 'etiquetado', label: 'Etiquetado', visible: true }, + { value: 'etiquetado', label: 'Etiquetado', visible: visibility.showLabelingTab }, { value: 'identificadores', label: 'IDs', visible: visibility.showIdentifiersTab } ].filter((tab) => tab.visible)); const tabListStyle = $derived(`grid-template-columns: repeat(${visibleTabs.length || 1}, minmax(0, 1fr));`); @@ -544,13 +544,20 @@ /> - - - + {#if visibility.showLabelingTab} + + + + {/if} {#if visibility.showIdentifiersTab} - + {/if} diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-identifiers.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-identifiers.svelte index 9b77f822..9600aa83 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-identifiers.svelte +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-identifiers.svelte @@ -1,26 +1,376 @@ -
- Identifiers - -
- - -
+
+ {#if visibility.showMexicanIdEnhanced} + +
+ + Activos / Num. Etiquetado (MEX) + + +
+ +
-
- - -
-
+
+ + + + Asset Number + Num. Factura + Línea + Imagen + Acciones + + + + {#if lineItem.series && lineItem.series.length > 0} + {#each lineItem.series as asset, index} + + {asset.number_id} + {asset.import_invoice || '-'} + {asset.import_line || '-'} + + {#if asset.image_path} +
+ +
+ {:else} + - + {/if} +
+ +
+ + +
+
+
+ {/each} + {:else} + + + No hay activos registrados. + + + {/if} +
+
+
+
+ {:else} + +
+ + Tabla de Identificadores + + +
+ +
+ +
+ + + + Clave + Compl. 1 + Compl. 2 + Compl. 3 + Acciones + + + + {#if lineItem.identifiers && lineItem.identifiers.length > 0} + {#each lineItem.identifiers as idDetail, index} + + {idDetail.identifier_code} + {idDetail.complement1 || '-'} + {idDetail.complement2 || '-'} + {idDetail.complement3 || '-'} + +
+ + +
+
+
+ {/each} + {:else} + + + No hay identificadores registrados. + + + {/if} +
+
+
+
+ {/if} + + + + + + + {isEditing ? 'Editar' : 'Insertar'} Identificador + + Ingrese los detalles del identificador para esta partida. + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + + + + +
+
+ + + + + + {isEditing ? 'Editar' : 'Insertar'} Asset Tag (Etiquetado) + + Detalles del etiquetado de activos para Compras Mexicanas. + + + +
+ +
+
+ +

{currentMexAsset.import_invoice || '-'}

+
+
+ +

{currentMexAsset.import_line || '-'}

+
+
+ + +
+
+ + +
+
+ +
+
+ {currentMexAsset.image_path || 'Ningún archivo seleccionado'} +
+ +
+
+
+
+ + + + + +
+
+ + diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte index 3e28e03e..8ce2cdb3 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte @@ -1,32 +1,256 @@ -
- Labeling - -
-
- - -
-
- - -
-
+
+ +
+ Labeling & Valuation + + {#if visibility.showLabelingStandard} +
+
+ + +
+
+ + +
+
+ {/if} -
- - -
-
+
+ {#if visibility.showLabelingEnhanced} + {#if visibility.showLabelingQuantity} +
+ + +
+ {/if} +
+ + +
+ {/if} +
+ + {#if visibility.showLabelingEnhanced} +
+ +
+ + +
+
+ + {#if visibility.showUsageReason} +
+ + +
+ {/if} + {/if} + + + {#if visibility.showLabelingStandard} +
+ + +
+ {/if} +
+ + {#if visibility.showLabelingEnhanced} + +
+ Assets / Series + +
+ +
+ +
+ + + + # + Asset Num + Factura + Línea + Acc + + + + {#each lineItem.series || [] as asset, i} + + {asset.row || i+1} + {asset.number_id || '-'} + {asset.import_invoice || '-'} + {asset.import_line || '-'} + +
+ + +
+
+
+ {:else} + + + No hay activos. + + + {/each} +
+
+
+ + {#if selectedAssetIndex !== null} +
+
Editar #{editingAsset.row}
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ {/if} +
+ {/if} + + + diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/valuation-method-selector.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/valuation-method-selector.svelte new file mode 100644 index 00000000..25a41a7f --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/valuation-method-selector.svelte @@ -0,0 +1,108 @@ + + + + + + Seleccionar Método de Valoración + + Busca y selecciona un método de valoración de la lista. + + + +
+
+ + +
+
+ +
+ {#if loading} +
+ +
+ {:else} + + + + Clave + Descripción + + + + {#each filteredMethods as method} + handleSelect(method)} + > + {method.key} + {method.description} + + {:else} + + + No se encontraron métodos de valoración. + + + {/each} + + + {/if} +
+
+
diff --git a/frontend/src/lib/config/invoice-item-visibility.ts b/frontend/src/lib/config/invoice-item-visibility.ts index 283660af..9570dda1 100644 --- a/frontend/src/lib/config/invoice-item-visibility.ts +++ b/frontend/src/lib/config/invoice-item-visibility.ts @@ -31,6 +31,18 @@ export interface InvoiceItemVisibility { showContinuationConsiderA31: boolean; /** Continuación tab: Extra Description in Spanish. */ showContinuationExtraDescription: boolean; + /** Etiquetado tab: Quantity, Valuation, Assets Table. */ + showLabelingEnhanced: boolean; + /** Identificadores tab: Special Assets table for MEX. */ + showMexicanIdEnhanced: boolean; + /** Etiquetado tab visibility. */ + showLabelingTab: boolean; + /** Etiquetado tab: Usage Reason field. */ + showUsageReason: boolean; + /** Etiquetado tab: Standard fields (Label No, Type, Observations). */ + showLabelingStandard: boolean; + /** Etiquetado tab: Quantity field. */ + showLabelingQuantity: boolean; } const defaultVisibility: InvoiceItemVisibility = { @@ -50,7 +62,13 @@ const defaultVisibility: InvoiceItemVisibility = { showContinuationOwnOmitAnnex: true, showContinuationLotEntry: true, showContinuationConsiderA31: true, - showContinuationExtraDescription: true + showContinuationExtraDescription: true, + showLabelingEnhanced: false, + showMexicanIdEnhanced: false, + showLabelingTab: true, + showUsageReason: false, + showLabelingStandard: true, + showLabelingQuantity: false }; function normalizeInvoiceType(invoiceType?: string | null): string { @@ -126,14 +144,21 @@ export function getVisibility( return { ...defaultVisibility, showCrTrackingHeader: false, - showFdaFcc: false + showFdaFcc: false, + showLabelingEnhanced: true, + showLabelingQuantity: true }; case 'CR': return { ...defaultVisibility, showEighthRule: false, - showValuationFields: true + showIdentifiersTab: true, + showValuationFields: true, + showUsageReason: true, + showLabelingEnhanced: true, + showLabelingQuantity: false, + showLabelingStandard: false }; case 'REP': @@ -165,7 +190,9 @@ export function getVisibility( showEighthRule: false, showFdaFcc: false, showCertificateOfOrigin: false, - showIdentifiersTab: false, + showIdentifiersTab: true, + showMexicanIdEnhanced: true, + showLabelingTab: false, showContinuationIgi: false, showContinuationLocation: true, showContinuationMilitary: false, From 63cbdf2124cbaf71433137f6c907fde334f5232b Mon Sep 17 00:00:00 2001 From: Kevin_Ramirez Date: Fri, 13 Mar 2026 17:56:15 -0500 Subject: [PATCH 2/4] Importacion de reparacion --- .../edit/items/fa/tab-labeling.svelte | 24 ++++++++++--------- .../src/lib/config/invoice-item-visibility.ts | 22 +++++++++++++---- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte index 8ce2cdb3..997558ea 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte @@ -111,16 +111,18 @@ /> {/if} -
- - -
+ {#if visibility.showLabelingValuationValue} +
+ + +
+ {/if} {/if} @@ -159,7 +161,7 @@ {/if} - {#if visibility.showLabelingStandard} + {#if visibility.showLabelingObservations}
{/if} - {/if} - - - {#if visibility.showLabelingObservations} -
- - -
- {/if} - + + {/if} {#if visibility.showLabelingEnhanced} diff --git a/frontend/src/lib/config/invoice-item-visibility.ts b/frontend/src/lib/config/invoice-item-visibility.ts index c1f702f9..d040537d 100644 --- a/frontend/src/lib/config/invoice-item-visibility.ts +++ b/frontend/src/lib/config/invoice-item-visibility.ts @@ -47,6 +47,10 @@ export interface InvoiceItemVisibility { showLabelingObservations: boolean; /** Etiquetado tab: Valuation field (Valor Det). */ showLabelingValuationValue: boolean; + /** Etiquetado tab: Valuation Method selector. */ + showLabelingValuationMethod: boolean; + /** Etiquetado tab: Whole left section (Legend + all fields). */ + showLabelingLeftSection: boolean; } const defaultVisibility: InvoiceItemVisibility = { @@ -74,7 +78,9 @@ const defaultVisibility: InvoiceItemVisibility = { showLabelingStandard: true, showLabelingQuantity: false, showLabelingObservations: true, - showLabelingValuationValue: false + showLabelingValuationValue: false, + showLabelingValuationMethod: true, + showLabelingLeftSection: true }; function normalizeInvoiceType(invoiceType?: string | null): string { @@ -130,8 +136,27 @@ export function getVisibility( const expVisibility: InvoiceItemVisibility = { ...defaultVisibility, showExportLinkToImportBlock: true, - showExportValuationFields: true + showExportValuationFields: true, + showLabelingEnhanced: true, + showUsageReason: true, + showLabelingValuationValue: true, + showLabelingStandard: false, + showLabelingObservations: false, + showLabelingQuantity: false }; + + // CHECK FOR EXPORT REPAIR (REP / REPAR) + const upInvoiceType = normalizeInvoiceType(invoiceType); + if (upInvoiceType === 'REP' || upInvoiceType === 'REPAR') { + return { + ...expVisibility, + showLabelingValuationMethod: false, + showLabelingValuationValue: false, + showUsageReason: false, + showLabelingLeftSection: false + }; + } + // Per-type overrides can be added here (e.g. hide valuation for SCRAP). switch (exportType) { case 'NODES': @@ -193,7 +218,8 @@ export function getVisibility( showLabelingQuantity: true, showLabelingStandard: true, showLabelingObservations: false, - showLabelingValuationValue: false + showLabelingValuationValue: false, + showLabelingValuationMethod: true }; case 'MEX': From 0f9b0bc23f17f4cc8ccd41fd3c8e67d82b837065 Mon Sep 17 00:00:00 2001 From: Kevin_Ramirez Date: Tue, 17 Mar 2026 12:49:37 -0500 Subject: [PATCH 4/4] archivo de prueba --- archivo.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 archivo.txt diff --git a/archivo.txt b/archivo.txt new file mode 100644 index 00000000..e69de29b