diff --git a/src/components/RemsInterface/RemsInterface.css b/src/components/RemsInterface/RemsInterface.css
index 230aaba6..7fba33a5 100644
--- a/src/components/RemsInterface/RemsInterface.css
+++ b/src/components/RemsInterface/RemsInterface.css
@@ -77,6 +77,29 @@ body {
animation-timing-function: ease-in-out;
}
+.requestBody{
+ overflow-y: scroll;
+ height:500px;
+}
+.jsonData{
+ line-height:16px;
+ font-family: 'Courier New', Courier, monospace;
+ font-size: 14px;
+
+ border-left: 2px solid #dddddd;
+ border-top:0px;
+ padding-left:6px;
+
+ display:block;
+}
+
+.elementBody{
+ color:#adadad;
+}
+.elementKey{
+ color:#343434
+}
+
@keyframes spin {
from {
transform:rotate(0deg);
diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx
index 1229619c..13db68db 100644
--- a/src/components/RemsInterface/RemsInterface.jsx
+++ b/src/components/RemsInterface/RemsInterface.jsx
@@ -21,6 +21,7 @@ export default class RemsInterface extends Component {
response: null,
spin: false,
spinPis: false,
+ viewResponse: false,
viewBundle: false,
viewPisBundle: false,
};
@@ -31,6 +32,8 @@ export default class RemsInterface extends Component {
this.refreshBundle = this.refreshBundle.bind(this);
this.refreshPisBundle = this.refreshPisBundle.bind(this);
this.toggleBundle = this.toggleBundle.bind(this);
+ this.toggleResponse = this.toggleResponse.bind(this);
+
this.togglePisBundle = this.togglePisBundle.bind(this);
}
@@ -47,8 +50,25 @@ export default class RemsInterface extends Component {
return options;
}
+ unfurlJson(jsonData, level) {
+ var divStyle = {
+ marginLeft: 20
+ };
+ if (jsonData) {
+ return Object.keys(jsonData).map(element => {
+ var elementKey = `${element}-${level}`;
+ return (
+
+ {element}: {jsonData[element] === null ? "null" : typeof jsonData[element] === "object" ? this.unfurlJson(jsonData[element], level + 1) : jsonData[element]}
+
+ )
+ });
+ }
+
+ }
+
async sendRemsMessage() {
- const remsAdminResponse = await axios.post("http://localhost:8090/api/rems", this.props.specialtyRxBundle, this.getAxiosOptions());
+ const remsAdminResponse = await axios.post("http://localhost:8090/rems", this.props.specialtyRxBundle, this.getAxiosOptions());
this.setState({ remsAdminResponse });
console.log(remsAdminResponse)
axios.post("http://localhost:3010/api/doctorOrder/fhir/rems", remsAdminResponse.data, this.getAxiosOptions()).then((response) => {
@@ -61,14 +81,21 @@ export default class RemsInterface extends Component {
}
toggleBundle() {
- this.setState((prevState)=>{
- return {...prevState, viewBundle: !prevState.viewBundle}
+ this.setState((prevState) => {
+ return { ...prevState, viewBundle: !prevState.viewBundle }
+ })
+ }
+
+ toggleResponse() {
+ console.log(this.state.viewResponse);
+ this.setState((prevState) => {
+ return { ...prevState, viewResponse: !prevState.viewResponse }
})
}
togglePisBundle() {
- this.setState((prevState)=>{
- return {...prevState, viewPisBundle: !prevState.viewPisBundle}
+ this.setState((prevState) => {
+ return { ...prevState, viewPisBundle: !prevState.viewPisBundle }
})
}
@@ -85,15 +112,15 @@ export default class RemsInterface extends Component {
}
refreshPisBundle() {
- this.setState({spinPis: true});
- axios.get(`http://localhost:3010/api/doctorOrder/${this.state.response.data.doctorOrder._id}`).then((response)=>{
- this.setState({response: response});
+ this.setState({ spinPis: true });
+ axios.get(`http://localhost:3010/api/doctorOrder/${this.state.response.data.doctorOrder._id}`).then((response) => {
+ this.setState({ response: response });
})
}
refreshBundle() {
- this.setState({spin: true});
- axios.get(`http://localhost:8090/api/rems/${this.state.remsAdminResponse.data.case_number}`).then((response)=>{
- this.setState({remsAdminResponse: response});
+ this.setState({ spin: true });
+ axios.get(`http://localhost:8090/rems/${this.state.remsAdminResponse.data.case_number}`).then((response) => {
+ this.setState({ remsAdminResponse: response });
})
}
render() {
@@ -105,7 +132,7 @@ export default class RemsInterface extends Component {
color = "#f0ad4e"
}
- let colorPis = "#f7f7f7"
+ let colorPis = "#f7f7f7"
const statusPis = this.state.response?.data?.doctorOrder?.dispenseStatus;
if (statusPis === "Approved") {
@@ -120,7 +147,7 @@ export default class RemsInterface extends Component {
REMS Admin Status
-
+
Case Number : {this.state.remsAdminResponse?.data?.case_number || "N/A"}
@@ -130,21 +157,29 @@ export default class RemsInterface extends Component {
- {this.state.remsAdminResponse?.data?.case_number ?
-
this.setState({spin: false})}
- />
- :""
- }
+
+
+ {this.state.remsAdminResponse?.data?.case_number ?
+ this.setState({ spin: false })}
+ />
+ : ""
+ }
+ {this.state.viewResponse ?
+
+ {this.unfurlJson(this.state.remsAdminResponse?.data, 0)}
+
+ :
+ ""}
{this.state.viewBundle ?
{this.renderBundle(this.props.specialtyRxBundle)}
-
: ""}
+ : ""}
@@ -152,31 +187,31 @@ export default class RemsInterface extends Component {
Pharmacy Status
-
-
-
- ID : {this.state.response?.data?.doctorOrder?._id || "N/A"}
-
-
- Status: {this.state.response?.data?.doctorOrder?.dispenseStatus}
-
-
-
- {this.state.response?.data?.doctorOrder?._id ?
-
this.setState({spinPis: false})}
- />
- :""
- }
-
-
-
-
- {this.state.viewPisBundle ?
+
+
+
+ ID : {this.state.response?.data?.doctorOrder?._id || "N/A"}
+
+
+ Status: {this.state.response?.data?.doctorOrder?.dispenseStatus}
+
+
+
+ {this.state.response?.data?.doctorOrder?._id ?
+
this.setState({ spinPis: false })}
+ />
+ : ""
+ }
+
+
+
+
+ {this.state.viewPisBundle ?
{this.renderBundle(this.props.specialtyRxBundle)}
-
: ""}
+
: ""}
{/*
*/}