Merge branch 'development' of https://git.aduanasoft.com/ADUANASOFT/anexo76 into fix/homogolizar_partidas_expo
This commit is contained in:
@@ -120,6 +120,14 @@
|
||||
body {
|
||||
@apply bg-background text-foreground overflow-x-hidden;
|
||||
}
|
||||
|
||||
/* Asegurar que el texto de los inputs de fecha sea legible en modo oscuro
|
||||
y en navegadores WebKit */
|
||||
input[type="date"],
|
||||
input[type="datetime-local"] {
|
||||
color: var(--color-foreground);
|
||||
-webkit-text-fill-color: var(--color-foreground);
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
let allItems = $state<UnitOfMeasure[]>([]); // Store full dataset
|
||||
let loading = $state(false);
|
||||
let searchTerm = $state("");
|
||||
let wasOpen = $state(false);
|
||||
|
||||
// Derived state for filtering
|
||||
$effect(() => {
|
||||
@@ -34,11 +35,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Cargar datos al abrir
|
||||
// Cargar datos al abrir y resetear búsqueda cada vez que se abre
|
||||
$effect(() => {
|
||||
if (open && companyStore.activeCompany && allItems.length === 0) {
|
||||
loadData();
|
||||
if (open && !wasOpen) {
|
||||
searchTerm = "";
|
||||
if (companyStore.activeCompany && allItems.length === 0) {
|
||||
loadData();
|
||||
}
|
||||
}
|
||||
wasOpen = open;
|
||||
});
|
||||
|
||||
async function loadData() {
|
||||
|
||||
@@ -70,6 +70,13 @@
|
||||
manualSorting: true // Sorting is handled server-side for this component
|
||||
});
|
||||
|
||||
function handleRowDoubleClick(row: any) {
|
||||
const invoice = row.original;
|
||||
if (invoice?.id) {
|
||||
window.location.href = `/dashboard/invoices/edit/${invoice.id}`;
|
||||
}
|
||||
}
|
||||
|
||||
let scrollContainer = $state<HTMLDivElement>();
|
||||
let loadingTrigger = $state<HTMLDivElement>();
|
||||
|
||||
@@ -200,6 +207,7 @@
|
||||
data-state={row.getIsSelected() && 'selected'}
|
||||
class="group/inv-list cursor-pointer {row.getIsSelected() ? 'catalog-table-row-selected' : 'catalog-table-row'}"
|
||||
onclick={() => onRowClick && onRowClick(row.original)}
|
||||
ondblclick={() => handleRowDoubleClick(row)}
|
||||
>
|
||||
{#each visibleCells as cell (cell.id)}
|
||||
{@const colId = cell.column.id}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="w-full">
|
||||
<div class="w-full" data-pedimento-list-table>
|
||||
<div
|
||||
class="min-h-[360px] max-h-[calc(100svh-420px)] overflow-auto rounded-md border bg-background [&_[data-slot=table-container]]:overflow-visible [&_[data-slot=table-container]]:w-full"
|
||||
bind:this={scrollContainer}
|
||||
@@ -105,7 +105,7 @@
|
||||
<Table.Root>
|
||||
<Table.Header class="sticky top-0 z-20 border-b bg-background/95 shadow-sm backdrop-blur-md">
|
||||
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
|
||||
<Table.Row>
|
||||
<Table.Row inTabOrder={false}>
|
||||
{#each headerGroup.headers as header (header.id)}
|
||||
{@const colId = header.column.id}
|
||||
<Table.Head
|
||||
@@ -180,6 +180,7 @@
|
||||
<Table.Body>
|
||||
{#each table.getRowModel().rows as row (row.id)}
|
||||
<Table.Row
|
||||
data-pedimento-data-row
|
||||
data-state={row.getIsSelected() && "selected"}
|
||||
onclick={() => {
|
||||
if (onRowClick) {
|
||||
@@ -208,7 +209,7 @@
|
||||
{/each}
|
||||
</Table.Row>
|
||||
{:else}
|
||||
<Table.Row>
|
||||
<Table.Row inTabOrder={false}>
|
||||
<Table.Cell colspan={columns.length} class="h-24 text-center">
|
||||
No hay resultados.
|
||||
</Table.Cell>
|
||||
@@ -217,7 +218,7 @@
|
||||
|
||||
<!-- Loading Trigger - Se activa cuando es visible -->
|
||||
{#if hasMore}
|
||||
<Table.Row>
|
||||
<Table.Row inTabOrder={false}>
|
||||
<Table.Cell colspan={columns.length} class="h-20 text-center">
|
||||
<div bind:this={loadingTrigger}>
|
||||
{#if loading}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
bind:this={ref}
|
||||
data-slot={dataSlot}
|
||||
class={cn(
|
||||
"selection:bg-primary dark:bg-input/30 selection:text-primary-foreground border-input ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 pt-1.5 text-sm font-medium outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50",
|
||||
"selection:bg-primary dark:bg-input/30 selection:text-primary-foreground border-input ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 pt-1.5 text-sm font-medium text-foreground outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
className
|
||||
@@ -40,7 +40,7 @@
|
||||
bind:this={ref}
|
||||
data-slot={dataSlot}
|
||||
class={cn(
|
||||
"border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base text-foreground outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
className
|
||||
|
||||
@@ -27,7 +27,7 @@ export const obtenerAtajosListaFacturas = (acciones: {
|
||||
}): ShortcutDef[] => [
|
||||
{ key: 'Alt+V', description: 'Ver Temporales', action: acciones.irTemporal },
|
||||
{ key: 'Alt+F', description: 'Ver Definitivas', action: acciones.irDefinitiva },
|
||||
{ key: 'Alt+N', description: 'Ver Nacionales', action: acciones.irNacional },
|
||||
{ key: 'Alt+Q', description: 'Ver Nacionales', action: acciones.irNacional },
|
||||
{ key: 'Alt+Z', description: 'Ver Cambio Régimen', action: acciones.irCambioRegimen },
|
||||
{ key: 'Alt+L', description: 'Ver Exportaciones', action: acciones.irExportacion },
|
||||
{ key: 'Alt+Y', description: 'Ver Reparaciones', action: acciones.irReparacion },
|
||||
|
||||
@@ -5,6 +5,8 @@ export const obtenerAtajosListaPedimento = (acciones: {
|
||||
manejarActualizar: () => void;
|
||||
manejarEditar: () => void;
|
||||
manejarEliminar: () => void;
|
||||
irATabla: () => void;
|
||||
irAAcciones: () => void;
|
||||
}): ShortcutDef[] => [
|
||||
{
|
||||
key: 'Alt+Shift+N',
|
||||
@@ -25,5 +27,17 @@ export const obtenerAtajosListaPedimento = (acciones: {
|
||||
key: 'Alt+Shift+D',
|
||||
description: 'Eliminar Seleccionado',
|
||||
action: acciones.manejarEliminar
|
||||
},
|
||||
{
|
||||
key: 'Alt+Shift+T',
|
||||
description: 'Ir a tabla de pedimentos',
|
||||
action: acciones.irATabla,
|
||||
skipDefaultFocusAfter: true
|
||||
},
|
||||
{
|
||||
key: 'Alt+Shift+A',
|
||||
description: 'Ir a acciones (barra inferior)',
|
||||
action: acciones.irAAcciones,
|
||||
skipDefaultFocusAfter: true
|
||||
}
|
||||
];
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold tracking-tight">Conceptos</h1>
|
||||
<p class="text-muted-foreground">Gestión del catálogo de conceptos</p>
|
||||
<p class="text-muted-foreground">Define los conceptos que se usan para capturar y clasificar cargos en la pestaña Cuenta de Gastos y A.A. del pedimento.</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<Button variant="outline" size="sm" class="h-9" onclick={reloadData}>
|
||||
|
||||
@@ -230,13 +230,52 @@ let filters = $state({
|
||||
}
|
||||
|
||||
// Keyboard Shortcuts
|
||||
/** Teclado: foco en la primera fila de datos de la tabla */
|
||||
function focusFirstPedimentoTableRow() {
|
||||
if (!browser) return;
|
||||
const row = document.querySelector<HTMLElement>(
|
||||
'[data-pedimento-list-table] tbody tr[data-pedimento-data-row][tabindex="0"]'
|
||||
);
|
||||
if (row) {
|
||||
row.focus();
|
||||
setTimeout(() => row.scrollIntoView({ behavior: 'smooth', block: 'nearest' }), 50);
|
||||
return;
|
||||
}
|
||||
toast.info('No hay filas en la tabla');
|
||||
}
|
||||
|
||||
/** Teclado: foco en el primer control habilitado de la barra de acciones fija */
|
||||
function focusPedimentoListFooterActions() {
|
||||
if (!browser) return;
|
||||
const footer = document.getElementById('pedimento-list-footer');
|
||||
if (!footer) return;
|
||||
const candidates = footer.querySelectorAll<HTMLElement>(
|
||||
'button, a[href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])'
|
||||
);
|
||||
for (const el of candidates) {
|
||||
if (el.offsetParent === null && el.getClientRects().length === 0) continue;
|
||||
if (el.hasAttribute('disabled')) continue;
|
||||
if ((el as HTMLButtonElement).disabled) continue;
|
||||
el.focus();
|
||||
setTimeout(() => el.scrollIntoView({ behavior: 'smooth', block: 'nearest' }), 50);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
footer.focus();
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
useShortcuts(
|
||||
'Pedimentos',
|
||||
obtenerAtajosListaPedimento({
|
||||
manejarCrear: handleCreateClick,
|
||||
manejarActualizar: reloadData,
|
||||
manejarEditar: handleEditSelected,
|
||||
manejarEliminar: handleDelete
|
||||
manejarEliminar: handleDelete,
|
||||
irATabla: focusFirstPedimentoTableRow,
|
||||
irAAcciones: focusPedimentoListFooterActions
|
||||
})
|
||||
);
|
||||
|
||||
@@ -535,6 +574,7 @@ let filters = $state({
|
||||
|
||||
<!-- Footer fijo con botones de acción -->
|
||||
<div
|
||||
id="pedimento-list-footer"
|
||||
class="fixed right-0 bottom-0 left-0 z-[5] ml-[calc(var(--sidebar-width))] border-t bg-background/95 shadow-lg backdrop-blur group-has-data-[state=collapsed]/sidebar-wrapper:ml-[calc(var(--sidebar-width-icon))] supports-[backdrop-filter]:bg-background/80"
|
||||
>
|
||||
<div class="mx-auto max-w-[1400px] px-4 py-4">
|
||||
|
||||
Reference in New Issue
Block a user