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..292e9844 100644 --- a/frontend/src/lib/api/dashboard/a76/clients-providers.ts +++ b/frontend/src/lib/api/dashboard/a76/clients-providers.ts @@ -5,14 +5,17 @@ import { api } from '$lib/api'; 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; + neighborhood?: string | null; + city?: string | null; + state?: string | null; + country?: string | null; + zip_code?: string | null; + client_id?: number; + interior_number?: string | null; + exterior_number?: string | null; + municipality?: string | null; } export interface ClientProviderPrograms { @@ -25,7 +28,7 @@ export interface ClientProviderPrograms { export interface ClientProvider { id: number; rfc: string; - name: string; + name: string; curp?: string | null; residence_country?: string | null; domicile_fiscal?: string | null; 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

- @@ -254,6 +253,3 @@ - - - diff --git a/frontend/src/routes/dashboard/clients_and_providers/edit/[[id]]/+page.svelte b/frontend/src/routes/dashboard/clients_and_providers/edit/[[id]]/+page.svelte new file mode 100644 index 00000000..bb94079f --- /dev/null +++ b/frontend/src/routes/dashboard/clients_and_providers/edit/[[id]]/+page.svelte @@ -0,0 +1,363 @@ + + +
+
+ +
+

{title}

+

+ {isEditing ? "Modifica los datos del registro existente." : "Completa los datos para el nuevo registro."} +

+
+
+ + + + Información General + Los campos marcados con * son obligatorios + + + {#if loading && isEditing && !formData.name} +
+ +
+ {:else} +
+ {#if error} +
+ 🚨 {error} +
+ {/if} + +
+

Información Básica

+ +
+
+ + +
+ +
+ + + + {typeLabels[formData.client_or_provider] || "Selecciona un tipo"} + + + Cliente + Proveedor + Ambos + + +
+
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+
+ +
+

Datos Fiscales

+
+
+ + +
+
+ + +
+
+
+ +
+

Dirección Física

+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+

Programas de Fomento

+
+
+ + +
+
+ + +
+
+
+ +
+ {/if} +
+
+
+ +
+ + + {#if !isEditing} + + {/if} + + +
\ No newline at end of file diff --git a/frontend/src/routes/dashboard/clients_and_providers/new/+page.svelte b/frontend/src/routes/dashboard/clients_and_providers/new/+page.svelte deleted file mode 100644 index 2888f15a..00000000 --- a/frontend/src/routes/dashboard/clients_and_providers/new/+page.svelte +++ /dev/null @@ -1,438 +0,0 @@ - - -
- -
- -
-

Nuevo Cliente/Proveedor

-

- Completa los datos para crear un nuevo cliente o proveedor -

-
-
- - - - - Información del Cliente/Proveedor - - Todos los campos marcados con * son obligatorios - - - -
- {#if error} -
- {error} -
- {/if} - - -
-

Información Básica

- -
-
- - -
- -
- - (formData.client_or_provider = value || "client")}> - - - - - Cliente - Proveedor - Ambos - - -
-
- -
- - -
- -
-
- - -
- -
- - -
-
-
- - -
-

Información Fiscal

- -
- - -
- -
- - -
-
- - -
-

Dirección

- -
- - -
- -
-
- - -
- -
- - -
-
- -
-
- - -
- -
- - -
-
- -
- - -
-
- - -
-

Programas

- -
-
- - -
- -
- - -
-
-
-
-
-
-
- - -
- - - -
- - -