From c9ca639f237644e7bc902d9b27ecdd6e67d4bb98 Mon Sep 17 00:00:00 2001 From: M M Date: Tue, 2 Jul 2024 20:43:39 -0700 Subject: [PATCH] Added the filter by status dropdown to the page. --- Client/src/Pages/Incidents/index.jsx | 33 ++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/Client/src/Pages/Incidents/index.jsx b/Client/src/Pages/Incidents/index.jsx index 54e857b0d..1246962cd 100644 --- a/Client/src/Pages/Incidents/index.jsx +++ b/Client/src/Pages/Incidents/index.jsx @@ -1,3 +1,5 @@ +import TextField from '@mui/material/TextField'; +import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; import { styled, useTheme } from '@mui/material/styles'; import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; @@ -20,10 +22,10 @@ const StyledTableCell = styled(TableCell)(({ theme }) => ({ })); const StyledTableRow = styled(TableRow)(({ theme }) => ({ - '&:nth-of-type(1)': { + '&:nth-of-type(odd)': { backgroundColor: theme.palette.action.hover, }, - '&:nth-of-type(n+1)': { + '&:nth-of-type(even)': { backgroundColor: theme.palette.common.white, }, '&:last-child td, &:last-child th': { @@ -31,6 +33,17 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({ }, })); +const filterOptions = createFilterOptions({ + matchFrom: 'start', + stringify: (option) => option.title, +}); + +const top100Films = [ + { title: 'The Shawshank Redemption', year: 1994 }, + { title: 'The Dark Knight', year: 2008 }, + { title: '12 Angry Men', year: 1957 }, +]; + function createData(name, date, message) { return { name, date, message }; } @@ -58,6 +71,9 @@ export default function CustomizedTables() { }, }} > + + + @@ -83,3 +99,16 @@ export default function CustomizedTables() { ); } + +function Filter() { + return ( + option.title} + filterOptions={filterOptions} + sx={{ width: 300 }} + renderInput={(params) => } + /> + ); +}