Skip to content

Commit

Permalink
Merge pull request from advanced-computer-lab-2023/Non-functional
Browse files Browse the repository at this point in the history
Non functional
  • Loading branch information
3laaHisham authored Dec 24, 2023
2 parents f59753c + bd913ff commit 0981646
Show file tree
Hide file tree
Showing 34 changed files with 558 additions and 547 deletions.
53 changes: 53 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@faker-js/faker": "^8.1.0",
"@hookform/resolvers": "^3.3.2",
"@iconify/react": "^4.1.1",
"@mui/icons-material": "^5.14.16",
"@mui/lab": "^5.0.0-alpha.147",
Expand All @@ -38,6 +39,7 @@
"date-fns": "^2.30.0",
"history": "^5.3.0",
"html2pdf.js": "^0.10.1",
"joi": "^17.11.0",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21",
"mui": "^0.0.1",
Expand All @@ -62,4 +64,4 @@
"vite": "^4.4.11",
"vite-plugin-checker": "^0.6.2"
}
}
}
2 changes: 0 additions & 2 deletions client/src/contexts/userContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,3 @@ export const AuthContextProvider = ({ children }) => {

return <AuthContext.Provider value={isLogged}>{children}</AuthContext.Provider>;
};

export const useAuthContext = () => useContext(AuthContext);
2 changes: 1 addition & 1 deletion client/src/layouts/dashboard/config-navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const navConfigByRole = {
},
{
title: 'Medical History',
path: `/medical-history/${localStorage.getItem('userID')}`,
path: `/medical-history/`,
icon: icon('ic_history')
},
{
Expand Down
5 changes: 2 additions & 3 deletions client/src/pages/medical-history.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import MedicalHistoryView from 'src/sections/upload/Medical-History/view/medical
import { useParams } from 'react-router-dom';
const MedicalHistoryPage = () => {
let { patientID } = useParams();
patientID = patientID ? patientID : localStorage.getItem('userID');

return (
<>
<Helmet>
<title>Medical History/Records</title>
</Helmet>

<div style={containerStyle}>



<MedicalHistoryView patientID={patientID} />
</div>
</>
Expand Down
4 changes: 1 addition & 3 deletions client/src/routes/sections.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import CircularProgress from '@mui/material/CircularProgress';

import DashboardLayout from 'src/layouts/dashboard';

import { useAuthContext } from 'src/contexts/userContext';

export const IndexPage = lazy(() => import('src/pages/app'));
export const BlogPage = lazy(() => import('src/pages/blog'));
export const AppointmentsPage = lazy(() => import('src/pages/appointments'));
Expand Down Expand Up @@ -57,7 +55,7 @@ export default function Router() {
{ path: 'appointments', element: <AppointmentsPage /> },
{ path: 'chat', element: <ViewChat /> },
{ path: 'requests', element: <RequestsPage /> },
{ path: '/medical-history/:patientID', element: <MedicalHistoryPage /> },
{ path: '/medical-history', element: <MedicalHistoryPage /> },
{ path: 'health-record', element: <HealthRecordPage /> },
{ path: 'prescription', element: <PrescriptionsPage /> },
{ path: 'packages', element: <PackagePage /> },
Expand Down
5 changes: 3 additions & 2 deletions client/src/sections/addSlotsOrAppointment/AddSlots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ const AddSlotsForm = () => {
</form>

<Snackbar
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
open={open}
autoHideDuration={6000}
onClose={handleClose}
autoHideDuration={5000}
onClose={handleCloseSnackBar}
message={message}
action={
<IconButton size="small" aria-label="close" color="inherit" onClick={handleClose}>
Expand Down
110 changes: 0 additions & 110 deletions client/src/sections/addSlotsOrAppointment/ScheduleApp.jsx

This file was deleted.

28 changes: 8 additions & 20 deletions client/src/sections/addSlotsOrAppointment/view-slots.jsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import React, { useState, useEffect } from 'react';
import { useQuery, useMutation } from 'react-query';

import Stack from '@mui/material/Stack';
import Typography from '@mui/material/Typography';
import Divider from '@mui/material/Divider';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import { useQuery, useMutation } from 'react-query';
import CircularProgress from '@mui/material/CircularProgress';
import Snackbar from '@mui/material/Snackbar';
import IconButton from '@mui/material/IconButton';
import CloseIcon from '@mui/icons-material/Close';

import { axiosInstance } from '../../utils/axiosInstance';

export default function ViewSlots() {
const [message, setMessage] = useState('');
const [openSnackbar, setOpenSnackbar] = useState(false);
const {
isLoading,
error,
data: weeklySlots
} = useQuery(`mySlots`, () => axiosInstance.get(`/me/weeklySlots`).then((res) => res.data.result), {
refetchOnWindowFocus: false
});

if (isLoading) return <CircularProgress style={{ position: 'absolute', top: '50%', left: '50%' }} />;
if (error) {
// setOpenSnackbar(true);
// setMessage(error.response?.data.message || 'Network error');
return <div>Something went wrong ...</div>;
}
if (error) return <Typography>An error has occurred: {error.response?.data.message || 'Network error'}</Typography>;

const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];

const daySlots = (slots, day) => {
Expand Down Expand Up @@ -66,21 +66,9 @@ export default function ViewSlots() {
);
};

const handleCloseSnackBar = () => {
setOpenSnackbar(false);
};

return (
<Stack direction={'row'} spacing={1} alignItems="center" justifyContent="center" sx={{ width: '900px' }}>
{weeklySlots && days.map((day) => daySlots(weeklySlots[day], day))}

{/* <Snackbar
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
open={openSnackbar}
autoHideDuration={5000}
onClose={handleCloseSnackBar}
message={message}
/> */}
</Stack>
);
}
Loading

0 comments on commit 0981646

Please sign in to comment.