-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Conversation
OPD Reports Custom Forms
Fix/report acceptance tests
Refactor code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adeolabadmus I commented below on how the print functionality can be done in a cleaner way.
As far as the update button is concerned, the abstract-edit-controller has a computed property. showUpdateButton that is used to determine if the update button should display. You can override that in your controller to not show the update button on an opd report when isNew is false. You still need to run the logic in abstract-edit-controller because it checks user permissions, so in your override you should do something like this:
showUpdateButton: computed('updateCapability', 'model.{isNew,reportType}', function() {
let showUpdate = this._super();
...
additional logic to determine if update button should display.
})
app/visits/edit/controller.js
Outdated
@@ -516,6 +522,22 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn | |||
this.send('update', true); | |||
}, | |||
|
|||
printReport(report) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too keen on how this was implemented. I think a better approach would be when clicking on the Print button, you are directed to the report page and print automatically fires from that page. You can use the {{print-this}} component to automatically print the page on render, so if you pass in a queryParam, in the template you can add the following to auto print:
{{#if printQueryParam}}
{{print-this}}
{{/if}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a small change needed here before this can be merged.
app/components/print-this.js
Outdated
export default Ember.Component.extend({ | ||
print: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print should default to true; otherwise invoice printing won't work unless you change that template. I would prefer to change the default to true.
Fixes #996
Changes proposed in this pull request:
Edit
report toView
Print
Button to visit pagecc @HospitalRun/core-maintainers