import { AppContent, BackHistoryButton } from "@repo/rdx-ui/components"; import { Button, Card, CardContent, CardHeader, CardTitle } from "@repo/shadcn-ui/components"; import { Banknote, Building2, EditIcon, FileText, Globe, Languages, Mail, MapPin, MoreVertical, Phone, Smartphone, User, } from "lucide-react"; import { useNavigate } from "react-router-dom"; import { useUrlParamId } from "@erp/core/hooks"; import { Badge } from "@repo/shadcn-ui/components"; import { CustomerEditorSkeleton, ErrorAlert } from "../../components"; import { useCustomerQuery } from "../../hooks"; import { useTranslation } from "../../i18n"; export const CustomerViewPage = () => { const customerId = useUrlParamId(); const { t } = useTranslation(); const navigate = useNavigate(); // 1) Estado de carga del cliente (query) const { data: customer, isLoading: isLoadingCustomer, isError: isLoadError, error: loadError, } = useCustomerQuery(customerId, { enabled: !!customerId }); if (isLoadingCustomer) { return ; } if (isLoadError) { return ( <>
); } return ( <>
{/* Header */}
{customer?.is_company ? ( ) : ( )}

{customer?.name}

{customer?.reference} {customer?.is_company ? "Empresa" : "Persona"}
{/* Main Content Grid */}
{/* Información Básica */} Información Básica
Nombre
{customer?.name}
Referencia
{customer?.reference}
Registro Legal
{customer?.legalRecord}
Impuestos por Defecto
{customer?.defaultTax}
{/* Dirección */} Dirección
Calle
{customer?.street1} {customer?.street2 && ( <>
{customer?.street2} )}
Ciudad
{customer?.city}
Código Postal
{customer?.postal_code}
Provincia
{customer?.province}
País
{customer?.country}
{/* Información de Contacto */} Información de Contacto
{/* Contacto Principal */}

Contacto Principal

{customer?.email_primary && (
Email
{customer?.email_primary}
)} {customer?.mobile_primary && (
Móvil
{customer?.mobile_primary}
)} {customer?.phone_primary && (
Teléfono
{customer?.phone_primary}
)}
{/* Contacto Secundario */}

Contacto Secundario

{customer?.email_secondary && (
Email
{customer?.email_secondary}
)} {customer?.mobile_secondary && (
Móvil
{customer?.mobile_secondary}
)} {customer?.phone_secondary && (
Teléfono
{customer?.phone_secondary}
)}
{/* Otros Contactos */} {(customer?.website || customer?.fax) && (

Otros

{customer?.website && ( )} {customer?.fax && (
Fax
{customer?.fax}
)}
)}
{/* Preferencias */} Preferencias
Idioma Preferido
{customer?.language_code}
Moneda Preferida
{customer?.currency_code}
); };