From 5f9405d1a07139d6d0c466165d69b1eec2ea07e5 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 Apr 2026 19:28:47 +0200 Subject: [PATCH] Cambios --- .../proforma-header.tsx | 17 +-- .../use-proforma-grid-columns.tsx | 7 +- .../list/ui/pages/list-proformas-page.tsx | 4 +- .../update/ui/pages/proforma-update-page.tsx | 1 + .../ui/dialogs/select-customer-dialog.tsx | 103 +++++------------- .../select-customer-selection-list.tsx | 77 +++++++++++++ .../customer-header.tsx | 16 +-- .../use-customer-grid-columns.tsx | 18 +-- .../src/web/list/ui/components/index.ts | 1 - .../src/web/list/ui/components/initials.tsx | 4 - 10 files changed, 119 insertions(+), 129 deletions(-) create mode 100644 modules/customers/src/common/features/customer-selection/ui/dialogs/select-customer-selection-list.tsx delete mode 100644 modules/customers/src/web/list/ui/components/initials.tsx diff --git a/modules/customer-invoices/src/web/proformas/list/ui/blocks/proforma-summary-panel/proforma-header.tsx b/modules/customer-invoices/src/web/proformas/list/ui/blocks/proforma-summary-panel/proforma-header.tsx index bb295430..604de0b1 100644 --- a/modules/customer-invoices/src/web/proformas/list/ui/blocks/proforma-summary-panel/proforma-header.tsx +++ b/modules/customer-invoices/src/web/proformas/list/ui/blocks/proforma-summary-panel/proforma-header.tsx @@ -1,8 +1,9 @@ -import { Avatar, AvatarFallback, Badge } from "@repo/shadcn-ui/components"; +import { InitialsAvatar } from "@repo/rdx-ui/components"; +import { Badge } from "@repo/shadcn-ui/components"; import { Building2Icon, CopyIcon, UserIcon } from "lucide-react"; import type { Proforma } from "../../../../shared"; -import { Initials, ProformaStatusBadge } from "../../components"; +import { ProformaStatusBadge } from "../../components"; export const ProformaHeader = ({ proforma }: { proforma: Proforma }) => { const handleCopyTin = async () => { @@ -16,17 +17,7 @@ export const ProformaHeader = ({ proforma }: { proforma: Proforma }) => { return (
- - - - - +
diff --git a/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx b/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx index 2c8ea746..aa38d346 100644 --- a/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx +++ b/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx @@ -103,7 +103,6 @@ export function useProformasGridColumns(
-
+ + + + + ); }; - -type CustomerSelectionListProps = { - customers: CustomerSelectionOption[]; - isLoading: boolean; - onSelect: (customer: CustomerSelectionOption) => void; -}; - -const CustomerSelectionList = ({ customers, isLoading, onSelect }: CustomerSelectionListProps) => { - const { t } = useTranslation(); - - //const columns = useCustomersGridColumns({}); - - if (isLoading) { - return ( -
-
-
-
-
- ); - } - - if (customers.length === 0) { - return ; - } - - return ( - - {customers.map((customer) => ( - onSelect(customer)} - role="listitem" - > - - - {customer.name} - {customer.tin} - - - - ))} - - ); -}; diff --git a/modules/customers/src/common/features/customer-selection/ui/dialogs/select-customer-selection-list.tsx b/modules/customers/src/common/features/customer-selection/ui/dialogs/select-customer-selection-list.tsx new file mode 100644 index 00000000..1a606c31 --- /dev/null +++ b/modules/customers/src/common/features/customer-selection/ui/dialogs/select-customer-selection-list.tsx @@ -0,0 +1,77 @@ +import { InitialsAvatar } from "@repo/rdx-ui/components"; +import { + Item, + ItemContent, + ItemDescription, + ItemGroup, + ItemMedia, + ItemTitle, +} from "@repo/shadcn-ui/components"; +import { cn } from "@repo/shadcn-ui/lib/utils"; + +import { useTranslation } from "../../../../../web/i18n"; +import type { CustomerSelectionOption } from "../../entities"; + +import { SelectCustomerEmptyCard } from "./select-customer-empty-card"; + +type SelectCustomerSelectionListProps = { + customers: CustomerSelectionOption[]; + isLoading: boolean; + selectedCustomer?: CustomerSelectionOption; + onSelect: (customer: CustomerSelectionOption) => void; +}; + +export const SelectCustomerSelectionList = ({ + customers, + isLoading, + selectedCustomer, + onSelect, +}: SelectCustomerSelectionListProps) => { + const { t } = useTranslation(); + + //const columns = useCustomersGridColumns({}); + console.log(selectedCustomer); + + if (isLoading) { + return ( +
+
+
+
+
+ ); + } + + if (customers.length === 0) { + return ; + } + + return ( + + {customers.map((customer) => ( + onSelect(customer)} + role="listitem" + variant={"outline"} + > + + + + + + {customer.name} + {customer.tin} + + + ))} + + ); +}; diff --git a/modules/customers/src/web/list/ui/blocks/customer-summary-panel/customer-header.tsx b/modules/customers/src/web/list/ui/blocks/customer-summary-panel/customer-header.tsx index 25a98955..72a20133 100644 --- a/modules/customers/src/web/list/ui/blocks/customer-summary-panel/customer-header.tsx +++ b/modules/customers/src/web/list/ui/blocks/customer-summary-panel/customer-header.tsx @@ -1,24 +1,14 @@ -import { Avatar, AvatarFallback, Badge } from "@repo/shadcn-ui/components"; +import { InitialsAvatar } from "@repo/rdx-ui/components"; +import { Badge } from "@repo/shadcn-ui/components"; import { Building2Icon, CopyIcon, UserIcon } from "lucide-react"; import type { Customer } from "../../../../shared"; -import { Initials } from "../../components"; export const CustomerHeader = ({ customer }: { customer: Customer }) => { return (
- - - - - +
diff --git a/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx b/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx index 2a01f584..baa4fb30 100644 --- a/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx +++ b/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx @@ -1,8 +1,6 @@ import { safeHTTPUrl } from "@erp/core/client"; -import { DataTableColumnHeader } from "@repo/rdx-ui/components"; +import { DataTableColumnHeader, InitialsAvatar } from "@repo/rdx-ui/components"; import { - Avatar, - AvatarFallback, Badge, Button, DropdownMenu, @@ -18,7 +16,7 @@ import * as React from "react"; import { useTranslation } from "../../../../i18n"; import type { CustomerListRow } from "../../../../shared"; -import { AddressCell, ContactCell, Initials } from "../../components"; +import { AddressCell, ContactCell } from "../../components"; type GridActionHandlers = { onEditClick?: (customer: CustomerListRow) => void; @@ -58,17 +56,7 @@ export function useCustomersGridColumns( type="button" >
- - - - - +
diff --git a/modules/customers/src/web/list/ui/components/index.ts b/modules/customers/src/web/list/ui/components/index.ts index 46dd269b..c73ea6d7 100644 --- a/modules/customers/src/web/list/ui/components/index.ts +++ b/modules/customers/src/web/list/ui/components/index.ts @@ -1,5 +1,4 @@ export * from "./address-cell"; export * from "./contact-cell"; -export * from "./initials"; export * from "./kind-badge"; export * from "./soft"; diff --git a/modules/customers/src/web/list/ui/components/initials.tsx b/modules/customers/src/web/list/ui/components/initials.tsx deleted file mode 100644 index 87b187ca..00000000 --- a/modules/customers/src/web/list/ui/components/initials.tsx +++ /dev/null @@ -1,4 +0,0 @@ -export const Initials = ({ name }: { name: string }) => { - const parts = name.trim().split(/\s+/).slice(0, 2); - return <> {parts.map((p) => p[0]?.toUpperCase() ?? "").join("") || "?"} ; -};