update jamespong14205,
This commit is contained in:
136
task1/project/003_src/client/pages/AdminHome/index.js
Normal file
136
task1/project/003_src/client/pages/AdminHome/index.js
Normal file
@@ -0,0 +1,136 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { ChevronLeftOutlined } from '@mui/icons-material';
|
||||
import MenuIcon from '@mui/icons-material/Menu';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Drawer,
|
||||
IconButton,
|
||||
List,
|
||||
ListItem,
|
||||
ListItemButton,
|
||||
ListItemIcon,
|
||||
ListItemText,
|
||||
} from '@mui/material';
|
||||
import { useRouter } from 'next/dist/client/router';
|
||||
import Head from 'next/head';
|
||||
|
||||
export default function Home() {
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
const [changing_page, setChangingPage] = useState(false);
|
||||
|
||||
const toggleDrawer = newOpen => () => {
|
||||
setOpen(newOpen);
|
||||
};
|
||||
|
||||
const DrawerList = (
|
||||
<Box sx={{ width: 250 }} role='presentation' onClick={toggleDrawer(false)}>
|
||||
<List>
|
||||
<ListItem key='dashboard' disablePadding>
|
||||
<ListItemButton
|
||||
onClick={() => {
|
||||
setChangingPage(true);
|
||||
router.push('/AdminLogin');
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<ChevronLeftOutlined />
|
||||
</ListItemIcon>
|
||||
<ListItemText primary='Logout' />
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</List>
|
||||
</Box>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>admin dashboard</title>
|
||||
<meta name='description' content='Generated by create next app' />
|
||||
<link rel='icon' href='/favicon.ico' />
|
||||
</Head>
|
||||
|
||||
<Box className='main'>
|
||||
<Box
|
||||
sx={{
|
||||
//
|
||||
display: 'flex',
|
||||
flexDirection: 'flex-start',
|
||||
alignItems: 'center',
|
||||
gap: '1rem',
|
||||
//
|
||||
height: '3rem',
|
||||
}}
|
||||
>
|
||||
<IconButton aria-label='menu' onClick={toggleDrawer(true)}>
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
<Box sx={{ fontWeight: 'bold', fontSize: '1.2rem' }}>Admin dashboard</Box>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
height: '90vh',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<Box sx={{}}>
|
||||
<Box style={{ paddingTop: '3rem', width: '90vw' }}>
|
||||
<Button
|
||||
variant='contained'
|
||||
disabled={changing_page}
|
||||
onClick={() => {
|
||||
setChangingPage(true);
|
||||
router.push('/SemiUrgentCaseList');
|
||||
}}
|
||||
fullWidth
|
||||
>
|
||||
<Box sx={{ fontSize: '1.1rem', padding: '1rem' }}>Semi-urgent case</Box>
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
<Box style={{ paddingTop: '3rem', width: '90vw' }}>
|
||||
<Button
|
||||
variant='contained'
|
||||
disabled={changing_page}
|
||||
onClick={() => {
|
||||
setChangingPage(true);
|
||||
router.push('/NonUrgentCaseList');
|
||||
}}
|
||||
fullWidth
|
||||
>
|
||||
<Box style={{ fontSize: '1.1rem', padding: '1rem' }}>Non-urgent case</Box>
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
<Box style={{ paddingTop: '3rem', width: '90vw' }}>
|
||||
<Button
|
||||
variant='contained'
|
||||
disabled={changing_page}
|
||||
onClick={() => {
|
||||
setChangingPage(true);
|
||||
router.push('/SearchCase');
|
||||
}}
|
||||
fullWidth
|
||||
>
|
||||
<Box style={{ fontSize: '1.1rem', padding: '1rem' }}>Search case</Box>
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Drawer open={open} onClose={toggleDrawer(false)}>
|
||||
{DrawerList}
|
||||
</Drawer>
|
||||
</>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user