Se movio la parte de descargas del sidbar al botoncito en reportes
This commit is contained in:
@@ -608,10 +608,6 @@ export function getSidebarData(): SidebarData {
|
||||
title: m["sidebar.reports.invoices"](),
|
||||
url: "/dashboard/reports/invoices",
|
||||
},
|
||||
{
|
||||
title: m["sidebar.reports.downloaded_parts"](),
|
||||
url: "/dashboard/reports/partes-descargadas",
|
||||
},
|
||||
{
|
||||
title: m["sidebar.reports.expiration"](),
|
||||
url: "/dashboard/reports/vencimiento",
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
import * as Dialog from '$lib/components/ui/dialog';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import PdfProgressDialog from '$lib/components/dashboard/invoices/pdf-progress-dialog.svelte';
|
||||
import DownloadedPartsForm from '$lib/components/dashboard/reports/downloaded-parts-form.svelte';
|
||||
import {
|
||||
invoiceMovementsApi,
|
||||
type MovementItem,
|
||||
@@ -77,7 +78,7 @@
|
||||
|
||||
// --- ESTADO CON RUNAS (SVELTE 5) ---
|
||||
|
||||
let activeReportType = $state<'invoices' | 'saldos'>('invoices');
|
||||
let activeReportType = $state<'invoices' | 'saldos' | 'partes_descargadas'>('invoices');
|
||||
|
||||
const menuOptions = [
|
||||
{
|
||||
@@ -88,7 +89,14 @@
|
||||
showResults = false;
|
||||
}
|
||||
},
|
||||
{ label: 'Descargos', icon: FileSpreadsheet, items: [] },
|
||||
{
|
||||
label: 'Descargos',
|
||||
icon: FileSpreadsheet,
|
||||
onclick: () => {
|
||||
activeReportType = 'partes_descargadas';
|
||||
showResults = false;
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Catálogos',
|
||||
icon: Book,
|
||||
@@ -1550,6 +1558,17 @@
|
||||
{#if activeReportType === 'invoices'}
|
||||
<FileSearch class="h-6 w-6 text-primary" />
|
||||
Reporte de Facturas
|
||||
{:else if activeReportType === 'partes_descargadas'}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="h-8 w-8 text-muted-foreground hover:text-primary"
|
||||
onclick={() => (activeReportType = 'invoices')}
|
||||
>
|
||||
<ArrowLeftRight class="h-5 w-5 rotate-180" />
|
||||
</Button>
|
||||
<FileSearch class="h-6 w-6 text-primary" />
|
||||
Partes Descargadas
|
||||
{:else}
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -1572,6 +1591,8 @@
|
||||
<div class="text-[11px] text-muted-foreground sm:text-xs">
|
||||
{#if activeReportType === 'invoices'}
|
||||
Reportes de Movimientos Impo/Expo
|
||||
{:else if activeReportType === 'partes_descargadas'}
|
||||
Reportes de Partes Descargadas
|
||||
{:else}
|
||||
Reportes de Control Fiscal
|
||||
{/if}
|
||||
@@ -1616,7 +1637,14 @@
|
||||
<DropdownMenu.Separator />
|
||||
<div class="max-h-[300px] overflow-y-auto">
|
||||
{#each item.items as subItem}
|
||||
<DropdownMenu.Item onclick={() => toast.info(`Seleccionado: ${subItem}`)}>
|
||||
<DropdownMenu.Item onclick={() => {
|
||||
if (subItem === 'Partes Descargadas') {
|
||||
activeReportType = 'partes_descargadas';
|
||||
showResults = false;
|
||||
} else {
|
||||
toast.info(`Seleccionado: ${subItem}`);
|
||||
}
|
||||
}}>
|
||||
{subItem}
|
||||
</DropdownMenu.Item>
|
||||
{/each}
|
||||
@@ -2053,7 +2081,7 @@
|
||||
</Button>
|
||||
</Card.Footer>
|
||||
</Card.Root>
|
||||
{:else}
|
||||
{:else if activeReportType === 'saldos'}
|
||||
<!-- SALDOS TEMPORALES -->
|
||||
<!-- Columna 1: Periodo y Clasificación -->
|
||||
<Card.Root class="flex h-full flex-col">
|
||||
@@ -2509,6 +2537,10 @@
|
||||
</Button>
|
||||
</Card.Footer>
|
||||
</Card.Root>
|
||||
{:else if activeReportType === 'partes_descargadas'}
|
||||
<div class="xl:col-span-2 2xl:col-span-3 h-full">
|
||||
<DownloadedPartsForm />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { getAuthTokens } from '$lib/server/api';
|
||||
|
||||
export const load: PageServerLoad = async ({ cookies }) => {
|
||||
const { accessToken } = getAuthTokens(cookies);
|
||||
|
||||
if (!accessToken) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
|
||||
return {
|
||||
title: 'Partes descargadas'
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user