Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed collapsible due to Atlassian bug

Purpose

Excerpt

Bahmni allows implementers to create their own Custom Controls. The examples include:

Configuration

Tip
titleWhere to Configure ?

Add to clinical/dashboard.json for it to appear on the patient dashboard or Add to clinical/visit.json for it to appear on the visit dashboard.


Sample Configuration

Code Block
languagejs
titleConfig
linenumberstrue
collapsetrue
"customControl": {
            "type": "custom",
            "config": {
                "title": "Title of the Control",
                "template": "<directive-name></directive-name>"
            }
       }

Key Field Table

KeyInformationMandatory
type

type of the section or control.

type should be "custom"

Yes
config

Configuration for the custom display control.

keyInformationMandatory
titletitle to be displayedYes
templatethe directive to be used to show the controlYes


Yes



Bahmni allows implementers to create their own custom display control.

Custom Control on Visit Dashboard

The following configuration needs to be added in visit.json (openmrs/apps/clinical/visit.json) to display the custom display control in different visit tabs.

Consider the following example to configure the birth certificate:

Code Block
languagejs
linenumberstrue
"birthCertificate": {
    "title": "Birth Certificate",
    "printing": {
        "title": "Bahmni",
        "header": "Certificate",
        "logo": "../images/bahmniLogo.png"
    },
    "sections": {
        "Birth Certificate": {
            "type": "custom",
            "config": {
                "title": "Birth Certificate",
                "template": "<birth-certificate></birth-certificate>"
            }
        }
    }
}


KeyInformation
titleTitle of the visit tab.Y

printing

Add printing section to enable the print button on visit page.Y

title - Title in print out.

header - Header in print out.

logo - Logo to display in print out.
type"custom" (Required and should always be custom)Y
configconfiguration for the custom display control.

title - title of the custom directive

Y

template - the directive which you want to show.Y


Custom control on Patient Dashboard

The following configuration needs to be added under sections in dashboard.json (openmrs/apps/clinical/dashboard.json) to display the custom display control in different dashboard tabs.

Consider the following example to configure the birth certificate:

Code Block
languagejs
linenumberstrue
"General": {
    "translationKey": "DASHBOARD_TAB_GENERAL_KEY",
    "sections": {
        "Birth Certificate": {
            "type": "custom",
            "config": {
                "title": "Birth Certificate",
                "template": "<birth-certificate></birth-certificate>"
            }
        }
    }
}


KeyInformationMandatory
type*"custom" (Required and should always be custom)Y
config

configuration for the custom display control.

keyInformation
titletitle of the custom directiveY
templatethe directive which you want to showY



Bahmni provides customDisplayControl module which provides basic connection between the application and configuration.

You can add new directives as per your requirement in the "openmrs/apps/customDisplayControl/js/customControl.js" file. (Make sure you can create new custom directives only in the existing file)

New directives should be under the same module. ("bahmni.common.displaycontrol.custom"). The scope of the new directive will have patient, visitUuid and config.


Note

1. Make sure you don't create a different file for new directives (all custom directives should be in the same file.)
2. Don't forget to change the contentUrl to the html file you are referring to.



Panel
titleColorwhite
titleBGColor#1FA5A0
titleSample Custom Controls
Child pages (Children Display)
alltrue


Panel
titleColorwhite
titleBGColor#1FA5A0
titleList of All Display Controls
Child pages (Children Display)
alltrue
pageDisplay Controls