Merge branch 'feature/admin-view3' into 'main'

Add style and interactivity features to M&E Data Entry view

See merge request vkuchenik/website-framework!71
This commit is contained in:
Dan Hansen
2025-08-25 22:15:12 +00:00
@@ -111,14 +111,30 @@ const items = [
female: 550, female: 550,
total: 1100, total: 1100,
}, },
{
id: "r6",
section: "Gas",
volcano: "Ranier",
country: "US",
start: "2024-07-02",
end: "2027-05-12",
type: "Deployment",
vpi10: "Yes",
downstream: 1200,
male: 570,
female: 570,
total: 1400,
},
]; ];
export function MEDataEntry() { export function MEDataEntry() {
const [value, setValue] = useState(""); const [value, setValue] = useState("");
const [selection, setSelection] = useState([]); const [selection, setSelection] = useState([]);
const { const {
register, register,
handleSubmit, handleSubmit,
reset,
watch, watch,
formState: { errors }, formState: { errors },
} = useForm(); } = useForm();
@@ -184,15 +200,16 @@ export function MEDataEntry() {
<Box m={4} mt={1} border="1px solid" borderRadius="sm" borderColor="gray.500"> <Box m={4} mt={1} border="1px solid" borderRadius="sm" borderColor="gray.500">
<Box m={4} border="1px solid"> <Box m={4} border="1px solid">
<Box pl={1} bg="gray.200" border="1px solid" borderColor="gray.300" overflow="hidden"> <Box pl={1} bg="gray.200" border="1px solid" borderColor="gray.400">
Number of people benefitting from VDAP activities, disaggregate by sex Number of people benefitting from VDAP activities, disaggregate by sex
</Box> </Box>
<Box overflowX="auto"> {/* <Box overflowX="auto"> */}
<Table.Root variant="outline" size="sm"> <Table.ScrollArea height="240px">
<Table.Root variant="outline" overflow="initial" size="sm" stickyHeader interactive>
<Table.Header> <Table.Header>
<Table.Row> <Table.Row bg="bg.subtle">
<Table.ColumnHeader /> {/* padding for checkboxes */} <Table.ColumnHeader w="40px"/>
<Table.ColumnHeader>Section</Table.ColumnHeader> <Table.ColumnHeader>Section</Table.ColumnHeader>
<Table.ColumnHeader>Volcano</Table.ColumnHeader> <Table.ColumnHeader>Volcano</Table.ColumnHeader>
<Table.ColumnHeader>Country</Table.ColumnHeader> <Table.ColumnHeader>Country</Table.ColumnHeader>
@@ -211,7 +228,8 @@ export function MEDataEntry() {
{rows} {rows}
</Table.Body> </Table.Body>
</Table.Root> </Table.Root>
</Box> </Table.ScrollArea>
{/* </Box> */}
</Box> </Box>
{/* Row actions aligned right */} {/* Row actions aligned right */}
<HStack justify="flex-end" p={3} pt={0} borderBottom="1px solid" borderColor="gray.300" spacing={3} > <HStack justify="flex-end" p={3} pt={0} borderBottom="1px solid" borderColor="gray.300" spacing={3} >
@@ -223,8 +241,13 @@ export function MEDataEntry() {
</HStack> </HStack>
{/* Form Section */} {/* Form Section */}
<Box m={4} border="1px solid"> <Box
<Box pl={1} bg="gray.200" border="1px solid" borderColor="gray.300" overflow="hidden"> as="form"
onSubmit={handleSubmit(onSubmit)}
m={4}
border="1px solid"
>
<Box pl={1} bg="gray.200" border="1px solid" borderColor="gray.400" overflow="hidden">
Fill in Form Fill in Form
</Box> </Box>
@@ -237,7 +260,7 @@ export function MEDataEntry() {
<Field.Root orientation="horizontal" flex="1" minW="260px"> <Field.Root orientation="horizontal" flex="1" minW="260px">
<Field.Label>Start Date of Assistance:</Field.Label> <Field.Label>Start Date of Assistance:</Field.Label>
<Input {...register("startdate")} placeholder="9/6/1987" /> <Input {...register("startdate", { valueAsDate: true })} placeholder="9/6/1987" />
</Field.Root> </Field.Root>
<Field.Root orientation="horizontal" flex="1"> <Field.Root orientation="horizontal" flex="1">
@@ -254,29 +277,29 @@ export function MEDataEntry() {
<Field.Root orientation="horizontal" flex="1" minW="260px"> <Field.Root orientation="horizontal" flex="1" minW="260px">
<Field.Label>End Date of Assistance:</Field.Label> <Field.Label>End Date of Assistance:</Field.Label>
<Input {...register("enddate")} placeholder="7/14/2054" /> <Input {...register("enddate", { valueAsDate: true })} placeholder="7/14/2054" />
</Field.Root> </Field.Root>
<Field.Root orientation="horizontal" flex="1"> <Field.Root orientation="horizontal" flex="1">
<Field.Label>Downstream Affected Population:</Field.Label> <Field.Label>Downstream Affected Population:</Field.Label>
<Input {...register("downstream")} placeholder="1337" /> <Input {...register("downstream", { valueAsNumber: true })} placeholder="1337" />
</Field.Root> </Field.Root>
</HStack> </HStack>
<HStack spacing={6} align="flex-start" w="100%" flexWrap="wrap"> <HStack spacing={6} align="flex-start" w="100%" flexWrap="wrap">
<Field.Root orientation="horizontal" flex="1" minW="260px"> <Field.Root orientation="horizontal" flex="1" minW="260px">
<Field.Label>Male Population:</Field.Label> <Field.Label>Male Population:</Field.Label>
<Input {...register("male")} placeholder="1776" /> <Input {...register("male", { valueAsNumber: true })} placeholder="1776" />
</Field.Root> </Field.Root>
<Field.Root orientation="horizontal" flex="1" minW="260px"> <Field.Root orientation="horizontal" flex="1" minW="260px">
<Field.Label>Female Population:</Field.Label> <Field.Label>Female Population:</Field.Label>
<Input {...register("female")} placeholder="1892" /> <Input {...register("female", { valueAsNumber: true })} placeholder="1892" />
</Field.Root> </Field.Root>
<Field.Root orientation="horizontal" flex="1"> <Field.Root orientation="horizontal" flex="1">
<Field.Label>Total Population:</Field.Label> <Field.Label>Total Population:</Field.Label>
<Input {...register("total")} placeholder="3668" /> <Input {...register("total", { valueAsNumber: true })} placeholder="3668" />
</Field.Root> </Field.Root>
</HStack> </HStack>
@@ -290,7 +313,7 @@ export function MEDataEntry() {
<Button type="submit" variant="solid" colorPalette="green" > <Button type="submit" variant="solid" colorPalette="green" >
Add Add
</Button> </Button>
<Button type="submit"> <Button onClick={() => reset()}>
Reset Reset
</Button> </Button>
</ButtonGroup> </ButtonGroup>