Merge pull request 'Arreglo de filtros, click con compoartmiento de exit, reactividad al ingresar un registro, ademmsa del docble click' (#433) from fix/prevalidadores into development
Reviewed-on: ADUANASOFT/anexo76#433
This commit is contained in:
@@ -29,6 +29,7 @@ prevalidator_crud = TenantCRUDRoutes(
|
||||
tags=["Prevalidators"],
|
||||
resource_name="Prevalidator",
|
||||
enable_list=True,
|
||||
enable_filters=True,
|
||||
list_permissions=["cat_prevalidators.view"],
|
||||
get_permissions=["cat_prevalidators.view"],
|
||||
create_permissions=["cat_prevalidators.create"],
|
||||
|
||||
@@ -37,17 +37,17 @@ export async function getPrevalidators(
|
||||
filters: Record<string, any> = {},
|
||||
companyId?: number
|
||||
): Promise<ApiResponse<PrevalidatorListResponse>> {
|
||||
const params = new URLSearchParams({
|
||||
const paramObj: Record<string, string> = {
|
||||
page: page.toString(),
|
||||
page_size: pageSize.toString(),
|
||||
...filters
|
||||
page_size: pageSize.toString()
|
||||
};
|
||||
if (companyId) paramObj.company_id = companyId.toString();
|
||||
Object.entries(filters).forEach(([k, v]) => {
|
||||
if (v !== undefined && v !== null && v !== '') paramObj[k] = String(v);
|
||||
});
|
||||
if (companyId) {
|
||||
params.append('company_id', companyId.toString());
|
||||
}
|
||||
const params = new URLSearchParams(paramObj);
|
||||
|
||||
const response = await api.get(`/v1/a76/prevalidators/?${params.toString()}`);
|
||||
return response.data;
|
||||
return api.get(`/v1/a76/prevalidators/?${params.toString()}`);
|
||||
}
|
||||
|
||||
export async function getPrevalidator(id: number, companyId?: number): Promise<Prevalidator> {
|
||||
|
||||
@@ -3,12 +3,12 @@ import type { ApiResponse } from '$lib/api';
|
||||
|
||||
export interface Signature {
|
||||
id: number;
|
||||
|
||||
code: string;
|
||||
signature: string | null;
|
||||
photo_path: string | null;
|
||||
|
||||
|
||||
|
||||
code: string;
|
||||
signature: string | null;
|
||||
photo_path: string | null;
|
||||
|
||||
|
||||
tenant_id: number;
|
||||
company_id: number;
|
||||
created_at: string;
|
||||
@@ -19,10 +19,10 @@ export interface SignatureCreate {
|
||||
code: string;
|
||||
signature?: string | null;
|
||||
photo_path?: string | null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
export interface SignatureUpdate extends Partial<SignatureCreate> {}
|
||||
export interface SignatureUpdate extends Partial<SignatureCreate> { }
|
||||
|
||||
export interface SignatureListResponse {
|
||||
items: Signature[];
|
||||
@@ -49,7 +49,6 @@ export async function getSignatures(
|
||||
});
|
||||
const params = new URLSearchParams(paramObj);
|
||||
|
||||
|
||||
return api.get(`/v1/a76/signatures/?${params.toString()}`);
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ export async function getSignature(id: number, companyId: number): Promise<Signa
|
||||
|
||||
|
||||
export async function createSignature(
|
||||
data: SignatureCreate,
|
||||
data: SignatureCreate,
|
||||
companyId: number
|
||||
): Promise<Signature> {
|
||||
const response = await api.post(`/v1/a76/signatures/?company_id=${companyId}`, data);
|
||||
@@ -71,8 +70,8 @@ export async function createSignature(
|
||||
}
|
||||
|
||||
export async function updateSignature(
|
||||
id: number,
|
||||
data: SignatureUpdate,
|
||||
id: number,
|
||||
data: SignatureUpdate,
|
||||
companyId: number
|
||||
): Promise<Signature> {
|
||||
const response = await api.put(`/v1/a76/signatures/${id}/?company_id=${companyId}`, data);
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
</script>
|
||||
|
||||
<Dialog.Root bind:open>
|
||||
<Dialog.Content class="sm:max-w-[500px]">
|
||||
<Dialog.Content class="sm:max-w-[500px]" onInteractOutside={(e) => e.preventDefault()}>
|
||||
<Dialog.Header>
|
||||
<Dialog.Title>{title}</Dialog.Title>
|
||||
</Dialog.Header>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import * as Card from '$lib/components/ui/card';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { Input } from '$lib/components/ui/input';
|
||||
import { Pencil, Plus, Trash2 } from 'lucide-svelte';
|
||||
import { Pencil, Plus, Trash2, RefreshCw } from 'lucide-svelte';
|
||||
import InfiniteDataTable from '$lib/components/dashboard/common/infinite-data-table.svelte';
|
||||
import { createColumns } from '$lib/components/dashboard/general_catalogs/prevalidators/columns';
|
||||
import CreateEditDialog from '$lib/components/dashboard/general_catalogs/prevalidators/create-edit-dialog.svelte';
|
||||
@@ -226,7 +226,9 @@
|
||||
size="sm"
|
||||
class="h-9"
|
||||
onclick={reloadData}
|
||||
disabled={loading}
|
||||
>
|
||||
<RefreshCw class="mr-2 h-4 w-4 {loading ? 'animate-spin' : ''}" />
|
||||
Actualizar
|
||||
</Button>
|
||||
{#if canCreate}
|
||||
@@ -262,7 +264,17 @@
|
||||
</Card.Header>
|
||||
<Card.Content class="p-0 flex-1 overflow-hidden min-h-0">
|
||||
<div class="rounded-md border bg-background overflow-hidden h-full">
|
||||
<InfiniteDataTable data={allItems} {columns} {loading} {hasMore} {loadMore} />
|
||||
<InfiniteDataTable
|
||||
data={allItems}
|
||||
{columns}
|
||||
{loading}
|
||||
{hasMore}
|
||||
{loadMore}
|
||||
{selectedIds}
|
||||
onSelectedIdsChange={(ids) => (selectedIds = ids)}
|
||||
onRowClick={handleRowClick}
|
||||
onRowDoubleClick={handleRowDoubleClick}
|
||||
/>
|
||||
</div>
|
||||
</Card.Content>
|
||||
</Card.Root>
|
||||
|
||||
Reference in New Issue
Block a user