From f9ffe1f2a8d2722312d5e9aaf8af15403e0b023c Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Sat, 12 Apr 2025 01:08:23 +0000 Subject: [PATCH] Fix domain creation and enhance customer creation. Added more optional fields to customer creation and fixed a bug preventing domain creation when no customer was selected. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/c1009a9a-4ed8-4285-853d-b523c88c7bff.jpg --- client/src/pages/domains.tsx | 7 +- client/src/pages/settings.tsx | 221 +++++++++++++++++++++++++++++++++- shared/schema.ts | 45 +++++++ 3 files changed, 267 insertions(+), 6 deletions(-) diff --git a/client/src/pages/domains.tsx b/client/src/pages/domains.tsx index e0ea3b4..cca5e6d 100644 --- a/client/src/pages/domains.tsx +++ b/client/src/pages/domains.tsx @@ -92,10 +92,14 @@ export default function DomainsPage() { // Add domain mutation const addDomainMutation = useMutation({ mutationFn: async (data: z.infer) => { + if (!currentCustomer?.id) { + throw new Error("No customer selected"); + } + // Prepare domain data with customerId const domainData: InsertDomain = { ...data, - customerId: currentCustomer?.id || "", + customerId: currentCustomer.id, }; // Add special handling for providerId @@ -106,6 +110,7 @@ export default function DomainsPage() { } console.log("Submitting domain with provider:", domainData.providerId); + console.log("Customer ID:", domainData.customerId); const res = await apiRequest("POST", "/api/domains", domainData); return await res.json(); diff --git a/client/src/pages/settings.tsx b/client/src/pages/settings.tsx index 4061d67..0acf4b8 100644 --- a/client/src/pages/settings.tsx +++ b/client/src/pages/settings.tsx @@ -461,17 +461,17 @@ export default function SettingsPage() {
{ - createOrganizationMutation.mutate(data); - createOrganizationForm.reset(); + createCustomerMutation.mutate(data); + createCustomerForm.reset(); })} className="space-y-4" > ( - Customer Name + Customer Name* @@ -481,7 +481,218 @@ export default function SettingsPage() { /> ( + + Description + + + + + A brief description of the customer's business + + + + )} + /> + +
+ ( + + Email + + + + + + )} + /> + + ( + + Phone + + + + + + )} + /> +
+ + ( + + Website + + + + + + )} + /> + + ( + + Industry + + + + + + )} + /> + +
+

Address Information

+
+ ( + + Address + + + + + + )} + /> + + ( + + City + + + + + + )} + /> + + ( + + State/Province + + + + + + )} + /> + + ( + + ZIP/Postal Code + + + + + + )} + /> + + ( + + Country + + + + + + )} + /> +
+
+ +
+

Billing Information

+
+ ( + + Billing Email + + + + + + )} + /> + + ( + + Billing Address + + + + + + )} + /> +
+
+ + ( + + Account Manager + + + + + + )} + /> + + ( + + Notes + +