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
16 changes: 16 additions & 0 deletions omod/src/main/webapp/resources/scripts/visit/visit.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,23 @@ angular.module("visit", [ "filters", "constants", "encounterTypeConfig", "visitS
doc.write('</body></html>');
doc.close();

// When the visit page is embedded in the ward app (O2VisitSummaryWorkspace
// iframe), a discharge form's "Save & Print" leaves the patient discharged.
// The parent defers removing the patient from the ward until printing has
// finished, so notify it here (guarded so it fires at most once).
var printedNotified = false;
var notifyParentPrinted = function() {
if (printedNotified) {
return;
}
printedNotified = true;
if (window.parent !== window) {
window.parent.postMessage({ type: 'o2IframeFormPrinted' }, '*');
}
};

var removeIframe = function() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this just close the iframe? Should we also trigger a message to close the workspace?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chibongho , the removeIframe function here in the visit.js closes the iFrame in which the printing template is loaded.
A couple lines above this code posts a 'o2IframeFormPrinted' message which the O3 O2VisitSummaryWorkspace component listens to and then it removes the patient from the ward and closes the workspace.

https://github.com/PIH/openmrs-esm-pihemr/pull/40/changes#diff-2ad2c6b5fbc16f8248605c48875931f27d4c70ee65db07fc787a6bd5742bb9fbR83

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't see that. Yeah, looks good then. Thanks!

notifyParentPrinted();
if (iframe.parentNode) {
iframe.parentNode.removeChild(iframe);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<fhir2Version>4.2.0</fhir2Version>
<growthChartVersion>2.1.0</growthChartVersion>
<htmlformentryVersion>7.3.0-SNAPSHOT</htmlformentryVersion>
<htmlformentryuiVersion>3.2.0</htmlformentryuiVersion>
<htmlformentryuiVersion>3.3.0-SNAPSHOT</htmlformentryuiVersion>
<htmlwidgetsVersion>2.0.1</htmlwidgetsVersion>
<idgenVersion>5.0.4</idgenVersion>
<initializerVersion>2.12.0</initializerVersion>
Expand Down