Show/Hide Display Controls inside a new created Bahmni Apps copy from Clinical App

Hi everyone! (@darius, @mksd)

  1. So I’d made a copy of the clinical app inside the default-config and also openmrs-module-bahmniapps and renamed to postClinical.
  2. Also I updated the postClinical app ID inside default-config/openmrs/apps/postClinical/app.json and all the related ID’s (extension-programs.json, extension.json)
  3. Done the same in the openmrs-module-bahmniapps/ui/apps/postClinical/ updated all the angular.module(‘bahmni.clinical’) to angular.module(‘bahmni.postClinical’) inside controllers, directives, services, modules, mappers, etc.
  4. Updated the gruntfile.js in order to run all the compilation and create the new postClinical inside the dist folder and it works after run the grunt command
  5. Added the new postClinical app to the home dashboard and it works without a problem, when I click the app icon it redirect me to the list of Active Patients and inside the Patient Search view I can click one patient and it redirect me to the Patient Dashboard just the same like the original Clinical app

But, I have a problem, when I want to show/hide display controls my new postClinical app sections inside the Patient Dashboard updating the default-config/openmrs/apps/postClinical/dashboard.json nothing happen.

I followed this guide in order to Show/Hide Display Control for the Clinical Apps, but it only works inside the original Clinical app (default-config/openmrs/apps/clinical/dashboard.json), not in my new postClinical app.

Any help?

Hi @cristian,

What do you mean by “nothing happens”?

Could it be that the dashboard of your post clinical app is still driven by config/openmrs/apps/clinical/dashboard.json (and not by config/openmrs/apps/postClinical/dashboard.json)?

1 Like

Hi @mksd

Well when I add this line inside one or more sections that are empty with No data => “hideEmptyDisplayControl”: true

It suppost to hide the section, also when I delete a section inside config/openmrs/apps/postClinical/dashboard.json the dashboard remain the same with all the default sections.

About this: Could it be that the dashboard of your post clinical app is still driven by config/openmrs/apps/clinical/dashboard.json (and not by config/openmrs/apps/postClinical/dashboard.json)?

Well I just check that and is correct, the /clinical/dashboard.json file is still driven the postClinical app. How I can change that?

Thanks for your reply!

So, at the End there was two updates that I need it inside openmrs-module-bahmniapps/ui/apps/postClinical/initialization.js :

var initApp = function () {
                    return appService.initApp('postClinical', {
                        'app': true,
                        'extension': true
                    }, config, ["dashboard", "visit", "medication"]);
                };

                var loadFormConditionsIfOffline = function () {
                    var isOfflineApp = offlineService.isOfflineApp();
                    if (isOfflineApp) {
                        if (offlineService.isAndroidApp()) {
                            offlineDbService = androidDbService;
                        }
                        return offlineDbService.getConfig("postClinical").then(function (config) {
                            var script = config.value['formConditions.js'];
                            eval(script); // eslint-disable-line no-eval
                        });
                    }
                };

Two lines:

  1. initApp(‘postClinical’,…) => (I didn’t updated from initApp(‘clinical’, …))
  2. getConfig(“postClinical”) => The Same

Now my postClinical/dashboard.json is separated from the clinical/dashboard.json

Thanks @mksd for your observation!

1 Like