Skip to content

Commit

Permalink
Merge pull request #125 from advanced-computer-lab-2023/cancel_payment
Browse files Browse the repository at this point in the history
fix: fixing mergeing isssues
  • Loading branch information
Aelmeky authored Dec 16, 2023
2 parents 21793ea + 195630f commit f42f482
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 50 deletions.
7 changes: 4 additions & 3 deletions client/src/layout/MainLayout/Sidebar/LogoSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import { useDispatch, useSelector } from 'react-redux';
import { ButtonBase } from '@mui/material';

// project imports
import config from 'config';
import Logo from 'ui-component/Logo';
import { MENU_OPEN } from 'store/actions';

import { useUserContext } from 'hooks/useUserContext.js';
// ==============================|| MAIN LOGO ||============================== //

const LogoSection = () => {
const { user } = useUserContext();
const userType = user.type;
const defaultId = useSelector((state) => state.customization.defaultId);
const dispatch = useDispatch();
return (
<ButtonBase disableRipple onClick={() => dispatch({ type: MENU_OPEN, id: defaultId })} component={Link} to={config.defaultPath}>
<ButtonBase disableRipple onClick={() => dispatch({ type: MENU_OPEN, id: defaultId })} component={Link} to={`/${userType}/dashboard/home`}>
<Logo />
</ButtonBase>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@ const pages = {
url: '/patient/pages/doctors',
target: false,
},
{
id: 'Wallet',
title: 'Wallet',
type: 'item',
icon: icons.Wallet,
url: '/patient/wallet',
target: false,
},
{
id: 'chat',
title: 'Chat',
Expand Down
36 changes: 0 additions & 36 deletions client/src/pages/prescriptions/EditPrescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
Button,
TextField,
FormControl,
Select,
MenuItem,
CircularProgress,
InputLabel,
} from '@mui/material';

const EditPrescription = ({
Expand All @@ -23,15 +20,6 @@ const EditPrescription = ({
setEditErrorMessage,
}) => {
const [isLoading, setIsLoading] = useState(false);
const [status, setStatus] = useState('');

const handleStatusChange = (e) => {
setStatus(e.target.value);
setSelectedEditPrescription({
...selectedEditPrescription,
filled: e.target.value,
});
};

return (
<Dialog
Expand All @@ -41,7 +29,6 @@ const EditPrescription = ({
setIsEditDialogOpen(false);
setTimeout(() => {
setEditErrorMessage('');
setStatus('');
}, 1000);
}}
>
Expand All @@ -54,32 +41,10 @@ const EditPrescription = ({
handleSaveEdit(e);
setTimeout(() => {
setIsLoading(false);
setStatus('');
}, 2000);
}}
id='editPrescriptionForm'
>
<FormControl required fullWidth>
<InputLabel required margin='norma;' id='status-label'>
Filled
</InputLabel>
<Select
fullWidth
labelId='status-label'
id='status-select'
value={status}
onChange={handleStatusChange}
label='Status'
required
>
<MenuItem fullWidth value='true'>
True
</MenuItem>
<MenuItem fullWidth value='false'>
False
</MenuItem>
</Select>
</FormControl>
<FormControl required fullWidth>
<TextField
fullWidth
Expand Down Expand Up @@ -110,7 +75,6 @@ const EditPrescription = ({
setIsEditDialogOpen(false);
setTimeout(() => {
setEditErrorMessage('');
setStatus('');
}, 1000);
}}
color='secondary'
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/prescriptions/MedicineCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export default function MedicineCard({
}}
>
<CardActionArea>
<IconButton onClick={() => handleMedicineDelete()}>
{userType === 'doctor' && (<IconButton onClick={() => handleMedicineDelete()}>
<Close />
</IconButton>
</IconButton>)}
<CardMedia
component='img'
height='140'
Expand Down
10 changes: 9 additions & 1 deletion client/src/pages/prescriptions/Prescriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const Prescriptions = () => {
const [editErrorMessage, setEditErrorMessage] = useState('');
const [isAddDialogOpen, setIsAddDialogOpen] = useState(false);
const [description, setDescription] = useState('');
const [patientName, setPatientName] = useState('');

useEffect(() => {
const getPrescriptions = async () => {
Expand Down Expand Up @@ -82,6 +83,13 @@ const Prescriptions = () => {
getPrescriptions();
}, [prescriptions.length]);

useEffect(() => {
patientAxios.get(`/patients/${patientID}`).then((response) => {
setPatientName(response.data.patient.name);
}
);
},[]);

useEffect(() => {
try {
pharmacyAxios.get('/medicines').then((response) => {
Expand Down Expand Up @@ -194,7 +202,7 @@ const Prescriptions = () => {
return loadingMedicine || loadingPrescription ? (
<Loader />
) : (
<MainCard title='Prescriptions'>
<MainCard title= {`Mr/Mrs ${patientName} Prescriptions`}>
<PrescriptionsList
prescriptions={prescriptions}
handleSelectingPrescription={handleSelectingPrescription}
Expand Down
8 changes: 8 additions & 0 deletions client/src/routes/DoctorRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const LazyHome = Loadable(lazy(() => import('pages/Home/Home')));

const Account = Loadable(lazy(() => import('pages/profile/Account')));

const LazyPrescription = Loadable(
lazy(() => import('pages/prescriptions/Prescriptions'))
);

// utilities routing
const UtilsTypography = Loadable(
lazy(() => import('pages/utilities/Typography'))
Expand Down Expand Up @@ -101,6 +105,10 @@ const DoctorRoutes = {
{
path: 'chat',
element: <LazyChat />,
},
{
path: 'patients/:patientId/prescriptions',
element: <LazyPrescription />,
}
],
},
Expand Down

0 comments on commit f42f482

Please sign in to comment.