(function () { "use strict"; var Upgrade = function ($scope, userService, accountService, timeService) { $('.waiting').show(); $scope.model = { tempName: '' }; userService.isAuthenticated().then(function (user) { $scope.name = user.userName; $('.waiting').hide(); }); $scope.plan = {}; accountService.getPlan().then(function (plan) { $scope.plan.type = plan.PlanType; $scope.plan.expiration = timeService.getDateFromString(plan.ExpirationDate); }); accountService.getPlanPurchaseOptions().then(function (options) { $scope.heading = options.Name; $scope.amount = Number.parseFloat(options.amount).toFixed(2); $scope.expiration = timeService.getDateFromString(options.ExpirationDate); }); accountService.getSharedPlans().then(x => console.log('plan', x)); $scope.changeName = function () { $scope.updateName = !$scope.updateName; $scope.model.tempName = $scope.name; }; $scope.saveName = function () { userService.updateName($scope.model.tempName).then(function (name) { $scope.name = name; $scope.updateName = false; }); }; $scope.plan.success = function () { $scope.success = true; }; }; Upgrade.$inject = ['$scope', 'userService', 'accountService', 'timeService']; angular.module('streamApp').controller('upgradeController', Upgrade); })();