diff --git a/modules/customers/src/web/components/customer-modal-selector/customer-empty-card.tsx b/modules/customers/src/web/components/customer-modal-selector/customer-empty-card.tsx
index fcfb39f7..44824592 100644
--- a/modules/customers/src/web/components/customer-modal-selector/customer-empty-card.tsx
+++ b/modules/customers/src/web/components/customer-modal-selector/customer-empty-card.tsx
@@ -1,10 +1,10 @@
-import { SearchIcon, UserPlusIcon } from "lucide-react";
+import { UserSearchIcon } from "lucide-react";
export const CustomerEmptyCard = () => {
return (
-
+
@@ -14,7 +14,6 @@ export const CustomerEmptyCard = () => {
Haz clic para buscar un cliente existente o crear uno nuevo
-
);
};
diff --git a/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx b/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx
index ba8dec2a..e28b859f 100644
--- a/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx
+++ b/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useState } from "react";
import { useCustomersSearchQuery } from "../../hooks";
-import { CustomerSummary } from "../../schemas";
+import { CustomerSummary, defaultCustomerFormData } from "../../schemas";
import { CustomerCard } from "./customer-card";
import { CustomerEmptyCard } from "./customer-empty-card";
import { CreateCustomerFormDialog } from "./customer-form-dialog";
@@ -30,7 +30,8 @@ export const CustomerModalSelector = ({ value, onValueChange }: CustomerModalSel
// Cliente seleccionado y creación local optimista
const [selected, setSelected] = useState(null);
- const [newClient, setNewClient] = useState>({ name: "", email: "" });
+ const [newClient, setNewClient] =
+ useState>(defaultCustomerFormData);
const [localCreated, setLocalCreated] = useState([]);
const {
@@ -61,19 +62,17 @@ export const CustomerModalSelector = ({ value, onValueChange }: CustomerModalSel
const handleCreate = () => {
if (!newClient.name || !newClient.email) return;
- const client: CustomerSummary = {
+ const newCustomer: CustomerSummary = {
id: crypto.randomUUID?.() ?? Date.now().toString(),
...newClient,
};
- setLocalCreated((prev) => [client, ...prev]);
- setSelected(client);
- onValueChange?.(client.id);
+ setLocalCreated((prev) => [newCustomer, ...prev]);
+ setSelected(newCustomer);
+ onValueChange?.(newCustomer.id);
setShowForm(false);
setShowSearch(false);
};
- console.log(customers);
-
return (
<>