Skip to content

Commit

Permalink
Merge pull request #510 from cornell-dti/nd433/studentFilter
Browse files Browse the repository at this point in the history
Added filter for disability in Student page
  • Loading branch information
Atikpui007 authored Sep 20, 2024
2 parents 1231199 + f638fa9 commit 02a0328
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
24 changes: 23 additions & 1 deletion frontend/src/components/UserTables/StudentsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Row, Table } from '../TableComponents/TableComponents';
import { useRiders } from '../../context/RidersContext';
import styles from './table.module.css';
import axios from '../../util/axios';
import { Label } from '../FormElements/FormElements';
import { Accessibility } from '../../types';

type UsageData = {
noShows: number;
Expand Down Expand Up @@ -34,6 +36,7 @@ const StudentsTable = ({ searchName }: studentTableProps) => {
];
const [usage, setUsage] = useState<UsageType>({});
const [showInactive, setShowInactive] = useState(false);
const [disabilityFilter, setDisabilityFilter] = useState('');

useEffect(() => {
axios
Expand Down Expand Up @@ -71,7 +74,8 @@ const StudentsTable = ({ searchName }: studentTableProps) => {
(r.firstName + ' ' + r.lastName)
.toLowerCase()
.includes((searchName + '').toLowerCase()) &&
(showInactive ? true : r.active)
(showInactive ? true : r.active) &&
(disabilityFilter === '' ? true : r.accessibility === disabilityFilter)
);

return (
Expand All @@ -95,6 +99,24 @@ const StudentsTable = ({ searchName }: studentTableProps) => {
/>
Show inactive students
</label>
<Label
className={styles.filterDisabilityHeader}
htmlFor="filterByDisability"
>
Filter by Disability:
</Label>
<select
className={styles.filterDisabilityBox}
name="filterByDisability"
value={disabilityFilter}
onChange={(e) => setDisabilityFilter(e.target.value)}
>
{Object.values(Accessibility).map((value, index) => (
<option value={value} key={index}>
{value}
</option>
))}
</select>
<Table>
<Row header colSizes={colSizes} data={headers} />

Expand Down
10 changes: 10 additions & 0 deletions frontend/src/components/UserTables/table.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@
border: #eb0023 1px solid;
}

.filterDisabilityHeader {
margin-left: 4rem;
}

.filterDisabilityBox {
height: 1.5rem;
border-radius: 4px;
border-width: 1.25px;
}

@media screen and (max-width: 700px) {
.scheduleTableInner {
min-width: initial;
Expand Down

0 comments on commit 02a0328

Please sign in to comment.