diff options
author | rohan09-raj <rajrohan1914@gmail.com> | 2022-08-26 02:04:49 +0530 |
---|---|---|
committer | rohan09-raj <rajrohan1914@gmail.com> | 2022-08-26 02:04:56 +0530 |
commit | 951b6dbaf9d3da78c056cafbde17167887f73594 (patch) | |
tree | 1379c3252a2c4636756195ffcb59723243acdfe6 | |
parent | 3e354484fb63ac5752cab3415b909a7ed9f0ede4 (diff) |
admin UI fixes
-rw-r--r-- | admin/package.json | 1 | ||||
-rw-r--r-- | admin/src/components/Accordion/Accordion.jsx | 121 | ||||
-rw-r--r-- | admin/src/components/Accordion/Accordion.module.css | 6 | ||||
-rw-r--r-- | admin/src/components/Header/Header.jsx | 18 | ||||
-rw-r--r-- | admin/src/components/Modal/Modal.jsx | 78 | ||||
-rw-r--r-- | admin/src/components/Modal/Modal.module.css | 21 | ||||
-rw-r--r-- | admin/src/pages/EnrollmentRequests/EnrollmentRequests.jsx | 9 | ||||
-rw-r--r-- | admin/src/pages/UpdateRequests/UpdateRequests.jsx | 22 | ||||
-rw-r--r-- | admin/src/services/apiservice.js | 5 | ||||
-rw-r--r-- | admin/yarn.lock | 13 | ||||
-rw-r--r-- | client/src/components/Card/Card.jsx | 2 | ||||
-rw-r--r-- | client/src/components/Card/Card.module.css | 6 |
12 files changed, 237 insertions, 65 deletions
diff --git a/admin/package.json b/admin/package.json index c2a745d..346489b 100644 --- a/admin/package.json +++ b/admin/package.json @@ -5,6 +5,7 @@ "dependencies": { "@emotion/react": "^11.10.0", "@emotion/styled": "^11.10.0", + "@mui/lab": "^5.0.0-alpha.96", "@mui/material": "^5.10.2", "@mui/styles": "^5.10.2", "@testing-library/jest-dom": "^5.16.5", diff --git a/admin/src/components/Accordion/Accordion.jsx b/admin/src/components/Accordion/Accordion.jsx index 08c46b1..c885d0b 100644 --- a/admin/src/components/Accordion/Accordion.jsx +++ b/admin/src/components/Accordion/Accordion.jsx @@ -2,54 +2,91 @@ import React, {useState} from 'react'; import {Button} from '@mui/material'; import styles from './Accordion.module.css'; +import PopUpModal from '../Modal/Modal'; const Accordion = ({name, user}) => { const [isActive, setIsActive] = useState(false); + const [open, setOpen] = React.useState(false); + const handleOpen = () => setOpen(true); + return ( - <div className={styles.accordion}> - <div - className={styles.accordion__title} - onClick={() => setIsActive(!isActive)} - > - <h2>{name}</h2> - <div>❯</div> - </div> - {isActive && ( - <div className={styles.accordion__content}> - <div className={styles.accordion__demographic}> - <div><span>Name</span> <hr/> {user.name}</div> - <div><span>Gender</span> <hr/> {user.gender}</div> - <div><span>Date of Birth</span> <hr/> {user.dob}</div> - <div><span>Mobile Number</span> <hr/> {user.mobile}</div> - <div><span>Email</span> <hr/> {user.email}</div> - <div><span>Address</span> <hr/> {user.address.houseNo},{user.address.street}, - {user.address.locality},{user.address.landmark}, - {user.address.village},{user.address.district.name}, - {user.address.state.name},{user.address.pincode}</div> - <div><span>Indian Resident</span> <hr/> {user.indianResident ? 'Yes' : 'No'}</div> - </div> - <div className={styles.accordion__biometric}> - <img - src={user.photo} - alt='' - height='300px' - className={styles.accordion__biometric_image} - /> - <Button - sx={{margin: '10px 0px', padding: '20px'}} - variant='contained' - onClick={() => {}} - > - Documents - </Button> - <Button sx={{padding: '20px'}} variant='contained'> - Biometric - </Button> - </div> + <> + <div className={styles.accordion}> + <div + className={styles.accordion__title} + onClick={() => setIsActive(!isActive)} + > + <h2>{name}</h2> + <span className={styles.accordion__subheading}> + Date of Birth: {user.dob} + </span> + <span className={styles.accordion__subheading}> + Mobile Number: {user.mobile} + </span> + <div>❯</div> </div> - )} - </div> + {isActive && ( + <div className={styles.accordion__content}> + <div className={styles.accordion__demographic}> + <div> + <span>Name</span> <hr /> {user.name} + </div> + <div> + <span>Gender</span> <hr /> {user.gender} + </div> + <div> + <span>Date of Birth</span> <hr /> {user.dob} + </div> + <div> + <span>Mobile Number</span> <hr /> {user.mobile} + </div> + <div> + <span>Email</span> <hr /> {user.email} + </div> + <div> + <span>Address</span> <hr /> {user.address.houseNo}, + {user.address.street},{user.address.locality}, + {user.address.landmark},{user.address.village}, + {user.address.district.name},{user.address.state.name}, + {user.address.pincode} + </div> + <div> + <span>Indian Resident</span> <hr />{' '} + {user.indianResident ? 'Yes' : 'No'} + </div> + </div> + <div className={styles.accordion__biometric}> + <img + src={user.photo} + alt='' + height='300px' + className={styles.accordion__biometric_image} + /> + <Button + sx={{margin: '10px 0px', padding: '20px'}} + variant='contained' + onClick={() => { + handleOpen(); + }} + > + Documents + </Button> + <Button + sx={{padding: '20px'}} + variant='contained' + onClick={() => { + handleOpen(); + }} + > + Biometric + </Button> + </div> + </div> + )} + </div> + <PopUpModal open={open} setOpen={setOpen} documents={user.documents} /> + </> ); }; diff --git a/admin/src/components/Accordion/Accordion.module.css b/admin/src/components/Accordion/Accordion.module.css index 0cf2603..347a405 100644 --- a/admin/src/components/Accordion/Accordion.module.css +++ b/admin/src/components/Accordion/Accordion.module.css @@ -5,7 +5,7 @@ .accordion__title { display: flex; - flex-direction: row; + align-items: center; justify-content: space-between; cursor: pointer; background-color: #2c3e50; @@ -23,6 +23,10 @@ padding: 1rem; } +.accordion__subheading { + font-size: 1.1rem; +} + .accordion__content { display: flex; justify-content: center; diff --git a/admin/src/components/Header/Header.jsx b/admin/src/components/Header/Header.jsx index a6e8523..fc0cf91 100644 --- a/admin/src/components/Header/Header.jsx +++ b/admin/src/components/Header/Header.jsx @@ -1,13 +1,17 @@ -import React from 'react' -import styles from './Header.module.css' +import React from 'react'; +import styles from './Header.module.css'; -const Header = ({ subheading }) => { +const Header = ({subheading}) => { return ( <header className={styles.header}> - <img src={`${process.env.PUBLIC_URL}/favicon.ico`} className={styles.header__image}/> + <img + src={`${process.env.PUBLIC_URL}/favicon.ico`} + className={styles.header__image} + alt='' + /> <h3 className={styles.header__subheading}>{subheading}</h3> </header> - ) -} + ); +}; -export default Header +export default Header; diff --git a/admin/src/components/Modal/Modal.jsx b/admin/src/components/Modal/Modal.jsx new file mode 100644 index 0000000..ffe0167 --- /dev/null +++ b/admin/src/components/Modal/Modal.jsx @@ -0,0 +1,78 @@ +import React from 'react'; +import {Modal, Box} from '@mui/material'; +import styles from './Modal.module.css'; +import Tab from '@mui/material/Tab'; +import TabContext from '@mui/lab/TabContext'; +import TabList from '@mui/lab/TabList'; +import TabPanel from '@mui/lab/TabPanel'; + +const PopUpModal = ({documents, open, setOpen}) => { + const style = { + position: 'absolute', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: 1000, + bgcolor: 'background.paper', + borderRadius: '10px', + boxShadow: 24, + p: 4, + }; + + const [value, setValue] = React.useState('1'); + + const handleChange = (event, newValue) => { + setValue(newValue); + }; + + const handleClose = () => setOpen(false); + + return ( + <div className={styles.modal}> + <Modal + open={open} + onClose={handleClose} + aria-labelledby='modal-modal-title' + aria-describedby='modal-modal-description' + > + <Box sx={style}> + <TabContext value={value}> + <Box sx={{borderBottom: 1, borderColor: 'divider'}}> + <TabList onChange={handleChange}> + <Tab label='Proof of Identity' value='1' /> + <Tab label='Proof of Address' value='2' /> + <Tab label='Proof of Date of Birth' value='3' /> + </TabList> + </Box> + <TabPanel + value='1' + sx={{ + textAlign: 'center', + }} + > + <img src={documents.POI} alt='' /> + </TabPanel> + <TabPanel + value='2' + sx={{ + textAlign: 'center', + }} + > + <img src={documents.POA} alt='' /> + </TabPanel> + <TabPanel + value='3' + sx={{ + textAlign: 'center', + }} + > + <img src={documents.DOB} alt='' /> + </TabPanel> + </TabContext> + </Box> + </Modal> + </div> + ); +}; + +export default PopUpModal; diff --git a/admin/src/components/Modal/Modal.module.css b/admin/src/components/Modal/Modal.module.css new file mode 100644 index 0000000..fd5e327 --- /dev/null +++ b/admin/src/components/Modal/Modal.module.css @@ -0,0 +1,21 @@ +.modal { + margin: 0px 15px; + position: absolute; + top: 100px; + right: 250px; +} + +.modal__title { + text-align: center; + margin: 20px 0px 40px; + font-size: var(--font-medium-large); +} + +.modal__image { + width: 50%; +} + +.modal__content { + width: 50%; + font-size: var(--font-medium-sm); +} diff --git a/admin/src/pages/EnrollmentRequests/EnrollmentRequests.jsx b/admin/src/pages/EnrollmentRequests/EnrollmentRequests.jsx index 22eb2c9..4ae5a85 100644 --- a/admin/src/pages/EnrollmentRequests/EnrollmentRequests.jsx +++ b/admin/src/pages/EnrollmentRequests/EnrollmentRequests.jsx @@ -10,6 +10,7 @@ import { import {useQuery, useMutation} from 'react-query'; import {useNavigate} from 'react-router-dom'; import BackButton from '../../components/BackButton/BackButton'; +import {sendMessage} from '../../services/apiservice'; import styles from './EnrollmentRequests.module.css'; @@ -28,6 +29,10 @@ const EnrollmentRequests = () => { }, }); + const setConfirm = useMutation((payload) => { + sendMessage(payload); + }); + return ( <div className={styles.unverified_users}> <Header subheading='Admin' /> @@ -46,7 +51,9 @@ const EnrollmentRequests = () => { <Button title='Reject' color='red' - onClick={() => deleteUse.mutate(item._id)} + onClick={() => { + deleteUse.mutate(item._id); + }} /> </div> )) diff --git a/admin/src/pages/UpdateRequests/UpdateRequests.jsx b/admin/src/pages/UpdateRequests/UpdateRequests.jsx index 07b3579..91629bd 100644 --- a/admin/src/pages/UpdateRequests/UpdateRequests.jsx +++ b/admin/src/pages/UpdateRequests/UpdateRequests.jsx @@ -49,16 +49,18 @@ const UpdateRequests = () => { data?.data.map((item) => ( <div className={styles.unverified_users__accordion} key={item._id}> <Accordion name={item.name} user={item} /> - <Button - title='Accept' - color='green' - onClick={() => updateUse.mutate(item._id)} - /> - <Button - title='Reject' - color='red' - onClick={() => deleteUse.mutate(item._id)} - /> + <div> + <Button + title='Accept' + color='green' + onClick={() => updateUse.mutate(item._id)} + /> + <Button + title='Reject' + color='red' + onClick={() => deleteUse.mutate(item._id)} + /> + </div> </div> )) ) : ( diff --git a/admin/src/services/apiservice.js b/admin/src/services/apiservice.js index c000755..2075239 100644 --- a/admin/src/services/apiservice.js +++ b/admin/src/services/apiservice.js @@ -28,3 +28,8 @@ export const updatingUsers = async () => { const response = await apiClient.get(`/users/updating`); return response; }; + +export const sendMessage = async (payload) => { + const response = await apiClient.post('/message', payload); + return response; +}; diff --git a/admin/yarn.lock b/admin/yarn.lock index ca1a2ea..6075bf0 100644 --- a/admin/yarn.lock +++ b/admin/yarn.lock @@ -1611,6 +1611,19 @@ resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.2.tgz#d54811df1d2d26ce87c0648e0e17061a41fe292c" integrity sha512-1guoGvL3QZ7VjA3y9zye9Rpm+jz18rVZIo3AauTGyW5ntDMxr/cR0M18nuc/NH2KqpMt+coh4NwPEO1uPuKM5w== +"@mui/lab@^5.0.0-alpha.96": + version "5.0.0-alpha.96" + resolved "https://registry.yarnpkg.com/@mui/lab/-/lab-5.0.0-alpha.96.tgz#f34e6c86ff4c1fc9a87592c8428b0771d3c1c970" + integrity sha512-hA3nef9cV50eIljPA/otQ6CrDeI276UGRJmVw6YZzSBtUeGuE9FY411VOZeST4I4OM88RD3lwiRbN5aTX5Nn3g== + dependencies: + "@babel/runtime" "^7.17.2" + "@mui/base" "5.0.0-alpha.94" + "@mui/system" "^5.10.2" + "@mui/utils" "^5.9.3" + clsx "^1.2.1" + prop-types "^15.8.1" + react-is "^18.2.0" + "@mui/material@^5.10.2": version "5.10.2" resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.10.2.tgz#e440c7839bff31c9bb075ce12eaebac83b4f1d9e" diff --git a/client/src/components/Card/Card.jsx b/client/src/components/Card/Card.jsx index 89b89b3..d0210f8 100644 --- a/client/src/components/Card/Card.jsx +++ b/client/src/components/Card/Card.jsx @@ -4,7 +4,7 @@ import styles from './Card.module.css' const Card = ({ title, image, onClick }) => { return ( <div onClick={onClick} className={styles.card}> - <img className={styles.card__image} src={image} alt="" height="300px" /> + <img className={styles.card__image} src={image} alt="" height="250px" /> <h2 className={styles.card__title}>{title}</h2> </div> ) diff --git a/client/src/components/Card/Card.module.css b/client/src/components/Card/Card.module.css index 54dd471..d34a159 100644 --- a/client/src/components/Card/Card.module.css +++ b/client/src/components/Card/Card.module.css @@ -1,8 +1,8 @@ @import '../../styles/GlobalVariables.css'; .card { - height: 500px; - width: 500px; + height: 400px; + width: 400px; display: flex; flex-direction: column; justify-content: center; @@ -13,7 +13,7 @@ transition: 0.2s all; cursor: pointer; color: var(--color-black); - font-size: 2.25rem; + font-size: 1.5rem; text-decoration: none; } |