From 246f2d33f792467db82a6b940732f0e9a1522b69 Mon Sep 17 00:00:00 2001 From: Kevin_Ramirez Date: Thu, 7 May 2026 16:49:41 -0500 Subject: [PATCH] Se le agrego multiselect a las partes --- .../dashboard/goods/parts/data-table.svelte | 87 ++--- .../routes/dashboard/goods/parts/+page.svelte | 296 +++++++++++------- 2 files changed, 236 insertions(+), 147 deletions(-) diff --git a/frontend/src/lib/components/dashboard/goods/parts/data-table.svelte b/frontend/src/lib/components/dashboard/goods/parts/data-table.svelte index 5c7277cd..2e68fc0a 100644 --- a/frontend/src/lib/components/dashboard/goods/parts/data-table.svelte +++ b/frontend/src/lib/components/dashboard/goods/parts/data-table.svelte @@ -1,11 +1,8 @@ -
+
- - + + {#each table.getHeaderGroups() as headerGroup (headerGroup.id)} {#each headerGroup.headers as header (header.id)} - + {#if !header.isPlaceholder}
-
- {}} - {sorting} - onSortingChange={(newSorting) => (sorting = newSorting)} - onRowClick={selectPart} - onRowDoubleClick={(part) => { - if (!canEdit) { - toast.error('No tienes permiso para editar partes'); - return; - } - goto(`/dashboard/goods/parts/edit/${part.id}`); - }} - /> +
+
+ {}} + {sorting} + onSortingChange={(newSorting) => (sorting = newSorting)} + bind:rowSelection + onRowDoubleClick={(part) => { + if (!canEdit) { + toast.error('No tienes permiso para editar partes'); + return; + } + goto(`/dashboard/goods/parts/edit/${part.id}`); + }} + /> +
+
-
-

- Número de Parte -

-
-

- {selectedPart?.part_number || '---'} -

- {#if selectedPart?.inv_data && selectedPart?.fa_data} - AMBOS - {:else if selectedPart?.inv_data} - SCAI - {:else if selectedPart?.fa_data} - SCAF - {/if} + {#if selectedParts.length > 1} + +
+

+ Selección Múltiple +

+
+

+ {selectedParts.length} +

+ Partes seleccionadas +
+
+
+ +

+ Tienes múltiples partes seleccionadas.
+ Las acciones en lote aplicarán a todos los registros marcados. +

+
+ {:else if activePart} + +
+

+ Número de Parte +

+
+

+ {activePart.part_number || '---'} +

+ {#if activePart.inv_data && activePart.fa_data} + + AMBOS + + {:else if activePart.inv_data} + + SCAI + + {:else if activePart.fa_data} + + SCAF + + {/if} +
-
-
- {#if selectedPart} +

- {selectedPart.description_spanish || 'Sin descripción'} + {activePart.description_spanish || 'Sin descripción'}

@@ -332,64 +368,65 @@ >Description EN

- {selectedPart.description_english || 'No translation available'} + {activePart.description_english || 'No translation available'}

-
+
- {selectedPart.part_class || '-'} +
+ + {activePart.part_class || '-'} +
-
- -
- {selectedPart.unit_of_measure || '-'} + {activePart.unit_of_measure || '-'}
- {selectedPart.unit_weight || '-'} + {activePart.unit_weight || '-'}
- +

- {formatMexTariffDigitsForDisplay(selectedPart.fraction || '') || '0000.00.00'} + {formatMexTariffDigitsForDisplay(activePart.fraction || '') || '0000.00.00'}

- {#if selectedPart.unit_cost} + {#if activePart.unit_cost}
- +

- ${selectedPart.unit_cost} - {selectedPart.currency_key || 'USD'} + ${activePart.unit_cost} + {activePart.currency_key || 'USD'}

{/if} - {:else} -
- -

Selecciona una parte para ver sus detalles

-
- {/if} -
+
+ {:else} + +
+ +

Selecciona una o más partes para ver sus detalles

+
+ {/if}
{/if} @@ -397,6 +434,7 @@
+ {#if !isError}
- Nueva Parte + Insertar {/if} @@ -414,19 +452,63 @@ {/if} {#if canDelete} - {/if}
{/if} + + + + + + ¿Confirmar eliminación? + +
+ {#if selectedParts.length === 1} +

+ ¿Estás seguro que deseas eliminar la parte {activePart?.part_number}? +

+

+ {activePart?.description_spanish} +

+ {:else} +

+ ¿Estás seguro que deseas eliminar las {selectedParts.length} partes seleccionadas? +

+ {/if} +

Esta acción no se puede deshacer.

+
+ + + + +
+