From f6befc215c9d5cc9daea518fae66f482921ffdec Mon Sep 17 00:00:00 2001 From: StefanWout Date: Tue, 19 Nov 2024 15:57:39 +0000 Subject: [PATCH] added all the inputs and state variables for the remote assesment modal --- .../components/RemoteAssesmentModal.tsx | 237 ++++++++++++++++-- .../[slug]/components/UploadCsvModal.tsx | 4 +- 2 files changed, 214 insertions(+), 27 deletions(-) diff --git a/src/app/portfolio/[slug]/components/RemoteAssesmentModal.tsx b/src/app/portfolio/[slug]/components/RemoteAssesmentModal.tsx index 6e1718d..a9babd6 100644 --- a/src/app/portfolio/[slug]/components/RemoteAssesmentModal.tsx +++ b/src/app/portfolio/[slug]/components/RemoteAssesmentModal.tsx @@ -1,18 +1,117 @@ "use client"; -import { Dialog, Transition } from "@headlessui/react"; +import { Dialog, Transition, Menu } from "@headlessui/react"; import { useState, Fragment } from "react"; import { useForm } from "react-hook-form"; -import { - Form, - FormItem, - FormLabel, - FormControl, - FormDescription, - FormMessage, - FormField, - } from "@/app/shadcn_components/ui/form"; import { Input } from "@/app/shadcn_components/ui/input"; +import { Button } from "@/app/shadcn_components/ui/button"; +import { Float } from "@headlessui-float/react"; +import { ChevronDownIcon } from "@heroicons/react/20/solid"; + +type Option = { + label: string; + value: string; + disabled: boolean; +}; + +type DropdownProps = { + options: Option[]; + selectedOption: string; + onSelectOption: (option: Option) => void; +}; + +const selecthousingTypeOptions = [ + { + label: "Social", + value: "Social", + disabled: false, + }, + { + label: "Private", + value: "Private", + disabled: false, + }, +]; + +const selectGoalOptions = [ + { + label: "Increase EPC", + value: "Increase EPC", + disabled: false, + }, + { + label: "Reduce energy consumption", + value: "Reduce energy consumption", + disabled: false, + }, +]; + +const goalValueOptions = [ + { + label: "C", + value: "C", + disabled: false, + }, + { + label: "B", + value: "B", + disabled: false, + }, + { + label: "A", + value: "A", + disabled: false, + }, +]; + +export function SelectDropdown({ + options, + selectedOption, + onSelectOption, +}: DropdownProps) { + return ( + + + + {selectedOption || "Select an option"} + + + + {options.map((option) => ( + + {({ active }) => ( + + )} + + ))} + + + + + ); +} + export default function RemoteAssesmentModal({ portfolioId, @@ -29,10 +128,29 @@ export default function RemoteAssesmentModal({ const [goalValue, setGoalValue] = useState(""); const [addressLineOne, setAddressLineOne] = useState(""); const [postcode, setPostcode] = useState(""); - const [buttonDisabled, setButtonDisabled] = useState(true); + const [uprn, setUprn] = useState(""); + const [valuation, setValuation] = useState(""); + // const [buttonDisabled, setButtonDisabled] = useState(true); - const form = useForm(); + function handleScenarioChange(event: React.ChangeEvent) { + setScenario(event.target.value); + } + function handleAddressLineOneChange(event: React.ChangeEvent) { + setAddressLineOne(event.target.value); + } + + function handlePostcodeChange(event: React.ChangeEvent) { + setPostcode(event.target.value); + } + + function handleUprnChange(event: React.ChangeEvent) { + setUprn(event.target.value); + } + + function handleValuationChange(event: React.ChangeEvent) { + setValuation(event.target.value); + } return ( <> @@ -68,23 +186,91 @@ export default function RemoteAssesmentModal({ - Title Goes Here + className="text-lg font-medium leading-6 text-brandblue mb-3"> + {scenario}
- Body Goes here + Scenario Name +
- -
- + Housing type + * + + sethousingType(option.value)} + />
+
+ + setSelectedGoal(option.value)} + /> + {selectedGoal === "Increase EPC" && ( +
+ + { + setGoalValue(option.value); + }} + /> +
+ )} +
+
+ Address Line One + +
+
+ Postcode + +
+
+ UPRN + +
+
+ Valuation + +
+
+ +
+
@@ -93,4 +279,5 @@ export default function RemoteAssesmentModal({ ); -} \ No newline at end of file +} + diff --git a/src/app/portfolio/[slug]/components/UploadCsvModal.tsx b/src/app/portfolio/[slug]/components/UploadCsvModal.tsx index a046403..0ebae80 100644 --- a/src/app/portfolio/[slug]/components/UploadCsvModal.tsx +++ b/src/app/portfolio/[slug]/components/UploadCsvModal.tsx @@ -96,7 +96,7 @@ const selectGoalOptions = [ { label: "Reduce energy consumption", value: "Reduce energy consumption", - disabled: true, + disabled: false, }, ]; @@ -272,7 +272,7 @@ export default function UploadCsvModal({ ); }} /> - {selectedGoal && ( + {selectedGoal === "Increase EPC" && (