Skip to content
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
4 changes: 2 additions & 2 deletions backend/src/routes/doctorOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ router.post('/api/addRx', async (req, res) => {
*/
router.patch('/api/updateRx/:id', async (req, res) => {
try {
const dontUpdateStatusBool = req.query.dontUpdateStatus;
const doNotUpdateStatusBool = req.query.doNotUpdateStatus;
// Finding by id
const order = await doctorOrder.findById(req.params.id).exec();
console.log('Found doctor order by id! --- ', order);
Expand Down Expand Up @@ -140,7 +140,7 @@ router.patch('/api/updateRx/:id', async (req, res) => {
{ _id: req.params.id },
{
dispenseStatus:
dontUpdateStatusBool || order.dispenseStatus === 'Picked Up'
doNotUpdateStatusBool || order.dispenseStatus === 'Picked Up'
? order.dispenseStatus
: status,
metRequirements: params
Expand Down
7 changes: 0 additions & 7 deletions backend/test/simple.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
You can add web fonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
Expand Down
26 changes: 12 additions & 14 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.App {
text-align: center;
background-color:#0A192A;
background-color: #0a192a;
padding: 20px;
margin-bottom:20px;
margin-bottom: 20px;
}

.App-logo {
Expand Down Expand Up @@ -43,33 +43,31 @@
.NavButtons {
list-style: none;
text-decoration: none;
margin-left:5px;
margin-left: 5px;
}

.App h1 {
color:white;
color: white;
line-height: 1.3;
letter-spacing: 0.00938em;
font-family: "Roboto","Helvetica","Arial",sans-serif;
font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

.logo {
grid-area:main;
text-align: left;
margin-right: auto;
display: inline-flex;
box-sizing: unset;
grid-area: main;
text-align: left;
margin-right: auto;
display: inline-flex;
box-sizing: unset;
}

.links {
grid-area:right;
grid-area: right;
margin-left: auto;
margin-top: 25px;
}

.containerg{
.containerg {
display: grid;
grid-template-areas: ' main right';
}


1 change: 0 additions & 1 deletion frontend/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

Expand Down
Empty file.
1 change: 0 additions & 1 deletion frontend/src/views/DoctorOrders/DoctorOrders.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import DoctorOrders from './DoctorOrders';

Expand Down
7 changes: 3 additions & 4 deletions frontend/src/views/DoctorOrders/DoctorOrders.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Box, Tab, Tabs } from '@mui/material';
import { Container } from '@mui/system';
import React from 'react';
import './DoctorOrders.css';
import NewOrders from './NewOrders/NewOrders';
import PickedUpOrders from './PickedUpOrders/PickedUpOrders';
import VerifiedOrders from './VerifiedOrders/VerifiedOrders';
Expand Down Expand Up @@ -44,17 +43,17 @@ export default function DoctorOrders() {
<Box sx={{ padding: 2 }}>
{tabIndex === 0 && (
<Box>
<NewOrders></NewOrders>
<NewOrders />
</Box>
)}
{tabIndex === 1 && (
<Box>
<VerifiedOrders></VerifiedOrders>
<VerifiedOrders />
</Box>
)}
{tabIndex === 2 && (
<Box>
<PickedUpOrders></PickedUpOrders>
<PickedUpOrders />
</Box>
)}
</Box>
Expand Down
Empty file.
3 changes: 1 addition & 2 deletions frontend/src/views/DoctorOrders/NewOrders/NewOrders.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import NewOrders from './NewOrders';
import axios from 'axios';
Expand All @@ -10,7 +9,7 @@ describe('<NewOrders />', () => {
render(<NewOrders />);

await waitFor(() => {
const linkElement = screen.getByText(/NewOrders/i);
const linkElement = screen.getByText(/new orders/i);
expect(linkElement).toBeInTheDocument();
});
});
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/views/DoctorOrders/NewOrders/NewOrders.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import OrderCard from '../OrderCard/OrderCard';
import './NewOrders.css';

const NewOrders = () => {
return (
<div className="NewOrders">
<h1>NewOrders</h1>
<div>
<h1>New Orders</h1>
<OrderCard tabStatus={'Pending'} />
</div>
);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type MetRequirements = {
};
};

interface DoctorOrder {
export type DoctorOrder = {
caseNumber?: string;
patientName?: string;
patientDOB?: string;
Expand All @@ -34,13 +34,13 @@ interface DoctorOrder {
doctorEmail?: string;
drugNames?: string;
drugPrice?: number;
drugRxnormCode: number;
quanitities?: string;
drugRxNormCode: number;
quantities?: string;
total?: number;
pickupDate?: string;
dispenseStatus?: string;
metRequirements: MetRequirements[];
}
};

const Transition = React.forwardRef(function Transition(
props: TransitionProps & {
Expand All @@ -59,12 +59,12 @@ const EtasuPopUp = (props: any) => {
const handleClickOpen = () => {
setOpen(true);
// call api endpoint to update
const url = '/doctorOrders/api/updateRx/' + props.data._id + '?dontUpdateStatus=true';
const url = '/doctorOrders/api/updateRx/' + props.data._id + '?doNotUpdateStatus=true';
axios
.patch(url)
.then(function (response) {
const DoctorOrders = response.data;
//Adding data to state
// Adding data to state
getDoctorOrders(DoctorOrders);
})
.catch(error => console.error('Error', error));
Expand Down
Empty file.
9 changes: 0 additions & 9 deletions frontend/src/views/DoctorOrders/OrderCard/OrderCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import OrderCard from './OrderCard';
import axios from 'axios';
Expand Down Expand Up @@ -52,14 +51,6 @@ describe('<OrderCard />', () => {
expect(screen.getByText(/1996/i)).toBeInTheDocument();
expect(screen.getByText(/Turalio/i)).toBeInTheDocument();
expect(screen.getByText(/Pending/i)).toBeInTheDocument();
// expect(screen.getByTestId('quantities')).toBeInTheDocument();
// expect(screen.getByTestId('drugPrice')).toBeInTheDocument();
// expect(screen.getByTestId('total')).toBeInTheDocument();
// expect(screen.getByTestId('doctorName')).toBeInTheDocument();
// expect(screen.getByTestId('doctorID')).toBeInTheDocument();
// expect(screen.getByTestId('doctorContact')).toBeInTheDocument();
// expect(screen.getByTestId('doctorEmail')).toBeInTheDocument();
// expect(screen.getByTestId('pickupDate')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /remove all/i })).toBeInTheDocument();
});
});
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/views/DoctorOrders/OrderCard/OrderCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ import {
import axios from 'axios';
import { useEffect, useState } from 'react';
import EtasuPopUp from './EtasuPopUp/EtasuPopUp';
import './OrderCard.css';
import PickedUpButton from './PickedUpButton';
import VerifyButton from './VerifyButton';

interface DoctorOrder {
export type DoctorOrder = {
caseNumber?: string;
patientName?: string;
patientDOB?: string;
Expand All @@ -46,9 +45,10 @@ interface DoctorOrder {
};
};
}[];
}
_id: string;
};

const OrderCard = (props: any) => {
const OrderCard = (props: { tabStatus: 'Pending' | 'Picked Up' | 'Approved' }) => {
const [doctorOrder, setDoctorOrders] = useState<DoctorOrder[]>([]);
const [isLoading, setIsLoading] = useState(true);

Expand Down Expand Up @@ -112,7 +112,7 @@ const OrderCard = (props: any) => {
<TableHead sx={{ fontWeight: 'bold' }}>
<TableRow sx={{ fontWeight: 'bold' }}>
<TableCell align="left">Dispense Status</TableCell>
<TableCell align="right">Quanitities</TableCell>
<TableCell align="right">Quantities</TableCell>
<TableCell align="right">Drug Price</TableCell>
<TableCell align="right">Total</TableCell>
<TableCell align="right">Doctor Name</TableCell>
Expand Down Expand Up @@ -142,10 +142,10 @@ const OrderCard = (props: any) => {
<Box sx={{ marginLeft: 'auto', mr: '8px' }}>
<EtasuPopUp data={row} />
{props.tabStatus === 'Pending' && (
<VerifyButton data={{ row, getAllDoctorOrders }} />
<VerifyButton row={row} getAllDoctorOrders={getAllDoctorOrders} />
)}
{props.tabStatus === 'Approved' && (
<PickedUpButton data={{ row, getAllDoctorOrders }} />
<PickedUpButton row={row} getAllDoctorOrders={getAllDoctorOrders} />
)}
</Box>
</CardActions>
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/views/DoctorOrders/OrderCard/PickedUpButton.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import Button from '@mui/material/Button';
import axios from 'axios';
import { DoctorOrder } from './OrderCard';

const PickedUpButton = (props: any) => {
//verify the order
const verifyOrder = () => {
const url = '/doctorOrders/api/updateRx/' + props.data.row._id + '/pickedUp';
type PickedUpButtonProps = { row: DoctorOrder; getAllDoctorOrders: () => Promise<void> };

const PickedUpButton = (props: PickedUpButtonProps) => {
const markOrderAsPickedUp = () => {
const url = '/doctorOrders/api/updateRx/' + props.row._id + '/pickedUp';
axios
.patch(url)
.then(function (response) {
props.data.getAllDoctorOrders();
props.getAllDoctorOrders();
console.log(response.data);
})
.catch(error => console.error('Error', error));
};

return (
<Button variant="contained" size="small" onClick={verifyOrder}>
<Button variant="contained" size="small" onClick={markOrderAsPickedUp}>
Mark as Picked Up
</Button>
);
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/views/DoctorOrders/OrderCard/VerifyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import Button from '@mui/material/Button';
import axios from 'axios';
import { DoctorOrder } from './OrderCard';

const VerifyButton = (props: any) => {
//verify the order
type VerifyButtonProps = { row: DoctorOrder; getAllDoctorOrders: () => Promise<void> };

const VerifyButton = (props: VerifyButtonProps) => {
// verify the order
const verifyOrder = () => {
const url = '/doctorOrders/api/updateRx/' + props.data.row._id;
const url = '/doctorOrders/api/updateRx/' + props.row._id;
axios
.patch(url)
.then(function (response) {
props.data.getAllDoctorOrders();
props.getAllDoctorOrders();
console.log(response.data);
})
.catch(error => console.error('Error', error));
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import PickedUpOrders from './PickedUpOrders';
import axios from 'axios';
Expand All @@ -10,7 +9,7 @@ describe('<PickedUpOrders />', () => {
render(<PickedUpOrders />);

await waitFor(() => {
const linkElement = screen.getByText(/PickedUpOrders/i);
const linkElement = screen.getByText(/picked up orders/i);
expect(linkElement).toBeInTheDocument();
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import OrderCard from '../OrderCard/OrderCard';
import './PickedUpOrders.css';

const PickedUpOrders = () => {
return (
<div className="PickedUpOrders">
<h1>PickedUpOrders</h1>
<div>
<h1>Picked Up Orders</h1>
<OrderCard tabStatus={'Picked Up'} />
</div>
);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import VerifiedOrders from './VerifiedOrders';
import axios from 'axios';
Expand All @@ -10,7 +9,7 @@ describe('<VerifiedOrders />', () => {
render(<VerifiedOrders />);

await waitFor(() => {
const linkElement = screen.getByText(/VerifiedOrders/i);
const linkElement = screen.getByText(/verified orders/i);
expect(linkElement).toBeInTheDocument();
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import OrderCard from '../OrderCard/OrderCard';
import './VerifiedOrders.css';

const VerifiedOrders = () => {
return (
<div className="VerifiedOrders">
<h1>VerifiedOrders</h1>
<div>
<h1>Verified Orders</h1>
<OrderCard tabStatus={'Approved'} />
</div>
);
Expand Down
Empty file removed frontend/src/views/Login/Login.css
Empty file.
1 change: 0 additions & 1 deletion frontend/src/views/Login/Login.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import Login from './Login';

Expand Down