Footer Menu Utility

Overview

The Footer Menu Utility file helps a developer configure the dynamic App Menu items of the Footer Menu component. It centralizes the methods that configure the widget properties of the Container of the Footer Menu component. The Footer Menu Utility file is available under the modules/require folder of the Infinity application.

NOTE: The Footer Menu Utility file is used inside the Mobile Banking application.

Footer Menu Utility File

The Footer Menu Utility file contains the following constants and methods.

Constants

The Footer Menu Utility file configures the constants used by the Footer Menu component. These constants configure the menu name.

Here is a sample of the Constant declaration provided in the Footer Menu Utility file.

    /**@member {Object} Maintains user permissions and features*/
    this.entitlements = {
    	"features": '[]',
    	"permissions": '[]'
    };
    /**@member {Object}  Contains all footer menu constants*/
    this.footerMenuConstants = {
    	OVERVIEW: kony.i18n.getLocalizedString('i18n.common.overView'),
    	BILLPAY: kony.i18n.getLocalizedString('i18n.common.billPay'),
    	CARDS: kony.i18n.getLocalizedString('i18n.common.myCards'),
    	MENU: kony.i18n.getLocalizedString('i18n.common.menu'),
    	ACCOUNTS: kony.i18n.getLocalizedString('i18n.common.accounts'),
    	APPROVALS: kony.i18n.getLocalizedString('i18n.common.approvals'),
    	WATCHLIST: kony.i18n.getLocalizedString('i18n.common.watchlist'),
    	TRANSFER: kony.i18n.getLocalizedString('i18n.common.transfer'),
    	CONTACTUS: kony.i18n.getLocalizedString('i18n.common.contactUs'),
    	LOCATEUS: kony.i18n.getLocalizedString('i18n.common.locateUs'),
    };
    /**@member {Array} holds the list of Footer MenuItems*/
    this.menuData = {
    	"defaultMenus": [{
    			"label": this.footerMenuConstants.OVERVIEW,
    			"icon": "overview_2.png",
    			"selectedIcon": "overview.png",
    			"isActive": true,
    			"navigation": {
    				"appName": "TestMA",
    				"friendlyName": "frmFooterMenuDestination"
    			} // Component Consumer should provide valid navigation config as per flow.
    		},
    		{
    			"label": this.footerMenuConstants.MENU,
    			"icon": "menu_2.png",
    			"selectedIcon": "menu.png",
    			"isActive": false,
    			"navigation": {
    				"appName": "TestMA",
    				"friendlyName": "frmFooterMenuDestination"
    			} // Component Consumer should provide valid navigation config as per flow.
    		}
    	],
    	"customMenus": [{
    			"label": this.footerMenuConstants.WATCHLIST,
    			"icon": "watch_list_2.png",
    			"selectedIcon": "watch_list.png",
    			"isActive": false,
    			"entitlements": "['WEALTH_WATCHLIST_INSTRUMENT_VIEW','WEALTH_WATCHLIST_INSTRUMENT_CREATE']",
    			"navigation": {
    				"appName": "TestMA",
    				"friendlyName": "frmFooterMenuDestination"
    			} // Component Consumer should provide valid navigation config as per flow.
    		},
    		{
    			"label": this.footerMenuConstants.TRANSFER,
    			"icon": "transfer_2.png",
    			"selectedIcon": "transfer.png",
    			"isActive": false,
    			"entitlements": "['INTRA_BANK_FUND_TRANSFER_CREATE','TRANSFER_BETWEEN_OWN_ACCOUNT_CREATE','INTER_BANK_ACCOUNT_FUND_TRANSFER_CREATE','INTERNATIONAL_ACCOUNT_FUND_TRANSFER_CREATE','P2P_CREATE','INTRA_BANK_FUND_TRANSFER_CREATE_RECEPIENT','TRANSFER_BETWEEN_OWN_ACCOUNT_CREATE_RECEPIENT','INTER_BANK_ACCOUNT_FUND_TRANSFER_CREATE_RECEPIENT','INTERNATIONAL_ACCOUNT_FUND_TRANSFER_CREATE_RECEPIENT','P2P_CREATE_RECEPIENT']",
    			"navigation": {
    				"appName": "TestMA",
    				"friendlyName": "frmFooterMenuDestination"
    			} // Component Consumer should provide valid naviagtion config as per flow.
    		}
    	],
    	"customMenusDefault": [{
    			"label": this.footerMenuConstants.CONTACTUS,
    			"icon": "contact_us_2.png",
    			"selectedIcon": "contact_us.png",
    			"isActive": false,
    			"entitlements": "[]",
    			"navigation": {
    				"appName": "TestMA",
    				"friendlyName": "frmFooterMenuDestination"
    			} // Component Consumer should provide valid naviagtion config as per flow.
    		},
    		{
    			"label": this.footerMenuConstants.LOCATEUS,
    			"icon": "locate_us_2.png",
    			"selectedIcon": "locate_us.png",
    			"isActive": false,
    			"entitlements": "[]",
    			"navigation": {
    				"appName": "TestMA",
    				"friendlyName": "frmFooterMenuDestination"
    			} // Component Consumer should provide valid naviagtion config as per flow.
    		}
    	],
    	"notification": {
    		"icon": "menu_notification_2.png",
    		"selectedIcon": "menu_notification.png",
    		"isNotificationAvailable": false
    	}
    };}

The Constants used in the Footer Menu Utility are assigned a JSON object with the following keys.

Key Description
entitlements
  • Sets the permissions required to display a menu item.
  • This key accepts a JSON object with the following keys.
    • features: Sets the feature name for authorization.
    • permissions: Sets the permission provided to the user.
