diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..8dc294ae
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 advanced-computer-lab-2023
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index fdde5378..fde29c97 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,39 @@
-# poly-medica-clinic
-
-
-## Motivation
-
-Welcome to poly-medica, a pioneering virtual clinic system designed to revolutionise healthcare accessibility by providing a seamless platform for patients and healthcare providers. Offering effortless appointment scheduling, online consultations, and streamlined access to medical records, our focus is on empowering patients while enabling healthcare professionals to prioritise patient care over administrative burdens. Join us in redefining the clinic experience, ensuring convenient, patient-centric healthcare services.
+# Poly Medica
+
+
+PolyMedica is a comprehensive healthcare solution that seamlessly integrates two virtual platforms: [PolyMedica Clinics](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic) and [PolyMedica Pharmacy](https://github.com/advanced-computer-lab-2023/poly-medica-Pharmacy). This innovative system is built on a microservices architecture, ensuring flexibility, scalability, and efficiency.
+
+The Systen mainly composed of 6 services, the communication among them is done by either asynchronous HTTP requests using Axios or synchronous communication using Apache Kafka:
+ * Clinic Service
+ * Patient Service
+ * Authentication Service
+ * Communication Service
+ * Payment Service
+ * Pharmacy Service
+---
+
+## Badges
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+---
## Build Status
@@ -17,12 +47,10 @@ Welcome to poly-medica, a pioneering virtual clinic system designed to revolutio
[![Payment CI](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/actions/workflows/payment-microservice-ci.yml/badge.svg)](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/actions/workflows/payment-microservice-ci.yml)
+---
### Planned Features
-#### Microservices with Kafka
-
-We're planning to implement a microservices architecture using Kafka as the messaging system. This will enable scalable and decoupled communication between various components of our system, ensuring robustness and flexibility.
#### Frontend Automated Testing with Jest for React MUI
@@ -34,7 +62,11 @@ We're excited to introduce AI models to augment our system's capabilities:
- *Doctor Assistance AI*: This AI model will assist doctors by analyzing symptoms input by the patient, suggesting suitable medicines, and providing dosage recommendations. It will also create reminders for doctors regarding prescribed medications and their quantities.
-## Code Style Guide
+- *Patient Assistance AI*: Suggest replacements for medicines out of stock for the patient
+
+---
+
+
Code Style Guide
### JavaScript (Node.js and React)
@@ -66,104 +98,137 @@ We're excited to introduce AI models to augment our system's capabilities:
- *Branching*: Follow Gitflow (feature branches, develop, master).
- *Pull Requests*: Require clear descriptions and peer reviews before merging.
+
+---
-## Screenshots 🖵
-
-Admin
-
-
-Add New Helath Packages
-
-![WhatsApp Image 2023-12-17 at 5 00 28 AM (1)](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/101880627/36a7386d-2d20-435c-acc3-349988abeb52)
+
Microservices Structure
+
+ ```bash
+ Poly-Medica Clinic
+├── clinic
+│ ├── ...
+│ └── (Clinic Service Code)
+├── patient
+│ ├── ...
+│ └── (Patient Service Code)
+├── authentication
+│ ├── ...
+│ └── (Authentication Service Code)
+├── communication
+│ ├── ...
+│ └── (Communication Service Code)
+├── payment
+│ ├── ...
+│ └── (Payment Service Code)
+└── client
+ ├── ...
+ └── (Client Application Code)
+
+Poly-Medica Pharmacy
+├── pharmacy
+│ ├── ...
+│ └── (Pharmacy Service Code)
+└── client
+ ├── ...
+ └── (Client Application Code)
+ ```
-
-
+---
-
-
-Patient
+## Screenshots 🖵
-Home Page
-
-![WhatsApp Image 2023-12-17 at 5 00 29 AM (1)](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/101880627/7fdf73b9-bc45-4f2c-ac3d-3bcbb4abf9a6)
-
-
+Login Page
+
+ ![login](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/56325872-aaac-4b78-843f-635c8edf4849)
+
-View Appointments
+Home Page
+
+ ![home](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/5bfe411b-d6a7-4472-96db-0b88cf9353b6)
+
+
-![WhatsApp Image 2023-12-17 at 5 00 28 AM](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/101880627/62230d66-c83e-4186-a991-24f3c3879ace)
-
+
+Appointments Page
+
+ ![appointments](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/4095f6da-2857-4ac1-bd5d-f2b61d911dc1)
+
-Select a Doctor
-
-![WhatsApp Image 2023-12-17 at 5 00 29 AM](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/101880627/7420601b-bd39-4a8c-9fc0-3338fad3c294)
-
-
+Health Package Page
+
+ ![health-package](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/ef6c952f-107a-4438-8462-f74652dc8ffa)
+
-
+
+Apply Filter on doctors
+
+![apply-filter](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/a8b3508f-52dd-4e17-8292-48c788667916)
+
-
-
-
-
-Doctor
+Patient Adding family members
+
+![add-member](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/e11252e9-487b-4b4f-b33e-efa325a854fb)
+
+
-Follow-up requests
-
- ![WhatsApp Image 2023-12-17 at 5 00 28 AM (2)](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/101880627/51774f22-2b4c-41c1-a073-390703f5b911)
-
-
+Doctor Receiving Notification
+
+![notification](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/f2a8d218-3002-4d7e-9129-25b537392adb)
+
-confirmation message
+Admin Viewing Requests
+
+![requests](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/102627389/b7643d4d-ac7b-4d18-b2e8-8f5b0fb9e84b)
- ![WhatsApp Image 2023-12-17 at 5 00 29 AM (2)](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/101880627/7097c174-83d2-4fd2-8718-669282a5595c)
+
-
-
-
-
-
+
+ ---
## Tech/Framework used
- [Node.js](https://nodejs.org/en/)
- [Express](https://expressjs.com/)
- [React](https://reactjs.org/)
-
- [MongoDB](https://www.mongodb.com/)
- [Mongoose](https://mongoosejs.com/)
- [Jest](https://jestjs.io/)
-
- [Material-UI](https://material-ui.com/)
- [Stripe](https://stripe.com/)
-
- [Git](https://git-scm.com/)
- [Github Actions](github.com/features/actions)
-
- [MongoDB Atlas](https://www.mongodb.com/cloud/atlas)
- [Postman](https://www.postman.com/)
- [VSCode](https://code.visualstudio.com/)
-- [Babel](https://babeljs.io/)
+- [Babel](https://babeljs.io/)
+- [Socket IO](https://socket.io/)
+- [JWT](https://jwt.io/)
+- [Docker](https://www.docker.com/)
+- [Apache Kafka](https://kafka.apache.org/)
+- [ESlint](https://eslint.org/)
+- [Redux](https://react-redux.js.org/)
+- [Node Mailer](https://nodemailer.com/)
+---
## Features
@@ -230,7 +295,7 @@ The system serves different type of users (Patient, Doctor , Admin )
- As a Admin I can
+ As an Admin I can
- Add another adminstrator
- Remove a doctor or a patient or an admin from the system
@@ -246,44 +311,92 @@ The system serves different type of users (Patient, Doctor , Admin )
- Filter Context
+ Admin Details
```javascript
+import React from 'react';
+import DoctorIcon from '../../../assets/images/icons/DoctorIcon.png';
+import EmailIcon from '@mui/icons-material/Email';
+import StarBorderIcon from '@mui/icons-material/StarBorder';
+import {
+ Dialog,
+ DialogTitle,
+ DialogContent,
+ Typography,
+ DialogActions,
+ Button,
+ useTheme,
+} from '@mui/material';
+import { styled } from '@mui/system';
+import { useAdminContext } from 'hooks/useAdminContext';
+import { commonStyles } from 'ui-component/CommonStyles';
+
+const useStyles = styled(() => commonStyles);
+
+const AdminDetails = () => {
+ const classes = useStyles();
+ const theme = useTheme();
+ const title = ' ';
-import React, { createContext, useContext, useState } from 'react';
-
-const FilterContext = createContext();
-
-export const FilterProvider = ({ children }) => {
- const [filterData, setFilterData] = useState(
- [
- {
- attribute: '',
- values: [],
- selectedValue: '',
- }
- ]);
+ const { setSelectedAdmin, setErrorMessage, selectedAdmin } = useAdminContext();
- const updateFilter = (newFilterData) => {
- setFilterData(newFilterData);
- };
+ const handleDialogClose = () => {
+ setSelectedAdmin(null);
+ setErrorMessage('');
+ };
- return (
-
- {children}
-
- );
+ return (
+
+ );
};
-export const useFilter = () => {
- const context = useContext(FilterContext);
- if (!context) {
- throw new Error('useFilter must be used within a FilterProvider');
- }
- return context;
-};
+export default AdminDetails;
```
@@ -324,182 +437,80 @@ export const SearchProvider = ({ children }) => {
- Side Bar
+ Get admins API
```javascript
-import PropTypes from 'prop-types';
-
-import { useTheme } from '@mui/material/styles';
-import { Box, Chip, Drawer, Stack, useMediaQuery } from '@mui/material';
-
-import PerfectScrollbar from 'react-perfect-scrollbar';
-import { BrowserView, MobileView } from 'react-device-detect';
-
-import MenuList from './MenuList';
-import LogoSection from './LogoSection';
-import { drawerWidth } from 'store/constant';
-
-
-const Sidebar = ({ drawerOpen, drawerToggle, window }) => {
- const theme = useTheme();
- const matchUpMd = useMediaQuery(theme.breakpoints.up('md'));
-
- const drawer = (
- <>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- );
-
- const container = window !== undefined ? () => window.document.body : undefined;
-
- return (
-
-
- {drawer}
-
-
- );
-};
-
-Sidebar.propTypes = {
- drawerOpen: PropTypes.bool,
- drawerToggle: PropTypes.func,
- window: PropTypes.object
-};
-
-export default Sidebar;
-
+ app.get('/admins', async (req, res) => {
+ try {
+ const admins = await service.findAllAdmins();
+ res.status(OK_STATUS_CODE).json({ admins });
+ } catch (err) {
+ res.status(ERROR_STATUS_CODE).json({ err: err.message });
+ }
+ });
```
- Order API
+ Users Model
```javascript
-import OrderService from '../service/order-service.js';
-import { isValidMongoId } from '../utils/Validation.js';
-
-import {
- OK_STATUS_CODE,
- ERROR_STATUS_CODE,
-} from '../utils/Constants.js';
-
-export const order = (app) => {
- const service = new OrderService();
-
- app.get('/order/pending', async (req, res) => {
- try {
- const data = await service.getPendingOrders();
- res.status(OK_STATUS_CODE).json(data);
- } catch (err) {
- res.status(ERROR_STATUS_CODE).json({
- message: 'error occurred while fetching orders',
- });
- }
- });
-
- app.get('/order/:patientId', async (req, res) => {
- const { patientId } = req.params;
- if (!isValidMongoId(patientId)) {
- return res.status(ERROR_STATUS_CODE).json({
- message: 'Patient ID is invalid',
- });
- }
- try {
- const data = await service.getOrders(patientId);
- res.status(OK_STATUS_CODE).json(data);
- } catch (err) {
- res.status(ERROR_STATUS_CODE).json({
- message: 'error occurred while fetching orders',
- });
- }
- });
-
- app.post('/order', async (req, res) => {
- try {
- const { order } = req.body;
- console.log(order);
- const data = await service.addOrder(order);
- res.status(OK_STATUS_CODE).json(data);
- } catch (err) {
- res.status(ERROR_STATUS_CODE).json({
- message: 'error occurred while adding order',
- error: err.message,
- });
- }
- });
-
- app.patch('/order/:orderId', async (req, res) => {
- const { orderId } = req.params;
- if (!isValidMongoId(orderId)) {
- return res.status(ERROR_STATUS_CODE).json({
- message: 'Order ID is invalid',
- });
- }
- try {
- const { order } = req.body;
- const data = await service.updateOrder(orderId, order);
- res.status(OK_STATUS_CODE).json(data);
- } catch (err) {
- res.status(ERROR_STATUS_CODE).json({
- message: 'error occurred while updating order',
- error: err.message,
- });
- }
+import mongoose from 'mongoose';
+import { USER_ARR_ENUM } from '../../utils/Constants.js';
+
+const userSchema = mongoose.Schema({
+ userId:{
+ type: mongoose.Schema.Types.ObjectId,
+ required:true,
+ unique: true,
+ },
+ email:{
+ type:String,
+ required:true,
+ unique: true,
+ },
+ userName:{
+ type:String,
+ required:true,
+ unique: true
+ },
+ password:{
+ type:String,
+ required:true
+ },
+ type:{
+ type: String,
+ enum: USER_ARR_ENUM,
+ required:true
+ },
+});
+
+userSchema.statics.signup = async function (
+ userId,
+ email,
+ password,
+ userName,
+ type,
+) {
+ const userRecord = new this({
+ userId: new mongoose.Types.ObjectId(userId),
+ email,
+ password,
+ userName,
+ type,
});
+ const result = await userRecord.save();
+ return result;
};
+const User = mongoose.model('User', userSchema);
+
+export default User;
```
@@ -607,37 +618,20 @@ export default Sidebar;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+---
## Installation
-
-Install my-project with `npm`
-
+
```bash
> git clone https://github.com/advanced-computer-lab-2023/poly-medica-Clinic.git
> cd poly-medica-clinic
-> cd authentication && npm i && cd..
-> cd clinic && npm i && cd..
-> cd communication && npm i && cd..
-> cd patient && npm i && cd..
-> cd payment && npm i && cd..
-> cd client && npm i
+> chmod +x install-all.sh
+> ./install-all.sh
```
+
+---
+
## API Refrences
### Authentication Endpoints
@@ -733,72 +727,39 @@ Install my-project with `npm`
POST /payment/wallet
POST /payment-salary/doctor/:doctorId/wallet
+---
+
## Tests
-The testing is done using `jest`. To run the tests, run the following command.
-
+The testing is done using `jest`. To run the tests, run the following command:
+- Make sure you are at the root directory of the project
+
```bash
-> cd authentication && npm run test
-```
-```bash
-> cd clinic && npm run test
-```
-```bash
-> cd communication && npm run test
-```
-```bash
-> cd patient && npm run test
-```
-```bash
-> cd payment && npm run test
+> chmod +x run-tests.sh
+>./run-tests.sh
```
![image](https://github.com/advanced-computer-lab-2023/poly-medica-Clinic/assets/101880627/3b31ae18-a4af-47ed-aee3-cf8e1be5a2d2)
-
-### Models tests
+### Model tests
`Faker.js` is used to generate data to test different models
-There is tests done for the following models : `User` , `Admin` , `Patient` , `Doctor` , `Appointment` , `Health Package` , `Order` , `Prescription`
-
-
-
+There are tests done for the following models : `User` , `Admin` , `Patient` , `Doctor` , `Appointment` , `Health Package` , `Order` , `Prescription`
## How to use
-To run backend
-#### authentication service
-```bash
-cd authentication && nodemon start
-```
-#### clinic service
-```bash
-cd clinic && nodemon start
-```
-#### patient service
-```bash
-cd patient && nodemon start
-```
-#### patient service
-```bash
-cd patient && nodemon start
-```
-#### payment service
-```bash
-cd patient && nodemon start
-```
-#### communication service
-```bash
-cd communication && nodemon start
-```
+To run the project
+- Make sure you are at the root directory of the project
+- The script will run all the services and the client except the pharmacy service, which could be found at [this repository](https://github.com/advanced-computer-lab-2023/poly-medica-Pharmacy)
-To run frontend
```bash
-cd client && npm start
+> npm install -g concurrently
+> chmod +x run-all.sh
+> ./run-all.sh
```
All services and client will be running on the specified ports on your env files.
@@ -836,11 +797,6 @@ Contributions are always welcome!
8. Wait for your pull request to be reviewed and merged
-
-
-
-
-
# Credits
- [NodeJs docs](https://nodejs.org/en/docs/)
- [Express docs](https://expressjs.com/en/4x/api.html)
@@ -855,18 +811,19 @@ Contributions are always welcome!
- [Designing Data Intensive Applications](https://www.oreilly.com/library/view/designing-data-intensive-applications/9781491903063/)
-
-
+---
## License
-#### Stripe License
-This project uses Stripe to process payments. By using this project, you agree to be bound by the Stripe Services Agreement.
-
-You can find the full text of the Stripe Services Agreement at the following link:
-
-https://stripe.com/legal
+The Project is open source following [MIT License](https://opensource.org/license/mit/)
-Please make sure to read and understand the Stripe Services Agreement before using this project.
+---
-If you have any questions about the Stripe Services Agreement or how it applies to your use of this project, please contact Stripe at support@stripe.com.
\ No newline at end of file
+### Contributers:
+- [Mohamed Khaled](https://github.com/Mohamed-Khaled308)
+- [Amir Tarek](https://github.com/amir-awad)
+- [Malek Mohamed](https://github.com/malekelkssas)
+- [Ahmad Hoseiny](https://github.com/AhmadHoseiny)
+- [Mohamed Hassan](https://github.com/mohamedhassans)
+- [Abdelrahman Amr](https://github.com/Aelmeky)
+- [Yehia Mohamed](https://github.com/YehiaFarghaly)
diff --git a/authentication/src/tests/api-tests/AuthenticationAPI.test.js b/authentication/src/tests/api-tests/AuthenticationAPI.test.js
index 96cdbe8c..a97b52a5 100644
--- a/authentication/src/tests/api-tests/AuthenticationAPI.test.js
+++ b/authentication/src/tests/api-tests/AuthenticationAPI.test.js
@@ -3,7 +3,7 @@ import app from '../../../app.js';
import {
connectDBTest,
disconnectDBTest
-} from '../../utils/testing-utils.js';
+} from '../../utils/TestingUtils.js';
import User from '../../database/models/Users.js';
import { describe, beforeEach, afterEach, expect, it, jest } from '@jest/globals';
import generateUser from '../model-generators/generateUser.js';
diff --git a/authentication/src/utils/testing-utils.js b/authentication/src/utils/TestingUtils.js
similarity index 100%
rename from authentication/src/utils/testing-utils.js
rename to authentication/src/utils/TestingUtils.js
diff --git a/client/src/api/AdminAPI.js b/client/src/api/AdminAPI.js
index 26da7164..e1e7056a 100644
--- a/client/src/api/AdminAPI.js
+++ b/client/src/api/AdminAPI.js
@@ -20,3 +20,23 @@ export const deleteAdmin = async (adminToDelete) => {
const response = await clinicAxios.delete(`/admins/${adminToDelete}`);
return response.data;
};
+
+export const getHealthPackages = async () => {
+ const response = await clinicAxios.get('/packages');
+ return response.data;
+};
+
+export const addHealthPackage = async (newPackage) => {
+ const response = await clinicAxios.post('/packages', { newPackage });
+ return response.data;
+};
+
+export const updateHealthPackage = async (selectedEditPackage) => {
+ const response = await clinicAxios.patch(`/package/${selectedEditPackage._id}`, { selectedEditPackage });
+ return response.data;
+};
+
+export const deleteHealthPackage = async (healthPackage) => {
+ const response = await clinicAxios.delete(`/packages/${healthPackage._id}`);
+ return response.data;
+};
\ No newline at end of file
diff --git a/client/src/api/DoctorAPI.js b/client/src/api/DoctorAPI.js
index 9ed1d6cd..89bbfb56 100644
--- a/client/src/api/DoctorAPI.js
+++ b/client/src/api/DoctorAPI.js
@@ -1,4 +1,4 @@
-import { clinicAxios, communicationAxios } from 'utils/AxiosConfig';
+import { clinicAxios, communicationAxios, patientAxios } from 'utils/AxiosConfig';
import {
DOCTOR_TYPE_ENUM,
PHARMACIST_TYPE_ENUM,
@@ -82,4 +82,16 @@ export const addDoctorChat = async (doctor) => {
],
},
});
+};
+
+export const updatePrescription = async (selectedEditPrescription) => {
+ const response = await patientAxios.patch('/prescriptions/' + selectedEditPrescription._id, {
+ prescription: selectedEditPrescription,
+ });
+ return response.data;
+};
+
+export const createPrescription = async (prescription) => {
+ const response = await patientAxios.post('/prescriptions', { prescription });
+ return response.data;
};
\ No newline at end of file
diff --git a/client/src/api/PatientAPI.js b/client/src/api/PatientAPI.js
index d7d77199..f5e74d81 100644
--- a/client/src/api/PatientAPI.js
+++ b/client/src/api/PatientAPI.js
@@ -1,5 +1,15 @@
import { patientAxios, clinicAxios } from 'utils/AxiosConfig';
+export const getPatient = async (patientID) => {
+ const response = await patientAxios.get(`/patients/${patientID}`);
+ return response.data;
+};
+
+export const getPatientHealthPackage = async (patientID) => {
+ const response = await patientAxios.get(`/patient/${patientID}/health-packages`);
+ return response.data;
+};
+
export const getPatients = async () => {
const response = await patientAxios.get('/patients');
return response.data;
@@ -8,4 +18,29 @@ export const getPatients = async () => {
export const deletePatient = async (patientToDelete) => {
const response = await clinicAxios.delete(`/patients/${patientToDelete}`);
return response.data;
+};
+
+export const getFamilyMembers = async (userId) => {
+ const response = await patientAxios.get('/family-members/' + userId);
+ return response.data;
+};
+
+export const updateFamilyMembers = async (userId, newMember) => {
+ const response = await patientAxios.patch('/family-members/' + userId, { member: newMember });
+ return response.data;
+};
+
+export const getPatientDiscount = async (user) => {
+ const response = await patientAxios.get(`/patient/${user.id}/discount`);
+ return response.data;
+};
+
+export const updateHealthPackageStatus = async (user, subscribedPackage) => {
+ const response = await patientAxios.patch(`patient/${user.id}/health-packages/${subscribedPackage.packageId}`);
+ return response.data;
+};
+
+export const getPatientPrescription = async (patientID) => {
+ const response = await patientAxios.get(`patient/${patientID}/prescriptions`);
+ return response.data;
};
\ No newline at end of file
diff --git a/client/src/assets/images/boarding.jpg b/client/src/assets/images/boarding.jpg
new file mode 100644
index 00000000..a47e4efe
Binary files /dev/null and b/client/src/assets/images/boarding.jpg differ
diff --git a/client/src/assets/images/logo.png b/client/src/assets/images/logo.png
index 2894136b..1f2126bb 100644
Binary files a/client/src/assets/images/logo.png and b/client/src/assets/images/logo.png differ
diff --git a/client/src/contexts/AdminContext.js b/client/src/contexts/AdminContext.js
index fd8e0e58..e3996337 100644
--- a/client/src/contexts/AdminContext.js
+++ b/client/src/contexts/AdminContext.js
@@ -19,6 +19,15 @@ const AdminProvider = ({ children }) => {
const [selectedAdmin, setSelectedAdmin] = useState(null);
const [strength, setStrength] = useState(0);
const [level, setLevel] = useState();
+ const [newPackage, setNewPackage] = useState({
+ name: '',
+ price: '',
+ discountOfDoctor: '',
+ discountOfMedicin: '',
+ discountOfFamily: '',
+ });
+ const [selectedEditPackages, setSelectedEditPackages] = useState(null);
+ const [isEditDialogOpen, setIsEditDialogOpen] = useState(false);
const contextValue = {
admins, setAdmins, isLoading, setIsLoading, openAddDialog, setOpenAddDialog, newAdminEmail,
@@ -27,7 +36,8 @@ const AdminProvider = ({ children }) => {
adminToDelete, setAdminToDelete, addAdmin, setAddAdmin, removeAdmin, setRemoveAdmin,
adminIsBeingAdded, setAdminIsBeingAdded, adminIsBeingDeleted, setAdminIsBeingDeleted,
errorMessage, setErrorMessage, selectedAdmin, setSelectedAdmin, strength, setStrength,
- level, setLevel
+ level, setLevel, newPackage, setNewPackage, selectedEditPackages, setSelectedEditPackages, isEditDialogOpen,
+ setIsEditDialogOpen
};
return (
diff --git a/client/src/contexts/DoctorContext.js b/client/src/contexts/DoctorContext.js
index f20c6a28..28acdaf5 100644
--- a/client/src/contexts/DoctorContext.js
+++ b/client/src/contexts/DoctorContext.js
@@ -13,19 +13,17 @@ const DoctorProvider = ({ children }) => {
const [errorMessage, setErrorMessage] = useState('');
const [availableSlots, setAvailableSlots] = useState([]);
const [selectedDate, setSelectedDate] = useState(null);
- const [selectedTime, setSelectedTime] = useState(null);
- const [patients, setPatients] = useState([]);
- const [originalPatients, setOriginalPatients] = useState([]);
- const [appointments, setAppointments] = useState([]);
- const [loggedInDoctor, setLoggedInDoctor] = useState(null);
- const [selectedPatient, setSelectedPatient] = useState(null);
-
+ const [selectedTime, setSelectedTime] = useState(null);
+ const [appointments, setAppointments] = useState([]);
+ const [loggedInDoctor, setLoggedInDoctor] = useState(null);
+ const [selectedDoctor, setSelectedDoctor] = useState(null);
+ const [originalDoctors, setOriginalDoctors] = useState([]);
+
const contextValue = {
doctors, setDoctors, isLoading, setIsLoading, confirmDeleteDialogOpen, setConfirmDeleteDialogOpen, setSelectedTime,
- doctorToDelete, setDoctorToDelete, doctorIsBeingDeleted, setDoctorIsBeingDeleted, doctorDeleted, selectedTime,
+ doctorToDelete, setDoctorToDelete, doctorIsBeingDeleted, setDoctorIsBeingDeleted, doctorDeleted, selectedTime, setOriginalDoctors,
setDoctorDeleted, errorMessage, setErrorMessage, availableSlots, setAvailableSlots, selectedDate, setSelectedDate,
- patients, setPatients, originalPatients, setOriginalPatients, appointments, setAppointments, loggedInDoctor, setLoggedInDoctor,
- selectedPatient, setSelectedPatient
+ appointments, setAppointments, loggedInDoctor, setLoggedInDoctor, selectedDoctor, setSelectedDoctor, originalDoctors
};
return (
diff --git a/client/src/contexts/PatientContext.js b/client/src/contexts/PatientContext.js
index 3d74515e..9ba83c0e 100644
--- a/client/src/contexts/PatientContext.js
+++ b/client/src/contexts/PatientContext.js
@@ -5,18 +5,40 @@ export const PatientContext = createContext();
const PatientProvider = ({ children }) => {
const [patients, setPatients] = useState([]);
- const [isLoading, setIsLoading] = useState(true);
- const [confirmDeleteDialogOpen, setConfirmDeleteDialogOpen] = useState(false);
- const [patientToDelete, setPatientToDelete] = useState(null);
- const [patientIsBeingDeleted, setPatientIsBeingDeleted] = useState(false);
- const [patientDeleted, setPatientDeleted] = useState(false);
- const [errorMessage, setErrorMessage] = useState('');
- const [selectedPatient, setSelectedPatient] = useState(null);
-
+ const [originalPatients, setOriginalPatients] = useState([]);
+ const [isLoading, setIsLoading] = useState(true);
+ const [confirmDeleteDialogOpen, setConfirmDeleteDialogOpen] = useState(false);
+ const [patientToDelete, setPatientToDelete] = useState(null);
+ const [patientIsBeingDeleted, setPatientIsBeingDeleted] = useState(false);
+ const [patientDeleted, setPatientDeleted] = useState(false);
+ const [errorMessage, setErrorMessage] = useState('');
+ const [selectedPatient, setSelectedPatient] = useState(null);
+ const [loggedInPatient, setLoggedInPatient] = useState(null);
+ const [loggedInPatientHealthPackage, setLoggedInPatientHealthPackage] = useState(null);
+ const [FamilyMembers, setFamilyMembers] = useState([]);
+ const [openPackages, setOpenPackages] = useState(false);
+ const [error, setError] = useState(false);
+ const [newMember, setNewMember] = useState({
+ name: '',
+ nationalId: '',
+ age: '',
+ gender: '',
+ relation: '',
+ email: '',
+ mobileNumber: '',
+ id: ''
+ });
+ const [memberId, setMemberId] = useState(null);
+ const [packages, setPackages] = useState([]);
+ const [subscribedPackage, setSubscribedPackage] = useState(null);
+ const [discount, setDiscount] = useState(0);
+ const [isPaymentOpen, setIsPaymentOpen] = useState(false);
const contextValue = {
- patients, setPatients, isLoading, setIsLoading, confirmDeleteDialogOpen, setConfirmDeleteDialogOpen, patientToDelete, setPatientToDelete,
- patientIsBeingDeleted, setPatientIsBeingDeleted, patientDeleted, setPatientDeleted, errorMessage, setErrorMessage, selectedPatient,
- setSelectedPatient
+ patients, setPatients, isLoading, setIsLoading, confirmDeleteDialogOpen, setConfirmDeleteDialogOpen, patientToDelete, setPatientToDelete, FamilyMembers,
+ patientIsBeingDeleted, setPatientIsBeingDeleted, patientDeleted, setPatientDeleted, errorMessage, setErrorMessage, selectedPatient, setFamilyMembers,
+ setSelectedPatient, originalPatients, setOriginalPatients, loggedInPatient, setLoggedInPatient, loggedInPatientHealthPackage,
+ openPackages, setOpenPackages, error, setError, newMember, setNewMember, memberId, setMemberId, setLoggedInPatientHealthPackage,
+ packages, setPackages, subscribedPackage, setSubscribedPackage, discount, setDiscount, isPaymentOpen, setIsPaymentOpen
};
return (
diff --git a/client/src/layout/MainLayout/Header/ProfileSection/UpgradePlanCard.js b/client/src/layout/MainLayout/Header/ProfileSection/UpgradePlanCard.js
index 3fa18646..f3837a13 100644
--- a/client/src/layout/MainLayout/Header/ProfileSection/UpgradePlanCard.js
+++ b/client/src/layout/MainLayout/Header/ProfileSection/UpgradePlanCard.js
@@ -5,9 +5,9 @@ import { Button, Card, CardContent, Grid, Stack, Typography } from '@mui/materia
import { useUserContext } from 'hooks/useUserContext';
// project imports
import AnimateButton from 'ui-component/extended/AnimateButton';
-import { patientAxios } from 'utils/AxiosConfig';
import { HEALTH_PACKAGE_STATUS } from 'utils/Constants';
import { useNavigate } from 'react-router-dom';
+import { getPatientHealthPackage } from 'api/PatientAPI';
// styles
const CardStyle = styled(Card)(({ theme }) => ({
background: theme.palette.warning.light,
@@ -49,8 +49,8 @@ const UpgradePlanCard = () => {
const formattedRenewalDate = renewalDate.toLocaleString('en-US', options);
const navigate = useNavigate();
useEffect(() => {
- patientAxios.get(`/patient/${user.id}/health-packages`).then((response) => {
- setHealthPackages(response.data.healthPackages);
+ getPatientHealthPackage(user.id).then((response) => {
+ setHealthPackages(response.healthPackages);
}).catch((err) => {
console.log(err);
});
diff --git a/client/src/layout/MainLayout/Header/SearchSection/FilterDropdown.js b/client/src/layout/MainLayout/Header/SearchSection/FilterDropdown.js
index f9663318..9f6dd35d 100644
--- a/client/src/layout/MainLayout/Header/SearchSection/FilterDropdown.js
+++ b/client/src/layout/MainLayout/Header/SearchSection/FilterDropdown.js
@@ -1,71 +1,87 @@
-import React from 'react';
+import React, { useState } from 'react';
import {
Drawer,
- Select,
Typography,
- MenuItem,
- FormControl,
- InputLabel,
Card,
Grid,
- TextField,
+ FormControl,
+ Radio,
+ RadioGroup,
+ FormControlLabel,
+ IconButton,
Slide,
+ TextField
} from '@mui/material';
+import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
+import ArrowBackIcon from '@mui/icons-material/ArrowBack';
const FilterDropdown = ({ filterData, onChange, isDrawerOpen, handleDrawerClose }) => {
+ const [activeFilterIndex, setActiveFilterIndex] = useState(0);
+
+ const handleArrowClick = (direction) => {
+ if (direction === 'left') {
+ setActiveFilterIndex((prevIndex) => (prevIndex - 1 + filterData.length) % filterData.length);
+ } else if (direction === 'right') {
+ setActiveFilterIndex((prevIndex) => (prevIndex + 1) % filterData.length);
+ }
+ };
+
return (
{filterData.length > 0 ? (
-
-
-
- Apply Filters on this page:
+
+
+
+ Apply Filters:
- {filterData.map((filter, index) => (
-
-
-
- Filter By {filter.attribute}
+
+
+
+ handleArrowClick('left')}>
+
+
+
+ {filterData[activeFilterIndex].attribute}
- {filter.attribute === 'Available Slots' ? (
- onChange(index, event.target.value)}
- InputLabelProps={{
- shrink: true,
- }}
- fullWidth
- sx={{ mb: 2 }}
- />
- ) : (
-
- Select...
-
-
- )}
-
-
- ))}
+ handleArrowClick('right')}>
+
+
+
+ {filterData[activeFilterIndex].attribute === 'Available Slots' ? (
+ onChange(activeFilterIndex, event.target.value)}
+ InputLabelProps={{
+ shrink: true,
+ }}
+ fullWidth
+ sx={{ mb: 2 }}
+ />
+ ) : (
+
+ onChange(activeFilterIndex, event.target.value)}
+ >
+ {filterData[activeFilterIndex].values.map((value) => (
+ } label={value} />
+ ))}
+
+
+ )}
+
+
) : (
-
+
No Filter Data on this page
)}
diff --git a/client/src/pages/Appointment/Appointment.js b/client/src/pages/Appointment/Appointment.js
index 8dffe7cb..5574ec73 100644
--- a/client/src/pages/Appointment/Appointment.js
+++ b/client/src/pages/Appointment/Appointment.js
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from 'react';
import { clinicAxios } from 'pages/utilities/AxiosConfig';
import MainCard from 'ui-component/cards/MainCard';
import AppointmentList from './AppointmentList.js';
-import AppointmentOptions from './AppointmentOptions/AppointmentOptions.js';
+import AppointmentOptions from './appointment-options/AppointmentOptions.js';
import { useUserContext } from 'hooks/useUserContext.js';
import { useFilter } from 'contexts/FilterContext.js';
import {
diff --git a/client/src/pages/Appointment/AppointmentOptions/AppointmentDetails.js b/client/src/pages/Appointment/appointment-options/AppointmentDetails.js
similarity index 91%
rename from client/src/pages/Appointment/AppointmentOptions/AppointmentDetails.js
rename to client/src/pages/Appointment/appointment-options/AppointmentDetails.js
index e8a53b75..460e0411 100644
--- a/client/src/pages/Appointment/AppointmentOptions/AppointmentDetails.js
+++ b/client/src/pages/Appointment/appointment-options/AppointmentDetails.js
@@ -8,7 +8,6 @@ import CalendarTodayIcon from '@mui/icons-material/CalendarToday';
import HelpCenterIcon from '@mui/icons-material/HelpCenter';
import StyleIcon from '@mui/icons-material/Style';
import AttachMoneyIcon from '@mui/icons-material/AttachMoney';
-import { useTheme } from '@mui/material/styles';
import Swal from 'sweetalert2';
import '../../../assets/css/swalStyle.css';
import { clinicAxios, communicationAxios } from 'pages/utilities/AxiosConfig';
@@ -18,7 +17,7 @@ import { chatExist } from 'utils/ChatUtils.js';
import { useUserContext } from 'hooks/useUserContext.js';
import { getDay, getTime } from '../../../utils/DateFormatter.js';
import { patientCanRefund } from '../../../utils/AppointmentUtils.js';
-import AppointmentStatus from '../AppointmentStatus';
+import AppointmentStatus from '../AppointmentStatus.js';
import { useNavigate } from 'react-router-dom';
import { usePayment } from 'contexts/PaymentContext';
import { showSuccessAlert } from 'utils/swal';
@@ -29,8 +28,6 @@ const AppointmentDetails = ({
setSelectedAppointment,
handleAppoinmentUpdate
}) => {
- const theme = useTheme();
- console.log('theme = ', theme);
const { chats, setChats } = useChat();
const { user } = useUserContext();
const navigate = useNavigate();
@@ -82,7 +79,6 @@ const AppointmentDetails = ({
};
const handleComplete = async () => {
// TODO: implement this function after merge with communication-service
- console.log('appointment completed');
clinicAxios
.patch(`/appointments/complete/${selectedAppointment._id}`)
.then((response) => {
@@ -261,25 +257,29 @@ const AppointmentDetails = ({
}
-
-
+ ':hover': {
+ backgroundColor: '#BE001C',
+ boxShadow: '0 2px 14px 0 rgb(32 40 45 / 8%)',
+ },
+ }}
+ onClick={handleCancelConfirmation}
+ disabled={cannotCompleteOrCancel}
+ >
+ Cancel
+
+
+ }
{
user.type == 'doctor'
diff --git a/client/src/pages/Appointment/AppointmentOptions/AppointmentOptions.js b/client/src/pages/Appointment/appointment-options/AppointmentOptions.js
similarity index 100%
rename from client/src/pages/Appointment/AppointmentOptions/AppointmentOptions.js
rename to client/src/pages/Appointment/appointment-options/AppointmentOptions.js
diff --git a/client/src/pages/Appointment/AppointmentOptions/AppointmentReschedule.js b/client/src/pages/Appointment/appointment-options/AppointmentReschedule.js
similarity index 96%
rename from client/src/pages/Appointment/AppointmentOptions/AppointmentReschedule.js
rename to client/src/pages/Appointment/appointment-options/AppointmentReschedule.js
index 2e174743..31b99808 100644
--- a/client/src/pages/Appointment/AppointmentOptions/AppointmentReschedule.js
+++ b/client/src/pages/Appointment/appointment-options/AppointmentReschedule.js
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import { clinicAxios } from 'pages/utilities/AxiosConfig';
import { Typography } from '@mui/material';
-import AvailableSlotsList from './AvailableSlotsList.js';
+import AvailableSlotsList from '../../../ui-component/AvailableSlotsList.js';
import Swal from 'sweetalert2';
import '../../../assets/css/swalStyle.css';
import { communicationAxios } from 'utils/AxiosConfig.js';
@@ -17,7 +17,6 @@ const AppointmentReschedule = ({
}) => {
const { user } = useUserContext();
- console.log('selectedAppointment', selectedAppointment);
const [doctorAvailableSlots, setDoctorAvailableSlots] = useState(null);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
@@ -68,7 +67,6 @@ const AppointmentReschedule = ({
.catch((error) => {
console.log(error);
});
- console.log('availableSlotsIdx', availableSlotsIdx);
};
const handleConfirmation = (event) => {
const availableSlotsIdx = parseInt(event.target.id);
diff --git a/client/src/pages/Appointment/AppointmentOptions/FollowUp.js b/client/src/pages/Appointment/appointment-options/FollowUp.js
similarity index 96%
rename from client/src/pages/Appointment/AppointmentOptions/FollowUp.js
rename to client/src/pages/Appointment/appointment-options/FollowUp.js
index 875bf2f4..fef7e99d 100644
--- a/client/src/pages/Appointment/AppointmentOptions/FollowUp.js
+++ b/client/src/pages/Appointment/appointment-options/FollowUp.js
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import { clinicAxios } from 'pages/utilities/AxiosConfig';
import { Typography } from '@mui/material';
-import AvailableSlotsList from './AvailableSlotsList.js';
+import AvailableSlotsList from '../../../ui-component/AvailableSlotsList.js';
import Swal from 'sweetalert2';
import '../../../assets/css/swalStyle.css';
import { useNavigate } from 'react-router-dom';
@@ -25,7 +25,6 @@ const FollowUp = ({ selectedAppointment }) => {
}
, []);
const handleFollowUpRequest = async (availableSlotsIdx) => {
- console.log('availableSlotsIdx', availableSlotsIdx);
const appointmentData = {
patientId: selectedAppointment.patientId,
doctorId: selectedAppointment.doctorId,
diff --git a/client/src/pages/admin/admin-control/AdminDetails.js b/client/src/pages/admin/admin-control/AdminDetails.js
index fe4f210c..d30d88c6 100644
--- a/client/src/pages/admin/admin-control/AdminDetails.js
+++ b/client/src/pages/admin/admin-control/AdminDetails.js
@@ -14,6 +14,7 @@ import {
import { styled } from '@mui/system';
import { useAdminContext } from 'hooks/useAdminContext';
import { commonStyles } from 'ui-component/CommonStyles';
+
const useStyles = styled(() => commonStyles);
const AdminDetails = () => {
diff --git a/client/src/pages/admin/admin-doctors/Doctors.js b/client/src/pages/admin/admin-doctors/Doctors.js
index e0f18ba9..832c1b95 100644
--- a/client/src/pages/admin/admin-doctors/Doctors.js
+++ b/client/src/pages/admin/admin-doctors/Doctors.js
@@ -26,7 +26,6 @@ const Doctors = () => {
useEffect(() => {
getDoctors().then((response) => {
- console.log('response = ', response);
setDoctors(response);
setIsLoading(false);
})
diff --git a/client/src/pages/authentication/AuthCardWrapper.js b/client/src/pages/authentication/AuthCardWrapper.js
index aeb337a8..3becebca 100644
--- a/client/src/pages/authentication/AuthCardWrapper.js
+++ b/client/src/pages/authentication/AuthCardWrapper.js
@@ -11,7 +11,6 @@ const AuthCardWrapper = ({ children, ...other }) => (
*': {
flexGrow: 1,
flexBasis: '50%'
diff --git a/client/src/pages/authentication/authentication3/ForgetPassword.js b/client/src/pages/authentication/authentication3/ForgetPassword.js
index 0b915c14..23926254 100644
--- a/client/src/pages/authentication/authentication3/ForgetPassword.js
+++ b/client/src/pages/authentication/authentication3/ForgetPassword.js
@@ -35,10 +35,10 @@ const ForgetPassword = () => {
- forget Password
+ forget Password
- Enter your Email
+ Enter your Email
@@ -53,7 +53,7 @@ const ForgetPassword = () => {
- Back to Login
+ Back to Login
diff --git a/client/src/pages/authentication/authentication3/Login3.js b/client/src/pages/authentication/authentication3/Login3.js
index f6768a18..30bebc1f 100644
--- a/client/src/pages/authentication/authentication3/Login3.js
+++ b/client/src/pages/authentication/authentication3/Login3.js
@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';
import { useTheme } from '@mui/material/styles';
import { Divider, Grid, Stack, Typography, useMediaQuery } from '@mui/material';
-
+import boardingImage from 'assets/images/boarding.jpg';
import AuthWrapper1 from '../AuthWrapper1';
import AuthCardWrapper from '../AuthCardWrapper';
import AuthLogin from '../auth-forms/AuthLogin';
@@ -19,12 +19,15 @@ const Login = () => {
return (
-
+
-
-
+
+
+
+
+
-
+
@@ -35,10 +38,10 @@ const Login = () => {
- Hi, Welcome Back
+ Hi, Welcome Back
- Enter your credentials to continue
+ Enter your credentials to continue
@@ -53,7 +56,7 @@ const Login = () => {
- Don't have an account?
+ Don't have an account?
diff --git a/client/src/pages/authentication/authentication3/Register3.js b/client/src/pages/authentication/authentication3/Register3.js
index 02a95647..81b20e00 100644
--- a/client/src/pages/authentication/authentication3/Register3.js
+++ b/client/src/pages/authentication/authentication3/Register3.js
@@ -40,16 +40,16 @@ const Register = () => {
- Sign up as
+ Sign up as
- setSeletcedButton('patient')}>
+ setSeletcedButton('patient')}>
Patient
- setSeletcedButton('doctor')}>
+ setSeletcedButton('doctor')}>
Doctor
@@ -60,7 +60,7 @@ const Register = () => {
{selectedButton && selectedButton == 'patient' && }
- {selectedButton && (selectedButton == 'doctor') && }
+ {selectedButton && (selectedButton == 'doctor') && }
@@ -68,7 +68,7 @@ const Register = () => {
- Already have an account?
+ Already have an account?
diff --git a/client/src/pages/chat/Chat.js b/client/src/pages/chat/Chat.js
index ce3de812..6c2245bd 100644
--- a/client/src/pages/chat/Chat.js
+++ b/client/src/pages/chat/Chat.js
@@ -38,7 +38,7 @@ const Chat = ({ children }) => {
height: '100%',
display: 'flex',
flexDirection: 'row',
- justifyContent: isChatOpen && isChatOpen && window.innerWidth > 1000? 'start' : 'center',
+ justifyContent: isChatOpen && isChatOpen && window.innerWidth > 1000 ? 'start' : 'center',
};
const updatePosition = () => {
diff --git a/client/src/pages/chat/ChatBox.js b/client/src/pages/chat/ChatBox.js
index 098eaa8a..fa3a6198 100644
--- a/client/src/pages/chat/ChatBox.js
+++ b/client/src/pages/chat/ChatBox.js
@@ -75,7 +75,6 @@ const ChatBox = ({ setChatOpen }) => {
}
action={
{
- // console.log(chats, selectedChat);
setSelectedChat(null);
setChatOpen(false);
}}>
diff --git a/client/src/pages/chat/ChatListCard.js b/client/src/pages/chat/ChatListCard.js
index 9bee76eb..fc164ac4 100644
--- a/client/src/pages/chat/ChatListCard.js
+++ b/client/src/pages/chat/ChatListCard.js
@@ -14,7 +14,6 @@ const ChatListCard = ({ chat }) => {
} else {
setUnseen(chat.users[1].unseen);
}
- console.log(chat);
}, [chat]);
useEffect(() => {
diff --git a/client/src/pages/doctor/doctor-patients/DoctorListofPatients.js b/client/src/pages/doctor/doctor-patients/DoctorListofPatients.js
index 5e742cf4..afcd8bab 100644
--- a/client/src/pages/doctor/doctor-patients/DoctorListofPatients.js
+++ b/client/src/pages/doctor/doctor-patients/DoctorListofPatients.js
@@ -8,6 +8,7 @@ import { useSearch } from 'contexts/SearchContext';
import { useFilter } from 'contexts/FilterContext';
import { useLocation } from 'react-router-dom';
import { useDoctorContext } from 'hooks/useDoctorContext';
+import { usePatientContext } from 'hooks/usePatientContext';
import { isUpcomingAppointment } from 'utils/DoctorUtils';
import { getAppointments, getDoctorPatients, getDoctor } from 'api/DoctorAPI';
import Loader from 'ui-component/Loader';
@@ -19,8 +20,9 @@ const Patients = () => {
redirectedPatient = location.state.selectedPatient;
}
- const { patients, setPatients, originalPatients, setOriginalPatients, isLoading, setIsLoading,
- appointments, setAppointments, setLoggedInDoctor, setSelectedPatient } = useDoctorContext();
+ const { appointments, setAppointments, setLoggedInDoctor } = useDoctorContext();
+
+ const { patients, setPatients, isLoading, setIsLoading, originalPatients, setOriginalPatients, setSelectedPatient } = usePatientContext();
const { searchQuery } = useSearch();
const { filterData, updateFilter } = useFilter();
@@ -76,7 +78,6 @@ const Patients = () => {
});
}, []);
-
return (
{isLoading ? (
@@ -97,5 +98,4 @@ const Patients = () => {
);
};
-
export default Patients;
diff --git a/client/src/pages/doctor/doctor-patients/DoctorPatientCard.js b/client/src/pages/doctor/doctor-patients/DoctorPatientCard.js
index 48e05963..035bd6a2 100644
--- a/client/src/pages/doctor/doctor-patients/DoctorPatientCard.js
+++ b/client/src/pages/doctor/doctor-patients/DoctorPatientCard.js
@@ -4,13 +4,17 @@ import {
ListItemAvatar,
} from '@mui/material';
import DoctorIcon from '../../../assets/images/icons/DoctorIcon.png';
-import { useDoctorContext } from 'hooks/useDoctorContext';
+import { usePatientContext } from 'hooks/usePatientContext';
import { getTitle } from 'utils/CommonUtils';
+import { commonStyles } from 'ui-component/CommonStyles';
+import { styled } from '@mui/system';
-const DoctorPatientCard = ({ patient }) => {
- const { setSelectedPatient } = useDoctorContext();
+const useStyles = styled(() => commonStyles);
+const DoctorPatientCard = ({ patient }) => {
+ const { setSelectedPatient } = usePatientContext();
const title = getTitle(patient);
+ const classes = useStyles();
return (
setSelectedPatient(patient)}>
@@ -25,11 +29,7 @@ const DoctorPatientCard = ({ patient }) => {
);
diff --git a/client/src/pages/doctor/doctor-patients/DoctorPatientDetails.js b/client/src/pages/doctor/doctor-patients/DoctorPatientDetails.js
index 7235d641..c153e459 100644
--- a/client/src/pages/doctor/doctor-patients/DoctorPatientDetails.js
+++ b/client/src/pages/doctor/doctor-patients/DoctorPatientDetails.js
@@ -8,27 +8,11 @@ import PhoneIcon from '@mui/icons-material/Phone';
import ContactEmergencyIcon from '@mui/icons-material/ContactEmergency';
import { getDay } from '../../../utils/DateFormatter';
import { useNavigate } from 'react-router-dom';
-import { useDoctorContext } from 'hooks/useDoctorContext';
+import { usePatientContext } from 'hooks/usePatientContext';
import { getTitle } from 'utils/CommonUtils';
-const PatientDetailsContainer = styled('div')({
- display: 'flex',
- justifyContent: 'space-around',
- alignItems: 'center',
- flexDirection: 'row',
- marginBottom: '5em',
-});
+import { commonStyles } from 'ui-component/CommonStyles';
-const PatientInfoContainer = styled('div')({
- display: 'flex',
- flexDirection: 'column',
- gap: '0.7em',
-});
-
-const IconContainer = styled('div')({
- display: 'flex',
- alignItems: 'center',
- flexDirection: 'row',
-});
+const useStyles = styled(() => commonStyles);
const StyledButton = styled(Button)({
marginTop: '2%',
@@ -36,43 +20,43 @@ const StyledButton = styled(Button)({
const DoctorPatientDetails = () => {
const navigate = useNavigate();
- const { selectedPatient } = useDoctorContext();
+ const { selectedPatient } = usePatientContext();
const title = getTitle(selectedPatient);
-
+ const classes = useStyles();
return (
<>
{selectedPatient && (
<>
-
-
-
-
- {`${title} ${selectedPatient.name}`}
-
-
-
-
+
+
+
+
+ {`${title} ${selectedPatient.name}`}
+
+
+
+
{`${selectedPatient.email}`}
-
-
+
+
{`Born on ${getDay(selectedPatient.dateOfBirth)}`}
-
-
+