From dc56ec79f1548357831c6a14804c2d054b5f4cb3 Mon Sep 17 00:00:00 2001 From: "Daniel S. Hansen" Date: Fri, 22 Aug 2025 16:55:24 -0700 Subject: [PATCH] Add initial fill in form boilerplate --- .../Canvas/views/AdminTabs/MEDataEntry.jsx | 128 ++++++++++++------ 1 file changed, 86 insertions(+), 42 deletions(-) diff --git a/client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx b/client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx index 75afa54..4ce5580 100644 --- a/client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx +++ b/client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx @@ -1,6 +1,7 @@ import { useState } from 'react'; -import { Box, Button, ButtonGroup, Text, List, HStack, RadioGroup, Table, Checkbox, createListCollection } from "@chakra-ui/react" +import { Box, Button, ButtonGroup, Text, Input, List, Field, Stack, HStack, Table, Checkbox, createListCollection } from "@chakra-ui/react" import DropDownMenu from "../../CanvasComponents/DropDownMenu" +import { useForm } from 'react-hook-form'; const startYear = 1970; const currentYear = new Date().getFullYear(); @@ -111,11 +112,21 @@ const items = [ total: 1100, }, ]; - + export function MEDataEntry() { const [value, setValue] = useState(""); - // const [rows, setRows] = useState([]); const [selection, setSelection] = useState([]); + const { + register, + handleSubmit, + watch, + formState: { errors }, + } = useForm(); + + const onSubmit = (data) => { + console.log("Form submitted:", data); + } + const rows = items.map((item) => ( - + // + + @@ -170,46 +182,78 @@ export function MEDataEntry() { Delete entry. Copy entry to form. Then hitting 'Save' will create a new entry. - - - Number of people benefitting from VDAP activities, disaggregate by sex - - - - {/* setValue(e.value)}> */} - - - - {/* padding for checkboxes */} - Section - Volcano - Country - Start Date of Assistance - End Date of Assistance - Assistance Type - VPI10 - Downstream Population - Male - Female - Total - - + + + + + Number of people benefitting from VDAP activities, disaggregate by sex + + + + {/* setValue(e.value)}> */} + + + + {/* padding for checkboxes */} + Section + Volcano + Country + Start Date of Assistance + End Date of Assistance + Assistance Type + VPI10 + Downstream Population + Male + Female + Total + + - - {rows} - - - {/* */} + + {rows} + + + + + {/* Row actions aligned right */} + + + + + + + + + + Fill in Form + + + + User Name + + + + + First Name + + + + + Last Name + + + + + Email + + + + + - {/* Row actions aligned right */} - - - - - - - ); }