angular.module("kalgudiApp.config",["restangular"]) .constant("themeBasePath",'app/themes/mobile_app/') .constant("restBasePath",SERVICES_CONSTRUCTED_URL) .constant("SERVER_IP",SERVER_IP) .config(["RestangularProvider","$httpProvider", function(restangular,$httpProvider) { //initialize get if not there if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.get = {}; } $httpProvider.interceptors.push(function() { return { 'request': function(config) { var countryId= window.localStorage['countryId']; var username= countryId + window.localStorage['username']; var password= window.localStorage['password']; var appVersion = window.localStorage['APP_VERSION']; config.headers['userName'] = username; config.headers['password'] = password; config.headers['appversion'] = appVersion; return config; } }; }); //disable IE ajax request caching $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache'; /* to make cros domain ajax calls */ $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; restangular.setBaseUrl(SERVICES_CONSTRUCTED_URL); restangular.setDefaultHeaders({ "Content-Type": "application/json" }); } ]); var kalgudiapp=angular.module("kalgudiApp",["ionic","ngIOS9UIWebViewPatch","ngMap","ngAudio","exceptionOverride","ionic-datepicker","ionic-timepicker","restangular","kalgudiApp.config","kalgudiApp.myconnects","kalgudiApp.mybusiness","kalgudiApp.basicApp","kalgudiApp.agriInput","kalgudiApp.farmer","kalgudiApp.coApp","kalgudiApp.intermediaryApp","kalgudiApp.agencyApp","kalgudiApp.mytransporter","kalgudiApp.mywarehouse","kalgudiApp.myaccounts","kalgudiApp.mycontent", "angularFileUpload","kalgudiApp.profile","kalgudiApp.shareqa","kalgudiApp.groups","kalgudiApp.pages", "kalgudiApp.programs", "monospaced.elastic","kalgudiApp.chat","kalgudiApp.surveys", "kalgudiApp.meetings", "kalgudiApp.eCommerce", "angularRipple",'focus-if','ngFileUpload']) kalgudiapp.config(["$stateProvider","$urlRouterProvider","$ionicConfigProvider","themeBasePath","RestangularProvider","$controllerProvider", "$compileProvider", "$filterProvider", "$provide", function($stateProvider,$urlRouterProvider,$ionicConfigProvider,themeBasePath,restangular,$controllerProvider, $compileProvider, $filterProvider, $provide) { kalgudiapp.controllerProvider = $controllerProvider; kalgudiapp.compileProvider = $compileProvider; kalgudiapp.filterProvider = $filterProvider; kalgudiapp.provide = $provide; kalgudiapp.factory = $provide.factory; kalgudiapp.service = $provide.service; $ionicConfigProvider.views.swipeBackEnabled(false); $ionicConfigProvider.views.transition('none'); // Disable ion view cache $ionicConfigProvider.views.maxCache(0); $stateProvider.state('home', { url: "/home", templateUrl: 'app/core/html/empty.html', data:{ action : "home", moduleAction : "home", currentmodule : "home", title:"COMMON_KALGUDI", module: "content", screenId: "home-page" } }) .state('kalgudi404', { url: '/404Error', templateUrl: themeBasePath+'shared/error.html', data:{ action : "404Error", moduleAction : "404Error", currentmodule : "myprofile" } }) .state('weatherfullview', { url: "/weatherfullview", templateUrl: themeBasePath+'mycontent/weatherfullview.html', data : { action : "weatherfullview", module : "weatherfullview", currentmodule : "weatherfullview", screenId : "weatherfullview", title:"Weather" } }) .state('forexfullview', { url: "/forexfullview", templateUrl: themeBasePath+'mycontent/forexfullview.html', data : { action : "forexfullview", module : "forexfullview", currentmodule : "forexfullview", screenId : "forexfullview", title:"Forex" } }) .state('searchincontent', { url: '/searchincontent', templateUrl: themeBasePath+'shared/searchincontent.html', controller : "searchController", data:{ action : "searchincontent", moduleAction : "searchincontent", currentmodule : "searchincontent" } }) .state('helpandlegal', { url: "/helpandlegal", templateUrl: themeBasePath+'shared/helpandlegal.html', data : { action : "helpandlegal", module : "help&legal", currentmodule : "helpandlegal", screenId : "helpandlegal", /*title:"COMMON_TITLE_ABOUT"*/ } }) .state('mobile_about', { url: "/mobile_about", templateUrl: themeBasePath+'shared/mobile_about.html', data : { action : "mobile_about", module : "mobile_about", currentmodule : "mobile_about", screenId : "mobile_about", title:"" } }) .state('mobile_disclaimer', { url: "/mobile_disclaimer", templateUrl: themeBasePath+'shared/mobile_aboutUs.html', controller : "aboutusController", data : { action : "mobile_disclaimer", module : "mobile_disclaimer", currentmodule : "mobile_disclaimer", screenId : "mobile_disclaimer", title:"COMMON_TITLE_DISCLAIMER" } }) .state('mobile_faq', { url: "/mobile_faq", templateUrl: themeBasePath+'shared/mobile_faq.html', data : { action : "mobile_faq", module : "mobile_faq", currentmodule : "mobile_faq", screenId : "mobile_faq", title:"COMMON_TITLE_FAQ" } }) .state('mobile_contact', { url: "/mobile_contact", templateUrl: themeBasePath+'shared/mobile_contactus.html', data : { action : "mobile_contact", module : "mobile_contact", currentmodule : "mobile_contact", screenId : "mobile_contact", title:"COMMON_TITLE_CONTACT_US" } }) .state('mobile_termsconditions', { url: "/mobile_termsconditions", templateUrl: themeBasePath+'shared/mobile_aboutUs.html', controller : "aboutusController", data : { action : "mobile_termsconditions", module : "mobile_termsconditions", currentmodule : "mobile_termsconditions", screenId : "mobile_termsconditions", title:"" } }) .state('mobile_privacy', { url: "/mobile_privacy", templateUrl: themeBasePath+'shared/mobile_aboutUs.html', controller : "aboutusController", data : { action : "mobile_privacy", module : "mobile_privacy", currentmodule : "mobile_privacy", screenId : "mobile_privacy", title:"" } }) .state('mobile_copyright', { url: "/mobile_copyright", templateUrl: themeBasePath+'shared/mobile_aboutUs.html', controller : "aboutusController", data : { action : "mobile_copyright", module : "mobile_copyright", currentmodule : "mobile_copyright", screenId : "mobile_copyright", title:"COMMON_TITLE_COPYRIGHT" } }) .state('mobile_postrules', { url: "/mobile_postrules", templateUrl: themeBasePath+'shared/mobile_postingrules.html', data : { action : "mobile_postrules", module : "mobile_postrules", currentmodule : "mobile_postrules", screenId : "mobile_postrules", title:"COMMON_TITLE_POSTING_RULE" } }) .state('faq', { url: "/faq", templateUrl: themeBasePath+'shared/faq.html', controller : "helpandlegalController", data : { action : "faq", module : "faq", currentmodule : "faq", screenId : "faq" } }) .state('privacypolicy', { url: "/privacypolicy", templateUrl: themeBasePath+'shared/privacypolicy.html', controller : "helpandlegalController", data : { action : "privacypolicy", module : "privacypolicy", currentmodule : "privacypolicy", screenId : "privacypolicy", title:"COMMON_TITLE_PRIVACY_POLICY" } }) .state('termsandconditions', { url: "/termsandconditions", templateUrl: themeBasePath+'shared/termsandconditions.html', controller : "helpandlegalController", data : { action : "termsandconditions", module : "termsandconditions", currentmodule : "termsandconditions", screenId : "termsandconditions", title:"COMMON_TITLE_TERM_OF_USE" } }) .state('About', { url: "/About", templateUrl: themeBasePath+'shared/About.html', controller : "helpandlegalController", data : { action : "About", module : "About", currentmodule : "About", screenId : "About", title:"COMMON_TITLE_ABOUT" } }) /*.state('Console', { url: "/Console", templateUrl: themeBasePath+'shared/Console.html', data : { action : "Console", module : "Console", currentmodule : "Console", screenId : "Console" } })*/ .state('contactus', { url: "/contactus", templateUrl: themeBasePath+'shared/contactus.html', controller : "helpandlegalController", data : { action : "contactus", module : "contactus", currentmodule : "contactus", screenId : "contactus", title:"COMMON_TITLE_CONTACT_US" } }) .state('Disclaimer', { url: "/Disclaimer", templateUrl: themeBasePath+'shared/Disclaimer.html', controller : "helpandlegalController", data : { action : "Disclaimer", module : "Disclaimer", currentmodule : "Disclaimer", screenId : "Disclaimer", title:"COMMON_TITLE_DISCLAIMER" } }) .state('searchpage', { url: '/searchpage', templateUrl: themeBasePath+'shared/searchpage.html', controller : "searchController", cache:false, data:{ action : "searchpage", moduleAction : "searchpage", currentmodule : "searchpage", screenId : "searchpage", title:"COMMON_TITLE_SEARCH" } }) .state('advanceSearch', { url : '/advanceSearch', templateUrl : themeBasePath+'shared/advance-search.html', cache : false, data : { action : "advance-search-options", moduleAction : "advance-search", currentmodule : "search", screenId : "advance-search-options", title:"Advance search" } }) .state('searchall', { url: '/searchall/:paramkey', templateUrl: themeBasePath+'shared/searchall.html', controller : "searchController", cache:false, data:{ action : "searchall", moduleAction : "searchall", currentmodule : "searchall", screenId : "searchall", title:"COMMON_TITLE_SEARCH" } }) .state('setpin', { url: "/setpin", templateUrl: themeBasePath+'myprofile/setpin.html', controller : "advanceSettingsController", data : { action : "setpin", module : "setpin", currentmodule : "setpin", screenId : "setpin", title:"COMMON_TITLE_SETTINGS" } }) .state('changePassword', { url: "/changePassword", templateUrl: themeBasePath+'myprofile/changePassword.html', controller : "advanceSettingsController", data : { action : "changePassword", module : "changePassword", currentmodule : "changePassword", title:"COMMON_TITLE_CHANGE_PASSWORD" } }) .state('switchLanguage', { url: "/switchLanguage", templateUrl: themeBasePath+'myprofile/languageSwitch.html', controller : "advanceSettingsController", data : { action : "languageSwitch", module : "languageSwitch", currentmodule : "languageSwitch", title:"COMMON_TITLE_LANGUAGE_SWITCH" } }) .state('kalgudiDownloads', { url: "/kalgudiDownloads", templateUrl: themeBasePath+'shared/downloadall.html', cache:false, controller : "downloadsController", data : { action : "kalgudiDownloads", module : "kalgudiDownloads", currentmodule : "kalgudiDownloads", title:"COMMON_TITLE_KALGUDI_DOWNLOADS" } }) .state('share', { url: "/share", templateUrl: themeBasePath+'shared/quickShare.html', cache:false, controller : "shareViaController", data : { action : "quickShare", module : "quickShare", currentmodule : "quickShare", screenId : "quickShare" } }) .state('shareVia', { url: '/shareVia/:shareType/:subject/:link', templateUrl: themeBasePath+'shared/shareVia.html', cache:false, controller : "shareViaController", data : { action : "shareVia", module : "shareVia", currentmodule : "shareVia", screenId : "shareVia" } }) .state('referUs', { url: "/referUs/:id/:token", templateUrl: themeBasePath+'shared/refercontacts.html', cache:false, controller : "referContactsController", data : { action : "refercontacts", module : "refercontacts", currentmodule : "refercontacts", screenId : "refercontacts" } }) .state('referContacts', { url: "/referContacts", templateUrl: themeBasePath+'shared/refercontacts.html', controller : "advanceSettingsController", data : { action : "referContacts", module : "referContacts", currentmodule : "referContacts" } }) /*.state('pendingActions', { url: "/pendingActions/:state", templateUrl: themeBasePath+'shared/pendingActions.html', controller : "pendingActionsController", data : { action : "pendingActions", module : "pendingActions", currentmodule : "pendingActions" } })*/ .state('qaRecommendation', { url: '/qaRecommendation', templateUrl: themeBasePath+'shared/qaRecommendation.html', controller : "qaRecommendationController", data:{ action : "qaRecommendation", currentmodule : "qaRecommendation", module : "qaRecommendation" } }) .state('kalgudiMessages', { url: "/kalgudiMessages", templateUrl: themeBasePath+'shared/kalgudiMessages.html', controller : "kalgudiMessagesController", data : { action : "kalgudiMessages", module : "kalgudiMessages", currentmodule : "kalgudiMessages" } }) .state('alerts', { url: '/alerts', templateUrl: themeBasePath+'shared/alerts.html', controller : "alertsAndOpportunityController", data:{ action : "alertList", currentmodule : "alert", module : "recommendation", title: "HOME_FEED_ALERTS" } }) .state('fullviewsNew', { url: '/fullview/:key', templateUrl: themeBasePath+'dashboard/fullview.html', controller : "alertController", data:{ action : "fullview", currentmodule : "newsFeed", module : "newsFeed" } }) .state('priceUpdateFullView', { // Price recommendation state definition url : '/price-updates/:productId', templateUrl : themeBasePath + 'dashboard/fullViewTemplate/price-update-fullview.html', controller : 'pricesRecommendationController', data : { action : 'fullview', currentmodule : 'priceUpdate', module : 'newsFeed', title : 'PRICE_UPDATES' } }).state('helperText', { url: '/helper', templateUrl: themeBasePath+'dashboard/helper.html', controller : "helperController", data:{ action : "help", currentmodule : "helper", module : "help", title : "HELP_TITLE" } }).state('smsCreditSetting', { url: "/smsCreditSetting", templateUrl: themeBasePath+'myprofile/smsSetting.html', controller : "smsSettingController", data : { action : '', module : 'profile', currentmodule : '', title:'HOME_HEADER_SMS_CREDITS' } }); restangular.setFullRequestInterceptor(function (element, operation, route, url, headers, params) { if (operation == 'remove') { //restangular.setDefaultHeaders({ "Content-Type": "application/json" }); element = params; //headers=''; params=''; } return { headers: headers, params: params, element: element, httpConfig: {} }; }); $urlRouterProvider.otherwise( function($injector, $location) { var $state = $injector.get("$state"); $state.go("home"); }); //$urlRouterProvider.otherwise("/home"); } ]); kalgudiapp.run(["$rootScope","$state","$timeout","$ionicModal","$ionicPopup","$http","$interval","kalgudiLiterals","themeBasePath","profileService","$q","dashboardFactory","setPinFactory","$ionicPopover","commonFactory", 'lazysync', function($rootScope,$state,$timeout,$ionicModal,$ionicPopup,$http,$interval,kalgudiLiterals,themeBasePath,profileService,$q,dashboardFactory,setPinFactory,$ionicPopover,commonFactory, lazysync) { $rootScope.$state = $state; /** * Constant to check dev or production env. */ $rootScope.isDevKalgudi = env.enviorment.includes(ENV_DEV); if(detectmob()){ $rootScope.currentPlatform = "mobile"; } else{ $rootScope.currentPlatform = "Desktop"; } window.localStorage['APP_VERSION'] = APP_VERSION; screen.orientation.lock('portrait').catch(function(error) { // console.log('Screen orientation is failed for this device'); }); //loading all literals data kalgudiLiterals.fetchAllDataFromPropertyFile(LITERALSDATA); $rootScope.loginpinliteral = LITERALSDATA; $rootScope.themebasepathvalue = themeBasePath; $rootScope.globalConfig = globalConfig; $rootScope.bussinessList = []; $rootScope.profileBusinessIncompleteInfo = false; //zoom $rootScope.zoomheight = window.innerHeight + 'px'; if(window.localStorage['userdata']!=undefined) $rootScope.loggedInUserBusinessProfile = JSON.parse(window.localStorage['userdata']); else window.location.href = "mobile_login.html"; $rootScope.s3fileUploadUrl = SERVICE_FACTORY_URLS.S3UPLOAD; $rootScope.s3picUploadUrl = SERVICE_FACTORY_URLS.S3PICUPLOAD; $rootScope.contentBucketRaikKey = "/buckets/crawledContent/keys/"; /*Spiner - for loading symbol*/ $rootScope.spinerisActive = false; /* Alert - info on Search bar */ $rootScope.validationTopErrorAlertFlag = false; $rootScope.commonTopInfoAlertFlag = false; $rootScope.commonTopInfoAlertMessage = ""; //SHOULD REMOVE THIS $rootScope.totalUnreadCounts = {}; $rootScope.inbox_sink_flag = false; $rootScope.windowsflag = false; $rootScope.platformFlag = false; $rootScope.platformMobile = detectmob(); if(platform_Flag!="Desktop"){ if (cordova.platformId == 'windows' || cordova.platformId == 'windows8') { $rootScope.windowsflag = true; }else{ $rootScope.windowsflag = false; } if (cordova.platformId == 'ios') { $rootScope.platformFlag = true; }else{ $rootScope.platformFlag = false; } } if(networkAvaliable()) { $rootScope.networkAvaliable = true; } else { $rootScope.networkAvaliable = false; } if($rootScope.loggedInUserBusinessProfile.hasOwnProperty('lstOfBusinessInfo')){ $rootScope.loggedInUserBusinessProfile.lstOfUserBusinessDetailsInfo = $rootScope.loggedInUserBusinessProfile.lstOfBusinessInfo; } if($rootScope.loggedInUserBusinessProfile.hasOwnProperty('lstOfUserBusinessDetailsInfo')){ $rootScope.loggedInUserCurrentBussinessInfo = _.find($rootScope.loggedInUserBusinessProfile.lstOfUserBusinessDetailsInfo, function(rw){ return rw.businessUUID == $rootScope.globalConfig.currentBussinessId }); } //loading all dynamic jsfiles $rootScope.load_dynamicJs = function(jsfile) { var deferred = $q.defer(); var dependencies = [ jsfile ]; $script(dependencies, function() { // all dependencies have now been loaded by $script.js so resolve the promise $rootScope.$apply(function() { deferred.resolve(); }); }); return deferred.promise; } //keyboard plugin $rootScope.keyboard = false; window.addEventListener('native.keyboardshow', keyboardShowHandler); function keyboardShowHandler(e){ $timeout(function(){ $rootScope.keyboard = true; },0); } window.addEventListener('native.keyboardhide', keyboardHideHandler); function keyboardHideHandler(e){ $timeout(function(){ $rootScope.keyboard = false; },0); } //Handling logout option in left menu $rootScope.signout = function() { if($rootScope.networkAvaliable){ window.localStorage.removeItem('mobileNumber'); //removedataStorage(); if(platform_Flag!="Desktop"){ var logout_req= { method: 'GET', url: SERVICE_FACTORY_URLS.PROFILE +'mobilelogout', headers: { 'deviceId': registrationId } } var device_deregistration_req = { method : 'GET', url : SERVICE_FACTORY_URLS.PROFILE + "mobileregid?q1=" + PUSH_NOTIFICATION_ID + "&q2=" + cordova.platformId + "&q3=logout", headers : { 'userName' : localStorage['countryId'] + localStorage['username'], 'password' : localStorage['password'] } } console.log(PUSH_NOTIFICATION_ID); $http(logout_req).success(function(resp) { $http(device_deregistration_req).success(function(resp) { window.location.href = "mobile_login.html"; removedataStorage(); }, function(err) { window.location.href = "mobile_login.html"; removedataStorage(); }); }, function(err) { // err.status will contain the status code }); } else{ window.location.href = "mobile_login.html"; removedataStorage(); } } else{ window.plugins.toast.show(' No network ', 'long', 'bottom'); } }; $rootScope.goToState = function(state,params) { if(params!=undefined) $state.go(state,params); else $state.go(state); } /** * Navigates to an angular state with a transition of 300ms, so that * any transition animation can be rendered. */ $rootScope.goToStateTransition = function(state, params) { setTimeout(function() { // Call already defined state navigation function $rootScope.goToState(state, params); }, 300); } $rootScope.enableOffline = function() { $rootScope.$broadcast('enableOffline', true); } /** * Global function to download and open a PDF file. * * @fileUrl Url of file to open. */ $rootScope.downloadAndOpenPDF = function(fileUrl) { if(IS_MOBILE_DEVICE && window.env.buildFor) { // For desktop browser mobile devices window.open(fileUrl,'_blank'); } else if(IS_MOBILE_DEVICE) { // For mobile device $rootScope.spinerisActive = true; // Get filename from file path var fileName = fileUrl.split('/').pop(); showInGallery(fileUrl, fileName, true, function() { // On success $rootScope.spinerisActive = false; }, function() { // On error $rootScope.spinerisActive = false; }); } else { window.open(fileUrl,'_system', 'location=yes'); } } $rootScope.$on('$stateChangeError',function(event, toState, toParams, fromState, fromParams){ console.log('$stateChangeError - fired when an error occurs during transition.'); console.log(arguments); }); $rootScope.$on('$stateNotFound',function(event, unfoundState, fromState, fromParams){ console.log('$stateNotFound '+unfoundState.name +' - fired when a state cannot be found by its name.'); console.log(unfoundState, fromState, fromParams); }); var tempPassword = window.localStorage['password']; if(tempPassword.length > 29){ $rootScope.logoutFlag = true; }else { $rootScope.logoutFlag = false; } // state change $rootScope.$on('$stateChangeStart', function(event, toState, toParams,fromState,fromParams){ if(!networkAvaliable() && fromState.url!="^")//{ window.plugins.toast.show(' No network ', 'long', 'bottom'); //event.preventDefault(); //event.stopPropagation; /* }else{*/ $rootScope.flip_menu =0; $rootScope.righMenuflaginternal = false; $rootScope.dosomegoodmodule = false; $rootScope.profilemodule = false; $rootScope.isAdminOfThePage = false; $rootScope.contentFullviewHeaderFlag = false; $rootScope.stateName = angular.copy(toState.data.currentmodule); $rootScope.moduleStateName = toState.data.action; $rootScope.moduleName = toState.data && toState.data.module || ''; $rootScope.screenId = toState.data.screenId; $rootScope.searchScreen = toState.name; $rootScope.closebottomPopover(); //$rootScope.slide_index=parseInt(toParams.slideindex); var currentmodulemobile=toState.data.currentmodule; commonFactory.StateName(toState,toParams); if($rootScope.stateName=='home'){ $rootScope.left_RightscreenId=""; } if(currentmodulemobile == "mycontent"){ $rootScope.left_RightscreenId = "Content"; if(toState.name=="mycontent.viewMessage" || toState.name=="mycontent.allContentSearchFullView" || toState.name=="mycontent.sharedMessageFullView" || toState.name=="mycontent.postShareViewMessage"){ $rootScope.currentstatemodule = ""; $rootScope.contentFullviewHeaderFlag = true; } else if(toState.name=="mycontent.viewSharedMessage"){ $rootScope.currentstatemodule = ""; } else{ $rootScope.currentstatemodule = "Content"; } } else if(currentmodulemobile == "myconnects" && toParams.inboxType=="MARKETPLACE"){ $rootScope.currentstatemodule = "Marketplace"; $rootScope.left_RightscreenId = "Marketplace"; } else if(currentmodulemobile == "myconnects" && toParams.inboxType=="CSM"){ $rootScope.currentstatemodule = "network"; $rootScope.left_RightscreenId = "network"; } else if(currentmodulemobile == "mybusiness" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000000")){ $rootScope.currentstatemodule = "transactions"; $rootScope.left_RightscreenId="transactions"; } else if(currentmodulemobile == "basicApp" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId=="BT000012" || $rootScope.loggedInUserCurrentBussinessInfo.businessTypeId=="BT000015" || $rootScope.loggedInUserCurrentBussinessInfo.businessTypeId=="BT000016" || $rootScope.loggedInUserCurrentBussinessInfo.businessTypeId=="BT000017" || $rootScope.loggedInUserCurrentBussinessInfo.businessTypeId=="BT000018" || $rootScope.loggedInUserCurrentBussinessInfo.businessTypeId=="BT000019")){ $rootScope.currentstatemodule = "transactions"; $rootScope.left_RightscreenId="transactions"; } else if(currentmodulemobile == "farmer" && $rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000002"){ $rootScope.currentstatemodule = "transactions"; $rootScope.left_RightscreenId="transactions"; } else if(currentmodulemobile == "coApp" && $rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000010"){ $rootScope.currentstatemodule = "transactions"; $rootScope.left_RightscreenId="transactions"; } else if(currentmodulemobile == "CA" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000001")){ $rootScope.currentstatemodule = "ca"; $rootScope.left_RightscreenId="ca"; } else if(currentmodulemobile == "basicbroker" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000013")){ $rootScope.currentstatemodule = "basicbroker"; $rootScope.left_RightscreenId="basicbroker"; } else if(currentmodulemobile == "agency" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000014")){ $rootScope.currentstatemodule = "agency"; $rootScope.left_RightscreenId="agency"; } else if(currentmodulemobile == "agriInput" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000008")){ $rootScope.currentstatemodule = "transactions"; $rootScope.left_RightscreenId="transactions"; } else if(currentmodulemobile == "mywarehouse" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000006")){ $rootScope.currentstatemodule = "transactions"; $rootScope.left_RightscreenId="transactions"; } else if(currentmodulemobile == "mytransporter" && ($rootScope.loggedInUserCurrentBussinessInfo.businessTypeId == "BT000003")){ $rootScope.currentstatemodule = "transactions"; $rootScope.left_RightscreenId="transactions"; } else if(currentmodulemobile == "myaccounts"){ $rootScope.currentstatemodule = "accounts"; $rootScope.left_RightscreenId="accounts"; } else if(currentmodulemobile == "myprofile"){ $rootScope.currentstatemodule = "Profile"; $rootScope.left_RightscreenId = "Profile"; $rootScope.profilemodule = true; } else if(currentmodulemobile == "ccp"){ $rootScope.currentstatemodule = "Do some good"; $rootScope.left_RightscreenId = "ccp"; $rootScope.dosomegoodmodule = true; } else if(currentmodulemobile == "changePassword") { $rootScope.currentstatemodule = "changePassword"; $rootScope.left_RightscreenId = "changePassword"; } else { $rootScope.currentstatemodule = ""; } $rootScope.fromState=angular.copy(fromState.name); $rootScope.myconnectsPostMessageDataLoseFlag =false; $rootScope.advanceSettingsDataLoseFlag = false; $rootScope.mycontentPostMessageDataLossFlag = false; $rootScope.commentValidationFlag = false; $rootScope.ccpDataLossFlag = false; /*}*/ }); // Success alert $rootScope.showCommonTopInfoAlert = function(messageToBeShown,closeManuallyFlag) { $rootScope.commonTopInfoAlertFlag = true; $rootScope.commonTopInfoAlertMessage = messageToBeShown; if(closeManuallyFlag){ }else{ // Disapper in 5 seconds $timeout(function(){ $rootScope.commonTopInfoAlertFlag = false; $rootScope.commonTopInfoAlertMessage = ""; },10000); } }; $rootScope.commonTopInfoAlertFlagClose = function(){ $rootScope.commonTopInfoAlertFlag = false; }; // Error alert $rootScope.commonTopErrorAlert = function(messageToBeShown,closeManuallyFlag,flagtype) { /*if(flagtype == "informationalert"){ $rootScope.informationalertflag=true; $rootScope.dowloadAlertflag=false; } else { $rootScope.informationalertflag=false; } $rootScope.commonTopErrorAlertFlag = true; $rootScope.commonTopErrorAlertMessage = messageToBeShown; if(closeManuallyFlag){ }else{ // Disapper in 5 seconds $timeout(function(){ $rootScope.commonTopErrorAlertFlag = false; $rootScope.commonTopErrorAlertMessage = ""; },10000); }*/ $rootScope.showAlertBox(messageToBeShown); }; $rootScope.commonTopErrorAlertFlagClose = function(){ $rootScope.commonTopErrorAlertFlag = false; }; $rootScope.handlingBadWord = function(abuseString){ var alertPopup = $ionicPopup.alert({ template :abuseString, cssClass: "", }); alertPopup.then(function(res) { }); }; // To show common alert messages $rootScope.showAlertBox = function(message, title, icon, expires, notify) { icon = icon || 'info_outline'; title = title || 'Info'; expires = expires || 5000; var confirmPopup = $ionicPopup.alert({ title: title, template: '