Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- function MainController($scope, $location, $stateParams, GameLinkService, GameInstancesService, GameMediaService, AuthenticationService, MessageService, utils, $localStorage) {
- function acceptCallback() {
- GameInstancesService.endWeekProcess()
- }
- function declineCallback() {}
- var main = this;
- main.ViewTransition = "", main.CurrentWeek = GameInstancesService.getCurrentWeek(), main.barWidth = {
- width: GameInstancesService.getProgressBarPercent()
- }, main.Initialize = function() {
- $scope.$on("updateViewTransition", function(event, data) {
- main.ViewTransition = data.transition
- }), 0 === main.CurrentWeek && GameInstancesService.setCurrentWeek($localStorage.GameCurrentWeek)
- }, main.FinishWeek = function() {
- MessageService.showConfirm({
- content: '<img class="end-of-week-flag" src="assets/images/end-of-week/flag.svg"/><br/>Are you sure you want to finish the week?',
- acceptFn: acceptCallback,
- declineFn: declineCallback,
- acceptBtnLabel: "FINISH THE WEEK",
- declineBtnLabel: "STAY ON THIS WEEK"
- })
- }, main.Help = function() {
- $scope.$broadcast("ShowMentorHelpPopup")
- }, main.Faqs = function() {
- $scope.$broadcast("ShowMentorFaqPopup")
- }, main.Logout = function() {
- AuthenticationService.logout(function(res) {
- var gameLinkId = $localStorage.GameLinkID;
- $localStorage.$reset(), $location.path("auth/login/" + gameLinkId)
- }, function(res) {
- log(res)
- })
- }, $scope.$on("CurrentWeekUpdated", function(event, currentWeek) {
- main.CurrentWeek = currentWeek, main.barWidth = {
- width: GameInstancesService.getProgressBarPercent()
- }
- }), $scope.$on("FinishWeek", function() {
- main.FinishWeek()
- }), main.Initialize()
- }
- function DialogPopupController($scope) {
- var vm = this;
- vm.dialogAccept = function() {
- $scope.ngDialogData.acceptFn(), $scope.closeThisDialog()
- }, vm.dialogDecline = function() {
- $scope.ngDialogData.declineFn(), $scope.closeThisDialog()
- }
- }
- function AuthenticationController($scope, $stateParams, $localStorage, GameLinkService) {
- var vm = this,
- splashPageTimeout = 2e3;
- $scope.GameInfo = {}, $scope.ShowClassModule = !1, $scope.ErrorGameLinkID = !0, $scope.Loading = !0, $scope.Status = "Loading Game...", $scope.Initialize = function() {
- GameLinkService.getInfo($stateParams.gamelinkid || $localStorage.GameLinkID, function(response) {
- $scope.GameInfo = response, $scope.Loading = !1, $scope.ShowClassModule = !0, $scope.ErrorGameLinkID = !1, setTimeout($scope.splashOut, splashPageTimeout)
- }, function(response) {
- log(response), $scope.Loading = !1, $scope.Status = "Game link ID not found", setTimeout($scope.splashOut, splashPageTimeout)
- })
- }, vm.validateInput = function(model, type) {
- var _class = "";
- switch (type) {
- case "text":
- model.$viewValue && model.$viewValue.length > 0 ? _class = model.$error.required || model.$error.yobrange || model.$error[type] || model.$error.pattern ? "active error" : "active" : model.$dirty && (_class = "active error");
- break;
- case "radioCheck":
- case "email":
- model.$viewValue && model.$viewValue.length > 0 ? _class = model.$error.required || model.$error[type] ? "active error" : "active" : model.$dirty && (_class = "active error");
- break;
- case "password":
- model.$viewValue && model.$viewValue.length > 0 ? _class = model.$error.required || model.$error.complexity || model.$error.complexity ? "active error" : "active" : model.$dirty && (_class = "active error");
- break;
- case "confirmPassword":
- model.$viewValue && model.$viewValue.length > 0 ? _class = model.$error.required || model.$error[type] || model.$error.passwordMatch ? "active error" : "active" : model.$dirty && (_class = "active error")
- }
- return _class
- }, $scope.validateInput = function(model, type) {
- return vm.validateInput(model, type)
- }, $scope.showError = function(model, property) {
- return model.$submitted || model[property].$dirty
- }, $scope.richInputInit = function() {
- $(".rich-input__inp").off("focus blur").on("focus blur", function(e) {
- var $this = $(this),
- $ri = $this.parents(".rich-input");
- $ri.toggleClass("active", "focus" === e.type || this.value.length > 0)
- }).trigger("blur")
- }, $scope.sliderInit = function() {
- var $slider = $(".login-gslot__group"),
- centerMode = !1,
- itemCount = $slider.find(".login-gslot__item").length;
- return $(window).width() > 992 && itemCount > 5 && (centerMode = !0), $slider.slick({
- slidesToShow: 5,
- arrows: !1,
- initialSlide: 0,
- focusOnSelect: !0,
- dots: !0,
- swipeToSlide: !0,
- centerMode: centerMode,
- responsive: [{
- breakpoint: 992,
- settings: {
- slidesToShow: 3,
- centerMode: !0
- }
- }, {
- breakpoint: 480,
- settings: {
- slidesToShow: 1,
- centerMode: !0
- }
- }]
- }), {
- slider: $slider
- }
- }, $scope.splashOut = function() {
- $(".screen-b").addClass("fade-out"), $(".screen-a").removeClass("hidden-screen"), $(".screen-a").addClass("show-in"), setTimeout(function() {
- $(".screen-b").remove()
- }, 900)
- }, $scope.Initialize()
- }
- function AuthCreateUserController($scope, $localStorage, $location, $stateParams, GameLinkService, AuthenticationService) {
- $scope.$parent.richInputInit();
- var vm = this;
- vm.CreateUser = {}, vm.UserDetails = {}, vm.SuccessView = !1, vm.FailedRegistration = {
- State: !1,
- Messages: {}
- }, log($localStorage.GameLinkID), vm.CreateAccount = function() {
- AuthenticationService.register(vm.UserDetails.SchoolEmail, vm.UserDetails.YOB, vm.UserDetails.Password, vm.UserDetails.Gender, vm.UserDetails.ConfirmPassword, vm.UserDetails.Name, $location.protocol() + "://" + location.host + "/#/auth/login/" + $localStorage.GameLinkID, function(response) {
- vm.SuccessView = !0, dataLayer.push({
- event: "user action",
- userAction: "account creation"
- })
- }, function(response) {
- log(response), 400 === response.status ? (vm.FailedRegistration.State = !0, vm.FailedRegistration.Messages = {
- Message: response.data.Message,
- ModelStates: response.data.ModelState[""]
- }) : (vm.FailedRegistration.State = !0, vm.FailedRegistration.Messages = {
- Message: response.status + " " + response.statusText
- })
- })
- }, vm.UpdateFields = function() {
- vm.FailedRegistration.State = !1
- }, vm.ReturnToLogin = function() {
- $location.path("auth/login/" + $localStorage.GameLinkID)
- }
- }
- function AuthLoginController($scope, $location, $stateParams, $localStorage, AuthenticationService, GameLinkService) {
- $scope.$parent.richInputInit();
- var vm = this;
- vm.UserLogin = {}, vm.UserDetails = {}, vm.LoginFailed = !1, vm.GamelinkID = $localStorage.GameLinkID, vm.registerGameLinkSuccess = function(res) {
- GameLinkService.get($stateParams.gamelinkid, function(res) {
- dataLayer.push({
- event: "VirtualPageview",
- virtualPageURL: "/game-play",
- userId: $localStorage.GameLink.UserID
- }), $location.path("/auth/game")
- }, function(response) {
- vm.LoginFailMessage = response.Message, vm.LoginFailed = !0, log(response)
- })
- }, vm.registerGameLinkFail = function(response) {
- vm.LoginFailed = !0, "Max users added to game link." == response.data.Message ? vm.LoginFailMessage = "Max users added to game link. Please contact your teacher." : vm.LoginFailMessage = response.data.Message
- }, vm.requestTokenSuccess = function() {
- GameLinkService.register($stateParams.gamelinkid, vm.registerGameLinkSuccess, vm.registerGameLinkFail)
- }, vm.requestTokenFail = function(response) {
- log(response), 400 === response.status ? vm.LoginFailMessage = response.data.error_description : vm.LoginFailMessage = response.status + " " + response.statusText, vm.LoginFailed = !0
- }, vm.login = function() {
- AuthenticationService.requestToken(vm.UserDetails.UserEmail, vm.UserDetails.LoginPassword, vm.requestTokenSuccess, vm.requestTokenFail)
- }
- }
- function AuthRecoveryController($scope, $location, $localStorage, $stateParams, GameLinkService, AuthenticationService) {
- $scope.$parent.richInputInit(), $scope.ShowClassModule = !1;
- var vm = this;
- vm.RecoveryForm = {}, vm.UserDetails = {}, vm.RecoverySent = {
- State: !1,
- Error: !1
- }, vm.ReturnToLoginState = !1, vm.SendRecoveryPassword = function() {
- log(vm.UserDetails), AuthenticationService.sendResetPassword(vm.UserDetails.RecoveryEmail, $location.protocol() + "://" + location.host + "/#/auth/password-reset", function(response) {
- vm.RecoverySent.State = !0
- }, function(error) {
- vm.RecoverySent.Error = !0
- })
- }, vm.GoBack = function() {
- vm.RecoverySent.Error = !1
- }, vm.ReturnToLogin = function() {
- $location.path("/auth/login/" + $localStorage.GameLinkID)
- }
- }
- function PasswordResetController($scope, $stateParams, $localStorage, AuthenticationService) {
- $scope.$parent.richInputInit(), $scope.$parent.ShowClassModule = !1, $scope.$parent.ErrorGameLinkID = !1, $scope.$parent.Loading = !1;
- var vm = this;
- vm.PasswordReset = {}, vm.UserDetails = {}, vm.setPasswordSuccess = !1, vm.CreateNewPassword = function() {
- log($stateParams.user), log($stateParams.token), log(vm.UserDetails.ConfirmPassword), log(vm.UserDetails.Password), AuthenticationService.resetPassword($stateParams.user, $stateParams.token, vm.UserDetails.Password, vm.UserDetails.ConfirmPassword, function(response) {
- log(response), vm.setPasswordSuccess = !0
- }, function(error) {
- log(error)
- })
- }
- }
- function AuthSelectGameController($scope, $localStorage, $location, $stateParams, GameLinkService, GameInstancesService, MessageService) {
- var vm = this;
- vm.GameInstances = [], vm.SelectedGame = [], vm.UserName = $localStorage.GameLinkID ? $localStorage.GameLink.Name : "", vm.LoadingGame = !1, $(".screen-a").removeClass("mark"), GameLinkService.get($localStorage.GameLinkID, function(res) {
- if ($localStorage.GameLink)
- for (var i = 0; i < $localStorage.GameLink.MaxGames; i++) {
- var currentGame = $localStorage.GameLink.GameInstances[i],
- game = {};
- currentGame && (game = currentGame, game.IsGameComplete = 27 == game.CurrentWeek);
- var game = currentGame ? currentGame : {};
- vm.GameInstances.push(game)
- }
- }, function(response) {
- log(response)
- }), $scope.$on("ngRepeatFinished", function() {
- var $slider = $scope.$parent.sliderInit().slider;
- vm.SelectedGame = vm.GameInstances[0], log(vm.SelectedGame), $slider.on("beforeChange", function(event, slick, currentSlide, nextSlide) {
- vm.SelectedGame = vm.GameInstances[nextSlide]
- })
- }), vm.SetGame = function(gameid) {
- vm.SelectedGame = vm.GameInstances[gameid]
- }, vm.LoadApps = function(GameInstanceID) {
- $localStorage.GameInstanceID = GameInstanceID, GameInstancesService.apps(function(apps) {
- log(apps), GameInstancesService.startWeek(function(data) {
- log(data), $location.path("app/dashboard/view")
- }, function(message) {
- vm.LoadingGame = !1, log(message)
- })
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.CreateGame = function() {
- GameInstancesService.createGame(function(GameInstanceID) {
- vm.LoadApps(GameInstanceID)
- }, function(message) {
- vm.LoadingGame = !1, log(message)
- })
- }, vm.LoadGame = function() {
- if (!vm.LoadingGame) {
- vm.LoadingGame = !0, log(vm.SelectedGame.ID);
- var gameNumber = $(".slick-current").find(".js-gameblock").data("game-number"),
- gameState = "continue game";
- "undefined" != typeof vm.SelectedGame.ID ? vm.LoadApps(vm.SelectedGame.ID) : (vm.CreateGame(), gameState = "start new game"), $localStorage.GameNumber = gameNumber, dataLayer.push({
- event: "game selection",
- gameState: gameState,
- gameNumber: "game " + gameNumber
- })
- }
- }
- }
- function DashboardController($scope, GameInstancesService, utils, FinancialInstanceService, $rootScope, DashboardService) {
- function gameApplications() {
- vm.barWidth = {
- width: GameInstancesService.getProgressBarPercent()
- }, vm.NetWorth = GameInstancesService.getNetWorth();
- var AppModel = [],
- AppURLs = appConfig.gameApps;
- vm.buildURL = function(instance) {
- var appUrl = AppURLs.filter(function(url) {
- return url.application === instance.Name
- });
- appUrl && appUrl.length && AppModel.push(angular.extend({}, instance, {
- url: appUrl[0].url,
- priority: appUrl[0].priority,
- mobilePriority: appUrl[0].mobilePriority,
- displayName: appUrl[0].displayName,
- state: appUrl[0].state,
- active: !1
- }))
- }, GameInstancesService.apps(function(response) {
- response.forEach(vm.buildURL), vm.GameApplications = AppModel, DashboardService.setGameApps(vm.GameApplications)
- }, function(response) {
- logError("fail", response)
- })
- }
- function updateAppModelState(data) {
- GameInstancesService.setConfigAppState(data.application, data.state);
- for (var i = 0; i < vm.GameApplications.length; i++) vm.GameApplications[i].Name === data.application && ("idle" == data.state && (vm.GameApplications[i].HasUpdate = !1, vm.GameApplications[i].UpdateCount = ""), vm.GameApplications[i].state = data.state);
- DashboardService.setGameApps(vm.GameApplications)
- }
- var vm = this;
- vm.NetWorth, vm.GameApplications = [], vm.CurrentWeek = GameInstancesService.getCurrentWeek(), vm.barWidth = {
- width: GameInstancesService.getProgressBarPercent()
- }, gameApplications(), $rootScope.$on("ResetActiveApp", function() {
- for (var i = 0; i < vm.GameApplications.length; i++) vm.GameApplications[i].active = !1
- }), $scope.$on("CurrentWeekUpdated", function(event, currentWeek) {
- vm.CurrentWeek = currentWeek, gameApplications()
- }), $scope.$on("UpdateNotifications", function() {
- GameInstancesService.apps(function(response) {
- response.forEach(function(instance) {
- for (var i = 0; i < vm.GameApplications.length; i++) vm.GameApplications[i].Name == instance.Name && (vm.GameApplications[i].HasBeenAccessed = instance.HasBeenAccessed, vm.GameApplications[i].UpdateCount = instance.UpdateCount, vm.GameApplications[i].HasUpdate = instance.HasUpdate, vm.GameApplications[i].IsDisabled = instance.IsDisabled, vm.GameApplications[i].state = "idle")
- }), DashboardService.setGameApps(vm.GameApplications)
- }, function(response) {
- logError("fail", response)
- })
- }), vm.FinishWeekClicked = function() {
- $scope.$emit("FinishWeek")
- }, vm.whereImAtClicked = function(location) {
- logError("whereImAtClicked"), utils.navigateRoute($scope, location, "appOpen")
- }, $scope.$on("AppIconStateUpdate", function(event, data) {
- updateAppModelState(data)
- }), $scope.$on("NetWorthUpdated", function(event, networth) {
- vm.NetWorth = networth
- })
- }
- function WhereImAtController($scope, utils, WhereImAtService, GameInstancesService, $rootScope, GameMediaService) {
- var vm = this;
- vm.howl = GameMediaService.get("mentor", "veryhappy"), vm.currentWeek = GameInstancesService.getCurrentWeek(), vm.PanelBtnText = "Show", vm.PanelOpen = !1, vm.ProgressObg, vm.NetPosition = 0, vm.UserName = GameInstancesService.getUser().username, vm.NetPositionTitle = "MY NET POSITION", vm.AssetsBreakdown = {
- MyCash: {
- ShowMobile: !0,
- Icon: "icon-my-cash",
- Title: "My cash",
- Balance: 0,
- Visible: !1
- },
- MyBank: {
- ShowMobile: !0,
- Icon: "icon-bank",
- Title: "My bank",
- Balance: 0,
- Visible: !1
- },
- Shares: {
- ShowMobile: !0,
- Icon: "icon-investment",
- Title: "Shares",
- Balance: 0,
- Visible: !1
- },
- MyStuff: {
- ShowMobile: !0,
- Icon: "icon-stuff",
- Title: "My Stuff",
- Balance: 0,
- Visible: !1
- },
- Superannuation: {
- ShowMobile: !0,
- Icon: "icon-superannuation",
- Title: "Superannuation",
- Balance: 0,
- Visible: !1
- },
- Survey: {
- ShowMobile: !0,
- Icon: "icon-survey",
- Title: "End of Game Quiz",
- Balance: 0,
- Visible: !1
- }
- }, vm.LiabilitiesBreakdown = {
- MyCredit: {
- ShowMobile: !0,
- Icon: "icon-credit-card",
- Title: "My credit",
- Balance: 0,
- Visible: !1
- },
- Bills: {
- ShowMobile: !0,
- Icon: "icon-dollar-sign",
- Title: "Outstanding bills",
- Balance: 0,
- Visible: !1
- }
- }, vm.Initialize = function() {
- GameInstancesService.checkEndGameSurvey(function(data) {
- data.HasEndSurvey && (vm.NetPositionTitle = "SUNCORP ESSI MONEY CHALLENGE NET POSITION")
- }, function(data) {
- Log(data)
- }), WhereImAtService.getProgress(function(data) {
- vm.ProgressObg = data.Results, vm.AssetsBreakdown.MyBank.Balance = 0;
- var netP = 0;
- vm.ProgressObg.forEach(function(arrayElem) {
- netP += arrayElem.Balance
- }), vm.NetPosition = netP, GameInstancesService.setNetWorth(vm.NetPosition), vm.ProgressObg.forEach(function(arrayElem) {
- "Cashbox" === arrayElem.Title && (vm.AssetsBreakdown.MyCash.Balance = arrayElem.Balance, vm.AssetsBreakdown.MyCash.Visible = !0), "BankAccountTransactions" !== arrayElem.Category && "InvestmentTransactions" !== arrayElem.Category || (vm.AssetsBreakdown.MyBank.Balance += arrayElem.Balance, vm.AssetsBreakdown.MyBank.Visible = !0), "Shares" === arrayElem.Title && (vm.AssetsBreakdown.Shares.Balance = arrayElem.Balance, vm.AssetsBreakdown.Shares.Visible = !0), "Items" === arrayElem.Title && (vm.AssetsBreakdown.MyStuff.Balance = arrayElem.Balance, vm.AssetsBreakdown.MyStuff.Visible = !0), "SuperTransactions" === arrayElem.Category && (vm.AssetsBreakdown.Superannuation.Balance = arrayElem.Balance, vm.AssetsBreakdown.Superannuation.Visible = !0), "Survey" === arrayElem.Category && (vm.AssetsBreakdown.Survey.Balance = arrayElem.Balance, vm.AssetsBreakdown.Survey.Visible = !0), "Credit Cards" === arrayElem.Title && (vm.LiabilitiesBreakdown.MyCredit.Balance = arrayElem.Balance), "Bills" === arrayElem.Category && (vm.LiabilitiesBreakdown.Bills.Balance = arrayElem.Balance)
- });
- var tempAssetsBreakdown = vm.AssetsBreakdown;
- vm.AssetsBreakdown = {}, angular.forEach(tempAssetsBreakdown, function(value, key) {
- value.Visible && (vm.AssetsBreakdown[key] = value)
- })
- }, function(data) {
- log(data)
- })
- }, vm.PanelClicked = function() {
- vm.PanelOpen = !vm.PanelOpen, vm.PanelOpen ? vm.PanelBtnText = "Hide" : vm.PanelBtnText = "Show"
- }, vm.ExitGame = function() {
- utils.navigateRoute($scope, "/auth/game", "next")
- }, $rootScope.$on("UpdateWhereImAt", function() {
- vm.Initialize()
- }), vm.Initialize()
- }
- function BankIndexController($scope, $filter, FinancialInstanceService, utils, MessageService, BankingInstanceService, GameInstancesService) {
- var vm = this;
- vm.BankAccounts = [], vm.InvestmentAccounts = [], vm.BankingAppInstance = {}, vm.Initialize = function() {
- FinancialInstanceService.getAccountSources("Banking", function(accounts) {
- vm.BankAccounts = accounts
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- }), BankingInstanceService.getInvestmentAccounts(function(accounts) {
- vm.InvestmentAccounts = accounts, log(vm.InvestmentAccounts)
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- }), GameInstancesService.apps(function(apps) {
- $filter("filter")(apps, function(i) {
- if ("Banking" == i.Name) return i
- })
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.Initialize(), vm.TriggerTransition = function(location) {
- utils.navigateRoute($scope, location, "next")
- }
- }
- function BankOpenAccountController($scope, $stateParams, GameBankingService, CashboxInstanceService, BankingInstanceService, $window, utils, MessageService, GameInstancesService) {
- function createAccount(transferAmount) {
- $scope.$broadcast("ShowTransferLoading"), BankingInstanceService.create(AccountID, vm.SelectModel.Selected.AppInstanceID, vm.SelectModel.Selected.ID, transferAmount, function(accountID) {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), MessageService.showMessage({
- content: messages[0]
- })
- })
- }
- var vm = this,
- AccountID = $stateParams.id;
- vm.Account = null, vm.TransferValue = 0, vm.SelectModel = {}, vm.SelectModel.Options = [], vm.SelectModel.Selected = [], vm.message = {}, vm.Initialize = function() {
- vm.OpenAccount = vm.OpenAccount, vm.LoadBankAccountType($stateParams.id), vm.CreateSourceOptions()
- }, vm.LoadBankAccountType = function(ID) {
- GameBankingService.get(function(banks) {
- vm.Account = banks.filter(function(e) {
- return e.ID === ID
- })[0], vm.TransferValue = vm.Account.MinimumBalance
- }, function(messages) {
- vm.message = MessageService.showMessage({
- content: messages
- })
- })
- }, vm.CreateSourceOptions = function() {
- vm.AddCashbox(), vm.GetBanks(vm.AddBanks)
- }, vm.AddCashbox = function() {
- CashboxInstanceService.get(function(data) {
- angular.extend(data, {
- AppInstanceID: utils.getInstanceAppID("Cashbox")
- }), vm.SelectModel.Options = vm.SelectModel.Options.concat([data])
- }, function(messages) {
- vm.message = MessageService.showMessage({
- content: messages
- })
- })
- }, vm.GetBanks = function(callback) {
- BankingInstanceService.get(function(response) {
- callback(response)
- }, function(messages) {
- vm.message = MessageService.showMessage({
- content: messages
- })
- })
- }, vm.AddBanks = function(data) {
- log(">> AddBanks");
- var bankingInstanceID = utils.getInstanceAppID("Banking"),
- banks = [];
- angular.forEach(data, function(value) {
- banks.push(angular.extend({}, value, {
- AppInstanceID: bankingInstanceID
- }))
- }), vm.SelectModel.Options = vm.SelectModel.Options.concat(banks), vm.SelectModel.Options.unshift({
- ID: "0",
- Title: " [Select Account] ",
- Balance: 0
- }), vm.SelectModel.Selected = vm.SelectModel.Options[0]
- }, vm.OpenAccount = function() {
- var transferAmount = vm.TransferValue;
- log(vm.Account.MinimumBalance, vm.SelectModel.Selected), vm.Account.MinimumBalance > 0 && "0" !== vm.SelectModel.Selected.ID ? parseFloat(transferAmount) >= parseFloat(vm.Account.MinimumBalance) ? parseFloat(transferAmount) <= parseFloat(vm.SelectModel.Selected.Balance) ? (dataLayer.push({
- event: "app",
- appSelected: "my bank",
- appAction: "open account"
- }), createAccount(transferAmount)) : vm.message = MessageService.showMessage({
- content: "Error: not enough money in deposit account"
- }) : vm.message = MessageService.showMessage({
- content: "Error: not enough money for the minimum balance"
- }) : 0 === vm.Account.MinimumBalance ? (dataLayer.push({
- event: "app",
- appSelected: "my bank",
- appAction: "open account"
- }), createAccount(transferAmount)) : vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- })
- }, vm.cancelClicked = function() {
- utils.navigateRoute($scope, "", "back")
- }, $scope.$on("TransactionComplete", function() {
- GameInstancesService.setConfigAppState("Banking", "idle"), utils.navigateRoute($scope, "/app/dashboard/banking", "back")
- }), vm.Initialize()
- }
- function ChooseBankAccountController($scope, GameBankingService, utils, $filter, FinancialInstanceService, MessageService, $timeout) {
- function setupSlider() {
- vm.slickConfig = {
- data: vm.BankOptions,
- adaptiveHeight: !1,
- arrows: !1,
- infinite: !1,
- enabled: !0,
- method: {},
- event: {
- init: function(event, slick) {
- vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), setTimeout(function() {
- slick.resize()
- }, 400)
- },
- afterChange: function(event, slick, currentSlide, nextSlide) {
- vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
- }
- }
- }
- }
- var vm = this;
- vm.BankOptions = [], vm.currentSlide = 1, vm.totalSlides = 1, vm.nextDisabled = !1, vm.prevDisabled = !0, vm.hasTransactionAccount = !1, vm.Initialize = function() {
- GameBankingService.get(function(accounts) {
- vm.PushBanksToOptions(accounts)
- }, function(messages) {
- log(messages)
- })
- }, vm.PushBanksToOptions = function(banks) {
- angular.forEach(banks, function(value) {
- value.MonthlyFee = $filter("currency")(value.MonthlyFee, "$", 0), utils.isNumeric(value.FeePerTransaction) && (value.FeePerTransaction = $filter("currency")(value.FeePerTransaction, "$", 0)), value.MinimumBalance = $filter("currency")(value.MinimumBalance, "$", 0), value.InterestRate = 100 * value.InterestRate + "%", vm.BankOptions.push(value)
- }), vm.getCurrentAccounts()
- }, vm.getCurrentAccounts = function() {
- FinancialInstanceService.getAccountSources("Banking", function(accounts) {
- var transactionAccounts = accounts.filter(function(e) {
- return "TransactionsBankAccountInstance" === e.AccountType
- });
- transactionAccounts.length > 0 && (vm.hasTransactionAccount = !0), setupSlider()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.getIcon = function(type) {
- return utils.getAccountTypeIcon(type)
- }, vm.OpenAccount = function(location) {
- utils.navigateRoute($scope, location, "next")
- }, $scope.$on("StartNavigateRoute", function() {
- vm.slickConfig.method.slickGoTo(0, !0)
- }), vm.Initialize()
- }
- function AccountStatementController($scope, $stateParams, BankingInstanceService, FinancialInstanceService, utils, MessageService, $location) {
- function acceptCallback() {
- BankingInstanceService.close(vm.Account.ID, vm.nextAccount.ID, function(response) {
- dataLayer.push({
- event: "app",
- appSelected: "my bank",
- appAction: "close bank account"
- }), utils.navigateRoute($scope, "", "back")
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }
- function declineCallback() {}
- var vm = this;
- vm.CanClose = !1, vm.Account = null, vm.Weeks = {};
- var Accounts = null,
- transactionAccounts = [];
- vm.Initialize = function() {
- vm.load($stateParams.id)
- }, vm.load = function(accountID) {
- var transactions = function(bankingAppID, accountID) {
- FinancialInstanceService.transactions(bankingAppID, accountID, function(transactions) {
- vm.Weeks = utils.orderTransactionsArr(transactions), $scope.$emit("RefreshWebKitScrolling")
- }, function(messages) {
- log(messages)
- })
- };
- $location.path().indexOf("investment") !== -1 ? BankingInstanceService.getInvestmentAccounts(function(accounts) {
- vm.Account = accounts.filter(function(e) {
- return e.ID === accountID
- })[0], transactions(vm.Account.AppInstanceID, vm.Account.ID), log(vm.Account)
- }, function(messages) {
- MessageService.showMessage({
- content: messages
- })
- }) : BankingInstanceService.get(function(accounts) {
- Accounts = accounts, transactionAccounts = accounts.filter(function(e) {
- return "TransactionsBankAccountInstance" === e.AccountType && e.ID !== accountID
- }), transactionAccounts.length > 0 && ($scope.CanClose = !0), vm.Account = accounts.filter(function(e) {
- return e.ID === accountID
- })[0], log(vm.Account), transactions(vm.Account.AppInstanceID, vm.Account.ID)
- }, function(messages) {
- MessageService.showMessage({
- content: messages
- })
- })
- }, vm.CloseAccount = function($event, accountID) {
- $scope.CanClose ? (vm.nextAccount = transactionAccounts[0], MessageService.showConfirm({
- content: "Are you sure you want to close this account? Your balance and all future debits and credits will be transferred to your <strong>" + vm.nextAccount.Title + "</strong> account",
- acceptFn: acceptCallback,
- declineFn: declineCallback
- })) : MessageService.showMessage({
- content: "Error: You must have at least one active bank account"
- })
- }, vm.transferClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/transfer/banking/" + vm.Account.ID, "next")
- }, vm.transferInvestmentClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/transfer/investment/" + vm.Account.ID, "next")
- }, vm.Initialize()
- }
- function ChooseInvestmentsController($scope, FinancialInstanceService, utils, MessageService, GameBankingService, $filter) {
- function setupSlider() {
- vm.slickConfig = {
- data: vm.InvestmentOptions,
- adaptiveHeight: !1,
- arrows: !1,
- infinite: !1,
- enabled: !0,
- method: {},
- event: {
- init: function(event, slick) {
- vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), setTimeout(function() {
- slick.resize()
- }, 400)
- },
- afterChange: function(event, slick, currentSlide, nextSlide) {
- vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
- }
- }
- }
- }
- var vm = this;
- vm.InvestmentOptions = [], vm.currentSlide = 1, vm.totalSlides = 1, vm.nextDisabled = !1, vm.prevDisabled = !0, vm.Initialize = function() {
- GameBankingService.getInvestmentAccounts(function(accounts) {
- log(accounts), accounts = accounts.filter(function(e) {
- return "GameFixedTermDepositInvestment" == e.AccountType
- }), vm.PushBanksToOptions(accounts)
- }, function(messages) {
- log(messages)
- })
- }, vm.PushBanksToOptions = function(banks) {
- angular.forEach(banks, function(value) {
- value.InterestRate = parseFloat(100 * value.InterestRate).toFixed(2), vm.InvestmentOptions.push(value)
- }), vm.getCurrentAccounts()
- }, vm.getCurrentAccounts = function() {
- FinancialInstanceService.getAccountSources("Banking", function(accounts) {
- var transactionAccounts = accounts.filter(function(e) {
- return "TransactionsBankAccountInstance" === e.AccountType
- });
- transactionAccounts.length > 0 && (vm.hasTransactionAccount = !0), setupSlider()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.OpenAccount = function(location) {
- utils.navigateRoute($scope, location, "next")
- }, $scope.$on("StartNavigateRoute", function() {
- vm.slickConfig.method.slickGoTo(0, !0)
- }), $scope.redrawSlider = function() {}, vm.Initialize()
- }
- function OpenInvestmentAccountController($scope, $stateParams, GameBankingService, CashboxInstanceService, BankingInstanceService, $window, utils, MessageService) {
- var vm = this,
- AccountID = $stateParams.id;
- vm.Account = null, vm.TransferValue = 0, vm.SelectModel = {}, vm.SelectModel.Options = [], vm.SelectModel.Selected = [], vm.message = {}, vm.Initialize = function() {
- vm.OpenAccount = vm.OpenAccount, vm.LoadBankAccountType($stateParams.id), vm.CreateSourceOptions()
- }, vm.LoadBankAccountType = function(ID) {
- GameBankingService.getInvestmentAccounts(function(banks) {
- vm.Account = banks.filter(function(e) {
- return e.ID === ID
- })[0], vm.TransferValue = vm.Account.MinimumBalance
- }, function(messages) {})
- }, vm.CreateSourceOptions = function() {
- vm.GetBanks(vm.AddBanks)
- }, vm.GetBanks = function(callback) {
- BankingInstanceService.get(function(response) {
- response && response.length && callback(response)
- }, function(messages) {
- log(messages)
- })
- }, vm.AddBanks = function(data) {
- var bankingInstanceID = utils.getInstanceAppID("Banking"),
- banks = [];
- angular.forEach(data, function(value) {
- banks.push(angular.extend({}, value, {
- AppInstanceID: bankingInstanceID
- }))
- }), vm.SelectModel.Options = vm.SelectModel.Options.concat(banks), vm.SelectModel.Options.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.SelectModel.Selected = vm.SelectModel.Options[0]
- }, vm.OpenAccount = function() {
- var transferAmount = vm.TransferValue;
- if ("0" !== vm.SelectModel.Selected.ID)
- if (parseFloat(transferAmount) <= parseFloat(vm.SelectModel.Selected.Balance)) {
- log(">> ", transferAmount), $scope.$broadcast("ShowTransferLoading");
- var data = {
- GameAccountID: AccountID,
- TransferFromGameAppInstanceID: vm.SelectModel.Selected.AppInstanceID,
- TransferFromAccountInstanceID: vm.SelectModel.Selected.ID,
- Amount: transferAmount
- };
- BankingInstanceService.createInvestmentAccount(data, function(accountID) {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), MessageService.showMessage({
- content: messages
- })
- }), dataLayer.push({
- event: "app",
- appSelected: "my bank",
- appAction: "invest"
- })
- } else vm.message = MessageService.showMessage({
- content: "Error: not enough money in deposit account"
- });
- else vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- })
- }, vm.cancelClicked = function() {
- utils.navigateRoute($scope, "", "back")
- }, $scope.$on("TransactionComplete", function() {
- log("TransactionComplete"), utils.navigateRoute($scope, "/app/dashboard/banking", "back")
- }), vm.Initialize()
- }
- function CashboxController($scope, FinancialInstanceService, $filter, utils, MessageService) {
- var vm = this;
- vm.Cashbox = {}, vm.Initialize = function() {
- FinancialInstanceService.getAccountSources(["Cashbox"], function(response) {
- var data = response[0];
- vm.Cashbox = {
- balance: $filter("currency")(data.Balance, "$", 2),
- id: data.ID
- }
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.transferClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/transfer/cashbox/" + vm.Cashbox.id, "next")
- }, vm.Initialize()
- }
- function TransferMoneyController($scope, $stateParams, $window, utils, FinancialInstanceService, $filter, MessageService, BankingInstanceService) {
- function UpdateToOptions() {
- vm.ToAccountOptions = vm.FromAccountOptions.filter(function(e) {
- return e.ID !== vm.FromAccountModel.selected.ID
- }), vm.ToAccountModel.selected = vm.ToAccountOptions[0]
- }
- var vm = this;
- vm.AccountOptions = [], vm.FromAccountModel = {}, vm.FromAccountOptions = [], vm.ToAccountModel = {}, vm.ToAccountOptions = [], vm.TransferValue, vm.AppBranding = {}, vm.UpdateToOptions = UpdateToOptions, vm.templateText = {
- title: "",
- buttonLabel: ""
- }, vm.Initialize = function() {
- "investment" === $stateParams.app && BankingInstanceService.getInvestmentAccounts(function(options) {
- vm.InvestmentOptions = options, log(vm.InvestmentOptions), vm.SetDefaults()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- }), FinancialInstanceService.getAccountSources(["Banking", "Cashbox"], function(options) {
- vm.AccountOptions = options, log(vm.AccountOptions), vm.SetDefaults()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.SetDefaults = function() {
- var DefaultID = null,
- accountsNoCashbox = vm.AccountOptions.filter(function(item) {
- if ("CashboxAccountInstance" != item.AccountType) return item
- });
- if (void 0 === $stateParams.app) vm.AppBranding = {
- HeaderTitle: "Transfer",
- Css: "transfer"
- };
- else switch ($stateParams.app) {
- case "banking":
- vm.AppBranding = {
- HeaderTitle: "My Bank",
- Css: "banking banking-transfer",
- Title: "Transfer Money",
- ButtonLabel: "Transfer",
- ShowAmount: !0
- }, vm.FromAccountOptions = accountsNoCashbox, vm.ToAccountOptions = accountsNoCashbox;
- break;
- case "investment":
- vm.AppBranding = {
- HeaderTitle: "My Bank",
- Css: "banking banking-transfer",
- Title: "Withdraw and Close",
- ButtonLabel: "Withdraw and Close",
- ShowAmount: !1
- }, vm.FromAccountOptions = vm.InvestmentOptions, vm.ToAccountOptions = accountsNoCashbox;
- break;
- case "cashbox":
- vm.AppBranding = {
- HeaderTitle: "My Cash",
- Css: "cashbox cashbox-transfer",
- Title: "Transfer Money",
- ButtonLabel: "Transfer",
- ShowAmount: !0
- }, vm.FromAccountOptions = vm.AccountOptions, vm.ToAccountOptions = accountsNoCashbox
- }
- void 0 === $stateParams.fromAccountID ? vm.FromAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }) : (DefaultID = $stateParams.fromAccountID, "banking" !== $stateParams.app ? (vm.FromAccountModel.selected = vm.FromAccountOptions.filter(function(e) {
- return e.ID === DefaultID
- })[0], vm.FromAccountOptions = [vm.FromAccountModel.selected], "investment" === $stateParams.app && (vm.TransferValue = vm.FromAccountModel.selected.Balance)) : (vm.FromAccountModel.selected = vm.FromAccountOptions.filter(function(e) {
- return e.ID === DefaultID
- })[0], vm.FromAccountOptions = vm.FromAccountOptions.filter(function(e) {
- return 0 !== e.ID
- }))), "banking" !== $stateParams.app ? vm.ToAccountOptions = vm.AccountOptions.filter(function(e) {
- return "0" === DefaultID || e.ID !== DefaultID && "TransactionsBankAccountInstance" === e.AccountType
- }) : vm.ToAccountOptions = accountsNoCashbox, 0 === vm.ToAccountOptions.length ? vm.ToAccountOptions.unshift({
- ID: "1",
- Title: " [You have no bank account] "
- }) : vm.ToAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.ToAccountModel.selected = vm.ToAccountOptions[0]
- }, vm.cancelClicked = function() {
- utils.navigateRoute($scope, "", "back")
- }, vm.transferComplete = function() {
- log(">>> ", $stateParams.app), "investment" == $stateParams.app ? utils.navigateRoute($scope, "/app/dashboard/banking", "back") : utils.navigateRoute($scope, "", "back")
- }, $scope.$on("TransactionComplete", vm.transferComplete), vm.Initialize();
- }
- function TransferController($scope, $stateParams, FinancialInstanceService, utils, MessageService, $location) {
- function creditCardTransfer() {
- return "credit-card" != vm.parentVm.vm.ToAccountModel.selected.Type || (vm.isCreditCard = !0, utils.currencyToNumber(vm.parentVm.vm.TransferValue) >= vm.parentVm.vm.ToAccountModel.selected.MinRepayAmount ? (log(utils.currencyToNumber(vm.parentVm.vm.TransferValue), Math.abs(vm.parentVm.vm.ToAccountModel.selected.ClosingBalance)), utils.currencyToNumber(vm.parentVm.vm.TransferValue) <= Math.abs(vm.parentVm.vm.ToAccountModel.selected.ClosingBalance) || (vm.message = MessageService.showMessage({
- content: "Error: Payment exceeds closing balance"
- }), !1)) : (vm.message = MessageService.showMessage({
- content: "Error: Payment does not meet minimum repayment amount"
- }), !1))
- }
- var vm = this;
- vm.parentVm = $scope.$parent, vm.isCreditCard = !1, vm.isFromCashAccount = "cashbox" === $stateParams.app, vm.isInvestmentUrl = $location.path().indexOf("investment") !== -1, vm.message = {}, vm.Initialize = function() {
- $scope.TransferFunds = this.TransferFunds
- }, vm.TransferFunds = function() {
- if (log(vm.parentVm.vm), "1" !== vm.parentVm.vm.ToAccountModel.selected.ID) {
- if (creditCardTransfer())
- if ("0" === vm.parentVm.vm.FromAccountModel.selected.ID || "0" === vm.parentVm.vm.ToAccountModel.selected.ID) vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- });
- else {
- var data = {
- FromGameAppInstanceID: vm.parentVm.vm.FromAccountModel.selected.AppInstanceID,
- FromAccountInstanceID: vm.parentVm.vm.FromAccountModel.selected.ID,
- ToGameAppInstanceID: vm.parentVm.vm.ToAccountModel.selected.AppInstanceID,
- ToAccountInstanceID: vm.parentVm.vm.ToAccountModel.selected.ID,
- Amount: utils.currencyToNumber(vm.parentVm.vm.TransferValue)
- };
- data.Amount && data.Amount > .01 ? data.Amount <= vm.parentVm.vm.FromAccountModel.selected.Balance ? ($scope.$broadcast("ShowTransferLoading"), FinancialInstanceService.transfer(data.FromGameAppInstanceID, data.FromAccountInstanceID, data.ToGameAppInstanceID, data.ToAccountInstanceID, data.Amount, function() {
- vm.isCreditCard ? dataLayer.push({
- event: "app",
- appSelected: "my credit",
- appAction: "pay off credit card"
- }) : vm.isFromCashAccount ? dataLayer.push({
- event: "app",
- appSelected: "my cash",
- appAction: "transfer this money"
- }) : vm.isInvestmentUrl ? dataLayer.push({
- event: "app",
- appSelected: "my bank",
- appAction: "close investment"
- }) : dataLayer.push({
- event: "app",
- appSelected: "my bank",
- appAction: "transfer funds"
- }), $scope.$broadcast("ShowTransferSuccess")
- }, function(data) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: data.Message
- })
- })) : vm.isCreditCard ? vm.message = MessageService.showMessage({
- content: "Error: Not enough funds in bank account"
- }) : vm.message = MessageService.showMessage({
- content: "Error: not enough money in deposit account"
- }) : vm.message = MessageService.showMessage({
- content: "Error: please enter amount"
- })
- }
- } else vm.message = MessageService.showMessage({
- content: "Error: you need a bank account to transfer money"
- })
- }, vm.Initialize()
- }
- function PayCreditCtrl($scope, utils, FinancialInstanceService, i_creditCard, $filter, MessageService) {
- var vm = this;
- vm.AccountOptions = [], vm.FromAccountOptions = [], vm.FromAccountModel = {}, vm.ToAccountModel = {}, vm.TransferValue, vm.Initialize = function() {
- FinancialInstanceService.getAccountSources(["Banking"], function(options) {
- vm.AccountOptions = options, vm.AccountOptions = vm.AccountOptions.filter(function(e) {
- return "TransactionsBankAccountInstance" === e.AccountType
- }), vm.getCreditCard()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.getCreditCard = function() {
- i_creditCard.getGameInstanceCreditCard(function(data) {
- vm.ToAccountModel.selected = data, vm.ToAccountModel.selected.Type = "credit-card", vm.ToAccountModel.selected.AppInstanceID = utils.getInstanceAppID("Credit Cards"), vm.TransferValue = data.MinRepayAmount, vm.SetDefaults()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.SetDefaults = function() {
- vm.FromAccountOptions = vm.AccountOptions, vm.FromAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.FromAccountModel.selected = vm.FromAccountOptions[0]
- }, vm.cancelClicked = function() {
- utils.navigateRoute($scope, "", "back")
- }, $scope.$on("TransactionComplete", vm.cancelClicked), vm.Initialize()
- }
- function SelectCardController($scope, g_creditCard, i_creditCard, FinancialInstanceService, utils, MessageService, $timeout) {
- function getBankOptions(callback) {
- function createBankOptions(response) {
- response.length < 1 ? vm.BankOptions = [{
- ID: "0",
- Title: "You have no bank account"
- }] : (vm.BankOptions = response, vm.BankOptions = vm.BankOptions.filter(function(e) {
- return "TransactionsBankAccountInstance" === e.AccountType
- }), vm.BankOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), HasBankAccount = !0), callback()
- }
- function bankOptionsFailed(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- }
- FinancialInstanceService.getAccountSources(["Banking"], createBankOptions, bankOptionsFailed)
- }
- function buildCCardOptions() {
- function buildOptionModel(card) {
- vm.BankOptionModel[card.ID] = {
- SelectedOption: vm.BankOptions[0]
- }
- }
- function createCardOptions(response) {
- vm.CreditCardOptions = response.data.Results, vm.totalSlides = vm.CreditCardOptions.length, vm.CreditCardOptions.forEach(buildOptionModel), setupSlider()
- }
- g_creditCard.getGameCreditCards().success(createCardOptions)
- }
- function setupSlider() {
- vm.slickConfig = {
- data: vm.CreditCardOptions,
- adaptiveHeight: !1,
- arrows: !1,
- infinite: !1,
- enabled: !0,
- method: {},
- event: {
- init: function(event, slick) {
- vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), slick.resize()
- },
- afterChange: function(event, slick, currentSlide, nextSlide) {
- log("change"), vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
- }
- }
- }
- }
- var vm = this,
- HasBankAccount = !1;
- vm.BankOptions = [], vm.CreditCardOptions = [], vm.BankOptionModel = [], vm.numberLoaded = !1, vm.currentSlide = 1, vm.totalSlides = 1, vm.nextDisabled = !1, vm.prevDisabled = !0, getBankOptions(buildCCardOptions), vm.BuyCard = function(Card) {
- if (HasBankAccount)
- if ("0" !== vm.BankOptionModel[Card.ID].SelectedOption.ID)
- if (vm.BankOptionModel[Card.ID].SelectedOption.Balance >= Card.Cost) {
- var data = {
- CreditCardID: Card.ID,
- PurchasingBankAccountInstanceID: vm.BankOptionModel[Card.ID].SelectedOption.ID
- };
- $scope.$broadcast("ShowTransferLoading"), i_creditCard.createCreditCardInstance(data, function(accountID) {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), MessageService.showMessage({
- content: messages[0]
- })
- }), dataLayer.push({
- event: "app",
- appSelected: "my credit",
- appAction: "apply for credit card"
- })
- } else vm.message = MessageService.showMessage({
- content: "Error: Not enough funds in selected account"
- });
- else vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- });
- else vm.message = MessageService.showMessage({
- content: "Error: you need a bank account to open a Credit Card."
- })
- }, $scope.$on("TransactionComplete", function() {
- utils.navigateRoute($scope, "/app/dashboard/creditcard", "next")
- }), $scope.$on("StartNavigateRoute", function() {
- vm.slickConfig.method.slickGoTo(0, !0)
- })
- }
- function CardStatementController($scope, i_creditCard, FinancialInstanceService, utils, MessageService) {
- function creditCard(callback) {
- i_creditCard.getGameInstanceCreditCard(function(response) {
- vm.ShowApp = !0, vm.CardAccount = response, callback()
- }, function(messages) {
- log(messages), utils.navigateRoute($scope, "/app/dashboard/creditcards", "appOpen")
- })
- }
- function getTransactions() {
- FinancialInstanceService.transactions(utils.getInstanceAppID("Credit Cards"), vm.CardAccount.ID, function(response) {
- vm.Transactions = response, vm.Weeks = utils.orderTransactionsArr(vm.Transactions)
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }
- var vm = this;
- vm.CardAccount = {}, vm.Transactions = {}, vm.Weeks = {}, vm.ShowApp = !1, creditCard(getTransactions), vm.makePayment = function() {
- utils.navigateRoute($scope, "/app/dashboard/pay-credit", "next")
- }
- }
- function EmailInboxController($scope, CommunicationsService, utils, $stateParams, EmailInstanceService) {
- var vm = this;
- vm.Messages = {}, vm.Bills = {}, vm.Bank = {}, vm.AllEmails = [], vm.Butttons = [0, 0, 0], vm.SelectedBtn = 0, vm.MessageList, vm.GameAppInstanceID = utils.getInstanceAppID("Emails"), vm.appIsDisabled = utils.isGameDisabled("Emails");
- var messageTypefilter = ["EmailInstance", "DebtCollectorEmailInstance", "EmploymentSubmissionEmailInstance", "PaySlipEmailInstance", "RandomEventEmailInstance", "iBuyItemForSaleEmailInstance"],
- billsTypefilter = ["BillEmailInstance"],
- mybankTypefilter = ["CreditCardStatementEmailInstance"];
- vm.Initialize = function() {
- vm.AllEmails = [], CommunicationsService.getInstances(vm.GameAppInstanceID, function(response) {
- vm.Messages.list = response.Results.filter(function(e) {
- return messageTypefilter.indexOf(e.CommunicationType) !== -1
- }), vm.Bills.list = response.Results.filter(function(e) {
- return billsTypefilter.indexOf(e.CommunicationType) !== -1
- }), vm.Bank.list = response.Results.filter(function(e) {
- return mybankTypefilter.indexOf(e.CommunicationType) !== -1
- }), vm.Messages.notifications = vm.Messages.list.filter(function(e) {
- return e.IsRead === !1
- }).length, vm.Bills.notifications = vm.Bills.list.filter(function(e) {
- return e.IsRead === !1
- }).length, vm.Bank.notifications = vm.Bank.list.filter(function(e) {
- return e.IsRead === !1
- }).length, vm.Bills.list = EmailInstanceService.orderEmailsByWeek(vm.Bills.list), vm.AllEmails.push(vm.Messages, vm.Bills, vm.Bank), null != $stateParams.categoryID ? (vm.SelectedBtn = $stateParams.categoryID, vm.Butttons[$stateParams.categoryID] = 1, vm.MessageList = vm.AllEmails[$stateParams.categoryID].list) : (vm.Butttons = [1, 0, 0], vm.MessageList = vm.AllEmails[0].list), log(vm.AllEmails), $scope.$broadcast("UpdateEmailListPosition")
- }, function(data) {
- log(data)
- })
- }, vm.ShowMessageList = function(listId) {
- vm.SelectedBtn = listId, vm.MessageList = vm.AllEmails[listId].list;
- for (var i = 0; i < vm.Butttons.length; i++) vm.Butttons[i] = 0;
- vm.Butttons[listId] = 1, $scope.$broadcast("UpdateEmailListPosition")
- }, vm.showOverlay = !1, vm.viewEmail = function(id) {
- var currentEmail = vm.MessageList.filter(function(e) {
- return e.ID === id
- })[0];
- CommunicationsService.storeCurrentCommunication(currentEmail), utils.navigateRoute($scope, "/app/dashboard/emails/mail/" + id + "/" + vm.SelectedBtn, "next")
- }, this.Initialize()
- }
- function MailController($scope, CommunicationsService, $stateParams, utils, EmailInstanceService, GameMediaService, GameInstancesService, MessageService, $rootScope) {
- function formatEmail() {
- log(vm.Mail), vm.Mail.Username = GameInstancesService.getUser().username, vm.Mail.IsRead || vm.markRead(), vm.Mail.Content = vm.Mail.Content.replace(/(?:\r\n|\\r|\\n)/g, "<br />"), vm.Mail.Content = vm.Mail.Content.replace(/%USERNAME%/g, vm.Mail.Username)
- }
- function loadEmailTemplate() {
- var company = GameMediaService.get("companies", vm.Mail.From);
- if (company !== !1 && (vm.Mail.EmailTemplateClass = company[1], vm.Mail.EmailTemplateImage = company[0]), "BillEmailInstance" === vm.Mail.CommunicationType && vm.Mail.Fees.length > 0) {
- vm.Mail.LateFees = 0;
- for (var i = 0; i < vm.Mail.Fees.length; i++) vm.Mail.LateFees += parseInt(vm.Mail.Fees[i].Amount);
- vm.Mail.OriginalAmount = (parseInt(vm.Mail.Amount) - vm.Mail.LateFees) * -1, vm.Mail.LateFees = vm.Mail.LateFees * -1
- }
- }
- var vm = this;
- vm.ReadStatus = !1, vm.GameAppInstanceID = utils.getInstanceAppID("Emails"), vm.CommunicationInstanceID = $stateParams.id, vm.backTo = "/app/dashboard/emails/" + $stateParams.categoryID, vm.currentEmail = {}, vm.emailTemplate = "", vm.GameAppInstanceID = utils.getInstanceAppID("Emails"), this.Initialize = function() {
- switch (vm.currentEmail = CommunicationsService.getCurrentCommunication(), vm.currentEmail.CommunicationType) {
- case "iBuyItemForSaleEmailInstance":
- case "RandomEventEmailInstance":
- case "EmailInstance":
- vm.Mail = vm.currentEmail, formatEmail(), vm.emailTemplate = "app/emails/mail/email.tpl";
- break;
- case "BillEmailInstance":
- vm.emailTemplate = "app/emails/mail/email-bill.tpl", vm.getEmailContent("getInstanceBillEmail", vm.currentEmail.ID);
- break;
- case "CreditCardStatementEmailInstance":
- vm.emailTemplate = "app/emails/mail/email-credit-card-statement.tpl", vm.getEmailContent("getCreditCardStatementEmailInstance", vm.currentEmail.ID);
- break;
- case "DebtCollectorEmailInstance":
- vm.emailTemplate = "app/emails/mail/email-debt-collector.tpl", vm.getEmailContent("getDebtCollectorEmailInstance", vm.currentEmail.ID);
- break;
- case "EmploymentSubmissionEmailInstance":
- vm.emailTemplate = "app/emails/mail/email.tpl", vm.getPlainEmailContent(vm.currentEmail.ID);
- break;
- case "PaySlipEmailInstance":
- vm.emailTemplate = "app/emails/mail/email-pay-slip.tpl", vm.getEmailContent("getPaySlipEmailInstance", vm.currentEmail.ID)
- }
- }, vm.getPlainEmailContent = function(emailID) {
- CommunicationsService.getInstance(vm.GameAppInstanceID, emailID, function(response) {
- vm.Mail = response, formatEmail()
- }, function(errMsg) {
- log(errMsg)
- })
- }, vm.getEmailContent = function(call, emailID) {
- EmailInstanceService[call](emailID, function(response) {
- vm.Mail = response, formatEmail(), loadEmailTemplate()
- }, function(errMsg) {
- log(errMsg)
- })
- }, vm.markRead = function() {
- CommunicationsService.readInstance(vm.GameAppInstanceID, vm.CommunicationInstanceID, function(data) {
- vm.ReadStatus = data, $rootScope.$broadcast("UpdateNotifications")
- }, function(data) {
- log(data)
- })
- }, vm.deleteEmail = function() {
- CommunicationsService.deleteInstance(vm.GameAppInstanceID, vm.CommunicationInstanceID, function(data) {
- vm.ReadStatus = data, utils.navigateRoute($scope, "/app/dashboard/emails/" + $stateParams.categoryID, "back")
- }, function(data) {
- log(data)
- }), dataLayer.push({
- event: "app",
- appSelected: "email",
- appAction: "delete email"
- })
- }, vm.payBill = function() {
- utils.navigateRoute($scope, "/app/dashboard/emails/pay-bills/" + vm.CommunicationInstanceID, "next")
- }, vm.acceptEmail = function() {
- $scope.$broadcast("ShowTransferLoading"), CommunicationsService.actionInstance(vm.GameAppInstanceID, vm.Mail.ActionGameAppInstanceID, vm.Mail.ActionItemInstanceID, !0, function(data) {
- log(data), $scope.$broadcast("ShowTransferSuccess")
- }, function(data) {
- MessageService.showMessage({
- content: data
- }), $scope.$broadcast("ResetTransferButton")
- }), dataLayer.push({
- event: "app",
- appSelected: "email",
- appAction: "accept offer"
- })
- }, $scope.$on("TransactionComplete", function(event, args) {
- utils.navigateRoute($scope, "/app/dashboard/emails/" + $stateParams.categoryID, "back")
- }), vm.Initialize()
- }
- function PayBillController($scope, $stateParams, utils, EmailInstanceService, GameMediaService, GameInstancesService, BillsInstanceService, FinancialInstanceService, MessageService) {
- function loadEmailTemplate() {
- var company = GameMediaService.get("companies", vm.Mail.From);
- company !== !1 && (vm.Mail.EmailTemplateClass = company[1], vm.Mail.EmailTemplateImage = company[0]), vm.Mail.Username = GameInstancesService.getUser().username
- }
- var vm = this;
- vm.CommunicationInstanceID = $stateParams.id, vm.FromAccountOptions = [], vm.FromAccountModel = {}, vm.AutoPay = 0, vm.message = "", this.Initialize = function() {
- EmailInstanceService.getInstanceBillEmail(vm.CommunicationInstanceID, function(response) {
- vm.Mail = response, loadEmailTemplate(), vm.getAccounts(), log(vm.Mail)
- }, function(errMsg) {
- log(errMsg)
- })
- }, vm.getAccounts = function() {
- FinancialInstanceService.getPaymentSources(function(options) {
- vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0], log(vm.FromAccountOptions)
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.PayBill = function() {
- log(vm.FromAccountModel.Selected.ID), "0" !== vm.FromAccountModel.Selected.ID ? vm.FromAccountModel.Selected.Balance >= vm.Mail.Amount ? ($scope.$broadcast("ShowTransferLoading"), BillsInstanceService.payBill(vm.FromAccountModel.Selected.AppInstanceID, vm.FromAccountModel.Selected.ID, vm.Mail.TargetItemInstanceID, "1" == vm.AutoPay, function(response) {
- dataLayer.push({
- event: "app",
- appSelected: "email",
- appAction: "pay bill"
- }), $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: messages[0]
- })
- })) : vm.message = MessageService.showMessage({
- content: "Error: Not enough funds in selected account"
- }) : vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- })
- }, vm.Cancel = function() {
- utils.navigateRoute($scope, "", "back")
- }, $scope.$on("TransactionComplete", function(event, args) {
- utils.navigateRoute($scope, "", "back")
- }), this.Initialize()
- }
- function TextMessageListController($scope, CommunicationsService, utils, GameMediaService, TextMessageService, $timeout) {
- var vm = this;
- vm.TextMessages, vm.SortedTextMessages = [], vm.GameAppInstanceID = utils.getInstanceAppID("Text Messages"), vm.Initialize = function() {
- CommunicationsService.getInstances(vm.GameAppInstanceID, function(data) {
- vm.TextMessages = data.Results, vm.SortedTextMessages = vm.TextMessages;
- for (var i = 0; i < vm.SortedTextMessages.length; i++) vm.SortedTextMessages[i].Content = TextMessageService.replaceContentPlaceholders(vm.SortedTextMessages[i].Content);
- vm.SortedTextMessages = TextMessageService.groupTextMessages(vm.SortedTextMessages)
- }, function(data) {
- log(data)
- })
- }, vm.groupIsRead = function(index) {
- for (var i = 0; i < vm.SortedTextMessages[index].length; i++)
- if (vm.SortedTextMessages[index][i].IsRead === !1) return !1;
- return !0
- }, vm.getProfileImage = function(from) {
- return GameMediaService.get("textmessages", from)
- }, vm.viewMessage = function(index) {
- CommunicationsService.storeCurrentCommunication(vm.SortedTextMessages[index]), utils.navigateRoute($scope, "/app/dashboard/text-message/message", "next")
- }, vm.Initialize()
- }
- function TextMessageController($scope, CommunicationsService, utils, GameMediaService, TextMessageService, $timeout, $rootScope) {
- var vm = this;
- vm.Messages, vm.MessagesSorted, vm.GameAppInstanceID = utils.getInstanceAppID("Text Messages"), vm.CommunicationsAppInstanceID = utils.getGameAppID("Text Messages"), vm.ReadStatus = !1, vm.ShowLoading = !1, vm.Initialize = function() {
- vm.Messages = CommunicationsService.getCurrentCommunication(), vm.MessagesSorted = TextMessageService.groupTextMessagesThreadByWeek(vm.Messages), $timeout(function() {
- $(".app-screen__app").animate({
- scrollTop: $(".app-screen__app")[0].scrollHeight
- }, 500)
- }, 700), vm.markRead()
- }, vm.getProfileImage = function(from) {
- return GameMediaService.get("textmessages", from)
- }, vm.countUnread = 1, vm.unreadArrLength = 0, vm.unreadArr, vm.markRead = function(ActionableInstanceID) {
- vm.countUnread = 0, vm.unreadArrLength = 0, vm.unreadArr = [];
- for (var i = 0; i < vm.MessagesSorted.length; i++)
- for (var c = 0; c < vm.MessagesSorted[i].length; c++) vm.MessagesSorted[i][c].IsRead || vm.unreadArr.push(vm.MessagesSorted[i][c].ID);
- vm.unreadArrLength = vm.unreadArr.length, vm.unreadArrLength > 0 && vm.callReadAPI()
- }, vm.callReadAPI = function() {
- log(vm.GameAppInstanceID, vm.unreadArr[vm.countUnread]), CommunicationsService.readInstance(vm.GameAppInstanceID, vm.unreadArr[vm.countUnread], function(data) {
- vm.ReadStatus = data, log(">> ", vm.countUnread == vm.unreadArrLength), vm.countUnread == vm.unreadArrLength - 1 ? (log("fire event"), $rootScope.$broadcast("UpdateNotifications")) : (vm.countUnread++, vm.callReadAPI())
- }, function(data) {
- log(data)
- })
- }, vm.updateAsActioned = function() {
- for (var i = 0; i < vm.MessagesSorted.length; i++) vm.MessagesSorted[i][0].ActionItemInstanceID == vm.actionItemInstanceID && (vm.MessagesSorted[i][0].Actioned = !0, vm.MessagesSorted[i][0].Accepted = vm.actionResponse)
- }, vm.actionClicked = function(actionGameAppInstanceID, actionItemInstanceID, action) {
- vm.actionResponse = action, vm.actionItemInstanceID = actionItemInstanceID, CommunicationsService.actionInstance(vm.GameAppInstanceID, actionGameAppInstanceID, actionItemInstanceID, action, function(data) {
- vm.updateAsActioned(), vm.updateMessages()
- }, function(data) {
- log(data)
- });
- var appAction = "decline";
- action && (appAction = "accept"), dataLayer.push({
- event: "app",
- appSelected: "messages",
- appAction: appAction
- })
- }, vm.updateMessages = function() {
- CommunicationsService.getInstances(vm.GameAppInstanceID, function(data) {
- vm.TextMessages = data.Results, vm.SortedTextMessages = vm.TextMessages;
- for (var i = 0; i < vm.SortedTextMessages.length; i++) vm.SortedTextMessages[i].Content = TextMessageService.replaceContentPlaceholders(vm.SortedTextMessages[i].Content);
- vm.SortedTextMessages = TextMessageService.groupTextMessages(vm.SortedTextMessages);
- for (var messageThreadIndex = 0, i = 0; i < vm.SortedTextMessages.length; i++)
- if (vm.actionItemInstanceID === vm.SortedTextMessages[i][0].ActionItemInstanceID) {
- messageThreadIndex = i;
- break
- }
- vm.ShowLoading = !0, $timeout(function() {
- vm.ShowLoading = !1, vm.Messages = vm.SortedTextMessages[messageThreadIndex], vm.MessagesSorted = TextMessageService.groupTextMessagesThreadByWeek(vm.Messages), vm.markRead()
- }, 2e3)
- }, function(data) {
- log(data)
- })
- }, vm.Initialize()
- }
- function JobFinderListController($scope, JobFinderService, utils, GameMediaService, TextMessageService) {
- function setupSlider() {
- vm.slickConfig = {
- data: vm.CurrentJobs,
- adaptiveHeight: !1,
- arrows: !1,
- infinite: !1,
- enabled: !0,
- dots: !0,
- method: {},
- event: {
- init: function(event, slick) {
- vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), setTimeout(function() {
- slick.resize()
- }, 400)
- },
- afterChange: function(event, slick, currentSlide, nextSlide) {
- vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
- }
- }
- }
- }
- var vm = this;
- vm.JobsList, vm.JobsListSorted, vm.NoJobData = {
- Title: "Unemployed",
- WorkingDays: [],
- Salary: 0
- }, vm.CurrentJobs, vm.Initialize = function() {
- JobFinderService.getInstancePostings(function(data) {
- vm.JobsList = data.Results, vm.JobsList = JobFinderService.calculatePaymentSalary(vm.JobsList)
- }, function(data) {
- log(data)
- }), JobFinderService.getInstanceCurrentJobs(function(data) {
- vm.CurrentJobs = data.Results, vm.CurrentJobs = JobFinderService.calculatePaymentSalary(vm.CurrentJobs), 0 === vm.CurrentJobs.length && vm.CurrentJobs.push(vm.NoJobData), setupSlider()
- }, function(data) {
- log(data)
- })
- }, vm.ViewJob = function(jobID, pendingApp) {
- pendingApp || utils.navigateRoute($scope, "/app/dashboard/job-finder/job/" + jobID, "next")
- }, vm.Initialize()
- }
- function JobController($scope, JobFinderService, utils, GameMediaService, $stateParams, MessageService) {
- var vm = this;
- vm.Job, vm.JobID = $stateParams.id, vm.GameAppID = utils.getGameAppID("JobFinder"), vm.Initialize = function() {
- JobFinderService.getInstancePosting(vm.JobID, function(data) {
- vm.Job = data, vm.JobsList = JobFinderService.calculatePaymentSalary([vm.Job]), vm.Job.Description = utils.addHTMLBreaks(vm.Job.Description)
- }, function(data) {
- log(data)
- })
- }, vm.getItemImg = function(name) {
- return GameMediaService.get("item", name)
- }, vm.applyForJob = function() {
- log("applyForJob"), $scope.$broadcast("ShowTransferLoading"), JobFinderService.applyForJob(vm.Job.GameJobID, vm.GameAppID, function() {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), log(">> ", messages), vm.message = MessageService.showMessage({
- content: messages
- })
- })
- }, vm.navigateBack = function() {
- utils.navigateRoute($scope, "", "back")
- }, $scope.$on("TransactionComplete", vm.navigateBack), vm.Initialize()
- }
- function MyStuffListController($scope, ItemsService, IBuyService, utils, GameMediaService, MyStuffService) {
- function getItemsForSale() {
- IBuyService.getItemsForSale(function(data) {
- log(data.Results);
- for (var saleItem, i = 0; i < data.Results.length; i++) saleItem = vm.MyStuff.filter(function(e) {
- return e.ID === data.Results[i].ItemInstanceID
- })[0], log(saleItem), null != saleItem && (saleItem.IBuySale = !0);
- setupSlider()
- }, function(data) {
- log(data)
- })
- }
- function setupSlider() {
- vm.slickConfig = {
- data: vm.MyStuff,
- adaptiveHeight: !0,
- arrows: !1,
- infinite: !1,
- enabled: !0,
- method: {},
- event: {
- init: function(event, slick) {
- vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), vm.prevDisabled = !0, slick.resize()
- },
- afterChange: function(event, slick, currentSlide, nextSlide) {
- vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
- }
- }
- }
- }
- var vm = this;
- vm.MyStuff, vm.MockData = [{
- ID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
- Title: "Suit",
- Description: "Description",
- GameItemID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
- Price: 20,
- Success: !1,
- Messages: null
- }, {
- ID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
- Title: "Suit",
- Description: "Description",
- GameItemID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
- Price: 20,
- Success: !1,
- Messages: null
- }, {
- ID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
- Title: "Suit",
- Description: "Description",
- GameItemID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
- Price: 20,
- Success: !1,
- Messages: null
- }], vm.GameAppInstanceID = utils.getInstanceAppID("Items"), vm.Initialize = function() {
- ItemsService.getInventory(function(data) {
- vm.MyStuff = data.Results, log(vm.MyStuff), getItemsForSale()
- }, function(data) {
- log(data)
- })
- }, vm.SellStuff = function(data) {
- MyStuffService.setCurrentStuff(data), utils.navigateRoute($scope, "/app/dashboard/my-stuff/sell", "next")
- }, vm.ViewIbuyListing = function(ID) {
- utils.navigateRoute($scope, "/app/dashboard/ibuy/selling", "next")
- }, vm.Initialize()
- }
- function MyStuffSellController($scope, IBuyService, utils, MyStuffService, MessageService) {
- var vm = this;
- vm.Item = MyStuffService.getCurrentStuff(), vm.TransferValue, vm.GameAppInstanceID = utils.getInstanceAppID("iBuy"), vm.message, vm.Initialize = function() {}, vm.SellOnIbuy = function() {
- return vm.TransferValue > 1e5 ? void(vm.message = MessageService.showMessage({
- content: "The maximum sell price is $100,000"
- })) : void(vm.TransferValue > 0 ? ($scope.$broadcast("ShowTransferLoading"), IBuyService.sell(vm.Item.ID, vm.TransferValue, function() {
- dataLayer.push({
- event: "app",
- appSelected: "myStuff",
- appAction: "sell item"
- }), $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: messages
- })
- })) : vm.message = MessageService.showMessage({
- content: "Sale price must be $1 or more"
- }))
- }, vm.CancelClicked = function() {
- utils.navigateRoute($scope, "", "back")
- }, $scope.$on("TransactionComplete", vm.CancelClicked), vm.Initialize()
- }
- function IBuyListController($scope, IBuyService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
- function getBids(itemData) {
- IBuyService.getBids(function(bidData) {
- vm.Items = itemData;
- for (var item, i = 0; i < bidData.Results.length; i++) item = vm.Items.filter(function(e) {
- return e.ID === bidData.Results[i].iBuyGameItemID
- })[0], null != item && (item.UserBidding = !0)
- }, function(data) {
- log(data)
- })
- }
- function getSelling() {
- IBuyService.getItemsForSale(function(data) {
- getInventory(data.Results)
- }, function(data) {
- log(data)
- })
- }
- function getInventory(itemsSelling) {
- ItemsService.getInventory(function(inventData) {
- vm.ItemsSelling = itemsSelling;
- for (var item, i = 0; i < inventData.Results.length; i++) item = vm.ItemsSelling.filter(function(e) {
- return e.ItemInstanceID === inventData.Results[i].ID
- })[0], null != item && (item.Title = inventData.Results[i].Title);
- $timeout(function() {
- vm.ShowBuy ? $scope.$emit("UpdateAppHeight", {
- selector: "buy-item",
- offset: 10
- }) : $scope.$emit("UpdateAppHeight", {
- selector: "sell-item",
- offset: 10
- })
- }, 200)
- }, function(data) {
- log(data)
- })
- }
- function acceptCallback() {
- IBuyService.cancelSell(vm.CancelItem.ID, function(data) {
- dataLayer.push({
- event: "app",
- appSelected: "iBuy",
- appAction: "cancel sale"
- }), getSelling()
- }, function(data) {
- log(data)
- })
- }
- function declineCallback() {}
- var vm = this;
- vm.Items, vm.ItemsSelling, vm.CancelItem, vm.ShowBuy = !0, vm.Initialize = function() {
- "selling" == $stateParams.page && (vm.ShowBuy = !1), IBuyService.getItems(function(data) {
- getBids(data.Results)
- }, function(data) {
- log(data)
- }), getSelling()
- }, vm.ShowBuyClick = function() {
- vm.ShowBuy = !0, $timeout(function() {
- $scope.$emit("UpdateAppHeight", {
- selector: "buy-item",
- offset: 10
- }), $scope.$emit("RefreshWebKitScrolling")
- }, 200)
- }, vm.ShowSellClick = function() {
- vm.ShowBuy = !1, $timeout(function() {
- $scope.$emit("UpdateAppHeight", {
- selector: "sell-item",
- offset: 10
- }), $scope.$emit("RefreshWebKitScrolling")
- }, 200)
- }, vm.ViewItem = function(data) {
- data.SoldOut || data.UserBidding || (IBuyService.storeCurrentItem(data), utils.navigateRoute($scope, "/app/dashboard/ibuy/item", "next"))
- }, vm.CancelSale = function(item) {
- vm.CancelItem = item, MessageService.showConfirm({
- content: "Are you sure you want to cancel this sale?",
- acceptFn: acceptCallback,
- declineFn: declineCallback
- })
- }, vm.Initialize()
- }
- function IBuyItemController($scope, IBuyService, utils, GameMediaService) {
- var vm = this;
- vm.Item = IBuyService.getCurrentItem(), vm.ItemBG = GameMediaService.get("ibuy", vm.Item.Title), vm.BidClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/ibuy/item/bid", "next")
- }, vm.BuyClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/ibuy/item/buy", "next")
- }, vm.BackClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/ibuy", "back")
- }
- }
- function IBuyPurchaseController($scope, IBuyService, utils, GameMediaService, $location, FinancialInstanceService, MessageService, ItemsService) {
- var vm = this;
- vm.Item = IBuyService.getCurrentItem(), vm.message = "", vm.FromAccountOptions = {}, vm.FromAccountModel = {}, vm.GameAppID = utils.getGameAppID("iBuy"), vm.Initialize = function() {
- $location.path().indexOf("bid") > 0 ? (vm.IsBid = !0, vm.NextPage = "bid", vm.Heading = "Bid on item", vm.Btn = "BID NOW", vm.TransferValue = vm.Item.CurrentBid + 10) : (vm.IsBid = !1, vm.NextPage = "buy", vm.Heading = "Buy item", vm.TransferValue = vm.Item.Price, vm.Btn = "BUY NOW"), FinancialInstanceService.getPaymentSources(function(options) {
- vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0]
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.Purchase = function() {
- "0" !== vm.FromAccountModel.Selected.ID ? vm.FromAccountModel.Selected.Balance >= vm.TransferValue ? vm.IsBid ? vm.TransferValue >= vm.Item.CurrentBid + 5 ? ($scope.$broadcast("ShowTransferLoading"), IBuyService.bid(vm.Item.ID, vm.FromAccountModel.Selected.AppInstanceID, vm.FromAccountModel.Selected.ID, vm.TransferValue, function(response) {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: messages[0]
- })
- }), dataLayer.push({
- event: "app",
- appSelected: "iBuy",
- appAction: "bid now"
- })) : vm.message = MessageService.showMessage({
- content: "Error: Bid not high enough"
- }) : ($scope.$broadcast("ShowTransferLoading"), ItemsService.purchaseItem(vm.GameAppID, vm.Item.ID, vm.FromAccountModel.Selected.AppInstanceID, vm.FromAccountModel.Selected.ID, function(response) {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: messages[0]
- })
- }), dataLayer.push({
- event: "app",
- appSelected: "iBuy",
- appAction: "buy now"
- })) : vm.message = MessageService.showMessage({
- content: "Error: Not enough funds in selected account"
- }) : vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- })
- }, vm.CancelClicked = function(itemID) {
- utils.navigateRoute($scope, "/app/dashboard/ibuy/item", "back")
- }, vm.SuccessPurchase = function(itemID) {
- utils.navigateRoute($scope, "/app/dashboard/ibuy/item/complete/" + vm.NextPage, "next")
- }, $scope.$on("TransactionComplete", vm.SuccessPurchase), vm.Initialize()
- }
- function IBuyPurchaseCompleteController($scope, $location, utils, GameMediaService) {
- var vm = this;
- vm.Initialize = function() {
- $location.path().indexOf("bid") > 0 ? (vm.Heading = "Bid submitted!", vm.Image = "ibuy_bid_submitted.svg", vm.Text = "Check your email next week to find out if your bid was successful or not.") : (vm.Heading = "Item bought!", vm.Image = "ibuy_item_bought.svg", vm.Text = "Item purchased and had been added to your <i>My Stuff</i>. ")
- }, vm.BackClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/ibuy", "back")
- }, vm.Initialize()
- }
- function UShopListController($scope, UShopService, utils, GameMediaService, ItemsService, MessageService) {
- var vm = this;
- vm.Items, vm.Initialize = function() {
- UShopService.getItems(function(data) {
- vm.Items = data.Results, log(vm.Items)
- }, function(data) {
- log(data)
- })
- }, vm.ViewItem = function(data) {
- data.SoldOut || (UShopService.storeCurrentItem(data), utils.navigateRoute($scope, "/app/dashboard/ushop/item", "next"))
- }, vm.GetItemBackground = function(title) {
- return GameMediaService.get("ibuy", title)
- }, vm.Initialize()
- }
- function UShopItemController($scope, UShopService, utils, GameMediaService) {
- var vm = this;
- vm.Item = UShopService.getCurrentItem(), vm.ItemBG = GameMediaService.get("ushop", vm.Item.Title), vm.BuyClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/ushop/item/buy", "next")
- }, vm.GetItemBackground = function(title) {
- return GameMediaService.get("ibuy", title)
- }, vm.BackClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/ushop", "back")
- }
- }
- function UShopPurchaseController($scope, UShopService, utils, GameMediaService, $location, FinancialInstanceService, MessageService, ItemsService) {
- var vm = this;
- vm.Item = UShopService.getCurrentItem(), vm.message = "", vm.FromAccountOptions = {}, vm.FromAccountModel = {},
- vm.GameAppID = utils.getGameAppID("uShop"), vm.Initialize = function() {
- vm.TransferValue = vm.Item.Price, FinancialInstanceService.getPaymentSources(function(options) {
- vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0], log(vm.FromAccountModel.Selected)
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- })
- }, vm.Purchase = function() {
- log(vm.FromAccountModel.Selected.ID), "0" !== vm.FromAccountModel.Selected.ID ? vm.FromAccountModel.Selected.Balance >= vm.TransferValue ? ($scope.$broadcast("ShowTransferLoading"), ItemsService.purchaseItem(vm.GameAppID, vm.Item.ID, vm.FromAccountModel.Selected.AppInstanceID, vm.FromAccountModel.Selected.ID, function(response) {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: messages[0]
- })
- }), dataLayer.push({
- event: "app",
- appSelected: "uShop",
- appAction: "buy"
- })) : vm.message = MessageService.showMessage({
- content: "Error: Not enough funds in selected account"
- }) : vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- })
- }, vm.CancelClicked = function(itemID) {
- utils.navigateRoute($scope, "/app/dashboard/ushop/item", "back")
- }, vm.SuccessPurchase = function(itemID) {
- utils.navigateRoute($scope, "/app/dashboard/ushop", "back")
- }, $scope.$on("TransactionComplete", vm.SuccessPurchase), vm.Initialize()
- }
- function SharesListController($scope, SharesService, utils, GameMediaService, $stateParams, MessageService, $timeout) {
- var vm = this;
- vm.Shares, vm.UserShares, vm.TotalInvestment = 0, vm.ShowMarket = !0, vm.GraphColors = ["#63c089", "#ff6b6b", "#ff9e10"], vm.HighChartConfig = {
- options: {
- chart: {
- type: "area"
- },
- plotOptions: {
- series: {
- stacking: "",
- lineWidth: 2
- }
- },
- xAxis: {
- tickInterval: 1,
- labels: {
- enabled: !1
- },
- title: {
- text: "SHARE PRICE HISTORY",
- style: {
- "margin-top": "5px",
- "dominant-baseline": "hanging"
- }
- }
- },
- yAxis: {
- tickAmount: 6,
- lineWidth: 2,
- title: {
- text: " ",
- rotation: 0
- },
- labels: {
- enabled: !1
- }
- },
- legend: {
- enabled: !1
- },
- tooltip: {
- enabled: !1
- }
- },
- series: [{
- name: "",
- data: [],
- connectNulls: !0,
- id: "series-1",
- type: "area",
- dashStyle: "Solid",
- color: "#63c089",
- lineWidth: "2px"
- }],
- title: {
- text: ""
- },
- credits: {
- enabled: !1
- },
- loading: !1,
- size: {
- height: 100
- }
- }, vm.Initialize = function() {
- vm.GetShares()
- }, vm.GetShares = function() {
- SharesService.getShares(function(data) {
- vm.Shares = data.Results, vm.UserShares = [];
- var c = 0;
- vm.Shares.forEach(function(share) {
- share.OwnedShares > 0 && vm.UserShares.push(share), share.HightChart = angular.copy(vm.HighChartConfig);
- for (var tempArr = share.PreviousWeekValues.reverse(), i = 0; i < tempArr.length; i++) share.HightChart.series[0].data.push(tempArr[i].Value);
- share.HightChart.series[0].color = vm.GraphColors[c], c++
- }), vm.UserShares.forEach(function(share) {
- vm.TotalInvestment += share.CurrentPrice * share.OwnedShares
- }), $timeout(function() {
- $scope.$emit("UpdateAppHeight", {
- selector: "share-card",
- offset: 60
- })
- }, 200)
- }, function(data) {
- log(data)
- })
- }, vm.ShowMarketClick = function() {
- vm.ShowMarket = !0, $timeout(function() {
- $scope.$emit("UpdateAppHeight", {
- selector: "share-card",
- offset: 60
- }), $scope.$broadcast("highchartsng.reflow")
- }, 200)
- }, vm.ShowPortfolioClick = function() {
- vm.ShowMarket = !1, $timeout(function() {
- $scope.$emit("UpdateAppHeight", {
- selector: "user-share-card",
- offset: 170
- })
- }, 200)
- }, vm.ChangeIndicator = function(last, current) {
- return current - last > 0 ? "up icon-180" : "down"
- }, vm.BuyShareClicked = function(share) {
- share.TotalShares != share.OwnedShares && (SharesService.storeCurrentShare(share), utils.navigateRoute($scope, "/app/dashboard/shares/buy", "next"))
- }, vm.SellShareClicked = function(share) {
- SharesService.storeCurrentShare(share), utils.navigateRoute($scope, "/app/dashboard/shares/sell", "next")
- }, vm.Initialize()
- }
- function SharesBuyController($scope, SharesService, utils, GameMediaService, $stateParams, MessageService, FinancialInstanceService) {
- var vm = this;
- vm.Share = SharesService.getCurrentShare(), vm.FromAccountOptions = {}, vm.FromAccountModel = {}, log(vm.Share), vm.Slider = {
- value: 1,
- options: {
- floor: 1,
- ceil: vm.Share.TotalShares - vm.Share.OwnedShares,
- hidePointerLabels: !0,
- hideLimitLabels: !0,
- step: 1,
- showSelectionBarFromValue: 1,
- showSelectionBar: !0,
- showSelectionBarEnd: !0
- }
- }, vm.TotalPrice = 0, vm.Cost = 0, vm.OnCountChange = function() {
- vm.Slider.value > vm.Slider.options.ceil && (vm.Slider.value = vm.Slider.options.ceil)
- }, vm.Initialize = function() {
- FinancialInstanceService.getPaymentSources(function(options) {
- log("options > ", options), vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0]
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- }), $scope.$watch("vm.Slider.value", function(newValue, oldValue) {
- vm.Cost = newValue * vm.Share.CurrentPrice, vm.TotalPrice = vm.Cost + vm.Share.BrokerageFee * vm.Cost
- })
- }, vm.Purchase = function() {
- vm.TransferValue = vm.TotalPrice, "0" !== vm.FromAccountModel.Selected.ID ? vm.Slider.value > 0 ? vm.FromAccountModel.Selected.Balance >= vm.TransferValue ? ($scope.$broadcast("ShowTransferLoading"), SharesService.buyShares(vm.Share.ID, vm.FromAccountModel.Selected.AppInstanceID, vm.FromAccountModel.Selected.ID, vm.Slider.value, function(response) {
- $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: messages[0]
- })
- }), dataLayer.push({
- event: "app",
- appSelected: "shares",
- appAction: "buy shares"
- })) : vm.message = MessageService.showMessage({
- content: "Error: Not enough funds in selected account"
- }) : vm.message = MessageService.showMessage({
- content: "Error: Please select at least 1 share to buy"
- }) : vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- }), log(vm.message)
- }, vm.CancelClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/shares", "back")
- }, $scope.$on("TransactionComplete", vm.CancelClicked), vm.Initialize()
- }
- function SharesSellController($scope, SharesService, utils, GameMediaService, $stateParams, MessageService, FinancialInstanceService) {
- var vm = this;
- vm.Share = SharesService.getCurrentShare(), vm.FromAccountOptions = {}, vm.FromAccountModel = {}, vm.Slider = {
- value: 1,
- options: {
- floor: 1,
- ceil: vm.Share.OwnedShares,
- hidePointerLabels: !0,
- hideLimitLabels: !0,
- step: 1,
- showSelectionBarFromValue: 1,
- showSelectionBar: !0,
- showSelectionBarEnd: !0
- }
- }, vm.TotalPrice = 0, vm.Cost = 0, vm.OnCountChange = function() {
- vm.Slider.value > vm.Slider.options.ceil && (vm.Slider.value = vm.Slider.options.ceil)
- }, vm.Initialize = function() {
- FinancialInstanceService.getPayoutSources(function(options) {
- vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
- ID: "0",
- Title: " [Select Account] "
- }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0]
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- })
- }), $scope.$watch("vm.Slider.value", function(newValue, oldValue) {
- vm.Cost = newValue * vm.Share.CurrentPrice, vm.TotalPrice = vm.Cost - vm.Share.BrokerageFee * vm.Cost
- })
- }, vm.Sell = function() {
- vm.TransferValue = vm.TotalPrice, "0" !== vm.FromAccountModel.Selected.ID ? vm.Slider.value > 0 ? ($scope.$broadcast("ShowTransferLoading"), SharesService.sellShares(vm.Share.ID, vm.FromAccountModel.Selected.AppInstanceID, vm.FromAccountModel.Selected.ID, vm.Slider.value, function(response) {
- dataLayer.push({
- event: "app",
- appSelected: "shares",
- appAction: "sell shares"
- }), $scope.$broadcast("ShowTransferSuccess")
- }, function(messages) {
- $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
- content: messages[0]
- })
- })) : vm.message = MessageService.showMessage({
- content: "Error: Please select at least 1 share to sell"
- }) : vm.message = MessageService.showMessage({
- content: "Error: please select an account"
- })
- }, vm.CancelClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/shares", "back")
- }, $scope.$on("TransactionComplete", vm.CancelClicked), vm.Initialize()
- }
- function EndOfWeekEndController($scope, GameInstancesService, utils, $timeout, EndOfWeekService) {
- var vm = this;
- vm.IsQuestion = !1, vm.currentWeek = GameInstancesService.getCurrentWeek(), vm.totalWeeks = GameInstancesService.getTotalWeeks(), vm.Init = function() {
- EndOfWeekService.eowQuestionsGenerate(function(response) {
- log("eowQuestionsGenerate > ", response), vm.IsQuestion = !0
- }, function(response) {
- log("fail", response), "A question already generated for this week." == response ? vm.IsQuestion = !0 : $timeout(function() {
- utils.navigateRoute($scope, "/end-of-week/summary", "next")
- }, 3e3)
- })
- }, vm.BonusQuestion = function() {
- utils.navigateRoute($scope, "/end-of-week/question", "next")
- }, vm.Init()
- }
- function EndOfWeekQuestionController($scope, GameInstancesService, utils, EndOfWeekService, $interval, MessageService) {
- function resetSelection() {
- for (var i = 0; i < vm.Question.Answers.length; i++) vm.Question.Answers[i].Selected = "";
- vm.Selection >= 0 && (vm.Question.Answers[vm.Selection].Selected = "selected")
- }
- var vm = this;
- vm.currentWeek = GameInstancesService.getCurrentWeek(), vm.Question, vm.TimerInterval, vm.TimesUp = !1, vm.TotalTime = 60, vm.Time = 60, vm.Selection = -1, vm.AnswerResponse = "", vm.Init = function() {
- EndOfWeekService.eowQuestions(function(response) {
- vm.Question = response, resetSelection(), log(response), vm.TotalTime = vm.Question.TotalSeconds, vm.Time = vm.TotalTime, vm.TimerInterval = $interval(function() {
- vm.Time--, 0 === vm.Time && (vm.TimesUp = !0, $interval.cancel(vm.TimerInterval), vm.ShowQuestion = !1, vm.ShowIncorrectScreen = !0, vm.sendAnswer(vm.Question.ID, null, !1))
- }, 1e3)
- }, function(response) {
- log("fail", response), "Could not find a generated question. Generate a question." == response[0] && MessageService.showConfirm({
- content: "Could not find a generated question.",
- acceptFn: vm.Continue,
- declineFn: !1,
- acceptBtnLabel: "GO TO SUMMARY",
- declineBtnLabel: ""
- })
- })
- }, vm.AnswerClicked = function(index) {
- vm.DisableAnswers || (vm.Selection = index, resetSelection())
- }, vm.SubmitAnswer = function() {
- vm.Selection != -1 && ($interval.cancel(vm.TimerInterval), vm.ShowQuestion = !0, vm.sendAnswer(vm.Question.ID, vm.Question.Answers[vm.Selection].ID, !1), dataLayer.push({
- event: "quiz",
- quizAction: "submit",
- quizLabel: "week " + vm.currentWeek + " end of week bonus question",
- quizType: "bonus quiz"
- }))
- }, vm.sendAnswer = function(qID, qanswer, skip) {
- EndOfWeekService.eowQuestionsAnswer(qID, qanswer, skip, vm.Time, function(response) {
- log(response.Messages[0]), "Question Skipped" == response.Messages[0] ? utils.navigateRoute($scope, "/end-of-week/summary", "next") : response.AnsweredCorrectly ? (EndOfWeekService.setQuestionData({
- Time: vm.Time,
- CashReward: response.Reward,
- TimeBonus: response.Bonus
- }), utils.navigateRoute($scope, "/end-of-week/feedback-correct", "next")) : (EndOfWeekService.setQuestionData({
- Time: vm.Time,
- CashReward: 0,
- TimeBonus: 0
- }), utils.navigateRoute($scope, "/end-of-week/feedback-incorrect", "next"))
- }, function(response) {
- log("fail", response), "Question has already been answered." == response && MessageService.showConfirm({
- content: response,
- acceptFn: vm.Continue,
- declineFn: !1,
- acceptBtnLabel: "GO TO SUMMARY",
- declineBtnLabel: ""
- })
- })
- }, vm.SkipAnswer = function() {
- dataLayer.push({
- event: "quiz",
- quizAction: "skip",
- quizLabel: "week " + vm.currentWeek + " end of week bonus question",
- quizType: "bonus quiz"
- }), vm.sendAnswer(vm.Question.ID, null, !0)
- }, vm.Continue = function() {
- utils.navigateRoute($scope, "/end-of-week/summary", "next")
- }, vm.Init()
- }
- function EndOfWeekFeedbackController($scope, GameInstancesService, utils, EndOfWeekService) {
- var vm = this;
- vm.currentWeek = GameInstancesService.getCurrentWeek(), vm.data = EndOfWeekService.getQuestionData(), vm.Time = vm.data.Time, vm.CashReward = vm.data.CashReward, vm.TimeBonus = vm.data.TimeBonus, vm.Continue = function() {
- utils.navigateRoute($scope, "/end-of-week/summary", "next")
- }
- }
- function EndOfWeekSummaryController($scope, EndOfWeekService, utils, GameInstancesService, GameMediaService) {
- var vm = this;
- vm.currentWeek = GameInstancesService.getCurrentWeek(), vm.Summary, vm.howl = GameMediaService.get("mentor", "happy"), vm.TextColor, vm.Init = function() {
- EndOfWeekService.getCurrentSummary(function(response) {
- log(response), vm.Summary = response, GameInstancesService.endWeek(function(response) {
- log("success ", response), response.Week > response.TotalGameWeeks ? (GameInstancesService.checkEndGameSurvey(function(response) {
- if (response.HasEndSurvey) return void(vm.ContinueBtnText = "START QUIZ")
- }, function(repsonse) {
- log("fail", repsonse)
- }), vm.ContinueBtnText = "FINISH THE GAME") : vm.ContinueBtnText = "START NEXT WEEK"
- }, function(response) {
- log("fail ", response)
- })
- }, function(response) {
- log("fail", response)
- })
- }, vm.ChangeIndicator = function(diff) {
- return diff > 0 ? (vm.howl = GameMediaService.get("mentor", "happy"), vm.TextColor = "green", "up icon-180") : (vm.howl = GameMediaService.get("mentor", "facepalm"), vm.TextColor = "red", "down")
- }, vm.StartWeek = function() {
- utils.navigateRoute($scope, "/end-of-week/start", "next")
- }, vm.Logout = function() {
- utils.navigateRoute($scope, "/auth/game")
- }, vm.Init()
- }
- function EndOfWeekStartController($scope, $localStorage, GameInstancesService, utils, $timeout) {
- var vm = this;
- vm.CallBackSuccess = !1;
- var currentWeek = parseInt(GameInstancesService.getCurrentWeek()),
- totalWeeks = parseInt(GameInstancesService.getTotalWeeks());
- vm.currentWeek = 1 + currentWeek, vm.currentWeek > totalWeeks ? (dataLayer.push({
- event: "game completed",
- gameNumber: "game " + $localStorage.GameNumber
- }), GameInstancesService.checkEndGameSurvey(function(response) {
- response.HasEndSurvey && dataLayer.push({
- event: "end of game quiz",
- endGameQuizAction: "start quiz",
- gameNumber: "game " + $localStorage.GameNumber
- })
- }, function(repsonse) {
- log("fail", repsonse)
- })) : dataLayer.push({
- event: "week",
- weekState: "start week",
- weekCompleted: "week " + vm.currentWeek
- }), GameInstancesService.startWeek(function() {
- vm.CallBackSuccess = !0, $timeout(function() {
- utils.navigateRoute($scope, "/app/dashboard/view", "next")
- }, 2800)
- }, function() {})
- }
- function FinanceWeeklyHomeController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
- var vm = this;
- vm.QuizComplete = !1, vm.Article, vm.Initialize = function() {
- FinanceWeeklyService.getArticle(function(data) {
- vm.Article = data, vm.QuizComplete = vm.Article.IsQuizComplete, vm.Article.Content = vm.Article.Content.replace(/(?:\r\n|\\r|\\n)/g, "<br />"), vm.Article.Content = utils.addGlossaryItems(vm.Article.Content), vm.Article.Week = GameInstancesService.getCurrentWeek(), vm.Article.Header = GameMediaService.get("financeweekly", "week" + GameInstancesService.getCurrentWeek())
- }, function(data) {
- log(data)
- })
- }, vm.ArticleClicked = function() {
- FinanceWeeklyService.storeCurrentArticle(vm.Article), dataLayer.push({
- event: "app",
- appSelected: "finance weekly",
- appAction: "read article"
- }), utils.navigateRoute($scope, "/app/dashboard/financeweekly/article", "next")
- }, vm.ArchiveClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/financeweekly/archive", "next")
- }, vm.QuizClicked = function() {
- FinanceWeeklyService.createQuiz(vm.Article.ID, function(data) {
- dataLayer.push({
- event: "app",
- appSelected: "finance weekly",
- appAction: "take quiz"
- }), utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz", "next")
- }, function(data) {
- log(data)
- })
- }, vm.Initialize()
- }
- function FinanceWeeklyArticleController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService, $location) {
- var vm = this;
- vm.QuizComplete = !1, vm.Article = FinanceWeeklyService.getCurrentArticle(), vm.Initialize = function() {}, vm.BackClicked = function() {
- $location.path().indexOf("archive") > 0 ? utils.navigateRoute($scope, "/app/dashboard/financeweekly/archive", "back") : utils.navigateRoute($scope, "/app/dashboard/financeweekly", "back")
- }, vm.Initialize()
- }
- function FinanceWeeklyArchiveController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService, $location) {
- var vm = this;
- vm.Initialize = function() {
- FinanceWeeklyService.getArticles(function(data) {
- vm.Articles = data.Results
- }, function(data) {
- log(data)
- })
- }, vm.ArticleClicked = function(article) {
- dataLayer.push({
- event: "app",
- appSelected: "finance weekly",
- appAction: "read archived article"
- }), article.Content = article.Content.replace(/(?:\r\n|\\r|\\n)/g, "<br />"), article.Header = GameMediaService.get("financeweekly", "week" + article.Week), article.Content = utils.addGlossaryItems(article.Content), FinanceWeeklyService.storeCurrentArticle(article), utils.navigateRoute($scope, "/app/dashboard/financeweekly/archive/article", "next")
- }, vm.BackClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/financeweekly", "back")
- }, vm.Initialize()
- }
- function FinanceWeeklyQuizController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService, $stateParams, $location) {
- function startQuiz() {
- FinanceWeeklyService.startQuiz(vm.Quiz.ID, function(data) {
- log(data)
- }, function(data) {
- log(data)
- })
- }
- function setupQuestion() {
- null != $stateParams.question ? utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz/" + vm.Quiz.CurrentQuestionIndex, "next") : 0 == vm.Quiz.CurrentQuestion.QuestionType || 1 == vm.Quiz.CurrentQuestion.QuestionType ? utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz/0", "next") : utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz/fill-gap", "next")
- }
- function submitQuestion(event, answers) {
- FinanceWeeklyService.submitAnswer(answers, function(data) {
- log(data), $scope.$broadcast("QuizAnswerFeedback", data.Messages)
- }, function(data) {
- log(data), MessageService.showMessage({
- content: data[0]
- })
- })
- }
- function quizQuestionFinished(event) {
- FinanceWeeklyService.completeQuestion(vm.Quiz.CurrentQuestion.ID, function(data) {
- log(data), vm.Quiz.AtLastQuestion ? (vm.showQuizEndBtn = !1, utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz/summary", "next"), FinanceWeeklyService.getQuiz(function(data) {
- vm.Quiz = data, vm.Quiz.TotalQuestions = vm.Quiz.Questions.length, dataLayer.push({
- event: "quiz",
- quizAction: "submit",
- quizLabel: "week " + vm.Week + " " + vm.Quiz.Title,
- quizType: "weekly quiz"
- })
- }, function(data) {
- log(data)
- })) : vm.Initialize()
- }, function(data) {
- log(data)
- })
- }
- function showSummary(raiseGA) {
- vm.showQuizEndBtn = !1, FinanceWeeklyService.endQuiz(vm.Quiz.ID, function(data) {
- log(data), FinanceWeeklyService.getQuiz(function(data) {
- vm.Quiz = data, vm.Quiz.TotalQuestions = vm.Quiz.Questions.length, raiseGA && dataLayer.push({
- event: "quiz",
- quizAction: "end quiz",
- quizLabel: "week " + vm.Week + " " + vm.Quiz.Title,
- quizType: "weekly quiz"
- })
- }, function(data) {
- log(data)
- })
- }, function(data) {
- log(data)
- })
- }
- function yesEndQuiz() {
- showSummary(!0), vm.showQuizEndBtn = !1, utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz/summary", "next")
- }
- function noEndQuiz() {}
- var vm = this;
- vm.Week = GameInstancesService.getCurrentWeek(), vm.QuizComplete = !1, vm.QuizTypes = ["Multiple Choice", "True or False", "Fill the Blanks"], vm.Quiz, vm.showQuizEndBtn = !0, vm.Initialize = function() {
- FinanceWeeklyService.getQuiz(function(data) {
- vm.Quiz = data, vm.Quiz.TotalQuestions = vm.Quiz.Questions.length, log(vm.Quiz), startQuiz(), $location.path().indexOf("summary") == -1 ? setupQuestion() : showSummary(!1)
- }, function(data) {
- log(data)
- })
- }, vm.EndQuiz = function() {
- vm.showQuizEndBtn ? MessageService.showConfirm({
- content: "You haven't answered all of the questions. By ending the quiz now, you will forfeit the chance to earn bonus cash on unanswered questions. What would you like to do?",
- acceptFn: yesEndQuiz,
- declineFn: noEndQuiz,
- acceptBtnLabel: "End Quiz",
- declineBtnLabel: "Keep going"
- }) : utils.navigateRoute($scope, "/app/dashboard/view", "toDash")
- }, $scope.$on("QuizSubmitAnswers", submitQuestion), $scope.$on("QuizQuestionFinished", quizQuestionFinished), $scope.$on("QuitingQuiz", vm.EndQuiz), vm.Initialize()
- }
- function FinanceWeeklyMultipleChoiceController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
- function setSelected(selected) {
- for (var i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Selected = !1
- }
- function showFeedback(event, feedback) {
- for (var overall = !0, i = 0; i < feedback.length; i++) {
- for (var index, answer = feedback[i].split(":"), c = 0; c < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; c++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[c].Classes = " disabled", $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[c].ID == answer[0] && (index = c);
- "True" == answer[1] ? $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Classes += " correct" : (overall = !1, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Classes += " incorrect")
- }
- overall ? vm.OverAllResult = 'Result - <span class="correct-text">Correct</span>' : vm.OverAllResult = 'Result - <span class="incorrect-text">Incorrect</span>'
- }
- var vm = this;
- vm.SubmitDisabled = !0, vm.ButtonText = "Submit", vm.SelectedAnswers = [], vm.HasSubmitted = !1, vm.OverAllResult = "", $scope.$watch("$parent.vm.Quiz", function(newValue, oldValue, scope) {
- null != $scope.$parent.vm.Quiz && setSelected(null)
- }), vm.AnswerClicked = function(index, qId, qIndex) {
- if (!vm.HasSubmitted) {
- for (var i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Selected = !1, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Classes = "";
- vm.SelectedAnswers = [], $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Selected = !0, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Classes = "selected", vm.SelectedAnswers.push({
- ID: qId,
- Index: qIndex
- }), vm.SelectedAnswers.length > 0 ? vm.SubmitDisabled = !1 : vm.SubmitDisabled = !0
- }
- }, vm.SubmitClicked = function() {
- vm.SubmitDisabled || vm.HasSubmitted ? vm.HasSubmitted && (vm.OverAllResult = "", vm.HasSubmitted = !1, vm.ButtonText = "Submit", vm.SubmitDisabled = !0, $scope.$emit("QuizQuestionFinished")) : ($scope.$emit("QuizSubmitAnswers", vm.SelectedAnswers), vm.HasSubmitted = !0, vm.ButtonText = "Next")
- }, $scope.$on("QuizAnswerFeedback", showFeedback)
- }
- function FinanceWeeklyFillGapController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
- function checkComplete() {
- for (var complete = 0, i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Index > -1 && complete++;
- complete == $scope.$parent.vm.Quiz.CurrentQuestion.RequiredAnswerCount ? vm.SubmitDisabled = !1 : vm.SubmitDisabled = !0
- }
- function showFeedback(event, feedback) {
- for (var i = 0; i < feedback.length; i++) {
- var answer = feedback[i].split(":");
- $scope.$broadcast("QuizShowFeedback", answer)
- }
- }
- function showWordPopup(event, wordId, offset) {
- if (!vm.HasSubmitted) {
- vm.CurrentWordIndex = wordId, $(window).outerWidth() < 992 && (offset += 60), vm.WordPopupOffset = {
- top: Math.round(offset) - 50 + "px"
- }, vm.WordPopup = !0;
- var count = 0,
- setHeight = function() {
- var el = angular.element(".word-popup-content")[0];
- if (el.clientHeight > 0) {
- var boxOffset = el.offsetTop,
- bottomOffset = boxOffset + el.clientHeight,
- gapHeight = $(".finance-weekly-fill-gap").height();
- bottomOffset > gapHeight && (vm.PageOffset = {
- height: bottomOffset + "px"
- });
- var popupHeight = el.clientHeight;
- return $(".app-screen__app").animate({
- scrollTop: offset + popupHeight - 130
- }, 500), void $scope.$apply()
- }
- count++, count < 10 && setTimeout(setHeight, 10)
- };
- setHeight()
- }
- }
- var vm = this;
- vm.SubmitDisabled = !0, vm.ButtonText = "Submit", vm.SelectedAnswers = [], vm.HasSubmitted = !1, vm.OverAllResult = "", vm.WordPopup = !1, vm.CurrentWordIndex, vm.PageOffset = {}, vm.Week = GameInstancesService.getCurrentWeek(), $scope.$watch("$parent.vm.Quiz", function(newValue, oldValue, scope) {
- if (null != $scope.$parent.vm.Quiz) {
- var text = $scope.$parent.vm.Quiz.CurrentQuestion.Text;
- text = text.replace(/{(.*?)}/g, '<blank-word id="$1">$1</blank-word>'), vm.QuestionTxt = text;
- for (var i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].WordUsed = !1, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Index = -1
- }
- }), vm.AnswerClicked = function(data) {
- for (var alreadyUsed = !1, i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].ID == data.ID && (alreadyUsed = $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].WordUsed);
- if (!alreadyUsed) {
- for (var i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Index == vm.CurrentWordIndex && ($scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].WordUsed = !1, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Index = -1), $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].ID == data.ID && ($scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].WordUsed = !0, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Index = vm.CurrentWordIndex);
- $scope.$broadcast("UpdateWordAnswer", vm.CurrentWordIndex, data), checkComplete()
- }
- }, vm.AnswerCleared = function(data) {
- for (var wordIndex = data.Index, i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Index == data.Index && ($scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].WordUsed = !1, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Index = -1);
- $scope.$broadcast("ClearAnswer", wordIndex, {
- Text: " "
- }, vm.CurrentWordIndex), checkComplete()
- }, vm.SubmitClicked = function() {
- vm.HasSubmitted && $scope.$emit("QuizQuestionFinished"), vm.SubmitDisabled || vm.HasSubmitted || (vm.SelectedAnswers = $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.filter(function(answer) {
- if (answer.Index > -1) return {
- ID: answer.ID,
- Index: answer.Index
- }
- }), $scope.$emit("QuizSubmitAnswers", vm.SelectedAnswers), vm.HasSubmitted = !0, vm.ButtonText = "Next", dataLayer.push({
- event: "quiz",
- quizAction: "submit",
- quizLabel: "week " + vm.Week + " " + $scope.$parent.vm.Quiz.Title,
- quizType: "weekly quiz"
- }))
- }, vm.CloseClicked = function() {
- vm.WordPopup = !1, vm.PageOffset = {}, $scope.$broadcast("QuizPopupClosed")
- }, $scope.$on("QuizAnswerFeedback", showFeedback), $scope.$on("QuizWordPopup", showWordPopup), $scope.$on("QuizClearWord", function(event, data) {
- vm.AnswerCleared(data)
- })
- }
- function FinanceWeeklySummaryController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
- var vm = this;
- $scope.$watch("$parent.vm.Quiz.ScoreActual", function(newValue, oldValue) {
- null != $scope.$parent.vm.Quiz && (vm.NumCorrect = $scope.$parent.vm.Quiz.ScoreActual, vm.TotalQuestions = $scope.$parent.vm.Quiz.ScorePossible, vm.Money = $scope.$parent.vm.Quiz.ScoreReward)
- }), vm.FinishClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/financeweekly", "next")
- }
- }
- function WeeklyPlannerHomeController($scope, utils, GameMediaService, ItemsService, $stateParams, MessageService, $location) {
- var vm = this;
- vm.ShowMyBudget = !0, vm.Initialize = function() {
- $location.path().indexOf("mybudget") > 0 ? vm.ShowMyBudget = !0 : $location.path().indexOf("diary") > 0 ? vm.ShowMyBudget = !1 : utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/mybudget", "appOpen")
- }, vm.ShowMyBudgetClick = function() {
- vm.ShowMyBudget = !0, utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/mybudget", "none")
- }, vm.ShowDiaryClick = function() {
- vm.ShowMyBudget = !1, utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/diary", "none")
- }, $scope.$on("UpdateTab", function(event, data) {
- vm.ShowMyBudget = data
- }), vm.Initialize()
- }
- function DiaryController($scope, WeeklyPlannerService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
- function savingComplete() {
- vm.QuestionAnswered = !0, $scope.$broadcast("ResetTransferButton")
- }
- var vm = this;
- vm.QuestionAnswered = !1, vm.Initialize = function() {
- $scope.$emit("UpdateTab", !1), WeeklyPlannerService.getCurrentQuestion(function(data) {
- log(data), vm.Question = data, vm.Question.Answer.length > 0 && (vm.QuestionAnswered = !0)
- }, function(data) {
- log(data)
- })
- }, vm.AnswerQuestion = function() {
- vm.Question.Answer.length > 0 && ($scope.$broadcast("ShowTransferLoading"), WeeklyPlannerService.answerQuestion(vm.Question.Week, vm.Question.Answer, function(data) {
- log(data), dataLayer.push({
- event: "app",
- appSelected: "weekly planner",
- appAction: "save response"
- }), $scope.$broadcast("ShowTransferSuccess")
- }, function(data) {
- $scope.$broadcast("ResetTransferButton"), log(data)
- }))
- }, vm.EditAnswer = function() {
- vm.QuestionAnswered = !1, dataLayer.push({
- event: "app",
- appSelected: "weekly planner",
- appAction: "edit response"
- })
- }, vm.ViewArchive = function() {
- utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/archive", "next")
- }, $scope.$on("TransactionComplete", savingComplete), vm.Initialize()
- }
- function MyBudgetController($scope, WeeklyPlannerService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
- function updateRemainingClass() {
- 0 == vm.SliderRemaining ? vm.RemainingClass = "zero" : vm.SliderRemaining < 0 ? vm.RemainingClass = "negative" : vm.RemainingClass = ""
- }
- function disableSliders(bool) {
- for (var i = 0; i < vm.Sliders.length; i++) vm.Sliders[i].options.disabled = bool
- }
- function updateSliderSpend(event) {
- for (var remaining = vm.Remaining, totalSliderSpend = 0, i = 0; i < vm.Sliders.length; i++) vm.Sliders[i].Value = Math.round(vm.Sliders[i].Spend / vm.Remaining * 100), totalSliderSpend += vm.Sliders[i].Spend;
- vm.SliderRemaining = remaining - totalSliderSpend, updateRemainingClass()
- }
- var vm = this;
- vm.Income = 0, vm.Expenses = {
- Total: 0,
- Rent: {
- width: "0",
- Title: "Rent",
- Expense: 0
- },
- Food: {
- width: "0",
- Title: "Food",
- Expense: 0
- },
- Travel: {
- width: "0",
- Title: "Travel",
- Expense: 0
- },
- Entertainment: {
- width: "0",
- Title: "Entertainment",
- Expense: 0
- }
- }, vm.Remaining = 0, vm.SliderRemaining = 0, vm.SliderOptions = {
- id: 0,
- floor: 0,
- ceil: 100,
- hidePointerLabels: !0,
- hideLimitLabels: !0,
- step: 1,
- showSelectionBarFromValue: 1,
- showSelectionBar: !0,
- showSelectionBarEnd: !0,
- onStart: function(sliderId, modelValue, highValue, pointerType) {
- vm.SliderStart(sliderId, modelValue, highValue, pointerType)
- },
- onChange: function(sliderId, modelValue, highValue, pointerType) {
- vm.SliderChange(sliderId, modelValue, highValue, pointerType)
- },
- onEnd: function(sliderId, modelValue, highValue, pointerType) {
- vm.SliderEnd(sliderId, modelValue, highValue, pointerType)
- }
- }, vm.Initialize = function() {
- $scope.$emit("UpdateTab", !0), vm.Sliders = [{
- Value: 0,
- Spend: null,
- Title: "Bills"
- }, {
- Value: 0,
- Spend: null,
- Title: "Goods"
- }, {
- Value: 0,
- Spend: null,
- Title: "Savings Account"
- }, {
- Value: 0,
- Spend: null,
- Title: "Shares"
- }, {
- Value: 0,
- Spend: null,
- Title: "Fixed Term Investment"
- }];
- for (var i = 0; i < vm.Sliders.length; i++) vm.Sliders[i].options = angular.copy(vm.SliderOptions), vm.Sliders[i].options.id = i;
- WeeklyPlannerService.getPlannerSummary(function(data) {
- log("--> ", data), vm.Income = data.Income;
- for (var c = 0; c < data.Expenses.length; c++) vm.Expenses.Total += data.Expenses[c].Value;
- vm.Remaining = vm.SliderRemaining = vm.Income - vm.Expenses.Total, vm.Remaining <= 0 ? (vm.Expenses.Style = {
- width: "100%"
- }, disableSliders(!0)) : vm.Expenses.Style = {
- width: Math.round(vm.Expenses.Total / vm.Income * 100) + "%"
- }, updateRemainingClass();
- for (var i = 0; i < data.Expenses.length; i++) switch (data.Expenses[i].Key) {
- case "Rent expense":
- vm.Expenses.Rent = {
- width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
- Title: "Rent",
- Expense: data.Expenses[i].Value
- };
- break;
- case "Entertainment expense":
- vm.Expenses.Entertainment = {
- width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
- Title: "Entertainment",
- Expense: data.Expenses[i].Value
- };
- break;
- case "Food expense":
- vm.Expenses.Food = {
- width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
- Title: "Food",
- Expense: data.Expenses[i].Value
- };
- break;
- case "Travel expense":
- vm.Expenses.Travel = {
- width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
- Title: "Travel",
- Expense: data.Expenses[i].Value
- }
- }
- }, function(data) {
- log(data)
- })
- }, vm.SliderStart = function(sliderId, modelValue, highValue, pointerType) {}, vm.SliderChange = function(sliderId, modelValue, highValue, pointerType) {
- vm.Sliders[sliderId].Spend = Math.round(vm.Remaining * (modelValue / 100));
- for (var remaining = vm.Remaining, totalSliderSpend = 0, i = 0; i < vm.Sliders.length; i++) vm.Sliders[i].Spend = Math.round(vm.Remaining * (vm.Sliders[i].Value / 100)), totalSliderSpend += vm.Sliders[i].Spend;
- vm.SliderRemaining = remaining - totalSliderSpend, updateRemainingClass()
- }, vm.SliderEnd = function(sliderId, modelValue, highValue, pointerType) {}, $scope.$on("SliderSpendManuallyUpdated", updateSliderSpend), vm.Initialize()
- }
- function WeeklyPlannerDiaryArchiveController($scope, utils, WeeklyPlannerService, GameMediaService, ItemsService, $stateParams, MessageService, $location) {
- var vm = this;
- vm.Data = {}, vm.Initialize = function() {
- WeeklyPlannerService.getQuestionInstances(function(data) {
- log(data), vm.Data = data
- }, function(data) {
- log(data)
- })
- }, vm.QuestionClicked = function(question) {
- WeeklyPlannerService.storeArchiveQuestion(question), utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/archive/view", "next")
- }, vm.BackClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/diary", "back")
- }, vm.Initialize()
- }
- function ViewDiaryController($scope, WeeklyPlannerService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
- function savingComplete() {
- vm.QuestionAnswered = !0, $scope.$broadcast("ResetTransferButton")
- }
- var vm = this;
- vm.Question = {}, vm.Initialize = function() {
- vm.Question = WeeklyPlannerService.getArchiveQuestion(), null != vm.Question.Week ? vm.Question.Answer.length > 0 ? vm.QuestionAnswered = !0 : vm.QuestionAnswered = !1 : utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/archive", "back");
- }, vm.AnswerQuestion = function() {
- vm.Question.Answer.length > 0 && ($scope.$broadcast("ShowTransferLoading"), WeeklyPlannerService.answerQuestion(vm.Question.Week, vm.Question.Answer, function(data) {
- log(data), dataLayer.push({
- event: "app",
- appSelected: "weekly planner",
- appAction: "save past response"
- }), $scope.$broadcast("ShowTransferSuccess")
- }, function(data) {
- $scope.$broadcast("ResetTransferButton"), log(data)
- }))
- }, vm.EditAnswer = function() {
- vm.QuestionAnswered = !1, dataLayer.push({
- event: "app",
- appSelected: "weekly planner",
- appAction: "edit past response"
- })
- }, vm.BackClicked = function() {
- utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/archive", "back")
- }, $scope.$on("TransactionComplete", savingComplete), vm.Initialize()
- }
- function EndFireworksController($scope, utils, $location, GameInstancesService, $localStorage, $window) {
- var vm = this;
- vm.GameName = "Essi Money", vm.GameHasSurvey = !1, vm.CertificateUrl = appConfig.baseUrl + "/api/i/survey/certificate?GameInstanceID=" + $localStorage.GameInstanceID, GameInstancesService.getCurrentWeek() < appConfig.gameLength && $location.path("/timeout"), GameInstancesService.checkEndGameSurvey(function(response) {
- response.HasEndSurvey && (vm.GameHasSurvey = !0, vm.GameName = " The Suncorp Essi Money Challenge")
- }, function(response) {
- log(response)
- }), vm.ViewBalanceSheet = function() {
- dataLayer.push({
- event: "view final balance",
- gameNumber: "game " + $localStorage.GameNumber
- }), utils.navigateRoute($scope, "/end-of-game/balancesheet", "next")
- }, vm.GetCertificate = function() {
- dataLayer.push({
- event: "download certificate",
- gameNumber: "game " + $localStorage.GameNumber
- }), $window.open(vm.CertificateUrl)
- }
- }
- function SurveyController($scope, utils, $location, GameInstancesService, SurveyService) {
- var vm = this;
- vm.Name = "Loading survey", SurveyService.getSurvey(function(data) {
- vm.Name = data.Name, vm.Options = data.Options
- }, function(data) {
- Log(data)
- }), vm.checkEndGameSurvey = function() {
- SurveyService.checkEndGameSurvey(function(data) {
- alert("checked if end game survey exists")
- }, function(data) {
- Log(data)
- })
- }, vm.StartSurvey = function() {
- utils.navigateRoute($scope, "/surveys/question", "next")
- }, vm.FinishSurvey = function() {
- utils.navigateRoute($scope, "/end-of-game/balancesheet", "next")
- }
- }
- function SurveyQuestionController($scope, utils, SurveyService, $localStorage) {
- function resetSelection() {
- for (var i = 0; i < vm.Answers.length; i++) vm.Answers[i].Selected = "";
- vm.Selection >= 0 && (vm.Answers[vm.Selection].Selected = "selected")
- }
- var vm = this;
- vm.CurrentQuestion, vm.TotalQuestions, vm.Question, vm.Selection = -1, vm.AnswerResponse = "", vm.Answers, vm.TotalQuestions, vm.Bonus, vm.AnswerStatus = "", vm.IsLastQuestion = !1, vm.Init = function() {
- vm.GetNextQuestion()
- }, vm.AnswerClicked = function(index) {
- vm.DisableAnswers || (vm.Selection = index, resetSelection())
- }, vm.SubmitAnswer = function() {
- vm.Selection != -1 && SurveyService.submitSurvey(vm.Answers[vm.Selection].ID, function(response) {
- dataLayer.push({
- event: "end of game quiz",
- endGameQuizAction: "submit question",
- gameNumber: "game " + $localStorage.GameNumber,
- endGameQuizQuestion: "question " + vm.CurrentQuestion
- }), 0 != vm.Bonus ? vm.Answers[vm.Selection].IsCorrect ? utils.navigateRoute($scope, "/surveys/feedback-correct", "next") : utils.navigateRoute($scope, "/surveys/feedback-incorrect", "next") : (vm.Selection = -1, vm.GetNextQuestion())
- }, function(response) {})
- }, vm.GetNextQuestion = function() {
- SurveyService.getSurvey(function(response) {
- return response.HasSurvey ? (vm.Question = response.Name, vm.Answers = response.Options, vm.Bonus = response.Bonus, vm.CurrentQuestion = response.CurrentQuestionIndex, SurveyService.setQuestionData({
- CurrentQuestion: vm.CurrentQuestion,
- TotalQuestions: response.TotalQuestionCount,
- CashReward: vm.Bonus
- }), SurveyService.getQuestionData().TotalQuestions === response.CurrentQuestionIndex && (vm.IsLastQuestion = !0), void 0) : (dataLayer.push({
- event: "end of game quiz",
- endGameQuizAction: "finish quiz",
- gameNumber: "game " + $localStorage.GameNumber
- }), void utils.navigateRoute($scope, "/end-of-game", "next"))
- }, function(response) {})
- }
- }
- function SurveyQuestionFeedbackController($scope, GameInstancesService, utils, SurveyService, $localStorage) {
- var vm = this;
- vm.progressData, vm.currentQuestion, vm.cashReward, vm.Init = function() {
- vm.progressData = SurveyService.getQuestionData(), vm.currentQuestion = vm.progressData.CurrentQuestion, vm.cashReward = vm.progressData.CashReward
- }, vm.Continue = function() {
- dataLayer.push({
- event: "end of game quiz",
- endGameQuizAction: "continue",
- gameNumber: "game " + $localStorage.GameNumber,
- endGameQuizQuestion: "question " + vm.currentQuestion
- }), utils.navigateRoute($scope, "/surveys/question", "next")
- }
- }
- function SurveyProgressController($scope, utils, $location, GameInstancesService, SurveyService) {
- var vm = this;
- vm.ProgressData, vm.BarWidth;
- var progressChanged = function() {
- vm.ProgressData = SurveyService.getQuestionData();
- var width = Math.round(vm.ProgressData.CurrentQuestion / vm.ProgressData.TotalQuestions * 100);
- vm.BarWidth = {
- width: width + "%"
- }
- };
- SurveyService.registerObserverCallback(progressChanged), vm.Init = function() {
- vm.ProgressData = SurveyService.getQuestionData();
- var width = Math.round(vm.ProgressData.CurrentQuestion / vm.ProgressData.TotalQuestions * 100);
- vm.BarWidth = {
- width: width + "%",
- transition: "none"
- }
- }
- }
- var appConfig = {
- gameLength: 26,
- baseUrl: "https://essimoney.com.au/api",
- gameApps: [{
- displayName: "My Bank",
- application: "Banking",
- state: "idle",
- url: "/app/dashboard/banking",
- priority: 2,
- mobilePriority: 2
- }, {
- displayName: "My Cash",
- application: "Cashbox",
- state: "idle",
- url: "/app/dashboard/cashbox",
- priority: 5,
- mobilePriority: 5
- }, {
- displayName: "My Credit",
- application: "Credit Cards",
- state: "idle",
- url: "/app/dashboard/creditcard",
- priority: 6,
- mobilePriority: 6
- }, {
- displayName: "Email",
- application: "Emails",
- state: "idle",
- url: "/app/dashboard/emails",
- priority: 1,
- mobilePriority: 1
- }, {
- displayName: "Messages",
- application: "Text Messages",
- state: "idle",
- url: "/app/dashboard/text-message",
- priority: 3,
- mobilePriority: 3
- }, {
- displayName: "Job Finder",
- application: "JobFinder",
- state: "idle",
- url: "/app/dashboard/job-finder",
- priority: 8,
- mobilePriority: 8
- }, {
- displayName: "MyStuff",
- application: "Items",
- state: "idle",
- url: "/app/dashboard/my-stuff",
- priority: 7,
- mobilePriority: 7
- }, {
- displayName: "iBuy",
- application: "iBuy",
- state: "idle",
- url: "/app/dashboard/ibuy",
- priority: 10,
- mobilePriority: 10
- }, {
- displayName: "uShop",
- application: "uShop",
- state: "idle",
- url: "/app/dashboard/ushop",
- priority: 9,
- mobilePriority: 9
- }, {
- displayName: "Shares",
- application: "Shares",
- state: "idle",
- url: "/app/dashboard/shares",
- priority: 11,
- mobilePriority: 11
- }, {
- displayName: "Finance Weekly",
- application: "News",
- state: "idle",
- url: "/app/dashboard/financeweekly",
- priority: 12,
- mobilePriority: 12
- }, {
- displayName: "Weekly Planner",
- application: "Planner",
- state: "idle",
- url: "/app/dashboard/weeklyplanner/mybudget",
- priority: 4,
- mobilePriority: 4
- }],
- enableLogging: !0,
- glossary: [{
- Term: "Gross Pay",
- Definition: "The total amount of money you earned for the week, before any deductions were taken from your pay."
- }, {
- Term: "Net Pay",
- Definition: "The amount of money you actually receive in your pay after income tax and superannuation have been deducted."
- }, {
- Term: "Income Tax",
- Definition: "A government tax or charge based on what a person earns each week."
- }, {
- Term: "Superannuation",
- Definition: "An amount of money put aside from each weekโs pay and paid into a fund for when you retire."
- }, {
- Term: "Group Certificate",
- Definition: "A statement provided to all employees by an employer detailing gross income, net income, tax paid and superannuation paid within the financial year."
- }, {
- Term: "Credit Card",
- Definition: "A card which enables you to purchase goods and services with money lent to you by a bank or other financial institution."
- }, {
- Term: "Interest",
- Definition: "The amount of money you have to pay to the financial institution for using its money to buy your goods and services."
- }, {
- Term: "Interest Rate",
- Definition: "The percentage rate of interest you pay on the amount of credit you have used on your credit card."
- }, {
- Term: "Credit card limit",
- Definition: "The maximum amount of money that you are able to use on your credit card."
- }, {
- Term: "Cash",
- Definition: "Cash consists of coins (5c, 10c, 20c, 50c, $1, $2) and bank notes ($5, $10, $20, $50, $100) that may be used to pay for goods and services."
- }, {
- Term: "Bank Account",
- Definition: "Bank account holds deposits of money you make into your personal individual account."
- }, {
- Term: "ATM",
- Definition: "Automated Teller Machine"
- }, {
- Term: "Internet Banking",
- Definition: "Internet Banking involves the ability to transfer money from one account to another, and to pay bills online."
- }, {
- Term: "Phone Banking",
- Definition: "The ability to transfer money from one account to another, and to pay bills using a telephone or mobile phone."
- }, {
- Term: "BPay",
- Definition: "Bpay enables you to have bills paid directly from your account to a business."
- }, {
- Term: "EFTPOS ",
- Definition: "Electronic Funds Transfer Point of Sale."
- }, {
- Term: "Financial planner",
- Definition: "An independent financial adviser who provides advice on the different financial options available to you and who helps you understand the terminology and processes of financial planning."
- }, {
- Term: "Budget",
- Definition: "A statement of your income and expenditure over a period of time."
- }, {
- Term: "Income",
- Definition: "Money earned by you from work and other sources"
- }, {
- Term: "Expenses",
- Definition: "The money you spend on your needs and wants."
- }, {
- Term: "Debt",
- Definition: "Debt is the amount of money owed by a person to another person, business and/or financial institution."
- }, {
- Term: "Assets",
- Definition: "Assets are items of value that an individual owns such as a house, car, jewellery or cash in the bank."
- }, {
- Term: "Lender",
- Definition: "Lender - A person, business or financial institution from whom you have borrowed money and are in debt to."
- }, {
- Term: "Debt consolidation",
- Definition: "Debt consolidation is putting all your debts into one debt"
- }, {
- Term: "Debt collector",
- Definition: "Debt collector is a person or company used by a lender to pursue you for the lenderโs money"
- }, {
- Term: "Bankruptcy",
- Definition: "Bankruptcy occurs when a person is unable to pay their debts and a court order is issued declaring a person bankrupt."
- }, {
- Term: "Unemployment",
- Definition: "Unemployment is when a person does not have a job, but is currently seeking a job in the workforce."
- }, {
- Term: "Centrelink",
- Definition: "Centrelink is the Australian Government organisation which looks after unemployment and social security (pensions) payments."
- }, {
- Term: "Personal loan",
- Definition: "Personal loan โ an amount of money used for a specific consumer purpose such as the purchase of a car."
- }, {
- Term: "Guarantor",
- Definition: "A person who agrees to personally guarantee that your loan will be re-payed. This person becomes responsible for the loan if you are unable to pay."
- }, {
- Term: "Principal",
- Definition: "The Principal is the amount that is borrowed in a loan."
- }, {
- Term: "Interest Rate 2",
- Definition: "The interest rate is the cost of the loan and determines how much extra money must be repaid on the loan."
- }, {
- Term: "Warranty",
- Definition: "Is a guarantee or assurance that a product or item will perform or function without fault for a period of time."
- }, {
- Term: "Investing",
- Definition: "Investing is the purchase of an asset with the intention of receiving an income or a capital gain or both for the owner."
- }, {
- Term: "Rate of return",
- Definition: "Rate of return is how fast your money grows."
- }, {
- Term: "Risk",
- Definition: "Risk is the level of uncertainty associated with a particular investment."
- }, {
- Term: "Bonds",
- Definition: "Bonds and securities are when you lend money to a company or government for a fixed period of time at a guaranteed interest rate."
- }, {
- Term: "Property",
- Definition: "Property includes land, houses, units, farms, shopping centres and commercial buildings."
- }, {
- Term: "Collectibles",
- Definition: "Collectibles include paintings, sculptures, rare stamps etc."
- }, {
- Term: "Managed Funds",
- Definition: "Managed Funds pool money from several investors and use the money to buy investments such as property and shares."
- }, {
- Term: "Shares",
- Definition: "Shares are an investment that represents ownership in a company."
- }, {
- Term: "Stockbroker",
- Definition: "A stockbroker is a person who buys and sells shares on your behalf."
- }, {
- Term: "Dividend",
- Definition: "A dividend is a share of the companyโs profits given to shareholders on the basis of how many shares they own."
- }, {
- Term: "Capital gain",
- Definition: "Capital gain occurs when the sale price for an asset is greater than the original cost."
- }, {
- Term: "Insurance",
- Definition: "Insurance is an arrangement where an insurance company agrees to pay an amount of money to the insurance policy holder if a defined event occurs in an exchange for an insurance premium being paid."
- }, {
- Term: "Insurance policy",
- Definition: "An insurance policy is a written statement of what is covered when you take out insurance."
- }, {
- Term: "Insurance premium",
- Definition: "An insurance premium is the payment made to an insurance company in exchange for protection or financial help if defined circumstances or events occur."
- }, {
- Term: "Insurance claim",
- Definition: "An insurance claim occurs when you submit an application for financial help when a defined event covered by your insurance policy happens to you."
- }, {
- Term: "Excess",
- Definition: "An excess is an additional amount of money you agree to pay if a defined event occurs, in return for a lower insurance premium."
- }, {
- Term: "Car Insurance",
- Definition: "Car Insurance covers damage to your car, other cars and property in the event of an accident or theft."
- }, {
- Term: "Health Insurance",
- Definition: "Health Insurance covers you against medical and hospital expenses not covered by Medicare."
- }, {
- Term: "Home insurance",
- Definition: "Home insurance covers damage to your house in the vent of fire, flood, earthquake etc."
- }, {
- Term: "Contents insurance",
- Definition: "Contents insurance covers damage to or theft of the contents of your house such as carpets, electrical appliances, clothing etc."
- }, {
- Term: "Life assurance",
- Definition: "Life assurance provides a payout to a nominated person in the event of your death."
- }, {
- Term: "Travel insurance",
- Definition: "Travel insurance covers you in the event of loss of luggage or medical expenses due to illness whilst travelling."
- }, {
- Term: "Income protection",
- Definition: "Income protection insurance covers the loss of income through personal; accident, illness or disability."
- }, {
- Term: "Entrepreneur",
- Definition: "An entrepreneur is someone who organises and manages a business, develops new ways of thinking and puts this into action."
- }, {
- Term: "Life expectancy",
- Definition: "Life expectancy is the age to which you can expect to live."
- }]
- };
- angular.module("essimoney", ["essimoney.ushop", "essimoney.jobfinder", "essimoney.creditcards", "essimoney.textmessage", "essimoney.bills", "essimoney.communication", "essimoney.email", "essimoney.whereimat", "essimoney.ibuy", "essimoney.items", "essimoney.mystuff", "essimoney.dashboard", "essimoney.creditcards", "essimoney.banking", "essimoney.cashbox", "essimoney.financial", "essimoney.shares", "essimoney.authentication", "essimoney.endofweek", "essimoney.management", "essimoney.mentorpopup", "essimoney.financeweekly", "essimoney.weeklyplanner", "essimoney.endofgame", "essimoney.survey", "ui.router", "ngAnimate", "slickCarousel", "ngDialog", "ngSanitize", "ngStorage"]), angular.module("essimoney").config(["$stateProvider", "$urlRouterProvider", "$httpProvider", "$locationProvider", function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) {
- $urlRouterProvider.otherwise("/timeout"), $locationProvider.hashPrefix(""), $stateProvider.state("app", {
- url: "/app",
- templateUrl: "app/operating-system/game-template.view.tpl"
- }).state("timeout", {
- url: "/timeout",
- templateUrl: "app/partials/404.view.tpl"
- }).state("app.dashboard", {
- url: "/dashboard",
- views: {
- appView: {
- template: '<div ui-view class="app-view height-100" ng-class="main.ViewTransition" ></div>'
- },
- leftView: {
- templateUrl: "app/dashboard/dashboard-desktop.view.tpl",
- controller: "DashboardController",
- controllerAs: "vm"
- },
- rightView: {
- templateUrl: "app/where-im-at/where-im-at-desktop.view.tpl",
- controller: "WhereImAtController",
- controllerAs: "vm"
- }
- }
- }), $httpProvider.interceptors.push(["$q", "$location", "$localStorage", function($q, $location, $localStorage) {
- return {
- request: function(config) {
- config.headers = config.headers || {};
- var base = $location.path().split("/");
- return "app" !== base[1] && "end-of-week" !== base[1] && "end-of-game" !== base[1] && "surveys" !== base[1] || ($localStorage.Token && $localStorage.GameInstanceID ? config.headers.Authorization = "bearer " + encodeURIComponent($localStorage.Token) : $location.path("/timeout")), config
- },
- responseError: function(response) {
- return 401 !== response.status && 403 !== response.status || $location.path("/timeout"), $q.reject(response)
- }
- }
- }])
- }]), angular.module("essimoney").filter("isEmpty", function() {
- var bar;
- return function(obj) {
- for (bar in obj)
- if (obj.hasOwnProperty(bar)) return !1;
- return !0
- }
- }), angular.module("essimoney").filter("orderObjectBy", function() {
- return function(items, field, reverse) {
- var filtered = [];
- return angular.forEach(items, function(item) {
- filtered.push(item)
- }), filtered.sort(function(a, b) {
- return a[field] > b[field] ? 1 : -1
- }), reverse && filtered.reverse(), filtered
- }
- }), angular.module("essimoney").factory("utils", ["$localStorage", "$http", "ngDialog", "$location", "$window", "$timeout", function($localStorage, $http, ngDialog, $location, $window, $timeout) {
- return {
- "if": function(exp) {
- var expEval = function(exp) {
- this.params = [], this.exp = "function" == typeof exp ? exp(this) : exp
- };
- return expEval.prototype["true"] = function(success) {
- return this.exp && success.apply(null, this.params), this
- }, expEval.prototype["false"] = function(fail) {
- return this.exp || fail.apply(null, this.params), this
- }, expEval.prototype.addParams = function(params) {
- 1 === arguments.length ? (angular.isArray(params) || (params = [params]), this.params = this.params.concat(params)) : this.params = arguments
- }, new expEval(exp)
- },
- req: function(config) {
- var request = $http(config);
- return {
- success: function(callback) {
- return request.then(callback), this
- },
- fail: function(callback) {
- return request.then(null, callback), this
- }
- }
- },
- getInstanceAppID: function(App) {
- var gApps = $localStorage.GameAppInstances;
- return gApps.filter(function(e) {
- return e.Name === App
- })[0].ID
- },
- getGameAppID: function(App) {
- var gApps = $localStorage.GameAppInstances;
- return gApps.filter(function(e) {
- return e.Name === App
- })[0].GameAppID
- },
- isGameDisabled: function(App) {
- var gApps = $localStorage.GameAppInstances;
- return gApps.filter(function(e) {
- return e.Name === App
- })[0].IsDisabled
- },
- navigateRoute: function(scope, path, direction) {
- switch (scope.$emit("StartNavigateRoute"), direction) {
- case "next":
- scope.$emit("updateViewTransition", {
- transition: "transition-app-screen-in",
- path: path
- }), $timeout(function() {
- $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
- }, 100);
- break;
- case "back":
- scope.$emit("updateViewTransition", {
- transition: "transition-app-screen-out",
- path: path
- }), $timeout(function() {
- "" === path ? ($window.history.back(), $(".app-screen__app, html, body").scrollTop(0)) : (scope.$emit("updateViewTransition", {
- transition: "transition-app-screen-out",
- path: path
- }), $timeout(function() {
- $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
- }, 100))
- }, 100);
- break;
- case "appOpen":
- scope.$emit("updateViewTransition", {
- transition: "transition-dash-to-app",
- path: path
- }), $timeout(function() {
- $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
- }, 100);
- break;
- case "toDash":
- scope.$emit("updateViewTransition", {
- transition: "transition-app-to-dash",
- path: path
- }), $timeout(function() {
- $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
- }, 100);
- break;
- case "none":
- scope.$emit("updateViewTransition", {
- transition: "",
- path: path
- }), $timeout(function() {
- $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
- }, 100)
- }
- },
- currencyToNumber: function(currency) {
- return "$" === String(currency).substring(0, 1) ? currency.substring(1, currency.length) : currency
- },
- addHTMLBreaks: function(content) {
- return content.replace(/(?:\r\n|\\r|\\n)/g, "<br/>")
- },
- orderTransactionsArr: function(transactions) {
- for (var weeks = {}, i = 0; i < transactions.length; i++) null == weeks["week-" + transactions[i].Week] && (weeks["week-" + transactions[i].Week] = []), weeks["week-" + transactions[i].Week].push(transactions[i]);
- var weeksSorted = [];
- for (var key in weeks) weeks[key].reverse(), weeksSorted.push(weeks[key]);
- return weeksSorted.reverse(), weeksSorted
- },
- isNumeric: function(n) {
- return !isNaN(parseFloat(n)) && isFinite(n)
- },
- replaceBetween: function(str, start, end, replace) {
- return str.substring(0, start) + replace + str.substring(end)
- },
- fillContentTokens: function(terms, content, template) {
- for (var sortedTerms = terms.sort(function(a, b) {
- return b.length - a.length
- }), tokens = [], i = 0; i < sortedTerms.length; ++i)
- for (var match, term = sortedTerms[i], re = new RegExp("\\b(" + term + ")\\b", "ig"); null != (match = re.exec(content));) {
- for (var found = !1, j = 0; j < tokens.length; ++j) {
- var token = tokens[j];
- if (match.index >= token.start && match.index <= token.end) {
- found = !0;
- break
- }
- }
- found || tokens.push({
- term: term,
- index: i,
- start: match.index,
- end: match.index + term.length
- })
- }
- for (var sortedTokens = tokens.sort(function(a, b) {
- return b.start - a.start
- }), i = 0; i < sortedTokens.length; ++i) {
- var token = sortedTokens[i];
- content = this.replaceBetween(content, token.start, token.end, template.replace(/\|token\|/g, token.term))
- }
- return content
- },
- addGlossaryItems: function(content) {
- for (var terms = [], i = 0; i < appConfig.glossary.length; ++i) terms.push(appConfig.glossary[i].Term);
- return this.fillContentTokens(terms, content, '<glossary-item match="|token|" term="|token|"></glossary-item>')
- },
- getGlossaryDefinition: function(term) {
- for (var i = 0; i < appConfig.glossary.length; i++)
- if (term === appConfig.glossary[i].Term) return appConfig.glossary[i].Definition;
- return !1
- }
- }
- }]), angular.module("essimoney").directive("onFinishRender", function($timeout) {
- return {
- restrict: "A",
- link: function(scope, element, attr) {
- scope.$last === !0 && $timeout(function() {
- scope.$emit(attr.onFinishRender)
- })
- }
- }
- }).directive("complexPassword", function() {
- return {
- require: "ngModel",
- link: function(scope, elm, attrs, ctrl) {
- ctrl.$parsers.unshift(function(password) {
- var minimumCharacterCount = 8,
- startGroupCount = 3,
- hasUpperCase = /[A-Z]/.test(password),
- hasLowerCase = /[a-z]/.test(password),
- hasNumbers = /\d/.test(password),
- characterGroupCount = hasUpperCase + hasLowerCase + hasNumbers;
- return password.length >= minimumCharacterCount && characterGroupCount >= startGroupCount ? (ctrl.$setValidity("complexity", !0), password) : void ctrl.$setValidity("complexity", !1)
- })
- }
- }
- }).directive("passwordCheck", function() {
- return {
- require: "ngModel",
- link: function(scope, elem, attrs, ctrl) {
- var firstPassword = "#" + attrs.passwordCheck;
- elem.add(firstPassword).on("keyup", function() {
- scope.$apply(function() {
- ctrl.$setValidity("passwordMatch", elem.val() === $(firstPassword).val())
- })
- })
- }
- }
- }).directive("bindHtmlCompile", ["$compile", function($compile) {
- return {
- restrict: "A",
- link: function(scope, element, attrs) {
- scope.$watch(function() {
- return scope.$eval(attrs.bindHtmlCompile)
- }, function(value) {
- element.html(value && value.toString());
- var compileScope = scope;
- attrs.bindHtmlScope && (compileScope = scope.$eval(attrs.bindHtmlScope)), $compile(element.contents())(compileScope)
- })
- }
- }
- }]).directive("transitionEnd", ["$parse", function($parse) {
- var transitions = {
- transition: "transitionend",
- OTransition: "oTransitionEnd",
- MozTransition: "transitionend",
- WebkitTransition: "webkitTransitionEnd"
- },
- whichTransitionEvent = function() {
- var t, el = document.createElement("fakeelement");
- for (t in transitions)
- if (void 0 !== el.style[t]) return transitions[t]
- },
- transitionEvent = whichTransitionEvent();
- return {
- restrict: "A",
- link: function(scope, element, attrs) {
- function addEvent() {
- element.on(transitionEvent, transitionEventEnded)
- }
- function removeEvent() {
- element.off(transitionEvent, transitionEventEnded)
- }
- function transitionEventEnded(evt) {}
- var expr = attrs.transitionEnd;
- $parse(expr);
- scope.$on("updateViewTransition", function(event, data) {
- removeEvent(), addEvent()
- })
- }
- }
- }]);
- var guid = function() {
- function s4() {
- return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1)
- }
- return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4()
- },
- log = function() {
- appConfig.enableLogging
- },
- logError = function() {
- appConfig.enableLogging
- };
- angular.module("essimoney").service("AppsService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- return {
- get: function(successCallback, failCallback) {
- return null != $localStorage.Apps ? void successCallback($localStorage.Apps) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/a/apps"
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]).service("GamesService", ["$http", "$q", "utils", "$localStorage", function($http, $q, utils, $localStorage) {
- return {
- create: function(name, successCallback, failCallback) {
- utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/g/games",
- data: {
- Name: name
- }
- }).success(function(response) {
- return response.data.Status ? ($localStorage.GameID = response.data.ID, void successCallback(response.data.ID)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- apps: function(successCallback, failCallback) {
- return null == $localStorage.GameID ? void failCallback(["Game not found."]) : null != $localStorage.GameApps ? void successCallback($localStorage.GameApps) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/g/games/apps",
- params: {
- GameID: $localStorage.GameID
- }
- }).success(function(response) {
- return response.data.Success ? ($localStorage.GameApps = response.data.Results, void successCallback(response.data.Results)) : void failCallback(response.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]).service("GameInstancesService", ["$http", "utils", "$localStorage", "$rootScope", "FinancialInstanceService", "FinanceWeeklyService", function($http, utils, $localStorage, $rootScope, FinancialInstanceService, FinanceWeeklyService) {
- var _currentWeek = 0,
- _totalWeeks = 0,
- _netWorth = 0,
- giObj = {
- create: function(successCallback, failCallback) {
- utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/games",
- data: {
- GameID: $localStorage.GameID
- }
- }).success(function(response) {
- return response.data.Success ? ($localStorage.GameInstanceID = response.data.ID, void successCallback(response.data.ID)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- createGame: function(successCallback, failCallback) {
- utils.req({
- method: "PUT",
- url: appConfig.baseUrl + "/api/i/games",
- headers: {
- "Content-Type": "application/json",
- Authorization: "bearer " + encodeURIComponent($localStorage.Token)
- },
- data: {
- GameLinkID: $localStorage.GameLinkID
- }
- }).success(function(response) {
- return response.data.Success ? ($localStorage.GameInstanceID = response.data.ID, void successCallback(response.data.ID)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- apps: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameInstanceApps ? void successCallback($localStorage.GameInstanceApps) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/games/apps",
- headers: {
- "Content-Type": "application/json",
- Authorization: "bearer " + encodeURIComponent($localStorage.Token)
- },
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? ($localStorage.GameAppInstances = response.data.Results, _totalWeeks = parseInt(response.data.TotalWeeks), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- setAppAsViewed: function(appInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/gameappinstances",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- AppInstanceID: appInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- startWeek: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/games/startweek",
- headers: {
- "Content-Type": "application/json",
- Authorization: "bearer " + encodeURIComponent($localStorage.Token)
- },
- data: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void(response.data.IsGameComplete ? utils.navigateRoute($rootScope, "/end-of-game", "next") : (_currentWeek = parseInt(response.data.Week), $localStorage.GameCurrentWeek = parseInt(response.data.Week), $rootScope.$broadcast("CurrentWeekUpdated", _currentWeek), $localStorage.MentorMessages = response.data.MentorMessages, $localStorage.MentorMessages.forEach(function(m) {
- m.Message = m.Message.replace(/(?:\r\n|\\r|\\n)/g, "<br />"), m.Message = m.Message.replace(/%USERNAME%/g, $localStorage.PlayerName)
- }), successCallback(response.data))) : response.data.IsGameComplete && !response.data.IsSurveyComplete ? void utils.navigateRoute($rootScope, "/surveys/question", "next") : response.data.IsGameComplete ? void utils.navigateRoute($rootScope, "/end-of-game", "next") : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data.Messages)
- })
- },
- endWeek: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/games/endweek",
- headers: {
- "Content-Type": "application/json",
- Authorization: "bearer " + encodeURIComponent($localStorage.Token)
- },
- data: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- endWeekProcess: function() {
- log("endWeekProcess in service", giObj.getCurrentWeek()), FinanceWeeklyService.isQuizRequiredAndCompleted(function(data) {
- return data.IsQuizRequired && !data.IsQuizCompleted ? void $rootScope.$broadcast("AppIconStateUpdate", {
- application: "News",
- state: "block"
- }) : void(1 === giObj.getCurrentWeek() ? FinancialInstanceService.getAccountSources("Banking", function(accounts) {
- accounts.length > 0 ? (dataLayer.push({
- event: "week",
- weekState: "finish week",
- weekCompleted: "week " + giObj.getCurrentWeek()
- }), utils.navigateRoute($rootScope, "/end-of-week/end", "next")) : $rootScope.$broadcast("AppIconStateUpdate", {
- application: "Banking",
- state: "block"
- })
- }, function(messages) {
- log(messages[0])
- }) : (dataLayer.push({
- event: "week",
- weekState: "finish week",
- weekCompleted: "week " + giObj.getCurrentWeek()
- }), utils.navigateRoute($rootScope, "/end-of-week/end", "next")))
- }, function(messages) {
- alert("error")
- })
- },
- getUser: function() {
- if (null == $localStorage.GameInstanceID) return void failCallback(["Game Instance doesn't exist."]);
- var userName = "Player";
- return null != $localStorage.PlayerName && (userName = $localStorage.PlayerName), {
- username: userName
- }
- },
- setCurrentWeek: function(week) {
- _currentWeek = week, $rootScope.$broadcast("CurrentWeekUpdated", _currentWeek)
- },
- getCurrentWeek: function() {
- return _currentWeek
- },
- setConfigAppState: function(app, state) {
- for (var i = 0; i < appConfig.gameApps.length; i++) appConfig.gameApps[i].application === app && (appConfig.gameApps[i].state = state)
- },
- setTotalWeeks: function(weeks) {
- _totalWeeks = weeks
- },
- getTotalWeeks: function() {
- return _totalWeeks
- },
- getProgressBarPercent: function() {
- var width = Math.round(_currentWeek / _totalWeeks * 100);
- return width + "%"
- },
- setNetWorth: function(netWorth) {
- _netWorth = netWorth, $rootScope.$broadcast("NetWorthUpdated", _netWorth)
- },
- getNetWorth: function() {
- return _netWorth
- },
- checkEndGameSurvey: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/games/hasendsurvey",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- };
- return giObj
- }]).service("GameMediaService", ["$http", "utils", "$localStorage", "GameInstancesService", function($http, utils, $localStorage, GameInstancesService) {
- var MediaData = {};
- return utils.req({
- method: "GET",
- url: "assets/images/media.json"
- }).success(function(response) {
- MediaData = response.data
- }).fail(function(response) {
- log(response);
- }), {
- get: function(mediaGroup, mediaID) {
- if (void 0 != mediaGroup && void 0 != mediaID) return mediaGroup = mediaGroup.toLowerCase(), mediaID = mediaID.toLowerCase(), mediaGroup = mediaGroup.replace(/[^A-Z0-9]/gi, ""), mediaID = mediaID.replace(/[^A-Z0-9]/gi, ""), void 0 !== MediaData[mediaGroup] && (void 0 !== MediaData[mediaGroup][mediaID] ? MediaData[mediaGroup][mediaID] : void 0 != MediaData[mediaGroup]["default"] && MediaData[mediaGroup]["default"])
- },
- replaceContentPlaceholders: function(msg) {
- for (var content = msg, username = GameInstancesService.getUser().username, emoticons = [
- [":D", "emoticonbigsmile"],
- [":(", "emoticonsad"],
- [":)", "emoticonsmile"],
- [";)", "emoticonwink"]
- ], i = 0; i < emoticons.length; i++) content = content.replace(emoticons[i][0], '<img class="emoticon" src="' + this.get("textmessages", emoticons[i][1]) + '">');
- return content = content.replace(/%USERNAME%/g, username)
- }
- }
- }]), angular.module("essimoney").controller("MainController", MainController), MainController.$inject = ["$scope", "$location", "$stateParams", "GameLinkService", "GameInstancesService", "GameMediaService", "AuthenticationService", "MessageService", "utils", "$localStorage"], angular.module("essimoney").directive("debug", ["$window", "$timeout", "GameInstancesService", "FinancialInstanceService", function($window, $timeout, GameInstancesService, FinancialInstanceService) {
- return {
- restrict: "E",
- replace: !0,
- link: function(scope, elem, attrs) {
- scope.newGameInstance = "", scope.startWeek = function() {
- GameInstancesService.startWeek(function(data) {
- log(data)
- }, function(message) {
- log(message)
- })
- }, scope.endWeek = function() {
- log(GameInstancesService.getCurrentWeek()), 1 === GameInstancesService.getCurrentWeek() ? FinancialInstanceService.getAccountSources("Banking", function(accounts) {
- accounts.length > 0 ? GameInstancesService.endWeek(function(data) {
- log(data)
- }, function(message) {
- log(message)
- }) : scope.$broadcast("AppIconStateUpdate", {
- application: "Banking",
- state: "block"
- })
- }, function(messages) {
- log(messages[0])
- }) : GameInstancesService.endWeek(function(data) {
- log(data)
- }, function(message) {
- log(message)
- })
- }, scope.createNewGameInstance = function() {
- GameInstancesService.create(function(data) {
- log(data), scope.newGameInstance = data, scope.$broadcast("CreateNewGame", data)
- }, function(message) {
- log(message)
- })
- }
- },
- templateUrl: "app/operating-system/debug/debug.tpl"
- }
- }]), angular.module("essimoney").directive("appHeader", ["$window", "$location", "utils", "$rootScope", function($window, $location, utils, $rootScope) {
- return {
- restrict: "E",
- scope: {
- title: "=",
- showCalculator: "=",
- backTo: "="
- },
- replace: !0,
- link: function(scope, elem, attrs) {
- scope.homeClicked = function() {
- "quiz" == scope.backTo ? $rootScope.$broadcast("QuitingQuiz") : ($rootScope.$emit("ResetActiveApp"), utils.navigateRoute(scope, "app/dashboard/view", "toDash"))
- }
- },
- templateUrl: "app/operating-system/app-header/app-header.tpl"
- }
- }]), angular.module("essimoney").directive("goBack", ["$window", "utils", "$rootScope", function($window, utils, $rootScope) {
- return {
- restrict: "AE",
- scope: !1,
- replace: !0,
- link: function(scope, elem, attrs) {
- function goBack(e) {
- log("goBack", attrs.to), "dashboard" === attrs.to ? ($rootScope.$broadcast("ResetActiveApp"), utils.navigateRoute(scope, "app/dashboard/view", "toDash")) : "quiz" == scope.backTo ? $rootScope.$broadcast("QuitingQuiz") : utils.navigateRoute(scope, attrs.to, "back")
- }
- var vm = scope;
- vm.goBack = goBack, vm.to = attrs.to
- },
- template: '<button ng-click="goBack()" class="btn btn-icon back"><span class="icon-back"></span></button>'
- }
- }]), DialogPopupController.$inject = ["$scope"], angular.module("essimoney").controller("DialogPopupController", DialogPopupController), angular.module("essimoney").service("MessageService", ["$localStorage", "$http", "ngDialog", "$location", "$window", "$timeout", function($localStorage, $http, ngDialog, $location, $window, $timeout) {
- return {
- showMessage: function(data) {
- return ngDialog.open({
- template: "app/operating-system/dialog-popup/dialog-popup.tpl",
- controller: "DialogPopupController",
- controllerAs: "vm",
- data: {
- type: "msg",
- content: data.content
- },
- showClose: !1,
- className: "dialog-popup"
- })
- },
- showConfirm: function(data) {
- var acceptBtnLabel = "Accept",
- declineBtnLabel = "Decline";
- return null != data.acceptBtnLabel && (acceptBtnLabel = data.acceptBtnLabel), null != data.declineBtnLabel && (declineBtnLabel = data.declineBtnLabel), ngDialog.open({
- template: "app/operating-system/dialog-popup/dialog-popup.tpl",
- controller: "DialogPopupController",
- controllerAs: "vm",
- data: {
- type: "confirm",
- content: data.content,
- acceptFn: data.acceptFn,
- declineFn: data.declineFn,
- acceptBtnLabel: acceptBtnLabel,
- declineBtnLabel: declineBtnLabel
- },
- showClose: !1,
- className: "dialog-popup"
- })
- }
- }
- }]), angular.module("essimoney").directive("deviceHeight", ["$window", "$document", "utils", "$timeout", function($window, $document, utils, $timeout) {
- return {
- restrict: "AE",
- scope: !1,
- replace: !1,
- link: function(scope, elem, attrs) {
- function setDeviceHeight() {
- var deviceHeight = angular.element($window).height(),
- deviceWidth = angular.element($window).width();
- deviceWidth < 991 ? elem.css({
- height: deviceHeight
- }) : elem.css({
- height: ""
- })
- }
- $timeout(function() {
- setDeviceHeight()
- }, 200), scope.$on("RefreshWebKitScrolling", function() {
- elem.css({
- "-webkit-overflow-scrolling": "auto"
- }), setTimeout(function() {
- elem.css({
- "-webkit-overflow-scrolling": "touch"
- })
- }, 400)
- }), angular.element($window).on("resize", setDeviceHeight), scope.$on("$destroy", function() {
- angular.element($window).off("resize", setDeviceHeight)
- })
- }
- }
- }]), angular.module("essimoney").directive("dropdown", function($rootScope, $timeout, $document, utils) {
- return {
- restrict: "E",
- templateUrl: "app/components/dropdown/dropdown.tpl",
- scope: {
- placeholder: "@",
- list: "=",
- selecteditem: "=",
- property: "@",
- id: "@"
- },
- link: function(scope, element) {
- function cleanUp() {
- scope.appWindow = angular.element($document[0].getElementsByClassName("app-window")), scope.appWindow.css("height", "")
- }
- log(scope), scope.listVisible = !1, scope.isPlaceholder = !0, scope.selectDisabled = !1, scope.scopeAppWindowh = !1, scope.ddPos = -1, scope.appWindow = 0, scope.$watch("list", function() {
- null != scope.list && scope.list.length > 1 ? scope.selectDisabled = !1 : scope.selectDisabled = !0
- }), scope.select = function(item) {
- scope.selecteditem = item, scope.listVisible = !1, cleanUp()
- }, scope.closeDropdown = function() {
- scope.listVisible = !1, cleanUp()
- }, scope.isselecteditem = function(item) {
- if (null != scope.selecteditem) return item[scope.property] === scope.selecteditem[scope.property]
- }, $rootScope.$on("closeAllDropDowns", function(event, id) {
- id !== scope.id && (scope.listVisible = !1, cleanUp())
- }), scope.show = function() {
- if ($rootScope.$broadcast("closeAllDropDowns", scope.id), !scope.selectDisabled && scope.list.length > 1)
- if (scope.listVisible) scope.listVisible = !1, cleanUp();
- else {
- scope.listVisible = !0;
- var ddHeight = 0,
- ddListTop = 0,
- AppScreen = 0,
- diff = 0;
- $timeout(function() {
- var ddList = angular.element(element[0].getElementsByClassName("list-item"));
- ddList.each(function(index) {
- ddHeight += angular.element(this).height()
- }), AppScreen = angular.element($document[0].getElementsByClassName("app-screen__app")), ddListTop = angular.element(ddList).offset(), scope.ddPos = ddListTop.top + AppScreen.scrollTop(), scope.appWindow = angular.element($document[0].getElementsByClassName("app-window")), diff = scope.appWindow.height() - (scope.ddPos + ddHeight - 50), diff < 0 && scope.appWindow.height(scope.appWindow.height() + Math.abs(diff)), $(".app-screen__app").animate({
- scrollTop: $(element[0].getElementsByClassName("dropdown-list")).offset().top
- }, 200)
- }, 200)
- }
- }
- }
- }
- }), angular.module("essimoney").directive("format", ["$filter", function($filter) {
- return {
- require: "?ngModel",
- link: function(scope, elem, attrs, ctrl) {
- ctrl && (ctrl.$formatters.unshift(function(a) {
- return $filter(attrs.format)(ctrl.$modelValue)
- }), elem.bind("blur", function(event) {
- var plainNumber = elem.val().replace(/[^\d|\-+|\.+]/g, "");
- elem.val($filter(attrs.format)(plainNumber))
- }))
- }
- }
- }]), angular.module("essimoney").directive("transferButton", ["$window", "$timeout", function($window, $timeout) {
- return {
- restrict: "E",
- replace: !0,
- scope: {
- label: "@label"
- },
- link: function(scope, elem, attrs) {
- function resetBtn() {
- scope.showLabel = !0, scope.showLoading = !1, scope.showSuccess = !1, scope.disableBtn = !1
- }
- resetBtn(), scope.$on("ResetTransferButton", resetBtn), scope.$on("ShowTransferLoading", function(event, args) {
- scope.showLabel = !1, scope.showLoading = !0, scope.showSuccess = !1, scope.disableBtn = !0
- }), scope.$on("ShowTransferSuccess", function(event, args) {
- $timeout(function() {
- scope.showLabel = !1, scope.showLoading = !1, scope.showSuccess = !0, $timeout(function() {
- scope.$emit("TransactionComplete")
- }, 1e3)
- }, 1e3)
- })
- },
- template: '<button ng-disabled="disableBtn"><span ng-show="showLabel" class="label">{{label}}</span><div ng-show="showLoading" class="loading"> <div class="icon-loading"></div></div><div class="success" ng-show="showSuccess"><div class="icon-success"></div></div></button>'
- }
- }]), angular.module("essimoney").directive("creditCardImage", ["$window", "$timeout", "GameInstancesService", "GameMediaService", function($window, $timeout, GameInstancesService, GameMediaService) {
- return {
- restrict: "E",
- replace: !0,
- scope: {
- cardName: "="
- },
- link: function(scope, elem, attrs) {
- scope.name = GameInstancesService.getUser().username, scope.$watch("cardName", function() {
- void 0 !== scope.cardName && (scope.image = GameMediaService.get("creditcard", scope.cardName))
- })
- },
- template: '<div><div class="image"><img ng-src="{{image}}"></div><div class="card-name">{{name}}</div></div>'
- }
- }]), angular.module("essimoney").directive("itemImage", ["$window", "$timeout", "GameMediaService", function($window, $timeout, GameMediaService) {
- return {
- restrict: "E",
- replace: !0,
- scope: {
- itemId: "="
- },
- link: function(scope, elem, attrs) {
- scope.$watch("itemId", function() {
- void 0 !== scope.itemId && (scope.image = GameMediaService.get("items", scope.itemId))
- })
- },
- template: '<div><img ng-src="{{image}}"></div>'
- }
- }]), angular.module("essimoney").directive("accountIcon", ["GameMediaService", function(GameMediaService) {
- return {
- restrict: "E",
- scope: {
- accountType: "="
- },
- replace: !0,
- link: function(scope, elem, attrs) {
- scope.$watch("accountType", function() {
- scope.icon = GameMediaService.get("banking", scope.accountType)
- })
- },
- template: '<span ng-class="icon"></span>'
- }
- }]), angular.module("essimoney").directive("fullHeight", ["utils", "$document", "$window", function(utils, $document, $window) {
- return {
- restrict: "A",
- link: function(scope, elem, attrs) {
- scope.$watch("fullHeight", function() {
- log("watch"), scope.onResize()
- }), scope.onResize = function() {
- var appScreen = angular.element($document[0].getElementsByClassName(attrs.fullHeight));
- log(elem.height() + " < " + (appScreen.height() - 39))
- }, angular.element($window).bind("resize", function() {
- scope.onResize()
- })
- }
- }
- }]), angular.module("essimoney").directive("moneyAmountInput", ["$window", "$timeout", function($window, $timeout) {
- return {
- restrict: "E",
- replace: !0,
- scope: !1,
- link: function(scope, elem, attrs, modelCtrl) {
- log(scope.vm), scope.inputPattern = /^\d+$/, scope.onlyNumbers = function(event) {
- var keys = {
- up: 38,
- right: 39,
- down: 40,
- left: 37,
- escape: 27,
- backspace: 8,
- tab: 9,
- enter: 13,
- del: 46,
- 0: 48,
- 1: 49,
- 2: 50,
- 3: 51,
- 4: 52,
- 5: 53,
- 6: 54,
- 7: 55,
- 8: 56,
- 9: 57
- };
- for (var index in keys)
- if (keys.hasOwnProperty(index) && (event.charCode == keys[index] || event.keyCode == keys[index])) return;
- event.preventDefault()
- }
- },
- template: '<div class="money-amount-input"><div class="dollar-sign">$</div><input class="transfer-amount" ng-keypress="onlyNumbers($event)" ng-model="vm.TransferValue" type="number" placeholder="0.00" step="0.01" min="0"/></div>'
- }
- }]), angular.module("essimoney").directive("lockedAccount", function($rootScope, $timeout, $document, utils) {
- return {
- restrict: "E",
- scope: !1,
- link: function(scope, element, attr) {
- function setHight() {
- var bgElement = angular.element(element[0].getElementsByClassName("inner"));
- bgElement.height(element.parent().height() - 50)
- }
- $timeout(setHight)
- }
- }
- }), angular.module("essimoney").directive("appHeight", function($rootScope, $timeout, $document, utils) {
- return {
- restrict: "E",
- scope: !1,
- link: function(scope, element, attr) {
- function updateHeight(data) {
- for (var elements = angular.element(element[0].getElementsByClassName(data.selector)), allHeights = 0, i = 0; i < elements.length; i++) allHeights += angular.element(elements[i]).outerHeight();
- allHeights += parseInt(data.offset), element.height(allHeights)
- }
- scope.$on("UpdateAppHeight", function(event, data) {
- updateHeight(data)
- })
- }
- }
- }), angular.module("essimoney").directive("glossaryItem", ["MessageService", "utils", function(MessageService, utils) {
- return {
- restrict: "E",
- scope: !0,
- replace: !0,
- link: function(scope, elem, attrs) {
- scope.Match = attrs.match, scope.Term = attrs.term, scope.glossaryClicked = function() {
- dataLayer.push({
- event: "app",
- appSelected: "finance weekly",
- appAction: "term definition"
- }), MessageService.showMessage({
- content: "<h1>" + scope.Term + "</h1><p>" + utils.getGlossaryDefinition(scope.Term) + "</p>"
- })
- }
- },
- template: ' <a href="" ng-click="glossaryClicked()">{{Match}}</a> '
- }
- }]), angular.module("essimoney.authentication", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.authentication").service("AuthenticationService", ["$http", "utils", "$localStorage", function($http, utils, $localStorage) {
- return {
- requestToken: function(username, password, successCallback, failCallback) {
- utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/Token",
- data: "grant_type=password&username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password)
- }).success(function(response) {
- 200 === response.status ? ($localStorage.Token = response.data.access_token, $localStorage.PlayerName = response.data.name, $localStorage.UserID = response.data.userId, successCallback(response.data), dataLayer.push({
- event: "user action",
- userAction: "log in"
- })) : failCallback(response.data)
- }).fail(function(response) {
- failCallback(response)
- })
- },
- register: function(email, yob, password, gender, confirmPassword, name, callbackUrl, successCallback, failCallback) {
- utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/Account/Register",
- data: {
- Email: email,
- YOB: yob,
- Password: password,
- ConfirmPassword: confirmPassword,
- Name: name,
- Gender: gender,
- CallbackUrl: callbackUrl
- }
- }).success(function(response) {
- successCallback(response)
- }).fail(function(response) {
- failCallback(response)
- })
- },
- yobRange: function(successCallback, failCallback) {
- utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/Account/yobrange"
- }).success(function(response) {
- successCallback(response)
- }).fail(function(response) {
- failCallback(response)
- })
- },
- sendResetPassword: function(username, callbackUrl, successCallback, failCallback) {
- utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/Account/sendresetpassword?UserName=" + encodeURIComponent(username),
- data: {
- UserName: username,
- CallbackUrl: callbackUrl
- }
- }).success(function(response) {
- successCallback(response)
- }).fail(function(response) {
- failCallback(response)
- })
- },
- resetPassword: function(userID, token, newPassword, confirmPassword, successCallback, failCallback) {
- utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/Account/ResetPassword",
- data: {
- UserID: userID,
- Code: token,
- NewPassword: newPassword,
- ConfirmPassword: confirmPassword
- }
- }).success(function(response) {
- successCallback(response)
- }).fail(function(response) {
- failCallback(response)
- })
- },
- logout: function(successCallback, failCallback) {
- utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/account/logout",
- headers: {
- "Content-Type": "application/json",
- Authorization: "bearer " + encodeURIComponent($localStorage.Token)
- },
- data: {}
- }).success(function(response) {
- successCallback(response), dataLayer.push({
- event: "user action",
- userAction: "log out"
- })
- }).fail(function(response) {
- failCallback(response)
- })
- }
- }
- }]), angular.module("essimoney.authentication").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("auth", {
- url: "/auth",
- templateUrl: "app/authentication/auth.view.tpl"
- }).state("auth.login", {
- url: "/login/:gamelinkid",
- templateUrl: "app/authentication/login/login.tpl",
- controller: "AuthLoginController",
- controllerAs: "vm"
- }).state("auth.create", {
- url: "/create-user",
- templateUrl: "app/authentication/create-user/create-user.tpl",
- controller: "AuthCreateUserController",
- controllerAs: "vm"
- }).state("auth.password-reset", {
- url: "/password-reset?user&token",
- templateUrl: "app/authentication/password-reset/password-reset.tpl",
- controller: "PasswordResetController",
- controllerAs: "vm"
- }).state("auth.account-recovery", {
- url: "/account-recovery/:gamelinkid",
- templateUrl: "app/authentication/recovery/recovery.tpl",
- controller: "AuthRecoveryController",
- controllerAs: "vm"
- }).state("auth.game", {
- url: "/game",
- templateUrl: "app/authentication/select-game/select-game.tpl",
- controller: "AuthSelectGameController",
- controllerAs: "vm",
- resolve: {
- GameInstances: function() {}
- }
- })
- }]), angular.module("essimoney.authentication").controller("AuthenticationController", AuthenticationController), AuthenticationController.$inject = ["$scope", "$stateParams", "$localStorage", "GameLinkService"], angular.module("essimoney.authentication").controller("AuthCreateUserController", AuthCreateUserController), AuthCreateUserController.$inject = ["$scope", "$localStorage", "$location", "$stateParams", "GameLinkService", "AuthenticationService"], angular.module("essimoney.authentication").controller("AuthLoginController", AuthLoginController), AuthLoginController.$inject = ["$scope", "$location", "$stateParams", "$localStorage", "AuthenticationService", "GameLinkService"], angular.module("essimoney.authentication").controller("AuthRecoveryController", AuthRecoveryController), AuthRecoveryController.$inject = ["$scope", "$location", "$localStorage", "$stateParams", "GameLinkService", "AuthenticationService"], angular.module("essimoney.authentication").controller("PasswordResetController", PasswordResetController), PasswordResetController.$inject = ["$scope", "$stateParams", "$localStorage", "AuthenticationService"], angular.module("essimoney.authentication").controller("AuthSelectGameController", AuthSelectGameController), AuthSelectGameController.$inject = ["$scope", "$localStorage", "$location", "$stateParams", "GameLinkService", "GameInstancesService", "MessageService"], angular.module("essimoney.authentication").directive("validateEmail", function() {
- var EMAIL_REGEXP = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
- return {
- require: "ngModel",
- restrict: "",
- link: function(scope, elm, attrs, ctrl) {
- ctrl && ctrl.$validators.email && (ctrl.$validators.email = function(modelValue) {
- return ctrl.$isEmpty(modelValue) || EMAIL_REGEXP.test(modelValue)
- })
- }
- }
- }), angular.module("essimoney.authentication").directive("validateYob", ["AuthenticationService", function(AuthenticationService) {
- var YEAR_REGEX = /[0-9]{4}/;
- return {
- require: "ngModel",
- restrict: "",
- link: function(scope, elm, attrs, ctrl) {
- if (ctrl) {
- var startYear = 0,
- endYear = 9999;
- AuthenticationService.yobRange(function(response) {
- startYear = +response.data.StartYear, endYear = +response.data.EndYear
- }, function(response) {
- log(response)
- }), ctrl.$validators.yobrange = function(modelValue) {
- if (YEAR_REGEX.test(modelValue)) {
- var yob = +modelValue;
- return yob >= startYear && yob <= endYear
- }
- return !0
- }
- }
- }
- }
- }]), angular.module("essimoney.dashboard", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.dashboard").service("DashboardService", ["$http", "$q", function() {
- var _GameApplications = {};
- return {
- setGameApps: function(gameApps) {
- _GameApplications = gameApps
- },
- getGameApps: function(gameApps) {
- return _GameApplications
- }
- }
- }]), angular.module("essimoney.dashboard").controller("DashboardController", DashboardController), DashboardController.$inject = ["$scope", "GameInstancesService", "utils", "FinancialInstanceService", "$rootScope", "DashboardService"], angular.module("essimoney.dashboard").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.view", {
- url: "/view",
- templateUrl: "app/dashboard/dashboard.view.tpl",
- controller: "DashboardController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney").directive("dashboardAppBtn", ["$rootScope", "$location", "utils", "GameMediaService", "MentorService", "GameInstancesService", function($rootScope, $location, utils, GameMediaService, MentorService, GameInstancesService) {
- return {
- restrict: "E",
- scope: {
- appData: "="
- },
- replace: !0,
- link: function(scope, elem, attrs) {
- function updateIcon() {
- "idle" === scope.appData.state ? scope.appData.HasUpdate ? scope.icon = GameMediaService.get("dashboard", scope.appData.Name + "active") : scope.icon = GameMediaService.get("dashboard", scope.appData.Name) : (scope.appData.HasUpdate = !0, scope.appData.UpdateCount = "!", scope.icon = GameMediaService.get("dashboard", scope.appData.Name + "block"))
- }
- function openApp() {
- scope.$emit("ResetActiveApp"), scope.appData.active = !0, scope.appData.HasBeenAccessed || MentorService.getAppHelpMessage(scope.appData.GameAppID, function(data) {
- for (var mentorMessages = [], i = 0; i < data.Results.length; i++) mentorMessages.push({
- ID: 0,
- Message: data.Results[i].Body,
- Title: data.Results[i].Title
- });
- mentorMessages.length > 0 && scope.$emit("ShowMentorPopup", mentorMessages), GameInstancesService.setAppAsViewed(scope.appData.ID, function() {
- scope.$emit("UpdateNotifications")
- }, function() {})
- }, function(data) {
- log("fail help message", data)
- }), utils.navigateRoute(scope, scope.appData.url, "appOpen")
- }
- scope.$watchCollection("[appData.state, appData.HasUpdate ]", function() {
- updateIcon()
- }), scope.appClicked = function() {
- $location.path().indexOf("financeweekly/quiz") > -1 && $location.path().indexOf("summary") == -1 ? $rootScope.$broadcast("QuitingQuiz") : openApp()
- }
- },
- template: '<button ng-click="appClicked()" class="icon" ng-class="{\'active\': appData.active}"><div class="notification" ng-class="{\'block\': appData.state == \'block\'}" ng-if="appData.HasUpdate"><span>{{appData.UpdateCount}}</span></div><img ng-src="{{icon}}"><span>{{appData.displayName}}</span></button>'
- }
- }]), angular.module("essimoney.whereimat", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.whereimat").controller("WhereImAtController", WhereImAtController), WhereImAtController.$inject = ["$scope", "utils", "WhereImAtService", "GameInstancesService", "$rootScope", "GameMediaService"], angular.module("essimoney.whereimat").service("WhereImAtService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- return {
- getProgress: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/progress",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]), angular.module("essimoney.whereimat").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.whereimat", {
- url: "/where-im-at",
- templateUrl: "app/where-im-at/where-im-at-mobile.view.tpl",
- controller: "WhereImAtController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.banking", ["ui.router", "ngStorage"]), angular.module("essimoney.banking").service("GameBankingService", ["$http", "utils", "$localStorage", function($http, utils, $localStorage) {
- return {
- get: function(successCallback, failCallback) {
- return null == $localStorage.GameID ? void failCallback(["Game doesn't exist."]) : null != $localStorage.GameApps && null != $localStorage.GameApps.Banking && null != $localStorage.GameApps.Banking.Accounts ? void successCallback($localStorage.GameApps.Banking.Accounts) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/g/banking",
- params: {
- GameID: $localStorage.GameID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getInvestmentAccounts: function(successCallback, failCallback) {
- return null == $localStorage.GameID ? void failCallback(["Game doesn't exist."]) : null != $localStorage.GameApps && null != $localStorage.GameApps.Banking && null != $localStorage.GameApps.Banking.Accounts ? void successCallback($localStorage.GameApps.Banking.Accounts) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/g/banking/investments",
- params: {
- GameID: $localStorage.GameID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]).service("BankingInstanceService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- return {
- get: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameAppInstances && null != $localStorage.GameAppInstances.Banking && null != $localStorage.GameAppInstances.Banking.Accounts ? void successCallback($localStorage.GameAppInstances.Banking.Accounts) : utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/banking",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data.Messages)
- })
- },
- create: function(gameAccountID, transferFromGameAppInstanceID, transferFromAccountInstanceID, amount, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : (log(amount), void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/banking",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAccountID: gameAccountID,
- TransferFromGameAppInstanceID: transferFromGameAppInstanceID,
- TransferFromAccountInstanceID: transferFromAccountInstanceID,
- Amount: amount
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("AppIconStateUpdate", {
- application: "Banking",
- state: "idle"
- }), $rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback([response.data.Message])
- }))
- },
- close: function(accountInstanceID, transferToAccountInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : (log($localStorage.GameInstanceID, accountInstanceID, transferToAccountInstanceID), void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/banking/close",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- AccountInstanceID: accountInstanceID,
- TransferToAccountInstanceID: transferToAccountInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback([response.data.Message])
- }))
- },
- getInvestmentAccounts: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameAppInstances && null != $localStorage.GameAppInstances.Banking && null != $localStorage.GameAppInstances.Banking.Accounts ? void successCallback($localStorage.GameAppInstances.Banking.Accounts) : utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/banking/investments",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- createInvestmentAccount: function(data, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : (data.GameInstanceID = $localStorage.GameInstanceID, utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/banking/investments",
- data: data
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data.Messages)
- }))
- }
- }
- }]), angular.module("essimoney.banking").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.banking", {
- url: "/banking",
- templateUrl: "app/banking/index/banking-index.tpl",
- controller: "BankIndexController",
- controllerAs: "vm"
- }).state("app.dashboard.banking-chooseAccount", {
- url: "/banking/choose-account",
- templateUrl: "app/banking/choose-account/choose-account.tpl",
- controller: "ChooseBankAccountController",
- controllerAs: "vm"
- }).state("app.dashboard.banking-openAccount-id", {
- url: "/banking/open-account/:id",
- templateUrl: "app/banking/open-account/open-account.tpl",
- controller: "BankOpenAccountController",
- controllerAs: "vm"
- }).state("app.dashboard.banking-account-statement-id", {
- url: "/banking/account-statement/:id",
- templateUrl: "app/banking/account-statement/account-statement.tpl",
- controller: "AccountStatementController",
- controllerAs: "vm"
- }).state("app.dashboard.banking-investmentStatement/id", {
- url: "/banking/investment-statement/:id",
- templateUrl: "app/banking/account-statement/account-statement.tpl",
- controller: "AccountStatementController",
- controllerAs: "vm"
- }).state("app.dashboard.banking-choosingInvestment", {
- url: "/banking/choose-investment",
- templateUrl: "app/banking/choose-investment/choose-investment.tpl",
- controller: "ChooseInvestmentsController",
- controllerAs: "vm"
- }).state("app.dashboard.banking-openInvestmentAccount-id", {
- url: "/banking/open-investment-account/:id",
- templateUrl: "app/banking/open-investment-account/open-investment-account.tpl",
- controller: "OpenInvestmentAccountController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.banking").controller("BankIndexController", BankIndexController), BankIndexController.$inject = ["$scope", "$filter", "FinancialInstanceService", "utils", "MessageService", "BankingInstanceService", "GameInstancesService"], angular.module("essimoney.banking").controller("BankOpenAccountController", BankOpenAccountController), BankOpenAccountController.$inject = ["$scope", "$stateParams", "GameBankingService", "CashboxInstanceService", "BankingInstanceService", "$window", "utils", "MessageService", "GameInstancesService"], angular.module("essimoney.banking").controller("ChooseBankAccountController", ChooseBankAccountController), ChooseBankAccountController.$inject = ["$scope", "GameBankingService", "utils", "$filter", "FinancialInstanceService", "MessageService", "$timeout"], angular.module("essimoney.banking").controller("AccountStatementController", AccountStatementController), AccountStatementController.$inject = ["$scope", "$stateParams", "BankingInstanceService", "FinancialInstanceService", "utils", "MessageService", "$location"], angular.module("essimoney.banking").controller("ChooseInvestmentsController", ChooseInvestmentsController), ChooseInvestmentsController.$inject = ["$scope", "FinancialInstanceService", "utils", "MessageService", "GameBankingService", "$filter"], angular.module("essimoney.banking").controller("OpenInvestmentAccountController", OpenInvestmentAccountController), OpenInvestmentAccountController.$inject = ["$scope", "$stateParams", "GameBankingService", "CashboxInstanceService", "BankingInstanceService", "$window", "utils", "MessageService"], angular.module("essimoney.bills", ["ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.bills").service("BillsInstanceService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- return {
- payBill: function(fromGameAppInstanceID, fromAccountInstanceID, billInstanceID, setAutomatic, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/bills/pay",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- FromGameAppInstanceID: fromGameAppInstanceID,
- FromAccountInstanceID: fromAccountInstanceID,
- BillInstanceID: billInstanceID,
- SetAutomatic: setAutomatic
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]), angular.module("essimoney.cashbox", ["ui.router", "ngStorage"]), angular.module("essimoney.cashbox").service("a_cashbox", ["$http", "$q", "$localStorage", "utils", function($http, $q) {
- return {
- createCshboxAccount: function() {},
- getCshboxAccounts: function() {}
- }
- }]).service("g_cashbox", ["$http", "$q", "$localStorage", "utils", function($http, $q) {
- return {
- createGameApp: function() {},
- createGameAccnt: function() {}
- }
- }]).service("i_cashbox", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- return {
- getGameInstanceCashbox: function() {
- var req = utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/cashbox",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- });
- return req
- }
- }
- }]).service("CashboxInstanceService", ["$localStorage", "utils", function($localStorage, utils) {
- return {
- get: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameAppInstances && null != $localStorage.GameAppInstances.Cashbox ? void successCallback($localStorage.GameAppInstances.Cashbox) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/cashbox",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data ? void successCallback(response.data) : void failCallback(response)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]), angular.module("essimoney.cashbox").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.cashbox", {
- url: "/cashbox",
- templateUrl: "app/cashbox/cashbox.tpl",
- controller: "CashboxController",
- controllerAs: "vm"
- })
- }]), CashboxController.$inject = ["$scope", "FinancialInstanceService", "$filter", "utils", "MessageService"], angular.module("essimoney.cashbox").controller("CashboxController", CashboxController), angular.module("essimoney.financial", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.financial").service("FinancialInstanceService", ["$http", "$localStorage", "utils", "$q", "CashboxInstanceService", "BankingInstanceService", "i_creditCard", "$rootScope", function($http, $localStorage, utils, $q, CashboxInstanceService, BankingInstanceService, i_creditCard, $rootScope) {
- return {
- transfer: function(fromGameAppInstanceID, fromAccountInstanceID, toGameAppInstanceID, toAccountInstanceID, amount, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/transfer",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- FromGameAppInstanceID: fromGameAppInstanceID,
- FromAccountInstanceID: fromAccountInstanceID,
- toGameAppInstanceID: toGameAppInstanceID,
- toAccountInstanceID: toAccountInstanceID,
- Amount: amount
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback()) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- transactions: function(gameAppInstanceID, gameAppAccountInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/transactions",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAppInstanceID: gameAppInstanceID,
- GameAppAccountInstanceID: gameAppAccountInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getAccountSources: function(apps, successCallback, failCallback) {
- apps = Array.isArray(apps) ? apps : [apps];
- var defers = [],
- sourceQueries = {
- Cashbox: CashboxInstanceService.get,
- Banking: BankingInstanceService.get,
- "Credit Cards": null
- },
- shouldContinue = !0,
- errorArgList = null;
- ! function() {
- for (var i = 0; i < apps.length; i++) {
- var currentArg = apps[i],
- hasQuery = !!sourceQueries[currentArg];
- shouldContinue = shouldContinue && hasQuery, hasQuery || (errorArgList || (errorArgList = []), errorArgList.push(currentArg))
- }
- }(), shouldContinue ? (! function() {
- for (var i = 0; i < apps.length; i++) {
- var currentArg = apps[i];
- ! function() {
- var defer = $q.defer();
- defers.push(function() {
- return sourceQueries[currentArg](function(response) {
- Array.isArray(response) || (response = [response]), defer.resolve(response)
- }, failCallback), defer.promise
- }())
- }()
- }
- }(), $q.all(defers).then(function(values) {
- var options = [],
- forEachFn = function(source) {
- source.hasOwnProperty("AppInstanceID") ? options.push(source) : options.push(angular.extend({}, source, {
- AppInstanceID: utils.getInstanceAppID(source.Title)
- }))
- };
- for (var prop in values) {
- var currentSource = values[prop];
- currentSource.forEach(forEachFn)
- }
- successCallback(options)
- })) : failCallback({
- Success: !1,
- Messages: function() {
- return [].map.call(errorArgList, function(e) {
- return e + " is not found"
- })
- }()
- })
- },
- getPaymentSources: function(successCallback, failCallback) {
- function checkBankAccounts() {
- BankingInstanceService.get(function(options) {
- options = options.filter(function(e) {
- return "TransactionsBankAccountInstance" === e.AccountType
- }), accounts = accounts.concat(options), AllDone()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- }), AllDone()
- })
- }
- function AllDone() {
- accounts.length > 0 ? successCallback(accounts) : failCallback(["No accounts found"])
- }
- var accounts = [];
- i_creditCard.getGameInstanceCreditCard(function(response) {
- response.Balance = response.CreditAvailable, response.AppInstanceID = utils.getInstanceAppID("Credit Cards"), response.AccountType = "creditcardinstance", accounts.push(response), checkBankAccounts()
- }, function(message) {
- "No credit card purchased." !== message[0] && failCallback(message), checkBankAccounts()
- })
- },
- getPayoutSources: function(successCallback, failCallback) {
- function checkBankAccounts() {
- BankingInstanceService.get(function(options) {
- options = options.filter(function(e) {
- return "TransactionsBankAccountInstance" === e.AccountType
- }), accounts = accounts.concat(options), AllDone()
- }, function(messages) {
- MessageService.showMessage({
- content: messages[0]
- }), AllDone()
- })
- }
- function AllDone() {
- accounts.length > 0 ? successCallback(accounts) : failCallback(["No accounts found"])
- }
- var accounts = [];
- checkBankAccounts()
- }
- }
- }]), angular.module("essimoney.financial").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.transfer", {
- url: "/transfer",
- templateUrl: "app/financial/transfers/transfer-money.tpl",
- controller: "TransferMoneyController",
- controllerAs: "vm"
- }).state("app.dashboard.transfer-accountID", {
- url: "/transfer/:fromAccountID",
- templateUrl: "app/financial/transfers/transfer-money.tpl",
- controller: "TransferMoneyController",
- controllerAs: "vm"
- }).state("app.dashboard.transfer-app-accountID", {
- url: "/transfer/:app/:fromAccountID",
- templateUrl: "app/financial/transfers/transfer-money.tpl",
- controller: "TransferMoneyController",
- controllerAs: "vm"
- }).state("app.dashboard.pay-creditcard", {
- url: "/pay-credit",
- templateUrl: "app/financial/pay-credit/pay-credit.tpl",
- controller: "PayCreditCtrl",
- controllerAs: "vm"
- })
- }]), TransferMoneyController.$inject = ["$scope", "$stateParams", "$window", "utils", "FinancialInstanceService", "$filter", "MessageService", "BankingInstanceService"], angular.module("essimoney.financial").controller("TransferMoneyController", TransferMoneyController), TransferController.$inject = ["$scope", "$stateParams", "FinancialInstanceService", "utils", "MessageService", "$location"], angular.module("essimoney.financial").controller("TransferController", TransferController), PayCreditCtrl.$inject = ["$scope", "utils", "FinancialInstanceService", "i_creditCard", "$filter", "MessageService"], angular.module("essimoney.financial").controller("PayCreditCtrl", PayCreditCtrl), angular.module("essimoney.creditcards", ["ui.router", "ngStorage"]), angular.module("essimoney.creditcards").service("g_creditCard", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- return {
- getGameCreditCards: function() {
- var addToStorage = function(response) {
- $localStorage.CreditCardOptions = response.data
- };
- return utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/g/creditcards",
- params: {
- GameID: $localStorage.GameID
- },
- cache: !0
- }).success(addToStorage)
- }
- }
- }]).service("i_creditCard", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- return {
- getGameInstanceCreditCard: function(successCallback, failCallback) {
- return utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/creditcards",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback([response.data.Message])
- })
- },
- createCreditCardInstance: function(data, successCallback, failCallback) {
- var _data = angular.extend({
- GameInstanceID: $localStorage.GameInstanceID
- }, data);
- return log(_data), utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/creditcards",
- data: _data
- }).success(function(response) {
- return log(response), response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- log(response.data), failCallback([response.data.Message])
- })
- }
- }
- }]), angular.module("essimoney.creditcards").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.creditcards", {
- url: "/creditcards",
- templateUrl: "app/creditcards/select-card/select-card.tpl",
- controller: "SelectCardController",
- controllerAs: "vm"
- }).state("app.dashboard.creditcard", {
- url: "/creditcard",
- templateUrl: "app/creditcards/card-statement/card-statement.tpl",
- controller: "CardStatementController",
- controllerAs: "vm"
- })
- }]), SelectCardController.$inject = ["$scope", "g_creditCard", "i_creditCard", "FinancialInstanceService", "utils", "MessageService", "$timeout"], angular.module("essimoney.creditcards").controller("SelectCardController", SelectCardController), CardStatementController.$inject = ["$scope", "i_creditCard", "FinancialInstanceService", "utils", "MessageService"], angular.module("essimoney.creditcards").controller("CardStatementController", CardStatementController), angular.module("essimoney.email", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.email").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.emails", {
- url: "/emails",
- templateUrl: "app/emails/inbox/inbox.view.tpl",
- controller: "EmailInboxController",
- controllerAs: "vm"
- }).state("app.dashboard.emails-category", {
- url: "/emails/:categoryID",
- templateUrl: "app/emails/inbox/inbox.view.tpl",
- controller: "EmailInboxController",
- controllerAs: "vm"
- }).state("app.dashboard.email-mail", {
- url: "/emails/mail/:id/:categoryID",
- templateUrl: "app/emails/mail/mail.view.tpl",
- controller: "MailController",
- controllerAs: "vm"
- }).state("app.dashboard.email-payBills", {
- url: "/emails/pay-bills/:id",
- templateUrl: "app/emails/pay-bill/pay-bill.view.tpl",
- controller: "PayBillController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.email").service("EmailInstanceService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- return {
- getInstanceBillEmail: function(emailInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/emails/bill",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- EmailInstanceID: emailInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getCreditCardStatementEmailInstance: function(emailInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/emails/creditcardstatement",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- EmailInstanceID: emailInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getDebtCollectorEmailInstance: function(emailInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/emails/debtcollector",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- EmailInstanceID: emailInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getPaySlipEmailInstance: function(emailInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/emails/payslip",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- EmailInstanceID: emailInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- orderEmailsByWeek: function(emailList) {
- for (var weeks = {}, i = 0; i < emailList.length; i++) null == weeks["week-" + emailList[i].Week] && (weeks["week-" + emailList[i].Week] = []), weeks["week-" + emailList[i].Week].push(emailList[i]);
- var weeksSorted = [];
- for (var key in weeks) weeksSorted = weeksSorted.concat(weeks[key]);
- return weeksSorted
- }
- }
- }]), angular.module("essimoney.email").controller("EmailInboxController", EmailInboxController), EmailInboxController.$inject = ["$scope", "CommunicationsService", "utils", "$stateParams", "EmailInstanceService"], angular.module("essimoney").directive("emailList", ["$window", "$document", "utils", "$timeout", function($window, $document, utils, $timeout) {
- return {
- restrict: "AE",
- scope: !1,
- replace: !1,
- link: function(scope, elem, attrs) {
- function setListPosition() {
- $timeout(function() {
- var emailListHeight = angular.element(elem).height(),
- appScreenApp = document.getElementsByClassName("app-screen__app"),
- deviceHeight = angular.element(appScreenApp).height();
- emailListHeight > deviceHeight && elem.css({
- position: ""
- })
- }, 10)
- }
- scope.$on("UpdateEmailListPosition", setListPosition)
- }
- }
- }]), angular.module("essimoney").directive("emailVirus", ["$window", "$document", "utils", "$timeout", function($window, $document, utils, $timeout) {
- return {
- restrict: "E",
- scope: !1,
- replace: !1,
- link: function(scope, elem, attrs) {
- function createVirus() {
- function randomRange(min, max) {
- return Math.floor(Math.random() * (max - min + 1)) + min
- }
- var glitcher = new Glitcher({
- color: {
- red: 1,
- green: 1,
- blue: 1
- },
- stereoscopic: {
- red: 1,
- green: 10,
- blue: 2
- },
- lineOffset: {
- value: 4
- }
- });
- glitcher.glitch("assets/images/email/email-virus.png", function() {
- elem[0].appendChild(glitcher.canvas)
- }), interval = setInterval(function() {
- glitcher.options = {
- color: {
- red: 1,
- green: .8,
- blue: .58
- },
- stereoscopic: {
- red: 1 * randomRange(1, 1),
- green: 2 * randomRange(1, 2, 25),
- blue: 1 * randomRange(1, 2)
- },
- lineOffset: {
- value: 1 * randomRange(1, 2),
- lineHeight: 3 * randomRange(1, 2)
- }
- }, glitcher.process()
- }, 100)
- }
- var interval;
- createVirus(), scope.$on("$destroy", function() {
- clearInterval(interval)
- })
- }
- }
- }]);
- var Glitcher = function() {
- function Glitcher(options) {
- this.canvas = document.createElement("canvas"), this.context = this.canvas.getContext("2d"), this.origCanvas = document.createElement("canvas"), this.origContext = this.origCanvas.getContext("2d"), this.options = options
- }
- return Glitcher.prototype.glitch = function(url, callback) {
- var _this = this;
- this.loadImage(url, function(img) {
- _this.renderImage(img), _this.process(), callback()
- })
- }, Glitcher.prototype.process = function() {
- var brightness, offset, i, x, y, imageData = this.origContext.getImageData(0, 0, this.width, this.height),
- pixels = imageData.data,
- length = pixels.length,
- options = this.options;
- for (i = 0; i < length; i += 4) options.color && (pixels[i] *= options.color.red, pixels[i + 1] *= options.color.green, pixels[i + 2] *= options.color.blue), options.greyscale && (brightness = pixels[i] * options.greyscale.red + pixels[i + 1] * options.greyscale.green + pixels[i + 2] * options.greyscale.blue, pixels[i] = brightness, pixels[i + 1] = brightness, pixels[i + 2] = brightness), options.stereoscopic && (offset = options.stereoscopic.red, pixels[i] = void 0 === pixels[i + 4 * offset] ? 0 : pixels[i + 4 * offset], offset = options.stereoscopic.green, pixels[i + 1] = void 0 === pixels[i + 1 + 4 * offset] ? 0 : pixels[i + 1 + 4 * offset], offset = options.stereoscopic.blue, pixels[i + 2] = void 0 === pixels[i + 2 + 4 * offset] ? 0 : pixels[i + 2 + 4 * offset]);
- if (options.lineOffset)
- for (i = 0, y = 0; y < this.height; y++)
- for (offset = y % options.lineOffset.lineHeight === 0 ? Math.round(Math.random() * options.lineOffset.value) : offset, x = 0; x < this.width; x++) i += 4, pixels[i + 0] = void 0 === pixels[i + 4 * offset] ? 0 : pixels[i + 4 * offset], pixels[i + 1] = void 0 === pixels[i + 1 + 4 * offset] ? 0 : pixels[i + 1 + 4 * offset], pixels[i + 2] = void 0 === pixels[i + 2 + 4 * offset] ? 0 : pixels[i + 2 + 4 * offset];
- options.glitch, this.context.putImageData(imageData, 0, 0)
- }, Glitcher.prototype.loadImage = function(url, callback) {
- var img = document.createElement("img");
- img.crossOrigin = "anonymous", img.onload = function() {
- callback(img)
- }, img.src = url
- }, Glitcher.prototype.renderImage = function(img) {
- this.canvas.width = this.origCanvas.width = this.width = img.width, this.canvas.height = this.origCanvas.height = this.height = img.height, this.origContext.drawImage(img, 0, 0)
- }, Glitcher
- }();
- MailController.$inject = ["$scope", "CommunicationsService", "$stateParams", "utils", "EmailInstanceService", "GameMediaService", "GameInstancesService", "MessageService", "$rootScope"], angular.module("essimoney.email").controller("MailController", MailController), PayBillController.$inject = ["$scope", "$stateParams", "utils", "EmailInstanceService", "GameMediaService", "GameInstancesService", "BillsInstanceService", "FinancialInstanceService", "MessageService"], angular.module("essimoney.email").controller("PayBillController", PayBillController), angular.module("essimoney.communication", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.communication").service("CommunicationsService", ["$localStorage", "utils", "$rootScope", function($localStorage, utils, $rootScope) {
- var _currentCommunicationObj = {};
- return {
- getInstances: function(gameAppInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameAppInstances && null != $localStorage.GameAppInstances.Communications ? void successCallback($localStorage.GameAppInstances.Communications) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/communications",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAppInstanceID: gameAppInstanceID
- }
- }).success(function(response) {
- return response.data ? void successCallback(response.data) : void failCallback(response)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getInstance: function(gameAppInstanceID, communicationInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameAppInstances && null != $localStorage.GameAppInstances.Communications ? void successCallback($localStorage.GameAppInstances.Communications) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/communication",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAppInstanceID: gameAppInstanceID,
- CommunicationInstanceID: communicationInstanceID
- }
- }).success(function(response) {
- return response.data ? void successCallback(response.data) : void failCallback(response)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- readInstance: function(gameAppInstanceID, communicationInstanceID, successCallback, failCallback, isMentor) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/communication/read",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAppInstanceID: gameAppInstanceID,
- CommunicationInstanceID: communicationInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? (isMentor || $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getCurrentCommunication: function() {
- return _currentCommunicationObj
- },
- storeCurrentCommunication: function(commObj) {
- _currentCommunicationObj = commObj
- },
- deleteInstance: function(gameAppInstanceID, communicationInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameAppInstances && null != $localStorage.GameAppInstances.Communications ? void successCallback($localStorage.GameAppInstances.Communications) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/communication/delete",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAppInstanceID: gameAppInstanceID,
- CommunicationInstanceID: communicationInstanceID
- }
- }).success(function(response) {
- return response.data ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- actionInstance: function(communicationsAppInstanceID, gameAppInstanceID, actionableInstanceID, choice, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameAppInstances && null != $localStorage.GameAppInstances.Communications ? void successCallback($localStorage.GameAppInstances.Communications) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/communication/action",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- CommunicationsAppInstanceID: communicationsAppInstanceID,
- GameAppInstanceID: gameAppInstanceID,
- ActionableInstanceID: actionableInstanceID,
- Choice: choice
- }
- }).success(function(response) {
- return log(response.data.Success), response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages[0])
- }).fail(function(response) {
- failCallback(response.data.Messages[0])
- })
- }
- }
- }]), angular.module("essimoney.textmessage", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.textmessage").service("TextMessageService", ["$http", "GameInstancesService", "GameMediaService", function($http, GameInstancesService, GameMediaService) {
- return {
- groupTextMessages: function(msgs) {
- for (var messages = {}, i = 0; i < msgs.length; i++) null == messages["from-" + msgs[i].From] && (messages["from-" + msgs[i].From] = []), messages["from-" + msgs[i].From].push(msgs[i]);
- var messagesSorted = [];
- for (var key in messages) messagesSorted.push(messages[key]);
- return messagesSorted
- },
- groupTextMessagesThreadByWeek: function(msgs) {
- for (var messages = {}, i = 0; i < msgs.length; i++) null == messages["week-" + msgs[i].Week] && (messages["week-" + msgs[i].Week] = []), messages["week-" + msgs[i].Week].push(msgs[i]);
- var messagesSorted = [];
- for (var key in messages) messages[key].reverse(), messagesSorted.push(messages[key]);
- return messagesSorted.reverse()
- },
- replaceContentPlaceholders: function(msg) {
- for (var content = msg, username = GameInstancesService.getUser().username, emoticons = [
- [":D", "emoticonbigsmile"],
- [":(", "emoticonsad"],
- [":)", "emoticonsmile"],
- [";)", "emoticonwink"]
- ], i = 0; i < emoticons.length; i++) content = content.replace(emoticons[i][0], '<img class="emoticon" src="' + GameMediaService.get("textmessages", emoticons[i][1]) + '">');
- return content = content.replace(/%USERNAME%/g, username)
- }
- }
- }]), angular.module("essimoney.textmessage").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.text-message", {
- url: "/text-message",
- templateUrl: "app/text-message/list-messages/list-messages.tpl",
- controller: "TextMessageListController",
- controllerAs: "vm"
- }).state("app.dashboard.text-message-message", {
- url: "/text-message/message",
- templateUrl: "app/text-message/message/message.tpl",
- controller: "TextMessageController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.textmessage").controller("TextMessageListController", TextMessageListController), TextMessageListController.$inject = ["$scope", "CommunicationsService", "utils", "GameMediaService", "TextMessageService", "$timeout"], angular.module("essimoney.textmessage").controller("TextMessageController", TextMessageController), TextMessageController.$inject = ["$scope", "CommunicationsService", "utils", "GameMediaService", "TextMessageService", "$timeout", "$rootScope"], angular.module("essimoney.jobfinder", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.jobfinder").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.jobFinder", {
- url: "/job-finder",
- templateUrl: "app/job-finder/list-jobs/list-jobs.tpl",
- controller: "JobFinderListController",
- controllerAs: "vm"
- }).state("app.dashboard.jobFinder-job-id", {
- url: "/job-finder/job/:id",
- templateUrl: "app/job-finder/job/job.tpl",
- controller: "JobController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.jobfinder").service("JobFinderService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- return {
- getInstancePostings: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/jobfinder",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getInstancePosting: function(jobPostingID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/jobfinder/jobposting",
- params: {
- GameInstanceID: $localStorage.GameInstanceID,
- JobPostingID: jobPostingID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getInstanceCurrentJobs: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/jobs",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? (log(response.data), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- applyForJob: function(gameJobID, gameAppID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/g/jobs/apply",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameJobID: gameJobID,
- GameAppID: gameAppID
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), successCallback(response.data), void dataLayer.push({
- event: "app",
- appSelected: "job finder",
- appAction: "apply for this job"
- })) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data.Message)
- })
- },
- calculatePaymentSalary: function(jobs) {
- for (var i = 0; i < jobs.length; i++) switch (jobs[i].Salary = jobs[i].Salary, jobs[i].PaymentFrequency) {
- case 1:
- jobs[i].PaymentFrequencyString = "p/w", jobs[i].PaymentFrequencyStringFull = "per week";
- break;
- case 2:
- jobs[i].PaymentFrequencyString = "p/fn", jobs[i].PaymentFrequencyStringFull = "per fortnight";
- break;
- case 4:
- jobs[i].PaymentFrequencyString = "p/m", jobs[i].PaymentFrequencyStringFull = "per month"
- }
- return jobs
- }
- }
- }]), angular.module("essimoney.jobfinder").controller("JobFinderListController", JobFinderListController), JobFinderListController.$inject = ["$scope", "JobFinderService", "utils", "GameMediaService", "TextMessageService"], angular.module("essimoney.jobfinder").controller("JobController", JobController), JobController.$inject = ["$scope", "JobFinderService", "utils", "GameMediaService", "$stateParams", "MessageService"], angular.module("essimoney").directive("workDaysDisplay", [function() {
- return {
- restrict: "E",
- scope: {
- workDays: "="
- },
- replace: !0,
- link: function(scope, elem, attrs) {
- scope.days = [
- ["M", !1],
- ["T", !1],
- ["W", !1],
- ["T", !1],
- ["F", !1],
- ["S", !1],
- ["S", !1]
- ], scope.$watch("workDays", function() {
- if (void 0 != scope.workDays)
- for (var i = 0; i < scope.workDays.length; i++) scope.days[scope.workDays[i].Day][1] = !0
- })
- },
- template: '<ul class="work-days"><li ng-class="{\'work-days-working\': day[1] }" ng-repeat="day in days">{{day[0]}}</li></ul>'
- }
- }]), angular.module("essimoney.mystuff", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.mystuff").service("MyStuffService", ["$http", function($http) {
- var _currentStuff = {};
- return {
- setCurrentStuff: function(data) {
- _currentStuff = data
- },
- getCurrentStuff: function(data) {
- return _currentStuff
- }
- }
- }]), angular.module("essimoney.mystuff").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.my-stuff", {
- url: "/my-stuff",
- templateUrl: "app/my-stuff/list-stuff/list-stuff.tpl",
- controller: "MyStuffListController",
- controllerAs: "vm"
- }).state("app.dashboard.my-stuff-sell", {
- url: "/my-stuff/sell",
- templateUrl: "app/my-stuff/sell-stuff/sell-stuff.tpl",
- controller: "MyStuffSellController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.mystuff").controller("MyStuffListController", MyStuffListController), MyStuffListController.$inject = ["$scope", "ItemsService", "IBuyService", "utils", "GameMediaService", "MyStuffService"], angular.module("essimoney.mystuff").controller("MyStuffSellController", MyStuffSellController), MyStuffSellController.$inject = ["$scope", "IBuyService", "utils", "MyStuffService", "MessageService"], angular.module("essimoney.items", ["ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.items").service("ItemsService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- return {
- getInventory: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/items/inventory",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- purchaseItem: function(gameAppID, gameAppItemID, financialGameAppInstanceID, financialGameAppAccountInstanceID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/items/purchase",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAppID: gameAppID,
- GameAppItemID: gameAppItemID,
- FinancialGameAppInstanceID: financialGameAppInstanceID,
- FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]), angular.module("essimoney.ibuy", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.ibuy").service("IBuyService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- var _currentItem = {};
- return {
- sell: function(itemInstanceID, sellPrice, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/iBuy/items",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- ItemInstanceID: itemInstanceID,
- SellPrice: sellPrice
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- cancelSell: function(iBuyItemForSaleID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/iBuy/items/cancel",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- iBuyItemForSaleID: iBuyItemForSaleID
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getItemsForSale: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/iBuy/items",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getItems: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/iBuy",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- bid: function(gameAppItemID, financialGameAppInstanceID, financialGameAppAccountInstanceID, bidAmount, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/iBuy/bids",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- GameAppItemID: gameAppItemID,
- FinancialGameAppInstanceID: financialGameAppInstanceID,
- FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID,
- BidAmount: bidAmount
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getBids: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/iBuy/bids",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- cancelBids: function(iBuyGameItemBidID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/iBuy/bids/cancel",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- iBuyGameItemBidID: iBuyGameItemBidID
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- storeCurrentItem: function(data) {
- _currentItem = data
- },
- getCurrentItem: function() {
- return _currentItem
- }
- }
- }]), angular.module("essimoney.ibuy").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.ibuy", {
- url: "/ibuy",
- templateUrl: "app/ibuy/ibuy-list/ibuy-list.tpl",
- controller: "IBuyListController",
- controllerAs: "vm"
- }).state("app.dashboard.ibuy-item", {
- url: "/ibuy/item",
- templateUrl: "app/ibuy/item/ibuy-item.tpl",
- controller: "IBuyItemController",
- controllerAs: "vm"
- }).state("app.dashboard.ibuy-item-bid", {
- url: "/ibuy/item/bid",
- templateUrl: "app/ibuy/purchase/ibuy-purchase.tpl",
- controller: "IBuyPurchaseController",
- controllerAs: "vm"
- }).state("app.dashboard.ibuy-item-buy", {
- url: "/ibuy/item/buy",
- templateUrl: "app/ibuy/purchase/ibuy-purchase.tpl",
- controller: "IBuyPurchaseController",
- controllerAs: "vm"
- }).state("app.dashboard.ibuy-item-complete-bid", {
- url: "/ibuy/item/complete/bid",
- templateUrl: "app/ibuy/purchase-complete/ibuy-purchase-complete.tpl",
- controller: "IBuyPurchaseCompleteController",
- controllerAs: "vm"
- }).state("app.dashboard.ibuy-item-complete-buy", {
- url: "/ibuy/item/complete/buy",
- templateUrl: "app/ibuy/purchase-complete/ibuy-purchase-complete.tpl",
- controller: "IBuyPurchaseCompleteController",
- controllerAs: "vm"
- }).state("app.dashboard.ibuy-page", {
- url: "/ibuy/:page",
- templateUrl: "app/ibuy/ibuy-list/ibuy-list.tpl",
- controller: "IBuyListController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.ibuy").controller("IBuyListController", IBuyListController), IBuyListController.$inject = ["$scope", "IBuyService", "utils", "GameMediaService", "ItemsService", "$stateParams", "MessageService", "$timeout"], angular.module("essimoney.ibuy").controller("IBuyItemController", IBuyItemController), IBuyItemController.$inject = ["$scope", "IBuyService", "utils", "GameMediaService"], angular.module("essimoney.ibuy").controller("IBuyPurchaseController", IBuyPurchaseController), IBuyPurchaseController.$inject = ["$scope", "IBuyService", "utils", "GameMediaService", "$location", "FinancialInstanceService", "MessageService", "ItemsService"], angular.module("essimoney.ibuy").controller("IBuyPurchaseCompleteController", IBuyPurchaseCompleteController), IBuyPurchaseCompleteController.$inject = ["$scope", "$location", "utils", "GameMediaService"], angular.module("essimoney.ushop", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.ushop").service("UShopService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- var _currentItem = {};
- return {
- getItems: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/uShop",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- storeCurrentItem: function(data) {
- _currentItem = data
- },
- getCurrentItem: function() {
- return _currentItem
- }
- }
- }]), angular.module("essimoney.ushop").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.ushop", {
- url: "/ushop",
- templateUrl: "app/ushop/ushop-list/ushop-list.tpl",
- controller: "UShopListController",
- controllerAs: "vm"
- }).state("app.dashboard.ushop-item", {
- url: "/ushop/item",
- templateUrl: "app/ushop/item/ushop-item.tpl",
- controller: "UShopItemController",
- controllerAs: "vm"
- }).state("app.dashboard.ushop-item-buy", {
- url: "/ushop/item/buy",
- templateUrl: "app/ushop/purchase/ushop-purchase.tpl",
- controller: "UShopPurchaseController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.ushop").controller("UShopListController", UShopListController), UShopListController.$inject = ["$scope", "UShopService", "utils", "GameMediaService", "ItemsService", "MessageService"], angular.module("essimoney.ushop").controller("UShopItemController", UShopItemController), UShopItemController.$inject = ["$scope", "UShopService", "utils", "GameMediaService"], angular.module("essimoney.ushop").controller("UShopPurchaseController", UShopPurchaseController), UShopPurchaseController.$inject = ["$scope", "UShopService", "utils", "GameMediaService", "$location", "FinancialInstanceService", "MessageService", "ItemsService"], angular.module("essimoney.shares", ["ui.router", "ngCookies", "ngResource", "ngStorage", "rzModule", "highcharts-ng"]), angular.module("essimoney.shares").service("SharesService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- var _currentShare = {};
- return {
- getShares: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/shares",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- buyShares: function(shareInstanceID, financialGameAppInstanceID, financialGameAppAccountInstanceID, total, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/shares/buy",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- ShareInstanceID: shareInstanceID,
- FinancialGameAppInstanceID: financialGameAppInstanceID,
- FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID,
- Total: total
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- sellShares: function(shareInstanceID, financialGameAppInstanceID, financialGameAppAccountInstanceID, total, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/shares/sell",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- ShareInstanceID: shareInstanceID,
- FinancialGameAppInstanceID: financialGameAppInstanceID,
- FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID,
- Total: total
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- storeCurrentShare: function(share) {
- _currentShare = share
- },
- getCurrentShare: function() {
- return _currentShare
- }
- }
- }]), angular.module("essimoney.shares").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.shares", {
- url: "/shares",
- templateUrl: "app/shares/shares-list/shares-list.tpl",
- controller: "SharesListController",
- controllerAs: "vm"
- }).state("app.dashboard.shares-buy", {
- url: "/shares/buy",
- templateUrl: "app/shares/shares-buy/shares-buy.tpl",
- controller: "SharesBuyController",
- controllerAs: "vm"
- }).state("app.dashboard.shares-sell", {
- url: "/shares/sell",
- templateUrl: "app/shares/shares-sell/shares-sell.tpl",
- controller: "SharesSellController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.shares").controller("SharesListController", SharesListController), SharesListController.$inject = ["$scope", "SharesService", "utils", "GameMediaService", "$stateParams", "MessageService", "$timeout"], angular.module("essimoney.shares").controller("SharesBuyController", SharesBuyController), SharesBuyController.$inject = ["$scope", "SharesService", "utils", "GameMediaService", "$stateParams", "MessageService", "FinancialInstanceService"], angular.module("essimoney.shares").controller("SharesSellController", SharesSellController), SharesSellController.$inject = ["$scope", "SharesService", "utils", "GameMediaService", "$stateParams", "MessageService", "FinancialInstanceService"], angular.module("essimoney.endofweek", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.endofweek").service("EndOfWeekService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- var _currentQuestion = {};
- return {
- getCurrentSummary: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/progress/summary",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- eowQuestionsGenerate: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/eowquestions/generate",
- data: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data.Success) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- eowQuestions: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/eowquestions",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- eowQuestionsAnswer: function(questionID, answerID, skip, totalSeconds, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/eowquestions",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- QuestionID: questionID,
- AnswerID: answerID,
- Skip: skip,
- TimeRemaining: totalSeconds
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- setQuestionData: function(data) {
- _currentQuestion = data
- },
- getQuestionData: function() {
- return _currentQuestion
- }
- }
- }]), angular.module("essimoney.endofweek").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("endofweek", {
- url: "/end-of-week",
- templateUrl: "app/end-of-week/end-of-week.view.tpl",
- controllerAs: "vm"
- }).state("endofweek.end", {
- url: "/end",
- templateUrl: "app/end-of-week/end/end-of-week-end.view.tpl",
- controller: "EndOfWeekEndController",
- controllerAs: "vm"
- }).state("endofweek.question", {
- url: "/question",
- templateUrl: "app/end-of-week/question/end-of-week-question.view.tpl",
- controller: "EndOfWeekQuestionController",
- controllerAs: "vm"
- }).state("endofweek.question-feedback-correct", {
- url: "/feedback-correct",
- templateUrl: "app/end-of-week/question/feedback-correct.view.tpl",
- controller: "EndOfWeekFeedbackController",
- controllerAs: "vm"
- }).state("endofweek.question-feedback-incorrect", {
- url: "/feedback-incorrect",
- templateUrl: "app/end-of-week/question/feedback-incorrect.view.tpl",
- controller: "EndOfWeekFeedbackController",
- controllerAs: "vm"
- }).state("endofweek.summary", {
- url: "/summary",
- templateUrl: "app/end-of-week/summary/end-of-week-summary.view.tpl",
- controller: "EndOfWeekSummaryController",
- controllerAs: "vm"
- }).state("endofweek.start", {
- url: "/start",
- templateUrl: "app/end-of-week/start/end-of-week-start.view.tpl",
- controller: "EndOfWeekStartController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.endofweek").controller("EndOfWeekEndController", EndOfWeekEndController), EndOfWeekEndController.$inject = ["$scope", "GameInstancesService", "utils", "$timeout", "EndOfWeekService"], angular.module("essimoney.endofweek").controller("EndOfWeekQuestionController", EndOfWeekQuestionController), EndOfWeekQuestionController.$inject = ["$scope", "GameInstancesService", "utils", "EndOfWeekService", "$interval", "MessageService"], angular.module("essimoney.endofweek").controller("EndOfWeekFeedbackController", EndOfWeekFeedbackController), EndOfWeekFeedbackController.$inject = ["$scope", "GameInstancesService", "utils", "EndOfWeekService"], angular.module("essimoney.endofweek").controller("EndOfWeekSummaryController", EndOfWeekSummaryController), EndOfWeekSummaryController.$inject = ["$scope", "EndOfWeekService", "utils", "GameInstancesService", "GameMediaService"], angular.module("essimoney.endofweek").controller("EndOfWeekStartController", EndOfWeekStartController), EndOfWeekStartController.$inject = ["$scope", "$localStorage", "GameInstancesService", "utils", "$timeout"], angular.module("essimoney.mentorpopup", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney").directive("mentorPopUp", ["$window", "$compile", "CommunicationsService", "utils", "DashboardService", "$localStorage", "orderByFilter", "MentorService", function($window, $compile, CommunicationsService, utils, DashboardService, $localStorage, orderBy, MentorService) {
- return {
- restrict: "E",
- scope: !1,
- link: function(scope, elem, attrs) {
- function showMentorPopup(data) {
- scope.showCloseButton = !1, scope.PopupData = data, elem.append($compile('<div class="mentor-popup"><div class="mentor-overlay"></div><div class="mentor-content"><div class="close" ng-show="showCloseButton" ng-click="CloseMentorPopup()"><span class="icon-add icon-45"></span></div><mentor-msg mentor-data="PopupData"></mentor-msg></div></div>')(scope))
- }
- function animationFinished(data) {
- $window.removeEventListener("animationend", animationFinished), elem.html(""), scope.currentMsg++, scope.currentMsg < scope.data.length ? showMentorPopup(scope.data[scope.currentMsg]) : scope.currentMsg = 0
- }
- scope.data = {}, scope.currentMsg = 0, scope.showCloseButton = !1, scope.gameAppInstanceID = utils.getInstanceAppID("Mentor"), null != $localStorage.MentorMessages && (log($localStorage.MentorMessages), $localStorage.MentorMessages.length > 0 && (scope.data = $localStorage.MentorMessages, showMentorPopup(scope.data[scope.currentMsg]), $localStorage.MentorMessages = [])), scope.$on("ShowMentorPopup", function(event, data) {
- data.length > 0 && (scope.data = data, showMentorPopup(data[scope.currentMsg]))
- }), scope.$on("ShowMentorHelpPopup", function() {
- scope.showCloseButton = !1;
- for (var apps = orderBy(DashboardService.getGameApps(), "displayName", !1), content = [new Array], split = 6, contentIndex = 0, i = 0; i < apps.length; i++) i >= split && (contentIndex++, split += split, content[contentIndex] = new Array), content[contentIndex].push({
- GameAppID: apps[i].GameAppID,
- Name: apps[i].displayName
- });
- scope.data = [{
- ShowHelp: !0,
- ID: 0,
- Title: "What can I help <br/>you with?",
- Message: content
- }], log(scope.data), showMentorPopup(scope.data[0])
- }), scope.$on("ShowMentorFaqPopup", function() {
- scope.showCloseButton = !1, MentorService.getAppFAQMessages(function(response) {
- for (var faqs = response.data.faqs, content = [new Array], split = 6, contentIndex = 0, i = 0; i < faqs.length; i++) i >= split && (contentIndex++, split += split, content[contentIndex] = new Array), content[contentIndex].push({
- ID: faqs[i].ID,
- Name: faqs[i].Name,
- Content: faqs[i].Content
- });
- scope.data = [{
- ShowHelp: !1,
- ShowFaqs: !0,
- ID: 0,
- Title: "Frequently asked questions",
- Message: content
- }], showMentorPopup(scope.data[0])
- }, function(error) {})
- }), scope.CloseMentorPopup = function(closeMsg) {
- 0 != scope.data[scope.currentMsg].ID && CommunicationsService.readInstance(scope.gameAppInstanceID, scope.data[scope.currentMsg].ID, function() {}, function() {}, !0), closeMsg || (closeMsg = "close"), dataLayer.push({
- event: "howl spotlight",
- howlInteraction: closeMsg
- }), $window.addEventListener("animationend", animationFinished, !1), elem.children().eq(0).addClass("close")
- }, scope.$on("ResetMentorPopup", function() {
- scope.showCloseButton = !1
- }), scope.$on("LastPageShown", function() {
- scope.showCloseButton = !0
- }), scope.$on("CloseMentorPopup", function() {
- scope.CloseMentorPopup("got it")
- })
- }
- }
- }]), angular.module("essimoney").directive("mentorMsg", ["$window", "$compile", "MentorService", "GameMediaService", function($window, $compile, MentorService, GameMediaService) {
- return {
- restrict: "E",
- scope: {
- mentorData: "="
- },
- link: function(scope, elem, attrs) {
- function showHelpContent() {
- scope.HelpContent = scope.mentorData, scope.ShowHelp = !0, scope.ShowHelpBackBtn = !0, scope.Pages = scope.mentorData.Message, setupNav()
- }
- function showFaqContent() {
- scope.HelpContent = scope.mentorData, scope.ShowFaqs = !0, scope.ShowHelpBackBtn = !1, scope.Pages = scope.mentorData.Message, setupNav()
- }
- function showMessageContent() {
- scope.ShowHelp = !1, scope.ShowFaqs = !1, scope.Pages = chunkString(scope.mentorData.Message, 350), setupNav()
- }
- function setupNav() {
- scope.CurrentPage = 0, scope.NextDisabled = !1, scope.PrevDisabled = !0, scope.ShowBtn = !1, scope.ShowNav = !1, 1 == scope.Pages.length && (scope.NextDisabled = !0, scope.PrevDisabled = !0, scope.ShowBtn = !0, scope.$emit("LastPageShown")), scope.Pages.length > 1 && (scope.ShowNav = !0)
- }
- function chunkString(str, len) {
- for (var _offsetStart, _offsetEnd, _size = Math.ceil(str.length / len), _ret = [], _offsetArr = [0], _i = 0; _i < _size; _i++) {
- for (_offsetStart = _offsetArr[_i], _offsetEnd = _offsetStart + len;
- " " !== str.charAt(_offsetEnd) && _offsetEnd < str.length;) _offsetEnd++;
- _offsetEnd > str.length && (_offsetEnd = str.length), _ret.push(str.substring(_offsetStart, _offsetEnd)), _offsetArr.push(_offsetEnd)
- }
- for (var _i = 0; _i < _ret.length; ++_i) {
- var rp = GameMediaService.replaceContentPlaceholders(_ret[_i]).replace(/(?:\r\n|\\r|\\n)/g, "<br />");
- _ret[_i] = rp
- }
- return _ret
- }
- scope.CurrentPage = 0, scope.ShowHelp = !1, scope.ShowFaqs = !1, scope.ShowHelpBackBtn = !1, scope.HelpContent = {}, scope.mentorData.ShowHelp ? showHelpContent() : scope.mentorData.ShowFaqs ? showFaqContent() : showMessageContent(), scope.HelpClicked = function(gameAppID) {
- MentorService.getAppHelpMessage(gameAppID, function(data) {
- if (data.Results.length > 0) {
- for (var mentorMessages = [], i = 0; i < data.Results.length; i++) mentorMessages.push({
- ID: data.Results[i].ID,
- Message: data.Results[i].Body,
- Title: data.Results[i].Title
- });
- scope.mentorData = mentorMessages[0], dataLayer.push({
- event: "help",
- helpAction: mentorMessages[0].Title
- }), showMessageContent(), scope.$emit("ResetMentorPopup")
- }
- }, function(data) {})
- }, scope.FaqsClicked = function(id, title, content) {
- var mentorMessages = [];
- mentorMessages.push({
- ID: id,
- Message: content,
- Title: title
- }), scope.mentorData = mentorMessages[0], showMessageContent(), scope.$emit("ResetMentorPopup")
- }, scope.Close = function() {
- scope.$emit("CloseMentorPopup")
- }, scope.NextPage = function() {
- scope.CurrentPage++, scope.CurrentPage < scope.Pages.length ? scope.CurrentPage === scope.Pages.length - 1 && (scope.ShowBtn = !0, scope.NextDisabled = !0, scope.PrevDisabled = !1, scope.$emit("LastPageShown")) : scope.CurrentPage = scope.Pages.length - 1, dataLayer.push({
- event: "howl spotlight",
- howlInteraction: "next"
- })
- }, scope.PrevPage = function() {
- scope.CurrentPage--, scope.ShowBtn = !1, scope.CurrentPage > 0 || (scope.CurrentPage = 0, scope.PrevDisabled = !0, scope.NextDisabled = !1), dataLayer.push({
- event: "howl spotlight",
- howlInteraction: "prev"
- })
- }, scope.getHowl = function(tag) {
- return void 0 == tag ? GameMediaService.get("mentor", "default") : GameMediaService.get("mentor", tag)
- }
- },
- templateUrl: "app/mentor-popup/mentor-msg.view.tpl"
- }
- }]), angular.module("essimoney.mentorpopup").service("MentorService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
- return {
- getAppHelpMessage: function(gameAppId, successCallback, failCallback) {
- return null == $localStorage.GameID ? void failCallback(["Game not found."]) : null != $localStorage.GameApps ? void successCallback($localStorage.GameApps) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/g/mentor/help-messages",
- params: {
- GameID: $localStorage.GameID,
- TargetGameAppID: gameAppId
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getAppFAQMessages: function(successCallback, failCallback) {
- $http.get("assets/json/faqs/faqs.json").then(successCallback, failCallback)
- }
- }
- }]), angular.module("essimoney.financeweekly", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.financeweekly").service("FinanceWeeklyService", ["$rootScope", "$http", "$localStorage", "utils", function($rootScope, $http, $localStorage, utils) {
- var _currentArticle = {};
- return {
- getArticle: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/news/article",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- storeCurrentArticle: function(data) {
- _currentArticle = data
- },
- getCurrentArticle: function() {
- return _currentArticle
- },
- getArticles: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/news/archive/articles",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- createQuizWithQuestions: function(articleID, gameQuestionIDs, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/news/quiz/create",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- ArticleID: articleID,
- GameQuestionIDs: gameQuestionIDs
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- createQuiz: function(articleID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/news/quiz/create",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- ArticleID: articleID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- startQuiz: function(quizID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/news/quiz/start",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- QuizID: quizID
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("AppIconStateUpdate", {
- application: "News",
- state: "idle"
- }), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- isQuizRequiredAndCompleted: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/news/quiz/isrequired",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- endQuiz: function(quizID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/news/quiz/end",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- QuizID: quizID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- completeQuestion: function(questionID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/news/question/complete",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- QuestionID: questionID
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- submitAnswer: function(answers, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/news/answer/submit",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- Answers: answers
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getQuiz: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/news/quiz",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- }
- }
- }]), angular.module("essimoney.financeweekly").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.financeweekly", {
- url: "/financeweekly",
- templateUrl: "app/finance-weekly/finance-weekly-home/finance-weekly-home.tpl",
- controller: "FinanceWeeklyHomeController",
- controllerAs: "vm"
- }).state("app.dashboard.financeweekly-article", {
- url: "/financeweekly/article",
- templateUrl: "app/finance-weekly/finance-weekly-article/finance-weekly-article.tpl",
- controller: "FinanceWeeklyArticleController",
- controllerAs: "vm"
- }).state("app.dashboard.financeweekly-archive", {
- url: "/financeweekly/archive",
- templateUrl: "app/finance-weekly/finance-weekly-archive/finance-weekly-archive.tpl",
- controller: "FinanceWeeklyArchiveController",
- controllerAs: "vm"
- }).state("app.dashboard.financeweekly-archive-article", {
- url: "/financeweekly/archive/article",
- templateUrl: "app/finance-weekly/finance-weekly-article/finance-weekly-article.tpl",
- controller: "FinanceWeeklyArticleController",
- controllerAs: "vm"
- }).state("app.dashboard.financeweekly-quiz", {
- url: "/financeweekly/quiz",
- templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz.tpl",
- controller: "FinanceWeeklyQuizController",
- controllerAs: "vm"
- }).state("app.dashboard.financeweekly-quiz.fill-gap", {
- url: "/fill-gap",
- templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-fill-gap.tpl",
- controller: "FinanceWeeklyFillGapController",
- controllerAs: "vm"
- }).state("app.dashboard.financeweekly-quiz.summary", {
- url: "/summary",
- templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-summary.tpl",
- controller: "FinanceWeeklySummaryController",
- controllerAs: "vm"
- }).state("app.dashboard.financeweekly-quiz.question", {
- url: "/:question",
- templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-multiple-choice.tpl",
- controller: "FinanceWeeklyMultipleChoiceController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.financeweekly").controller("FinanceWeeklyHomeController", FinanceWeeklyHomeController), FinanceWeeklyHomeController.$inject = ["$scope", "FinanceWeeklyService", "utils", "GameMediaService", "MessageService", "GameInstancesService"], angular.module("essimoney.financeweekly").controller("FinanceWeeklyArticleController", FinanceWeeklyArticleController), FinanceWeeklyArticleController.$inject = ["$scope", "FinanceWeeklyService", "utils", "GameMediaService", "MessageService", "GameInstancesService", "$location"], angular.module("essimoney.financeweekly").controller("FinanceWeeklyArchiveController", FinanceWeeklyArchiveController), FinanceWeeklyArchiveController.$inject = ["$scope", "FinanceWeeklyService", "utils", "GameMediaService", "MessageService", "GameInstancesService", "$location"], angular.module("essimoney.financeweekly").controller("FinanceWeeklyQuizController", FinanceWeeklyQuizController), FinanceWeeklyQuizController.$inject = ["$scope", "FinanceWeeklyService", "utils", "GameMediaService", "MessageService", "GameInstancesService", "$stateParams", "$location"], angular.module("essimoney.financeweekly").controller("FinanceWeeklyMultipleChoiceController", FinanceWeeklyMultipleChoiceController), FinanceWeeklyMultipleChoiceController.$inject = ["$scope", "FinanceWeeklyService", "utils", "GameMediaService", "MessageService", "GameInstancesService"], angular.module("essimoney.financeweekly").controller("FinanceWeeklyFillGapController", FinanceWeeklyFillGapController), FinanceWeeklyFillGapController.$inject = ["$scope", "FinanceWeeklyService", "utils", "GameMediaService", "MessageService", "GameInstancesService"], angular.module("essimoney.financeweekly").controller("FinanceWeeklySummaryController", FinanceWeeklySummaryController),
- FinanceWeeklySummaryController.$inject = ["$scope", "FinanceWeeklyService", "utils", "GameMediaService", "MessageService", "GameInstancesService"], angular.module("essimoney.financeweekly").directive("blankWord", ["$window", "$location", "utils", "GameMediaService", "MentorService", "GameInstancesService", function($window, $location, utils, GameMediaService, MentorService, GameInstancesService) {
- return {
- restrict: "E",
- scope: {
- id: "="
- },
- replace: !0,
- link: function(scope, elem, attrs) {
- function updateWordAnswer(event, index, data) {
- index == scope.id && (data.Index > -1 ? (scope.Answer = data, scope.Classes = "current-selection has-word") : (scope.Answer = data, scope.Classes = ""))
- }
- function clearAnswer(event, index, data, currentSelectedID) {
- index == scope.id && (scope.Answer = data, scope.id == currentSelectedID ? scope.Classes = "current-selection" : scope.Classes = "")
- }
- function showFeedback(event, feedback) {
- feedback[0] == scope.Answer.ID && ("True" == feedback[1] ? scope.Classes = "correct" : scope.Classes = "incorrect")
- }
- function removeZIndex() {
- scope.Classes = scope.Classes.replace("current-selection", "")
- }
- scope.Answer = {
- Text: " "
- }, scope.Classes = "";
- var scrollElement = angular.element(document.getElementsByClassName("app-screen__app"));
- scope.WordClicked = function() {
- "correct" == scope.Classes || "incorrect" == scope.Classes || (scope.Answer.Index > -1 ? (scope.Classes = "current-selection", scope.$emit("QuizClearWord", {
- Index: scope.Answer.Index
- }), scope.Answer = {
- Text: " "
- }) : scope.Classes = "current-selection", scope.$emit("QuizWordPopup", scope.id, angular.element(elem).offset().top + scrollElement.scrollTop(), angular.element(elem).height()))
- }, scope.$on("UpdateWordAnswer", updateWordAnswer), scope.$on("ClearAnswer", clearAnswer), scope.$on("QuizShowFeedback", showFeedback), scope.$on("QuizPopupClosed", removeZIndex)
- },
- template: '<div class="blank-word"><button class="btn-blank-word" ng-class="Classes" ng-click="WordClicked()" ><span ng-bind-html="Answer.Text"></span><span class="icon-quiz-tick"></span><span class="icon-quiz-cross"></span></button></div>'
- }
- }]), angular.module("essimoney.weeklyplanner", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.weeklyplanner").service("WeeklyPlannerService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- var _currentQuestion = {};
- return {
- answerQuestion: function(week, answer, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/planner",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- Week: week,
- Answer: answer
- }
- }).success(function(response) {
- return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getPlannerSummary: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/planner",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getCurrentQuestion: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/planner/question",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- getQuestionInstances: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/planner/questions",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- storeArchiveQuestion: function(data) {
- _currentQuestion = data
- },
- getArchiveQuestion: function() {
- return _currentQuestion
- }
- }
- }]), angular.module("essimoney.weeklyplanner").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("app.dashboard.weeklyplanner", {
- url: "/weeklyplanner",
- templateUrl: "app/weekly-planner/weekly-planner-home/weekly-planner-home.tpl",
- controller: "WeeklyPlannerHomeController",
- controllerAs: "vm"
- }).state("app.dashboard.weeklyplanner.mybudget", {
- url: "/mybudget",
- templateUrl: "app/weekly-planner/weekly-planner-home/my-budget/my-budget.tpl",
- controller: "MyBudgetController",
- controllerAs: "vm"
- }).state("app.dashboard.weeklyplanner.diary", {
- url: "/diary",
- templateUrl: "app/weekly-planner/weekly-planner-home/diary/diary.tpl",
- controller: "DiaryController",
- controllerAs: "vm"
- }).state("app.dashboard.weeklyplanner-diaryView", {
- url: "/weeklyplanner/archive/view",
- templateUrl: "app/weekly-planner/weekly-planner-archive/view-diary.tpl",
- controller: "ViewDiaryController",
- controllerAs: "vm"
- }).state("app.dashboard.weeklyplanner-archive", {
- url: "/weeklyplanner/archive",
- templateUrl: "app/weekly-planner/weekly-planner-archive/diary-archive.tpl",
- controller: "WeeklyPlannerDiaryArchiveController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.weeklyplanner").controller("WeeklyPlannerHomeController", WeeklyPlannerHomeController), WeeklyPlannerHomeController.$inject = ["$scope", "utils", "GameMediaService", "ItemsService", "$stateParams", "MessageService", "$location"], angular.module("essimoney.weeklyplanner").controller("DiaryController", DiaryController), DiaryController.$inject = ["$scope", "WeeklyPlannerService", "utils", "GameMediaService", "ItemsService", "$stateParams", "MessageService", "$timeout"], angular.module("essimoney.weeklyplanner").controller("MyBudgetController", MyBudgetController), MyBudgetController.$inject = ["$scope", "WeeklyPlannerService", "utils", "GameMediaService", "ItemsService", "$stateParams", "MessageService", "$timeout"], angular.module("essimoney.weeklyplanner").directive("budgetMoneyInput", ["$window", "$timeout", function($window, $timeout) {
- return {
- restrict: "E",
- replace: !0,
- scope: {
- data: "=",
- maxData: "="
- },
- link: function(scope, elem, attrs) {
- log(scope.vm), scope.inputPattern = /^\d+$/, scope.ID = attrs.id, scope.onlyNumbers = function(event) {
- var keys = {
- up: 38,
- right: 39,
- down: 40,
- left: 37,
- escape: 27,
- backspace: 8,
- tab: 9,
- enter: 13,
- del: 46,
- 0: 48,
- 1: 49,
- 2: 50,
- 3: 51,
- 4: 52,
- 5: 53,
- 6: 54,
- 7: 55,
- 8: 56,
- 9: 57
- };
- for (var index in keys)
- if (keys.hasOwnProperty(index) && (event.charCode == keys[index] || event.keyCode == keys[index])) return;
- event.preventDefault()
- }, scope.onBlur = function() {
- void 0 == scope.data.Spend ? scope.data.Spend = 0 : scope.data.Spend = parseFloat(scope.data.Spend.toFixed())
- }, scope.keyUpCheck = function() {
- scope.data.Spend > scope.maxData && (scope.data.Spend = parseFloat(scope.maxData.toFixed())), scope.$emit("SliderSpendManuallyUpdated")
- }
- },
- template: '<div class="slide-value" ng-class="{\'disabled\':data.options.disabled}"><div class="dollar-sign">$</div><input class="transfer-amount" ng-disabled="data.options.disabled" ng-keyup="keyUpCheck()" ng-blur="onBlur()" ng-keypress="onlyNumbers($event)" ng-model="data.Spend" type="number" placeholder="0" step="1" min=0/></div>'
- }
- }]), angular.module("essimoney.weeklyplanner").controller("WeeklyPlannerDiaryArchiveController", WeeklyPlannerDiaryArchiveController), WeeklyPlannerDiaryArchiveController.$inject = ["$scope", "utils", "WeeklyPlannerService", "GameMediaService", "ItemsService", "$stateParams", "MessageService", "$location"], angular.module("essimoney.weeklyplanner").controller("ViewDiaryController", ViewDiaryController), ViewDiaryController.$inject = ["$scope", "WeeklyPlannerService", "utils", "GameMediaService", "ItemsService", "$stateParams", "MessageService", "$timeout"], angular.module("essimoney.endofgame", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.endofgame").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("endofgame", {
- url: "/end-of-game",
- templateUrl: "app/end-of-game/fireworks/end-fireworks.view.tpl",
- controller: "EndFireworksController",
- controllerAs: "vm"
- }).state("endofgame-balance", {
- url: "/end-of-game/balancesheet",
- templateUrl: "app/end-of-game/end-balance-sheet/end-balance-sheet.view.tpl",
- controller: "WhereImAtController",
- controllerAs: "vm"
- })
- }]), angular.module("essimoney.endofgame").controller("EndFireworksController", EndFireworksController), EndFireworksController.$inject = ["$scope", "utils", "$location", "GameInstancesService", "$localStorage", "$window"], angular.module("essimoney.endofgame").directive("fireworksCanvas", ["$window", function($window) {
- return {
- restrict: "E",
- replace: !0,
- link: function(scope, elem, attrs) {
- function random(min, max) {
- return Math.random() * (max - min) + min
- }
- function calculateDistance(p1x, p1y, p2x, p2y) {
- var xDistance = p1x - p2x,
- yDistance = p1y - p2y;
- return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2))
- }
- function Firework(sx, sy, tx, ty) {
- for (this.x = sx, this.y = sy, this.sx = sx, this.sy = sy, this.tx = tx, this.ty = ty, this.distanceToTarget = calculateDistance(sx, sy, tx, ty), this.distanceTraveled = 0, this.coordinates = [], this.coordinateCount = 3; this.coordinateCount--;) this.coordinates.push([this.x, this.y]);
- this.angle = Math.atan2(ty - sy, tx - sx), this.speed = 2, this.acceleration = 1.05, this.brightness = random(50, 70), this.targetRadius = 0
- }
- function Particle(x, y) {
- for (this.x = x, this.y = y, this.coordinates = [], this.coordinateCount = 5; this.coordinateCount--;) this.coordinates.push([this.x, this.y]);
- this.angle = random(0, 2 * Math.PI), this.speed = random(1, 10), this.friction = .95, this.gravity = 1, this.hue = random(hue - 20, hue + 20), this.brightness = random(50, 80), this.alpha = 1, this.decay = random(.015, .03)
- }
- function createParticles(x, y) {
- for (var particleCount = 50; particleCount--;) particles.push(new Particle(x, y))
- }
- function loop() {
- scope.ShowFireworks && requestAnimFrame(loop), cw = window.innerWidth, ch = window.innerHeight, scope.width = cw, scope.height = ch, hue += .5, ctx.globalCompositeOperation = "destination-out", ctx.fillStyle = "rgba(0, 0, 0, .8)", ctx.fillRect(0, 0, cw, ch), ctx.globalCompositeOperation = "lighter";
- for (var i = fireworks.length; i--;) fireworks[i].draw(), fireworks[i].update(i);
- for (var i = particles.length; i--;) particles[i].draw(), particles[i].update(i);
- timerTick >= timerTotal ? mousedown || (fireworks.push(new Firework(cw / 2, ch, random(0, cw), random(0, ch / 2))), timerTick = 0) : timerTick++
- }
- scope.ShowFireworks = !0, scope.Style = {}, scope.width = 0, scope.height = 0, elem.on("$destroy", function() {
- scope.ShowFireworks = !1
- }), window.requestAnimFrame = function() {
- return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
- window.setTimeout(callback, 1e3 / 60)
- }
- }();
- var canvas = document.getElementById("canvas"),
- ctx = canvas.getContext("2d"),
- cw = window.innerWidth,
- ch = window.innerHeight,
- fireworks = [],
- particles = [],
- hue = 120,
- timerTotal = 30,
- timerTick = 0,
- mousedown = !1;
- canvas.width = cw, canvas.height = ch, Firework.prototype.update = function(index) {
- this.coordinates.pop(), this.coordinates.unshift([this.x, this.y]), this.targetRadius = .1, this.speed *= this.acceleration;
- var vx = Math.cos(this.angle) * this.speed,
- vy = Math.sin(this.angle) * this.speed;
- this.distanceTraveled = calculateDistance(this.sx, this.sy, this.x + vx, this.y + vy), createParticles(this.tx, this.ty), fireworks.splice(index, 1)
- }, Firework.prototype.draw = function() {
- ctx.beginPath(), ctx.moveTo(this.coordinates[this.coordinates.length - 1][0], this.coordinates[this.coordinates.length - 1][1]), ctx.lineTo(this.x, this.y), ctx.strokeStyle = "hsl(" + hue + ", 100%, " + this.brightness + "%)", ctx.stroke(), ctx.beginPath(), ctx.arc(this.tx, this.ty, this.targetRadius, 0, 2 * Math.PI), ctx.stroke()
- }, Particle.prototype.update = function(index) {
- this.coordinates.pop(), this.coordinates.unshift([this.x, this.y]), this.speed *= this.friction, this.x += Math.cos(this.angle) * this.speed, this.y += Math.sin(this.angle) * this.speed + this.gravity, this.alpha -= this.decay, this.alpha <= this.decay && particles.splice(index, 1)
- }, Particle.prototype.draw = function() {
- ctx.beginPath(), ctx.moveTo(this.coordinates[this.coordinates.length - 1][0], this.coordinates[this.coordinates.length - 1][1]), ctx.lineTo(this.x, this.y), ctx.strokeStyle = "hsla(" + this.hue + ", 100%, 100%, " + this.alpha + ")", ctx.stroke()
- }, loop(), angular.element($window).bind("resize", function() {
- scope.$apply()
- })
- },
- template: '<canvas id="canvas" width="{{width}}" height="{{height}}"></canvas>'
- }
- }]), angular.module("essimoney.survey", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.survey").service("SurveyService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
- var _questionData = {},
- _observerCallbacks = [],
- notifyObservers = function() {
- angular.forEach(_observerCallbacks, function(callback) {
- callback()
- })
- };
- return {
- getSurvey: function(successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "GET",
- url: appConfig.baseUrl + "/api/i/survey",
- params: {
- GameInstanceID: $localStorage.GameInstanceID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- submitSurvey: function(surveyQuestionOptionID, successCallback, failCallback) {
- return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
- method: "POST",
- url: appConfig.baseUrl + "/api/i/survey/submit",
- data: {
- GameInstanceID: $localStorage.GameInstanceID,
- SurveyQuestionOptionID: surveyQuestionOptionID
- }
- }).success(function(response) {
- return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
- }).fail(function(response) {
- failCallback(response.data)
- })
- },
- setQuestionData: function(data) {
- _questionData = data, notifyObservers()
- },
- getQuestionData: function() {
- return _questionData
- },
- registerObserverCallback: function(callback) {
- _observerCallbacks.push(callback)
- }
- }
- }]), angular.module("essimoney.survey").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
- $stateProvider.state("surveys", {
- url: "/surveys",
- templateUrl: "app/survey/survey.view.tpl",
- controllerAs: "vm"
- }).state("surveys.question", {
- url: "/question",
- views: {
- "": {
- templateUrl: "app/survey/survey-question/question.view.tpl",
- controller: "SurveyQuestionController",
- controllerAs: "vm"
- },
- progress: {
- templateUrl: "app/survey/survey-progress/progress.view.tpl",
- controller: "SurveyProgressController",
- controllerAs: "vm"
- }
- }
- }).state("surveys.feedback-correct", {
- url: "/feedback-correct",
- views: {
- "": {
- templateUrl: "app/survey/survey-question/feedback-correct.view.tpl",
- controller: "SurveyQuestionFeedbackController",
- controllerAs: "vm"
- },
- progress: {
- templateUrl: "app/survey/survey-progress/progress.view.tpl",
- controller: "SurveyProgressController",
- controllerAs: "vm"
- }
- }
- }).state("surveys.feedback-incorrect", {
- url: "/feedback-incorrect",
- views: {
- "": {
- templateUrl: "app/survey/survey-question/feedback-incorrect.view.tpl",
- controller: "SurveyQuestionFeedbackController",
- controllerAs: "vm"
- },
- progress: {
- templateUrl: "app/survey/survey-progress/progress.view.tpl",
- controller: "SurveyProgressController",
- controllerAs: "vm"
- }
- }
- })
- }]), angular.module("essimoney").directive("survey", [function() {
- return {
- restrict: "E",
- scope: !1,
- link: function(scope, elem, attrs) {},
- templateUrl: "app/survey/survey-start.view.tpl"
- }
- }]), angular.module("essimoney.survey").controller("SurveyController", SurveyController), SurveyController.$inject = ["$scope", "utils", "$location", "GameInstancesService", "SurveyService"], angular.module("essimoney.survey").controller("SurveyQuestionController", SurveyQuestionController), SurveyQuestionController.$inject = ["$scope", "utils", "SurveyService", "$localStorage"], angular.module("essimoney.survey").controller("SurveyQuestionFeedbackController", SurveyQuestionFeedbackController), SurveyQuestionFeedbackController.$inject = ["$scope", "GameInstancesService", "utils", "SurveyService", "$localStorage"], angular.module("essimoney.survey").controller("SurveyProgressController", SurveyProgressController), SurveyProgressController.$inject = ["$scope", "utils", "$location", "GameInstancesService", "SurveyService"], angular.module("essimoney.management", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.management").service("GameLinkService", ["$http", "utils", "$localStorage", function($http, utils, $localStorage) {
- return {
- register: function(gamelinkid, successCallback, failCallback) {
- utils.req({
- method: "post",
- url: appConfig.baseUrl + "/api/m/gamelinks",
- headers: {
- "Content-Type": "application/json",
- Authorization: "bearer " + encodeURIComponent($localStorage.Token)
- },
- data: {
- GameLinkID: gamelinkid
- }
- }).success(successCallback).fail(function(response) {
- failCallback(response)
- })
- },
- get: function(gamelinkid, successCallback, failCallback) {
- utils.req({
- method: "get",
- url: appConfig.baseUrl + "/api/m/gamelinks?GameLinkID=" + encodeURIComponent(gamelinkid),
- headers: {
- "Content-Type": "application/json",
- Authorization: "bearer " + encodeURIComponent($localStorage.Token)
- }
- }).success(function(response) {
- $localStorage.GameLink = response.data, $localStorage.GameID = response.data.GameID, dataLayer.push({
- userId: $localStorage.GameLink.UserID
- }), successCallback(response.data)
- }).fail(function(response) {
- alert("failed"), failCallback(response)
- })
- },
- getInfo: function(gamelinkid, successCallback, failCallback) {
- utils.req({
- method: "get",
- url: appConfig.baseUrl + "/api/m/gamelink?GameLinkID=" + encodeURIComponent(gamelinkid),
- headers: {
- "Content-Type": "application/json"
- }
- }).success(function(response) {
- log(gamelinkid), $localStorage.GameLinkID = gamelinkid, successCallback(response.data)
- }).fail(function(response) {
- failCallback(response)
- })
- }
- }
- }]), angular.module("essimoney").run(["$templateCache", function($templateCache) {
- $templateCache.put("app/authentication/auth.view.tpl", '<div class="splash-screen"> <div class="splash-screen screen-a mark hidden-screen"> <div class="login-grp clearfix" ng-controller="AuthenticationController"> <div class="login-grp__mid"> <div class="login-grp__item login-grp__item--logo"> <div class="login-logo-a"> <picture> <img src="assets/images/login/essimoney-suncorp-logo-desktop.svg" alt="Essi Money powered by Suncorp"> </picture> </div> <div class="login-class" ng-show="Loading || ErrorGameLinkID"> <h4 class="login-class__title lxt lxt--title-4 lxt--clr lxt--lt lxt--ctr">{{Status}}</h4> </div> <div class="login-class" ng-show="ShowClassModule"> <h4 class="login-class__title lxt lxt--title-4 lxt--lt lxt--clr">{{GameInfo.GroupName}}</h4> <p class="login-class__text">YEAR {{GameInfo.GroupYear}} {{GameInfo.GroupSubject}}</p> </div> </div> <div class="login-grp__item" ui-view></div> </div> </div> <div class="login-stage"></div> </div> <div class="splash-screen screen-b"> <div class="login-grp clearfix"> <div class="login-grp__mid"> <div class="login-grp__item"> <div class="login-logo-b"> <picture> <img src="assets/images/login/essimoney-suncorp-logo-desktop.svg" alt="Essi Money powered by Suncorp"> </picture> </div> </div> </div> </div> <div class="login-stage splash"></div> </div> </div> '), $templateCache.put("app/authentication/create-user/create-user.tpl", '<div ng-show="!vm.SuccessView && !vm.FailedRegistration.State"> <div class="login-panel min"> <div class="login-fgroup login-fgroup--cuser"> <form name="vm.CreateUser" novalidate> <h2 class="lxt lxt--title lxt--ctr lxt--clr">CREATE AN ESSI MONEY ACCOUNT</h2> <div class="rich-input" ng-class="$parent.validateInput(vm.CreateUser.Name, \'text\')"> <label class="rich-input__label">First Name</label> <input type="text" class="rich-input__inp" ng-model="vm.UserDetails.Name" ng-model-options="{ updateOn: \'blur\' }" name="Name" required ng-pattern="/^\\w+$/"> <div ng-show="$parent.showError(vm.CreateUser, \'Name\')"> <span class="rich-input__err" ng-show="vm.CreateUser.Name.$error.required">Please enter your name</span> <span class="rich-input__err" ng-show="vm.CreateUser.Name.$error.pattern">First Name can only contain letters and numbers</span> </div> </div> <div class="rich-input" ng-class="$parent.validateInput(vm.CreateUser.SchoolEmail, \'email\')"> <label class="rich-input__label">School Email</label> <input type="email" validate-email class="rich-input__inp" ng-model="vm.UserDetails.SchoolEmail" ng-model-options="{ updateOn: \'blur\' }" name="SchoolEmail" required> <div ng-show="$parent.showError(vm.CreateUser, \'SchoolEmail\')"> <span class="rich-input__err" ng-show="vm.CreateUser.SchoolEmail.$error.required">Please enter your school email</span> <span class="rich-input__err" ng-show="vm.CreateUser.SchoolEmail.$error.email">This is not a valid email</span> </div> </div> <div class="rich-input" ng-class="$parent.validateInput(vm.CreateUser.YOB, \'text\')"> <label class="rich-input__label">Year of Birth</label> <input type="text" class="rich-input__inp" validate-yob ng-model="vm.UserDetails.YOB" ng-model-options="{ updateOn: \'blur\' }" name="YOB" ng-pattern="/^[12]{1}[0-9]{3}$/" required> <div ng-show="$parent.showError(vm.CreateUser, \'YOB\')"> <span class="rich-input__err" ng-show="vm.CreateUser.YOB.$error.required">Please enter the year you were born in</span> <span class="rich-input__err" ng-show="vm.CreateUser.YOB.$error.pattern">Please enter the year as a four digit number</span> <span class="rich-input__err" ng-show="vm.CreateUser.YOB.$error.yobrange">Your year of birth must be within the allowed range</span> </div> </div> <br> <p class="lxt lxt--clr">Password must be a minimum of 8 characters, contain a mixture of upper and lowercase letters and at least one number</p> <div class="rich-input" ng-class="$parent.validateInput(vm.CreateUser.Password, \'password\')"> <label class="rich-input__label">Password</label> <input type="password" class="rich-input__inp" ng-model="vm.UserDetails.Password" ng-model-options="{ updateOn: \'blur\' }" id="Password" name="Password" complex-password required> <div ng-show="$parent.showError(vm.CreateUser, \'Password\')"> <span class="rich-input__err" ng-show="vm.CreateUser.Password.$error.required">Please enter a password</span> <span class="rich-input__err" ng-show="vm.CreateUser.Password.$error.complexity">Please enter a valid password</span> </div> </div> <div class="rich-input" ng-class="$parent.validateInput(vm.CreateUser.ConfirmPassword, \'confirmPassword\')"> <label class="rich-input__label">Confirm Password</label> <input type="password" class="rich-input__inp" ng-model="vm.UserDetails.ConfirmPassword" ng-model-options="{ updateOn: \'blur\' }" id="ConfirmPassword" name="ConfirmPassword" password-check="Password" required> <div ng-show="$parent.showError(vm.CreateUser, \'ConfirmPassword\')"> <span class="rich-input__err" ng-show="vm.CreateUser.ConfirmPassword.$error.required && !vm.CreateUser.ConfirmPassword.$error.passwordMatch">No password entered</span> <span class="rich-input__err" ng-show="vm.CreateUser.ConfirmPassword.$error.passwordMatch">Password does not match</span> </div> </div> <div class="login-fgroup__gender"> <div class="radio-check"> <input type="radio" name="Gender" class="radio-check__obj" ng-model="vm.UserDetails.Gender" id="gender-m" value="m" required> <label class="radio-check__lbl" for="gender-m">Male</label> </div> <div class="radio-check"> <input type="radio" name="Gender" class="radio-check__obj" ng-model="vm.UserDetails.Gender" id="gender-f" value="f" required> <label class="radio-check__lbl" for="gender-f">Female</label> </div> </div> <button class="login-btn dk" type="button" ng-click="vm.CreateAccount()" ng-disabled="!vm.CreateUser.$valid">CREATE ACCOUNT</button> </form> </div> </div> <br> <p class="lxt lxt--clr lxt--ctr"> <span ng-click="vm.ReturnToLogin()" ng-show="!$parent.ErrorGameLinkID" class="lxt lxt--ctr" style="text-decoration: underline; cursor: pointer; color: #1B3756">RETURN TO LOG IN</span> </p> </div> <div class="login-panel min" ng-show="vm.SuccessView"> <div class="login-fgroup login-fgroup--cuser"> <h2 class="lxt lxt--title lxt--ctr lxt--clr">Your ESSI Money account has been created</h2> <button type="button" ng-show="!$parent.ErrorGameLinkID" ng-click="vm.ReturnToLogin()" class="login-btn dk">RETURN TO LOG IN</button> </div> </div> <div class="login-panel min" ng-show="vm.FailedRegistration.State"> <div class="login-fgroup login-fgroup--cuser"> <h2 class="lxt lxt--title-3 lxt--clr">{{vm.FailedRegistration.Messages.Message}}</h2> <br> <p class="lxt lxt--clr" style="overflow: hidden; text-overflow: ellipsis; margin-bottom: 20px" ng-repeat="state in vm.FailedRegistration.Messages.ModelStates" title="{{state}}">{{state}}</p> <button type="button" ng-click="vm.UpdateFields()" class="login-btn dk">GO BACK</button> </div> </div> '), $templateCache.put("app/authentication/login/login.tpl", '<div class="login-panel" ng-show="!$parent.ErrorGameLinkID"> <div class="login-panel__col"> <div class="login-fgroup login-fgroup--euser"> <form name="vm.UserLogin" novalidate autocomplete="new-password"> <h2 class="lxt lxt--title lxt--ctr lxt--clr">EXISTING USER</h2> <!-- fake fields are a workaround for chrome autofill getting the wrong fields --> <input type="email" class="fake-input" name="fakeusernameremembered" aria-hidden="true"> <input type="password" class="fake-input" name="fakepasswordremembered" aria-hidden="true"> <div class="rich-input" ng-class="$parent.validateInput(vm.UserLogin.UserEmail, \'email\')"> <label class="rich-input__label" for="3fs1">Email</label> <input type="email" id="3fs1" validate-email class="rich-input__inp" ng-model="vm.UserDetails.UserEmail" ng-model-options="{ updateOn: \'blur\' }" name="UserEmail" required> <div ng-show="$parent.showError(vm.UserLogin, \'UserEmail\')"> <span class="rich-input__err" ng-show="vm.UserLogin.UserEmail.$error.required">Please enter your email</span> <span class="rich-input__err" ng-show="vm.UserLogin.UserEmail.$error.email">This is not a valid email</span> </div> </div> <div class="rich-input" ng-class="$parent.validateInput(vm.UserLogin.LoginPassword, \'text\')"> <label class="rich-input__label" for="3fs2">Password</label> <input type="password" id="3fs2" class="rich-input__inp" ng-model="vm.UserDetails.LoginPassword" ng-model-options="{ updateOn: \'blur\' }" name="LoginPassword" required> <div ng-show="$parent.showError(vm.UserLogin, \'LoginPassword\')"> <span class="rich-input__err" ng-show="vm.UserLogin.LoginPassword.$error.required">Password is required</span> </div> </div> <div class="rich-input error" ng-show="vm.LoginFailed"> <span class="rich-input__err lxt--ctr">{{vm.LoginFailMessage}}</span> </div> <br> <p class="lxt lxt--ctr lxt--clr"> <a href="#/auth/account-recovery/{{vm.GamelinkID}}" class="lxt" style="text-decoration: underline">FORGOT PASSWORD</a> </p> <br> <button class="login-btn dk" ng-click="vm.login()" type="button">LOG IN</button> </form> </div> </div> <div class="login-panel__or"><span>OR</span></div> <div class="login-panel__col"> <div class="login-fgroup login-fgroup--nuser"> <h2 class="lxt lxt--title lxt--ctr">NEW USER</h2> <p class="lxt lxt--ctr"> Is this your first time playing <span style="white-space: nowrap">ESSI Money</span>? </p> <p class="lxt lxt--ctr">Create an account here</p> <a href="#/auth/create-user" class="login-btn lt">CREATE ACCOUNT</a> </div> </div> </div>'), $templateCache.put("app/authentication/password-reset/password-reset.tpl", '<div class="login-panel md" ng-show="!vm.setPasswordSuccess"> <div class="login-fgroup login-fgroup--cuser"> <form name="vm.PasswordReset" novalidate> <h2 class="lxt lxt--title lxt--ctr lxt--clr">PASSWORD RESET</h2> <p class="lxt lxt--ctr">Your password has been reset. Please enter a new one</p> <p class="lxt lxt--ctr">Password must be a minimum of 8 characters, contain a mixture of upper and lowercase letters and at lease one number</p> <div class="rich-input" ng-class="$parent.validateInput(vm.PasswordReset.Password, \'password\')"> <label class="rich-input__label">Password</label> <input type="password" class="rich-input__inp" ng-model="vm.UserDetails.Password" id="Password" name="Password" complex-password required> <div ng-show="$parent.showError(vm.PasswordReset, \'Password\')"> <span class="rich-input__err" ng-show="vm.PasswordReset.Password.$error.required">Please enter a password</span> <span class="rich-input__err" ng-show="vm.PasswordReset.Password.$error.complexity">Please enter a valid password</span> </div> </div> <div class="rich-input" ng-class="$parent.validateInput(vm.PasswordReset.ConfirmPassword, \'confirmPassword\')"> <label class="rich-input__label">Confirm Password</label> <input type="password" class="rich-input__inp" ng-model="vm.UserDetails.ConfirmPassword" id="ConfirmPassword" name="ConfirmPassword" password-check="Password" required> <div ng-show="$parent.showError(vm.PasswordReset, \'ConfirmPassword\')"> <span class="rich-input__err" ng-show="vm.PasswordReset.ConfirmPassword.$error.required && !vm.PasswordReset.ConfirmPassword.$error.passwordMatch">No password entered</span> <span class="rich-input__err" ng-show="vm.PasswordReset.ConfirmPassword.$error.passwordMatch">Password does not match</span> </div> </div> <br> <button class="login-btn dk" type="button" ng-click="vm.CreateNewPassword()" ng-disabled="!vm.PasswordReset.$valid">RESET PASSWORD</button> </form> </div> </div> <div class="login-panel md" ng-show="vm.setPasswordSuccess"> <div class="login-fgroup login-fgroup--cuser"> <h2 class="lxt lxt--title-3 lxt--clr lxt--ctr">YOUR PASSWORD HAS BEEN SUCCESSFULLY RESET.</h2> <br> <p class="lxt lxt--clr lxt--ctr" style="overflow: hidden; text-overflow: ellipsis; margin-bottom: 20px">Please close this browser window and follow the game link supplied by your teacher</p> </div> </div>'), $templateCache.put("app/authentication/recovery/recovery.tpl", '<div ng-show="!vm.RecoverySent.State && !vm.RecoverySent.Error"> <div class="login-panel min"> <div class="login-fgroup login-fgroup--cuser"> <form name="vm.RecoveryForm" novalidate> <h2 class="lxt lxt--title lxt--ctr lxt--clr">FORGOT YOUR PASSWORD?</h2> <br> <p class="lxt lxt--clr lxt--ctr">Please enter your email address to begin the password recovery process.</p> <div class="rich-input" ng-class="$parent.validateInput(vm.RecoveryForm.RecoveryEmail, \'email\')"> <label class="rich-input__label">Email</label> <input type="email" class="rich-input__inp" ng-model="vm.UserDetails.RecoveryEmail" name="RecoveryEmail" required> <div ng-show="$parent.showError(vm.RecoveryForm, \'RecoveryEmail\')"> <span class="rich-input__err" ng-show="vm.RecoveryForm.RecoveryEmail.$error.required">Please enter your school email</span> <span class="rich-input__err" ng-show="vm.RecoveryForm.RecoveryEmail.$error.email">This is not a valid email</span> </div> </div> <button class="login-btn dk" type="button" ng-click="vm.SendRecoveryPassword();" ng-disabled="!vm.RecoveryForm.$valid">SEND</button> </form> </div> </div> <br> <p class="lxt lxt--clr lxt--ctr"> <span ng-click="vm.ReturnToLogin()" ng-show="!$parent.ErrorGameLinkID" class="lxt lxt--ctr" style="text-decoration: underline; cursor: pointer; color: #1B3756">RETURN TO LOG IN</span> </p> </div> <br> <div class="login-panel min" ng-show="vm.RecoverySent.State"> <div class="login-fgroup login-fgroup--cuser"> <h2 class="lxt lxt--title lxt--ctr lxt--clr">RECOVERY EMAIL SENT</h2> <br> <p class="lxt lxt--clr lxt--ctr">A recovery email has been sent to your address. Please follow the link in your email to reset your password.</p> <button ng-click="vm.ReturnToLogin()" ng-show="!$parent.ErrorGameLinkID" class="login-btn dk" type="button">RETURN TO LOG IN</button> </div> </div> <div class="login-panel min" ng-show="vm.RecoverySent.Error"> <div class="login-fgroup login-fgroup--cuser"> <h2 class="lxt lxt--title-3 lxt--ctr lxt--clr">Email not found</h2> <button type="button" ng-click="vm.GoBack()" class="login-btn dk">Go Back</button> </div> </div>'), $templateCache.put("app/authentication/select-game/select-game.tpl", '<div class="login-gslot"> <h3 ng-show="!$parent.ErrorGameLinkID" class="lxt lxt--title-3 lxt--ctr" style="color: #1B3756">Welcome {{vm.UserName}}, please select a game:</h3> <div class="login-gslot__group"> <div class="login-gslot__item" ng-repeat="Game in vm.GameInstances" on-finish-render="ngRepeatFinished" ng-class="Game.NetPosition < 0 ? \'login-gslot__item--neg\' : \'\'" ng-click="vm.SelectGame($index);"> <div class="js-gameblock login-gslot__obj" data-game-number="{{$index + 1}}" ng-if="Game.ID != undefined" ng-click="vm.SetGame($index)"> <img class="img-ratio" src="assets/images/placeholder-40x49.png"> <div class="login-gslot__det"> <div> <h2 class="lxt lxt--title lxt--clr">GAME {{$index + 1}}</h2> <h3 class="login-gslot__week lxt lxt--lt lxt--title-3 lxt--clr" ng-if="Game.IsGameComplete"> <span>COMPLETED</span> </h3> <h3 class="login-gslot__week lxt lxt--title-3 lxt--clr" ng-if="!Game.IsGameComplete"> WEEK {{Game.CurrentWeek}} </h3> <div ng-if="Game.NetPosition <= 0"> <p class="login-gslot__pos lxt lxt--clr"><strong style="color: #FA6C58">NET POSITION</strong></p> <h3 class="lxt lxt--title-3 lxt--clr" style="color: #494E91; font-size: 26px">{{Game.NetPosition | currency : \'$\' : 2 }}</h3> </div> <div ng-if="Game.NetPosition > 0"> <p class="login-gslot__pos lxt lxt--clr" style="color: #494E91"><strong>NET POSITION</strong></p> <h3 class="lxt lxt--title-3 lxt--clr" style="color: #494E91; font-size: 26px">{{Game.NetPosition | currency : \'$\' : 2 }}</h3> </div> </div> </div> </div> <div class="js-gameblock login-gslot__obj" ng-if="Game.ID == undefined" data-game-number="{{$index + 1}}" ng-click="vm.SetGame($index)"> <div class="login-gslot__obj"> <img class="img-ratio" src="assets/images/placeholder-40x49.png"> <div class="login-gslot__det"> <h2 class="lxt lxt--title">NEW<br>GAME</h2> </div> </div> </div> </div> </div> <button ng-show="!$parent.ErrorGameLinkID" class="login-btn dk" ng-click="vm.LoadGame()" type="button">GO</button> </div> '),
- $templateCache.put("app/banking/account-statement/account-statement.tpl", '<app-frame class="banking banking-statement clearfix"> <app-header data-title="\'My Bank\'" data-back-to=""></app-header> <div class="app-window"> <!-- Normal accounts --> <div ng-if="vm.Account.AccountType == \'TransactionsBankAccountInstance\' || vm.Account.AccountType == \'SavingsBankAccountInstance\'"> <div class="statement-top clearfix"> <div class="icon"><account-icon class="icon" account-type="vm.Account.AccountType"></account-icon></div> <div class="content"> <span class="title">{{vm.Account.Title}}</span> <span class="account-number">Account number: {{vm.Account.ID | limitTo:6}}</span> <span class="balance">{{vm.Account.Balance | currency}}</span> </div> <button class="btn btn-banking-general" ng-click="vm.transferClicked()">Transfer Money</button> </div> <div> <a href="" class="btn-banking-close-account" ng-click="vm.CloseAccount($event, vm.Account.ID)">Close this account</a> </div> </div> <!-- Super --> <div class="investment-super" ng-if="vm.Account.AccountType == \'SuperInvestmentInstance\' "> <div class="super-icon"><span class="icon-info"></span></div> <div class="super-content">This account shows you the superannuation you have accrued. You are unable to transfer from or close this account. </div> <div class="statement-top clearfix"> <div class="icon"><account-icon class="icon" account-type="vm.Account.AccountType"></account-icon></div> <div class="content"> <span class="title">{{vm.Account.Title}}</span> <span class="account-number">Account number: {{vm.Account.ID | limitTo:6}}</span> <span class="balance">{{vm.Account.Balance | currency}}</span> </div> </div> </div> <!-- Investment --> <div class="investment" ng-if="vm.Account.AccountType == \'FixedTermDepositInvestmentInstance\' "> <div class="statement-top clearfix"> <div class="icon"><account-icon class="icon" account-type="vm.Account.AccountType"></account-icon></div> <div class="content"> <span class="title">{{vm.Account.Title}}</span> <span class="account-number">Account number: {{vm.Account.ID | limitTo:6}}</span> <span class="balance">{{vm.Account.Balance | currency}}</span> </div> </div> <!-- Not mature --> <div class="tranfer-box" ng-if="!vm.Account.IsMature"> <span class="icon icon-banking-locked"></span> <p>You have <strong>{{vm.Account.WeeksToMaturity}} <ng-pluralize count="vm.Account.WeeksToMaturity" when="{\'1\': \'week\',\r\n\t \'other\': \'weeks\'}"> </ng-pluralize></strong> <br>until your investment matures</p> <button class="btn btn-banking-general btn-immature" ng-click="vm.transferInvestmentClicked()">WITHDRAW AND CLOSE EARLY</button> </div> <!-- Mature --> <div class="tranfer-box" ng-if="vm.Account.IsMature"> <span class="icon icon-banking-unlocked"></span> <p><strong>Your investment has matured.</strong> <br>Please withdraw and close this account.</p> <button class="btn btn-banking-general btn-mature" ng-click="vm.transferInvestmentClicked()">WITHDRAW AND CLOSE</button> </div> </div> <div ng-repeat="data in vm.Weeks"> <table class="table-statement"> <tr> <th class="th-week">Week {{data[0].Week}}</th> <th class="th-dc">Debit/<br>Credit</th> <th class="th-blance">Balance</th> </tr> <tr ng-repeat="transaction in data"> <td class="td-description">{{transaction.Description}}</td> <td class="td-type" ng-if="transaction.Money >= 0"> <span class="type">Credit</span> <span class="credit">+{{transaction.Money | currency}}</span> </td> <td class="td-type" ng-if="transaction.Money < 0"> <span class="type">Debit</span> <span class="debit">{{transaction.Money | currency}}</span> </td> <td class="td-balance"> {{transaction.Balance | currency}} </td> </tr> </table> </div> </div> </app-frame> '), $templateCache.put("app/banking/choose-account/choose-account.tpl", '<app-frame class="banking banking-select-account"> <app-header data-title="\'My Bank\'" data-back-to=""></app-header> <div class="app-window"> <div class="instruction-note"> <img src="assets/images/banking/new_account_icon.svg"> <div class="content"> <h2>New Bank Account</h2> <p>Please select the type of bank account you would like to open.</p> </div> </div> <!-- header controls --> <div class="slide-header clearfix"> <div class="left"> <button class="btn btn-slider-prev" ng-class="{\'disabled\' : vm.prevDisabled }" ng-click="vm.slickConfig.method.slickPrev()" ng-disabled="vm.prevDisabled"> <div class="icon"><span class="icon-arrow icon-flipped"></span></div> <div class="label">PREVIOUS</div> </button> </div> <div class="center">SHOWING {{vm.currentSlide}}/{{vm.totalSlides}}</div> <div class="right"> <button class="btn btn-slider-next" ng-class="{\'disabled\' : vm.nextDisabled }" ng-click="vm.slickConfig.method.slickNext()" ng-disabled="vm.nextDisabled"> <div class="icon"><span class="icon-arrow"></span></div> <div class="label">NEXT</div> </button> </div> </div> <slick class="slider" settings="vm.slickConfig"> <div class="slide" ng-repeat="option in vm.BankOptions | orderBy: \'AccountType\' : true"> <locked-account class="account-locked" ng-if="option.AccountType == \'GameSavingsBankAccount\' && !vm.hasTransactionAccount"> <div class="inner"> <span class="icon icon-banking-locked"></span> <h3>ACCOUNT LOCKED</h3> <p>You can open this account once <br>you have a transaction account.</p> </div> </locked-account> <h3><account-icon class="icon" account-type="option.AccountType"></account-icon><span class="title">{{option.Title}}</span></h3> <h4>Account Description</h4> <p>{{option.Description}}</p> <ul class="clearfix"> <li><span class="label">Account Keeping Fees*</span><span class="value">{{option.MonthlyFee}}</span></li> <li><span class="label">Transaction Fee</span><span class="value">{{option.FeePerTransaction}}</span></li> <li><span class="label">Monthly Interest rate</span><span class="value">{{option.InterestRate}}</span></li> <li><span class="label">Transfers</span> <span class="value">{{option.TransactionsPerMonth == 9999 ? \'unlimited\' : option.TransactionsPerMonth}}</span> </li> <li><span class="label">Minimum Balance</span><span class="value">{{option.MinimumBalance}}</span></li> </ul> <p class="disclaimer">*Your account keeping fees will be paid automatically</p> <button ng-disabled="option.AccountType == \'GameSavingsBankAccount\' && !vm.hasTransactionAccount" class="btn btn-investment text-center" ng-click="vm.OpenAccount(\'/app/dashboard/banking/open-account/\'+option.ID)"> OPEN THIS BANK ACCOUNT </button> </div> </slick> </div> </app-frame> '), $templateCache.put("app/banking/choose-investment/choose-investment.tpl", '<app-frame class="banking banking-select-account"> <app-header data-title="\'My Bank\'" data-back-to=""></app-header> <div class="app-window"> <div class="instruction-note"> <img src="assets/images/banking/new_account_icon.svg"> <div class="content"> <h2>New Investment</h2> <p>Please select the type of investment you would like to make.</p> </div> </div> <!-- header controls --> <div class="slide-header clearfix"> <div class="left"> <button class="btn btn-slider-prev" ng-class="{\'disabled\' : vm.prevDisabled }" ng-click="vm.slickConfig.method.slickPrev()" ng-disabled="vm.prevDisabled"> <div class="icon"><span class="icon-arrow icon-flipped"></span></div> <div class="label">PREVIOUS</div> </button> </div> <div class="center">SHOWING {{vm.currentSlide}}/{{vm.totalSlides}}</div> <div class="right"> <button class="btn btn-slider-next" ng-class="{\'disabled\' : vm.nextDisabled }" ng-click="vm.slickConfig.method.slickNext()" ng-disabled="vm.nextDisabled"> <div class="icon"><span class="icon-arrow"></span></div> <div class="label">NEXT</div> </button> </div> </div> <slick class="slider" settings="vm.slickConfig"> <div class="slide" ng-repeat="option in vm.InvestmentOptions | orderBy: \'Title\'"> <locked-account class="account-locked" ng-if="!vm.hasTransactionAccount"> <div class="inner"> <span class="icon icon-banking-locked"></span> <h3>ACCOUNT LOCKED</h3> <p>You can open this account once <br>you have a transaction account.</p> </div> </locked-account> <h3><account-icon class="icon" account-type="option.AccountType"></account-icon><span class="title">{{option.Title}}</span></h3> <h4>Account Description</h4> <p>{{option.Description}}</p> <ul class="clearfix"> <li><span class="label">Interest rate</span><span class="value">{{option.InterestRate}}%</span></li> <li><span class="label">Investment TERM</span><span class="value">{{option.DepositPeriod}} Weeks</span></li> </ul> <button ng-disabled="!vm.hasTransactionAccount" class="btn btn-investment text-center" ng-click="vm.OpenAccount(\'/app/dashboard/banking/open-investment-account/\'+option.ID)"> MAKE THIS INVESTMENT </button> </div> </slick> </div> </app-frame> '), $templateCache.put("app/banking/index/banking-index.tpl", '<app-frame class="banking banking-index"> <app-header data-title="\'My Bank\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window"> <div class="logo"> <img src="assets/images/banking/logo-banking.svg"> </div> <h2>Bank Accounts</h2> <div ng-if="vm.BankAccounts.length > 0"> <button ng-click="vm.TriggerTransition(\'/app/dashboard/banking/account-statement/\'+account.ID)" class="btn btn-banking-statement" ng-repeat="account in vm.BankAccounts | orderBy: \'Title\'"> <div class="icon"><account-icon class="icon" account-type="account.AccountType"></account-icon></div> <div class="content"> <span class="title">{{account.Title}}</span> <span class="account-number">Account number: {{account.ID | limitTo:6}}</span> <span class="balance">{{account.Balance | currency}}</span> </div> <div class="arrow"><span class="icon-arrow"></span></div> </button> </div> <button class="btn btn-banking" ng-click="vm.TriggerTransition(\'/app/dashboard/banking/choose-account\')"> <span class="icon icon-add"></span><span class="label">OPEN A NEW BANK ACCOUNT</span><div ng-show="vm.BankAccounts.length == 0" class="notification button"><span>!</span></div> </button> <h2>Investments</h2> <div ng-if="vm.InvestmentAccounts.length > 0"> <button ng-click="vm.TriggerTransition(\'/app/dashboard/banking/investment-statement/\'+account.ID)" class="btn btn-banking-statement" ng-repeat="account in vm.InvestmentAccounts | orderBy: \'Title\'"> <div class="icon"><account-icon class="icon" account-type="account.AccountType"></account-icon></div> <div class="content"> <span class="title">{{account.Title}}</span> <span class="account-number">Account number: {{account.ID | limitTo:6}}</span> <span class="balance">{{account.Balance | currency}}</span> </div> <div class="arrow"><span class="icon-arrow"></span></div> </button> </div> <button class="btn btn-investment" ng-click="vm.TriggerTransition(\'/app/dashboard/banking/choose-investment\')"><span class="icon icon-add"></span><span class="label">MAKE AN INVESTMENT</span></button> <div class="banking-notification" ng-show="vm.BankAccounts.length == 0"> <div class="notification-icon"><div class="notification block"><span>!</span></div></div> <div class="banking-notification-text">You must have a bank account before progressing to the next week.</div></div> </div> </app-frame> '), $templateCache.put("app/banking/open-account/open-account.tpl", '<app-frame class="banking banking-open-account"> <app-header data-title="\'My Bank\'" data-back-to=""></app-header> <div class="app-window"> <h2><account-icon class="icon" account-type="vm.Account.AccountType"></account-icon><span class="title">{{vm.Account.Title}}</span></h2> <div ng-if="vm.Account.MinimumBalance === 0"> <p>No Minimum amount required</p> <transfer-button ng-click="vm.OpenAccount()" class="btn btn-transfer" data-label="Open account" ng-click=""></transfer-button> </div> <div ng-if="vm.Account.MinimumBalance > 0"> <p>This account require a minimum balance of <strong>${{vm.Account.MinimumBalance}}</strong> to open. Please select where you would like this deposit to come from.</p> <h3>Deposit</h3> <dropdown list="vm.SelectModel.Options" selecteditem="vm.SelectModel.Selected" property="Title" id="1"> </dropdown> <h3>Amount</h3> <money-amount-input></money-amount-input> <transfer-button ng-click="vm.OpenAccount()" class="btn btn-transfer" data-label="Transfer and open account"></transfer-button> </div> <button class="btn btn-cancel" ng-click="vm.cancelClicked()">Cancel</button> </div> </app-frame> '), $templateCache.put("app/banking/open-investment-account/open-investment-account.tpl", '<app-frame class="banking banking-open-account"> <app-header data-title="\'My Bank\'" data-back-to=""></app-header> <div class="app-window"> <h2><account-icon class="icon" account-type="vm.Account.AccountType"></account-icon><span class="title">{{vm.Account.Title}}</span></h2> <div> <p>Please enter the amount you would like to invest in this long term depsosit.</p> <h3>Deposit</h3> <dropdown list="vm.SelectModel.Options" selecteditem="vm.SelectModel.Selected" property="Title" id="1"> </dropdown> <h3>Amount</h3> <money-amount-input></money-amount-input> <transfer-button ng-click="vm.OpenAccount()" class="btn btn-transfer" data-label="Invest"></transfer-button> </div> <button class="btn btn-cancel" ng-click="vm.cancelClicked()">Cancel</button> </div> </app-frame> '), $templateCache.put("app/cashbox/cashbox.tpl", '<app-frame class="cashbox cashbox-index"> <app-header data-title="\'My Cash\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window"> <div class="logo"> <img src="assets/images/cashbox/my-cash-pig.svg"> </div> <div class="display"> <div class="top"><img src="assets/images/cashbox/box-top.svg"></div> <div class="box"> <h2>MY CASH</h2> <span>{{vm.Cashbox.balance}}</span> </div> </div> <button class="btn btn-cashbox-transfer" ng-click="vm.transferClicked()">transfer this money</button> </div> </app-frame>'), $templateCache.put("app/components/dropdown/dropdown.tpl", '<div class="dd-bg-cover" ng-show="listVisible" ng-click="closeDropdown()"></div> <div class="dropdown-container" ng-class="{\'change-z\':listVisible}"> <div class="dropdown-display clearfix" ng-click="show();" ng-class="{\'btn-disabled-white\':selectDisabled}"> <div class="item-content"> <div ng-if="selecteditem.ID === \'0\' || selecteditem.ID === \'1\'"> <div class="account-details"> <div class="select-account">{{selecteditem.Title}}</div> </div> </div> <div ng-if="selecteditem.ID != \'0\' && selecteditem.ID != \'1\'"> <div class="account-icon"><account-icon class="icon" account-type="selecteditem.AccountType"></account-icon></div> <div class="account-details"> <div class="account-title">{{selecteditem.Title}}</div> <div class="account-number">Account number: {{selecteditem.ID | limitTo:6}}</div> <div class="balance">{{selecteditem.Balance | currency}}</div> </div> </div> </div> <div class="icon-down" ng-hide="selectDisabled"></div> </div> <div class="dropdown-list" ng-show="listVisible"> <div> <div ng-repeat="item in list" ng-click="select(item)" class="list-item clearfix" ng-class="{ selecteditem: isselecteditem(item) }"> <div class="item-content" ng-if="item.ID === \'0\'"> <div class="account-details"> <div class="select-account">{{item.Title}}</div> </div> </div> <div class="item-content" ng-if="item.ID != \'0\'"> <div class="account-icon"><account-icon class="icon" account-type="item.AccountType"></account-icon></div> <div class="account-details"> <div class="account-title">{{item.Title}}</div> <div class="account-number">Account number: {{item.ID | limitTo:6}}</div> <div class="balance">{{item.Balance | currency}}</div> </div> </div> </div> </div> </div> </div> '), $templateCache.put("app/creditcards/card-statement/card-statement.tpl", '<app-frame class="credit-card credit-card-statement"> <app-header data-title="\'My Credit\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window" ng-show="vm.ShowApp"> <credit-card-image class="credit-card-image" card-name="vm.CardAccount.Title"></credit-card-image> <div class="statement-top clearfix"> <h2>Credit Card Statement</h2> <ul> <li>Credit card limit: <span>{{ vm.CardAccount.Limit | currency: \'$\' : 2}}</span></li> <li>Amount of credit available: <span>{{ vm.CardAccount.CreditAvailable | currency: \'$\' : 2}}</span></li> <li>Closing balance <span ng-class="{\'closing-balance\':vm.CardAccount.ClosingBalance < 0}">{{ vm.CardAccount.ClosingBalance | currency: \'$\' : 2}}</span></li> <li class="min-repay">Minimum repayment: <span>{{ vm.CardAccount.MinRepayAmount | currency: \'$\' : 2}}</span></li> </ul> <button class="btn btn-banking-general" ng-click="vm.makePayment()">Pay Credit Card</button> </div> <div ng-repeat="data in vm.Weeks"> <table class="table-statement"> <tr> <th class="th-week">Week {{data[0].Week}}</th> <th class="th-dc">Debit/<br>Credit</th> </tr> <tr ng-repeat="transaction in data"> <td class="td-description">{{transaction.Description}}</td> <td class="td-type" ng-if="transaction.Money >= 0"> <span class="type">Credit</span> <span class="credit">+{{transaction.Money | currency}}</span> </td> <td class="td-type" ng-if="transaction.Money < 0"> <span class="type">Debit</span> <span class="debit">{{transaction.Money | currency}}</span> </td> </tr> </table> </div> </div> </app-frame> '), $templateCache.put("app/creditcards/select-card/select-card.tpl", '<app-frame class="credit-card credit-card-select"> <app-header data-title="\'My Credit\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window"> <div class="instruction-note"> <img src="assets/images/creditcards/new_credit_card_icon.svg"> <div class="content"> <h2>Select a credit card</h2> <p>You can only select one card, so make your selection count. </p> </div> </div> <!-- header controls --> <div class="slide-header clearfix"> <div class="left"> <button class="btn btn-slider-prev" ng-class="{\'disabled\' : vm.prevDisabled }" ng-click="vm.slickConfig.method.slickPrev()" ng-disabled="vm.prevDisabled"> <div class="icon"><span class="icon-arrow icon-flipped"></span></div> <div class="label">PREVIOUS</div> </button> </div> <div class="center">SHOWING {{vm.currentSlide}}/{{vm.totalSlides}}</div> <div class="right"> <button class="btn btn-slider-next" ng-class="{\'disabled\' : vm.nextDisabled }" ng-click="vm.slickConfig.method.slickNext()" ng-disabled="vm.nextDisabled"> <div class="icon"><span class="icon-arrow"></span></div> <div class="label">NEXT</div> </button> </div> </div> <slick class="slider" settings="vm.slickConfig"> <div class="slide" ng-repeat="option in vm.CreditCardOptions | orderBy: \'Title\'"> <credit-card-image class="credit-card-image" card-name="option.Title"></credit-card-image> <h3>{{option.Title}}</h3> <ul> <li>Annual Fee: {{option.Cost| currency: \'$\': 0}}</li> <li>Credit Limit: {{option.Limit | currency: \'$\': 0}}</li> <li>Interest: {{option.InterestRate *100}}%</li> </ul> <h4>Select a bank account to pay the annual fee:</h4> <dropdown list="vm.BankOptions" selecteditem="vm.BankOptionModel[option.ID].SelectedOption" property="ID" id="1"> </dropdown> <transfer-button ng-click="vm.BuyCard(option)" class="btn btn-transfer" data-label="APPLY FOR THIS CREDIT CARD"></transfer-button> </div> </slick> </div> </app-frame> '), $templateCache.put("app/dashboard/dashboard-desktop.view.tpl", '<div class="dashboard-desktop"> <div class="apps clearfix"> <div class="app" ng-repeat="app in vm.GameApplications | orderBy: \'priority\'"> <dashboard-app-btn app-data="app"></dashboard-app-btn> </div> </div> </div>'), $templateCache.put("app/dashboard/dashboard.view.tpl", '<app-frame class="dashboard"> <div class="header clearfix"> <div class="week">Week {{vm.CurrentWeek}}</div> <div class="progress-bar"><div class="bar" ng-style="vm.barWidth"></div></div> <div class="vertical-line"></div> <a href="" ng-click="vm.FinishWeekClicked()">Finish the week <span class="icon-arrow-right"></span> </a> </div> <div class="summary clearfix"> <div class="owl"><img src="assets/images/where-im-at/owl.svg"></div> <div class="position-content"> <h2>MY NET POSITION</h2> <div class="">{{vm.NetWorth | currency : \'$\': 0}}</div> </div> <div class="btn-where" ng-click="vm.whereImAtClicked(\'/app/dashboard/where-im-at\')"> <div class="label">Where <br>I\'m at</div> <div class="icon"><span class="icon-arrow"></span></div> </div> </div> <div class="apps clearfix"> <div class="app" ng-repeat="app in vm.GameApplications | orderBy: \'mobilePriority\' | limitTo : vm.GameApplications.length : 3"> <dashboard-app-btn app-data="app"></dashboard-app-btn> </div> </div> <div class="bottom-apps"> <div class="apps clearfix"> <div class="app" ng-repeat="app in vm.GameApplications | orderBy: \'mobilePriority\' | limitTo : 3 : 0"> <dashboard-app-btn app-data="app"></dashboard-app-btn> </div> </div> </div> <div class="footer"><a ng-click="main.Logout();">Save and log out</a> <a href="" ng-click="main.Help()">Help</a> <a href="" ng-click="main.Faqs()">FAQs</a></div> </app-frame> '), $templateCache.put("app/emails/inbox/inbox.view.tpl", '<app-frame class="email email-inbox"> <app-header data-title="\'Email\'" data-back-to="\'dashboard\'"></app-header> <div class="app-overlay" ng-if="vm.appIsDisabled"> <email-virus class="email-virus"></email-virus> </div> <div class="app-window clearfix" ng-if="!vm.appIsDisabled"> <div class="menu-bg"> <img src="assets/images/email/email-strip.svg"> </div> <div class="menu"> <button class="btn-email-menu" ng-class="{selected: vm.Butttons[0]}" ng-click="vm.ShowMessageList(0);"> <div class="notification" ng-if="vm.Messages.notifications > 0">{{vm.Messages.notifications}}</div> <div class="icon"><span class="icon-email-inbox"></span></div> Messages </button> <button class="btn-email-menu" ng-class="{selected: vm.Butttons[1]}" ng-click="vm.ShowMessageList(1);"> <div class="notification" ng-if="vm.Bills.notifications > 0">{{vm.Bills.notifications}}</div> <div class="icon"><span class="icon-email-billing"></span></div> Bills</button> <button class="btn-email-menu" ng-class="{selected: vm.Butttons[2]}" ng-click="vm.ShowMessageList(2);"> <div class="notification" ng-if="vm.Bank.notifications > 0">{{vm.Bank.notifications}}</div> <div class="icon"><span class="icon-email-bank"></span></div> My Bank</button> </div> <email-list class="email-list"> <div class="no-mail" ng-if="vm.MessageList == 0" class="disabled"> <img src="assets/images/email/no-email.svg"><br> No messages in<br>this folder </div> <ul> <li ng-repeat="email in vm.MessageList | orderBy : \'-Week\'" class="email-list-animate" ng-click="vm.viewEmail(email.ID)"> <div class="list-padding"> <div class="notice" ng-class="email.Tag" ng-if="email.Tag != undefined && email.Tag != \'\' ">{{email.Tag}}</div> <div class="arrow"><span class="icon-arrow"></span></div> <div class="week">Week {{email.Week}}</div> <div class="title" ng-class="{\'is-read\': email.IsRead}">{{email.From}}</div> <div class="subject">{{email.Subject}}</div> </div> </li> </ul> </email-list> </div> </app-frame> '), $templateCache.put("app/emails/mail/email-bill.tpl", '<div class="email-bill" ng-class="vm.Mail.EmailTemplateClass"> <div ng-if="vm.Mail.Tag == \'\' || vm.Mail.Tag == \'Paid\' || vm.Mail.Tag == \'Expired\'"> <div class="email-body"> <p>Hello {{vm.Mail.Username}},</p> <p>Please find your bill below:</p> </div> </div> <div ng-if="vm.Mail.Tag == \'Overdue\' || vm.Mail.Tag == \'Collected\'"> <div class="email-body"> <p>Hello {{vm.Mail.Username}},</p> <p>You have missed the payment date and your bill is now overdue. Failure to pay this bill this week will result in an automatic deduction being made from your account.</p> <p>Please find your bill below:</p> </div> </div> <div ng-if="vm.Mail.Tag == \'Expired\'" class="expired clearfix"> <div class="expired-icon"> <span class="icon icon-email-expired"></span> </div> <div class="content"> <strong>EXPIRED</strong><br>This bill was not paid on time. It has now expired. A updated bill has been sent. </div> </div> <div> <div class="header"> <img src="{{vm.Mail.EmailTemplateImage}}"> </div> <div class="summary"> <div class="notice-box" ng-if="vm.Mail.Tag == \'\' || vm.Mail.Tag == \'Expired\'"> <div class="txt1">Date due</div> <div class="txt3">Week</div> <div class="txt4">{{vm.Mail.WeekDue}}</div> </div> <div class="notice-box notice-box-paid" ng-if="vm.Mail.Tag == \'Paid\'"> <span class="icon icon-paid"></span><br> <span class="txt2">Paid</span> </div> <div class="notice-box notice-box-overdue" ng-if="vm.Mail.Tag == \'Overdue\'"> <span class="icon icon-email-expired"></span><br> Overdue </div> <div class="notice-box notice-box-debt-collected" ng-if="vm.Mail.Tag == \'Collected\'"> <span class="icon icon-debt-collected"></span><br> Debt Collected </div> <h2>Bill Summary</h2> <h3>BILL TO</h3> <span class="summary-value">{{vm.Mail.Username}}</span> <h3>BILLING PERIOD</h3> <span class="summary-value" ng-if="vm.Mail.OpeningWeek == vm.Mail.ClosingWeek">WEEK {{vm.Mail.OpeningWeek}}</span> <span class="summary-value" ng-if="vm.Mail.OpeningWeek != vm.Mail.ClosingWeek">WEEK {{vm.Mail.OpeningWeek}} - {{vm.Mail.ClosingWeek}}</span> <h3 class="description">DESCRIPTION</h3> <span ng-bind-html="vm.Mail.Content"></span> <div ng-if="vm.Mail.Fees.length > 0"> <h3>LATE PAYMENT FEES</h3> <div class="underline clearfix"> <span>Original bill</span><span class="fees">{{vm.Mail.OriginalAmount | currency}}</span> </div> <div class="underline clearfix"> <span>Late payment fee</span><span class="fees">{{vm.Mail.LateFees | currency}}</span> </div> </div> <h3>TOTAL AMOUNT DUE</h3> <span class="total-amount" ng-class="{\'overdue\': vm.Mail.Fees.length > 0 }">{{vm.Mail.Amount | currency}}</span> </div> <button class="btn-email-pay-bill" ng-click="vm.payBill()" ng-if="vm.Mail.Tag === \'\' || vm.Mail.Tag === \'Overdue\' ">Pay this bill</button> </div> </div> '), $templateCache.put("app/emails/mail/email-credit-card-statement.tpl", '<div class="email-credit-card-statement"> <span class="email-body" ng-bind-html="vm.Mail.Content"></span> <h2>Credit Card Statement</h2> <div class="summary"> <credit-card-image class="credit-card-image" card-name="vm.Mail.Title"></credit-card-image> <div class="underline"> <span>Account number</span><span class="pull-right">{{vm.Mail.CreditCardInstanceID | limitTo:8}}</span> </div> <div class="underline"> <span>Statement period</span><span class="pull-right">Week {{vm.Mail.OpeningWeek}} - Week {{vm.Mail.ClosingWeek}}</span> </div> <div class="underline-dotted"> <span>Credit limit</span><span class="pull-right">{{vm.Mail.Limit | currency}}</span> </div> <div class="underline"> <span>Available Credit</span><span class="pull-right">{{vm.Mail.CreditAvailable | currency}}</span> </div> <div class="closing-balance"> <span><strong>Closing balance</strong></span><span class="pull-right"><strong>{{vm.Mail.ClosingBalance | currency}}</strong></span> </div> <div class="late-fee" ng-if="vm.Mail.FeeApplied > 0"> <span><strong>Late payment fee</strong></span><span class="pull-right"><strong>-{{vm.Mail.FeeApplied | currency}}</strong></span> </div> <div class="underline"> <span>Monthly interest applied</span><span class="pull-right">{{vm.Mail.InterestApplied | currency}}</span> </div> <div class="no-underline"> <span><strong>Minimum repayment amount</strong></span><span class="pull-right"><strong>{{vm.Mail.MinimumRepayment | currency}}</strong></span> </div> <div class=""> <span><strong>Due week</strong></span><span class="pull-right"><strong>Week {{vm.Mail.DueWeek}}</strong></span> </div> <i>For more details please see your My Credit app.</i> </div> </div> '), $templateCache.put("app/emails/mail/email-debt-collector.tpl", '<div class="email-debt-collector" ng-class="vm.Mail.EmailTemplateClass"> <div> <span class="email-body" ng-bind-html="vm.Mail.Content"></span> </div> <div class="header"> <img ng-src="{{vm.Mail.EmailTemplateImage}}"> </div> <div class="summary"> <div class="underline"> <h2>Overdue {{vm.Mail.Company}} bill </h2> </div> <h3>DEBT COLLECTED</h3> <span class="total-amount">{{vm.Mail.AmountDue | currency}}</span> </div> </div> '), $templateCache.put("app/emails/mail/email-pay-slip.tpl", '<div class="email-pay-slip"> <span class="email-body" ng-bind-html="vm.Mail.Content"></span> <div class="pay-slip"> <div class="header"> <h2>{{vm.Mail.From | uppercase}}</h2> ABN 48 123 111 444 </div> <div class="summary"> <div class="label">NAME</div> <div class="value">{{vm.Mail.Username}}</div> <div class="label">OCCUPATION</div> <div class="value">{{vm.Mail.Occupation}}</div> <div class="label">PAY PERIOD</div> <div class="value" ng-show="vm.Mail.OpeningWeek != vm.Mail.ClosingWeek">Week {{vm.Mail.OpeningWeek}} - Week {{vm.Mail.ClosingWeek}}</div> <div class="value" ng-show="vm.Mail.OpeningWeek == vm.Mail.ClosingWeek">Week {{vm.Mail.OpeningWeek}}</div> <div class="pay"> <div class="dotted-line clearfix"> <div class="pull-left">Gross pay</div> <div class="pull-right">{{vm.Mail.GrossAmount | currency}}</div> </div> <div class="dotted-line clearfix"> <div class="pull-left">Superannuation</div> <div class="pull-right">{{vm.Mail.SuperannuationAmount | currency}}</div> </div> <div class="solid-line clearfix"> <div class="pull-left">Less Tax</div> <div class="pull-right">{{vm.Mail.TaxAmount | currency}}</div> </div> <div class="net-pay clearfix"> <div class="pull-left">Net Pay</div> <div class="pull-right"><strong>{{vm.Mail.NetAmount | currency}}</strong></div> </div> </div> </div> </div> </div> '), $templateCache.put("app/emails/mail/email.tpl", '<div class="email-body" ng-bind-html="vm.Mail.Content"> </div> '), $templateCache.put("app/emails/mail/mail.view.tpl", '<app-frame class="email email-view"> <app-header data-title="\'Email\'" data-back-to="vm.backTo"></app-header> <div class="app-window"> <div class="field"> <div class="from-label">From:</div> {{vm.Mail.From}} </div> <div class="field clearfix"> <div class="subject-label">Subject:</div> <div class="subject-content">{{vm.Mail.Subject}} <div class="week">WEEK {{vm.Mail.Week}}</div> </div> </div> <div class="content"> <div ng-include="vm.emailTemplate"></div> <div class="action" ng-if="vm.Mail.IsActionable && !vm.Mail.Actioned && !vm.Mail.Cancelled"> <transfer-button ng-click="vm.acceptEmail()" class="btn btn-bills-pay" data-label="ACCEPT THIS OFFER"></transfer-button> </div> <div class="actioned" ng-if="vm.Mail.Actioned && !vm.Mail.Cancelled && vm.Mail.CommunicationType != \'BillEmailInstance\'"> <div class="wrapper"> <div class="icon icon-left-arrow"></div> <div class="label" ng-if="vm.Mail.Accepted">You accepted this offer</div> <div class="label" ng-if="!vm.Mail.Accepted">You declined this offer</div> </div> </div> </div> <div class="actioned" ng-if="vm.Mail.Cancelled && vm.Mail.CommunicationType != \'EmploymentSubmissionEmailInstance\'"> <div class="wrapper"> <div class="icon icon-left-arrow"></div> <div class="label">This offer has been cancelled.</div> </div> </div> </div> <button class="btn-email-delete" ng-click="vm.deleteEmail()">Delete this email</button> </app-frame> '), $templateCache.put("app/emails/pay-bill/pay-bill.view.tpl", '<app-frame class="email email-pay-bill"> <app-header data-title="\'Email\'" data-back-to=""></app-header> <div class="app-window"> <div class="email-bill content" ng-class="vm.Mail.EmailTemplateClass"> <h2>Pay Bill</h2> <div class="header"> <img ng-src="{{vm.Mail.EmailTemplateImage}}"> </div> <div class="summary"> <h3>TOTAL AMOUNT DUE</h3> <span class="total-amount">{{vm.Mail.Amount | currency}}</span> </div> <h3>From :</h3> <dropdown list="vm.FromAccountOptions" selecteditem="vm.FromAccountModel.Selected" property="ID" id="1"> </dropdown> <div class="regular-bill" ng-if="vm.Mail.IsRecurring"> <p>This is a regular bill. Would you like to setup an automatic payment from this account for this bill?</p> <label><input type="radio" value="1" ng-model="vm.AutoPay"> Yes</label> <label><input type="radio" value="0" ng-model="vm.AutoPay"> No</label> </div> <transfer-button ng-click="vm.PayBill()" class="btn btn-bills-pay" data-label="PAY"></transfer-button> <button class="btn-email-delete" ng-click="vm.Cancel()">Cancel</button> </div> </div> </app-frame>'), $templateCache.put("app/end-of-game/end-balance-sheet/end-balance-sheet.view.tpl", '<div class="end-of-game balance-sheet"> <div class="content"> <div class="header"> <div>{{vm.UserName}}</div> <h1>Final Balance Sheet</h1> </div> <div class="breakdown"> <div class="mobile"> <h3>CREDITS</h3> <div class="assets"> <div class="breakdown-container clearfix" ng-repeat="item in vm.AssetsBreakdown" ng-class="{\'liabilities\' : item.Balance < 0 }"> <div class="title"> <span class="icon" ng-class="item.Icon"></span>{{item.Title}} </div> <div class="credit">{{item.Balance | currency: \'$\' : 2 }}</div> </div> </div> <h3>DEBITS</h3> <div class="liabilities"> <div class="breakdown-container clearfix" ng-repeat="item in vm.LiabilitiesBreakdown"> <div class="title"> <span class="icon" ng-class="item.Icon"></span>{{item.Title}} </div> <div class="debit">{{item.Balance | currency: \'$\' : 2 }}</div> </div> </div> </div> <table class="desktop"> <tr> <td></td> <td class="top-row">CREDITS</td> <td class="top-row">DEBITS</td> </tr> <tr ng-repeat="item in vm.AssetsBreakdown"> <td class="title"><span class="icon" ng-class="item.Icon"></span>{{item.Title}}</td> <td class="credit">{{item.Balance | currency: \'$\' : 2 }}</td> <td></td> </tr> <tr ng-repeat="item in vm.LiabilitiesBreakdown"> <td class="title"><span class="icon" ng-class="item.Icon"></span>{{item.Title}}</td> <td></td> <td class="debit">{{item.Balance | currency: \'$\' : 2 }}</td> </tr> </table> </div> <div class="footer"> <h3>{{ vm.NetPositionTitle }}</h3> <div class="net-position">{{vm.NetPosition | currency: \'$\' : 0}}</div> <div class="mentor"><img ng-src="{{vm.howl}}"></div> </div> <div class="exit-link"> <a href="" ng-click="vm.ExitGame()">EXIT TO GAME SELECTION</a> </div> </div> </div>'),
- $templateCache.put("app/end-of-game/fireworks/end-fireworks.view.tpl", '<div class="end-of-game fireworks"> <div class="over-canvas"> <h1>Congratulations!</h1> <h2>You\'ve completed {{vm.GameName}}</h2> <button class="btn btn-start-eow-questions" ng-click="vm.ViewBalanceSheet()">VIEW MY FINAL BALANCE SHEET</button> <p ng-show="vm.GameHasSurvey" class="certificate-link"><a ng-click="vm.GetCertificate();" href="">DOWNLOAD MY CERTIFICATE</a></p> </div> <fireworks-canvas></fireworks-canvas> </div>'), $templateCache.put("app/end-of-week/end-of-week.view.tpl", '<div class="end-of-week"> <ui-view class="fade-between"></ui-view> </div>'), $templateCache.put("app/end-of-week/end/end-of-week-end.view.tpl", '<div class="screen-end"> <div class="current-week" ng-class="{\'is-question\':vm.IsQuestion}"> <div class="week-title">Week {{vm.currentWeek}} Complete</div> <div class="underline"></div> </div> <div class="question-intro" ng-class="{\'is-question\':vm.IsQuestion}"> <div class="inner" ng-class="{\'is-question\':vm.IsQuestion}"> <div class="content-box"> <div class="title">Bonus Question</div> <p>Answer the bonus question correctly for your chance to win some extra cash!</p> </div> <div class="bit"><img src="assets/images/mentor/bubble-bit.svg"></div> <div class="mentor"><img src="assets/images/mentor/howl1.svg"></div> </div> </div> <button class="btn btn-start-eow-questions" ng-class="{\'is-question\':vm.IsQuestion}" ng-click="vm.BonusQuestion()">Lets do it!</button> </div>'), $templateCache.put("app/end-of-week/question/end-of-week-question.view.tpl", '<div class="screen-question"> <div class="question-container"> <div class="timer"> <div class="clock"><img src="assets/images/end-of-week/time-icon.svg"></div> <div class="time">{{vm.Time}}</div> </div> <h1>Week {{vm.currentWeek}}</h1> <h2>END OF WEEK BONUS QUESTION</h2> <div class="underline"></div> <div> <p>{{vm.Question.Text}}</p> <ul> <li ng-repeat="Answers in vm.Question.Answers" ng-click="vm.AnswerClicked($index)" ng-class="[Answers.Selected, vm.DisableAnswersClass]"> <div class="circle"></div><span class="icon-success"></span><span class="icon-incorrect"></span><span class="answer-text">{{Answers.Text}}</span></li> </ul> <button class="btn btn-eow-submit" ng-click="vm.SubmitAnswer()" ng-class="{\'disabled\': vm.Selection == -1 }">SUBMIT</button> <button class="btn btn-eow-skip" ng-click="vm.SkipAnswer()">SKIP</button> </div> </div> </div>'), $templateCache.put("app/end-of-week/question/feedback-correct.view.tpl", '<div class="screen-question"> <div class="question-container"> <div class="timer"> <div class="clock"><img src="assets/images/end-of-week/time-icon.svg"></div> <div class="time">{{vm.Time}}</div> </div> <h1>Week {{vm.currentWeek}}</h1> <h2>END OF WEEK BONUS QUESTION</h2> <div class="underline"></div> <div class="correct-screen"> <div class="symbol"><span class="icon-success"></span></div> <div class="label">CORRECT</div> <div class="row clearfix"> <div class="left">CASH REWARD</div> <div class="right">{{vm.CashReward | currency : $ : 2}}</div> </div> <div class="row clearfix"> <div class="left">TIME BONUS</div> <div class="right">{{vm.TimeBonus | currency : $ : 2}}</div> </div> <div class="total clearfix"> <div class="left">TOTAL</div> <div class="right">{{ vm.CashReward + vm.TimeBonus | currency : $ : 2 }}</div> </div> <p>Money added to \'My Cash\'</p> <button class="btn btn-eow-submit" ng-click="vm.Continue()">CONTINUE</button> </div> </div> </div> '), $templateCache.put("app/end-of-week/question/feedback-incorrect.view.tpl", '<div class="screen-question"> <div class="question-container"> <div class="timer"> <div class="clock"><img src="assets/images/end-of-week/time-icon.svg"></div> <div class="time">{{vm.Time}}</div> </div> <h1>Week {{vm.currentWeek}}</h1> <h2>END OF WEEK BONUS QUESTION</h2> <div class="underline"></div> <div class="incorrect-screen"> <div class="symbol"><span class="icon-incorrect"></span></div> <div class="label">{{vm.Time > 0 ? \'INCORRECT\' : \'OUT OF TIME\'}}</div> <div class="incorrect-txt">NO BONUS<br>CASH THIS TIME</div> <button class="btn btn-eow-submit" ng-click="vm.Continue()">CONTINUE</button> </div> </div> </div>'), $templateCache.put("app/end-of-week/start/end-of-week-start.view.tpl", '<div class="screen-start"> <div class="current-week" ng-class="{\'is-question\':vm.IsQuestion}" ng-show="vm.CallBackSuccess"> <div class="week-title">Week {{vm.currentWeek}}</div> <div class="underline"></div> </div> </div>'), $templateCache.put("app/end-of-week/summary/end-of-week-summary.view.tpl", '<div class="screen-summary"> <div class="summary-container" ng-class="{\'is-question\':vm.IsQuestion}"> <div class="week-title">Week {{vm.currentWeek}} Summary</div> <div class="bar-container"> <div class="bar-display previous"> <div class="label"> PREVIOUS WEEKโS NET POSITION</div> <div class="amount">{{ vm.Summary.StartingNetPosition | currency}}</div> </div> <div class="bar-display finishing"> <div class="label">FINISHING NET POSITION</div> <div class="amount"><span class="icon-down" ng-class="vm.ChangeIndicator(vm.Summary.Difference)"></span> {{ vm.Summary.FinishingNetPosition | currency}}</div> </div> <div class="bar-display difference"> <div class="label" ng-class="vm.TextColor">DIFFERENCE</div> <div class="amount">{{ vm.Summary.Difference | currency}}</div> </div> <button class="btn btn-eow-start-nextweek" ng-click="vm.StartWeek()">{{vm.ContinueBtnText}}</button> <button class="btn btn-eow-save" ng-click="main.Logout()">SAVE AND LOG OUT</button> </div> <div class="mentor"><img ng-src="{{vm.howl}}"></div> </div> </div> '), $templateCache.put("app/finance-weekly/finance-weekly-archive/finance-weekly-archive.tpl", '<app-frame class="finance-weekly finance-weekly-archive"> <app-header data-title="\'Finance Weekly\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <h2>Article Archive</h2> <ul> <li ng-repeat="article in vm.Articles | orderBy: \'-Week\'" ng-click="vm.ArticleClicked(article)"> <div class="article-block"> <div class="week">WEEK {{article.Week}}</div> <div class="title">{{article.Title}}</div> <span class="icon-arrow"></span> </div> </li> </ul> <div class="no-archives" ng-if="vm.Articles.length == 0"> No Articles<br>Archived </div> <div class="back-btn"> <button class="btn btn-finance-weekly-submit" ng-click="vm.BackClicked()">Back</button> </div> </div> </app-frame> '), $templateCache.put("app/finance-weekly/finance-weekly-article/finance-weekly-article.tpl", '<app-frame class="finance-weekly finance-weekly-home"> <app-header data-title="\'Finance Weekly\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <article> <div class="article-img" ng-class="vm.Article.Header.Class"> <img ng-src="{{vm.Article.Header.Image}}"> </div> <h2>{{vm.Article.Title}}</h2> <p bind-html-compile="vm.Article.Content"></p> <button class="btn btn-finance-weekly-submit" ng-click="vm.BackClicked()">Back</button> </article> </div> </app-frame> '), $templateCache.put("app/finance-weekly/finance-weekly-home/finance-weekly-home.tpl", '<app-frame class="finance-weekly finance-weekly-home"> <app-header data-title="\'Finance Weekly\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window clearfix"> <div class="logo-container"> <img src="assets/images/finance-weekly/finance-weekly-logo.svg"> </div> <article> <div class="article-img" ng-class="vm.Article.Header.Class"> <img ng-src="{{vm.Article.Header.Image}}"> </div> <h2>{{vm.Article.Title}}</h2> <p>{{vm.Article.PreviewText}}</p> <button class="btn btn-finance-weekly-dark" ng-click="vm.ArticleClicked()">Read full article</button> </article> <div class="quiz"> <div class="quiz-intro-offset"> <div class="quiz-intro" ng-hide="vm.QuizComplete"> <div class="intro">Was this article helpful to you? <br>Take a short quiz and earn bonus money!</div> <div class="bit"></div> </div> </div> <div class="clipboard" ng-class="{\'complete\' : vm.QuizComplete}"> <div class="clip"><img src="assets/images/finance-weekly/clip.svg"></div> <div class="paper"> <div class="quiz-icon"> <div class="notification" ng-hide="vm.QuizComplete">1</div> <span class="icon-pencil" ng-hide="vm.QuizComplete"></span> <span class="icon-tick-thin" ng-show="vm.QuizComplete"></span> </div> <div class="quiz-title"> <div class="week">WEEK {{vm.Article.Week}}</div> <div class="title" ng-hide="vm.QuizComplete">{{vm.Article.QuizTitle}}</div> <div class="title" ng-show="vm.QuizComplete">Quiz Complete</div> </div> <button class="btn btn-finance-weekly-light" ng-click="vm.QuizClicked()" ng-hide="vm.QuizComplete">Take the quiz</button> </div> </div> </div> <div class="archives"> <a href="" ng-click="vm.ArchiveClicked()">Article archive</a> </div> </div> </app-frame> '), $templateCache.put("app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-fill-gap.tpl", '<div class="finance-weekly-fill-gap" ng-style="vm.PageOffset"> <div class="word-popup" ng-show="vm.WordPopup"> <div class="overlay"></div> <div class="content word-popup-content" ng-style="vm.WordPopupOffset"> <div class="close" ng-click="vm.CloseClicked()"><span class="icon-quiz-cross"></span></div> <p>Select the correct word or phrase to fill the gaps</p> <ul> <li ng-repeat=" answer in $parent.vm.Quiz.CurrentQuestion.AnswerOptions" class="clearfix"> <a href="" ng-click="vm.AnswerClicked(answer)" class="answer-text" ng-class="{\'word-used\' : answer.WordUsed}">{{answer.Text}}</a><a href="" class="cancel" ng-click="vm.AnswerCleared(answer)" ng-show="answer.WordUsed"><span class="icon-quiz-cross"></span></a> </li> </ul> </div> </div> <h4>Tap or click the gaps below to select the missing word</h4> <p bind-html-compile="vm.QuestionTxt"></p> <button class="btn btn-finance-weekly-submit" ng-click="vm.SubmitClicked()" ng-class="{\'disabled\' : vm.SubmitDisabled}">{{vm.ButtonText}}</button> </div> '), $templateCache.put("app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-multiple-choice.tpl", '<div class="finance-weekly-multiple-choice"> <h4>Question {{$parent.vm.Quiz.CurrentQuestionIndex+1}}</h4> <p ng-bind-html="$parent.vm.Quiz.CurrentQuestion.Text"></p> <h4 ng-if="!vm.HasSubmitted">Answer</h4> <h4 ng-if="vm.HasSubmitted" ng-bind-html="vm.OverAllResult"></h4> <ul> <li ng-repeat=" answer in $parent.vm.Quiz.CurrentQuestion.AnswerOptions" ng-click="vm.AnswerClicked($index, answer.ID, answer.Index)" ng-class="answer.Classes"> <div class="circle-indicator"><div class="inner"></div></div> <div class="tick"><span class="icon-quiz-tick"></span></div> <div class="cross"><span class="icon-quiz-cross"></span></div> <div class="answer-text">{{answer.Text}}</div> </li> </ul> <button class="btn btn-finance-weekly-submit" ng-click="vm.SubmitClicked()" ng-class="{\'disabled\' : vm.SubmitDisabled}">{{vm.ButtonText}}</button> </div> '), $templateCache.put("app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-summary.tpl", '<div class="finance-weekly-quiz-summary"> <div class="clipboard" ng-class="{\'complete\' : vm.QuizComplete}"> <div class="clip"><img src="assets/images/finance-weekly/clip.svg"></div> <div class="paper"> <h4>Quiz Summary</h4> <div class="bar"></div> <div class="values">{{vm.NumCorrect}}/{{vm.TotalQuestions}}</div> <div class="text">Correct</div> <div class="values">{{ vm.Money | currency : \'$\': 0}}</div> <div class="text">Has been added to <br>your โMy Cashโ</div> </div> </div> <button class="btn btn-finance-weekly-submit" ng-click="vm.FinishClicked()">Finish</button> </div> '), $templateCache.put("app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz.tpl", '<app-frame class="finance-weekly finance-weekly-quiz" ng-class="{\'summary-bg\' : !vm.showQuizEndBtn}"> <app-header data-title="\'Finance Weekly\'" data-back-to="\'quiz\'"></app-header> <div class="app-window clearfix"> <div class="quiz-header clearfix"> <h2>Week {{vm.Week}} - {{vm.QuizTypes[vm.Quiz.CurrentQuestion.QuestionType]}}</h2> <h3>{{vm.Quiz.Title}}</h3> <div class="progress-indicator" ng-if="vm.Quiz.CurrentQuestion.QuestionType == 0 || vm.Quiz.CurrentQuestion.QuestionType == 1"> <ul> <li ng-repeat="item in vm.Quiz.Questions"><div class="bar" ng-if="$index >0"></div><div class="circle" ng-class="{\'complete\': $index <= vm.Quiz.CurrentQuestionIndex }"></div></li> </ul> </div> </div> <ui-view></ui-view> <div class="quiz-footer" ng-show="vm.showQuizEndBtn"> <a href="" class="btn-end-quiz" ng-click="vm.EndQuiz()">End quiz</a> </div> </div> </app-frame> '), $templateCache.put("app/financial/pay-credit/pay-credit.tpl", '<app-frame class="financial-transfers credit-card credit-card-payment"> <app-header data-title="\'My Credit\'" data-back-to=""></app-header> <div class="app-window"> <credit-card-image class="credit-card-image" card-name="vm.ToAccountModel.selected.Title"></credit-card-image> <h2>Pay Credit Card</h2> <div class="payment-top clearfix"> <ul> <li>Minimum repayment: <span>{{ vm.ToAccountModel.selected.MinRepayAmount | currency: \'$\' : 2}}</span></li> <li>Closing balance <span>{{ vm.ToAccountModel.selected.ClosingBalance | currency: \'$\' : 2}}</span></li> </ul> </div> <h3>From :</h3> <dropdown list="vm.FromAccountOptions" selecteditem="vm.FromAccountModel.selected" property="ID" id="1"> </dropdown> <h3>Amount :</h3> <money-amount-input></money-amount-input> <div ng-controller="TransferController as vm"> <transfer-button ng-click="vm.TransferFunds()" class="btn btn-transfer" data-label="TRANSFER"></transfer-button> </div> <a href="" class="btn-cancel" ng-click="vm.cancelClicked()">Cancel</a> </div> </app-frame> '), $templateCache.put("app/financial/transfers/transfer-money.tpl", '<app-frame class="financial-transfers" ng-class="vm.AppBranding.Css"> <app-header data-title="vm.AppBranding.HeaderTitle" data-back-to=""></app-header> <div class="app-window"> <h2>{{vm.AppBranding.Title}}</h2> <h3>From :</h3> <dropdown list="vm.FromAccountOptions" selecteditem="vm.FromAccountModel.selected" property="ID" id="1"> </dropdown> <h3>To :</h3> <dropdown list="vm.ToAccountOptions" selecteditem="vm.ToAccountModel.selected" property="ID" id="2"> </dropdown> <div ng-show="vm.AppBranding.ShowAmount"> <h3>Amount :</h3> <money-amount-input></money-amount-input> </div> <div ng-controller="TransferController as vm"> <transfer-button ng-click="vm.TransferFunds()" class="btn btn-transfer" data-label="{{vm.parentVm.vm.AppBranding.ButtonLabel}}"></transfer-button> </div> <a href="" class="btn-cancel" ng-click="vm.cancelClicked()">Cancel</a> </div> </app-frame> '), $templateCache.put("app/ibuy/ibuy-list/ibuy-list.tpl", '<app-frame class="ibuy ibuy-list"> <app-header data-title="\'iBuy\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window clearfix"> <div class="logo-container"> <img class="logo" src="assets/images/ibuy/ibuy-logo.svg"> <div class="clearfix"> <div class="btn-buy" ng-class="{\'active\':vm.ShowBuy}" ng-click="vm.ShowBuyClick()">BUYING</div> <div class="btn-sell" ng-class="{\'active\':!vm.ShowBuy}" ng-click="vm.ShowSellClick()">SELLING</div> </div> </div> <div class="ibuy-item-list"> <div class="ibuy-buy" ng-show="vm.ShowBuy"> <ul> <li ng-repeat="item in vm.Items" ng-click="vm.ViewItem(item)" class="buy-item" ng-class="{\'disabled\' : item.SoldOut || item.UserBidding}"> <div class="img-wrapper"> <item-image class="item-img" item-id="item.Title"></item-image> </div> <div class="item-content clearfix"> <h3>{{item.Title}}</h3> <div ng-hide="item.UserBidding || item.SoldOut"> <div class="left">BUY NOW<span>{{item.Price | currency }}</span></div> <div class="left current-bid">CURRENT BID<span>{{item.CurrentBid | currency}}</span></div> <div class="arrow"><span class="icon-arrow"></span></div> </div> <div class="currently-bidding" ng-show="item.UserBidding"> <span class="icon-clock"></span> <div>YOU ARE CURRENTLY BIDDING ON THIS ITEM</div> </div> <div class="auction-ended" ng-show="item.SoldOut && !item.UserBidding"> <span class="icon-flag"></span> <div>AUCTION<br>ENDED</div> </div> </div> </li> </ul> </div> <div class="ibuy-sell" ng-show="!vm.ShowBuy"> <div class="no-items" ng-hide="vm.ItemsSelling.length > 0" class="sell-item">YOU HAVE NO ITEMS<br>FOR SALE</div> <ul> <li ng-repeat="item in vm.ItemsSelling" class="disabled sell-item"> <div class="img-wrapper"> <item-image class="item-img" item-id="item.Title"></item-image> </div> <div class="item-content"> <h3>{{item.Title}}</h3> <div> <div class="left">SALE PRICE<span>{{item.SellPrice | currency }}</span></div> <button class="btn-cancel-sale" ng-click="vm.CancelSale(item)"><span class="icon-add icon-45"></span><div>CANCEL<br>SALE</div></button> </div> </div> </li> </ul> </div> </div> </div> </app-frame> '), $templateCache.put("app/ibuy/item/ibuy-item.tpl", '<app-frame class="ibuy ibuy-item"> <app-header data-title="\'iBuy\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <div class="image-container" ng-class="vm.ItemBG"> <item-image class="item-img" item-id="vm.Item.Title"></item-image> </div> <div class="content"> <h2>{{vm.Item.Title}}</h2> <div class="clearfix"> <h3 class="left">BUY NOW<span>{{vm.Item.Price | currency }}</span></h3> <h3 class="left">NUMBER OF BIDS<span>{{vm.Item.NumberOfBids }}</span></h3> <h3 class="left current-bid">CURRENT BID<span>{{vm.Item.CurrentBid | currency}}</span></h3> </div> <button class="btn btn-ibuy-bid" ng-click="vm.BidClicked()">BID ON ITEM</button> <button class="btn btn-ibuy-sell" ng-click="vm.BuyClicked()">BUY NOW</button> <div class="item-details"> <h3>ITEM DETAILS</h3> <p>{{vm.Item.Description}}</p> <p class="seller">Seller: MRFLASH07 (99.6% Positive)</p> </div> <a href="" class="ibuy-cancel" ng-click="vm.BackClicked()">BACK TO ITEMS TO BUY</a> </div> </div> </app-frame> '), $templateCache.put("app/ibuy/purchase-complete/ibuy-purchase-complete.tpl", '<app-frame class="ibuy ibuy-purchase-complete"> <app-header data-title="\'iBuy\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <div class="header-image"><img ng-src="assets/images/ibuy/{{vm.Image}}"></div> <div class="wrapper"> <h2>{{vm.Heading}}</h2> <p ng-bind-html="vm.Text"></p> <button class="btn btn-ibuy-return" ng-click="vm.BackClicked()">RETURN TO ITEM LIST</button> </div> </div> </app-frame> '), $templateCache.put("app/ibuy/purchase/ibuy-purchase.tpl", '<app-frame class="ibuy ibuy-purchase"> <app-header data-title="\'iBuy\'" data-back-to=""></app-header> <div class="app-window clearfix"> <h2>{{vm.Heading}}</h2> <div class="item-details" ng-class="{\'buy\':!vm.IsBid}"> <item-image class="item-img" item-id="vm.Item.Title"></item-image> <div class="content"> <h3>{{vm.Item.Title}}</h3> <div class="label" ng-hide="vm.IsBid">BUY NOW<span>{{vm.Item.Price | currency }}</span></div> <div class="label current-bid" ng-show="vm.IsBid">CURRENT BID<span>{{vm.Item.CurrentBid | currency}}</span></div> </div> </div> <p ng-show="vm.IsBid">Enter the amount you want to bid for this item. If your bid fails you will be refunded the amount you bid.</p> <h3 class="labels" ng-show="vm.IsBid">Enter your bid amount:</h3> <money-amount-input ng-show="vm.IsBid"></money-amount-input> <h3 class="labels">Choose payment method:</h3> <dropdown list="vm.FromAccountOptions" selecteditem="vm.FromAccountModel.Selected" property="ID" id="1"> </dropdown> <transfer-button ng-click="vm.Purchase()" class="btn btn-transfer btn-transfer-ibuy" data-label="{{vm.Btn}}"></transfer-button> <a href="" class="ibuy-cancel" ng-click="vm.CancelClicked()">Cancel</a> </div> </app-frame> '), $templateCache.put("app/job-finder/job/job.tpl", '<app-frame class="job-finder job-finder-job"> <app-header data-title="\'Job Finder\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <div class="wrapper"> <h2>{{vm.Job.Title}}</h2> <div class="company">{{vm.Job.Company}}</div> <h3>Work Days</h3> <work-days-display work-days="vm.Job.WorkingDays"></work-days-display> <h3>Salary</h3> <p>{{vm.Job.Salary | currency:\'$\':0}} {{vm.Job.PaymentFrequencyStringFull}}<br> <span ng-show="vm.Job.IncludesSuper">Including</span><span ng-show="!vm.Job.IncludesSuper">Excluding</span> superannuation</p> <h3 ng-if="vm.Job.ItemRequirements.length > 0">Requirements</h3> <div class="clearfix"> <div class="item" title="{{item.Title}}" ng-repeat="item in vm.Job.ItemRequirements"> <item-image class="item-img" item-id="item.Title"></item-image> </div> </div> <h3>Experience Required</h3> <p><span ng-if="vm.Job.ExperienceRequirements.length === 0">None</span> <span ng-repeat="requirement in vm.Job.ExperienceRequirements">{{requirement.Weeks}} weeks as a {{requirement.Title}} <span ng-show="$index < (vm.Job.ExperienceRequirements.length-1) && vm.Job.ExperienceRequirements.length > 1"> or </span><br></span> </p> <h3>Promotion</h3> <p><span ng-bind-html="vm.Job.Promotion"></span> weeks</p> <h3>Pay Rise</h3> <p><span ng-bind-html="vm.Job.PayRise"></span> weeks</p> <h3>Contract Period</h3> <p><span ng-bind-html="vm.Job.ContractLength"></span> weeks</p> <h3>Contract Penalty</h3> <p>{{vm.Job.ContractPenalty | currency}}</p> <h3>Description</h3> <p><span ng-bind-html="vm.Job.Description"></span></p> <div class="notice"> <div class="icon"><span class="icon-emark"></span></div> <div class="content">After applying you will receive an email next week letting you know if you have been successful. </div> </div> <transfer-button ng-click="vm.applyForJob()" class="btn btn-transfer btn-apply-job" data-label="APPLY FOR THIS JOB"></transfer-button> <a href="" class="btn-cancel btn-cancel-job" ng-click="vm.navigateBack()">BACK TO JOB LIST</a> </div> </div> </app-frame> '), $templateCache.put("app/job-finder/list-jobs/list-jobs.tpl", '<app-frame class="job-finder job-finder-list"> <app-header data-title="\'Job Finder\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window"> <div class="current-jobs container-padding"> <h2>Current Employment</h2> <div class="slide-container"> <slick class="slider" settings="vm.slickConfig"> <div class="slide" ng-repeat="job in vm.CurrentJobs"> <div class="job-title">{{job.Title}}</div> <h3>Work Days</h3> <work-days-display work-days="job.WorkingDays"></work-days-display> <h3>Salary</h3> <div class="salary">{{job.Salary | currency:"$":2}} <span>{{job.PaymentFrequencyString}}</span></div> </div> </slick> </div> </div> <div class="job-list"> <h2 class="container-padding">Available Jobs</h2> <ul> <li ng-repeat="job in vm.JobsList" ng-click="vm.ViewJob(job.ID,job.HasApplied)" ng-class="{\'disabled\': job.HasApplied}" class="job-btn"> <div class="container-padding"> <div class="job-title-listing">{{job.Title}}</div> <div class="clearfix" ng-if="!job.HasApplied"> <div class="arrow"><span class="icon-arrow"></span></div> <div class="left-panel"> <h3>Work Days</h3> <work-days-display work-days="job.WorkingDays"></work-days-display> </div> <div class="right-panel"> <h3>Salary</h3> <div class="salary-listing">{{job.Salary | currency:"$":0}} <span>{{job.PaymentFrequencyString}}</span></div> </div> </div> <div class="pending-application" ng-if="job.HasApplied"> <div class="icon"><span class="icon-clock"></span></div> <div class="content">YOUR APPLICATION FOR THIS JOB IS PENDING</div> </div> </div> </li> </ul> </div> </div> </app-frame> '), $templateCache.put("app/mentor-popup/mentor-msg.view.tpl", '<div class="mentor-msg"> <div class="content-box"> <div class="title" ng-bind-html="mentorData.Title"></div> <p ng-bind-html="Pages[CurrentPage]" ng-if="!ShowHelp && !ShowFaqs"></p> <div ng-if="ShowHelp" class="help"> <p>Tell me about:</p> <ul> <li ng-repeat="item in Pages[CurrentPage]"><a class="link" ng-click="HelpClicked(item.GameAppID)">{{item.Name}}</a></li> </ul> </div> <div ng-if="ShowFaqs" class="help"> <p> <ul> <li ng-repeat="item in Pages[CurrentPage]"><a class="link" ng-click="FaqsClicked(item.ID, item.Name, item.Content)">{{item.Name}}</a></li> </ul> </p> </div> <button class="btn btn-mentor-popup" ng-if="ShowBtn && !ShowHelp && !ShowFaqs" ng-click="Close()">Got it!</button> <div class="navigation" ng-show="ShowNav"> <button class="left btn btn-mentor-nav" ng-class="{\'disabled\' : PrevDisabled}" ng-click="PrevPage()"><span class="icon-arrow-mentor icon-180"></span></button> <button class="right btn btn-mentor-nav" ng-class="{\'disabled\' :NextDisabled}" ng-click="NextPage()"><span class="icon-arrow-mentor"></span></button> <div class="progress">{{CurrentPage + 1}} / {{Pages.length}}</div> </div> </div> <div class="bit"><img src="assets/images/mentor/bubble-bit.svg"></div> <div class="mentor"><img ng-src="{{getHowl(mentorData.Tag)}}"></div> </div>'), $templateCache.put("app/my-stuff/list-stuff/list-stuff.tpl", '<app-frame class="my-stuff my-stuff-list"> <app-header data-title="\'MyStuff\'" data-back-to="\'dashboard\'"></app-header> <div class="app-overlay" ng-if="vm.showOverlay"> Overlay here </div> <div class="app-window clearfix" ng-if="!vm.showOverlay"> <div class="app-logo"> <h2>MY STUFF</h2> </div> <div class="no-items" ng-if="vm.MyStuff.length === 0"> <img src="assets/images/my-stuff/my_stuff_no_items.svg"><br> You currently have<br>no items. </div> <div ng-if="vm.MyStuff.length > 0"> <button class="btn btn-slider-prev" ng-class="{\'disabled\' : vm.prevDisabled }" ng-click="vm.slickConfig.method.slickPrev()" ng-disabled="vm.prevDisabled"> <div class="icon"><span class="icon-my-stuff-arrow icon-flipped"></span></div> </button> <button class="btn btn-slider-next" ng-class="{\'disabled\' : vm.nextDisabled }" ng-click="vm.slickConfig.method.slickNext()" ng-disabled="vm.nextDisabled"> <div class="icon"><span class="icon-my-stuff-arrow"></span></div> </button> <slick class="slider" settings="vm.slickConfig"> <div class="slide" ng-repeat="option in vm.MyStuff | orderBy: \'Title\'"> <div class="for-sale-sign" ng-if="option.IBuySale"> <img src="assets/images/my-stuff/for-sale-sign.svg"> </div> <item-image class="item-img" item-id="option.IBuySale ? option.Title+\'silhouette\' : option.Title"></item-image> <h3>{{option.Title}}</h3> <div class="center item-counter">ITEM <b>{{$index+1}}</b> OF <b>{{vm.totalSlides}}</b></div> <div class="btn-area"> <div ng-if="!option.IBuySale"> <div class="value-box"> <div class="label">VALUE</div> <div class="price">{{option.Price | currency}}</div> </div> <button class="btn-sell-on-ibuy" ng-click="vm.SellStuff(option)">Sell on iBuy</button> </div> <div ng-if="option.IBuySale"> <button class="btn btn-transfer btn-transfer-yellow" ng-click="vm.ViewIbuyListing(option.ID)">View iBuy Listing</button> </div> </div> </div> </slick> </div> </div> </app-frame> '), $templateCache.put("app/my-stuff/sell-stuff/sell-stuff.tpl", '<app-frame class="my-stuff my-stuff-sell"> <app-header data-title="\'MyStuff\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <h2>Sell Item</h2> <div class="item-box"> <item-image class="item-img" item-id="vm.Item.Title"></item-image> <div class="content-box"> <h3>{{vm.Item.Title}}</h3> <div class="label">VALUE</div> <div class="price">{{vm.Item.Price | currency}}</div> </div> </div> <h3>Enter your sale price:</h3> <money-amount-input></money-amount-input> <div class="email-notice"> <span class="icon-email-icon"></span> <div>Check your email next week to see if you are successful.</div> </div> <transfer-button ng-click="vm.SellOnIbuy()" class="btn btn-transfer btn-transfer-yellow" data-label="Sell on iBuy"></transfer-button> <a href="" class="btn-cancel" ng-click="vm.CancelClicked()">Cancel</a> </div> </app-frame> '), $templateCache.put("app/operating-system/app-header/app-header.tpl", '<div class="app-header"> <go-back to="{{backTo}}"></go-back> <h1>{{title}}</h1> <button class="btn btn-icon home" ng-click="homeClicked()"><span class="icon-global-home"></span></button> <button class="btn btn-icon close" ng-click="homeClicked()"><span class="icon-add icon-45"></span></button> </div>'), $templateCache.put("app/operating-system/debug/debug.tpl", '<div> <button ng-click="createNewGameInstance()">Create New Game</button> <br>{{newGameInstance}} </div> '), $templateCache.put("app/operating-system/dialog-popup/dialog-popup.tpl", '<div> <div ng-if="ngDialogData.type === \'msg\'"> <p ng-bind-html="ngDialogData.content"></p> <button class="btn btn-dialog-solid" ng-click="closeThisDialog(0)">Okay</button> </div> <div ng-if="ngDialogData.type === \'confirm\'"> <p ng-bind-html="ngDialogData.content"></p> <button class="btn btn-dialog-solid" ng-show="ngDialogData.acceptFn" ng-click="vm.dialogAccept()">{{ngDialogData.acceptBtnLabel}}</button> <button class="btn btn-dialog-hollow" ng-show="ngDialogData.declineFn" ng-click="vm.dialogDecline()">{{ngDialogData.declineBtnLabel}}</button> </div> </div>'), $templateCache.put("app/operating-system/game-template.view.tpl", '<div class="desktop-header visible-in--l"> <div class="week">Week {{main.CurrentWeek}}</div> <div class="progress-bar"><div class="bar" ng-style="main.barWidth"></div></div> <div class="buttons"> <a href="" ng-click="main.Faqs()">Faqs</a> <a href="" ng-click="main.Help()">Help</a> <a href="" ng-click="main.Logout();">Save and log out</a> <button ng-click="main.FinishWeek()">Finish the week <span class="icon-arrow-right"></span></button> </div> </div> <div class="rotate-screen"> <h1>Please rotate your device</h1> </div> <div class="pig-in-the-middle"> <img src="assets/images/desktop-pig.svg"> </div> <div class="app-viewport"> <div class="av-dashboard"> <div class="av-widgets left visible-in--l"> <div ui-view="leftView"></div> </div> <div class="av-sim"> <div class="app-screen"> <device-height class="app-screen__app" ng-class="main.AppFrameDropshadow"> <div class="height-100" ng-class="main.ViewTransition" ui-view="appView"></div> </device-height> </div> </div> <div class="av-widgets right visible-in--l"> <div ui-view="rightView"></div> </div> </div> </div> <mentor-pop-up></mentor-pop-up>'), $templateCache.put("app/partials/404.view.tpl", '<div class="page-err"> Your session has expired please follow the link you were supplied. </div> '), $templateCache.put("app/shares/shares-buy/shares-buy.tpl", '<app-frame class="shares shares-buy-sell"> <app-header data-title="\'Shares\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <h2>Buy Shares</h2> <div class="underline"></div> <div class="info-box"> <div class="code">{{vm.Share.Company}}</div> <div class="content"> <div class="name">{{vm.Share.Title}}</div> <h3>Current share price:</h3> <div class="price">1x = {{vm.Share.CurrentPrice | currency}}</div> </div> </div> <h3>How many shares would you like to buy:</h3> <div class="slider"> <rzslider rz-slider-model="vm.Slider.value" rz-slider-options="vm.Slider.options"></rzslider> <input type="number" ng-change="vm.OnCountChange()" ng-model="vm.Slider.value" class="amount" min="1"> </div> <h3>Cost:</h3> <div class="value">{{vm.Cost | currency}}</div> <h3>Brokerage Fee:</h3> <div class="value">{{vm.Share.BrokerageFee * vm.Cost | currency}}</div> <h3>Total:</h3> <div class="value-total">{{vm.TotalPrice | currency}}</div> <h3>Choose payment method:</h3> <dropdown list="vm.FromAccountOptions" selecteditem="vm.FromAccountModel.Selected" property="ID" id="1"> </dropdown> <transfer-button ng-click="vm.Purchase()" class="btn btn-transfer btn-transfer-shares" data-label="{{\'BUY SHARES\'}}"></transfer-button> <a href="" class="shares-cancel" ng-click="vm.CancelClicked()">Cancel</a> </div> </app-frame> '), $templateCache.put("app/shares/shares-list/shares-list.tpl", '<app-frame class="shares shares-list"> <app-header data-title="\'Shares\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window clearfix"> <div class="logo-container"> <img class="logo" src="assets/images/shares/shares-logo.svg"> <div class="clearfix"> <div class="btn-market" ng-class="{\'active\':vm.ShowMarket}" ng-click="vm.ShowMarketClick()">Market</div> <div class="btn-portfolio" ng-class="{\'active\':!vm.ShowMarket}" ng-click="vm.ShowPortfolioClick()">Portfolio</div> </div> </div> <app-height> <div class="shares-market" ng-show="vm.ShowMarket"> <div class="share-card" ng-repeat="share in vm.Shares | orderBy:\'Risk\'"> <div class="header clearfix"> <div class="company"> <div class="code">{{share.Company}}</div> <div class="title">{{share.Title}}</div> </div> <div class="risk"> <div class="title">RISK RATING</div> <div class="rating" ng-class="\'rating\'+share.Risk"> <ng-pluralize count="share.Risk" when="{\'0\': \'LOW\',\r\n\t\t\t\t\t\t\t\t \'1\': \'MEDIUM\',\r\n\t\t\t\t\t\t\t\t \'2\': \'HIGH\'}"> </ng-pluralize> </div> </div> </div> <div class="graph"> <highchart id="{{\'chart\'+ $index}}" config="share.HightChart"></highchart> </div> <div class="prices"> <div class="last"> <div class="title">PRICE LAST<br>WEEK</div> <div class="price">{{share.LastWeeksPrice | currency}}</div> </div> <div class="current"> <div class="borders"></div> <div class="title">CURRENT<br>PRICE</div> <div class="price">{{share.CurrentPrice | currency}}</div> </div> <div class="change"> <div class="title">PERCENTAGE<br>CHANGE</div> <div class="price">{{share.PercentageChange}}% <span class="icon-down" ng-class="vm.ChangeIndicator(share.LastWeeksPrice,share.CurrentPrice)"></span></div> </div> </div> <div class="number">Shares AVAILABLE: {{share.TotalShares- share.OwnedShares}}/{{share.TotalShares}}</div> <button class="btn btn-trade-shares" ng-class="{\'disabled\': share.TotalShares == share.OwnedShares}" ng-click="vm.BuyShareClicked(share)">{{share.TotalShares == share.OwnedShares? \'NO SHARES LEFT TO PURCHASE\':\'BUY THESE SHARES\'}}</button> </div> </div> <div class="shares-portfolio" ng-show="!vm.ShowMarket"> <div class="no-shares" ng-hide="vm.UserShares.length > 0 ">You currently own no shares</div> <div class="user-shares" ng-show="vm.UserShares.length > 0 "> <div class="portfolio-total"> <div class="title">TOTAL INVESTMENT VALUE</div> <div class="price">{{ vm.TotalInvestment | currency }}</div> </div> <div class="user-share-card" ng-repeat="share in vm.UserShares"> <div class="company"> <span class="code"><strong>{{share.Company}}</strong></span> โ <span class="title">{{share.Title}}</span> </div> <div class="share-price"> <div class="owned"> <div class="label">SHARES OWNED</div> <div class="value">{{share.OwnedShares}}</div> </div> <div class="price"> <div class="borders"></div> <div class="label">CURRENT PRICE</div> <div class="value">{{share.CurrentPrice | currency}}</div> </div> </div> <div class="label">TOTAL</div> <div class="total-share-price">{{ share.OwnedShares * share.CurrentPrice | currency }}</div> <button class="btn btn-trade-shares" ng-click="vm.SellShareClicked(share)">SELL THESE SHARES</button> </div> </div> </div> </app-height> </div> </app-frame> '),
- $templateCache.put("app/shares/shares-sell/shares-sell.tpl", '<app-frame class="shares shares-buy-sell"> <app-header data-title="\'Shares\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <h2>Sell Shares</h2> <div class="underline"></div> <div class="info-box"> <div class="code">{{vm.Share.Company}}</div> <div class="content"> <div class="name">{{vm.Share.Title}}</div> <h3>Current share price:</h3> <div class="price">1x = {{vm.Share.CurrentPrice | currency}}</div> </div> </div> <h3>Shares owned:</h3> <div class="value">{{vm.Share.OwnedShares}}</div> <h3>How many shares would you like to sell:</h3> <div class="slider"> <rzslider rz-slider-model="vm.Slider.value" rz-slider-options="vm.Slider.options"></rzslider> <input type="number" ng-change="vm.OnCountChange()" ng-model="vm.Slider.value" class="amount" min="1"> </div> <h3>Value:</h3> <div class="value">{{vm.Cost | currency}}</div> <h3>Brokerage Fee:</h3> <div class="value">{{vm.Share.BrokerageFee*vm.Cost | currency}}</div> <h3>Total:</h3> <div class="value-total">{{vm.TotalPrice | currency}}</div> <h3>Select bank account to be paid into:</h3> <dropdown list="vm.FromAccountOptions" selecteditem="vm.FromAccountModel.Selected" property="ID" id="1"> </dropdown> <transfer-button ng-click="vm.Sell()" class="btn btn-transfer btn-transfer-shares" data-label="{{\'SELL SHARES\'}}"></transfer-button> <a href="" class="shares-cancel" ng-click="vm.CancelClicked()">Cancel</a> </div> </app-frame> '), $templateCache.put("app/survey/survey-progress/progress.view.tpl", '<div class="desktop-header desktop-header--survey" ng-init="vm.Init()"> <div class="week">QUIZ PROGRESS</div> <div class="progress-bar"><div class="bar" ng-style="vm.BarWidth"></div></div> <div class="buttons visible-in--l"> <a href="" ng-click="main.Logout();">SAVE AND LOG OUT</a> </div> </div>'), $templateCache.put("app/survey/survey-question/feedback-correct.view.tpl", '<div class="screen-question" ng-init="vm.Init()"> <div class="question-container"> <h1>QUESTION {{vm.currentQuestion}}</h1> <h2>END OF GAME QUIZ</h2> <div class="underline"></div> <div class="correct-screen"> <div class="symbol"><span class="icon-success"></span></div> <div class="label">CORRECT</div> <div class="total clearfix"> <div class="left">TOTAL REWARD</div> <div class="right">{{ vm.cashReward | currency : $ : 2 }}</div> </div> <button class="btn btn-eow-submit" ng-click="vm.Continue()">CONTINUE</button> </div> </div> </div> '), $templateCache.put("app/survey/survey-question/feedback-incorrect.view.tpl", '<div class="screen-question" ng-init="vm.Init()"> <div class="question-container"> <h1>QUESTION {{vm.currentQuestion}}</h1> <h2>END OF GAME QUIZ</h2> <div class="underline"></div> <div class="incorrect-screen"> <div class="symbol"><span class="icon-incorrect"></span></div> <div class="label">INCORRECT</div> <div class="incorrect-txt">NO BONUS<br>CASH THIS TIME</div> <button class="btn btn-eow-submit" ng-click="vm.Continue()">CONTINUE</button> </div> </div> </div>'), $templateCache.put("app/survey/survey-question/question.view.tpl", '<div class="screen-question" ng-init="vm.Init()"> <div class="question-container"> <h1>QUESTION {{vm.CurrentQuestion}}</h1> <h2>END OF GAME QUIZ</h2> <div class="underline"></div> <p>{{vm.Question}}</p> <ul> <li ng-repeat="Answers in vm.Answers" ng-click="vm.AnswerClicked($index)" ng-class="[Answers.Selected, vm.DisableAnswersClass, Answers.Status]"> <div class="circle"></div><span class="icon-success"></span><span class="icon-incorrect"></span><span class="answer-text">{{Answers.Name}}</span></li> </ul> <button class="btn btn-eow-submit" ng-click="vm.SubmitAnswer()" ng-class="{\'disabled\': vm.Selection == -1 }">{{ vm.IsLastQuestion ? \'COMPLETE\' : \'SUBMIT\' }}</button> </div> </div>'), $templateCache.put("app/survey/survey.view.tpl", '<div ui-view="progress"></div> <div class="survey"> <ui-view></ui-view> </div>'), $templateCache.put("app/text-message/list-messages/list-messages.tpl", '<app-frame class="text-message text-message-list"> <app-header data-title="\'Messages\'" data-back-to="\'dashboard\'"></app-header> <div class="app-overlay" ng-if="vm.showOverlay"> Overlay here </div> <div class="app-window clearfix" ng-if="!vm.showOverlay"> <div class="no-messages" ng-if="vm.SortedTextMessages.length === 0"> No Messages<br>Received </div> <ul> <li class="clearfix" ng-class="{\'message-unread\': !vm.groupIsRead($index)}" ng-repeat="group in vm.SortedTextMessages"> <div class="message-item clearfix" ng-click="vm.viewMessage($index)"> <div class="profile-image"> <img ng-src="{{vm.getProfileImage(group[0].From)}}"> </div> <div class="text-content"> <div class="from">{{group[0].From}}</div> <div class="week">WEEK {{group[[0]].Week}}</div> <div class="text-excerpt"><span ng-bind-html="group[0].Content"></span></div> </div> <div class="arrow"><span class="icon icon-arrow-right"></span></div> </div> </li> </ul> </div> </app-frame> '), $templateCache.put("app/text-message/message/message.tpl", '<app-frame class="text-message text-messages"> <app-header data-title="\'Messages\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix" ng-if="!vm.showOverlay"> <div class="from">{{vm.MessagesSorted[0][0].From}}</div> <div class="message-week-block" ng-repeat="week in vm.MessagesSorted"> <div class="week">WEEK {{week[0].Week}}</div> <div class="message-block" ng-repeat="message in week"> <div class="message clearfix"> <div class="text-wrapper"> <div class="profile-image"><img ng-src="{{vm.getProfileImage(message.From)}}"></div> <div class="talk-corner"></div> <div class="text"> <span ng-bind-html="message.Content"></span> </div> </div> <!-- Msg action --> <div class="message-action" ng-show="message.IsActionable && !message.Actioned"> <div class="btn-text-message-action accept" ng-click="vm.actionClicked(message.ActionGameAppInstanceID, message.ActionItemInstanceID, true)"> <div class="icon-wrapper"><span class="icon icon-text-message-hand"></span></div> <div class="label">ACCEPT</div> </div> <div class="btn-text-message-action decline" ng-click="vm.actionClicked(message.ActionGameAppInstanceID, message.ActionItemInstanceID, false)"> <div class="icon-wrapper"><span class="icon icon-text-message-hand"></span></div> <div class="label">DECLINE</div> </div> </div> <!-- Msg actioned response --> <div class="message-actioned clearfix" ng-show="message.Actioned && message.IsActionable" ng-class="{\'accept\': message.Accepted, \'decline\': !message.Accepted}"> <div class="response-corner"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="22.266px" height="26.418px" viewBox="0 0 22.266 26.418" enable-background="new 0 0 22.266 26.418" xml:space="preserve"> <g id="Layer_1_2_"> <path d="M8.348,26.418H0L0,0.001l8.351,0c1.908-0.039,3.606,1.206,4.141,3.038c1.164,4.6,4.691,8.232,9.255,9.53\r\n\t\t\t\t\t\t\t\t\t\tc0.36,0.083,0.584,0.442,0.501,0.802c-0.053,0.229-0.221,0.413-0.445,0.485c-4.369,1.635-7.785,5.128-9.321,9.534\r\n\t\t\t\t\t\t\t\t\t\tC11.918,25.196,10.241,26.424,8.348,26.418z"/> </g> </svg> </div> <div class="icon-wrapper"> <span class="icon icon-text-message-hand"></span> </div> </div> </div> </div> </div> <message-loading class="message-loading" ng-show="vm.ShowLoading"> <div class="message-block"> <div class="message clearfix"> <div class="text-wrapper"> <div class="profile-image"><img ng-src="{{vm.getProfileImage(vm.MessagesSorted[0][0].From)}}"></div> <div class="talk-corner"></div> <div class="text"> <div class="loading"><span class="dot dot1"></span><span class="dot dot2"></span><span class="dot dot3"></span></div> </div> </div> </div> </div> </message-loading> </div> </app-frame>'), $templateCache.put("app/ushop/item/ushop-item.tpl", '<app-frame class="ushop ushop-item"> <app-header data-title="\'uShop\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <div class="wrapper"> <div class="image-container" ng-class="vm.GetItemBackground(vm.Item.Title)"> <item-image class="item-img" item-id="vm.Item.Title"></item-image> </div> <div class="content"> <h2>{{vm.Item.Title}}</h2> <h3> {{vm.Item.Price | currency }}</h3> <p>{{vm.Item.Description}}</p> <button class="btn btn-ushop-buy" ng-click="vm.BuyClicked()">BUY THIS ITEM</button> </div> <a href="" class="ushop-cancel" ng-click="vm.BackClicked()">BACK TO ITEMS TO BUY</a> </div> </div> </app-frame> '), $templateCache.put("app/ushop/purchase/ushop-purchase.tpl", '<app-frame class="ushop ushop-purchase"> <app-header data-title="\'uShop\'" data-back-to=""></app-header> <div class="app-window clearfix"> <h2>BUY ITEM</h2> <div class="center-underline"></div> <div class="item-details"> <item-image class="item-img" item-id="vm.Item.Title"></item-image> <div class="content"> <h3>{{vm.Item.Title}}</h3> <div class="label">{{vm.Item.Price | currency }}</div> </div> </div> <money-amount-input ng-show="vm.IsBid"></money-amount-input> <h3 class="labels">Choose payment method:</h3> <dropdown list="vm.FromAccountOptions" selecteditem="vm.FromAccountModel.Selected" property="ID" id="1"> </dropdown> <transfer-button ng-click="vm.Purchase()" class="btn btn-transfer btn-transfer-ushop" data-label="BUY"></transfer-button> <a href="" class="ushop-cancel" ng-click="vm.CancelClicked()">Cancel</a> </div> </app-frame> '), $templateCache.put("app/ushop/ushop-list/ushop-list.tpl", '<app-frame class="ushop ushop-list"> <app-header data-title="\'uShop\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window clearfix"> <div class="logo-container"></div> <h2>This week\'s hot items</h2> <div class="center-underline"></div> <div class="ushop-buy"> <ul> <li ng-repeat="item in vm.Items track by $index" ng-click="vm.ViewItem(item)" ng-class="{\'disabled\':item.SoldOut}"> <div class="img-wrapper" ng-class="vm.GetItemBackground(item.Title)"> <div class="sold-out" ng-if="item.SoldOut"> <img src="assets/images/ushop/sold-out.svg"> </div> <item-image class="item-img" item-id="item.Title"></item-image> </div> <h3>{{item.Title}}</h3> <h4>{{item.Price | currency }}</h4> </li> </ul> </div> </div> </app-frame> '), $templateCache.put("app/weekly-planner/weekly-planner-archive/diary-archive.tpl", '<app-frame class="weekly-planner weekly-planner-archive"> <app-header data-title="\'Weekly Planner\'" data-back-to=""></app-header> <div class="app-window clearfix"> <h2> <b class="text-icon"> <span class="icon-clock-rewind"></span> PAST WEEK ENTRIES </b> </h2> <ul> <li ng-repeat="question in vm.Data.Questions | orderBy: \'-Week\'" ng-click="vm.QuestionClicked(question)"> <div class="question-block clearfix"> <div class="week">WEEK {{question.Week}}</div> <div class="title">{{question.Title}}</div> <span class="icon-arrow"></span> </div> </li> </ul> <div class="no-archives" ng-if="vm.Data.Questions.length == 0"> No Past Week<br>Entries </div> <div class="box-margin"> <button class="btn btn-archive-back" ng-click="vm.BackClicked()">Back</button> </div> </div> </app-frame> '), $templateCache.put("app/weekly-planner/weekly-planner-archive/view-diary.tpl", '<app-frame class="weekly-planner weekly-planner-diary"> <app-header data-title="\'Weekly Planner\'" data-back-to=""></app-header> <div class="app-window clearfix"> <h2 class="archive"> <b class="text-icon"> <span class="icon-clock-rewind"></span> PAST WEEK ENTRIES </b> </h2> <div class="question-block"> <h2>WEEK {{vm.Question.Week}} REFLECTION QUESTION</h2> <p>{{vm.Question.Text}}</p> <p><strong>RESPONSE</strong></p> <div class="answer-box" ng-class="{\'read-only\' : vm.QuestionAnswered}"> <textarea placeholder="Enter your response here" ng-model="vm.Question.Answer" ng-readonly="vm.QuestionAnswered"></textarea> <transfer-button ng-show="!vm.QuestionAnswered" ng-class="{\'disabled\':vm.Question.Answer.length == 0}" ng-click="vm.AnswerQuestion()" class="btn btn-transfer btn-save-response" data-label="SAVE RESPONSE"></transfer-button> <button ng-show="vm.QuestionAnswered" ng-click="vm.EditAnswer()" class="btn btn-edit-response"><span class="icon-pencil"></span><span class="underline">EDIT THIS RESPONSE</span></button> </div> </div> <div class="box-margin"> <button class="btn btn-archive-back" ng-click="vm.BackClicked()">Back</button> </div> </div> </app-frame>'), $templateCache.put("app/weekly-planner/weekly-planner-home/diary/diary.tpl", '<div class="weekly-planner-diary"> <div class="box-margin"> <p><strong>Provide your thoughts, tips and strategies โ within the game and in real life!</strong></p> </div> <div class="question-block"> <h2>WEEK {{vm.Question.Week}} REFLECTION QUESTION</h2> <p>{{vm.Question.Text}}</p> <p><strong>RESPONSE</strong></p> <div class="answer-box" ng-class="{\'read-only\' : vm.QuestionAnswered}"> <textarea maxlength="500" placeholder="Enter your response here" ng-model="vm.Question.Answer" ng-readonly="vm.QuestionAnswered"></textarea> <transfer-button ng-show="!vm.QuestionAnswered" ng-class="{\'disabled\':vm.Question.Answer.length == 0}" ng-click="vm.AnswerQuestion()" class="btn btn-transfer btn-save-response" data-label="SAVE RESPONSE"></transfer-button> <button ng-show="vm.QuestionAnswered" ng-click="vm.EditAnswer()" class="btn btn-edit-response"><span class="icon-pencil"></span><span class="underline">EDIT THIS RESPONSE</span></button> </div> </div> <div class="box-margin"> <button class="btn btn-past-weeks btn-past-weeks--text-icon" ng-click="vm.ViewArchive()"> <b class="text-icon"> <span class="icon-clock-rewind"></span>PAST WEEK ENTRIES </b> </button> </div> </div> '), $templateCache.put("app/weekly-planner/weekly-planner-home/my-budget/my-budget.tpl", '<div class="weekly-planner-my-budget"> <h2>Weekly Income <span>{{vm.Income | currency:\'$\':0}}</span></h2> <div class="bar-chart-income" ng-class="{\'has-income\': vm.Income > 0 }"><span ng-hide="vm.Income > 0">YOU DO NOT HAVE A WEEKLY INCOME</span></div> <h2>Weekly Expenses <span>{{vm.Expenses.Total | currency:\'$\':0}}</span></h2> <div class="bar-chart-expenses clearfix"> <div class="expense-total-bar" ng-style="vm.Expenses.Style"> <div class="bar rent" ng-style="vm.Expenses.Rent"></div> <div class="bar food" ng-style="vm.Expenses.Food"></div> <div class="bar travel" ng-style="vm.Expenses.Travel"></div> <div class="bar entertainment" ng-style="vm.Expenses.Entertainment"></div> </div> </div> <div class="clearfix"> <div class="legend" ng-repeat="item in vm.Expenses" ng-if="($index>0)"> <div class="block" ng-class="item.Title | lowercase"></div> <div class="info"> <div class="title">{{item.Title}}</div> <div class="expense">{{item.Expense | currency : \'$\': 0}}</div> </div> </div> </div> <div class="budget"> <div class="icon"><span class="icon-money-pile"></span></div> <div class="info"><span>{{vm.Remaining | currency:\'$\':0}}</span> Balance remaining after weekly expenses</div> </div> <h2 class="text-center">Use the tool below to plan what you will<br>do with your remaining funds.</h2> <div class="remaining" ng-class="vm.RemainingClass"> <span class="money">{{vm.SliderRemaining | currency:\'$\':0}}</span> <span class="info">REMAINING</span> </div> <div class="sliders"> <div class="slider-group"> <h3>SPENDING</h3> <div class="slider-row"> <div class="slider-label" ng-class="{\'disabled\' : vm.Sliders[0].options.disabled}">BILLS</div> <div class="slider"> <rzslider rz-slider-model="vm.Sliders[0].Value" rz-slider-options="vm.Sliders[0].options"></rzslider> </div> <budget-money-input id="0" data="vm.Sliders[0]" max-data="vm.Remaining"></budget-money-input> </div> <div class="slider-row"> <div class="slider-label" ng-class="{\'disabled\' : vm.Sliders[1].options.disabled}">GOODS</div> <div class="slider"> <rzslider rz-slider-model="vm.Sliders[1].Value" rz-slider-options="vm.Sliders[1].options"></rzslider> </div> <budget-money-input id="1" data="vm.Sliders[1]" max-data="vm.Remaining"></budget-money-input> </div> </div> <div class="slider-group"> <h3>SAVING</h3> <div class="slider-row"> <div class="slider-label" ng-class="{\'disabled\' : vm.Sliders[2].options.disabled}">SAVINGS ACCOUNT</div> <div class="slider"> <rzslider rz-slider-model="vm.Sliders[2].Value" rz-slider-options="vm.Sliders[2].options"></rzslider> </div> <budget-money-input id="1" data="vm.Sliders[2]" max-data="vm.Remaining"></budget-money-input> </div> </div> <div class="slider-group"> <h3>INVESTING</h3> <div class="slider-row"> <div class="slider-label" ng-class="{\'disabled\' : vm.Sliders[3].options.disabled}">SHARES</div> <div class="slider"> <rzslider rz-slider-model="vm.Sliders[3].Value" rz-slider-options="vm.Sliders[3].options"></rzslider> </div> <budget-money-input id="1" data="vm.Sliders[3]" max-data="vm.Remaining"></budget-money-input> </div> <div class="slider-row"> <div class="slider-label" ng-class="{\'disabled\' : vm.Sliders[4].options.disabled}">FIXED TERM INVESTMENT</div> <div class="slider"> <rzslider rz-slider-model="vm.Sliders[4].Value" rz-slider-options="vm.Sliders[4].options"></rzslider> </div> <budget-money-input id="1" data="vm.Sliders[4]" max-data="vm.Remaining"></budget-money-input> </div> </div> </div> </div> '), $templateCache.put("app/weekly-planner/weekly-planner-home/weekly-planner-home.tpl", '<app-frame class="weekly-planner weekly-planner-home"> <app-header data-title="\'Weekly Planner\'" data-back-to="\'dashboard\'"></app-header> <div class="app-window clearfix"> <div class="logo-container"> <div class="tab-btns clearfix"> <div class="btn btn-weekly-planner-tab" ng-class="{\'active\':vm.ShowMyBudget}" ng-click="vm.ShowMyBudgetClick()">MY BUDGET<div class="line" ng-show="vm.ShowMyBudget"></div></div> <div class="btn btn-weekly-planner-tab" ng-class="{\'active\':!vm.ShowMyBudget}" ng-click="vm.ShowDiaryClick()">DIARY<div class="line-green" ng-show="!vm.ShowMyBudget"></div></div> </div> </div> <ui-view></ui-view> </div> </app-frame> '), $templateCache.put("app/where-im-at/breakdown.tpl", '<div class="breakdown"> <div class="inner"> <div class="week">WEEK {{vm.currentWeek}}</div> <span class="inner-title">Progress Report</span> <h3>ASSETS</h3> <div class="assets"> <div class="breakdown-container" ng-repeat="item in vm.AssetsBreakdown" ng-class="{\'liabilities\' : item.Balance < 0 }" ng-show="item.Title != \'Survey\'"> <h1>{{item.Category}}</h1> <span class="icon" ng-class="item.Icon"></span> <div class="content clearfix"> <div class="title">{{item.Title}} </div> <div class="balance-flex"> <div class="line"></div> <div class="balance">{{item.Balance | currency }}</div> </div> </div> </div> </div> <h3 class="libh2">LIABILITIES</h3> <div class="liabilities"> <div class="breakdown-container" ng-repeat="item in vm.LiabilitiesBreakdown"> <span class="icon" ng-class="item.Icon"></span> <div class="content clearfix"> <div class="title">{{item.Title}} </div> <div class="balance-flex"> <div class="line"></div> <div class="balance">{{item.Balance | currency: \'$\' : 2 }}</div> </div> </div> </div> </div> </div> </div> '), $templateCache.put("app/where-im-at/where-im-at-desktop.view.tpl", '<div class="where-im-at where-im-at-desktop"> <div class="header"> <div class="inner"> <h1>MY NET POSITION</h1> <h2>{{vm.NetPosition | currency: \'$\' : 0}}</h2> </div> </div> <div class="where-im-at-panel" ng-show="vm.PanelOpen"> <div class="breakdown-top-shadow"></div> <ng-include src="\'app/where-im-at/breakdown.tpl\'"></ng-include> </div> <div class="btn-panel" ng-click="vm.PanelClicked()">{{vm.PanelBtnText}} Where I\'m at <span class="icon-arrow icon-90" ng-class="{\'icon-270 open\' : vm.PanelOpen}"></span> </div> </div>'), $templateCache.put("app/where-im-at/where-im-at-mobile.view.tpl", '<app-frame class="where-im-at where-im-at-app"> <app-header data-title="\'Where I\\\'m at\'" data-back-to="\'\'"></app-header> <div class="app-window clearfix"> <div class="shadow"> <ng-include src="\'app/where-im-at/breakdown.tpl\'"></ng-include> <div class="net-position"> <div class="inner"> <h1>MY NET POSITION</h1> <h2>{{vm.NetPosition | currency: \'$\' : 2}}</h2> </div> </div> </div> <div class="footer"> <img src="assets/images/fbf-logo.svg"> </div> </div> </app-frame> ')
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement