aboutsummaryrefslogtreecommitdiffstats
path: root/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-02-14 19:41:00 -0500
committerPamela Dragosh <pdragosh@research.att.com>2017-02-14 19:41:32 -0500
commit91d04c64771832a0b8815ffbe1f0f9920320d94d (patch)
treefb02d5e1c84a3d91def9a7ee95bc87f9c046cc96 /ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives
parentb9d4caa40ef8e3566ac475968bce17b9b64b6939 (diff)
Initial OpenECOMP policy/engine commit
Change-Id: I7dbff37733b661643dd4d1caefa3d7dccc361b6e Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives')
-rw-r--r--ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt0
-rw-r--r--ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js30
-rw-r--r--ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js504
-rw-r--r--ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js203
4 files changed, 737 insertions, 0 deletions
diff --git a/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt
diff --git a/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js
new file mode 100644
index 000000000..a2dab75c2
--- /dev/null
+++ b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js
@@ -0,0 +1,30 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.directive('qFooter', function () {
+ return {
+ restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements
+ replace: false,
+ templateUrl: "app/fusion/scripts/view-models/footer.html",
+ controller: ['$scope', '$filter', function ($scope, $filter) {
+ // Your behaviour goes here :)
+ }]
+ }
+});
+
diff --git a/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js
new file mode 100644
index 000000000..bc90d2005
--- /dev/null
+++ b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js
@@ -0,0 +1,504 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+app.directive('qHeader', function () {
+ return {
+ restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements
+ replace: false,
+ templateUrl: "app/fusion/scripts/view-models/header.html",
+ controller: ['$scope', '$filter','$http','$timeout', '$log','UserInfoService', '$window', '$cookies', function ($scope, $filter, $http, $timeout, $log,UserInfoService, $window, $cookies) {
+
+ /*Define fields*/
+ $scope.userName;
+ $scope.userFirstName;
+ $scope.redirectUrl;
+ $scope.contactUsUrl;
+ $scope.getAccessUrl;
+ $scope.childData=[];
+ $scope.parentData=[];
+ $scope.menuItems = [];
+ $scope.loadMenufail=false;
+ $scope.megaMenuDataObject=[];
+ $scope.activeClickSubMenu = {
+ x: ''
+ };
+ $scope.activeClickMenu = {
+ x: ''
+ };
+ $scope.favoritesMenuItems = [];
+ $scope.favoriteItemsCount = 0;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ $scope.favoritesWindow = false;
+
+ /*Menu Structure*/
+ var menuStructureConvert = function(menuItems) {
+ console.log(menuItems);
+ $scope.megaMenuDataObjectTemp =
+ [
+ {
+ text: "ECOMP",
+ children: menuItems
+ },
+ {
+ text: "Help",
+ children: [
+ {
+ text:"Contact Us",
+ url:$scope.contactUsUrl
+ },
+ {
+ text:"Get Access",
+ url:$scope.getAccessUrl
+ }]
+ }
+ ];
+ return $scope.megaMenuDataObjectTemp;
+ };
+
+ /***************functions**************/
+ /*Put user info into fields*/
+ $scope.inputUserInfo = function(userInfo){
+ if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
+ if(typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null){
+ $scope.userFirstName = userInfo.USER_FIRST_NAME;
+ }
+ }
+ }
+ /*getting user info from session*/
+ $scope.getUserNameFromSession = function(){
+ UserInfoService.getFunctionalMenuStaticDetailSession()
+ .then(function (res) {
+ $scope.contactUsUrl=res.contactUsLink;
+ $scope.userName = res.userName;
+ $scope.userFirstName = res.firstName;
+ $scope.redirectUrl = res.portalUrl;
+ $scope.getAccessUrl = res.getAccessUrl;
+ });
+ }
+ $scope.getTopMenuStaticInfo=function() {
+ var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
+ promise.then(
+ function(res) {
+ if(res==null || res==''){
+ $log.info('failed getting static User information');
+ $scope.getUserNameFromSession();
+ }else{
+ $log.info('Received static User information');
+
+ var resData = res;
+ console.log(resData);
+ $scope.inputUserInfo(resData);
+ $scope.userName = $scope.firstName+ ' '+ $scope.lastName;
+ }
+ },
+ function(err) {
+ $log.info('failed getting static User information');
+ }
+ );
+ }
+
+ $scope.returnToPortal=function(){
+ window.location.href = $scope.redirectUrl;
+ }
+
+ var unflatten = function( array, parent, tree ){
+ tree = typeof tree !== 'undefined' ? tree : [];
+ parent = typeof parent !== 'undefined' ? parent : { menuId: null };
+ var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
+ if( !_.isEmpty( children ) ){
+ if( parent.menuId === null ){
+ tree = children;
+ }else{
+ parent['children'] = children
+ }
+ _.each( children, function( child ){ unflatten( array, child ) } );
+ }
+ return tree;
+ }
+
+ $scope.getMenu=function() {
+ $scope.getTopMenuStaticInfo();
+ $http({
+ method: "GET",
+ url: 'get_functional_menu',
+// TIMEOUT USED FOR LOCAL TESTING ONLY
+// timeout: 100
+ }).success(function (response) {
+
+ if (response == '101: Timeout') {
+ $log.debug('Timeout attempting to get_functional_menu');
+ $scope.megaMenuDataObject = menuStructureConvert("");
+// $scope.createErrorMenu();
+ //$scope.loadMenufail=true;
+ } else {
+ if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
+ $log.debug('Timeout attempting to get_functional_menu');
+ $scope.menuItems = unflatten( response);
+ $scope.megaMenuDataObject = menuStructureConvert($scope.menuItems);
+// $scope.createErrorMenu();
+ //$scope.loadMenufail=true;
+ }else{
+ $scope.loadMenufail=false;
+ $scope.contactUsURL = response.contactUsLink;
+ $log.debug('functional_menu',response);
+ $scope.megaMenuDataObject = menuStructureConvert("");
+ }
+ }
+ }).error(function (response){
+ $scope.megaMenuDataObject = menuStructureConvert("");
+// $scope.createErrorMenu();
+ //$scope.loadMenufail=true;
+ $log.debug('REST API failed get_functional_menu...');
+ });
+
+ }
+
+ $scope.adjustHeader=function() {
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 70;
+ $scope.drawer_custom_top = 54;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 60;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 10;
+ }
+
+ }
+
+ $scope.getMenu();
+ $scope.adjustHeader();
+
+/* **************************************************************************/
+/* Logic for the favorite menus is here */
+
+ $scope.loadFavorites = function () {
+ $log.debug('loadFavorites has happened.');
+ if ($scope.favoritesMenuItems == '') {
+ $scope.generateFavoriteItems();
+ $log.debug('loadFavorites is calling generateFavoriteItems()');
+ } else {
+ $log.debug('loadFavorites is NOT calling generateFavoriteItems()');
+ }
+ }
+
+ $scope.goToUrl = function (item) {
+ $log.info("goToUrl called")
+ $log.info(item);
+
+ var url = item.url;
+ var restrictedApp = item.restrictedApp;
+ $log.debug('Restricted app status is: ' + restrictedApp);
+ if (!url) {
+ $log.info('No url found for this application, doing nothing..');
+ return;
+ }
+ if (restrictedApp) {
+ $window.open(url, '_blank');
+ } else {
+ $window.open(url, '_self');
+ }
+
+ }
+
+ $scope.submenuLevelAction = function(index, column) {
+ if ($scope.favoritesMenuItems == '') {
+ $scope.generateFavoriteItems();
+ $log.debug('submenuLevelAction is calling generateFavoriteItems()');
+ }
+ $log.debug('item hovered/clicked: ' + index + '; column = ' + column);
+ if (column == 2) { // 2 is Design
+ $scope.favoritesWindow = false;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+ if (index=='Favorites' && $scope.favoriteItemsCount != 0) {
+ $log.debug('Showing Favorites window');
+ $scope.favoritesWindow = true;
+ $scope.showFavorites = true;
+ $scope.emptyFavorites = false;
+ }
+ if (index=='Favorites' && $scope.favoriteItemsCount == 0) {
+ $log.debug('Hiding Favorites window in favor of No Favorites Window');
+ $scope.favoritesWindow = true;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = true;
+ }
+ if (column > 2) {
+ $scope.favoritesWindow = false;
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+ };
+
+ $scope.hideFavoritesWindow = function() {
+ $log.debug('$scope.hideFavoritesWindow has been called');
+ $scope.showFavorites = false;
+ $scope.emptyFavorites = false;
+ }
+
+ $scope.isUrlFavorite = function (menuId) {
+// $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId);
+ var jsonMenu = JSON.stringify($scope.favoritesMenuItems);
+ var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId);
+ if (isMenuFavorite==-1) {
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+
+ $scope.generateFavoriteItems = function() {
+ $http({
+ method: "GET",
+ url: 'get_favorites',
+// TIMEOUT USED FOR LOCAL TESTING ONLY
+// timeout: 100
+ }).success(function (response) {
+ if (response == '101: Timeout') {
+ $log.error('Timeout attempting to get_favorites_menu');
+ } else {
+ if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
+ $log.error('REST API failed get_favorites' + response);
+ }else{
+ $log.debug('get_favorites = ' + JSON.stringify(response));
+ $scope.favoritesMenuItems = response;
+ $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
+ $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
+ }
+ }
+ }).error(function (response){
+ $log.error('REST API failed get_favorites' + response);
+//createFavoriteErrorMenu() USED FOR LOCAL TESTING ONLY
+// $scope.createFavoriteErrorMenu();
+ });
+ }
+
+ $scope.createFavoriteErrorMenu=function() {
+ $scope.favoritesMenuItems = [];
+ $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
+ $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
+ }
+
+ /* end of Favorite Menu code */
+ /* **************************************************************************/
+
+
+ /* **************************************************************************/
+ // THIS IS USED FOR LOCAL TESTING ONLY
+ /* **************************************************************************/
+ $scope.createErrorMenu=function() {
+ $log.debug('Creating fake menu now...');
+// $scope.loadMenufail=true;
+ $scope.menuItems = [
+ {
+ "menuId": 1,
+ "column": 2,
+ "text": "Design",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 2,
+ "column": 3,
+ "text": "Infrastructure Ordering",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 3,
+ "column": 4,
+ "text": "Service Creation",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 4,
+ "column": 5,
+ "text": "Service Mgmt",
+ "parentMenuId": null,
+ "url": ""
+ },
+ {
+ "menuId": 90,
+ "column": 1,
+ "text": "Google",
+ "parentMenuId": 1,
+ "url": ""
+ },
+ {
+ "menuId": 91,
+ "column": 1,
+ "text": "Mike Little's Coffee Cup",
+ "parentMenuId": 2,
+ "url": ""
+ },
+ {
+ "menuId": 92,
+ "column": 2,
+ "text": "Andy and his Astrophotgraphy",
+ "parentMenuId": 3,
+ "url": ""
+ },
+ {
+ "menuId": 93,
+ "column": 1,
+ "text": "JSONLint",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 94,
+ "column": 2,
+ "text": "HROneStop",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 95,
+ "column": 2,
+ "text": "4th Level App4a R16",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 96,
+ "column": 3,
+ "text": "3rd Level App1c R200",
+ "parentMenuId": 4,
+ "url": ""
+ },
+ {
+ "menuId": 97,
+ "column": 1,
+ "text": "3rd Level App4b R16",
+ "parentMenuId": 5,
+ "url": ""
+ },
+ {
+ "menuId": 98,
+ "column": 2,
+ "text": "3rd Level App2b R16",
+ "parentMenuId": 5,
+ "url": ""
+ },
+ {
+ "menuId": 99,
+ "column": 1,
+ "text": "Favorites",
+ "parentMenuId": null,
+ "url": ""
+ }
+ ];
+ $scope.menuItems = unflatten( $scope.menuItems );
+ //remove this
+ $scope.megaMenuDataObject = menuStructureConvert($scope.menuItems);
+ }
+ }]
+ }
+});
+
+app.filter("ellipsis", function(){
+ return function(text, length){
+ if (text) {
+ var ellipsis = text.length > length ? "..." : "";
+ return text.slice(0, length) + ellipsis;
+ };
+ return text;
+ }
+});
+
+function reloadPageOnce() {
+ if( window.localStorage )
+ {
+ if( !localStorage.getItem('firstLoad') )
+ {
+ localStorage['firstLoad'] = true;
+ window.location.reload();
+ }
+ else
+ localStorage.removeItem('firstLoad');
+ }
+}
+app.controller('loginSnippetCtrl', function ($scope,$http, $log,UserInfoService){
+ /*Define fields*/
+ $scope.userProfile={
+ firstName:'',
+ lastName:'',
+ fullName:'',
+ email:'',
+ userid:''
+ }
+ /*Put user info into fields*/
+ $scope.inputUserInfo = function(userInfo){
+ if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
+ if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='')
+ $scope.userProfile.firstName = userInfo.USER_FIRST_NAME;
+ if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='')
+ $scope.userProfile.lastName = userInfo.USER_LAST_NAME;
+ if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='')
+ $scope.userProfile.email = userInfo.USER_EMAIL;
+ if (typeof(userInfo.USER_ORGUSERID) != "undefined" && userInfo.USER_ORGUSERID!=null && userInfo.USER_ORGUSERID!='')
+ $scope.userProfile.userid = userInfo.USER_ORGUSERID;
+ }
+ }
+ /*getting user info from session*/
+ $scope.getUserNameFromSession = function(){
+ UserInfoService.getFunctionalMenuStaticDetailSession()
+ .then(function (response) {
+ $scope.userProfile.fullName = response.userName;
+ $scope.userProfile.userid = response.userid;
+ $scope.userProfile.email = response.email;
+ });
+ }
+ /*getting user info from shared context*/
+ $scope.getUserName=function() {
+ var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
+ promise.then(
+ function(res) {
+ if(res==null || res==''){
+ $log.info('Getting User information from session');
+ $scope.getUserNameFromSession();
+
+ }else{
+ $log.info('Received User information from shared context',res);
+ var resData = res;
+ console.log(resData);
+ $scope.inputUserInfo(resData);
+ $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
+ }
+ },
+ function(err) {
+ console.log('error');
+ }
+ );
+ };
+ /*call the get user info function*/
+ try{
+ $scope.getUserName();
+ }catch(err){
+ $log.info('Error while getting User information',err);
+ }
+});
diff --git a/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js
new file mode 100644
index 000000000..737cb8012
--- /dev/null
+++ b/ecomp-sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js
@@ -0,0 +1,203 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+
+app.directive('qMenu', function () {
+ return {
+ restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements
+ replace: false,
+ templateUrl: "app/fusion/scripts/view-models/left_menu.html",
+ controller: ['$scope', '$filter','$http','$timeout','$cookies','LeftMenuService', function ($scope, $filter, $http,$timeout,$cookies,LeftMenuService) {
+
+ $scope.leftChildData=[];
+ $scope.leftParentData=[];
+ $scope.leftMenuItems = [];
+ $scope.app_name = "";
+ $scope.app_name_full;
+ LeftMenuService.getLeftMenu().then(function(response){
+ var j = response;
+ try{
+ if(j && j !== "null" && j!== "undefined"){
+ $scope.leftParentData = JSON.parse(j.data);
+ $scope.leftChildData = JSON.parse(j.data2);
+ }else{
+ throw "Get Left Menu respsone is not an object/is empty";
+ }
+ try{
+ var leftChildItemList = $scope.leftChildData;
+ var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1];
+ var leftParentList =$scope.leftParentData;
+ for (var i = 0; i < leftParentList.length; i++) {
+ $scope.item = {
+ parentLabel : leftParentList[i].label,
+ parentAction : leftParentList[i].action,
+ parentImageSrc : leftParentList[i].imageSrc,
+ open:pageUrl==leftParentList[i].action?true:false,
+ childItemList : leftChildItemList[i]
+ }
+ $scope.leftMenuItems.push($scope.item);
+ };
+ }catch(err){
+ console.log("error happened while trying to set left menu structure"+err);
+ }
+ }catch (e) {
+ console.log("error happened while trying to get left menu items"+e);
+ reloadPageOnce();
+ return;
+ }
+ },function(error){
+ console.log("error happened while calling getLeftMenu"+error);
+ });
+
+ LeftMenuService.getAppName().then(function(response){
+ var j = response;
+ try{
+ if(j && j !== "null" && j!== "undefined"){
+ console.log("app name is " + $scope.app_name);
+ $scope.app_name_full = j.data;
+ var processed_app_name = j.data;
+ var n = processed_app_name.length;
+ if (n > 15) {
+ n = 15;
+ }
+ $scope.app_name = processed_app_name.substr(0, n);
+ }else{
+ throw "Get app_name respsone is not an object/is empty";
+ }
+ }catch (e) {
+ console.log("error happened while trying to get app name "+e);
+ return;
+ }
+ },function(error){
+ console.log("error happened while calling getAppName "+error);
+ });
+
+ $scope.adjustHeader=function() {
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 50;
+ $scope.drawer_custom_top = 20;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 0;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 0;
+ }
+
+
+ };
+
+ $scope.adjustHLeftMenu = function (type){
+ $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
+
+ if($scope.showHeader == true) {
+ $scope.drawer_margin_top = 60;
+ $scope.drawer_custom_top = 54;
+ $scope.toggle_drawer_top = 55;
+ }
+ else {
+
+ $scope.drawer_margin_top = 50;
+ $scope.drawer_custom_top = 0;
+ $scope.toggle_drawer_top = 10;
+ }
+ if(type=='burgerIcon'){
+ return { "top": $scope.toggle_drawer_top+"px"};
+ }else if(type=='leftMenu'){
+ return { "margin-top": $scope.drawer_margin_top+"px"};
+ }else
+ return;
+ }
+ $scope.adjustHeader();
+ $scope.drawerOpen = true;
+
+ $scope.toggleDrawer = function() {
+ $scope.drawerOpen = !($scope.drawerOpen);
+ if ($scope.drawerOpen) {
+ // setCookie('drawerOpen','open',30);
+ $scope.arrowShow = true;
+
+
+ if (document.getElementById('fnMenueContent')!=null)
+ document.getElementById('fnMenueContent').style.marginLeft = "0px";
+
+ if (document.getElementById('rightContentAdmin')!=null)
+ document.getElementById('rightContentAdmin').style.marginLeft = "210px";
+
+ else if (document.getElementById('rightContentProfile')!=null)
+ document.getElementById('rightContentProfile').style.marginLeft = "210px";
+
+
+
+ } else {
+
+ $scope.arrowShow = false;
+
+ if (document.getElementById('fnMenueContent')!=null)
+ document.getElementById('fnMenueContent').style.marginLeft = "-150px";
+
+ if (document.getElementById('rightContentAdmin')!=null) {
+ document.getElementById('rightContentAdmin').style.marginLeft = "50px";
+
+ }
+
+ else if (document.getElementById('rightContentProfile')!=null)
+ document.getElementById('rightContentProfile').style.marginLeft = "50px";
+
+
+
+
+ }
+ };
+
+ $timeout(function() {
+ detectScrollEvent();
+ }, 800);
+ }]
+ }
+
+});
+$(window).scroll(function() {
+ if ($('.att-drawer').is(':visible')) {
+ detectScrollEvent();
+ }
+
+});
+
+function detectScrollEvent() {
+ try{
+ var footerOff = $('#footerContainer').offset().top;
+ var headOff = $('#headerContainer').offset().top;
+ var winHeight = $(window).height();
+ if ((footerOff - headOff) <= winHeight) {
+ $('.att-drawer').css({
+ "height" : footerOff - headOff - 55
+ });
+ } else {
+ $('.att-drawer').css({
+ "height" : "94vh"
+ });
+ }
+ }catch(err){
+ console.log(err)
+ }
+}