The GSP fragment is not quite self sufficient in this dashboard, it needs to be paired with a JS file that behaves like another controller for it.
This is an example of a complete override for a specific encounter type (it’s coming from the Visit Documents UI module):
The GSP fragment: complexObsEncounterTemplate.gsp
As you know this is a view, but the ‘real’ controller is not so much the Java controller but rather the JS file that goes with it, see hereunder.
The JS file: complexObsEncounterTemplate.js
That’s the guy fetching the content of the encounter based on its UUID. I believe the default encounter template does it based on the encounter ID because… it’s a bit of a legacy piece of code.
Have you tried Visit Documents UI btw? It may possibly do just what you need out of the box.
This module is likely going to become part of the Ref App distro and be ported to Bahmni. Furthermore it has been designed to be extended to more use cases than just ‘visit documents’ and will be eventually refactored into Patient Documents UI.
Version 1.2 will be on out soon and allows to attach files to past/closed visits. Hopefully you will find it suitable to your needs, and we would be happy to take in your PRs should you want to bring features that you find missing.
Ahhh… That’s why I couldn’t.
I completely ignored the JS files for that fragment assuming it has UI related stuff.
I checked Visit Documents UI, but reverse engineering it is little slow for me because it is developed in AngularJS which I’m not familiar with. I’m learning and exploring on the go as needed.