diff --git a/backend/api/v1/modules/a76/clients_and_providers/dto.py b/backend/api/v1/modules/a76/clients_and_providers/dto.py
index f77df843..624c99f1 100644
--- a/backend/api/v1/modules/a76/clients_and_providers/dto.py
+++ b/backend/api/v1/modules/a76/clients_and_providers/dto.py
@@ -116,9 +116,7 @@ class ClientProviderCreateDTO(BaseModel):
)
position: Optional[str] = Field(None, max_length=30, description="Position")
incoterm: Optional[str] = Field(None, max_length=19, description="Incoterm")
- is_national_provider: Optional[str] = Field(
- None, max_length=2, description="Is national provider"
- )
+ is_national_provider: Optional[bool] = None
is_active: Optional[bool] = Field(None, description="Enabled/Disabled status")
# Nested DTOs
@@ -159,9 +157,7 @@ class ClientProviderUpdateDTO(BaseModel):
)
position: Optional[str] = Field(None, max_length=30, description="Position")
incoterm: Optional[str] = Field(None, max_length=19, description="Incoterm")
- is_national_provider: Optional[str] = Field(
- None, max_length=2, description="Is national provider"
- )
+ is_national_provider: Optional[bool] = None
is_active: Optional[bool] = Field(None, description="Enabled/Disabled status")
# Nested DTOs
@@ -193,7 +189,7 @@ class ClientProviderResponseDTO(BaseModel):
responsible: Optional[str] = None
position: Optional[str] = None
incoterm: Optional[str] = None
- is_national_provider: Optional[str] = None
+ is_national_provider: Optional[bool] = None
is_active: Optional[bool] = None
tenant_id: int
company_id: int
diff --git a/backend/api/v1/modules/a76/clients_and_providers/routes.py b/backend/api/v1/modules/a76/clients_and_providers/routes.py
index 970b71ad..e1db85d7 100644
--- a/backend/api/v1/modules/a76/clients_and_providers/routes.py
+++ b/backend/api/v1/modules/a76/clients_and_providers/routes.py
@@ -61,7 +61,6 @@ async def get_clients_and_providers(
"page_size": limit,
}
-
@router.get("/{client_id}/basic", response_model=ClientProviderBasicDTO)
async def get_clients_and_providers_basic_info(
client_id: int,
@@ -111,6 +110,26 @@ async def update_client_provider(
return client
+@router.get("/{client_id}", response_model=ClientProviderResponseDTO)
+async def get_client_provider_detail(
+ client_id: int,
+ company_id: int = Query(..., description="Company ID"),
+ db: Session = Depends(get_core_db),
+ current_user: dict = Depends(get_current_user),
+):
+ """
+ Obtener un cliente/proveedor completo por ID.
+ Esta es la ruta que tu formulario necesita para cargar los datos.
+ """
+ tenant_id = validate_access_to_resource(db, company_id, current_user)
+
+ # Usamos el servicio para buscar por ID
+ client = ClientProviderService.get_by_id(db, client_id, tenant_id, company_id)
+
+ if not client:
+ raise HTTPException(status_code=404, detail="Client/Provider not found")
+
+ return client
@router.delete("/{client_id}", response_model=bool)
async def delete_client_provider(
diff --git a/frontend/src/lib/api/dashboard/a76/clients-providers.ts b/frontend/src/lib/api/dashboard/a76/clients-providers.ts
index 26d31d69..af66c1c5 100644
--- a/frontend/src/lib/api/dashboard/a76/clients-providers.ts
+++ b/frontend/src/lib/api/dashboard/a76/clients-providers.ts
@@ -1,170 +1,97 @@
-/**
- * API Client para Clientes y Proveedores
- * Gestiona las operaciones CRUD para clientes y proveedores
- */
import { api } from '$lib/api';
+// --- Interfaces para Tablas Hijas ---
+
export interface ClientProviderAddress {
- id?: number;
- street?: string | null;
- neighborhood?: string | null;
- city?: string | null;
- state?: string | null;
- country?: string | null;
- zip_code?: string | null;
- client_id?: number;
+ id?: number;
+ streets?: string | null;
+ exterior_number?: string | null;
+ interior_number?: string | null;
+ neighborhood?: string | null;
+ municipality?: string | null;
+ city?: string | null;
+ state?: string | null;
+ country?: string | null;
+ postal_code?: string | null;
+ email?: string | null;
+ phone?: string | null;
+ contact?: string | null;
}
export interface ClientProviderPrograms {
- id?: number;
- program_code?: string | null;
- authorization_date?: string | null;
- client_id?: number;
+ id?: number;
+ program?: string | null;
+ program_number?: string | null;
+ secon_auth_date?: number | null; // YYYYMMDD
+ prosec?: number | null;
+ manufacturer_id?: string | null;
+ tax_id?: string | null;
+ ctpat_svi?: string | null;
+ is_certified_company?: string | null;
}
+// --- Interfaz Principal ---
+
export interface ClientProvider {
- id: number;
- rfc: string;
- name: string;
- curp?: string | null;
- residence_country?: string | null;
- domicile_fiscal?: string | null;
- foreign_tax_id?: string | null;
- client_or_provider?: string | null;
- is_active?: boolean;
- tenant_id: number;
- address?: ClientProviderAddress | null;
- programs?: ClientProviderPrograms | null;
-}
-
-export interface ClientProviderBasic {
- id: number;
- rfc: string;
- name: string;
- curp?: string | null;
- residence_country?: string | null;
- domicile_fiscal?: string | null;
- foreign_tax_id?: string | null;
- client_or_provider?: string | null;
- is_active?: boolean;
- tenant_id: number;
+ id: number;
+ rfc: string;
+ name: string;
+ short_name?: string | null;
+ curp?: string | null;
+ client_or_provider: 'client' | 'provider' | 'both';
+
+ // Campos planos de la tabla principal
+ type_nat_foreign?: string | null;
+ responsible?: string | null;
+ position?: string | null;
+
+ // Booleanos (Coincidiendo con la BD)
+ is_national_provider?: boolean | null;
+ is_active?: boolean;
+
+ // Relaciones Anidadas
+ address?: ClientProviderAddress | null;
+ programs?: ClientProviderPrograms | null;
}
export interface ClientProviderListResponse {
- items: ClientProvider[];
- total: number;
- page: number;
- page_size: number;
+ items: ClientProvider[];
+ total: number;
+ page: number;
+ page_size: number;
}
-export interface CreateClientProviderData {
- rfc: string;
- name: string;
- curp?: string | null;
- residence_country?: string | null;
- domicile_fiscal?: string | null;
- foreign_tax_id?: string | null;
- client_or_provider?: string | null;
- is_active?: boolean;
- address?: Omit | null;
- programs?: Omit | null;
+// DTOs de Envío (excluyendo IDs automáticos)
+export interface CreateClientProviderData extends Omit {
+ address?: ClientProviderAddress | null;
+ programs?: ClientProviderPrograms | null;
}
-export interface UpdateClientProviderData {
- rfc?: string;
- name?: string;
- curp?: string | null;
- residence_country?: string | null;
- domicile_fiscal?: string | null;
- foreign_tax_id?: string | null;
- client_or_provider?: string | null;
- is_active?: boolean;
- address?: Partial | null;
- programs?: Partial | null;
-}
+export interface UpdateClientProviderData extends Partial {}
-/**
- * API para Clientes y Proveedores
- */
export const clientsProvidersApi = {
- /**
- * Lista todos los clientes y proveedores con paginación
- * @param companyId - ID de la compañía
- * @param page - Número de página (por defecto 1)
- * @param pageSize - Tamaño de página (por defecto 50)
- * @param filters - Filtros opcionales
- */
- list: (companyId: number, page = 1, pageSize = 50, filters?: Record) => {
- const params = new URLSearchParams({
- company_id: companyId.toString(),
- page: page.toString(),
- page_size: pageSize.toString()
- });
+ list: (companyId: number, page = 1, pageSize = 50, filters?: Record) => {
+ const params = new URLSearchParams({
+ company_id: companyId.toString(),
+ page: page.toString(),
+ page_size: pageSize.toString()
+ });
+ if (filters) {
+ Object.entries(filters).forEach(([key, value]) => {
+ if (value) params.append(key, value.toString());
+ });
+ }
+ return api.get(`/v1/a76/clients-providers?${params.toString()}`);
+ },
+ get: (id: number, companyId: number) =>
+ api.get(`/v1/a76/clients-providers/${id}?company_id=${companyId}`),
+
+ create: (companyId: number, data: any) =>
+ api.post(`/v1/a76/clients-providers?company_id=${companyId}`, data),
- if (filters) {
- Object.entries(filters).forEach(([key, value]) => {
- if (value !== undefined && value !== null && value !== '') {
- params.append(key, value.toString());
- }
- });
- }
+ update: (id: number, companyId: number, data: any) =>
+ api.patch(`/v1/a76/clients-providers/${id}?company_id=${companyId}`, data),
- return api.get(
- `/v1/a76/clients-providers?${params.toString()}`
- );
- },
-
- /**
- * Obtiene un cliente/proveedor por ID
- * @param id - ID del cliente/proveedor
- * @param companyId - ID de la compañía
- */
- get: (id: number, companyId: number) =>
- api.get(`/v1/a76/clients-providers/${id}?company_id=${companyId}`),
-
- /**
- * Obtiene información básica de un cliente/proveedor
- * @param id - ID del cliente/proveedor
- * @param companyId - ID de la compañía
- */
- getBasic: (id: number, companyId: number) =>
- api.get(
- `/v1/a76/clients-providers/${id}/basic?company_id=${companyId}`
- ),
-
- /**
- * Crea un nuevo cliente/proveedor
- * @param companyId - ID de la compañía
- * @param data - Datos del cliente/proveedor a crear
- */
- create: (companyId: number, data: CreateClientProviderData) =>
- api.post(`/v1/a76/clients-providers?company_id=${companyId}`, data),
-
- /**
- * Actualiza un cliente/proveedor existente
- * @param id - ID del cliente/proveedor a actualizar
- * @param companyId - ID de la compañía
- * @param data - Datos a actualizar
- */
- update: (id: number, companyId: number, data: UpdateClientProviderData) =>
- api.patch(`/v1/a76/clients-providers/${id}?company_id=${companyId}`, data),
-
- /**
- * Alterna el estado activo/inactivo de un cliente/proveedor
- * @param id - ID del cliente/proveedor
- * @param companyId - ID de la compañía
- */
- toggleStatus: (id: number, companyId: number) =>
- api.put(
- `/v1/a76/clients-providers/${id}/toggle-status?company_id=${companyId}`,
- {}
- ),
-
- /**
- * Elimina un cliente/proveedor
- * @param id - ID del cliente/proveedor a eliminar
- * @param companyId - ID de la compañía
- */
- delete: (id: number, companyId: number) =>
- api.delete(`/v1/a76/clients-providers/${id}?company_id=${companyId}`)
-};
+ delete: (id: number, companyId: number) =>
+ api.delete(`/v1/a76/clients-providers/${id}?company_id=${companyId}`)
+};
\ No newline at end of file
diff --git a/frontend/src/lib/components/dashboard/clients_and_providers/columns.ts b/frontend/src/lib/components/dashboard/clients_and_providers/columns.ts
index ef8ea700..a09246ab 100644
--- a/frontend/src/lib/components/dashboard/clients_and_providers/columns.ts
+++ b/frontend/src/lib/components/dashboard/clients_and_providers/columns.ts
@@ -1,111 +1,101 @@
-import type { ColumnDef } from "@tanstack/table-core";
import { renderComponent, renderSnippet } from "$lib/components/ui/data-table/index.js";
import { createRawSnippet } from "svelte";
import DataTableActions from "./data-table-actions.svelte";
-import type { ClientProvider } from "$lib/api/dashboard/a76/clients-providers";
-export type { ClientProvider };
+export function createColumns(onSuccess) {
+ return [
+ {
+ accessorKey: "id",
+ header: "ID",
+ cell: ({ row }) => {
+ const snippet = createRawSnippet((getData) => {
+ const { val } = getData();
+ return { render: () => `${val}` };
+ });
+ return renderSnippet(snippet, { val: row.original.id });
+ }
+ },
+ {
+ accessorKey: "rfc",
+ header: "RFC",
+ cell: ({ row }) => {
+ const snippet = createRawSnippet((getData) => {
+ const { val } = getData();
+ return { render: () => `${val}` };
+ });
+ return renderSnippet(snippet, { val: row.original.rfc });
+ }
+ },
+ {
+ accessorKey: "name",
+ header: "Nombre",
+ cell: ({ row }) => {
+ const snippet = createRawSnippet((getData) => {
+ const { val } = getData();
+ return { render: () => `${val}
` };
+ });
+ return renderSnippet(snippet, { val: row.original.name });
+ }
+ },
+ {
+ id: "country",
+ header: "País",
+ cell: ({ row }) => {
+ const snippet = createRawSnippet((getData) => {
+ const { val } = getData();
+ return { render: () => `${val || '-'}
` };
+ });
+ // Busca en address.country, si no existe pone null
+ const country = row.original.address?.country;
+ return renderSnippet(snippet, { val: country });
+ }
+ },
+ {
+ accessorKey: "client_or_provider",
+ header: "Tipo",
+ cell: ({ row }) => {
+ const snippet = createRawSnippet((getData) => {
+ const { val } = getData();
+ const map = { client: 'Cliente', provider: 'Proveedor', both: 'Ambos' };
+ const colors = {
+ client: 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300',
+ provider: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300',
+ both: 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300'
+ };
+ return {
+ render: () => `${map[val] || val}`
+ };
+ });
+ return renderSnippet(snippet, { val: row.original.client_or_provider });
+ }
+ },
+ // --- CORRECCIÓN AQUÍ ---
+ {
+ accessorKey: "is_active",
+ header: "Estado",
+ cell: ({ row }) => {
+ const snippet = createRawSnippet((getData) => {
+ const { val } = getData();
+
+
+ const isActive = !!val;
-export function createColumns(onSuccess?: () => void): ColumnDef[] {
- return [
- {
- accessorKey: "id",
- header: "ID",
- cell: ({ row }) => {
- const idSnippet = createRawSnippet<[{ id: number }]>((getId) => {
- const { id } = getId();
- return {
- render: () =>
- `${id}`
- };
- });
- return renderSnippet(idSnippet, { id: row.original.id });
- }
- },
- {
- accessorKey: "rfc",
- header: "RFC",
- cell: ({ row }) => {
- const rfcSnippet = createRawSnippet<[{ rfc: string }]>((getRfc) => {
- const { rfc } = getRfc();
- return {
- render: () =>
- `${rfc}`
- };
- });
- return renderSnippet(rfcSnippet, { rfc: row.original.rfc });
- }
- },
- {
- accessorKey: "name",
- header: "Nombre",
- cell: ({ row }) => {
- const nameSnippet = createRawSnippet<[{ name: string }]>((getName) => {
- const { name } = getName();
- return {
- render: () => `${name}
`
- };
- });
- return renderSnippet(nameSnippet, { name: row.original.name });
- }
- },
- {
- accessorKey: "client_or_provider",
- header: "Tipo",
- cell: ({ row }) => {
- const typeSnippet = createRawSnippet<[{ type: string | null | undefined }]>((getType) => {
- const { type } = getType();
- const displayType = type === 'client' ? 'Cliente' : type === 'provider' ? 'Proveedor' : type === 'both' ? 'Ambos' : 'N/A';
- const colorClass = type === 'client' ? 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300'
- : type === 'provider' ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300'
- : type === 'both' ? 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-300'
- : 'bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-300';
- return {
- render: () => `${displayType}`
- };
- });
- return renderSnippet(typeSnippet, { type: row.original.client_or_provider });
- }
- },
- {
- accessorKey: "residence_country",
- header: "País",
- cell: ({ row }) => {
- const countrySnippet = createRawSnippet<[{ country: string | null | undefined }]>((getCountry) => {
- const { country } = getCountry();
- return {
- render: () => `${country || '-'}
`
- };
- });
- return renderSnippet(countrySnippet, { country: row.original.residence_country });
- }
- },
- {
- accessorKey: "is_active",
- header: "Estado",
- cell: ({ row }) => {
- const statusSnippet = createRawSnippet<[{ status: number | undefined }]>((getStatus) => {
- const { status } = getStatus();
- const isEnabled = status === 1;
- const statusText = isEnabled ? 'Activo' : 'Inactivo';
- const colorClass = isEnabled
- ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300'
- : 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300';
- return {
- render: () => `${statusText}`
- };
- });
- return renderSnippet(statusSnippet, { status: row.original.is_active });
- }
- },
- {
- id: "actions",
- cell: ({ row }) => {
- return renderComponent(DataTableActions, { item: row.original, onSuccess });
- }
- }
- ];
-}
-
-// Mantener compatibilidad hacia atrás
-export const columns = createColumns();
+ const text = isActive ? 'Activo' : 'Inactivo';
+ const color = isActive
+ ? 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300'
+ : 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300';
+
+ return {
+ render: () => `${text}`
+ };
+ });
+ return renderSnippet(snippet, { val: row.original.is_active });
+ }
+ },
+ {
+ id: "actions",
+ header: "Acciones",
+ cell: ({ row }) => renderComponent(DataTableActions, { item: row.original, onSuccess })
+ }
+ ];
+}
\ No newline at end of file
diff --git a/frontend/src/lib/components/dashboard/clients_and_providers/data-table-actions.svelte b/frontend/src/lib/components/dashboard/clients_and_providers/data-table-actions.svelte
index 888b9488..03550b05 100644
--- a/frontend/src/lib/components/dashboard/clients_and_providers/data-table-actions.svelte
+++ b/frontend/src/lib/components/dashboard/clients_and_providers/data-table-actions.svelte
@@ -1,103 +1,98 @@
-
- {#snippet child({ props })}
-
- {/snippet}
-
-
-
- Acciones
-
- Copiar ID
-
-
- Copiar RFC
-
-
-
- Ver detalles
- Editar
-
- {isToggling ? 'Cambiando...' : item.is_active === true ? 'Desactivar' : 'Activar'}
-
-
- Eliminar
-
+
+ {#snippet child({ props })}
+
+ {/snippet}
+
+
+
+ Acciones
+
+ Copiar ID
+
+
+ Copiar RFC
+
+
+
+ Ver detalles
+
+ goto(`/dashboard/clients_and_providers/edit/${item.id}`)}>
+ Editar
+
+
+ {isToggling ? 'Cambiando...' : item.is_active === true ? 'Desactivar' : 'Activar'}
+
+
+ Eliminar
+
-
-
-
+
\ No newline at end of file
diff --git a/frontend/src/lib/components/dashboard/customs_brokers/columns.ts b/frontend/src/lib/components/dashboard/customs_brokers/columns.ts
index 993c6763..4f099fd3 100644
--- a/frontend/src/lib/components/dashboard/customs_brokers/columns.ts
+++ b/frontend/src/lib/components/dashboard/customs_brokers/columns.ts
@@ -118,6 +118,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[
},
{
id: "actions",
+ header: "Acciones",
cell: ({ row }) => {
return renderComponent(DataTableActions, {
broker: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/doda/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/doda/columns.ts
index e9751ef3..946aed85 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/doda/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/doda/columns.ts
@@ -32,6 +32,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] {
},
{
id: 'actions',
+ Headers: 'Acciones',
cell: ({ row }) => {
return renderComponent(DataTableActions, {
item: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/electronic_notices/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/electronic_notices/columns.ts
index 3a07231a..3ebec0cb 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/electronic_notices/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/electronic_notices/columns.ts
@@ -2,6 +2,7 @@ import type { ColumnDef } from '@tanstack/table-core';
import type { ElectronicNotice } from '$lib/api/dashboard/a76/general_catalogs/electronic-notices';
import { renderComponent } from '$lib/components/ui/data-table';
import DataTableActions from './data-table-actions.svelte';
+import { Head } from '$lib/components/ui/table';
export function createColumns(onSuccess?: () => void): ColumnDef[] {
return [
@@ -32,6 +33,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef {
return renderComponent(DataTableActions, {
item: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/equivalencies/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/equivalencies/columns.ts
index 704f2210..f4a92c75 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/equivalencies/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/equivalencies/columns.ts
@@ -2,6 +2,7 @@ import type { ColumnDef } from '@tanstack/table-core';
import type { Equivalency } from '$lib/api/dashboard/a76/general_catalogs/equivalencies';
import { renderComponent } from '$lib/components/ui/data-table';
import DataTableActions from './data-table-actions.svelte';
+import { Header } from '$lib/components/ui/alert-dialog';
export function createColumns(onSuccess?: () => void): ColumnDef[] {
return [
@@ -22,6 +23,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[]
},
{
id: 'actions',
+ Header: 'Acciones',
cell: ({ row }) => {
return renderComponent(DataTableActions, {
item: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/identifiers/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/identifiers/columns.ts
index 8247aeb7..6aa1997c 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/identifiers/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/identifiers/columns.ts
@@ -2,6 +2,7 @@ import type { ColumnDef } from '@tanstack/table-core';
import type { Identifier } from '$lib/api/dashboard/a76/general_catalogs/identifiers';
import { renderComponent } from '$lib/components/ui/data-table';
import DataTableActions from './data-table-actions.svelte';
+import { Header } from '$lib/components/ui/alert-dialog';
export function createColumns(onSuccess?: () => void): ColumnDef[] {
return [
@@ -27,6 +28,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] {
},
{
id: 'actions',
+ Header: 'Acciones',
cell: ({ row }) => {
return renderComponent(DataTableActions, {
item: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/inpc/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/inpc/columns.ts
index 34d58e58..c6828b12 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/inpc/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/inpc/columns.ts
@@ -22,6 +22,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] {
},
{
id: 'actions',
+ header: 'Acciones',
cell: ({ row }) => {
return renderComponent(DataTableActions, {
item: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/prevalidators/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/prevalidators/columns.ts
index 1c8b2ab5..404a0752 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/prevalidators/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/prevalidators/columns.ts
@@ -2,6 +2,7 @@ import type { ColumnDef } from '@tanstack/table-core';
import type { Prevalidator } from '$lib/api/dashboard/a76/general_catalogs/prevalidators';
import { renderComponent } from '$lib/components/ui/data-table';
import DataTableActions from './data-table-actions.svelte';
+import { Header } from '$lib/components/ui/alert-dialog';
export function createColumns(onSuccess?: () => void): ColumnDef[] {
return [
@@ -27,6 +28,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[]
},
{
id: 'actions',
+ Header: 'Acciones',
cell: ({ row }) => {
return renderComponent(DataTableActions, {
item: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/unit_conversions/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/unit_conversions/columns.ts
index a251e9fa..34d970a0 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/unit_conversions/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/unit_conversions/columns.ts
@@ -2,6 +2,7 @@ import type { ColumnDef } from '@tanstack/table-core';
import type { UnitConversion } from '$lib/api/dashboard/a76/general_catalogs/unit-conversions';
import { renderComponent } from '$lib/components/ui/data-table';
import DataTableActions from './data-table-actions.svelte';
+import { Header } from '$lib/components/ui/alert-dialog';
export function createColumns(onSuccess?: () => void): ColumnDef[] {
return [
@@ -19,6 +20,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef
},
{
id: 'actions',
+ header: 'Acciones',
cell: ({ row }) =>
renderComponent(DataTableActions, {
conversion: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/american/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/american/columns.ts
index d9f1124e..f9d51db1 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/american/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/american/columns.ts
@@ -15,6 +15,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef
renderComponent(DataTableActions, {
unit: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/customs/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/customs/columns.ts
index 5fcde59a..6f5d2136 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/customs/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/customs/columns.ts
@@ -19,6 +19,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef
renderComponent(DataTableActions, {
unit: row.original,
diff --git a/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/oma/columns.ts b/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/oma/columns.ts
index b3f5c0b8..a24ccbea 100644
--- a/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/oma/columns.ts
+++ b/frontend/src/lib/components/dashboard/general_catalogs/units_of_measure/oma/columns.ts
@@ -15,6 +15,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef
renderComponent(DataTableActions, {
unit: row.original,
diff --git a/frontend/src/lib/components/dashboard/identifiers/columns.ts b/frontend/src/lib/components/dashboard/identifiers/columns.ts
index d1feb995..c1b371ed 100644
--- a/frontend/src/lib/components/dashboard/identifiers/columns.ts
+++ b/frontend/src/lib/components/dashboard/identifiers/columns.ts
@@ -26,6 +26,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef[] {
},
{
id: 'actions',
+ header: 'Acciones',
cell: ({ row }) => {
return renderComponent(DataTableActions, {
item: row.original,
diff --git a/frontend/src/lib/components/dashboard/seal/columns.ts b/frontend/src/lib/components/dashboard/seal/columns.ts
index dbe33b26..bf68d94e 100644
--- a/frontend/src/lib/components/dashboard/seal/columns.ts
+++ b/frontend/src/lib/components/dashboard/seal/columns.ts
@@ -1,27 +1,26 @@
-/**
- * Column definitions for Seal table
- */
import type { ColumnDef } from '@tanstack/table-core';
import type { Seal } from '$lib/api/dashboard/a76/general_catalogs/seal';
import { renderComponent } from '$lib/components/ui/data-table';
import DataTableActions from './data-table-actions.svelte';
export function createColumns(onSuccess?: () => void): ColumnDef[] {
- return [
- {
- accessorKey: 'seal',
- header: 'Sello',
- cell: ({ row }) => row.original.seal
- },
- {
- id: 'actions',
- header: 'Acciones',
- cell: ({ row }) => {
- return renderComponent(DataTableActions, {
- item: row.original,
- onSuccess
- });
- }
- }
- ];
-}
+ return [
+
+ {
+ accessorKey: 'seal',
+ header: 'Sello',
+ cell: ({ row }) => row.original.seal,
+ },
+ {
+ id: 'actions',
+ header: 'Acciones',
+ meta: {
+ class: 'w-[100px] text-right'
+ },
+ cell: ({ row }) => renderComponent(DataTableActions, {
+ item: row.original,
+ onSuccess
+ })
+ }
+ ];
+}
\ No newline at end of file
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/ace/columns.ts b/frontend/src/lib/components/dashboard/units_of_measure/ace/columns.ts
deleted file mode 100644
index d88fb3a2..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/ace/columns.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { UnitOfMeasureACE } from '$lib/api/dashboard/a76/general_catalogs/units-of-measure';
-import type { ColumnDef } from '@tanstack/table-core';
-import { renderComponent } from '$lib/components/ui/data-table';
-import DataTableActions from './data-table-actions.svelte';
-
-export function createColumns(onSuccess?: () => void): ColumnDef[] {
- return [
- {
- accessorKey: 'code',
- header: 'Código',
- },
- {
- accessorKey: 'description',
- header: 'Descripción',
- cell: ({ row }) => row.original.description || '-'
- },
- {
- id: 'actions',
- cell: ({ row }) => {
- return renderComponent(DataTableActions, {
- item: row.original,
- onSuccess
- });
- }
- }
- ];
-}
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/ace/create-edit-dialog.svelte b/frontend/src/lib/components/dashboard/units_of_measure/ace/create-edit-dialog.svelte
deleted file mode 100644
index f0bd92f2..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/ace/create-edit-dialog.svelte
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
- {title}
-
-
-
- {#if error}
-
{error}
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/ace/data-table-actions.svelte b/frontend/src/lib/components/dashboard/units_of_measure/ace/data-table-actions.svelte
deleted file mode 100644
index 49e2eb59..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/ace/data-table-actions.svelte
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
- {#snippet child({ props })}
-
- {/snippet}
-
-
- Acciones
- dialogOpen = true}>
-
- Editar
-
-
- {#if loading}
-
- {:else}
-
- {/if}
- Eliminar
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/ace/data-table.svelte b/frontend/src/lib/components/dashboard/units_of_measure/ace/data-table.svelte
deleted file mode 100644
index ea8886c5..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/ace/data-table.svelte
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-
-
- {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
-
- {#each headerGroup.headers as header (header.id)}
-
- {#if !header.isPlaceholder}
-
- {/if}
-
- {/each}
-
- {/each}
-
-
- {#each table.getRowModel().rows as row (row.id)}
-
- {#each row.getVisibleCells() as cell (cell.id)}
-
-
-
- {/each}
-
- {:else}
-
-
- No hay resultados.
-
-
- {/each}
-
-
-
-
-
-
- Total: {totalItems}
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/american/columns.ts b/frontend/src/lib/components/dashboard/units_of_measure/american/columns.ts
deleted file mode 100644
index e3a4bff7..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/american/columns.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { UnitOfMeasureAmerican } from '$lib/api/dashboard/a76/general_catalogs/units-of-measure';
-import type { ColumnDef } from '@tanstack/table-core';
-import { renderComponent } from '$lib/components/ui/data-table';
-import DataTableActions from './data-table-actions.svelte';
-
-export function createColumns(onSuccess?: () => void): ColumnDef[] {
- return [
- {
- accessorKey: 'code',
- header: 'Código',
- },
- {
- accessorKey: 'description',
- header: 'Descripción',
- cell: ({ row }) => row.original.description || '-'
- },
- {
- id: 'actions',
- cell: ({ row }) => {
- return renderComponent(DataTableActions, {
- item: row.original,
- onSuccess
- });
- }
- }
- ];
-}
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/american/create-edit-dialog.svelte b/frontend/src/lib/components/dashboard/units_of_measure/american/create-edit-dialog.svelte
deleted file mode 100644
index 8ef1d6fb..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/american/create-edit-dialog.svelte
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
- {title}
-
-
-
- {#if error}
-
{error}
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/american/data-table-actions.svelte b/frontend/src/lib/components/dashboard/units_of_measure/american/data-table-actions.svelte
deleted file mode 100644
index 74912f4e..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/american/data-table-actions.svelte
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
- {#snippet child({ props })}
-
- {/snippet}
-
-
- Acciones
- dialogOpen = true}>
-
- Editar
-
-
- {#if loading}
-
- {:else}
-
- {/if}
- Eliminar
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/customs/columns.ts b/frontend/src/lib/components/dashboard/units_of_measure/customs/columns.ts
deleted file mode 100644
index db580d6b..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/customs/columns.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import type { ColumnDef } from '@tanstack/table-core';
-import { renderComponent } from '$lib/components/ui/data-table';
-import DataTableActions from './data-table-actions.svelte';
-
-export interface UMCustomsMex {
- id: number;
- code: string;
- description: string | null;
-}
-
-export function createColumns(onSuccess?: () => void): ColumnDef[] {
- return [
- {
- accessorKey: 'code',
- header: 'Código',
- },
- {
- accessorKey: 'description',
- header: 'Descripción',
- cell: ({ row }) => row.original.description || '-'
- },
- {
- id: 'actions',
- cell: ({ row }) => {
- return renderComponent(DataTableActions, {
- item: row.original,
- onSuccess
- });
- }
- }
- ];
-}
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/customs/create-edit-dialog.svelte b/frontend/src/lib/components/dashboard/units_of_measure/customs/create-edit-dialog.svelte
deleted file mode 100644
index 46319d69..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/customs/create-edit-dialog.svelte
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-
-
- {title}
-
-
-
- {#if error}
-
{error}
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/customs/data-table-actions.svelte b/frontend/src/lib/components/dashboard/units_of_measure/customs/data-table-actions.svelte
deleted file mode 100644
index 0e845518..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/customs/data-table-actions.svelte
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
- {#snippet child({ props })}
-
- {/snippet}
-
-
- Acciones
- dialogOpen = true}>
-
- Editar
-
-
- {#if loading}
-
- {:else}
-
- {/if}
- Eliminar
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/customs/data-table.svelte b/frontend/src/lib/components/dashboard/units_of_measure/customs/data-table.svelte
deleted file mode 100644
index ea8886c5..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/customs/data-table.svelte
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-
-
- {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
-
- {#each headerGroup.headers as header (header.id)}
-
- {#if !header.isPlaceholder}
-
- {/if}
-
- {/each}
-
- {/each}
-
-
- {#each table.getRowModel().rows as row (row.id)}
-
- {#each row.getVisibleCells() as cell (cell.id)}
-
-
-
- {/each}
-
- {:else}
-
-
- No hay resultados.
-
-
- {/each}
-
-
-
-
-
-
- Total: {totalItems}
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/general/columns.ts b/frontend/src/lib/components/dashboard/units_of_measure/general/columns.ts
deleted file mode 100644
index 710cb488..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/general/columns.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import type { ColumnDef } from '@tanstack/table-core';
-import { renderComponent } from '$lib/components/ui/data-table';
-import DataTableActions from './data-table-actions.svelte';
-
-export interface UnitMeasure {
- id: number;
- code: string;
- description: string | null;
-}
-
-export function createColumns(onSuccess?: () => void): ColumnDef[] {
- return [
- {
- accessorKey: 'code',
- header: 'Código',
- },
- {
- accessorKey: 'description',
- header: 'Descripción',
- cell: ({ row }) => row.original.description || '-'
- },
- {
- id: 'actions',
- cell: ({ row }) => {
- return renderComponent(DataTableActions, {
- item: row.original,
- onSuccess
- });
- }
- }
- ];
-}
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/general/create-edit-dialog.svelte b/frontend/src/lib/components/dashboard/units_of_measure/general/create-edit-dialog.svelte
deleted file mode 100644
index ffbb4054..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/general/create-edit-dialog.svelte
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-
-
- {title}
-
-
-
- {#if error}
-
{error}
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/general/data-table-actions.svelte b/frontend/src/lib/components/dashboard/units_of_measure/general/data-table-actions.svelte
deleted file mode 100644
index 66641d66..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/general/data-table-actions.svelte
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
- {#snippet child({ props })}
-
- {/snippet}
-
-
- Acciones
- dialogOpen = true}>
-
- Editar
-
-
- {#if loading}
-
- {:else}
-
- {/if}
- Eliminar
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/general/data-table.svelte b/frontend/src/lib/components/dashboard/units_of_measure/general/data-table.svelte
deleted file mode 100644
index ea8886c5..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/general/data-table.svelte
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-
-
- {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
-
- {#each headerGroup.headers as header (header.id)}
-
- {#if !header.isPlaceholder}
-
- {/if}
-
- {/each}
-
- {/each}
-
-
- {#each table.getRowModel().rows as row (row.id)}
-
- {#each row.getVisibleCells() as cell (cell.id)}
-
-
-
- {/each}
-
- {:else}
-
-
- No hay resultados.
-
-
- {/each}
-
-
-
-
-
-
- Total: {totalItems}
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/oma/columns.ts b/frontend/src/lib/components/dashboard/units_of_measure/oma/columns.ts
deleted file mode 100644
index 4b28f780..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/oma/columns.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { UnitOfMeasureOMA } from '$lib/api/dashboard/a76/general_catalogs/units-of-measure';
-import type { ColumnDef } from '@tanstack/table-core';
-import { renderComponent } from '$lib/components/ui/data-table';
-import DataTableActions from './data-table-actions.svelte';
-
-export function createColumns(onSuccess?: () => void): ColumnDef[] {
- return [
- {
- accessorKey: 'code',
- header: 'Código',
- },
- {
- accessorKey: 'description',
- header: 'Descripción',
- cell: ({ row }) => row.original.description || '-'
- },
- {
- id: 'actions',
- cell: ({ row }) => {
- return renderComponent(DataTableActions, {
- item: row.original,
- onSuccess
- });
- }
- }
- ];
-}
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/oma/create-edit-dialog.svelte b/frontend/src/lib/components/dashboard/units_of_measure/oma/create-edit-dialog.svelte
deleted file mode 100644
index 2917b9fa..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/oma/create-edit-dialog.svelte
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
-
- {title}
-
-
-
- {#if error}
-
{error}
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/lib/components/dashboard/units_of_measure/oma/data-table-actions.svelte b/frontend/src/lib/components/dashboard/units_of_measure/oma/data-table-actions.svelte
deleted file mode 100644
index 7627fe6d..00000000
--- a/frontend/src/lib/components/dashboard/units_of_measure/oma/data-table-actions.svelte
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
- {#snippet child({ props })}
-
- {/snippet}
-
-
- Acciones
- dialogOpen = true}>
-
- Editar
-
-
- {#if loading}
-
- {:else}
-
- {/if}
- Eliminar
-
-
-
-
-
diff --git a/frontend/src/routes/dashboard/clients_and_providers/+page.svelte b/frontend/src/routes/dashboard/clients_and_providers/+page.svelte
index ca02a3f0..a2401c3e 100644
--- a/frontend/src/routes/dashboard/clients_and_providers/+page.svelte
+++ b/frontend/src/routes/dashboard/clients_and_providers/+page.svelte
@@ -3,7 +3,6 @@
import { clientsProvidersApi, type ClientProvider } from '$lib/api/dashboard/a76/clients-providers';
import DataTable from '$lib/components/dashboard/clients_and_providers/data-table.svelte';
import { createColumns } from '$lib/components/dashboard/clients_and_providers/columns.js';
- import CreateEditDialog from '$lib/components/dashboard/clients_and_providers/create-edit-dialog.svelte';
import * as Card from '$lib/components/ui/card';
import { Button } from '$lib/components/ui/button';
import * as Select from '$lib/components/ui/select';
@@ -195,7 +194,7 @@
Gestiona el catálogo de clientes y proveedores de tu empresa
-