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 Deployment #37

Merged
merged 4 commits into from
May 29, 2021
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/screens/ConsultationDetailsScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const ConsultationDetailsScreen = ({ history, match }) => {
<td>
<strong>Patient Name</strong>
</td>
<td>{consultation.patient.$oid}</td>
<td>{consultation.patientName}</td>
</tr>
<tr key='patient-id'>
<td>
Expand Down
2 changes: 1 addition & 1 deletion client/src/screens/DoctorScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const ProfileScreen = ({ history }) => {
<Row className='align-items-center'>
<Col md={10}>
<p className='m-0'>
<strong>{`${consul.patient.$oid}`}</strong> has requested your
<strong>{`${consul.patientName}`}</strong> has requested your
consultation.{' '}
<Link
to={`/consultations/details/${consul._id.$oid}`}
Expand Down
139 changes: 86 additions & 53 deletions client/src/screens/ProfileScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,43 +189,78 @@ const ProfileScreen = ({ history }) => {
<Tab eventKey='notifications' title='Notifications'>
<div className='mt-4'>
{notifications.map((notif) => (
<Alert variant='info' className='p-2' key={notif.id}>
<Row className='align-items-center'>
<Col md={10}>
<p className='m-0'>
<strong>{`Dr. ${notif.healthOfficial.name}`}</strong> has requested access
to your record{' '}
<Link to={`/records/details/${notif.record.id}`} className='p-0 m-0'>
{`${notif.record.name}`}
</Link>
.
</p>
</Col>
<Col md={2} className='p-0 d-flex flex-column'>
{loadingConsent ? (
<Spinner animation='border' />
) : (
<>
<Button
variant='success'
className='btn-sm'
style={{ margin: '0 0 0.5rem 0' }}
onClick={() => consentRequestHandler(notif.id, true)}
>
Approve
</Button>
<Button
variant='danger'
className='btn-sm'
onClick={() => consentRequestHandler(notif.id, false)}
>
Decline
</Button>
</>
)}
</Col>
</Row>
</Alert>
<>
{notif.rtype === 'consent' && (
<Alert variant='info' className='p-2' key={notif.id}>
<Row className='align-items-center'>
<Col md={10}>
<p className='m-0'>
<strong>{`Dr. ${notif.healthOfficial.name}`}</strong> has requested
access to your record{' '}
<Link to={`/records/details/${notif.record.id}`} className='p-0 m-0'>
{`${notif.record.name}`}
</Link>
.
</p>
</Col>
<Col md={2} className='p-0 d-flex flex-column'>
{loadingConsent ? (
<Spinner animation='border' />
) : (
<>
<Button
variant='success'
className='btn-sm'
style={{ margin: '0 0 0.5rem 0' }}
onClick={() => consentRequestHandler(notif.id, true)}
>
Approve
</Button>
<Button
variant='danger'
className='btn-sm'
onClick={() => consentRequestHandler(notif.id, false)}
>
Decline
</Button>
</>
)}
</Col>
</Row>
</Alert>
)}

{notif.rtype === 'consult' && (
<Alert
variant={notif.approved ? 'success' : 'warning'}
className='p-2'
key={notif.id}
>
<Row className='align-items-center'>
<Col md={10}>
<p className='m-0'>
<strong>{`Dr. ${notif.healthOfficial.name}`}</strong> has{' '}
<strong>{notif.approved ? 'approved' : 'declined'}</strong> your
consultation request.
</p>
</Col>
<Col md={2} className='p-0 d-flex flex-column'>
{loadingConsent ? (
<Spinner animation='border' />
) : (
<Button
variant='danger'
className='btn-sm'
onClick={() => consentRequestHandler(notif.id, false)}
>
Delete
</Button>
)}
</Col>
</Row>
</Alert>
)}
</>
))}
</div>
</Tab>
Expand Down Expand Up @@ -260,22 +295,20 @@ const ProfileScreen = ({ history }) => {
</tr>
</thead>
<tbody>
{doctors.map((doctor) => {
return (
<tr key={doctor._id.$oid}>
<td>{doctor._id.$oid}</td>
<td>{doctor.name}</td>
<td>{doctor.email}</td>
<td>
<LinkContainer to={`/consultations/add/${doctor._id.$oid}`}>
<Button variant='light' className='btn-sm'>
Request
</Button>
</LinkContainer>
</td>
</tr>
);
})}
{doctors.map((doctor) => (
<tr key={doctor._id.$oid}>
<td>{doctor._id.$oid}</td>
<td>{doctor.name}</td>
<td>{doctor.email}</td>
<td>
<LinkContainer to={`/consultations/add/${doctor._id.$oid}`}>
<Button variant='light' className='btn-sm'>
Request
</Button>
</LinkContainer>
</td>
</tr>
))}
</tbody>
</Table>
)}
Expand Down
2 changes: 2 additions & 0 deletions server/healthOfficial/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ def deleteRequest(_id):
healthOfficial.consultationRequests = crequests
pnotif = PatientNotifications(healthOfficial=ObjectId(_id), rtype="consult")

# create new patient notification
# type = consultation
if approved == "True":
healthOfficial.patients.append(ObjectId(p_id))
pnotif.approved = True
Expand Down