From 3a25f4d8e50555c0bd02add5dfcf8d3996e9630f Mon Sep 17 00:00:00 2001 From: sambokar Date: Fri, 27 Dec 2024 22:31:08 -0500 Subject: [PATCH] adding baseline filtration system back in --- .../client/rendergridexplanations.tsx | 148 ++++++++++-------- .../datagrids/measurementscommons.tsx | 38 +++-- frontend/config/macros/formdetails.ts | 20 +-- 3 files changed, 119 insertions(+), 87 deletions(-) diff --git a/frontend/components/client/rendergridexplanations.tsx b/frontend/components/client/rendergridexplanations.tsx index 07da209c..ee10318b 100644 --- a/frontend/components/client/rendergridexplanations.tsx +++ b/frontend/components/client/rendergridexplanations.tsx @@ -1,15 +1,29 @@ 'use client'; import { DatagridType, HeadersByDatagridType } from '@/config/macros/formdetails'; -import { Alert, Box, Card, CardContent, Chip, List, ListItem, Tooltip, Typography } from '@mui/joy'; +import { + AccordionGroup, + Accordion, + AccordionSummary, + AccordionDetails, + Alert, + Box, + Card, + CardContent, + Chip, + List, + ListItem, + Tooltip, + Typography +} from '@mui/joy'; import React from 'react'; import WarningIcon from '@mui/icons-material/Warning'; export default function RenderGridExplanations({ datagridType }: { datagridType: DatagridType }) { const categoryRegex = /alive(?:-not measured)?|dead|missing|broken below|stem dead/g; - const matches = HeadersByDatagridType[datagridType].find(obj => obj.label === 'status')?.explanation?.match(categoryRegex); + const matches = HeadersByDatagridType[datagridType].find(obj => obj.label === 'Status')?.explanation?.match(categoryRegex); const cleanedString = HeadersByDatagridType[datagridType] - .find(obj => obj.label === 'status') + .find(obj => obj.label === 'Status') ?.explanation?.replace(categoryRegex, '') .replace(/\s*,\s*/g, '') .trim(); @@ -22,67 +36,75 @@ export default function RenderGridExplanations({ datagridType }: { datagridType: width: '100%' }} > - - Understanding the Headers - - - {HeadersByDatagridType[datagridType].map((header, index) => ( - - - {header.label} + + + + + Understanding the Headers - - {header.label === 'status' ? ( - - {cleanedString} - - {matches?.map((category, index) => ( - - {category} - - ))} - - - ) : ( - <> - {header.explanation} - {header.label.includes('date') && ( - } variant="soft" color="danger" sx={{ mb: 2 }}> - - Please note: For date fields, accepted formats are - - - - YYYY-MM-DD - - - - - DD-MM-YYYY - - - - Hover over formats to see additionally accepted separators. -
- Please ensure your dates follow one of these formats. -
-
- )} - - )} -
-
- ))} -
+ + + + {HeadersByDatagridType[datagridType].map((header, index) => ( + + + {header.label} + + + {header.label === 'Status' ? ( + + {cleanedString} + + {matches?.map((category, index) => ( + + {category} + + ))} + + + ) : ( + <> + {header.explanation} + {header.label.includes('date') && ( + } variant="soft" color="danger" sx={{ mb: 2 }}> + + Please note: For date fields, accepted formats are + + + + YYYY-MM-DD + + + + + DD-MM-YYYY + + + + Hover over formats to see additionally accepted separators. +
+ Please ensure your dates follow one of these formats. +
+
+ )} + + )} +
+
+ ))} +
+
+ + ); } diff --git a/frontend/components/datagrids/measurementscommons.tsx b/frontend/components/datagrids/measurementscommons.tsx index 54aa94c4..5377c4f1 100644 --- a/frontend/components/datagrids/measurementscommons.tsx +++ b/frontend/components/datagrids/measurementscommons.tsx @@ -13,7 +13,9 @@ import { GridRowModes, GridRowModesModel, GridSortModel, + GridToolbarColumnsButton, GridToolbarContainer, + GridToolbarFilterButton, GridToolbarProps, GridToolbarQuickFilter, ToolbarPropsOverrides, @@ -172,7 +174,10 @@ const EditToolbar = (props: EditToolbarProps) => { + + { - {dynamicButtons.map((button: any, index: number) => ( - <> - {button.tooltip ? ( + + Other + + {dynamicButtons.map((button: any, index: number) => ( <> - - - + + )} - ) : ( - - )} - - ))} + ))} + + ); diff --git a/frontend/config/macros/formdetails.ts b/frontend/config/macros/formdetails.ts index 73086cca..0d7a5aac 100644 --- a/frontend/config/macros/formdetails.ts +++ b/frontend/config/macros/formdetails.ts @@ -243,14 +243,14 @@ export const HeadersByDatagridType: Record ({ label: header, explanation: { - Quadrat: 'The name of the quadrat where measurements were taken.', + 'Quadrat Name': 'The name of the quadrat where measurements were taken.', 'Species Code': 'The unique code for the species measured.', - Tree: 'The tag or identifier for the tree measured.', - Stem: 'The tag or identifier for the stem measured.', - X: 'The local X-coordinate of the stem.', - Y: 'The local Y-coordinate of the stem.', - DBH: 'The diameter at breast height of the tree.', - HOM: 'The height from the ground where DBH was measured.', + 'Tree Tag': 'The tag or identifier for the tree measured.', + 'Stem Tag': 'The tag or identifier for the stem measured.', + 'X (Stem)': 'The local X-coordinate of the stem.', + 'Y (Stem)': 'The local Y-coordinate of the stem.', + 'DBH (Diameter at Breast Height)': 'The diameter at breast height of the tree.', + 'HOM (Height of Measure)': 'The height from the ground where DBH was measured.', Description: 'A text description of the measurement.', Attributes: 'Additional attributes associated with the measurement.' }[header], @@ -300,9 +300,9 @@ export const HeadersByDatagridType: Record