Skip to content

Commit

Permalink
Merge pull request #37 from purplepotion/dev
Browse files Browse the repository at this point in the history
🚀 Final Deployment
  • Loading branch information
ankitkumarsamota121 authored May 29, 2021
2 parents 3c6147a + a5d7519 commit a1d71a4
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 55 deletions.
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

0 comments on commit a1d71a4

Please sign in to comment.