diff --git a/.env b/.env index d4b9e1e..f6a3868 100644 --- a/.env +++ b/.env @@ -30,3 +30,5 @@ VITE_USE_PHARMACY_IN_PREFETCH = true VITE_INTERMEDIARY = http://localhost:3003 VITE_DISABLE_MEDICATION_STATUS = false VITE_PHARMACY_ID = pharm0111 +VITE_PACIO_EHR_URL = https://gw.interop.community/paciosandbox2/open/Bundle +VITE_PACIO_NEW_PRESCRIBER_ID=pra1234 diff --git a/src/PrefetchTemplate.js b/src/PrefetchTemplate.js index 573a880..7ee00ca 100644 --- a/src/PrefetchTemplate.js +++ b/src/PrefetchTemplate.js @@ -3,10 +3,9 @@ export class PrefetchTemplate { static generatePrefetchMap(settings = null) { // If no settings provided, use defaults from data.js - const includePharmacy = settings?.includePharmacyInPreFetch ?? - headerDefinitions.includePharmacyInPreFetch.default; - const pharmacyId = settings?.pharmacyId ?? - headerDefinitions.pharmacyId.default; + const includePharmacy = + settings?.includePharmacyInPreFetch ?? headerDefinitions.includePharmacyInPreFetch.default; + const pharmacyId = settings?.pharmacyId ?? headerDefinitions.pharmacyId.default; const prefetchMap = new Map(); @@ -64,7 +63,7 @@ export class PrefetchTemplate { ) { const prefetchMap = PrefetchTemplate.generatePrefetchMap(settings); const paramElementMap = PrefetchTemplate.generateParamElementMap(); - + var resolvedQueries = new Map(); for (var i = 0; i < prefetchKeys.length; i++) { var prefetchKey = prefetchKeys[i]; @@ -73,7 +72,7 @@ export class PrefetchTemplate { // Regex source: https://regexland.com/all-between-specified-characters/ var parametersToFill = query.match(/(?<={{).*?(?=}})/gs); var resolvedQuery = query.slice(); - + if (parametersToFill) { for (var j = 0; j < parametersToFill.length; j++) { var unresolvedParameter = parametersToFill[j]; @@ -135,4 +134,4 @@ export class PrefetchTemplate { getQuery() { return this.query; } -} \ No newline at end of file +} diff --git a/src/components/RequestDashboard/Communication.jsx b/src/components/RequestDashboard/Communication.jsx index ecf490b..05de736 100644 --- a/src/components/RequestDashboard/Communication.jsx +++ b/src/components/RequestDashboard/Communication.jsx @@ -1,45 +1,44 @@ -import { Button, Grid } from "@mui/material"; +import { Button, Grid } from '@mui/material'; import DeleteIcon from '@mui/icons-material/Delete'; import useStyles from './styles'; - const Communication = props => { - const classes = useStyles(); - const { communication, deleteCommunication } = props; + const classes = useStyles(); + const { communication, deleteCommunication } = props; - const convertTimeStamp = (timeStamp) => { - const date = new Date(timeStamp); - return date.toLocaleString(); - }; + const convertTimeStamp = timeStamp => { + const date = new Date(timeStamp); + return date.toLocaleString(); + }; - return ( -
- - - {`ID: ${communication.id}`} - - - {`Received: ${convertTimeStamp(communication.received)}`} - - - - - - {communication.payload[0].contentString} - - -
- ); + return ( +
+ + + {`ID: ${communication.id}`} + + + {`Received: ${convertTimeStamp(communication.received)}`} + + + + + + {communication.payload[0].contentString} + + +
+ ); }; -export default Communication; \ No newline at end of file +export default Communication; diff --git a/src/components/RequestDashboard/CommunicationsDialog.jsx b/src/components/RequestDashboard/CommunicationsDialog.jsx index ba7d7ef..cfe387a 100644 --- a/src/components/RequestDashboard/CommunicationsDialog.jsx +++ b/src/components/RequestDashboard/CommunicationsDialog.jsx @@ -6,7 +6,7 @@ import Badge from '@mui/material/Badge'; import Dialog from '@mui/material/Dialog'; import DialogTitle from '@mui/material/DialogTitle'; import DialogContent from '@mui/material/DialogContent'; -import { Refresh } from '@mui/icons-material' +import { Refresh } from '@mui/icons-material'; import { styled } from '@mui/material/styles'; import Paper from '@mui/material/Paper'; @@ -23,25 +23,23 @@ const CommunicationsDialog = props => { open: false }); - const debugLog = (message) => { + const debugLog = message => { console.log('CommunicationsDialog: ' + message); }; useEffect(() => { // reload on page load and dialog open if (state.initialLoad) { - setState(prevState => ({ ...prevState, initialLoad: false})); + setState(prevState => ({ ...prevState, initialLoad: false })); getCommunications(); } const interval = setInterval(() => { // page load... getCommunications(); - - }, 1000 * 5) // reload every 5 seconds + }, 1000 * 5); // reload every 5 seconds return () => clearInterval(interval); - }); const getCommunications = () => { @@ -56,9 +54,9 @@ const CommunicationsDialog = props => { loadCommunications(bundle); }); } - } + }; - const deleteCommunication = (id) => { + const deleteCommunication = id => { debugLog('deleteCommunication: ' + id); if (id) { state.client.delete(`Communication/${id}`).then(() => { @@ -66,15 +64,15 @@ const CommunicationsDialog = props => { getCommunications(); }); } - } + }; - const loadCommunications = (bundle) => { + const loadCommunications = bundle => { let count = bundle.length; - setState(prevState => ({ ...prevState, communicationCount: count, communications: bundle})); + setState(prevState => ({ ...prevState, communicationCount: count, communications: bundle })); }; const handleClose = () => { - setState(prevState => ({ ...prevState, open: false})); + setState(prevState => ({ ...prevState, open: false })); }; const Item = styled(Paper)(({ theme }) => ({ @@ -82,59 +80,64 @@ const CommunicationsDialog = props => { ...theme.typography.body2, padding: theme.spacing(1), textAlign: 'left', - color: theme.palette.text.secondary, + color: theme.palette.text.secondary })); const renderCommunications = () => { return ( - + {state.communications.map(communication => { return ( - + + + ); })} - + ); - } + }; return ( - { - setState(prevState => ({ ...prevState, open: true, initialLoad: true})); - }} > - - - - - - - - - Communications ({state.communicationCount}) - - - + { + setState(prevState => ({ ...prevState, open: true, initialLoad: true })); + }} + > + + + + + + + + + + Communications ({state.communicationCount}) + + + + - - - - - { renderCommunications() } - + - + {renderCommunications()} + ); }; -export default CommunicationsDialog; \ No newline at end of file +export default CommunicationsDialog; diff --git a/src/components/RequestDashboard/Home.jsx b/src/components/RequestDashboard/Home.jsx index 61b538c..ba322ec 100644 --- a/src/components/RequestDashboard/Home.jsx +++ b/src/components/RequestDashboard/Home.jsx @@ -12,7 +12,6 @@ import PatientSection from './PatientSection'; import SettingsSection from './SettingsSection'; import TasksSection from './TasksSection'; - import { logout } from '../../util/auth'; const Home = props => { @@ -86,9 +85,7 @@ const Home = props => { {section ? ( - +    {token.name}