feature/seed-digitalizacion
This commit is contained in:
@@ -4,7 +4,6 @@ export interface DocumentTypeDigitization {
|
||||
id: number;
|
||||
code: string;
|
||||
description: string;
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
export interface DocumentTypeDigitizationListResponse {
|
||||
@@ -25,7 +24,6 @@ export const documentTypesDigitizationApi = {
|
||||
pageSize = 50,
|
||||
companyId: number,
|
||||
search?: string,
|
||||
activeOnly = false
|
||||
) => {
|
||||
const params = new URLSearchParams({
|
||||
page: page.toString(),
|
||||
@@ -37,15 +35,11 @@ export const documentTypesDigitizationApi = {
|
||||
params.append('search', search);
|
||||
}
|
||||
|
||||
if (activeOnly) {
|
||||
params.append('active_only', 'true');
|
||||
}
|
||||
|
||||
return api.get<DocumentTypeDigitizationListResponse>(`${BASE_URL}/?${params.toString()}`);
|
||||
},
|
||||
|
||||
getAll: (companyId: number, activeOnly = true, search?: string) => {
|
||||
return documentTypesDigitizationApi.list(1, 2000, companyId, search, activeOnly);
|
||||
getAll: (companyId: number, search?: string) => {
|
||||
return documentTypesDigitizationApi.list(1, 2000, companyId, search);
|
||||
},
|
||||
|
||||
getById: (id: number, companyId: number) => {
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
if (docTypes.length === 0) {
|
||||
docTypesLoading = true;
|
||||
documentTypesDigitizationApi
|
||||
.getAll(companyId, true)
|
||||
.getAll(companyId)
|
||||
.then((res) => {
|
||||
docTypes = res.data?.items || [];
|
||||
})
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
tiposDocumentos = [];
|
||||
return;
|
||||
}
|
||||
const response = await documentTypesDigitizationApi.getAll(companyId, true);
|
||||
const response = await documentTypesDigitizationApi.getAll(companyId);
|
||||
tiposDocumentos = response.data?.items || [];
|
||||
} catch (error) {
|
||||
console.error('Error al cargar tipos de documentos:', error);
|
||||
|
||||
@@ -34,25 +34,6 @@ export function createColumns(): ColumnDef<DocumentTypeDigitization>[] {
|
||||
return renderSnippet(descriptionSnippet, { description: row.original.description });
|
||||
}
|
||||
},
|
||||
{
|
||||
accessorKey: 'active',
|
||||
header: 'Estatus',
|
||||
cell: ({ row }) => {
|
||||
const activeSnippet = createRawSnippet<[{ active: boolean }]>((getActive) => {
|
||||
const { active } = getActive();
|
||||
const className = active
|
||||
? 'border-emerald-200 bg-emerald-50 text-emerald-700'
|
||||
: 'border-slate-200 bg-slate-50 text-slate-600';
|
||||
const label = active ? 'Activo' : 'Inactivo';
|
||||
return {
|
||||
render: () =>
|
||||
`<span class="inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium ${className}">${label}</span>`
|
||||
};
|
||||
});
|
||||
|
||||
return renderSnippet(activeSnippet, { active: row.original.active });
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user