diff --git a/backend/api/v1/modules/a76/company/__init__.py b/backend/api/v1/modules/a76/general_catalogs/company/__init__.py similarity index 100% rename from backend/api/v1/modules/a76/company/__init__.py rename to backend/api/v1/modules/a76/general_catalogs/company/__init__.py diff --git a/backend/api/v1/modules/a76/company/dto.py b/backend/api/v1/modules/a76/general_catalogs/company/dto.py similarity index 100% rename from backend/api/v1/modules/a76/company/dto.py rename to backend/api/v1/modules/a76/general_catalogs/company/dto.py diff --git a/backend/api/v1/modules/a76/company/models.py b/backend/api/v1/modules/a76/general_catalogs/company/models.py similarity index 98% rename from backend/api/v1/modules/a76/company/models.py rename to backend/api/v1/modules/a76/general_catalogs/company/models.py index aee82269..76a565fc 100644 --- a/backend/api/v1/modules/a76/company/models.py +++ b/backend/api/v1/modules/a76/general_catalogs/company/models.py @@ -22,7 +22,7 @@ class Company(Base, TimestampMixin): Modelo para la tabla Company - Información de la empresa """ - __tablename__ = "company" + __tablename__ = "company" #GEmpresa __table_args__ = ( PrimaryKeyConstraint("id", name="company_pkey"), ForeignKeyConstraint( diff --git a/backend/api/v1/modules/a76/company/routes.py b/backend/api/v1/modules/a76/general_catalogs/company/routes.py similarity index 98% rename from backend/api/v1/modules/a76/company/routes.py rename to backend/api/v1/modules/a76/general_catalogs/company/routes.py index 90efa2cc..0095bc4d 100644 --- a/backend/api/v1/modules/a76/company/routes.py +++ b/backend/api/v1/modules/a76/general_catalogs/company/routes.py @@ -9,7 +9,7 @@ from sqlalchemy.orm import Session from core.database import get_core_db from core.security import get_current_user, validate_access_to_resource -from ....common.tenant_crud_routes import TenantCRUDRoutes +from .....common.tenant_crud_routes import TenantCRUDRoutes from .dto import CompanyCreateDTO, CompanyResponseDTO, CompanyUpdateDTO from .models import Company from .service import CompanyService diff --git a/backend/api/v1/modules/a76/company/service.py b/backend/api/v1/modules/a76/general_catalogs/company/service.py similarity index 100% rename from backend/api/v1/modules/a76/company/service.py rename to backend/api/v1/modules/a76/general_catalogs/company/service.py diff --git a/backend/api/v1/modules/a76/company/test_company.py b/backend/api/v1/modules/a76/general_catalogs/company/test_company.py similarity index 100% rename from backend/api/v1/modules/a76/company/test_company.py rename to backend/api/v1/modules/a76/general_catalogs/company/test_company.py diff --git a/backend/api/v1/modules/a76/exchange_rate/dto.py b/backend/api/v1/modules/a76/general_catalogs/exchange_rate/dto.py similarity index 100% rename from backend/api/v1/modules/a76/exchange_rate/dto.py rename to backend/api/v1/modules/a76/general_catalogs/exchange_rate/dto.py diff --git a/backend/api/v1/modules/a76/exchange_rate/models.py b/backend/api/v1/modules/a76/general_catalogs/exchange_rate/models.py similarity index 100% rename from backend/api/v1/modules/a76/exchange_rate/models.py rename to backend/api/v1/modules/a76/general_catalogs/exchange_rate/models.py diff --git a/backend/api/v1/modules/a76/exchange_rate/routes.py b/backend/api/v1/modules/a76/general_catalogs/exchange_rate/routes.py similarity index 100% rename from backend/api/v1/modules/a76/exchange_rate/routes.py rename to backend/api/v1/modules/a76/general_catalogs/exchange_rate/routes.py diff --git a/backend/api/v1/modules/a76/exchange_rate/services.py b/backend/api/v1/modules/a76/general_catalogs/exchange_rate/services.py similarity index 100% rename from backend/api/v1/modules/a76/exchange_rate/services.py rename to backend/api/v1/modules/a76/general_catalogs/exchange_rate/services.py diff --git a/backend/api/v1/modules/a76/exchange_rate/test_exchange_rate.py b/backend/api/v1/modules/a76/general_catalogs/exchange_rate/test_exchange_rate.py similarity index 100% rename from backend/api/v1/modules/a76/exchange_rate/test_exchange_rate.py rename to backend/api/v1/modules/a76/general_catalogs/exchange_rate/test_exchange_rate.py diff --git a/backend/api/v1/modules/a76/package/dto.py b/backend/api/v1/modules/a76/general_catalogs/packages/dto.py similarity index 100% rename from backend/api/v1/modules/a76/package/dto.py rename to backend/api/v1/modules/a76/general_catalogs/packages/dto.py diff --git a/backend/api/v1/modules/a76/package/models.py b/backend/api/v1/modules/a76/general_catalogs/packages/models.py similarity index 100% rename from backend/api/v1/modules/a76/package/models.py rename to backend/api/v1/modules/a76/general_catalogs/packages/models.py diff --git a/backend/api/v1/modules/a76/package/routes.py b/backend/api/v1/modules/a76/general_catalogs/packages/routes.py similarity index 100% rename from backend/api/v1/modules/a76/package/routes.py rename to backend/api/v1/modules/a76/general_catalogs/packages/routes.py diff --git a/backend/api/v1/modules/a76/package/services.py b/backend/api/v1/modules/a76/general_catalogs/packages/services.py similarity index 100% rename from backend/api/v1/modules/a76/package/services.py rename to backend/api/v1/modules/a76/general_catalogs/packages/services.py diff --git a/backend/api/v1/modules/a76/package/test_package.py b/backend/api/v1/modules/a76/general_catalogs/packages/test_package.py similarity index 100% rename from backend/api/v1/modules/a76/package/test_package.py rename to backend/api/v1/modules/a76/general_catalogs/packages/test_package.py diff --git a/backend/api/v1/modules/a76/seal/dto.py b/backend/api/v1/modules/a76/general_catalogs/seal/dto.py similarity index 100% rename from backend/api/v1/modules/a76/seal/dto.py rename to backend/api/v1/modules/a76/general_catalogs/seal/dto.py diff --git a/backend/api/v1/modules/a76/seal/models.py b/backend/api/v1/modules/a76/general_catalogs/seal/models.py similarity index 100% rename from backend/api/v1/modules/a76/seal/models.py rename to backend/api/v1/modules/a76/general_catalogs/seal/models.py diff --git a/backend/api/v1/modules/a76/seal/routes.py b/backend/api/v1/modules/a76/general_catalogs/seal/routes.py similarity index 100% rename from backend/api/v1/modules/a76/seal/routes.py rename to backend/api/v1/modules/a76/general_catalogs/seal/routes.py diff --git a/backend/api/v1/modules/a76/seal/services.py b/backend/api/v1/modules/a76/general_catalogs/seal/services.py similarity index 100% rename from backend/api/v1/modules/a76/seal/services.py rename to backend/api/v1/modules/a76/general_catalogs/seal/services.py diff --git a/backend/api/v1/modules/a76/seal/test_seal.py b/backend/api/v1/modules/a76/general_catalogs/seal/test_seal.py similarity index 100% rename from backend/api/v1/modules/a76/seal/test_seal.py rename to backend/api/v1/modules/a76/general_catalogs/seal/test_seal.py diff --git a/backend/api/v1/modules/a76/router.py b/backend/api/v1/modules/a76/router.py index 47083ec0..7f443981 100644 --- a/backend/api/v1/modules/a76/router.py +++ b/backend/api/v1/modules/a76/router.py @@ -11,22 +11,22 @@ from .customs_brokers.routes import router as customs_broker_router from .auth import router as auth_router from .classes import router as classes_router from .clients_and_providers import router as client_and_provider_router -from .company import router as company_router +from .general_catalogs.company import router as company_router from .country_rule_oct.routes import router as country_rule_oct_router -from .drivers.routes import router as drivers_router -from .exchange_rate.routes import router as exchange_rate_router +from .transportation.drivers.routes import router as drivers_router +from .general_catalogs.exchange_rate.routes import router as exchange_rate_router from .fraction_rule_octave.routes import router as fraction_rule_octave_router from .licenses import router as licenses_router -from .package.routes import router as package_router +from .general_catalogs.packages.routes import router as package_router from .parts import router as parts_router from .pedmientos.router import router as pedimentos_router from .permission_rule_oct.routes import router as permission_rule_oct_router -from .seal.routes import router as seal_router +from .general_catalogs.seal.routes import router as seal_router from .tenants import router as tenants_router -from .trailers.routes import router as trailers_router -from .transporters.routes import router as transporters_router +from .transportation.trailers.routes import router as trailers_router +from .transportation.transporters.routes import router as transporters_router from .user_tenant.routes import router as user_tenant_router -from .vehicles.routes import router as vehicles_router +from .transportation.vehicles.routes import router as vehicles_router # Router principal router = APIRouter() diff --git a/backend/api/v1/modules/a76/drivers/dto.py b/backend/api/v1/modules/a76/transportation/drivers/dto.py similarity index 100% rename from backend/api/v1/modules/a76/drivers/dto.py rename to backend/api/v1/modules/a76/transportation/drivers/dto.py diff --git a/backend/api/v1/modules/a76/drivers/models.py b/backend/api/v1/modules/a76/transportation/drivers/models.py similarity index 100% rename from backend/api/v1/modules/a76/drivers/models.py rename to backend/api/v1/modules/a76/transportation/drivers/models.py diff --git a/backend/api/v1/modules/a76/drivers/routes.py b/backend/api/v1/modules/a76/transportation/drivers/routes.py similarity index 100% rename from backend/api/v1/modules/a76/drivers/routes.py rename to backend/api/v1/modules/a76/transportation/drivers/routes.py diff --git a/backend/api/v1/modules/a76/drivers/services.py b/backend/api/v1/modules/a76/transportation/drivers/services.py similarity index 100% rename from backend/api/v1/modules/a76/drivers/services.py rename to backend/api/v1/modules/a76/transportation/drivers/services.py diff --git a/backend/api/v1/modules/a76/trailers/dto.py b/backend/api/v1/modules/a76/transportation/trailers/dto.py similarity index 100% rename from backend/api/v1/modules/a76/trailers/dto.py rename to backend/api/v1/modules/a76/transportation/trailers/dto.py diff --git a/backend/api/v1/modules/a76/trailers/models.py b/backend/api/v1/modules/a76/transportation/trailers/models.py similarity index 100% rename from backend/api/v1/modules/a76/trailers/models.py rename to backend/api/v1/modules/a76/transportation/trailers/models.py diff --git a/backend/api/v1/modules/a76/trailers/routes.py b/backend/api/v1/modules/a76/transportation/trailers/routes.py similarity index 100% rename from backend/api/v1/modules/a76/trailers/routes.py rename to backend/api/v1/modules/a76/transportation/trailers/routes.py diff --git a/backend/api/v1/modules/a76/trailers/services.py b/backend/api/v1/modules/a76/transportation/trailers/services.py similarity index 100% rename from backend/api/v1/modules/a76/trailers/services.py rename to backend/api/v1/modules/a76/transportation/trailers/services.py diff --git a/backend/api/v1/modules/a76/transporters/dto.py b/backend/api/v1/modules/a76/transportation/transporters/dto.py similarity index 100% rename from backend/api/v1/modules/a76/transporters/dto.py rename to backend/api/v1/modules/a76/transportation/transporters/dto.py diff --git a/backend/api/v1/modules/a76/transporters/models.py b/backend/api/v1/modules/a76/transportation/transporters/models.py similarity index 100% rename from backend/api/v1/modules/a76/transporters/models.py rename to backend/api/v1/modules/a76/transportation/transporters/models.py diff --git a/backend/api/v1/modules/a76/transporters/routes.py b/backend/api/v1/modules/a76/transportation/transporters/routes.py similarity index 100% rename from backend/api/v1/modules/a76/transporters/routes.py rename to backend/api/v1/modules/a76/transportation/transporters/routes.py diff --git a/backend/api/v1/modules/a76/transporters/services.py b/backend/api/v1/modules/a76/transportation/transporters/services.py similarity index 100% rename from backend/api/v1/modules/a76/transporters/services.py rename to backend/api/v1/modules/a76/transportation/transporters/services.py diff --git a/backend/api/v1/modules/a76/vehicles/dto.py b/backend/api/v1/modules/a76/transportation/vehicles/dto.py similarity index 100% rename from backend/api/v1/modules/a76/vehicles/dto.py rename to backend/api/v1/modules/a76/transportation/vehicles/dto.py diff --git a/backend/api/v1/modules/a76/vehicles/models.py b/backend/api/v1/modules/a76/transportation/vehicles/models.py similarity index 100% rename from backend/api/v1/modules/a76/vehicles/models.py rename to backend/api/v1/modules/a76/transportation/vehicles/models.py diff --git a/backend/api/v1/modules/a76/vehicles/routes.py b/backend/api/v1/modules/a76/transportation/vehicles/routes.py similarity index 100% rename from backend/api/v1/modules/a76/vehicles/routes.py rename to backend/api/v1/modules/a76/transportation/vehicles/routes.py diff --git a/backend/api/v1/modules/a76/vehicles/services.py b/backend/api/v1/modules/a76/transportation/vehicles/services.py similarity index 100% rename from backend/api/v1/modules/a76/vehicles/services.py rename to backend/api/v1/modules/a76/transportation/vehicles/services.py diff --git a/frontend/src/lib/api/dashboard/a76/customs-brokers.ts b/frontend/src/lib/api/dashboard/a76/customs-brokers.ts new file mode 100644 index 00000000..ed496e6a --- /dev/null +++ b/frontend/src/lib/api/dashboard/a76/customs-brokers.ts @@ -0,0 +1,128 @@ +/** + * API Client para Agentes Aduanales (Customs Brokers) + * Gestiona las operaciones CRUD para agentes aduanales + */ +import { api } from '$lib/api'; + +export interface CustomsBroker { + type?: string | null; + broker_key: string; + name?: string | null; + address?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + phone?: string | null; + fax?: string | null; + email?: string | null; + country?: string | null; + tax_id?: string | null; + personal_id?: string | null; + position?: string | null; + license?: string | null; + company?: string | null; + contact?: string | null; + tenant_id: string; + company_id: string; +} + +export interface CustomsBrokerVU { + certificate_path?: string | null; + key_path?: string | null; + access_key?: string | null; + fiel_format?: string | null; + signature_read_path?: string | null; + archive_path?: string | null; + fiel_access_key?: string | null; + web_service_user?: string | null; + web_service_access_key?: string | null; + vu_email?: string | null; + vu_figure_type?: string | null; + xml_files_path?: string | null; + query_tax_id?: string | null; + doda_certificate_path?: string | null; + doda_key_path?: string | null; + doda_web_service_user?: string | null; + doda_web_service_access_key?: string | null; + doda_fiel_access_key?: string | null; + doda_xml_files_path?: string | null; +} + +export interface CustomsBrokerPersonnel { + broker_key: string; + line: number; + name?: string | null; + tax_id?: string | null; + personal_id?: string | null; + position?: string | null; + license?: string | null; + first_name?: string | null; + last_name?: string | null; + middle_name?: string | null; + email?: string | null; +} + +export interface CreateCustomsBrokerData { + type?: string | null; + broker_key: string; + name?: string | null; + address?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + phone?: string | null; + fax?: string | null; + email?: string | null; + country?: string | null; + tax_id?: string | null; + personal_id?: string | null; + position?: string | null; + license?: string | null; + company?: string | null; + contact?: string | null; + tenant_id: string; + company_id: string; +} + +/** + * API para Agentes Aduanales + */ +export const customsBrokersApi = { + /** + * Obtiene un agente aduanal por su clave + */ + get: (brokerKey: string) => { + return api.get(`/api/v1/a76/customs-broker/${brokerKey}`); + }, + + /** + * Crea un nuevo agente aduanal + */ + create: (data: CreateCustomsBrokerData) => { + return api.post('/api/v1/a76/customs-broker', data); + }, + + /** + * Elimina un agente aduanal + */ + delete: (brokerKey: string) => { + return api.delete(`/api/v1/a76/customs-broker/${brokerKey}`); + }, + + /** + * Actualiza la información de VU de un agente aduanal + */ + updateVU: (brokerKey: string, data: CustomsBrokerVU) => { + return api.put(`/api/v1/a76/customs-broker-vu/${brokerKey}`, data); + }, + + /** + * Actualiza el personal de un agente aduanal + */ + updatePersonnel: (brokerKey: string, line: number, data: CustomsBrokerPersonnel) => { + return api.put( + `/api/v1/a76/customs-broker-personnel/${brokerKey}/${line}`, + data + ); + } +}; diff --git a/frontend/src/lib/components/dashboard/customs_brokers/columns.ts b/frontend/src/lib/components/dashboard/customs_brokers/columns.ts new file mode 100644 index 00000000..993c6763 --- /dev/null +++ b/frontend/src/lib/components/dashboard/customs_brokers/columns.ts @@ -0,0 +1,129 @@ +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 { CustomsBroker } from "$lib/api/dashboard/a76/customs-brokers"; + +export type { CustomsBroker }; + +export function createColumns(onSuccess?: () => void): ColumnDef[] { + return [ + { + accessorKey: "broker_key", + header: "Clave", + cell: ({ row }) => { + const keySnippet = createRawSnippet<[{ key: string }]>((getKey) => { + const { key } = getKey(); + return { + render: () => + `${key}` + }; + }); + return renderSnippet(keySnippet, { key: row.original.broker_key }); + } + }, + { + accessorKey: "name", + header: "Nombre", + cell: ({ row }) => { + const nameSnippet = createRawSnippet<[{ name: string | null | undefined }]>((getName) => { + const { name } = getName(); + return { + render: () => `
${name || '-'}
` + }; + }); + return renderSnippet(nameSnippet, { name: row.original.name }); + } + }, + { + accessorKey: "type", + header: "Tipo", + cell: ({ row }) => { + const typeSnippet = createRawSnippet<[{ type: string | null | undefined }]>((getType) => { + const { type } = getType(); + return { + render: () => `
${type || '-'}
` + }; + }); + return renderSnippet(typeSnippet, { type: row.original.type }); + } + }, + { + accessorKey: "license", + header: "Patente", + cell: ({ row }) => { + const licenseSnippet = createRawSnippet<[{ license: string | null | undefined }]>((getLicense) => { + const { license } = getLicense(); + return { + render: () => + license + ? `${license}` + : `-` + }; + }); + return renderSnippet(licenseSnippet, { license: row.original.license }); + } + }, + { + accessorKey: "tax_id", + header: "RFC", + cell: ({ row }) => { + const taxIdSnippet = createRawSnippet<[{ taxId: string | null | undefined }]>((getTaxId) => { + const { taxId } = getTaxId(); + return { + render: () => `
${taxId || '-'}
` + }; + }); + return renderSnippet(taxIdSnippet, { taxId: row.original.tax_id }); + } + }, + { + accessorKey: "email", + header: "Email", + cell: ({ row }) => { + const emailSnippet = createRawSnippet<[{ email: string | null | undefined }]>((getEmail) => { + const { email } = getEmail(); + return { + render: () => `
${email || '-'}
` + }; + }); + return renderSnippet(emailSnippet, { email: row.original.email }); + } + }, + { + accessorKey: "phone", + header: "Teléfono", + cell: ({ row }) => { + const phoneSnippet = createRawSnippet<[{ phone: string | null | undefined }]>((getPhone) => { + const { phone } = getPhone(); + return { + render: () => `
${phone || '-'}
` + }; + }); + return renderSnippet(phoneSnippet, { phone: row.original.phone }); + } + }, + { + accessorKey: "city", + header: "Ciudad", + cell: ({ row }) => { + const citySnippet = createRawSnippet<[{ city: string | null | undefined }]>((getCity) => { + const { city } = getCity(); + return { + render: () => `
${city || '-'}
` + }; + }); + return renderSnippet(citySnippet, { city: row.original.city }); + } + }, + { + id: "actions", + cell: ({ row }) => { + return renderComponent(DataTableActions, { + broker: row.original, + onSuccess + }); + } + } + ]; +} diff --git a/frontend/src/lib/components/dashboard/customs_brokers/create-dialog.svelte b/frontend/src/lib/components/dashboard/customs_brokers/create-dialog.svelte new file mode 100644 index 00000000..e623e2f2 --- /dev/null +++ b/frontend/src/lib/components/dashboard/customs_brokers/create-dialog.svelte @@ -0,0 +1,381 @@ + + + + + + Nuevo Agente Aduanal + + Completa los datos para crear un nuevo agente aduanal. + + + +
+ {#if error} +
+ {error} +
+ {/if} + + +
+

Información Básica

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

Información de Contacto

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

Dirección

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

Información Fiscal

+ +
+
+ + +
+ +
+ + +
+
+ +
+ + +
+
+ + + + + +
+
+
diff --git a/frontend/src/lib/components/dashboard/customs_brokers/data-table-actions.svelte b/frontend/src/lib/components/dashboard/customs_brokers/data-table-actions.svelte new file mode 100644 index 00000000..5a6f7281 --- /dev/null +++ b/frontend/src/lib/components/dashboard/customs_brokers/data-table-actions.svelte @@ -0,0 +1,75 @@ + + + + + + + + + Acciones + + Copiar clave + + {#if broker.tax_id} + + Copiar RFC + + {/if} + + + + + Ver detalles + + + Eliminar + + + + + + + diff --git a/frontend/src/lib/components/dashboard/customs_brokers/data-table.svelte b/frontend/src/lib/components/dashboard/customs_brokers/data-table.svelte new file mode 100644 index 00000000..a922ec82 --- /dev/null +++ b/frontend/src/lib/components/dashboard/customs_brokers/data-table.svelte @@ -0,0 +1,70 @@ + + +
+
+ + + {#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} + + +
+
diff --git a/frontend/src/lib/components/dashboard/customs_brokers/delete-dialog.svelte b/frontend/src/lib/components/dashboard/customs_brokers/delete-dialog.svelte new file mode 100644 index 00000000..3e24770d --- /dev/null +++ b/frontend/src/lib/components/dashboard/customs_brokers/delete-dialog.svelte @@ -0,0 +1,122 @@ + + + + + + ¿Estás seguro? + +

Esta acción no se puede deshacer. Se eliminará permanentemente este agente aduanal:

+ {#if broker} +
+
+ Clave: + {broker.broker_key} +
+ {#if broker.name} +
+ Nombre: + {broker.name} +
+ {/if} + {#if broker.license} +
+ Patente: + {broker.license} +
+ {/if} +
+ {/if} + {#if error} +
+ {error} +
+ {/if} +
+
+ + Cancelar + + {#if loading} + + + + + Eliminando... + {:else} + Eliminar + {/if} + + +
+
diff --git a/frontend/src/lib/components/dashboard/customs_brokers/details-dialog.svelte b/frontend/src/lib/components/dashboard/customs_brokers/details-dialog.svelte new file mode 100644 index 00000000..6d1a0a04 --- /dev/null +++ b/frontend/src/lib/components/dashboard/customs_brokers/details-dialog.svelte @@ -0,0 +1,192 @@ + + + + + + Detalles del Agente Aduanal + + Información completa del agente aduanal + + + + {#if broker} +
+ +
+

Información Básica

+ +
+
+ Clave + {broker.broker_key} +
+ + {#if broker.license} +
+ Patente + {broker.license} +
+ {/if} +
+ + {#if broker.name} +
+ Nombre + {broker.name} +
+ {/if} + + {#if broker.type} +
+ Tipo + {broker.type} +
+ {/if} + + {#if broker.company} +
+ Empresa + {broker.company} +
+ {/if} + + +
+ + +
+

Información de Contacto

+ + {#if broker.contact} +
+ Contacto + {broker.contact} +
+ {/if} + +
+ {#if broker.phone} +
+ Teléfono + {broker.phone} +
+ {/if} + + {#if broker.fax} +
+ Fax + {broker.fax} +
+ {/if} +
+ + {#if broker.email} + + {/if} + + +
+ + +
+

Dirección

+ + {#if broker.address} +
+ Dirección + {broker.address} +
+ {/if} + +
+ {#if broker.postal_code} +
+ C.P. + {broker.postal_code} +
+ {/if} + + {#if broker.city} +
+ Ciudad + {broker.city} +
+ {/if} + + {#if broker.state} +
+ Estado + {broker.state} +
+ {/if} +
+ + {#if broker.country} +
+ País + {broker.country} +
+ {/if} + + +
+ + +
+

Información Fiscal

+ + {#if broker.tax_id} +
+ RFC + {broker.tax_id} +
+ {/if} + + {#if broker.personal_id} +
+ CURP + {broker.personal_id} +
+ {/if} + + {#if broker.position} +
+ Posición + {broker.position} +
+ {/if} +
+
+ {:else} +
+ No hay información disponible +
+ {/if} + + + + +
+
diff --git a/frontend/src/routes/dashboard/customs_brokers/+page.server.ts b/frontend/src/routes/dashboard/customs_brokers/+page.server.ts new file mode 100644 index 00000000..490bb9ba --- /dev/null +++ b/frontend/src/routes/dashboard/customs_brokers/+page.server.ts @@ -0,0 +1,21 @@ +import type { PageServerLoad } from './$types'; +import { getAuthTokens } from '$lib/server/api'; + +export const load: PageServerLoad = async ({ cookies, parent }) => { + // Esperar a que el layout padre valide/refresque el token + const parentData = await parent(); + + const { accessToken } = getAuthTokens(cookies); + + if (!accessToken) { + return { + error: 'No authenticated', + companies: parentData.companies || [] + }; + } + + return { + companies: parentData.companies || [], + error: null + }; +}; diff --git a/frontend/src/routes/dashboard/customs_brokers/+page.svelte b/frontend/src/routes/dashboard/customs_brokers/+page.svelte new file mode 100644 index 00000000..528b31f7 --- /dev/null +++ b/frontend/src/routes/dashboard/customs_brokers/+page.svelte @@ -0,0 +1,253 @@ + + +
+ +
+
+

Agentes Aduanales

+

+ Gestiona el catálogo de agentes aduanales +

+
+ +
+ + + + + Buscar Agente Aduanal + + Ingresa la clave del agente aduanal para buscarlo + {#if companyStore.activeCompany} + - Compañía: {companyStore.activeCompany.name} + {/if} + + + +
{ e.preventDefault(); handleSearch(); }} class="space-y-4"> +
+
+ + +
+
+ + {#if searchedBroker} + + {/if} +
+
+ + {#if searchError} +
+ {searchError} +
+ {/if} +
+
+
+ + + {#if searchedBroker} + + +
+
+ Resultado de la Búsqueda + + Se encontró 1 agente aduanal + +
+
+
+ + + +
+ {/if} +
+ + +