UNPKG

consumerportal

Version:

mydna Custimised for you

90 lines (71 loc) 2.52 kB
/// <reference path="../includes.ts" /> module parentCtrl { import IAngularEvent = angular.IAngularEvent; import IUser = services.IUser; import IModalService = app.IModalService; interface IParentScope extends angular.IScope { disableClass: any; classNameForDifferentPopUps: any; dialogTitle: any; dialogBody: any; bindHTML: any; $sce: angular.ISCEService; ActiveDirectoryUsername: string; ActiveDirectoryName: string; modalTplToInclude: any; showMedications: boolean; showDiet: boolean; } interface IParentController { focusOnClose(focus: any): any; } class ParentController implements IParentController { static $inject = [ '$scope', '$rootScope', 'hotkeys', '$timeout', 'modalService' ]; copyRightDate: number = new Date().getFullYear(); showMenu: boolean = false; constructor( private $scope: IParentScope, private $rootScope: angular.IRootScopeService , private hotkeys: ng.hotkeys.HotkeysProvider, private $timeout: angular.ITimeoutService, private modalService: IModalService ){ $scope.$on("disable-on-save-on", () => { $scope.disableClass = "disable-on-save"; }); $scope.$on("disable-on-save-off", () => { $scope.disableClass = ""; }); $scope.$on('changeUser', (ev: IAngularEvent, user: IUser) => { this.showMenu = user !== null; }); hotkeys.add({ combo: 'esc', description: 'Close the dialog', callback: () => { this.modalService.remove(); $rootScope.$emit("resetTabIndexValue"); } }); } focusOnClose(focusId){ this.$timeout(() => { if(focusId!=''){ if (document.getElementById(focusId)) { document.getElementById(focusId).focus(); } } }, 200); } closeErrorModal() { $('#errorDialog').removeClass('in'); } } angular.module('app').controller('parentCtrl', ParentController); }