footerMenuConstants
  • Sets the text for the Footer menu items.
  • • This key accepts a JSON object with each menu item and the i18n key as a key-value pair.
menuData
  • Maps the default JSON structure for each menu item.
  • This key accepts a JSON object with the following keys.
    • defaultMenus: Defines the First and Fourth menu item data. This data contains the following key-value pairs.
      • label: The text that appears on the footer menu item.
      • icon: The image that appears on the footer menu item.
      • selectedIcon: The selected icon that appears on the footer menu item.
      • isActive: Enables or disables the footer menu item.
      • navigation: The details of the form the application navigates to with the click of the footer menu item.
    • customMenus: Defines the First and Fourth menu item data. This data contains the following key-value pairs.
      • label: The text that appears on the footer menu item.
      • icon: The image that appears on the footer menu item.
      • selectedIcon: The selected icon that appears on the footer menu item.
      • isActive: Enables or disables the footer menu item.
      • entitlements: The user permissions.
      • navigation: The details of the form the application navigates to with the click of the footer menu item.
notification
  • Configures how notifications appear on the footer menu.
  • Accepts a JSON object with the following keys.
    • icon: Image that appears as the red dot.
    • selectedIcon: Image that appears when an icon is selected.
    • isNotificationAvailable: Enables or disables the user notifications.

getFooterMenuUtilityInstance Method

This method retrieves the scope of the FooterMenuUtility file.

Parameter Value
Input parameter

NA

How to Consume from Form Controller 

onNavigate: function() {
	var footerMenuUtility = require('FooterMenuUtility');
	this.footerMenuUtility = footerMenuUtility.getFooterMenuUtilityInstance();
},

Return Type

None

updateMenuData Method

This method updates the Menus as per user preferences.

Parameter Value
Input parameter

Accepts a JSON object with either customMenus or defaultMenus as key and an array of JSON objects with the following keys as values.

  • label: The text that appears on the footer menu item.
  • icon: The image that appears on the footer menu item.
  • selectedIcon: The selected icon that appears on the footer menu item.
  • isActive: Enables or disables the footer menu item.
  • entitlements: The user permissions.
  • navigation: The details of the form the application navigates to with the click of the footer menu item.

How to Consume from Form Controller 

updateFooterMenu: function() {
	//Context data for custum menu items
	let customMenu = {
		"customMenus": [{
				"label": this.footerMenuUtility.footerMenuConstants.ACCOUNTS,
				"icon": "accounts_2.png",
				"selectedIcon": "accounts.png",
				"isActive": false,
				"entitlements": "['ACCOUNTS']",
				"navigation": {
					"appName": "TestMA",
					"friendlyName": "frmFooterMenuDestination"
				}
			},
			{
				"label": this.footerMenuUtility.footerMenuConstants.APPROVALS,
				"icon": "approvals_2.png",
				"selectedIcon": "approvals.png",
				"isActive": false,
				"entitlements": "['APPROVALS']",
				"navigation": {
					"appName": "TestMA",
					"friendlyName": "frmFooterMenuDestination"
				}
			}
		]
	};
	// Update default Footer menu items
	this.footerMenuUtility.updateMenuData(customMenu);
}

Return Type

None

setNotificationDot Method

This method enables or disables the notification dot for new or unread notifications.

Parameter Value
Input parameter

Boolean value to enable or disable the notification.

How to Consume from Form Controller 

setNotificationStatus: function() {
	// sets the notification status for user
	this.footerMenuUtility.setNotificationDot(true);
}

Return Type

None

setFooterMenuItems Method

This method sets the app level widget data Method to set app level widget data using the kony.application.setAppLevelWidget API. This API configures a container widget as a footer menu at an application level. The kony.application.setAppLevelWidget API maps the Context Data to the App level widget using the executeOnAppLevelWidget function inside the API definition.

Parameter Value
Input parameter
  • scope: The scope of the current form.
  • flexBackgroundSkin: Sets the skin for the outer FlexContainer widget. The FlexContainer background color must match the Form background color to maintain screen appearance.

How to Consume from Form Controller 

preShow: function() {
	var scope = this;
	this.footerMenuUtility.setFooterMenuItems(scope, "flxPrimary500");
}

Return Type

None

handleFooterMenuError Method

This method handles any error that occurs in the component. This method passes an error object information from the component to the Segment Template controller.

Parameter Value
Input parameter

The JSON object contains the following keys.

  • level: This key contains the String value regarding where the error occurs. It can be from the component View controller or the component Business controller.
  • method: This key contains the method to be executed when an error occurs.
  • error: This key contains the actual error message and the stack.

How to Consume from the App Level Widget Template Controller

//Gets triggered if any exception occurs in Footer Menu Component.
scope.view.FooterMenu.onError = function(errorObject) {
	scope.footerMenuUtility.handleFooterMenuError(errorObject);
};		

Return Type

NA

handleFooterMenuNavigation Method

This method binds the navigation callback actions for each menu item. These callback actions ses the destination form for each menu constant.

Parameter Value
Input parameter
  • selectedMenuItem: Contains information about the selected menu item.

How to Consume from the App Level Widget Template Controller 

//Gets triggered onSelection of Footer Menu item.
scope.view.FooterMenu.handleCallToAction = function(selectedMenuItem) {
	scope.footerMenuUtility.handleFooterMenuNavigation(selectedMenuItem);
};

Return Type

None

 

 

Copyright © 2020- Temenos Headquarters SA

Published on :
Monday, May 2, 2022 5:08:54 PM IST

Feedback
x