- { this.props.patient.id ? (
-
-
-
- Patient ID: {this.props.patient.id}
-
-
- {this.renderPatientInfo()}
- {this.renderPrefetchedResources()}
-
-
-
-
-
-
-
-
-
+ <>
+
+
+
+ Patient ID: {this.props.patient.id}
+
+
+ {this.renderPatientInfo()}
+ {this.renderPrefetchedResources()}
+
+
+
+
+
+
+
+
- ) : (
-
- )}
+
-
- Success! NewRx Received By Pharmacy
-
-
-
+ anchorOrigin={{
+ vertical: 'bottom',
+ horizontal: 'left'
+ }}
+ open={this.state.submittedRx}
+ onClose={this.handleClose}
+ autoHideDuration={6000}
+ >
+
+ Success! NewRx Received By Pharmacy
+
+
+ >
);
}
}
diff --git a/src/components/SettingsBox/SettingsBox.js b/src/components/SettingsBox/SettingsBox.js
index f12a3487..684188ec 100644
--- a/src/components/SettingsBox/SettingsBox.js
+++ b/src/components/SettingsBox/SettingsBox.js
@@ -6,12 +6,10 @@ import { headerDefinitions, types } from '../../util/data';
import FHIR from 'fhirclient';
import { Box, Button, FormControlLabel, Grid, TextField } from '@mui/material';
-const clearMedicationDispenses =
+const clearMedicationDispenses =
({ ehrUrl, access_token }, consoleLog) =>
() => {
- console.log(
- 'Clear MedicationDispenses from the EHR: ' + ehrUrl
- );
+ console.log('Clear MedicationDispenses from the EHR: ' + ehrUrl);
const client = FHIR.client({
serverUrl: ehrUrl,
...(access_token ? { tokenResponse: access_token } : {})
@@ -160,23 +158,23 @@ export default class SettingsBox extends Component {
}
componentDidMount() {
- const headers = Object.keys(headerDefinitions).map(key => ([key, this.props.state[key]]));
- this.setState({originalValues: headers});
+ const headers = Object.keys(headerDefinitions).map(key => [key, this.props.state[key]]);
+ this.setState({ originalValues: headers });
}
closeSettings() {
this.props.updateCB('showSettings', false);
}
saveSettings() {
- const headers = Object.keys(headerDefinitions).map(key => ([key, this.props.state[key]]));
+ const headers = Object.keys(headerDefinitions).map(key => [key, this.props.state[key]]);
console.log(headers);
localStorage.setItem('reqgenSettings', JSON.stringify(headers));
this.closeSettings();
}
cancelSettings() {
- this.state.originalValues.forEach((e) => {
- try{
+ this.state.originalValues.forEach(e => {
+ try {
this.props.updateCB(e[0], e[1]);
} catch {
console.log('Failed to reset setting value');
@@ -199,80 +197,89 @@ export default class SettingsBox extends Component {
);
return (
-
-
- Settings
-
- {headers.map(({ key, type, display }) => {
-
- switch (type) {
- case 'input':
- return (
-
-
- {updateCB(key, event.target.value);}}
- sx = {{width:'100%'}}
- />
-
-
- );
- case 'check':
- if(firstCheckbox) {
- firstCheckbox = false;
- showBreak = true;
- } else {
- showBreak = false;
- }
- return (
-
- {showBreak ? :''}
-
- {updateCB(key, event.target.checked);}}/>
- }
- label = {display}
- />
+
+ Settings
+
+ {headers.map(({ key, type, display }) => {
+ switch (type) {
+ case 'input':
+ return (
+
+
+ {
+ updateCB(key, event.target.value);
+ }}
+ sx={{ width: '100%' }}
+ />
+
-
- );
- default:
- return (
-
- );
- }
- })}
- {resetHeaderDefinitions.map(({ key, display, reset }) => {
- return (
-
-
-
- );
- })}
+ );
+ case 'check':
+ if (firstCheckbox) {
+ firstCheckbox = false;
+ showBreak = true;
+ } else {
+ showBreak = false;
+ }
+ return (
+
+ {showBreak ? : ''}
+
+ {
+ updateCB(key, event.target.checked);
+ }}
+ />
+ }
+ label={display}
+ />
+
+
+ );
+ default:
+ return (
+
+ );
+ }
+ })}
+ {resetHeaderDefinitions.map(({ key, display, reset }) => {
+ return (
+
+
+
+ );
+ })}
{/* spacer */}
-
+
-
+
-
+
-
);
}
}
diff --git a/src/containers/RequestBuilder.js b/src/containers/RequestBuilder.js
index 00018b58..e4845d42 100644
--- a/src/containers/RequestBuilder.js
+++ b/src/containers/RequestBuilder.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import { Button, Box, IconButton, Modal, DialogTitle } from '@mui/material';
+import { Button, Box, Grid, IconButton, Modal, DialogTitle } from '@mui/material';
import PersonIcon from '@mui/icons-material/Person';
import RefreshIcon from '@mui/icons-material/Refresh';
import DisplayBox from '../components/DisplayBox/DisplayBox';
@@ -16,8 +16,9 @@ import Accordion from '@mui/material/Accordion';
import AccordionSummary from '@mui/material/AccordionSummary';
import AccordionDetails from '@mui/material/AccordionDetails';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
-
+import SettingsIcon from '@mui/icons-material/Settings';
import PatientSearchBar from '../components/RequestBox/PatientSearchBar/PatientSearchBar';
+import { MedicationStatus } from '../components/MedicationStatus/MedicationStatus.jsx';
export default class RequestBuilder extends Component {
constructor(props) {
@@ -37,7 +38,7 @@ export default class RequestBuilder extends Component {
showSettings: false,
token: null,
client: this.props.client,
- codeValues: defaultValues,
+ codeValues: defaultValues
};
this.updateStateElement = this.updateStateElement.bind(this);
@@ -50,11 +51,11 @@ export default class RequestBuilder extends Component {
componentDidMount() {
// init settings
- Object.keys(headerDefinitions).map((key) => {
+ Object.keys(headerDefinitions).map(key => {
this.setState({ [key]: headerDefinitions[key].default });
});
// load settings
- JSON.parse(localStorage.getItem('reqgenSettings') || '[]').forEach((element) => {
+ JSON.parse(localStorage.getItem('reqgenSettings') || '[]').forEach(element => {
try {
this.updateStateElement(element[0], element[1]);
} catch {
@@ -104,7 +105,6 @@ export default class RequestBuilder extends Component {
}
};
-
timeout = time => {
let controller = new AbortController();
setTimeout(() => controller.abort(), time * 1000);
@@ -201,7 +201,7 @@ export default class RequestBuilder extends Component {
.request(this.state.patientFhirQuery, { flat: true })
.then(result => {
this.setState({
- patientList: result,
+ patientList: result
});
})
.catch(e => {
@@ -234,34 +234,49 @@ export default class RequestBuilder extends Component {
response: {}
});
};
+
handleChange = () => (event, isExpanded) => {
this.setState({ expanded: isExpanded ? true : false });
};
+ isOrderNotSelected() {
+ return Object.keys(this.state.request).length === 0;
+ }
+
render() {
+ const displayRequestBox = !!this.state.patient.id;
+ const disableGetMedicationStatus = this.isOrderNotSelected() || this.state.loading;
+
return (
-
-
-
-
-
-
{ this.setState({ showSettings: false }); }} >
-
-
-
- }
- aria-controls="panel1a-content"
- id="panel1a-header"
- style={{ marginLeft: '45%' }}
- >
- }>
- Select a patient
-
-
-
- {this.state.patientList.length > 0 && this.state.expanded ?
-
+
+
+
+
+ }
+ aria-controls="panel1a-content"
+ id="panel1a-header"
+ style={{ marginLeft: '45%' }}
+ >
+ }>
+ Select a patient
+
+
+
+ {this.state.patientList.length > 0 && this.state.expanded && (
- {this.state.patientList instanceof Error
- ? this.renderError()
- : }
+ {this.state.patientList instanceof Error ? (
+ this.renderError()
+ ) : (
+
+ )}
-
- :
- }
+ )}
+
+
+
+
+ this.getPatients()} size="large">
+
+
+
-
-
-
this.getPatients()}
- size="large"
- >
-
-
-
-
-
- {/*for the ehr launch */}
-
+ {displayRequestBox && (
+
+
+
+ )}
+ {!disableGetMedicationStatus && (
+
+
+
+ )}
+
+
+
+
-
-
-
-
-
-
-
+
+
+ >
);
}
}
+
+const navigationBarButtonStyle = {
+ backgroundColor: 'white',
+ color: 'black',
+ borderColor: 'black',
+ display: 'flex',
+ marginX: 2,
+ marginY: 1,
+ '&:hover': {
+ color: 'white',
+ backgroundColor: 'black',
+ borderColor: 'black'
+ },
+ '&:active': {
+ color: 'white',
+ backgroundColor: 'black',
+ borderColor: 'black'
+ }
+};
diff --git a/src/index.css b/src/index.css
index 410e3449..5c0b331e 100644
--- a/src/index.css
+++ b/src/index.css
@@ -2,15 +2,10 @@ body {
margin: 0;
padding: 0;
font-family: sans-serif;
-
}
-.left-form {
- width: 50%;
- float: left;
- margin-top: 25px;
-}
-.btn:focus,.btn:active {
+.btn:focus,
+.btn:active {
outline: none !important;
box-shadow: none;
}
@@ -22,298 +17,247 @@ body {
left: 13px;
top: 17px;
transition: 0.2s ease all;
- font-size: 14px;
+ font-size: 14px;
}
-input:focus ~ .floating-label{
+input:focus ~ .floating-label {
top: -14px;
opacity: 1;
-
}
-input:not(:focus):not([value=""]):valid ~ .floating-label{
+input:not(:focus):not([value='']):valid ~ .floating-label {
top: -14px;
opacity: 1;
-
}
-.error-border{
- border-color:#E34531 !important;
+.error-border {
+ border-color: #e34531 !important;
}
-.input-text:not(:focus):not([value=""]):valid{
+.input-text:not(:focus):not([value='']):valid {
border-color: #000000;
-
}
.form-control:focus {
border-color: inherit;
-webkit-box-shadow: none;
box-shadow: none;
}
-.input-text{
- border-width:1px 0px 0px 9px;
+.input-text {
+ border-width: 1px 0px 0px 9px;
border-style: solid none solid solid;
}
-.input-text:hover{
+.input-text:hover {
border-color: #999999;
}
-.input-text:focus{
+.input-text:focus {
border-color: #555555;
}
-.btn-class{
- border-width:1px 5px 3px 1px;
+.btn-class {
+ border-width: 1px 5px 3px 1px;
border-style: solid solid solid solid;
border-color: black;
- background: linear-gradient(white,white)
-}
-
-
-.btn-class-correct{
- border-color: #3145C3;
+ background: linear-gradient(white, white);
}
-.right-form{
-
- float:right;
- width:50%;
- /* gotta account for the header on the left form */
- margin-top:52px;
+.btn-class-correct {
+ border-color: #3145c3;
}
-.button-empty-fields{
- opacity:0.5 !important;
+.button-empty-fields {
+ opacity: 0.5 !important;
}
-.button-error{
- border-color: #E34531;
+.button-error {
+ border-color: #e34531;
}
-.genderBlockMaleUnselected{
+.genderBlockMaleUnselected {
border-width: 1px 1px 3px 5px;
- opacity:0.5;
-
+ opacity: 0.5;
}
-.genderBlockFemaleUnselected{
+.genderBlockFemaleUnselected {
border-width: 1px 5px 3px 1px;
- opacity:0.5;
+ opacity: 0.5;
}
-.genderBlockMaleSelected{
+.genderBlockMaleSelected {
border-width: 1px 1px 1px 3px;
- background:#DDDDDD;
-
+ background: #dddddd;
}
-.genderBlockFemaleSelected{
-
+.genderBlockFemaleSelected {
border-width: 1px 3px 1px 1px;
- background:#DDDDDD;
-
-
+ background: #dddddd;
}
-.genderBlockMale{
- width:50%;
+.genderBlockMale {
+ width: 50%;
border-top-right-radius: 0cm;
border-bottom-right-radius: 0cm;
-
-
}
-.genderBlockFemale{
- width:50%;
+.genderBlockFemale {
+ width: 50%;
border-top-left-radius: 0cm;
border-bottom-left-radius: 0cm;
-
}
-.genderBlockFemaleUnselected:hover{
- border-width:1px 3px 1px 1px;
- padding-bottom:-2px;
- margin-bottom:2px;
+.genderBlockFemaleUnselected:hover {
+ border-width: 1px 3px 1px 1px;
+ padding-bottom: -2px;
+ margin-bottom: 2px;
}
-.genderBlockMaleUnselected:hover{
- border-width:1px 1px 1px 3px;
- padding-bottom:-2px;
- margin-bottom:2px;
+.genderBlockMaleUnselected:hover {
+ border-width: 1px 1px 1px 3px;
+ padding-bottom: -2px;
+ margin-bottom: 2px;
}
-.dropdownCode{
+.dropdownCode {
border-width: 1px 1px 0px 9px !important;
}
-.dropdownCode:focus{
+.dropdownCode:focus {
border-color: #555555 !important;
}
-.header{
+.header {
text-align: center;
font-size: 18px;
- padding:10px;
+ padding: 10px;
}
-.checkBox{
- float:right;
+.checkBox {
+ float: right;
border-style: solid;
- border-width:1px 5px 3px 1px;
+ border-width: 1px 5px 3px 1px;
}
-.checkBoxClicked{
+.checkBoxClicked {
border-width: 1px 3px 1px 1px;
- float:right;
- border-color:gray black black gray;
-
+ float: right;
+ border-color: gray black black gray;
}
-.checkBox:hover{
- border-width:1px 3px 1px 1px;
- border-color:gray black black gray;
+.checkBox:hover {
+ border-width: 1px 3px 1px 1px;
+ border-color: gray black black gray;
}
-.onOffState{
+.onOffState {
border-style: solid;
- border-radius:50px;
+ border-radius: 50px;
border-width: 0px 5px 0px 5px;
margin-left: 5px;
}
-.onOff{
+.onOff {
/* border-color: #E34531; */
- border-color: #C5C5C5;
+ border-color: #c5c5c5;
}
-.onOffActive{
+.onOffActive {
/* border-color: #5CB85C; */
border-color: #222222;
-
}
-.ui.selection.active.dropdown:hover{
- border-color:black;
+.ui.selection.active.dropdown:hover {
+ border-color: black;
}
-.blackBorder{
- border-color:black !important;
+.blackBorder {
+ border-color: black !important;
}
-.ui.selection.active.dropdown{
- border-color:#333333;
+.ui.selection.active.dropdown {
+ border-color: #333333;
}
-.ui{
+.ui {
transition: all 2s;
}
-
-.visible{
- opacity:1;
+.visible {
+ opacity: 1;
}
-.invisible{
+.invisible {
/* display:none; */
- opacity:0;
+ opacity: 0;
}
-.spinner{
- display:inline-block;
- transition:all 0.5s;
- margin-left:15px;
- line-height:3em;
+.spinner {
+ display: inline-block;
+ transition: all 0.5s;
+ margin-left: 15px;
+ line-height: 3em;
}
-.rightStateInput{
- width:50%;
- float:right;
- margin-bottom:25px;
+.rightStateInput {
+ width: 50%;
+ float: right;
+ margin-bottom: 25px;
border-left: 5px solid transparent;
}
-.leftStateInput{
- width:50%;
- border-right:5px solid transparent;
- float:left;
- margin-bottom:25px;
+.leftStateInput {
+ width: 50%;
+ border-right: 5px solid transparent;
+ float: left;
+ margin-bottom: 25px;
}
.version-button {
- width: 60px;
- border-style: solid solid solid solid;
- border-color: black;
+ width: 60px;
+ border-style: solid solid solid solid;
+ border-color: black;
}
.launch-button {
- border-style: solid solid solid solid;
- border-color: black;
- width:120px;
+ border-style: solid solid solid solid;
+ border-color: black;
+ width: 120px;
}
.right-button {
- border-width:1px 3px 3px 1px;
- border-radius: 0 10% 10% 0%;
- margin-right: 10px;
+ border-width: 1px 3px 3px 1px;
+ border-radius: 0 10% 10% 0%;
+ margin-right: 10px;
}
.left-button {
- border-width:1px 1px 3px 3px;
- border-radius: 10% 0% 0% 10%;
-}
-
-.version-button:hover{
- background:black;
- color:#AAA;
-}
-
-.launch-button:hover{
- background:black;
- color:#AAA;
-}
-
-.launch-button.not-active{
- color:#666;
+ border-width: 1px 1px 3px 3px;
+ border-radius: 10% 0% 0% 10%;
}
-.launch-button.active{
- background:black;
- color:white;
+.version-button:hover {
+ background: black;
+ color: #aaa;
}
-.version-button.not-active{
- color:#666;
+.launch-button:hover {
+ background: black;
+ color: #aaa;
}
-.version-button.active{
- background:black;
- color:white;
+.launch-button.not-active {
+ color: #666;
}
-.btn-class.settings{
- border-width:1px;
- font-size:22px;
- height:36px;
- float:right;
-
-}
-.settings:hover{
- background:black;
- color:white;
+.launch-button.active {
+ background: black;
+ color: white;
}
-.settings.active{
- background:black;
- color:white;
+.version-button.not-active {
+ color: #666;
}
-.settings-icon{
- vertical-align:1px;
-}
-#settings-header{
- margin-bottom: 10px;
+.version-button.active {
+ background: black;
+ color: white;
}
-.nav-header{
- margin-bottom: 10px;
- display: flow;
- height: 55px;
- padding:10px;
+.nav-header {
border-bottom: 1px solid black;
- background-color: #005B94;
+ background-color: #005b94;
}
-.loading{
+.loading {
width: 100vw;
height: 100vh;
display: flex;
@@ -329,12 +273,11 @@ input:not(:focus):not([value=""]):valid ~ .floating-label{
border: 1px solid black;
width: 75%;
height: 75%;
- background-color:white;
+ background-color: white;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow-y: auto;
- box-shadow: 10px 10px 20px black
-
-}
\ No newline at end of file
+ box-shadow: 10px 10px 20px black;
+}