fix/codigo-clave-cambio
This commit is contained in:
@@ -11,6 +11,7 @@ router = TenantCRUDRoutes(
|
||||
tags=["a76.general_catalogs.concepts"],
|
||||
resource_name="Concept",
|
||||
enable_list=True,
|
||||
enable_filters=True,
|
||||
list_permissions=["cat_concepts.view"],
|
||||
get_permissions=["cat_concepts.view"],
|
||||
create_permissions=["cat_concepts.create"],
|
||||
|
||||
@@ -19,6 +19,7 @@ identifier_crud = TenantCRUDRoutes(
|
||||
tags=["Identifiers"],
|
||||
resource_name="Identifier",
|
||||
enable_list=True,
|
||||
enable_filters=True,
|
||||
list_permissions=["cat_identifiers.view"],
|
||||
get_permissions=["cat_identifiers.view"],
|
||||
create_permissions=["cat_identifiers.create"],
|
||||
|
||||
@@ -50,11 +50,22 @@ export async function getConcepts(
|
||||
companyId: number,
|
||||
filters: Record<string, any> = {},
|
||||
): Promise<ApiResponse<ConceptListResponse>> {
|
||||
const cleanFilters = Object.fromEntries(
|
||||
Object.entries(filters).filter(([, value]) => {
|
||||
if (value === undefined || value === null) return false;
|
||||
if (typeof value === 'string') {
|
||||
const trimmed = value.trim();
|
||||
return trimmed !== '' && trimmed.toLowerCase() !== 'undefined';
|
||||
}
|
||||
return true;
|
||||
})
|
||||
);
|
||||
|
||||
const params = new URLSearchParams({
|
||||
page: page.toString(),
|
||||
page_size: pageSize.toString(),
|
||||
company_id: companyId.toString(),
|
||||
...filters
|
||||
...cleanFilters
|
||||
});
|
||||
|
||||
return await api.get(`/v1/a76/concepts/?${params.toString()}`);
|
||||
|
||||
@@ -68,11 +68,22 @@ export async function getIdentifiers(
|
||||
companyId: number,
|
||||
filters: Record<string, any> = {}
|
||||
): Promise<ApiResponse<IdentifierListResponse>> {
|
||||
const cleanFilters = Object.fromEntries(
|
||||
Object.entries(filters).filter(([, value]) => {
|
||||
if (value === undefined || value === null) return false;
|
||||
if (typeof value === 'string') {
|
||||
const trimmed = value.trim();
|
||||
return trimmed !== '' && trimmed.toLowerCase() !== 'undefined';
|
||||
}
|
||||
return true;
|
||||
})
|
||||
);
|
||||
|
||||
const queryParams = new URLSearchParams({
|
||||
page: page.toString(),
|
||||
page_size: pageSize.toString(),
|
||||
company_id: companyId.toString(),
|
||||
...filters
|
||||
...cleanFilters
|
||||
});
|
||||
|
||||
return await api.get(`/v1/a76/identifiers/?${queryParams.toString()}`);
|
||||
|
||||
@@ -45,8 +45,26 @@
|
||||
let loading = $state(false);
|
||||
let error = $state<string | null>(null);
|
||||
|
||||
// Cargar datos al abrir
|
||||
function resetForm() {
|
||||
formData = {
|
||||
code: '',
|
||||
description: '',
|
||||
description_en: '',
|
||||
detailed_description: '',
|
||||
priority: '',
|
||||
priority_ame: '',
|
||||
first_total: '',
|
||||
type: '',
|
||||
is_printed: false,
|
||||
section: '',
|
||||
classification: ''
|
||||
};
|
||||
}
|
||||
|
||||
// Cargar/limpiar datos al abrir
|
||||
$effect(() => {
|
||||
if (!open) return;
|
||||
|
||||
if (item) {
|
||||
formData = {
|
||||
code: item.code || '',
|
||||
@@ -62,21 +80,10 @@
|
||||
classification: item.classification || ''
|
||||
};
|
||||
} else {
|
||||
// Limpiar formulario
|
||||
formData = {
|
||||
code: '',
|
||||
description: '',
|
||||
description_en: '',
|
||||
detailed_description: '',
|
||||
priority: '',
|
||||
priority_ame: '',
|
||||
first_total: '',
|
||||
type: '',
|
||||
is_printed: false,
|
||||
section: '',
|
||||
classification: ''
|
||||
};
|
||||
resetForm();
|
||||
}
|
||||
|
||||
error = null;
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
|
||||
@@ -283,7 +283,7 @@
|
||||
<Card.Title>Listado de Equivalencias</Card.Title>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Input
|
||||
placeholder="Código origen"
|
||||
placeholder="Identificador"
|
||||
bind:value={searchFrom}
|
||||
oninput={handleSearch}
|
||||
class="h-9 w-40 bg-card lg:w-52"
|
||||
|
||||
@@ -221,7 +221,7 @@ onRetry={reloadData}
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<Card.Title>Listado de Unidades</Card.Title>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Input placeholder="Clave" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Código" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Descripción" bind:value={searchDesc} oninput={handleSearch} class="h-9 w-44 bg-card lg:w-64" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -221,7 +221,7 @@ onRetry={reloadData}
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<Card.Title>Listado de Unidades</Card.Title>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Input placeholder="Clave" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Código" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Descripción" bind:value={searchDesc} oninput={handleSearch} class="h-9 w-44 bg-card lg:w-64" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -182,7 +182,7 @@ onRetry={reloadData}
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<Card.Title>Listado de Unidades</Card.Title>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Input placeholder="Clave" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Código" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Descripción" bind:value={searchDesc} oninput={handleSearch} class="h-9 w-44 bg-card lg:w-64" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
<Card.Title>Listado de Unidades</Card.Title>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Input
|
||||
placeholder="Clave"
|
||||
placeholder="Código"
|
||||
bind:value={searchCode}
|
||||
oninput={handleSearch}
|
||||
class="h-9 w-36 bg-card lg:w-44"
|
||||
|
||||
@@ -221,7 +221,7 @@ onRetry={reloadData}
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<Card.Title>Listado de Unidades</Card.Title>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<Input placeholder="Clave" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Código" bind:value={searchCode} oninput={handleSearch} class="h-9 w-36 bg-card lg:w-44" />
|
||||
<Input placeholder="Descripción" bind:value={searchDesc} oninput={handleSearch} class="h-9 w-44 bg-card lg:w-64" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user