fix/invoices-return-cancelar-fix
This commit is contained in:
@@ -720,16 +720,25 @@
|
||||
});
|
||||
|
||||
function invoicesListPath(): string {
|
||||
const q = get(page).url.search;
|
||||
return q ? `/dashboard/invoices${q}` : '/dashboard/invoices';
|
||||
const searchParams = new URLSearchParams($page.url.search);
|
||||
|
||||
// Si no hay parámetros en la URL (ej. recarga de página), intentamos reconstruirlos del estado
|
||||
if (!searchParams.has('operation_type')) {
|
||||
const opType = InvoiceTopFieldsFormData?.operation_type || data.invoice?.operation_type || data.filters?.operation_type;
|
||||
if (opType) searchParams.set('operation_type', opType);
|
||||
}
|
||||
|
||||
if (!searchParams.has('invoice_type')) {
|
||||
const invType = InvoiceTopFieldsFormData?.invoice_type || data.invoice?.invoice_type || data.filters?.invoice_type;
|
||||
if (invType) searchParams.set('invoice_type', invType);
|
||||
}
|
||||
|
||||
const qs = searchParams.toString();
|
||||
return qs ? `/dashboard/invoices?${qs}` : '/dashboard/invoices';
|
||||
}
|
||||
|
||||
function handleBack() {
|
||||
if (browser && window.history.length > 1) {
|
||||
window.history.back();
|
||||
} else {
|
||||
goto(invoicesListPath());
|
||||
}
|
||||
goto(invoicesListPath());
|
||||
}
|
||||
|
||||
function getOperationColor(type?: string | null): 'default' | 'secondary' {
|
||||
|
||||
Reference in New Issue
Block a user