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

Final Integration #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
288 changes: 132 additions & 156 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
}
}

.footer{
height: 12rem;
}
.welcome {
display: flex;
align-items: center;
Expand Down Expand Up @@ -111,14 +114,14 @@
}

.profile-box{
width: 69%;
width: 72%;
display: flex;
background-color: #ffffff;
justify-content: center;
height: 38rem;
height: 39rem;
flex-direction: column;
border-radius: 35px;
margin-left: 25px;
margin-left: 180px;
}

.side-box{
Expand Down Expand Up @@ -378,4 +381,15 @@ label {

.mx-t3{
margin-top: -3rem;
}

.login-box{
height: 28rem;
box-shadow: 0px 0px 5px 1px #999;
margin-left: 200px;
width: 70%;
display: flex;
padding-top: 45px;
flex-direction: column;
align-items: center;
}
26 changes: 10 additions & 16 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,15 @@ import Profile from './components/Profile.js';
import OtpInput from './components/Forms/Otp'
import FindDoctor from './components/FindDoctor';
import FindPatient from './components/FindPatient';
import MedicalProfile from './components/MedicalProfile'
import OrgRegister from './components/BasicDetails'
import HealthProffRegister from './components/HealthProffRegister'
import Hospitals from './components/HospitalsData'
import Decision from './components/Decision';
import Login from './components/Forms/LoginForm';
import AddMedicalRecordForm from './components/Forms/AddMedicalRecordForm';

function App() {

const user = localStorage.getItem('user');

const [auth, setAuth] = React.useState(true);

React.useEffect(() => {
if (user === null) {
setAuth = false;
}
})

return (
<div className="App">
<BrowserRouter>
Expand All @@ -43,19 +34,19 @@ function App() {
<Route path="/user_register" element={<UserRegistrationForm />} />
</Routes>
<Routes>
<Route path="/welcome" element={<Welcome name={user} />} />
<Route path="/addRecord" element={<AddMedicalRecordForm />} />
</Routes>
<Routes>
<Route path="/hospitals" element={<Hospitals name={user} />} />
<Route path="/welcome" element={<Welcome/>} />
</Routes>
<Routes>
<Route path="/medical" element={<MedicalRecordsForm />} />
<Route path="/hospitals" element={<Hospitals/>} />
</Routes>
<Routes>
<Route path="/profile" element={<UserProfile />} />
<Route path="/medical" element={<MedicalRecordsForm />} />
</Routes>
<Routes>
<Route path="/medicalProfile" element={<MedicalProfile />} />
<Route path="/profile/:id" element={<UserProfile />} />
</Routes>
<Routes>
<Route path="/findDoctor" element={<FindDoctor />} />
Expand All @@ -81,6 +72,9 @@ function App() {
<Routes>
<Route path="/records" element={<DoctorRecords />} />
</Routes>
<Routes>
<Route path="/login" element={<Login />} />
</Routes>
</BrowserRouter>
</div>
);
Expand Down
48 changes: 35 additions & 13 deletions src/components/BasicDetails.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { useState, useEffect } from 'react'
import { useNavigate } from 'react-router-dom';
import axios from "axios";

export default function BasicDetails() {

Expand All @@ -13,36 +14,48 @@ export default function BasicDetails() {
const [state, setState] = useState('Jharkhand')
const [password, setPassword] = useState('varru1029')
const [phone, setPhone] = useState('9931230984')
const [profession, setProfession] = useState('');


useEffect(() => {
if (localStorage.getItem('user') === null) {
setAuth = false;
setAuth(false);
}

}, [])

const navigate = useNavigate();

function handleSubmit(event) {
async function handleSubmit(event) {
event.preventDefault();

console.log(event)
let basicData = {
name: name,
patientName: name,
email: email,
address: address,
location: address,
dob: dob,
gender: gender,
state: state,
password: password,
phone: phone,

}

localStorage.setItem('basicDetails', JSON.stringify(basicData))
let details = JSON.parse(localStorage.getItem('basicDetails'))
navigate('/medical')
if (localStorage.getItem("profile") === "patient") {
localStorage.setItem('basicDetails', JSON.stringify(basicData))
navigate('/medical')
} else {
let { data } = await axios.post("http://localhost:3001/HPR", {
hpr_details: {
...basicData,
profession,
adhar_number: localStorage.getItem('aadhar')
}
});
localStorage.setItem('HPR_details', JSON.stringify(data));
localStorage.setItem('user', JSON.stringify(data));
navigate("/hospitals")
}
}

return (
Expand Down Expand Up @@ -88,9 +101,8 @@ export default function BasicDetails() {
<select id="gender" className="form-control browser-default custom-select" onChange={event => {
setGender(event.target.value)
}}>
<option value="female">Female</option>
<option value="male">Male</option>
<option value="unspesified">Unspecified</option>
<option value="Female">Female</option>
<option value="Male">Male</option>
</select>
</div>
<div className="col-sm-2 form-group">
Expand Down Expand Up @@ -312,18 +324,28 @@ export default function BasicDetails() {
<option data-countryCode="ZW" value="263">Zimbabwe (+263)</option>
</select>
</div>
<div className="col-sm-4 form-group">
<div className="col-sm-3 mr-10 form-group">
<label htmlFor="tel">Phone</label>
<input type="tel" name="phone" className="form-control" id="tel" placeholder="Enter your phone number." required onChange={event => {
setPhone(event.target.value)
}}/>
</div>
<div className="col-sm-6 form-group">
<div className="col-sm-6 ml-14 form-group">
<label htmlFor="password" >Password</label>
<input type="Password" name="password" className="form-control" id="pass" placeholder="Enter your password." required onChange={event => {
setPassword(event.target.value)
}}/>
</div>
{ localStorage.getItem("profile") === "patient" ? <></> :
<>
<div className="col-sm-6 form-group">
<label htmlFor="profession" >Profession</label>
<input type="text" name="profession" className="form-control" id="prof" placeholder="Enter your profession" required onChange={event => {
setProfession(event.target.value)
}}/>
</div>
</>
}
<div className="col-sm-12">
<a href='/medical'><button className="btn btn-primary float-center pr-6 pl-6" onClick={handleSubmit}>Next</button></a>
</div>
Expand Down
59 changes: 3 additions & 56 deletions src/components/Common/Footer.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,14 @@
import * as React from 'react';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemText from '@mui/material/ListItemText';
import Divider from '@mui/material/Divider';




export default function Footer() {

return (
<div>
<footer className="footer-main bg-dark ">
<div className="container">
<div className="row address-main">
<div className="col-lg-4 col-sm-12 col-xs-12">
<div className="address-box clearfix">

{/* <div className="add-content">
<h5>Address</h5>
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut veniam </p>
</div> */}
</div>
</div>
<div className="col-lg-4 col-sm-12 col-xs-12">
<div className="address-box clearfix">

{/* <div className="add-content">
<h5>Phone</h5>
<p> +(91) 262633000 <br />
+(91) 262633000 </p>
</div> */}
</div>
</div>
<div className="col-lg-4 col-sm-12 col-xs-12">
<div className="address-box clearfix">

{/* <div className="add-content">
<h5>Email</h5>
<p> <a href="mailto:" >[email protected]</a> </p>
</div> */}
</div>
</div>
</div>
<footer className="footer bg-dark text-center text-white ">
<div className="text-center pt-20">
Health-e © 2023 All Rights Reserved.
</div>



<footer className="bg-dark text-center text-white">


<Divider sx={{ backgroundColor: '#ffffff'}}/>



<div className="text-center p-3">
Health-e © 2023 All Rights Reserved.
</div>

</footer>
</footer>

</div>
)
}
47 changes: 38 additions & 9 deletions src/components/Common/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,41 @@ import AccountCircle from '@mui/icons-material/AccountCircle';
import MenuItem from '@mui/material/MenuItem';
import Menu from '@mui/material/Menu';
import { Link } from '@mui/material';
import Button from '@mui/material/Button';
import { useNavigate } from 'react-router-dom';

export default function MenuAppBar() {
const [auth, setAuth] = React.useState(true);
const [anchorEl, setAnchorEl] = React.useState(null);
const [userProfile, setUserProfile] = React.useState({});
const [profile, setProfile] = React.useState()
const navigate = useNavigate();


React.useEffect(() => {
if (localStorage.getItem('user') === null) {
setAuth = false;
setAuth(false);
}

if (localStorage.getItem('user') !== null) {
let user = JSON.parse(localStorage.getItem('user'));
let prof = localStorage.getItem('profile');
console.log(user);
console.log(prof);
setUserProfile(user);
setProfile(prof);
}
}, [])

const handleMenu = (event) => {
setAnchorEl(event.currentTarget);
};

const handleClose = () => {
const handleClose = (event) => {
setAnchorEl(null);
localStorage.clear();
event.preventDefault();
navigate("/");
};

return (
Expand All @@ -37,15 +53,29 @@ export default function MenuAppBar() {

<Typography variant="h6" component="div" sx={{ flexGrow: 1, textAlign: 'left' }}>

Health-e
<a href='/'>Health-e</a>
</Typography>

{/* <Typography variant="h6" component="div" sx={{ marginLeft: '852px', textAlign: 'right' }}>
About us
</Typography> */}
<Typography variant="h6" component="div" sx={{ flexGrow: 1, marginRight: '30px', textAlign: 'right' }}>
{
!auth &&
<Button href="/login" variant="h6" sx={{ text: "white", marginRight: '30px', textAlign: 'right' }}>
Login
</Typography>
</Button>
}

{
auth && profile === "Patient" &&
<Button variant="h6" href="/findDoctor" sx={{ marginLeft: '830px', textAlign: 'right' }}>
Find Doctor
</Button>
}

{
auth && profile !== "Patient" && userProfile.is_admin &&
<Button variant="h6" href="/decision" sx={{ marginLeft: '852px', textAlign: 'right' }}>
Requests
</Button>
}


{auth && (
Expand Down Expand Up @@ -76,7 +106,6 @@ export default function MenuAppBar() {
open={Boolean(anchorEl)}
onClose={handleClose}
>
<Link href="/profile" underline="none"><MenuItem onClick={handleClose}>My account</MenuItem></Link>
<MenuItem onClick={handleClose}>Logout</MenuItem>
</Menu>
</div>
Expand Down
Loading