diff --git a/src/app/portfolio/[slug]/components/BookSurveyModal.tsx b/src/app/portfolio/[slug]/components/BookSurveyModal.tsx new file mode 100644 index 0000000..58e7ce8 --- /dev/null +++ b/src/app/portfolio/[slug]/components/BookSurveyModal.tsx @@ -0,0 +1,81 @@ +"use client"; + +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogFooter, +} from "@/app/shadcn_components/ui/dialog"; +import { Button } from "@/app/shadcn_components/ui/button"; +import { Input } from "@/app/shadcn_components/ui/input"; +import { Label } from "@/app/shadcn_components/ui/label"; +import { useState, useEffect } from "react"; + +interface BookSurveyModalProps { + open: boolean; + onOpenChange: (open: boolean) => void; +} + +export default function BookSurveyModal({ open, onOpenChange }: BookSurveyModalProps) { + const [formData, setFormData] = useState({ + deal_name: "", + }); + + const handleChange = (e: React.ChangeEvent) => { + const { name, value } = e.target; + setFormData((prev) => ({ ...prev, [name]: value })); + }; + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log("Form submitted:", formData); + onOpenChange(false); // ✅ close on submit + }; + + // ✅ Reset form whenever modal closes + useEffect(() => { + if (!open) { + setFormData({ deal_name: ""}); + } + }, [open]); + + return ( + + + + Book a Survey + + +
+
+ + +
+ + + + +
+
+
+ ); +} + + +// TODO: +// 1) When I press the submit button +// * Call to Next JS backend to upload a deal in hubspot CRM +// * update information in Db +// 2) Show khalim weird dialog button when closing dialog +// 3) Make it functional per individual deal instead of just one +// Push to production after MR with Khalim \ No newline at end of file diff --git a/src/app/portfolio/[slug]/components/propertyTableColumns.tsx b/src/app/portfolio/[slug]/components/propertyTableColumns.tsx index 7d71f8a..f92e5af 100644 --- a/src/app/portfolio/[slug]/components/propertyTableColumns.tsx +++ b/src/app/portfolio/[slug]/components/propertyTableColumns.tsx @@ -21,6 +21,9 @@ import { PropertyToRecommendation, PropertyWithRelations, } from "@/app/db/schema/property"; +import BookSurveyModal from "./BookSurveyModal"; +import { useState } from "react"; + interface DataTableColumnHeaderProps extends React.HTMLAttributes { @@ -40,11 +43,13 @@ const EpcLetterBubble = ({ letter }: { letter: string }) => { ); }; + export function DataTableFilterHeader({ column, title, className, }: DataTableColumnHeaderProps) { + if (!column.getCanSort()) { return
{title}
; } @@ -212,6 +217,7 @@ export const columns: ColumnDef[] = [ { id: "actions", cell: ({ row }) => { + const [openModal, setOpenModal] = useState(false); const property = row.original; const propertyId = property.id; const portfolioId = property.portfolioId; @@ -236,7 +242,7 @@ export const columns: ColumnDef[] = [ Actions - console.log("hello junte")}> + setOpenModal(true)}> Book a survey [] = [ + {/* ✅ Render modal outside dropdown context */} + {openModal && ( + + )} ); },