(function () { "use strict"; var Account = function ($scope, userService, accountService, timeService) { $('.waiting').show(); $scope.model = { tempName: '' }; userService.isAuthenticated().then(function (user) { $scope.name = user.userName; $scope.email = user.email; $scope.model.privateMode = user.privateMode; $('.waiting').hide(); }); $scope.updatePrivate = (isPrivate) => { userService.updatePrivateMode(isPrivate).then(function (user) { }); } const planType = ["Standard Plan", "Premium Plan"]; $scope.plan = {}; accountService.getPlan().then(function (plan) { $scope.plan.description = planType[plan.PlanType]; $scope.plan.type = plan.PlanType; $scope.plan.expiration = timeService.getDateFromString(plan.ExpirationDate); }); userService.getRelationships() .then(function (relationships) { $scope.relationships = relationships; }); $scope.callback = function () { let selected = $scope.relationships.filter(s => s.selected) .map(x => x.Id); userService.updateRelationships(selected); }; 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; }); }; function parseDate(dateTimeString) { let date = Date.parse(dateTimeString); return date.toLocaleString(); } }; Account.$inject = ['$scope', 'userService', 'accountService', 'timeService']; angular.module('streamApp').controller('accountController', Account); })();