Skip to content
Merged

Dev #106

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
cca8107
Fix typo
jtquach1 Jan 18, 2024
527cafb
Merge pull request #94 from mcode/fix-typo
avirgulto Jan 24, 2024
d2d970c
Feature/576 update workflow (#95)
avirgulto Jan 30, 2024
efd4e78
Update NewRx (#98)
plarocque4 Feb 1, 2024
77c8477
make settings a modal and add save button (#96)
KeeyanGhoreshi Feb 8, 2024
f924984
prevent suggestions crash (#99)
KeeyanGhoreshi Feb 9, 2024
5631214
Create the MedicationDispense when sending NewRx. Add button to clean…
plarocque4 Feb 15, 2024
97171e9
Merge pull request #101 from mcode/create-medication-dispense
avirgulto Feb 16, 2024
5e31c9d
Read dispensed status from ehr (#100)
jtquach1 Feb 19, 2024
063808f
Update new state variable to open the snackbar as expected (#103)
avirgulto Feb 23, 2024
cefa780
fix unrelated warning
KeeyanGhoreshi Feb 1, 2024
aa621b0
remove unnecessary key
KeeyanGhoreshi Feb 1, 2024
443e172
add task ui and update other ui
KeeyanGhoreshi Feb 15, 2024
37561aa
prettier
KeeyanGhoreshi Feb 15, 2024
4233b75
minor merge fixes
KeeyanGhoreshi Feb 20, 2024
5d341a2
fix settings related errors
KeeyanGhoreshi Feb 20, 2024
4afc32e
restore button in settings
KeeyanGhoreshi Feb 20, 2024
b8a33a2
prettier
KeeyanGhoreshi Feb 20, 2024
d3743c2
fix bugs and reintroduce reconnect ehr button
KeeyanGhoreshi Feb 21, 2024
fe17131
code cleanup and spelling
KeeyanGhoreshi Feb 22, 2024
a3ffa6b
spelling
KeeyanGhoreshi Feb 22, 2024
95d8131
update reducer
KeeyanGhoreshi Feb 22, 2024
772615f
increase task card clarity
KeeyanGhoreshi Feb 22, 2024
ae38636
Merge pull request #102 from mcode/task-ui
avirgulto Feb 23, 2024
114c4f4
Updates to patient portal and add in assign to me and assign to patie…
Feb 23, 2024
706d563
prettier updates
Feb 23, 2024
5059551
Rename method to camelcase
jtquach1 Feb 20, 2024
2a54855
Move MedicationDispense fetching up to parent component
jtquach1 Feb 22, 2024
fac2edf
Remove unused code
jtquach1 Feb 26, 2024
6b6940b
Fix incorrect variable
jtquach1 Feb 26, 2024
06b1ca1
Fix typo again
jtquach1 Feb 26, 2024
461f596
Move update startup dispatch call out of for loop since if local stor…
jtquach1 Feb 26, 2024
3ccaae2
Merge pull request #104 from mcode/fix-medication-dispense-flicker
jtquach1 Feb 26, 2024
802a901
Merge branch 'dev' into 623-patient-portal-task
avirgulto Feb 26, 2024
246e30d
update fill of select
Feb 26, 2024
876f43f
Merge pull request #105 from mcode/623-patient-portal-task
avirgulto Feb 26, 2024
34fd8a8
Merge branch 'main' into dev
smalho01 Feb 26, 2024
bb1b6b3
Merge branch 'main' into dev
smalho01 Feb 26, 2024
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
13 changes: 12 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import { ThemeProvider } from '@mui/styles';
import React from 'react';
import React, { useEffect } from 'react';
import { BrowserRouter, HashRouter, Route, Routes } from 'react-router-dom';
import Gateway from '../containers/Gateway/Gateway';
import Index from '../containers/Index';
import Launch from '../containers/Launch';
import PatientPortal from '../containers/PatientPortal';
import RegisterPage from '../containers/register/RegisterPage';
import theme from '../containers/styles/theme';
import { SettingsContext } from '../containers/ContextProvider/SettingsProvider';
import { actionTypes } from '../containers/ContextProvider/reducer';

const isGhPages = process.env.REACT_APP_GH_PAGES === 'true';
const Router = isGhPages ? HashRouter : BrowserRouter;
const redirect = isGhPages ? '/request-generator/#/index' : '/index';
const App = () => {
const [state, dispatch] = React.useContext(SettingsContext);
useEffect(() => {
dispatch({
type: actionTypes.updateSetting,
settingId: 'redirect',
value: redirect
});
}, []);
return (
<Router>
<Routes>
Expand Down
1 change: 1 addition & 0 deletions src/components/Auth/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const Login = props => {
const [username, _setUsername] = useState('');
const [password, _setPassword] = useState('');
const handleClose = () => setMessage(null);
document.title = 'EHR | Patient Portal';

const onSubmit = useCallback(() => {
if (username && password) {
Expand Down
99 changes: 34 additions & 65 deletions src/components/Dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React, { memo, useState, useEffect } from 'react';
import useStyles from './styles';
import DashboardElement from './DashboardElement';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import Box from '@mui/material/Box';
import Drawer from '@mui/material/Drawer';
import CssBaseline from '@mui/material/CssBaseline';
import Toolbar from '@mui/material/Toolbar';
import List from '@mui/material/List';
import Divider from '@mui/material/Divider';
import AssignmentIcon from '@mui/icons-material/Assignment';
import ListAltIcon from '@mui/icons-material/ListAlt';
import MedicationIcon from '@mui/icons-material/Medication';
import BiotechIcon from '@mui/icons-material/Biotech';
import LogoutIcon from '@mui/icons-material/Logout';
Expand All @@ -21,34 +19,28 @@ import NotificationsIcon from '@mui/icons-material/Notifications';
import AlarmIcon from '@mui/icons-material/Alarm';
import SettingsIcon from '@mui/icons-material/Settings';
import MedicalInformationIcon from '@mui/icons-material/MedicalInformation';
import { Paper } from '@mui/material';
import FormsSection from './ListSelections/FormsSection';
import EmptySection from './ListSelections/EmptySection';
import PatientTaskSection from './ListSelections/PatientTaskSection';

const Dashboard = props => {
const classes = useStyles();
const [resources, setResources] = useState([]);
const [message, setMessage] = useState('Loading...');
const [checked, setChecked] = useState(true);
const drawerWidth = '340px';
const handleChange = event => {
setChecked(event.target.checked);
};
const [selectedIndex, setSelectedIndex] = useState(3);

const addResources = bundle => {
if (bundle.entry) {
bundle.entry.forEach(e => {
const resource = e.resource;
setResources(resources => [...resources, resource]);
});
}
const handleListItemClick = (event, index) => {
setSelectedIndex(index);
};

const drawerWidth = '340px';

const createIcons = () => {
const icons = [];
const style = { fontSize: '40px' };
const itemStyle = { height: '80px' };
const qStyle = { height: '80px', backgroundColor: '#f5f5fa' };
icons.push(['Notifications', <NotificationsIcon sx={style} />, itemStyle]);
icons.push(['Appointments', <AlarmIcon sx={style} />, itemStyle]);
icons.push(['Questionnaire Forms', <AssignmentIcon sx={style} />, qStyle]);
icons.push(['Tasks', <AssignmentIcon sx={style} />, itemStyle]);
icons.push(['Questionnaire Forms', <ListAltIcon sx={style} />, itemStyle]);
icons.push(['Health Data', <MedicalInformationIcon sx={style} />, itemStyle]);
icons.push(['Medications', <MedicationIcon sx={style} />, itemStyle]);
icons.push(['Tests and Results', <BiotechIcon sx={style} />, itemStyle]);
Expand All @@ -57,32 +49,25 @@ const Dashboard = props => {

return icons;
};

useEffect(() => {
if (props.client.patient.id) {
props.client.patient
.request('QuestionnaireResponse', { pageLimit: 0, onPage: addResources })
.then(() => {
setMessage(
'No QuestionnaireResponses Found for user with patientId: ' + props.client.patient.id
);
});
} else {
setMessage('Invalid patient: No patientId provided');
if (selectedIndex === 8) {
// logout - set client to null to display login page
props.logout();
}
}, [props.client.patient]);
}, [selectedIndex]);

const renderElements = () => {
let resourcesToRender = [];
if (checked) {
resourcesToRender = resources.filter(e => {
return e.status === 'in-progress';
});
} else {
resourcesToRender = resources;
const renderBody = () => {
switch (selectedIndex) {
case 2:
return <PatientTaskSection client={props.client} />;
case 3:
return <FormsSection client={props.client} />;
default:
return <EmptySection />;
}
resourcesToRender.reverse();
return resourcesToRender;
};

return (
<div>
<Box sx={{ display: 'flex' }}>
Expand All @@ -102,8 +87,13 @@ const Dashboard = props => {
<List>
{createIcons().map((option, index) => (
<div key={`icon-${index}`}>
<ListItem key={option[0]} style={option[2]} disablePadding>
<ListItemButton>
<ListItem
key={option[0]}
style={option[2]}
selected={selectedIndex === index}
disablePadding
>
<ListItemButton onClick={event => handleListItemClick(event, index)}>
<ListItemIcon>{option[1]}</ListItemIcon>
<ListItemText
primaryTypographyProps={{ fontSize: '18px' }}
Expand All @@ -119,28 +109,7 @@ const Dashboard = props => {
</Drawer>
<Box component="main" sx={{ flexGrow: 1, p: 3 }}>
<Toolbar />
<div className={classes.dashboardArea}>
<h2 className={classes.elementHeader}>Available Forms</h2>
<FormControlLabel
style={{ float: 'right' }}
control={<Checkbox checked={checked} onChange={handleChange} />}
label="Only show in-progress forms"
/>
{resources.length > 0 ? (
renderElements().map(e => {
return (
<DashboardElement
key={e.id}
status={e.status}
resource={e}
client={props.client}
/>
);
})
) : (
<Paper className={classes.dashboardElement}>{message}</Paper>
)}
</div>
{renderBody()}
</Box>
</Box>
</div>
Expand Down
13 changes: 13 additions & 0 deletions src/components/Dashboard/ListSelections/EmptySection.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, { memo } from 'react';
import useStyles from '../styles';

const EmptySection = () => {
const classes = useStyles();
return (
<div className={classes.dashboardArea}>
<h2 className={classes.elementHeader}>Not available</h2>
</div>
);
};

export default memo(EmptySection);
75 changes: 75 additions & 0 deletions src/components/Dashboard/ListSelections/FormsSection.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React, { memo, useState, useEffect } from 'react';
import { Paper } from '@mui/material';
import DashboardElement from '../DashboardElement';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import useStyles from '../styles';

const FormsSection = props => {
const classes = useStyles();
const [resources, setResources] = useState([]);
const [message, setMessage] = useState('Loading...');
const [checked, setChecked] = useState(true);

useEffect(() => {
if (props.client.patient.id) {
props.client.patient
.request('QuestionnaireResponse', { pageLimit: 0, onPage: addResources })
.then(() => {
setMessage(
'No QuestionnaireResponses Found for user with patientId: ' + props.client.patient.id
);
});
} else {
setMessage('Invalid patient: No patientId provided');
}
}, [props.client.patient]);

const handleChange = event => {
setChecked(event.target.checked);
};

const addResources = bundle => {
if (bundle.entry) {
bundle.entry.forEach(e => {
const resource = e.resource;
setResources(resources => [...resources, resource]);
});
}
};

const renderElements = () => {
let resourcesToRender = [];
if (checked) {
resourcesToRender = resources.filter(e => {
return e.status === 'in-progress';
});
} else {
resourcesToRender = resources;
}
resourcesToRender.reverse();
return resourcesToRender;
};

return (
<div className={classes.dashboardArea}>
<h2 className={classes.elementHeader}>Available Forms</h2>
<FormControlLabel
style={{ float: 'right' }}
control={<Checkbox checked={checked} onChange={handleChange} />}
label="Only show in-progress forms"
/>
{resources.length > 0 ? (
renderElements().map(e => {
return (
<DashboardElement key={e.id} status={e.status} resource={e} client={props.client} />
);
})
) : (
<Paper className={classes.dashboardElement}>{message}</Paper>
)}
</div>
);
};

export default memo(FormsSection);
Loading