{"version":3,"names":[],"mappings":"","sources":["settings/settings-controller.js"],"sourcesContent":["(function() {\r\n 'use strict';\r\n\r\n /**\r\n * @ngdoc object\r\n * @name settings.controller:SettingsCtrl\r\n *\r\n * @description\r\n *\r\n */\r\n angular\r\n .module('settings')\r\n .controller('SettingsCtrl', SettingsCtrl);\r\n\r\n function SettingsCtrl($scope, $location, App) {\r\n $scope.user = $scope.getItemFromLocalStorage(\"userDetails\");\r\n $scope.paymentData = $scope.getItemFromLocalStorage(\"paymentData\");\r\n\r\n $scope.removeCreditCard = function() {\r\n $scope.paymentData = {};\r\n $scope.setItemInLocalStorage(\"paymentData\", {});\r\n }\r\n\r\n $scope.saveUserDetails = function() {\r\n if ($scope.user.Address != undefined && typeof($scope.user.Address) != \"string\") {\r\n var place = getDataFromGooglePlaceObject($scope.user.Address);\r\n $scope.user.Longitude = place.Longitude;\r\n $scope.user.Latitude = place.Latitude;\r\n $scope.user.Address = place.Address;\r\n }\r\n $scope.setItemInLocalStorage(\"userDetails\", $scope.user);\r\n App.updateUserDetails($scope.user);\r\n $location.path(\"menu\");\r\n }\r\n\r\n $scope.sendPushChanged = function() {\r\n $scope.setItemInLocalStorage(\"userDetails\", $scope.user);\r\n App.updateUserDetails($scope.user);\r\n }\r\n\r\n $scope.logout = function() {\r\n localStorage.clear();\r\n $location.path(\"login\");\r\n }\r\n\r\n var getDataFromGooglePlaceObject = function(place) {\r\n if (place == undefined || place.geometry == undefined) return {};\r\n return {\r\n Longitude: place.geometry.location.lng(),\r\n Latitude: place.geometry.location.lat(),\r\n Address: place.formatted_address\r\n }\r\n }\r\n\r\n }\r\n}());\r\n"],"file":"settings-controller.js"}