Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot fix : email send #85

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/layouts/dashboard/common/account-popover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function AccountPopover() {
}}
>
<Avatar
src={account.photoURL}
src={'assets/images/profile/profile-image.png'}
alt={account.displayName}
sx={{
width: 36,
Expand Down
6 changes: 5 additions & 1 deletion client/src/pages/login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import { LoginView } from 'src/sections/login';
// ----------------------------------------------------------------------

export default function LoginPage() {
const deleteCookie = (cookieName) => {
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
}
deleteCookie('token');
return (
<>
<Helmet>
<title> Login </title>
</Helmet>

{localStorage.clear()}
<LoginView />
</>
);
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ProfilePage() {
<Helmet>
<title> Profile </title>
</Helmet>
{console.log("888888 8 8 8 ", id)}

<ProfileView userID={id} />
</>
);
Expand Down
12 changes: 6 additions & 6 deletions client/src/sections/doctors/doctor-card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function DoctorCard({ i, doctor }) {
sx={{ position: 'relative', width: '85%' }}
>
{/* Backward Navigation Button */}
<Button
{localStorage.getItem('userRole') == 'Patient' && <Button
variant="contained"
onClick={() => {
setCheck((prev) => !prev);
Expand All @@ -110,10 +110,10 @@ export default function DoctorCard({ i, doctor }) {
}}
>
<Iconify icon="system-uicons:backward" sx={{ mx: 1 }} />
</Button>
</Button>}

{/* Sliding Component with DoctorDaySlots */}
<Slide in={check} direction="left" timeout={500} appear={false}>
{localStorage.getItem('userRole') == 'Patient' && <Slide in={check} direction="left" timeout={500} appear={false}>
<Stack direction={'row'} spacing={1} alignItems="center" justifyContent="center">
{Object.keys(weekSlots)
.slice(displayedDays, displayedDays + 3)
Expand All @@ -127,10 +127,10 @@ export default function DoctorCard({ i, doctor }) {
/>
))}
</Stack>
</Slide>
</Slide>}

{/* Forward Navigation Button */}
<Button
{localStorage.getItem('userRole') == 'Patient' && <Button
variant="contained"
onClick={() => {
setCheck((prev) => !prev);
Expand All @@ -152,7 +152,7 @@ export default function DoctorCard({ i, doctor }) {
}}
>
<Iconify icon="system-uicons:forward" sx={{ mx: 1 }} />
</Button>
</Button>}
</Stack>
</Stack>

Expand Down
12 changes: 6 additions & 6 deletions client/src/sections/doctors/view/doctors-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export default function DoctorsView() {
<Grid container spacing={3}>
{filteredDoctors
? filteredDoctors.map((doctor) => {
return (
<Grid key={doctor._id} item xs={12} md={12} sm={12}>
<DoctorCard i={i++} doctor={doctor} />
</Grid>
);
})
return (
<Grid key={doctor._id} item xs={12} md={12} sm={12}>
<DoctorCard i={i++} doctor={doctor} />
</Grid>
);
})
: null}
</Grid>
</Container>
Expand Down
2 changes: 1 addition & 1 deletion client/src/sections/login/login-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function LoginView() {
let target = destination;
if (user.role != 'Patient' && user.role != 'Admin') {
let response = await axiosInstance.get('upload/uploads');
if (response.data.result == 0) {
if (!response.data.result) {
target = '/upload-document';
}
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/sections/products/product-details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ export default function ProductDetails({ product, onCloseProductDetails }) {
const renderDescription = (
<Stack spacing={2}>
<Stack>
<Typography>Description : </Typography>
<Typography fontWeight="bold">Description : </Typography>
<Typography>{medicineProduct.description} </Typography>
</Stack>
<Stack direction={'row'} spacing={1}>
<Typography>medical use : </Typography>
<Typography fontWeight="bold">Medical use : </Typography>
<Typography>{medicineProduct.medicalUse} </Typography>
</Stack>
</Stack>
Expand Down Expand Up @@ -223,7 +223,7 @@ export default function ProductDetails({ product, onCloseProductDetails }) {
{user === 'Pharmacist' && (
<Stack spacing={1} sx={{ p: 3 }}>
<Typography color="inherit" underline="hover" variant="subtitle2">
items left in the stock
Items left in the stock
</Typography>
<Typography color="inherit" underline="hover" variant="subtitle2" sx={{ pl: 7 }}>
{medicineProduct.numStock}
Expand All @@ -233,7 +233,7 @@ export default function ProductDetails({ product, onCloseProductDetails }) {
{user === 'Pharmacist' && (
<Stack spacing={1} sx={{ p: 3 }}>
<Typography color="inherit" underline="hover" variant="subtitle2">
items sold
Items sold
</Typography>
<Typography color="inherit" underline="hover" variant="subtitle2" sx={{ pl: 4 }}>
{medicineProduct.numSold}
Expand Down
5 changes: 5 additions & 0 deletions client/src/sections/profile/component/profileInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
Divider,
Button,
} from '@mui/material';

import { CircularProgress } from '@mui/material';
import EditProfileModal from './profileSettings';
import PatientInfo from './patient/patientInfo';
// Custom component to render ListItemText with bold styling for words before the colon
Expand Down Expand Up @@ -188,11 +190,14 @@ function ProfileInfo({ userID }) {
{/* Apply BoldBeforeColonText to each ListItemText */}
<BoldBeforeColonText primary={`Name: ${user.name || 'Not specified'}`} />
<BoldBeforeColonText primary={`Email: ${user.email || 'Not specified'}`} />
<BoldBeforeColonText primary={`Username: ${user.username || 'Not specified'}`} />
<BoldBeforeColonText
primary={`Birth Date: ${new Date(user.birthDate).toLocaleDateString() || 'Not specified'}`}
/>
<BoldBeforeColonText primary={`Gender: ${user.gender || 'Not specified'}`} />
<BoldBeforeColonText primary={`Phone: ${user.phone || 'Not specified'}`} />
<BoldBeforeColonText primary={`Role: ${user.role || 'Not specified'}`} />

</List>
</CardContent>
</Card>
Expand Down
133 changes: 70 additions & 63 deletions client/src/sections/textChat/components/UsersList.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { axiosInstance } from '../../../utils/axiosInstance';
import Chat from './Chat';
import { Typography, List, ListItem, ListItemText, Paper, Box, Divider,Button } from '@mui/material';
import { Typography, List, ListItem, ListItemText, Paper, Box, Divider, Button, CircularProgress } from '@mui/material';
import io from 'socket.io-client';

function UsersList({ ioUrl, contactUrl }) {
Expand All @@ -12,6 +12,7 @@ function UsersList({ ioUrl, contactUrl }) {
const [newSocket, setNewSocket] = useState(null);
const [oldUsers, setOldUsers] = useState([]);
const [isSavedOld, setIsSavedOld] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const handleUserClick = (user) => {
setSelectedUser(user);
};
Expand All @@ -24,15 +25,15 @@ function UsersList({ ioUrl, contactUrl }) {
try {
if (firstTime) {
firstTime = false;

await fetch('http://localhost:3000/video-permission', {
method: 'GET',
});

} else {
// Open a new tab with Google Calendar URL
window.open('https://calendar.google.com/', '_blank');

// Use fetch for the second time with a request body
await fetch('http://localhost:3000/video-permission/schedule-videoCall', {
method: 'GET',
Expand Down Expand Up @@ -61,11 +62,12 @@ function UsersList({ ioUrl, contactUrl }) {

const fetchData = async () => {
try {
setIsLoading(true);
const response = await axiosInstance.get(contactUrl);
console.log('Response from /chat/users:', response.data);

const unseenMessagesCounts = await Promise.all(
response.data.map(async (user) => {
response.data.filter((user) => user.userID).map(async (user) => {
const countResponse = await axiosInstance.get(`/chat/room/${user.userID._id}/count`);
return { userID: user.userID._id, count: countResponse.data.count };
})
Expand All @@ -74,7 +76,7 @@ function UsersList({ ioUrl, contactUrl }) {
unseenMessagesCounts.forEach((item) => {
countMap[item.userID] = item.count;
});
const sortedUsers = response.data.sort((a, b) => {
const sortedUsers = response.data.filter((user) => user.userID).sort((a, b) => {
const countA = unseenMessagesCount[a.userID._id] || 0;
const countB = unseenMessagesCount[b.userID._id] || 0;
return countB - countA;
Expand All @@ -86,6 +88,8 @@ function UsersList({ ioUrl, contactUrl }) {
console.log('Count map:', countMap);
} catch (error) {
console.error('Error fetching users:', error);
} finally {
setIsLoading(false);
}
};

Expand Down Expand Up @@ -131,7 +135,65 @@ function UsersList({ ioUrl, contactUrl }) {
});
setUsers((prev) => sortedUsers);
}, [searchQuery]);

const renderList = () => {
return (<List style={{ padding: '0' }}>
{users.map((user) => (
<React.Fragment key={user.userID._id}>
<ListItem
style={{
backgroundColor: '#e6f7ff', // Light Blue
cursor: 'pointer',
transition: 'background-color 0.3s',
'&:hover': {
backgroundColor: '#c2e2ff', // Lighter Blue on Hover
},
//display: 'flex',
//alignItems: 'center'
}}
onClick={() => handleUserClick(user)}
>
<img
src={`/assets/images/profile/profile-image.png`}
alt={user.userID.name}
style={{ width: '50px', height: '50px', borderRadius: '50%', marginRight: '16px' }}
/>
<ListItemText primary={user.userID.name} />
{unseenMessagesCount[user.userID._id] > 0 && (
<div style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center' }}>
<div
style={{
width: '24px',
height: '24px',
borderRadius: '50%',
backgroundColor: 'red',
color: '#fff',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '14px',
}}
>
{unseenMessagesCount[user.userID._id]}
</div>
</div>
)}
<Button
variant="outlined"
onClick={(e) => {
e.stopPropagation();
handleVideoChat(user)
}}
style={{ marginLeft: 'auto' }}
>
Video Chat
</Button>
</ListItem>
<Divider sx={{ backgroundColor: '#bdbdbd' }} />
</React.Fragment>
))}
</List>
);
}
return (
<Box maxWidth="800px" m="0 auto" p="20px">
{/* <Typography variant="h4" mb={3} color="primary">
Expand All @@ -154,62 +216,7 @@ function UsersList({ ioUrl, contactUrl }) {
/>
</Paper>
<Paper elevation={3} sx={{ borderRadius: '8px', backgroundColor: '#f0f0f0', boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)' }}>
<List style={{ padding: '0' }}>
{users.map((user) => (
<React.Fragment key={user.userID._id}>
<ListItem
style={{
backgroundColor: '#e6f7ff', // Light Blue
cursor: 'pointer',
transition: 'background-color 0.3s',
'&:hover': {
backgroundColor: '#c2e2ff', // Lighter Blue on Hover
},
//display: 'flex',
//alignItems: 'center'
}}
onClick={() => handleUserClick(user)}
>
<img
src={`/assets/images/profile/profile-image.png`}
alt={user.userID.name}
style={{ width: '50px', height: '50px', borderRadius: '50%', marginRight: '16px' }}
/>
<ListItemText primary={user.userID.name} />
{unseenMessagesCount[user.userID._id] > 0 && (
<div style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center' }}>
<div
style={{
width: '24px',
height: '24px',
borderRadius: '50%',
backgroundColor: 'red',
color: '#fff',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '14px',
}}
>
{unseenMessagesCount[user.userID._id]}
</div>
</div>
)}
<Button
variant="outlined"
onClick={(e) =>{
e.stopPropagation();
handleVideoChat(user)
}}
style={{ marginLeft: 'auto' }}
>
Video Chat
</Button>
</ListItem>
<Divider sx={{ backgroundColor: '#bdbdbd' }} />
</React.Fragment>
))}
</List>
{isLoading ? <CircularProgress style={{ position: 'absolute', top: '50%', left: '50%' }} /> : renderList()}
</Paper>
{selectedUser && (
<Chat
Expand Down
2 changes: 1 addition & 1 deletion client/src/sections/upload/viewPDF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '@react-pdf-viewer/core/lib/styles/index.css';
function PDFViewer({ pdfURL }) {
return (
<div>
<Worker workerUrl={`${import.meta.env.BASE_URL}pdf.worker.min2.js`}>
<Worker workerUrl={`${import.meta.env.BASE_URL}pdf.worker.min.js`}>
<Viewer
fileUrl={pdfURL}
withCredentials={true}
Expand Down
Loading
Loading