Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
feat(students): add hide and search button in advanced search collaps…
Browse files Browse the repository at this point in the history
…ible
  • Loading branch information
rhahao authored Jun 27, 2022
1 parent b175141 commit 808509d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/components/students/StudentAdvancedSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ import { useTranslation } from 'react-i18next';
import Box from '@mui/material/Box';
import Checkbox from '@mui/material/Checkbox';
import Collapse from '@mui/material/Collapse';
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import FormControlLabel from '@mui/material/FormControlLabel';
import FormGroup from '@mui/material/FormGroup';
import IconButton from '@mui/material/IconButton';
import PersonSearchIcon from '@mui/icons-material/PersonSearch';
import Typography from '@mui/material/Typography';

const StudentAdvancedSearch = ({
advancedOpen,
isFemale,
isMale,
assTypes,
handleSearchStudent,
setAdvancedOpen,
setIsFemale,
setIsMale,
setAssTypes,
txtSearch,
}) => {
const { t } = useTranslation();

Expand All @@ -24,6 +30,10 @@ const StudentAdvancedSearch = ({
const [isBibleStudy, setIsBibleStudy] = useState(false);
const [isTalk, setIsTalk] = useState(false);

const handleSearchAdvanced = () => {
handleSearchStudent(txtSearch, isMale, isFemale, assTypes);
};

const handleCheckBRead = (value) => {
if (value) {
if (assTypes.findIndex((assType) => assType === 100) === -1) {
Expand Down Expand Up @@ -223,6 +233,30 @@ const StudentAdvancedSearch = ({
</FormGroup>
</Box>
</Box>
<Box sx={{ marginTop: '10px' }}>
<IconButton
sx={{ backgroundColor: '#A9CCE3', marginRight: '10px' }}
onClick={() => setAdvancedOpen(false)}
>
<ExpandLessIcon
sx={{
fontSize: '25px',
color: 'black',
}}
/>
</IconButton>
<IconButton
sx={{ backgroundColor: '#A9CCE3' }}
onClick={handleSearchAdvanced}
>
<PersonSearchIcon
sx={{
fontSize: '25px',
color: 'black',
}}
/>
</IconButton>
</Box>
</Box>
</Collapse>
);
Expand Down
5 changes: 5 additions & 0 deletions src/pages/Students.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,17 @@ const Students = () => {

<StudentAdvancedSearch
advancedOpen={advancedOpen}
setAdvancedOpen={(value) => setAdvancedOpen(value)}
isMale={isMale}
isFemale={isFemale}
handleSearchStudent={(txtSearch, isMale, isFemale, assTypes) =>
handleSearchStudent(txtSearch, isMale, isFemale, assTypes)
}
assTypes={assTypes}
setIsMale={(value) => setIsMale(value)}
setIsFemale={(value) => setIsFemale(value)}
setAssTypes={(value) => setAssTypes(value)}
txtSearch={txtSearch}
/>

<Box sx={{ marginBottom: '10px', marginRight: '5px' }}>
Expand Down

0 comments on commit 808509d

Please sign in to comment.