Advertisement
Guest User

Untitled

a guest
Jul 31st, 2018
3,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 433.95 KB | None | 0 0
  1. "use strict";
  2.  
  3. function MainController($scope, $location, $stateParams, GameLinkService, GameInstancesService, GameMediaService, AuthenticationService, MessageService, utils, $localStorage) {
  4. function acceptCallback() {
  5. GameInstancesService.endWeekProcess()
  6. }
  7.  
  8. function declineCallback() {}
  9. var main = this;
  10. main.ViewTransition = "", main.CurrentWeek = GameInstancesService.getCurrentWeek(), main.barWidth = {
  11. width: GameInstancesService.getProgressBarPercent()
  12. }, main.Initialize = function() {
  13. $scope.$on("updateViewTransition", function(event, data) {
  14. main.ViewTransition = data.transition
  15. }), 0 === main.CurrentWeek && GameInstancesService.setCurrentWeek($localStorage.GameCurrentWeek)
  16. }, main.FinishWeek = function() {
  17. MessageService.showConfirm({
  18. 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?',
  19. acceptFn: acceptCallback,
  20. declineFn: declineCallback,
  21. acceptBtnLabel: "FINISH THE WEEK",
  22. declineBtnLabel: "STAY ON THIS WEEK"
  23. })
  24. }, main.Help = function() {
  25. $scope.$broadcast("ShowMentorHelpPopup")
  26. }, main.Faqs = function() {
  27. $scope.$broadcast("ShowMentorFaqPopup")
  28. }, main.Logout = function() {
  29. AuthenticationService.logout(function(res) {
  30. var gameLinkId = $localStorage.GameLinkID;
  31. $localStorage.$reset(), $location.path("auth/login/" + gameLinkId)
  32. }, function(res) {
  33. log(res)
  34. })
  35. }, $scope.$on("CurrentWeekUpdated", function(event, currentWeek) {
  36. main.CurrentWeek = currentWeek, main.barWidth = {
  37. width: GameInstancesService.getProgressBarPercent()
  38. }
  39. }), $scope.$on("FinishWeek", function() {
  40. main.FinishWeek()
  41. }), main.Initialize()
  42. }
  43.  
  44. function DialogPopupController($scope) {
  45. var vm = this;
  46. vm.dialogAccept = function() {
  47. $scope.ngDialogData.acceptFn(), $scope.closeThisDialog()
  48. }, vm.dialogDecline = function() {
  49. $scope.ngDialogData.declineFn(), $scope.closeThisDialog()
  50. }
  51. }
  52.  
  53. function AuthenticationController($scope, $stateParams, $localStorage, GameLinkService) {
  54. var vm = this,
  55. splashPageTimeout = 2e3;
  56. $scope.GameInfo = {}, $scope.ShowClassModule = !1, $scope.ErrorGameLinkID = !0, $scope.Loading = !0, $scope.Status = "Loading Game...", $scope.Initialize = function() {
  57. GameLinkService.getInfo($stateParams.gamelinkid || $localStorage.GameLinkID, function(response) {
  58. $scope.GameInfo = response, $scope.Loading = !1, $scope.ShowClassModule = !0, $scope.ErrorGameLinkID = !1, setTimeout($scope.splashOut, splashPageTimeout)
  59. }, function(response) {
  60. log(response), $scope.Loading = !1, $scope.Status = "Game link ID not found", setTimeout($scope.splashOut, splashPageTimeout)
  61. })
  62. }, vm.validateInput = function(model, type) {
  63. var _class = "";
  64. switch (type) {
  65. case "text":
  66. 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");
  67. break;
  68. case "radioCheck":
  69. case "email":
  70. model.$viewValue && model.$viewValue.length > 0 ? _class = model.$error.required || model.$error[type] ? "active error" : "active" : model.$dirty && (_class = "active error");
  71. break;
  72. case "password":
  73. model.$viewValue && model.$viewValue.length > 0 ? _class = model.$error.required || model.$error.complexity || model.$error.complexity ? "active error" : "active" : model.$dirty && (_class = "active error");
  74. break;
  75. case "confirmPassword":
  76. model.$viewValue && model.$viewValue.length > 0 ? _class = model.$error.required || model.$error[type] || model.$error.passwordMatch ? "active error" : "active" : model.$dirty && (_class = "active error")
  77. }
  78. return _class
  79. }, $scope.validateInput = function(model, type) {
  80. return vm.validateInput(model, type)
  81. }, $scope.showError = function(model, property) {
  82. return model.$submitted || model[property].$dirty
  83. }, $scope.richInputInit = function() {
  84. $(".rich-input__inp").off("focus blur").on("focus blur", function(e) {
  85. var $this = $(this),
  86. $ri = $this.parents(".rich-input");
  87. $ri.toggleClass("active", "focus" === e.type || this.value.length > 0)
  88. }).trigger("blur")
  89. }, $scope.sliderInit = function() {
  90. var $slider = $(".login-gslot__group"),
  91. centerMode = !1,
  92. itemCount = $slider.find(".login-gslot__item").length;
  93. return $(window).width() > 992 && itemCount > 5 && (centerMode = !0), $slider.slick({
  94. slidesToShow: 5,
  95. arrows: !1,
  96. initialSlide: 0,
  97. focusOnSelect: !0,
  98. dots: !0,
  99. swipeToSlide: !0,
  100. centerMode: centerMode,
  101. responsive: [{
  102. breakpoint: 992,
  103. settings: {
  104. slidesToShow: 3,
  105. centerMode: !0
  106. }
  107. }, {
  108. breakpoint: 480,
  109. settings: {
  110. slidesToShow: 1,
  111. centerMode: !0
  112. }
  113. }]
  114. }), {
  115. slider: $slider
  116. }
  117. }, $scope.splashOut = function() {
  118. $(".screen-b").addClass("fade-out"), $(".screen-a").removeClass("hidden-screen"), $(".screen-a").addClass("show-in"), setTimeout(function() {
  119. $(".screen-b").remove()
  120. }, 900)
  121. }, $scope.Initialize()
  122. }
  123.  
  124. function AuthCreateUserController($scope, $localStorage, $location, $stateParams, GameLinkService, AuthenticationService) {
  125. $scope.$parent.richInputInit();
  126. var vm = this;
  127. vm.CreateUser = {}, vm.UserDetails = {}, vm.SuccessView = !1, vm.FailedRegistration = {
  128. State: !1,
  129. Messages: {}
  130. }, log($localStorage.GameLinkID), vm.CreateAccount = function() {
  131. 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) {
  132. vm.SuccessView = !0, dataLayer.push({
  133. event: "user action",
  134. userAction: "account creation"
  135. })
  136. }, function(response) {
  137. log(response), 400 === response.status ? (vm.FailedRegistration.State = !0, vm.FailedRegistration.Messages = {
  138. Message: response.data.Message,
  139. ModelStates: response.data.ModelState[""]
  140. }) : (vm.FailedRegistration.State = !0, vm.FailedRegistration.Messages = {
  141. Message: response.status + " " + response.statusText
  142. })
  143. })
  144. }, vm.UpdateFields = function() {
  145. vm.FailedRegistration.State = !1
  146. }, vm.ReturnToLogin = function() {
  147. $location.path("auth/login/" + $localStorage.GameLinkID)
  148. }
  149. }
  150.  
  151. function AuthLoginController($scope, $location, $stateParams, $localStorage, AuthenticationService, GameLinkService) {
  152. $scope.$parent.richInputInit();
  153. var vm = this;
  154. vm.UserLogin = {}, vm.UserDetails = {}, vm.LoginFailed = !1, vm.GamelinkID = $localStorage.GameLinkID, vm.registerGameLinkSuccess = function(res) {
  155. GameLinkService.get($stateParams.gamelinkid, function(res) {
  156. dataLayer.push({
  157. event: "VirtualPageview",
  158. virtualPageURL: "/game-play",
  159. userId: $localStorage.GameLink.UserID
  160. }), $location.path("/auth/game")
  161. }, function(response) {
  162. vm.LoginFailMessage = response.Message, vm.LoginFailed = !0, log(response)
  163. })
  164. }, vm.registerGameLinkFail = function(response) {
  165. 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
  166. }, vm.requestTokenSuccess = function() {
  167. GameLinkService.register($stateParams.gamelinkid, vm.registerGameLinkSuccess, vm.registerGameLinkFail)
  168. }, vm.requestTokenFail = function(response) {
  169. log(response), 400 === response.status ? vm.LoginFailMessage = response.data.error_description : vm.LoginFailMessage = response.status + " " + response.statusText, vm.LoginFailed = !0
  170. }, vm.login = function() {
  171. AuthenticationService.requestToken(vm.UserDetails.UserEmail, vm.UserDetails.LoginPassword, vm.requestTokenSuccess, vm.requestTokenFail)
  172. }
  173. }
  174.  
  175. function AuthRecoveryController($scope, $location, $localStorage, $stateParams, GameLinkService, AuthenticationService) {
  176. $scope.$parent.richInputInit(), $scope.ShowClassModule = !1;
  177. var vm = this;
  178. vm.RecoveryForm = {}, vm.UserDetails = {}, vm.RecoverySent = {
  179. State: !1,
  180. Error: !1
  181. }, vm.ReturnToLoginState = !1, vm.SendRecoveryPassword = function() {
  182. log(vm.UserDetails), AuthenticationService.sendResetPassword(vm.UserDetails.RecoveryEmail, $location.protocol() + "://" + location.host + "/#/auth/password-reset", function(response) {
  183. vm.RecoverySent.State = !0
  184. }, function(error) {
  185. vm.RecoverySent.Error = !0
  186. })
  187. }, vm.GoBack = function() {
  188. vm.RecoverySent.Error = !1
  189. }, vm.ReturnToLogin = function() {
  190. $location.path("/auth/login/" + $localStorage.GameLinkID)
  191. }
  192. }
  193.  
  194. function PasswordResetController($scope, $stateParams, $localStorage, AuthenticationService) {
  195. $scope.$parent.richInputInit(), $scope.$parent.ShowClassModule = !1, $scope.$parent.ErrorGameLinkID = !1, $scope.$parent.Loading = !1;
  196. var vm = this;
  197. vm.PasswordReset = {}, vm.UserDetails = {}, vm.setPasswordSuccess = !1, vm.CreateNewPassword = function() {
  198. 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) {
  199. log(response), vm.setPasswordSuccess = !0
  200. }, function(error) {
  201. log(error)
  202. })
  203. }
  204. }
  205.  
  206. function AuthSelectGameController($scope, $localStorage, $location, $stateParams, GameLinkService, GameInstancesService, MessageService) {
  207. var vm = this;
  208. vm.GameInstances = [], vm.SelectedGame = [], vm.UserName = $localStorage.GameLinkID ? $localStorage.GameLink.Name : "", vm.LoadingGame = !1, $(".screen-a").removeClass("mark"), GameLinkService.get($localStorage.GameLinkID, function(res) {
  209. if ($localStorage.GameLink)
  210. for (var i = 0; i < $localStorage.GameLink.MaxGames; i++) {
  211. var currentGame = $localStorage.GameLink.GameInstances[i],
  212. game = {};
  213. currentGame && (game = currentGame, game.IsGameComplete = 27 == game.CurrentWeek);
  214. var game = currentGame ? currentGame : {};
  215. vm.GameInstances.push(game)
  216. }
  217. }, function(response) {
  218. log(response)
  219. }), $scope.$on("ngRepeatFinished", function() {
  220. var $slider = $scope.$parent.sliderInit().slider;
  221. vm.SelectedGame = vm.GameInstances[0], log(vm.SelectedGame), $slider.on("beforeChange", function(event, slick, currentSlide, nextSlide) {
  222. vm.SelectedGame = vm.GameInstances[nextSlide]
  223. })
  224. }), vm.SetGame = function(gameid) {
  225. vm.SelectedGame = vm.GameInstances[gameid]
  226. }, vm.LoadApps = function(GameInstanceID) {
  227. $localStorage.GameInstanceID = GameInstanceID, GameInstancesService.apps(function(apps) {
  228. log(apps), GameInstancesService.startWeek(function(data) {
  229. log(data), $location.path("app/dashboard/view")
  230. }, function(message) {
  231. vm.LoadingGame = !1, log(message)
  232. })
  233. }, function(messages) {
  234. MessageService.showMessage({
  235. content: messages[0]
  236. })
  237. })
  238. }, vm.CreateGame = function() {
  239. GameInstancesService.createGame(function(GameInstanceID) {
  240. vm.LoadApps(GameInstanceID)
  241. }, function(message) {
  242. vm.LoadingGame = !1, log(message)
  243. })
  244. }, vm.LoadGame = function() {
  245. if (!vm.LoadingGame) {
  246. vm.LoadingGame = !0, log(vm.SelectedGame.ID);
  247. var gameNumber = $(".slick-current").find(".js-gameblock").data("game-number"),
  248. gameState = "continue game";
  249. "undefined" != typeof vm.SelectedGame.ID ? vm.LoadApps(vm.SelectedGame.ID) : (vm.CreateGame(), gameState = "start new game"), $localStorage.GameNumber = gameNumber, dataLayer.push({
  250. event: "game selection",
  251. gameState: gameState,
  252. gameNumber: "game " + gameNumber
  253. })
  254. }
  255. }
  256. }
  257.  
  258. function DashboardController($scope, GameInstancesService, utils, FinancialInstanceService, $rootScope, DashboardService) {
  259. function gameApplications() {
  260. vm.barWidth = {
  261. width: GameInstancesService.getProgressBarPercent()
  262. }, vm.NetWorth = GameInstancesService.getNetWorth();
  263. var AppModel = [],
  264. AppURLs = appConfig.gameApps;
  265. vm.buildURL = function(instance) {
  266. var appUrl = AppURLs.filter(function(url) {
  267. return url.application === instance.Name
  268. });
  269. appUrl && appUrl.length && AppModel.push(angular.extend({}, instance, {
  270. url: appUrl[0].url,
  271. priority: appUrl[0].priority,
  272. mobilePriority: appUrl[0].mobilePriority,
  273. displayName: appUrl[0].displayName,
  274. state: appUrl[0].state,
  275. active: !1
  276. }))
  277. }, GameInstancesService.apps(function(response) {
  278. response.forEach(vm.buildURL), vm.GameApplications = AppModel, DashboardService.setGameApps(vm.GameApplications)
  279. }, function(response) {
  280. logError("fail", response)
  281. })
  282. }
  283.  
  284. function updateAppModelState(data) {
  285. GameInstancesService.setConfigAppState(data.application, data.state);
  286. 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);
  287. DashboardService.setGameApps(vm.GameApplications)
  288. }
  289. var vm = this;
  290. vm.NetWorth, vm.GameApplications = [], vm.CurrentWeek = GameInstancesService.getCurrentWeek(), vm.barWidth = {
  291. width: GameInstancesService.getProgressBarPercent()
  292. }, gameApplications(), $rootScope.$on("ResetActiveApp", function() {
  293. for (var i = 0; i < vm.GameApplications.length; i++) vm.GameApplications[i].active = !1
  294. }), $scope.$on("CurrentWeekUpdated", function(event, currentWeek) {
  295. vm.CurrentWeek = currentWeek, gameApplications()
  296. }), $scope.$on("UpdateNotifications", function() {
  297. GameInstancesService.apps(function(response) {
  298. response.forEach(function(instance) {
  299. 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")
  300. }), DashboardService.setGameApps(vm.GameApplications)
  301. }, function(response) {
  302. logError("fail", response)
  303. })
  304. }), vm.FinishWeekClicked = function() {
  305. $scope.$emit("FinishWeek")
  306. }, vm.whereImAtClicked = function(location) {
  307. logError("whereImAtClicked"), utils.navigateRoute($scope, location, "appOpen")
  308. }, $scope.$on("AppIconStateUpdate", function(event, data) {
  309. updateAppModelState(data)
  310. }), $scope.$on("NetWorthUpdated", function(event, networth) {
  311. vm.NetWorth = networth
  312. })
  313. }
  314.  
  315. function WhereImAtController($scope, utils, WhereImAtService, GameInstancesService, $rootScope, GameMediaService) {
  316. var vm = this;
  317. 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 = {
  318. MyCash: {
  319. ShowMobile: !0,
  320. Icon: "icon-my-cash",
  321. Title: "My cash",
  322. Balance: 0,
  323. Visible: !1
  324. },
  325. MyBank: {
  326. ShowMobile: !0,
  327. Icon: "icon-bank",
  328. Title: "My bank",
  329. Balance: 0,
  330. Visible: !1
  331. },
  332. Shares: {
  333. ShowMobile: !0,
  334. Icon: "icon-investment",
  335. Title: "Shares",
  336. Balance: 0,
  337. Visible: !1
  338. },
  339. MyStuff: {
  340. ShowMobile: !0,
  341. Icon: "icon-stuff",
  342. Title: "My Stuff",
  343. Balance: 0,
  344. Visible: !1
  345. },
  346. Superannuation: {
  347. ShowMobile: !0,
  348. Icon: "icon-superannuation",
  349. Title: "Superannuation",
  350. Balance: 0,
  351. Visible: !1
  352. },
  353. Survey: {
  354. ShowMobile: !0,
  355. Icon: "icon-survey",
  356. Title: "End of Game Quiz",
  357. Balance: 0,
  358. Visible: !1
  359. }
  360. }, vm.LiabilitiesBreakdown = {
  361. MyCredit: {
  362. ShowMobile: !0,
  363. Icon: "icon-credit-card",
  364. Title: "My credit",
  365. Balance: 0,
  366. Visible: !1
  367. },
  368. Bills: {
  369. ShowMobile: !0,
  370. Icon: "icon-dollar-sign",
  371. Title: "Outstanding bills",
  372. Balance: 0,
  373. Visible: !1
  374. }
  375. }, vm.Initialize = function() {
  376. GameInstancesService.checkEndGameSurvey(function(data) {
  377. data.HasEndSurvey && (vm.NetPositionTitle = "SUNCORP ESSI MONEY CHALLENGE NET POSITION")
  378. }, function(data) {
  379. Log(data)
  380. }), WhereImAtService.getProgress(function(data) {
  381. vm.ProgressObg = data.Results, vm.AssetsBreakdown.MyBank.Balance = 0;
  382. var netP = 0;
  383. vm.ProgressObg.forEach(function(arrayElem) {
  384. netP += arrayElem.Balance
  385. }), vm.NetPosition = netP, GameInstancesService.setNetWorth(vm.NetPosition), vm.ProgressObg.forEach(function(arrayElem) {
  386. "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)
  387. });
  388. var tempAssetsBreakdown = vm.AssetsBreakdown;
  389. vm.AssetsBreakdown = {}, angular.forEach(tempAssetsBreakdown, function(value, key) {
  390. value.Visible && (vm.AssetsBreakdown[key] = value)
  391. })
  392. }, function(data) {
  393. log(data)
  394. })
  395. }, vm.PanelClicked = function() {
  396. vm.PanelOpen = !vm.PanelOpen, vm.PanelOpen ? vm.PanelBtnText = "Hide" : vm.PanelBtnText = "Show"
  397. }, vm.ExitGame = function() {
  398. utils.navigateRoute($scope, "/auth/game", "next")
  399. }, $rootScope.$on("UpdateWhereImAt", function() {
  400. vm.Initialize()
  401. }), vm.Initialize()
  402. }
  403.  
  404. function BankIndexController($scope, $filter, FinancialInstanceService, utils, MessageService, BankingInstanceService, GameInstancesService) {
  405. var vm = this;
  406. vm.BankAccounts = [], vm.InvestmentAccounts = [], vm.BankingAppInstance = {}, vm.Initialize = function() {
  407. FinancialInstanceService.getAccountSources("Banking", function(accounts) {
  408. vm.BankAccounts = accounts
  409. }, function(messages) {
  410. MessageService.showMessage({
  411. content: messages[0]
  412. })
  413. }), BankingInstanceService.getInvestmentAccounts(function(accounts) {
  414. vm.InvestmentAccounts = accounts, log(vm.InvestmentAccounts)
  415. }, function(messages) {
  416. MessageService.showMessage({
  417. content: messages[0]
  418. })
  419. }), GameInstancesService.apps(function(apps) {
  420. $filter("filter")(apps, function(i) {
  421. if ("Banking" == i.Name) return i
  422. })
  423. }, function(messages) {
  424. MessageService.showMessage({
  425. content: messages[0]
  426. })
  427. })
  428. }, vm.Initialize(), vm.TriggerTransition = function(location) {
  429. utils.navigateRoute($scope, location, "next")
  430. }
  431. }
  432.  
  433. function BankOpenAccountController($scope, $stateParams, GameBankingService, CashboxInstanceService, BankingInstanceService, $window, utils, MessageService, GameInstancesService) {
  434. function createAccount(transferAmount) {
  435. $scope.$broadcast("ShowTransferLoading"), BankingInstanceService.create(AccountID, vm.SelectModel.Selected.AppInstanceID, vm.SelectModel.Selected.ID, transferAmount, function(accountID) {
  436. $scope.$broadcast("ShowTransferSuccess")
  437. }, function(messages) {
  438. $scope.$broadcast("ResetTransferButton"), MessageService.showMessage({
  439. content: messages[0]
  440. })
  441. })
  442. }
  443. var vm = this,
  444. AccountID = $stateParams.id;
  445. vm.Account = null, vm.TransferValue = 0, vm.SelectModel = {}, vm.SelectModel.Options = [], vm.SelectModel.Selected = [], vm.message = {}, vm.Initialize = function() {
  446. vm.OpenAccount = vm.OpenAccount, vm.LoadBankAccountType($stateParams.id), vm.CreateSourceOptions()
  447. }, vm.LoadBankAccountType = function(ID) {
  448. GameBankingService.get(function(banks) {
  449. vm.Account = banks.filter(function(e) {
  450. return e.ID === ID
  451. })[0], vm.TransferValue = vm.Account.MinimumBalance
  452. }, function(messages) {
  453. vm.message = MessageService.showMessage({
  454. content: messages
  455. })
  456. })
  457. }, vm.CreateSourceOptions = function() {
  458. vm.AddCashbox(), vm.GetBanks(vm.AddBanks)
  459. }, vm.AddCashbox = function() {
  460. CashboxInstanceService.get(function(data) {
  461. angular.extend(data, {
  462. AppInstanceID: utils.getInstanceAppID("Cashbox")
  463. }), vm.SelectModel.Options = vm.SelectModel.Options.concat([data])
  464. }, function(messages) {
  465. vm.message = MessageService.showMessage({
  466. content: messages
  467. })
  468. })
  469. }, vm.GetBanks = function(callback) {
  470. BankingInstanceService.get(function(response) {
  471. callback(response)
  472. }, function(messages) {
  473. vm.message = MessageService.showMessage({
  474. content: messages
  475. })
  476. })
  477. }, vm.AddBanks = function(data) {
  478. log(">> AddBanks");
  479. var bankingInstanceID = utils.getInstanceAppID("Banking"),
  480. banks = [];
  481. angular.forEach(data, function(value) {
  482. banks.push(angular.extend({}, value, {
  483. AppInstanceID: bankingInstanceID
  484. }))
  485. }), vm.SelectModel.Options = vm.SelectModel.Options.concat(banks), vm.SelectModel.Options.unshift({
  486. ID: "0",
  487. Title: " [Select Account] ",
  488. Balance: 0
  489. }), vm.SelectModel.Selected = vm.SelectModel.Options[0]
  490. }, vm.OpenAccount = function() {
  491. var transferAmount = vm.TransferValue;
  492. 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({
  493. event: "app",
  494. appSelected: "my bank",
  495. appAction: "open account"
  496. }), createAccount(transferAmount)) : vm.message = MessageService.showMessage({
  497. content: "Error: not enough money in deposit account"
  498. }) : vm.message = MessageService.showMessage({
  499. content: "Error: not enough money for the minimum balance"
  500. }) : 0 === vm.Account.MinimumBalance ? (dataLayer.push({
  501. event: "app",
  502. appSelected: "my bank",
  503. appAction: "open account"
  504. }), createAccount(transferAmount)) : vm.message = MessageService.showMessage({
  505. content: "Error: please select an account"
  506. })
  507. }, vm.cancelClicked = function() {
  508. utils.navigateRoute($scope, "", "back")
  509. }, $scope.$on("TransactionComplete", function() {
  510. GameInstancesService.setConfigAppState("Banking", "idle"), utils.navigateRoute($scope, "/app/dashboard/banking", "back")
  511. }), vm.Initialize()
  512. }
  513.  
  514. function ChooseBankAccountController($scope, GameBankingService, utils, $filter, FinancialInstanceService, MessageService, $timeout) {
  515. function setupSlider() {
  516. vm.slickConfig = {
  517. data: vm.BankOptions,
  518. adaptiveHeight: !1,
  519. arrows: !1,
  520. infinite: !1,
  521. enabled: !0,
  522. method: {},
  523. event: {
  524. init: function(event, slick) {
  525. vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), setTimeout(function() {
  526. slick.resize()
  527. }, 400)
  528. },
  529. afterChange: function(event, slick, currentSlide, nextSlide) {
  530. vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
  531. }
  532. }
  533. }
  534. }
  535. var vm = this;
  536. vm.BankOptions = [], vm.currentSlide = 1, vm.totalSlides = 1, vm.nextDisabled = !1, vm.prevDisabled = !0, vm.hasTransactionAccount = !1, vm.Initialize = function() {
  537. GameBankingService.get(function(accounts) {
  538. vm.PushBanksToOptions(accounts)
  539. }, function(messages) {
  540. log(messages)
  541. })
  542. }, vm.PushBanksToOptions = function(banks) {
  543. angular.forEach(banks, function(value) {
  544. 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)
  545. }), vm.getCurrentAccounts()
  546. }, vm.getCurrentAccounts = function() {
  547. FinancialInstanceService.getAccountSources("Banking", function(accounts) {
  548. var transactionAccounts = accounts.filter(function(e) {
  549. return "TransactionsBankAccountInstance" === e.AccountType
  550. });
  551. transactionAccounts.length > 0 && (vm.hasTransactionAccount = !0), setupSlider()
  552. }, function(messages) {
  553. MessageService.showMessage({
  554. content: messages[0]
  555. })
  556. })
  557. }, vm.getIcon = function(type) {
  558. return utils.getAccountTypeIcon(type)
  559. }, vm.OpenAccount = function(location) {
  560. utils.navigateRoute($scope, location, "next")
  561. }, $scope.$on("StartNavigateRoute", function() {
  562. vm.slickConfig.method.slickGoTo(0, !0)
  563. }), vm.Initialize()
  564. }
  565.  
  566. function AccountStatementController($scope, $stateParams, BankingInstanceService, FinancialInstanceService, utils, MessageService, $location) {
  567. function acceptCallback() {
  568. BankingInstanceService.close(vm.Account.ID, vm.nextAccount.ID, function(response) {
  569. dataLayer.push({
  570. event: "app",
  571. appSelected: "my bank",
  572. appAction: "close bank account"
  573. }), utils.navigateRoute($scope, "", "back")
  574. }, function(messages) {
  575. MessageService.showMessage({
  576. content: messages[0]
  577. })
  578. })
  579. }
  580.  
  581. function declineCallback() {}
  582. var vm = this;
  583. vm.CanClose = !1, vm.Account = null, vm.Weeks = {};
  584. var Accounts = null,
  585. transactionAccounts = [];
  586. vm.Initialize = function() {
  587. vm.load($stateParams.id)
  588. }, vm.load = function(accountID) {
  589. var transactions = function(bankingAppID, accountID) {
  590. FinancialInstanceService.transactions(bankingAppID, accountID, function(transactions) {
  591. vm.Weeks = utils.orderTransactionsArr(transactions), $scope.$emit("RefreshWebKitScrolling")
  592. }, function(messages) {
  593. log(messages)
  594. })
  595. };
  596. $location.path().indexOf("investment") !== -1 ? BankingInstanceService.getInvestmentAccounts(function(accounts) {
  597. vm.Account = accounts.filter(function(e) {
  598. return e.ID === accountID
  599. })[0], transactions(vm.Account.AppInstanceID, vm.Account.ID), log(vm.Account)
  600. }, function(messages) {
  601. MessageService.showMessage({
  602. content: messages
  603. })
  604. }) : BankingInstanceService.get(function(accounts) {
  605. Accounts = accounts, transactionAccounts = accounts.filter(function(e) {
  606. return "TransactionsBankAccountInstance" === e.AccountType && e.ID !== accountID
  607. }), transactionAccounts.length > 0 && ($scope.CanClose = !0), vm.Account = accounts.filter(function(e) {
  608. return e.ID === accountID
  609. })[0], log(vm.Account), transactions(vm.Account.AppInstanceID, vm.Account.ID)
  610. }, function(messages) {
  611. MessageService.showMessage({
  612. content: messages
  613. })
  614. })
  615. }, vm.CloseAccount = function($event, accountID) {
  616. $scope.CanClose ? (vm.nextAccount = transactionAccounts[0], MessageService.showConfirm({
  617. 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",
  618. acceptFn: acceptCallback,
  619. declineFn: declineCallback
  620. })) : MessageService.showMessage({
  621. content: "Error: You must have at least one active bank account"
  622. })
  623. }, vm.transferClicked = function() {
  624. utils.navigateRoute($scope, "/app/dashboard/transfer/banking/" + vm.Account.ID, "next")
  625. }, vm.transferInvestmentClicked = function() {
  626. utils.navigateRoute($scope, "/app/dashboard/transfer/investment/" + vm.Account.ID, "next")
  627. }, vm.Initialize()
  628. }
  629.  
  630. function ChooseInvestmentsController($scope, FinancialInstanceService, utils, MessageService, GameBankingService, $filter) {
  631. function setupSlider() {
  632. vm.slickConfig = {
  633. data: vm.InvestmentOptions,
  634. adaptiveHeight: !1,
  635. arrows: !1,
  636. infinite: !1,
  637. enabled: !0,
  638. method: {},
  639. event: {
  640. init: function(event, slick) {
  641. vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), setTimeout(function() {
  642. slick.resize()
  643. }, 400)
  644. },
  645. afterChange: function(event, slick, currentSlide, nextSlide) {
  646. vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
  647. }
  648. }
  649. }
  650. }
  651. var vm = this;
  652. vm.InvestmentOptions = [], vm.currentSlide = 1, vm.totalSlides = 1, vm.nextDisabled = !1, vm.prevDisabled = !0, vm.Initialize = function() {
  653. GameBankingService.getInvestmentAccounts(function(accounts) {
  654. log(accounts), accounts = accounts.filter(function(e) {
  655. return "GameFixedTermDepositInvestment" == e.AccountType
  656. }), vm.PushBanksToOptions(accounts)
  657. }, function(messages) {
  658. log(messages)
  659. })
  660. }, vm.PushBanksToOptions = function(banks) {
  661. angular.forEach(banks, function(value) {
  662. value.InterestRate = parseFloat(100 * value.InterestRate).toFixed(2), vm.InvestmentOptions.push(value)
  663. }), vm.getCurrentAccounts()
  664. }, vm.getCurrentAccounts = function() {
  665. FinancialInstanceService.getAccountSources("Banking", function(accounts) {
  666. var transactionAccounts = accounts.filter(function(e) {
  667. return "TransactionsBankAccountInstance" === e.AccountType
  668. });
  669. transactionAccounts.length > 0 && (vm.hasTransactionAccount = !0), setupSlider()
  670. }, function(messages) {
  671. MessageService.showMessage({
  672. content: messages[0]
  673. })
  674. })
  675. }, vm.OpenAccount = function(location) {
  676. utils.navigateRoute($scope, location, "next")
  677. }, $scope.$on("StartNavigateRoute", function() {
  678. vm.slickConfig.method.slickGoTo(0, !0)
  679. }), $scope.redrawSlider = function() {}, vm.Initialize()
  680. }
  681.  
  682. function OpenInvestmentAccountController($scope, $stateParams, GameBankingService, CashboxInstanceService, BankingInstanceService, $window, utils, MessageService) {
  683. var vm = this,
  684. AccountID = $stateParams.id;
  685. vm.Account = null, vm.TransferValue = 0, vm.SelectModel = {}, vm.SelectModel.Options = [], vm.SelectModel.Selected = [], vm.message = {}, vm.Initialize = function() {
  686. vm.OpenAccount = vm.OpenAccount, vm.LoadBankAccountType($stateParams.id), vm.CreateSourceOptions()
  687. }, vm.LoadBankAccountType = function(ID) {
  688. GameBankingService.getInvestmentAccounts(function(banks) {
  689. vm.Account = banks.filter(function(e) {
  690. return e.ID === ID
  691. })[0], vm.TransferValue = vm.Account.MinimumBalance
  692. }, function(messages) {})
  693. }, vm.CreateSourceOptions = function() {
  694. vm.GetBanks(vm.AddBanks)
  695. }, vm.GetBanks = function(callback) {
  696. BankingInstanceService.get(function(response) {
  697. response && response.length && callback(response)
  698. }, function(messages) {
  699. log(messages)
  700. })
  701. }, vm.AddBanks = function(data) {
  702. var bankingInstanceID = utils.getInstanceAppID("Banking"),
  703. banks = [];
  704. angular.forEach(data, function(value) {
  705. banks.push(angular.extend({}, value, {
  706. AppInstanceID: bankingInstanceID
  707. }))
  708. }), vm.SelectModel.Options = vm.SelectModel.Options.concat(banks), vm.SelectModel.Options.unshift({
  709. ID: "0",
  710. Title: " [Select Account] "
  711. }), vm.SelectModel.Selected = vm.SelectModel.Options[0]
  712. }, vm.OpenAccount = function() {
  713. var transferAmount = vm.TransferValue;
  714. if ("0" !== vm.SelectModel.Selected.ID)
  715. if (parseFloat(transferAmount) <= parseFloat(vm.SelectModel.Selected.Balance)) {
  716. log(">> ", transferAmount), $scope.$broadcast("ShowTransferLoading");
  717. var data = {
  718. GameAccountID: AccountID,
  719. TransferFromGameAppInstanceID: vm.SelectModel.Selected.AppInstanceID,
  720. TransferFromAccountInstanceID: vm.SelectModel.Selected.ID,
  721. Amount: transferAmount
  722. };
  723. BankingInstanceService.createInvestmentAccount(data, function(accountID) {
  724. $scope.$broadcast("ShowTransferSuccess")
  725. }, function(messages) {
  726. $scope.$broadcast("ResetTransferButton"), MessageService.showMessage({
  727. content: messages
  728. })
  729. }), dataLayer.push({
  730. event: "app",
  731. appSelected: "my bank",
  732. appAction: "invest"
  733. })
  734. } else vm.message = MessageService.showMessage({
  735. content: "Error: not enough money in deposit account"
  736. });
  737. else vm.message = MessageService.showMessage({
  738. content: "Error: please select an account"
  739. })
  740. }, vm.cancelClicked = function() {
  741. utils.navigateRoute($scope, "", "back")
  742. }, $scope.$on("TransactionComplete", function() {
  743. log("TransactionComplete"), utils.navigateRoute($scope, "/app/dashboard/banking", "back")
  744. }), vm.Initialize()
  745. }
  746.  
  747. function CashboxController($scope, FinancialInstanceService, $filter, utils, MessageService) {
  748. var vm = this;
  749. vm.Cashbox = {}, vm.Initialize = function() {
  750. FinancialInstanceService.getAccountSources(["Cashbox"], function(response) {
  751. var data = response[0];
  752. vm.Cashbox = {
  753. balance: $filter("currency")(data.Balance, "$", 2),
  754. id: data.ID
  755. }
  756. }, function(messages) {
  757. MessageService.showMessage({
  758. content: messages[0]
  759. })
  760. })
  761. }, vm.transferClicked = function() {
  762. utils.navigateRoute($scope, "/app/dashboard/transfer/cashbox/" + vm.Cashbox.id, "next")
  763. }, vm.Initialize()
  764. }
  765.  
  766. function TransferMoneyController($scope, $stateParams, $window, utils, FinancialInstanceService, $filter, MessageService, BankingInstanceService) {
  767. function UpdateToOptions() {
  768. vm.ToAccountOptions = vm.FromAccountOptions.filter(function(e) {
  769. return e.ID !== vm.FromAccountModel.selected.ID
  770. }), vm.ToAccountModel.selected = vm.ToAccountOptions[0]
  771. }
  772. var vm = this;
  773. vm.AccountOptions = [], vm.FromAccountModel = {}, vm.FromAccountOptions = [], vm.ToAccountModel = {}, vm.ToAccountOptions = [], vm.TransferValue, vm.AppBranding = {}, vm.UpdateToOptions = UpdateToOptions, vm.templateText = {
  774. title: "",
  775. buttonLabel: ""
  776. }, vm.Initialize = function() {
  777. "investment" === $stateParams.app && BankingInstanceService.getInvestmentAccounts(function(options) {
  778. vm.InvestmentOptions = options, log(vm.InvestmentOptions), vm.SetDefaults()
  779. }, function(messages) {
  780. MessageService.showMessage({
  781. content: messages[0]
  782. })
  783. }), FinancialInstanceService.getAccountSources(["Banking", "Cashbox"], function(options) {
  784. vm.AccountOptions = options, log(vm.AccountOptions), vm.SetDefaults()
  785. }, function(messages) {
  786. MessageService.showMessage({
  787. content: messages[0]
  788. })
  789. })
  790. }, vm.SetDefaults = function() {
  791. var DefaultID = null,
  792. accountsNoCashbox = vm.AccountOptions.filter(function(item) {
  793. if ("CashboxAccountInstance" != item.AccountType) return item
  794. });
  795. if (void 0 === $stateParams.app) vm.AppBranding = {
  796. HeaderTitle: "Transfer",
  797. Css: "transfer"
  798. };
  799. else switch ($stateParams.app) {
  800. case "banking":
  801. vm.AppBranding = {
  802. HeaderTitle: "My Bank",
  803. Css: "banking banking-transfer",
  804. Title: "Transfer Money",
  805. ButtonLabel: "Transfer",
  806. ShowAmount: !0
  807. }, vm.FromAccountOptions = accountsNoCashbox, vm.ToAccountOptions = accountsNoCashbox;
  808. break;
  809. case "investment":
  810. vm.AppBranding = {
  811. HeaderTitle: "My Bank",
  812. Css: "banking banking-transfer",
  813. Title: "Withdraw and Close",
  814. ButtonLabel: "Withdraw and Close",
  815. ShowAmount: !1
  816. }, vm.FromAccountOptions = vm.InvestmentOptions, vm.ToAccountOptions = accountsNoCashbox;
  817. break;
  818. case "cashbox":
  819. vm.AppBranding = {
  820. HeaderTitle: "My Cash",
  821. Css: "cashbox cashbox-transfer",
  822. Title: "Transfer Money",
  823. ButtonLabel: "Transfer",
  824. ShowAmount: !0
  825. }, vm.FromAccountOptions = vm.AccountOptions, vm.ToAccountOptions = accountsNoCashbox
  826. }
  827. void 0 === $stateParams.fromAccountID ? vm.FromAccountOptions.unshift({
  828. ID: "0",
  829. Title: " [Select Account] "
  830. }) : (DefaultID = $stateParams.fromAccountID, "banking" !== $stateParams.app ? (vm.FromAccountModel.selected = vm.FromAccountOptions.filter(function(e) {
  831. return e.ID === DefaultID
  832. })[0], vm.FromAccountOptions = [vm.FromAccountModel.selected], "investment" === $stateParams.app && (vm.TransferValue = vm.FromAccountModel.selected.Balance)) : (vm.FromAccountModel.selected = vm.FromAccountOptions.filter(function(e) {
  833. return e.ID === DefaultID
  834. })[0], vm.FromAccountOptions = vm.FromAccountOptions.filter(function(e) {
  835. return 0 !== e.ID
  836. }))), "banking" !== $stateParams.app ? vm.ToAccountOptions = vm.AccountOptions.filter(function(e) {
  837. return "0" === DefaultID || e.ID !== DefaultID && "TransactionsBankAccountInstance" === e.AccountType
  838. }) : vm.ToAccountOptions = accountsNoCashbox, 0 === vm.ToAccountOptions.length ? vm.ToAccountOptions.unshift({
  839. ID: "1",
  840. Title: " [You have no bank account] "
  841. }) : vm.ToAccountOptions.unshift({
  842. ID: "0",
  843. Title: " [Select Account] "
  844. }), vm.ToAccountModel.selected = vm.ToAccountOptions[0]
  845. }, vm.cancelClicked = function() {
  846. utils.navigateRoute($scope, "", "back")
  847. }, vm.transferComplete = function() {
  848. log(">>> ", $stateParams.app), "investment" == $stateParams.app ? utils.navigateRoute($scope, "/app/dashboard/banking", "back") : utils.navigateRoute($scope, "", "back")
  849. }, $scope.$on("TransactionComplete", vm.transferComplete), vm.Initialize();
  850. }
  851.  
  852. function TransferController($scope, $stateParams, FinancialInstanceService, utils, MessageService, $location) {
  853. function creditCardTransfer() {
  854. 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({
  855. content: "Error: Payment exceeds closing balance"
  856. }), !1)) : (vm.message = MessageService.showMessage({
  857. content: "Error: Payment does not meet minimum repayment amount"
  858. }), !1))
  859. }
  860. var vm = this;
  861. vm.parentVm = $scope.$parent, vm.isCreditCard = !1, vm.isFromCashAccount = "cashbox" === $stateParams.app, vm.isInvestmentUrl = $location.path().indexOf("investment") !== -1, vm.message = {}, vm.Initialize = function() {
  862. $scope.TransferFunds = this.TransferFunds
  863. }, vm.TransferFunds = function() {
  864. if (log(vm.parentVm.vm), "1" !== vm.parentVm.vm.ToAccountModel.selected.ID) {
  865. if (creditCardTransfer())
  866. if ("0" === vm.parentVm.vm.FromAccountModel.selected.ID || "0" === vm.parentVm.vm.ToAccountModel.selected.ID) vm.message = MessageService.showMessage({
  867. content: "Error: please select an account"
  868. });
  869. else {
  870. var data = {
  871. FromGameAppInstanceID: vm.parentVm.vm.FromAccountModel.selected.AppInstanceID,
  872. FromAccountInstanceID: vm.parentVm.vm.FromAccountModel.selected.ID,
  873. ToGameAppInstanceID: vm.parentVm.vm.ToAccountModel.selected.AppInstanceID,
  874. ToAccountInstanceID: vm.parentVm.vm.ToAccountModel.selected.ID,
  875. Amount: utils.currencyToNumber(vm.parentVm.vm.TransferValue)
  876. };
  877. 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() {
  878. vm.isCreditCard ? dataLayer.push({
  879. event: "app",
  880. appSelected: "my credit",
  881. appAction: "pay off credit card"
  882. }) : vm.isFromCashAccount ? dataLayer.push({
  883. event: "app",
  884. appSelected: "my cash",
  885. appAction: "transfer this money"
  886. }) : vm.isInvestmentUrl ? dataLayer.push({
  887. event: "app",
  888. appSelected: "my bank",
  889. appAction: "close investment"
  890. }) : dataLayer.push({
  891. event: "app",
  892. appSelected: "my bank",
  893. appAction: "transfer funds"
  894. }), $scope.$broadcast("ShowTransferSuccess")
  895. }, function(data) {
  896. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  897. content: data.Message
  898. })
  899. })) : vm.isCreditCard ? vm.message = MessageService.showMessage({
  900. content: "Error: Not enough funds in bank account"
  901. }) : vm.message = MessageService.showMessage({
  902. content: "Error: not enough money in deposit account"
  903. }) : vm.message = MessageService.showMessage({
  904. content: "Error: please enter amount"
  905. })
  906. }
  907. } else vm.message = MessageService.showMessage({
  908. content: "Error: you need a bank account to transfer money"
  909. })
  910. }, vm.Initialize()
  911. }
  912.  
  913. function PayCreditCtrl($scope, utils, FinancialInstanceService, i_creditCard, $filter, MessageService) {
  914. var vm = this;
  915. vm.AccountOptions = [], vm.FromAccountOptions = [], vm.FromAccountModel = {}, vm.ToAccountModel = {}, vm.TransferValue, vm.Initialize = function() {
  916. FinancialInstanceService.getAccountSources(["Banking"], function(options) {
  917. vm.AccountOptions = options, vm.AccountOptions = vm.AccountOptions.filter(function(e) {
  918. return "TransactionsBankAccountInstance" === e.AccountType
  919. }), vm.getCreditCard()
  920. }, function(messages) {
  921. MessageService.showMessage({
  922. content: messages[0]
  923. })
  924. })
  925. }, vm.getCreditCard = function() {
  926. i_creditCard.getGameInstanceCreditCard(function(data) {
  927. vm.ToAccountModel.selected = data, vm.ToAccountModel.selected.Type = "credit-card", vm.ToAccountModel.selected.AppInstanceID = utils.getInstanceAppID("Credit Cards"), vm.TransferValue = data.MinRepayAmount, vm.SetDefaults()
  928. }, function(messages) {
  929. MessageService.showMessage({
  930. content: messages[0]
  931. })
  932. })
  933. }, vm.SetDefaults = function() {
  934. vm.FromAccountOptions = vm.AccountOptions, vm.FromAccountOptions.unshift({
  935. ID: "0",
  936. Title: " [Select Account] "
  937. }), vm.FromAccountModel.selected = vm.FromAccountOptions[0]
  938. }, vm.cancelClicked = function() {
  939. utils.navigateRoute($scope, "", "back")
  940. }, $scope.$on("TransactionComplete", vm.cancelClicked), vm.Initialize()
  941. }
  942.  
  943. function SelectCardController($scope, g_creditCard, i_creditCard, FinancialInstanceService, utils, MessageService, $timeout) {
  944. function getBankOptions(callback) {
  945. function createBankOptions(response) {
  946. response.length < 1 ? vm.BankOptions = [{
  947. ID: "0",
  948. Title: "You have no bank account"
  949. }] : (vm.BankOptions = response, vm.BankOptions = vm.BankOptions.filter(function(e) {
  950. return "TransactionsBankAccountInstance" === e.AccountType
  951. }), vm.BankOptions.unshift({
  952. ID: "0",
  953. Title: " [Select Account] "
  954. }), HasBankAccount = !0), callback()
  955. }
  956.  
  957. function bankOptionsFailed(messages) {
  958. MessageService.showMessage({
  959. content: messages[0]
  960. })
  961. }
  962. FinancialInstanceService.getAccountSources(["Banking"], createBankOptions, bankOptionsFailed)
  963. }
  964.  
  965. function buildCCardOptions() {
  966. function buildOptionModel(card) {
  967. vm.BankOptionModel[card.ID] = {
  968. SelectedOption: vm.BankOptions[0]
  969. }
  970. }
  971.  
  972. function createCardOptions(response) {
  973. vm.CreditCardOptions = response.data.Results, vm.totalSlides = vm.CreditCardOptions.length, vm.CreditCardOptions.forEach(buildOptionModel), setupSlider()
  974. }
  975. g_creditCard.getGameCreditCards().success(createCardOptions)
  976. }
  977.  
  978. function setupSlider() {
  979. vm.slickConfig = {
  980. data: vm.CreditCardOptions,
  981. adaptiveHeight: !1,
  982. arrows: !1,
  983. infinite: !1,
  984. enabled: !0,
  985. method: {},
  986. event: {
  987. init: function(event, slick) {
  988. vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), slick.resize()
  989. },
  990. afterChange: function(event, slick, currentSlide, nextSlide) {
  991. log("change"), vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
  992. }
  993. }
  994. }
  995. }
  996. var vm = this,
  997. HasBankAccount = !1;
  998. 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) {
  999. if (HasBankAccount)
  1000. if ("0" !== vm.BankOptionModel[Card.ID].SelectedOption.ID)
  1001. if (vm.BankOptionModel[Card.ID].SelectedOption.Balance >= Card.Cost) {
  1002. var data = {
  1003. CreditCardID: Card.ID,
  1004. PurchasingBankAccountInstanceID: vm.BankOptionModel[Card.ID].SelectedOption.ID
  1005. };
  1006. $scope.$broadcast("ShowTransferLoading"), i_creditCard.createCreditCardInstance(data, function(accountID) {
  1007. $scope.$broadcast("ShowTransferSuccess")
  1008. }, function(messages) {
  1009. $scope.$broadcast("ResetTransferButton"), MessageService.showMessage({
  1010. content: messages[0]
  1011. })
  1012. }), dataLayer.push({
  1013. event: "app",
  1014. appSelected: "my credit",
  1015. appAction: "apply for credit card"
  1016. })
  1017. } else vm.message = MessageService.showMessage({
  1018. content: "Error: Not enough funds in selected account"
  1019. });
  1020. else vm.message = MessageService.showMessage({
  1021. content: "Error: please select an account"
  1022. });
  1023. else vm.message = MessageService.showMessage({
  1024. content: "Error: you need a bank account to open a Credit Card."
  1025. })
  1026. }, $scope.$on("TransactionComplete", function() {
  1027. utils.navigateRoute($scope, "/app/dashboard/creditcard", "next")
  1028. }), $scope.$on("StartNavigateRoute", function() {
  1029. vm.slickConfig.method.slickGoTo(0, !0)
  1030. })
  1031. }
  1032.  
  1033. function CardStatementController($scope, i_creditCard, FinancialInstanceService, utils, MessageService) {
  1034. function creditCard(callback) {
  1035. i_creditCard.getGameInstanceCreditCard(function(response) {
  1036. vm.ShowApp = !0, vm.CardAccount = response, callback()
  1037. }, function(messages) {
  1038. log(messages), utils.navigateRoute($scope, "/app/dashboard/creditcards", "appOpen")
  1039. })
  1040. }
  1041.  
  1042. function getTransactions() {
  1043. FinancialInstanceService.transactions(utils.getInstanceAppID("Credit Cards"), vm.CardAccount.ID, function(response) {
  1044. vm.Transactions = response, vm.Weeks = utils.orderTransactionsArr(vm.Transactions)
  1045. }, function(messages) {
  1046. MessageService.showMessage({
  1047. content: messages[0]
  1048. })
  1049. })
  1050. }
  1051. var vm = this;
  1052. vm.CardAccount = {}, vm.Transactions = {}, vm.Weeks = {}, vm.ShowApp = !1, creditCard(getTransactions), vm.makePayment = function() {
  1053. utils.navigateRoute($scope, "/app/dashboard/pay-credit", "next")
  1054. }
  1055. }
  1056.  
  1057. function EmailInboxController($scope, CommunicationsService, utils, $stateParams, EmailInstanceService) {
  1058. var vm = this;
  1059. 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");
  1060. var messageTypefilter = ["EmailInstance", "DebtCollectorEmailInstance", "EmploymentSubmissionEmailInstance", "PaySlipEmailInstance", "RandomEventEmailInstance", "iBuyItemForSaleEmailInstance"],
  1061. billsTypefilter = ["BillEmailInstance"],
  1062. mybankTypefilter = ["CreditCardStatementEmailInstance"];
  1063. vm.Initialize = function() {
  1064. vm.AllEmails = [], CommunicationsService.getInstances(vm.GameAppInstanceID, function(response) {
  1065. vm.Messages.list = response.Results.filter(function(e) {
  1066. return messageTypefilter.indexOf(e.CommunicationType) !== -1
  1067. }), vm.Bills.list = response.Results.filter(function(e) {
  1068. return billsTypefilter.indexOf(e.CommunicationType) !== -1
  1069. }), vm.Bank.list = response.Results.filter(function(e) {
  1070. return mybankTypefilter.indexOf(e.CommunicationType) !== -1
  1071. }), vm.Messages.notifications = vm.Messages.list.filter(function(e) {
  1072. return e.IsRead === !1
  1073. }).length, vm.Bills.notifications = vm.Bills.list.filter(function(e) {
  1074. return e.IsRead === !1
  1075. }).length, vm.Bank.notifications = vm.Bank.list.filter(function(e) {
  1076. return e.IsRead === !1
  1077. }).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")
  1078. }, function(data) {
  1079. log(data)
  1080. })
  1081. }, vm.ShowMessageList = function(listId) {
  1082. vm.SelectedBtn = listId, vm.MessageList = vm.AllEmails[listId].list;
  1083. for (var i = 0; i < vm.Butttons.length; i++) vm.Butttons[i] = 0;
  1084. vm.Butttons[listId] = 1, $scope.$broadcast("UpdateEmailListPosition")
  1085. }, vm.showOverlay = !1, vm.viewEmail = function(id) {
  1086. var currentEmail = vm.MessageList.filter(function(e) {
  1087. return e.ID === id
  1088. })[0];
  1089. CommunicationsService.storeCurrentCommunication(currentEmail), utils.navigateRoute($scope, "/app/dashboard/emails/mail/" + id + "/" + vm.SelectedBtn, "next")
  1090. }, this.Initialize()
  1091. }
  1092.  
  1093. function MailController($scope, CommunicationsService, $stateParams, utils, EmailInstanceService, GameMediaService, GameInstancesService, MessageService, $rootScope) {
  1094. function formatEmail() {
  1095. 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)
  1096. }
  1097.  
  1098. function loadEmailTemplate() {
  1099. var company = GameMediaService.get("companies", vm.Mail.From);
  1100. if (company !== !1 && (vm.Mail.EmailTemplateClass = company[1], vm.Mail.EmailTemplateImage = company[0]), "BillEmailInstance" === vm.Mail.CommunicationType && vm.Mail.Fees.length > 0) {
  1101. vm.Mail.LateFees = 0;
  1102. for (var i = 0; i < vm.Mail.Fees.length; i++) vm.Mail.LateFees += parseInt(vm.Mail.Fees[i].Amount);
  1103. vm.Mail.OriginalAmount = (parseInt(vm.Mail.Amount) - vm.Mail.LateFees) * -1, vm.Mail.LateFees = vm.Mail.LateFees * -1
  1104. }
  1105. }
  1106. var vm = this;
  1107. 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() {
  1108. switch (vm.currentEmail = CommunicationsService.getCurrentCommunication(), vm.currentEmail.CommunicationType) {
  1109. case "iBuyItemForSaleEmailInstance":
  1110. case "RandomEventEmailInstance":
  1111. case "EmailInstance":
  1112. vm.Mail = vm.currentEmail, formatEmail(), vm.emailTemplate = "app/emails/mail/email.tpl";
  1113. break;
  1114. case "BillEmailInstance":
  1115. vm.emailTemplate = "app/emails/mail/email-bill.tpl", vm.getEmailContent("getInstanceBillEmail", vm.currentEmail.ID);
  1116. break;
  1117. case "CreditCardStatementEmailInstance":
  1118. vm.emailTemplate = "app/emails/mail/email-credit-card-statement.tpl", vm.getEmailContent("getCreditCardStatementEmailInstance", vm.currentEmail.ID);
  1119. break;
  1120. case "DebtCollectorEmailInstance":
  1121. vm.emailTemplate = "app/emails/mail/email-debt-collector.tpl", vm.getEmailContent("getDebtCollectorEmailInstance", vm.currentEmail.ID);
  1122. break;
  1123. case "EmploymentSubmissionEmailInstance":
  1124. vm.emailTemplate = "app/emails/mail/email.tpl", vm.getPlainEmailContent(vm.currentEmail.ID);
  1125. break;
  1126. case "PaySlipEmailInstance":
  1127. vm.emailTemplate = "app/emails/mail/email-pay-slip.tpl", vm.getEmailContent("getPaySlipEmailInstance", vm.currentEmail.ID)
  1128. }
  1129. }, vm.getPlainEmailContent = function(emailID) {
  1130. CommunicationsService.getInstance(vm.GameAppInstanceID, emailID, function(response) {
  1131. vm.Mail = response, formatEmail()
  1132. }, function(errMsg) {
  1133. log(errMsg)
  1134. })
  1135. }, vm.getEmailContent = function(call, emailID) {
  1136. EmailInstanceService[call](emailID, function(response) {
  1137. vm.Mail = response, formatEmail(), loadEmailTemplate()
  1138. }, function(errMsg) {
  1139. log(errMsg)
  1140. })
  1141. }, vm.markRead = function() {
  1142. CommunicationsService.readInstance(vm.GameAppInstanceID, vm.CommunicationInstanceID, function(data) {
  1143. vm.ReadStatus = data, $rootScope.$broadcast("UpdateNotifications")
  1144. }, function(data) {
  1145. log(data)
  1146. })
  1147. }, vm.deleteEmail = function() {
  1148. CommunicationsService.deleteInstance(vm.GameAppInstanceID, vm.CommunicationInstanceID, function(data) {
  1149. vm.ReadStatus = data, utils.navigateRoute($scope, "/app/dashboard/emails/" + $stateParams.categoryID, "back")
  1150. }, function(data) {
  1151. log(data)
  1152. }), dataLayer.push({
  1153. event: "app",
  1154. appSelected: "email",
  1155. appAction: "delete email"
  1156. })
  1157. }, vm.payBill = function() {
  1158. utils.navigateRoute($scope, "/app/dashboard/emails/pay-bills/" + vm.CommunicationInstanceID, "next")
  1159. }, vm.acceptEmail = function() {
  1160. $scope.$broadcast("ShowTransferLoading"), CommunicationsService.actionInstance(vm.GameAppInstanceID, vm.Mail.ActionGameAppInstanceID, vm.Mail.ActionItemInstanceID, !0, function(data) {
  1161. log(data), $scope.$broadcast("ShowTransferSuccess")
  1162. }, function(data) {
  1163. MessageService.showMessage({
  1164. content: data
  1165. }), $scope.$broadcast("ResetTransferButton")
  1166. }), dataLayer.push({
  1167. event: "app",
  1168. appSelected: "email",
  1169. appAction: "accept offer"
  1170. })
  1171. }, $scope.$on("TransactionComplete", function(event, args) {
  1172. utils.navigateRoute($scope, "/app/dashboard/emails/" + $stateParams.categoryID, "back")
  1173. }), vm.Initialize()
  1174. }
  1175.  
  1176. function PayBillController($scope, $stateParams, utils, EmailInstanceService, GameMediaService, GameInstancesService, BillsInstanceService, FinancialInstanceService, MessageService) {
  1177. function loadEmailTemplate() {
  1178. var company = GameMediaService.get("companies", vm.Mail.From);
  1179. company !== !1 && (vm.Mail.EmailTemplateClass = company[1], vm.Mail.EmailTemplateImage = company[0]), vm.Mail.Username = GameInstancesService.getUser().username
  1180. }
  1181. var vm = this;
  1182. vm.CommunicationInstanceID = $stateParams.id, vm.FromAccountOptions = [], vm.FromAccountModel = {}, vm.AutoPay = 0, vm.message = "", this.Initialize = function() {
  1183. EmailInstanceService.getInstanceBillEmail(vm.CommunicationInstanceID, function(response) {
  1184. vm.Mail = response, loadEmailTemplate(), vm.getAccounts(), log(vm.Mail)
  1185. }, function(errMsg) {
  1186. log(errMsg)
  1187. })
  1188. }, vm.getAccounts = function() {
  1189. FinancialInstanceService.getPaymentSources(function(options) {
  1190. vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
  1191. ID: "0",
  1192. Title: " [Select Account] "
  1193. }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0], log(vm.FromAccountOptions)
  1194. }, function(messages) {
  1195. MessageService.showMessage({
  1196. content: messages[0]
  1197. })
  1198. })
  1199. }, vm.PayBill = function() {
  1200. 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) {
  1201. dataLayer.push({
  1202. event: "app",
  1203. appSelected: "email",
  1204. appAction: "pay bill"
  1205. }), $scope.$broadcast("ShowTransferSuccess")
  1206. }, function(messages) {
  1207. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  1208. content: messages[0]
  1209. })
  1210. })) : vm.message = MessageService.showMessage({
  1211. content: "Error: Not enough funds in selected account"
  1212. }) : vm.message = MessageService.showMessage({
  1213. content: "Error: please select an account"
  1214. })
  1215. }, vm.Cancel = function() {
  1216. utils.navigateRoute($scope, "", "back")
  1217. }, $scope.$on("TransactionComplete", function(event, args) {
  1218. utils.navigateRoute($scope, "", "back")
  1219. }), this.Initialize()
  1220. }
  1221.  
  1222. function TextMessageListController($scope, CommunicationsService, utils, GameMediaService, TextMessageService, $timeout) {
  1223. var vm = this;
  1224. vm.TextMessages, vm.SortedTextMessages = [], vm.GameAppInstanceID = utils.getInstanceAppID("Text Messages"), vm.Initialize = function() {
  1225. CommunicationsService.getInstances(vm.GameAppInstanceID, function(data) {
  1226. vm.TextMessages = data.Results, vm.SortedTextMessages = vm.TextMessages;
  1227. for (var i = 0; i < vm.SortedTextMessages.length; i++) vm.SortedTextMessages[i].Content = TextMessageService.replaceContentPlaceholders(vm.SortedTextMessages[i].Content);
  1228. vm.SortedTextMessages = TextMessageService.groupTextMessages(vm.SortedTextMessages)
  1229. }, function(data) {
  1230. log(data)
  1231. })
  1232. }, vm.groupIsRead = function(index) {
  1233. for (var i = 0; i < vm.SortedTextMessages[index].length; i++)
  1234. if (vm.SortedTextMessages[index][i].IsRead === !1) return !1;
  1235. return !0
  1236. }, vm.getProfileImage = function(from) {
  1237. return GameMediaService.get("textmessages", from)
  1238. }, vm.viewMessage = function(index) {
  1239. CommunicationsService.storeCurrentCommunication(vm.SortedTextMessages[index]), utils.navigateRoute($scope, "/app/dashboard/text-message/message", "next")
  1240. }, vm.Initialize()
  1241. }
  1242.  
  1243. function TextMessageController($scope, CommunicationsService, utils, GameMediaService, TextMessageService, $timeout, $rootScope) {
  1244. var vm = this;
  1245. 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() {
  1246. vm.Messages = CommunicationsService.getCurrentCommunication(), vm.MessagesSorted = TextMessageService.groupTextMessagesThreadByWeek(vm.Messages), $timeout(function() {
  1247. $(".app-screen__app").animate({
  1248. scrollTop: $(".app-screen__app")[0].scrollHeight
  1249. }, 500)
  1250. }, 700), vm.markRead()
  1251. }, vm.getProfileImage = function(from) {
  1252. return GameMediaService.get("textmessages", from)
  1253. }, vm.countUnread = 1, vm.unreadArrLength = 0, vm.unreadArr, vm.markRead = function(ActionableInstanceID) {
  1254. vm.countUnread = 0, vm.unreadArrLength = 0, vm.unreadArr = [];
  1255. for (var i = 0; i < vm.MessagesSorted.length; i++)
  1256. for (var c = 0; c < vm.MessagesSorted[i].length; c++) vm.MessagesSorted[i][c].IsRead || vm.unreadArr.push(vm.MessagesSorted[i][c].ID);
  1257. vm.unreadArrLength = vm.unreadArr.length, vm.unreadArrLength > 0 && vm.callReadAPI()
  1258. }, vm.callReadAPI = function() {
  1259. log(vm.GameAppInstanceID, vm.unreadArr[vm.countUnread]), CommunicationsService.readInstance(vm.GameAppInstanceID, vm.unreadArr[vm.countUnread], function(data) {
  1260. vm.ReadStatus = data, log(">> ", vm.countUnread == vm.unreadArrLength), vm.countUnread == vm.unreadArrLength - 1 ? (log("fire event"), $rootScope.$broadcast("UpdateNotifications")) : (vm.countUnread++, vm.callReadAPI())
  1261. }, function(data) {
  1262. log(data)
  1263. })
  1264. }, vm.updateAsActioned = function() {
  1265. 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)
  1266. }, vm.actionClicked = function(actionGameAppInstanceID, actionItemInstanceID, action) {
  1267. vm.actionResponse = action, vm.actionItemInstanceID = actionItemInstanceID, CommunicationsService.actionInstance(vm.GameAppInstanceID, actionGameAppInstanceID, actionItemInstanceID, action, function(data) {
  1268. vm.updateAsActioned(), vm.updateMessages()
  1269. }, function(data) {
  1270. log(data)
  1271. });
  1272. var appAction = "decline";
  1273. action && (appAction = "accept"), dataLayer.push({
  1274. event: "app",
  1275. appSelected: "messages",
  1276. appAction: appAction
  1277. })
  1278. }, vm.updateMessages = function() {
  1279. CommunicationsService.getInstances(vm.GameAppInstanceID, function(data) {
  1280. vm.TextMessages = data.Results, vm.SortedTextMessages = vm.TextMessages;
  1281. for (var i = 0; i < vm.SortedTextMessages.length; i++) vm.SortedTextMessages[i].Content = TextMessageService.replaceContentPlaceholders(vm.SortedTextMessages[i].Content);
  1282. vm.SortedTextMessages = TextMessageService.groupTextMessages(vm.SortedTextMessages);
  1283. for (var messageThreadIndex = 0, i = 0; i < vm.SortedTextMessages.length; i++)
  1284. if (vm.actionItemInstanceID === vm.SortedTextMessages[i][0].ActionItemInstanceID) {
  1285. messageThreadIndex = i;
  1286. break
  1287. }
  1288. vm.ShowLoading = !0, $timeout(function() {
  1289. vm.ShowLoading = !1, vm.Messages = vm.SortedTextMessages[messageThreadIndex], vm.MessagesSorted = TextMessageService.groupTextMessagesThreadByWeek(vm.Messages), vm.markRead()
  1290. }, 2e3)
  1291. }, function(data) {
  1292. log(data)
  1293. })
  1294. }, vm.Initialize()
  1295. }
  1296.  
  1297. function JobFinderListController($scope, JobFinderService, utils, GameMediaService, TextMessageService) {
  1298. function setupSlider() {
  1299. vm.slickConfig = {
  1300. data: vm.CurrentJobs,
  1301. adaptiveHeight: !1,
  1302. arrows: !1,
  1303. infinite: !1,
  1304. enabled: !0,
  1305. dots: !0,
  1306. method: {},
  1307. event: {
  1308. init: function(event, slick) {
  1309. vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), setTimeout(function() {
  1310. slick.resize()
  1311. }, 400)
  1312. },
  1313. afterChange: function(event, slick, currentSlide, nextSlide) {
  1314. vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
  1315. }
  1316. }
  1317. }
  1318. }
  1319. var vm = this;
  1320. vm.JobsList, vm.JobsListSorted, vm.NoJobData = {
  1321. Title: "Unemployed",
  1322. WorkingDays: [],
  1323. Salary: 0
  1324. }, vm.CurrentJobs, vm.Initialize = function() {
  1325. JobFinderService.getInstancePostings(function(data) {
  1326. vm.JobsList = data.Results, vm.JobsList = JobFinderService.calculatePaymentSalary(vm.JobsList)
  1327. }, function(data) {
  1328. log(data)
  1329. }), JobFinderService.getInstanceCurrentJobs(function(data) {
  1330. vm.CurrentJobs = data.Results, vm.CurrentJobs = JobFinderService.calculatePaymentSalary(vm.CurrentJobs), 0 === vm.CurrentJobs.length && vm.CurrentJobs.push(vm.NoJobData), setupSlider()
  1331. }, function(data) {
  1332. log(data)
  1333. })
  1334. }, vm.ViewJob = function(jobID, pendingApp) {
  1335. pendingApp || utils.navigateRoute($scope, "/app/dashboard/job-finder/job/" + jobID, "next")
  1336. }, vm.Initialize()
  1337. }
  1338.  
  1339. function JobController($scope, JobFinderService, utils, GameMediaService, $stateParams, MessageService) {
  1340. var vm = this;
  1341. vm.Job, vm.JobID = $stateParams.id, vm.GameAppID = utils.getGameAppID("JobFinder"), vm.Initialize = function() {
  1342. JobFinderService.getInstancePosting(vm.JobID, function(data) {
  1343. vm.Job = data, vm.JobsList = JobFinderService.calculatePaymentSalary([vm.Job]), vm.Job.Description = utils.addHTMLBreaks(vm.Job.Description)
  1344. }, function(data) {
  1345. log(data)
  1346. })
  1347. }, vm.getItemImg = function(name) {
  1348. return GameMediaService.get("item", name)
  1349. }, vm.applyForJob = function() {
  1350. log("applyForJob"), $scope.$broadcast("ShowTransferLoading"), JobFinderService.applyForJob(vm.Job.GameJobID, vm.GameAppID, function() {
  1351. $scope.$broadcast("ShowTransferSuccess")
  1352. }, function(messages) {
  1353. $scope.$broadcast("ResetTransferButton"), log(">> ", messages), vm.message = MessageService.showMessage({
  1354. content: messages
  1355. })
  1356. })
  1357. }, vm.navigateBack = function() {
  1358. utils.navigateRoute($scope, "", "back")
  1359. }, $scope.$on("TransactionComplete", vm.navigateBack), vm.Initialize()
  1360. }
  1361.  
  1362. function MyStuffListController($scope, ItemsService, IBuyService, utils, GameMediaService, MyStuffService) {
  1363. function getItemsForSale() {
  1364. IBuyService.getItemsForSale(function(data) {
  1365. log(data.Results);
  1366. for (var saleItem, i = 0; i < data.Results.length; i++) saleItem = vm.MyStuff.filter(function(e) {
  1367. return e.ID === data.Results[i].ItemInstanceID
  1368. })[0], log(saleItem), null != saleItem && (saleItem.IBuySale = !0);
  1369. setupSlider()
  1370. }, function(data) {
  1371. log(data)
  1372. })
  1373. }
  1374.  
  1375. function setupSlider() {
  1376. vm.slickConfig = {
  1377. data: vm.MyStuff,
  1378. adaptiveHeight: !0,
  1379. arrows: !1,
  1380. infinite: !1,
  1381. enabled: !0,
  1382. method: {},
  1383. event: {
  1384. init: function(event, slick) {
  1385. vm.totalSlides = slick.slideCount, 1 == vm.totalSlides && (vm.nextDisabled = !0), vm.prevDisabled = !0, slick.resize()
  1386. },
  1387. afterChange: function(event, slick, currentSlide, nextSlide) {
  1388. vm.currentSlide = currentSlide + 1, currentSlide < vm.totalSlides - 1 ? vm.nextDisabled = !1 : vm.nextDisabled = !0, 0 == currentSlide ? vm.prevDisabled = !0 : vm.prevDisabled = !1
  1389. }
  1390. }
  1391. }
  1392. }
  1393. var vm = this;
  1394. vm.MyStuff, vm.MockData = [{
  1395. ID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
  1396. Title: "Suit",
  1397. Description: "Description",
  1398. GameItemID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
  1399. Price: 20,
  1400. Success: !1,
  1401. Messages: null
  1402. }, {
  1403. ID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
  1404. Title: "Suit",
  1405. Description: "Description",
  1406. GameItemID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
  1407. Price: 20,
  1408. Success: !1,
  1409. Messages: null
  1410. }, {
  1411. ID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
  1412. Title: "Suit",
  1413. Description: "Description",
  1414. GameItemID: "8cb7153b-0134-4a3d-ab19-0d68c5200e8e",
  1415. Price: 20,
  1416. Success: !1,
  1417. Messages: null
  1418. }], vm.GameAppInstanceID = utils.getInstanceAppID("Items"), vm.Initialize = function() {
  1419. ItemsService.getInventory(function(data) {
  1420. vm.MyStuff = data.Results, log(vm.MyStuff), getItemsForSale()
  1421. }, function(data) {
  1422. log(data)
  1423. })
  1424. }, vm.SellStuff = function(data) {
  1425. MyStuffService.setCurrentStuff(data), utils.navigateRoute($scope, "/app/dashboard/my-stuff/sell", "next")
  1426. }, vm.ViewIbuyListing = function(ID) {
  1427. utils.navigateRoute($scope, "/app/dashboard/ibuy/selling", "next")
  1428. }, vm.Initialize()
  1429. }
  1430.  
  1431. function MyStuffSellController($scope, IBuyService, utils, MyStuffService, MessageService) {
  1432. var vm = this;
  1433. vm.Item = MyStuffService.getCurrentStuff(), vm.TransferValue, vm.GameAppInstanceID = utils.getInstanceAppID("iBuy"), vm.message, vm.Initialize = function() {}, vm.SellOnIbuy = function() {
  1434. return vm.TransferValue > 1e5 ? void(vm.message = MessageService.showMessage({
  1435. content: "The maximum sell price is $100,000"
  1436. })) : void(vm.TransferValue > 0 ? ($scope.$broadcast("ShowTransferLoading"), IBuyService.sell(vm.Item.ID, vm.TransferValue, function() {
  1437. dataLayer.push({
  1438. event: "app",
  1439. appSelected: "myStuff",
  1440. appAction: "sell item"
  1441. }), $scope.$broadcast("ShowTransferSuccess")
  1442. }, function(messages) {
  1443. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  1444. content: messages
  1445. })
  1446. })) : vm.message = MessageService.showMessage({
  1447. content: "Sale price must be $1 or more"
  1448. }))
  1449. }, vm.CancelClicked = function() {
  1450. utils.navigateRoute($scope, "", "back")
  1451. }, $scope.$on("TransactionComplete", vm.CancelClicked), vm.Initialize()
  1452. }
  1453.  
  1454. function IBuyListController($scope, IBuyService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
  1455. function getBids(itemData) {
  1456. IBuyService.getBids(function(bidData) {
  1457. vm.Items = itemData;
  1458. for (var item, i = 0; i < bidData.Results.length; i++) item = vm.Items.filter(function(e) {
  1459. return e.ID === bidData.Results[i].iBuyGameItemID
  1460. })[0], null != item && (item.UserBidding = !0)
  1461. }, function(data) {
  1462. log(data)
  1463. })
  1464. }
  1465.  
  1466. function getSelling() {
  1467. IBuyService.getItemsForSale(function(data) {
  1468. getInventory(data.Results)
  1469. }, function(data) {
  1470. log(data)
  1471. })
  1472. }
  1473.  
  1474. function getInventory(itemsSelling) {
  1475. ItemsService.getInventory(function(inventData) {
  1476. vm.ItemsSelling = itemsSelling;
  1477. for (var item, i = 0; i < inventData.Results.length; i++) item = vm.ItemsSelling.filter(function(e) {
  1478. return e.ItemInstanceID === inventData.Results[i].ID
  1479. })[0], null != item && (item.Title = inventData.Results[i].Title);
  1480. $timeout(function() {
  1481. vm.ShowBuy ? $scope.$emit("UpdateAppHeight", {
  1482. selector: "buy-item",
  1483. offset: 10
  1484. }) : $scope.$emit("UpdateAppHeight", {
  1485. selector: "sell-item",
  1486. offset: 10
  1487. })
  1488. }, 200)
  1489. }, function(data) {
  1490. log(data)
  1491. })
  1492. }
  1493.  
  1494. function acceptCallback() {
  1495. IBuyService.cancelSell(vm.CancelItem.ID, function(data) {
  1496. dataLayer.push({
  1497. event: "app",
  1498. appSelected: "iBuy",
  1499. appAction: "cancel sale"
  1500. }), getSelling()
  1501. }, function(data) {
  1502. log(data)
  1503. })
  1504. }
  1505.  
  1506. function declineCallback() {}
  1507. var vm = this;
  1508. vm.Items, vm.ItemsSelling, vm.CancelItem, vm.ShowBuy = !0, vm.Initialize = function() {
  1509. "selling" == $stateParams.page && (vm.ShowBuy = !1), IBuyService.getItems(function(data) {
  1510. getBids(data.Results)
  1511. }, function(data) {
  1512. log(data)
  1513. }), getSelling()
  1514. }, vm.ShowBuyClick = function() {
  1515. vm.ShowBuy = !0, $timeout(function() {
  1516. $scope.$emit("UpdateAppHeight", {
  1517. selector: "buy-item",
  1518. offset: 10
  1519. }), $scope.$emit("RefreshWebKitScrolling")
  1520. }, 200)
  1521. }, vm.ShowSellClick = function() {
  1522. vm.ShowBuy = !1, $timeout(function() {
  1523. $scope.$emit("UpdateAppHeight", {
  1524. selector: "sell-item",
  1525. offset: 10
  1526. }), $scope.$emit("RefreshWebKitScrolling")
  1527. }, 200)
  1528. }, vm.ViewItem = function(data) {
  1529. data.SoldOut || data.UserBidding || (IBuyService.storeCurrentItem(data), utils.navigateRoute($scope, "/app/dashboard/ibuy/item", "next"))
  1530. }, vm.CancelSale = function(item) {
  1531. vm.CancelItem = item, MessageService.showConfirm({
  1532. content: "Are you sure you want to cancel this sale?",
  1533. acceptFn: acceptCallback,
  1534. declineFn: declineCallback
  1535. })
  1536. }, vm.Initialize()
  1537. }
  1538.  
  1539. function IBuyItemController($scope, IBuyService, utils, GameMediaService) {
  1540. var vm = this;
  1541. vm.Item = IBuyService.getCurrentItem(), vm.ItemBG = GameMediaService.get("ibuy", vm.Item.Title), vm.BidClicked = function() {
  1542. utils.navigateRoute($scope, "/app/dashboard/ibuy/item/bid", "next")
  1543. }, vm.BuyClicked = function() {
  1544. utils.navigateRoute($scope, "/app/dashboard/ibuy/item/buy", "next")
  1545. }, vm.BackClicked = function() {
  1546. utils.navigateRoute($scope, "/app/dashboard/ibuy", "back")
  1547. }
  1548. }
  1549.  
  1550. function IBuyPurchaseController($scope, IBuyService, utils, GameMediaService, $location, FinancialInstanceService, MessageService, ItemsService) {
  1551. var vm = this;
  1552. vm.Item = IBuyService.getCurrentItem(), vm.message = "", vm.FromAccountOptions = {}, vm.FromAccountModel = {}, vm.GameAppID = utils.getGameAppID("iBuy"), vm.Initialize = function() {
  1553. $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) {
  1554. vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
  1555. ID: "0",
  1556. Title: " [Select Account] "
  1557. }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0]
  1558. }, function(messages) {
  1559. MessageService.showMessage({
  1560. content: messages[0]
  1561. })
  1562. })
  1563. }, vm.Purchase = function() {
  1564. "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) {
  1565. $scope.$broadcast("ShowTransferSuccess")
  1566. }, function(messages) {
  1567. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  1568. content: messages[0]
  1569. })
  1570. }), dataLayer.push({
  1571. event: "app",
  1572. appSelected: "iBuy",
  1573. appAction: "bid now"
  1574. })) : vm.message = MessageService.showMessage({
  1575. content: "Error: Bid not high enough"
  1576. }) : ($scope.$broadcast("ShowTransferLoading"), ItemsService.purchaseItem(vm.GameAppID, vm.Item.ID, vm.FromAccountModel.Selected.AppInstanceID, vm.FromAccountModel.Selected.ID, function(response) {
  1577. $scope.$broadcast("ShowTransferSuccess")
  1578. }, function(messages) {
  1579. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  1580. content: messages[0]
  1581. })
  1582. }), dataLayer.push({
  1583. event: "app",
  1584. appSelected: "iBuy",
  1585. appAction: "buy now"
  1586. })) : vm.message = MessageService.showMessage({
  1587. content: "Error: Not enough funds in selected account"
  1588. }) : vm.message = MessageService.showMessage({
  1589. content: "Error: please select an account"
  1590. })
  1591. }, vm.CancelClicked = function(itemID) {
  1592. utils.navigateRoute($scope, "/app/dashboard/ibuy/item", "back")
  1593. }, vm.SuccessPurchase = function(itemID) {
  1594. utils.navigateRoute($scope, "/app/dashboard/ibuy/item/complete/" + vm.NextPage, "next")
  1595. }, $scope.$on("TransactionComplete", vm.SuccessPurchase), vm.Initialize()
  1596. }
  1597.  
  1598. function IBuyPurchaseCompleteController($scope, $location, utils, GameMediaService) {
  1599. var vm = this;
  1600. vm.Initialize = function() {
  1601. $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>. ")
  1602. }, vm.BackClicked = function() {
  1603. utils.navigateRoute($scope, "/app/dashboard/ibuy", "back")
  1604. }, vm.Initialize()
  1605. }
  1606.  
  1607. function UShopListController($scope, UShopService, utils, GameMediaService, ItemsService, MessageService) {
  1608. var vm = this;
  1609. vm.Items, vm.Initialize = function() {
  1610. UShopService.getItems(function(data) {
  1611. vm.Items = data.Results, log(vm.Items)
  1612. }, function(data) {
  1613. log(data)
  1614. })
  1615. }, vm.ViewItem = function(data) {
  1616. data.SoldOut || (UShopService.storeCurrentItem(data), utils.navigateRoute($scope, "/app/dashboard/ushop/item", "next"))
  1617. }, vm.GetItemBackground = function(title) {
  1618. return GameMediaService.get("ibuy", title)
  1619. }, vm.Initialize()
  1620. }
  1621.  
  1622. function UShopItemController($scope, UShopService, utils, GameMediaService) {
  1623. var vm = this;
  1624. vm.Item = UShopService.getCurrentItem(), vm.ItemBG = GameMediaService.get("ushop", vm.Item.Title), vm.BuyClicked = function() {
  1625. utils.navigateRoute($scope, "/app/dashboard/ushop/item/buy", "next")
  1626. }, vm.GetItemBackground = function(title) {
  1627. return GameMediaService.get("ibuy", title)
  1628. }, vm.BackClicked = function() {
  1629. utils.navigateRoute($scope, "/app/dashboard/ushop", "back")
  1630. }
  1631. }
  1632.  
  1633. function UShopPurchaseController($scope, UShopService, utils, GameMediaService, $location, FinancialInstanceService, MessageService, ItemsService) {
  1634. var vm = this;
  1635. vm.Item = UShopService.getCurrentItem(), vm.message = "", vm.FromAccountOptions = {}, vm.FromAccountModel = {},
  1636. vm.GameAppID = utils.getGameAppID("uShop"), vm.Initialize = function() {
  1637. vm.TransferValue = vm.Item.Price, FinancialInstanceService.getPaymentSources(function(options) {
  1638. vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
  1639. ID: "0",
  1640. Title: " [Select Account] "
  1641. }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0], log(vm.FromAccountModel.Selected)
  1642. }, function(messages) {
  1643. MessageService.showMessage({
  1644. content: messages[0]
  1645. })
  1646. })
  1647. }, vm.Purchase = function() {
  1648. 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) {
  1649. $scope.$broadcast("ShowTransferSuccess")
  1650. }, function(messages) {
  1651. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  1652. content: messages[0]
  1653. })
  1654. }), dataLayer.push({
  1655. event: "app",
  1656. appSelected: "uShop",
  1657. appAction: "buy"
  1658. })) : vm.message = MessageService.showMessage({
  1659. content: "Error: Not enough funds in selected account"
  1660. }) : vm.message = MessageService.showMessage({
  1661. content: "Error: please select an account"
  1662. })
  1663. }, vm.CancelClicked = function(itemID) {
  1664. utils.navigateRoute($scope, "/app/dashboard/ushop/item", "back")
  1665. }, vm.SuccessPurchase = function(itemID) {
  1666. utils.navigateRoute($scope, "/app/dashboard/ushop", "back")
  1667. }, $scope.$on("TransactionComplete", vm.SuccessPurchase), vm.Initialize()
  1668. }
  1669.  
  1670. function SharesListController($scope, SharesService, utils, GameMediaService, $stateParams, MessageService, $timeout) {
  1671. var vm = this;
  1672. vm.Shares, vm.UserShares, vm.TotalInvestment = 0, vm.ShowMarket = !0, vm.GraphColors = ["#63c089", "#ff6b6b", "#ff9e10"], vm.HighChartConfig = {
  1673. options: {
  1674. chart: {
  1675. type: "area"
  1676. },
  1677. plotOptions: {
  1678. series: {
  1679. stacking: "",
  1680. lineWidth: 2
  1681. }
  1682. },
  1683. xAxis: {
  1684. tickInterval: 1,
  1685. labels: {
  1686. enabled: !1
  1687. },
  1688. title: {
  1689. text: "SHARE PRICE HISTORY",
  1690. style: {
  1691. "margin-top": "5px",
  1692. "dominant-baseline": "hanging"
  1693. }
  1694. }
  1695. },
  1696. yAxis: {
  1697. tickAmount: 6,
  1698. lineWidth: 2,
  1699. title: {
  1700. text: " ",
  1701. rotation: 0
  1702. },
  1703. labels: {
  1704. enabled: !1
  1705. }
  1706. },
  1707. legend: {
  1708. enabled: !1
  1709. },
  1710. tooltip: {
  1711. enabled: !1
  1712. }
  1713. },
  1714. series: [{
  1715. name: "",
  1716. data: [],
  1717. connectNulls: !0,
  1718. id: "series-1",
  1719. type: "area",
  1720. dashStyle: "Solid",
  1721. color: "#63c089",
  1722. lineWidth: "2px"
  1723. }],
  1724. title: {
  1725. text: ""
  1726. },
  1727. credits: {
  1728. enabled: !1
  1729. },
  1730. loading: !1,
  1731. size: {
  1732. height: 100
  1733. }
  1734. }, vm.Initialize = function() {
  1735. vm.GetShares()
  1736. }, vm.GetShares = function() {
  1737. SharesService.getShares(function(data) {
  1738. vm.Shares = data.Results, vm.UserShares = [];
  1739. var c = 0;
  1740. vm.Shares.forEach(function(share) {
  1741. share.OwnedShares > 0 && vm.UserShares.push(share), share.HightChart = angular.copy(vm.HighChartConfig);
  1742. for (var tempArr = share.PreviousWeekValues.reverse(), i = 0; i < tempArr.length; i++) share.HightChart.series[0].data.push(tempArr[i].Value);
  1743. share.HightChart.series[0].color = vm.GraphColors[c], c++
  1744. }), vm.UserShares.forEach(function(share) {
  1745. vm.TotalInvestment += share.CurrentPrice * share.OwnedShares
  1746. }), $timeout(function() {
  1747. $scope.$emit("UpdateAppHeight", {
  1748. selector: "share-card",
  1749. offset: 60
  1750. })
  1751. }, 200)
  1752. }, function(data) {
  1753. log(data)
  1754. })
  1755. }, vm.ShowMarketClick = function() {
  1756. vm.ShowMarket = !0, $timeout(function() {
  1757. $scope.$emit("UpdateAppHeight", {
  1758. selector: "share-card",
  1759. offset: 60
  1760. }), $scope.$broadcast("highchartsng.reflow")
  1761. }, 200)
  1762. }, vm.ShowPortfolioClick = function() {
  1763. vm.ShowMarket = !1, $timeout(function() {
  1764. $scope.$emit("UpdateAppHeight", {
  1765. selector: "user-share-card",
  1766. offset: 170
  1767. })
  1768. }, 200)
  1769. }, vm.ChangeIndicator = function(last, current) {
  1770. return current - last > 0 ? "up icon-180" : "down"
  1771. }, vm.BuyShareClicked = function(share) {
  1772. share.TotalShares != share.OwnedShares && (SharesService.storeCurrentShare(share), utils.navigateRoute($scope, "/app/dashboard/shares/buy", "next"))
  1773. }, vm.SellShareClicked = function(share) {
  1774. SharesService.storeCurrentShare(share), utils.navigateRoute($scope, "/app/dashboard/shares/sell", "next")
  1775. }, vm.Initialize()
  1776. }
  1777.  
  1778. function SharesBuyController($scope, SharesService, utils, GameMediaService, $stateParams, MessageService, FinancialInstanceService) {
  1779. var vm = this;
  1780. vm.Share = SharesService.getCurrentShare(), vm.FromAccountOptions = {}, vm.FromAccountModel = {}, log(vm.Share), vm.Slider = {
  1781. value: 1,
  1782. options: {
  1783. floor: 1,
  1784. ceil: vm.Share.TotalShares - vm.Share.OwnedShares,
  1785. hidePointerLabels: !0,
  1786. hideLimitLabels: !0,
  1787. step: 1,
  1788. showSelectionBarFromValue: 1,
  1789. showSelectionBar: !0,
  1790. showSelectionBarEnd: !0
  1791. }
  1792. }, vm.TotalPrice = 0, vm.Cost = 0, vm.OnCountChange = function() {
  1793. vm.Slider.value > vm.Slider.options.ceil && (vm.Slider.value = vm.Slider.options.ceil)
  1794. }, vm.Initialize = function() {
  1795. FinancialInstanceService.getPaymentSources(function(options) {
  1796. log("options > ", options), vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
  1797. ID: "0",
  1798. Title: " [Select Account] "
  1799. }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0]
  1800. }, function(messages) {
  1801. MessageService.showMessage({
  1802. content: messages[0]
  1803. })
  1804. }), $scope.$watch("vm.Slider.value", function(newValue, oldValue) {
  1805. vm.Cost = newValue * vm.Share.CurrentPrice, vm.TotalPrice = vm.Cost + vm.Share.BrokerageFee * vm.Cost
  1806. })
  1807. }, vm.Purchase = function() {
  1808. 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) {
  1809. $scope.$broadcast("ShowTransferSuccess")
  1810. }, function(messages) {
  1811. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  1812. content: messages[0]
  1813. })
  1814. }), dataLayer.push({
  1815. event: "app",
  1816. appSelected: "shares",
  1817. appAction: "buy shares"
  1818. })) : vm.message = MessageService.showMessage({
  1819. content: "Error: Not enough funds in selected account"
  1820. }) : vm.message = MessageService.showMessage({
  1821. content: "Error: Please select at least 1 share to buy"
  1822. }) : vm.message = MessageService.showMessage({
  1823. content: "Error: please select an account"
  1824. }), log(vm.message)
  1825. }, vm.CancelClicked = function() {
  1826. utils.navigateRoute($scope, "/app/dashboard/shares", "back")
  1827. }, $scope.$on("TransactionComplete", vm.CancelClicked), vm.Initialize()
  1828. }
  1829.  
  1830. function SharesSellController($scope, SharesService, utils, GameMediaService, $stateParams, MessageService, FinancialInstanceService) {
  1831. var vm = this;
  1832. vm.Share = SharesService.getCurrentShare(), vm.FromAccountOptions = {}, vm.FromAccountModel = {}, vm.Slider = {
  1833. value: 1,
  1834. options: {
  1835. floor: 1,
  1836. ceil: vm.Share.OwnedShares,
  1837. hidePointerLabels: !0,
  1838. hideLimitLabels: !0,
  1839. step: 1,
  1840. showSelectionBarFromValue: 1,
  1841. showSelectionBar: !0,
  1842. showSelectionBarEnd: !0
  1843. }
  1844. }, vm.TotalPrice = 0, vm.Cost = 0, vm.OnCountChange = function() {
  1845. vm.Slider.value > vm.Slider.options.ceil && (vm.Slider.value = vm.Slider.options.ceil)
  1846. }, vm.Initialize = function() {
  1847. FinancialInstanceService.getPayoutSources(function(options) {
  1848. vm.FromAccountOptions = options, vm.FromAccountOptions.unshift({
  1849. ID: "0",
  1850. Title: " [Select Account] "
  1851. }), vm.FromAccountModel.Selected = vm.FromAccountOptions[0]
  1852. }, function(messages) {
  1853. MessageService.showMessage({
  1854. content: messages[0]
  1855. })
  1856. }), $scope.$watch("vm.Slider.value", function(newValue, oldValue) {
  1857. vm.Cost = newValue * vm.Share.CurrentPrice, vm.TotalPrice = vm.Cost - vm.Share.BrokerageFee * vm.Cost
  1858. })
  1859. }, vm.Sell = function() {
  1860. 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) {
  1861. dataLayer.push({
  1862. event: "app",
  1863. appSelected: "shares",
  1864. appAction: "sell shares"
  1865. }), $scope.$broadcast("ShowTransferSuccess")
  1866. }, function(messages) {
  1867. $scope.$broadcast("ResetTransferButton"), vm.message = MessageService.showMessage({
  1868. content: messages[0]
  1869. })
  1870. })) : vm.message = MessageService.showMessage({
  1871. content: "Error: Please select at least 1 share to sell"
  1872. }) : vm.message = MessageService.showMessage({
  1873. content: "Error: please select an account"
  1874. })
  1875. }, vm.CancelClicked = function() {
  1876. utils.navigateRoute($scope, "/app/dashboard/shares", "back")
  1877. }, $scope.$on("TransactionComplete", vm.CancelClicked), vm.Initialize()
  1878. }
  1879.  
  1880. function EndOfWeekEndController($scope, GameInstancesService, utils, $timeout, EndOfWeekService) {
  1881. var vm = this;
  1882. vm.IsQuestion = !1, vm.currentWeek = GameInstancesService.getCurrentWeek(), vm.totalWeeks = GameInstancesService.getTotalWeeks(), vm.Init = function() {
  1883. EndOfWeekService.eowQuestionsGenerate(function(response) {
  1884. log("eowQuestionsGenerate > ", response), vm.IsQuestion = !0
  1885. }, function(response) {
  1886. log("fail", response), "A question already generated for this week." == response ? vm.IsQuestion = !0 : $timeout(function() {
  1887. utils.navigateRoute($scope, "/end-of-week/summary", "next")
  1888. }, 3e3)
  1889. })
  1890. }, vm.BonusQuestion = function() {
  1891. utils.navigateRoute($scope, "/end-of-week/question", "next")
  1892. }, vm.Init()
  1893. }
  1894.  
  1895. function EndOfWeekQuestionController($scope, GameInstancesService, utils, EndOfWeekService, $interval, MessageService) {
  1896. function resetSelection() {
  1897. for (var i = 0; i < vm.Question.Answers.length; i++) vm.Question.Answers[i].Selected = "";
  1898. vm.Selection >= 0 && (vm.Question.Answers[vm.Selection].Selected = "selected")
  1899. }
  1900. var vm = this;
  1901. 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() {
  1902. EndOfWeekService.eowQuestions(function(response) {
  1903. vm.Question = response, resetSelection(), log(response), vm.TotalTime = vm.Question.TotalSeconds, vm.Time = vm.TotalTime, vm.TimerInterval = $interval(function() {
  1904. 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))
  1905. }, 1e3)
  1906. }, function(response) {
  1907. log("fail", response), "Could not find a generated question. Generate a question." == response[0] && MessageService.showConfirm({
  1908. content: "Could not find a generated question.",
  1909. acceptFn: vm.Continue,
  1910. declineFn: !1,
  1911. acceptBtnLabel: "GO TO SUMMARY",
  1912. declineBtnLabel: ""
  1913. })
  1914. })
  1915. }, vm.AnswerClicked = function(index) {
  1916. vm.DisableAnswers || (vm.Selection = index, resetSelection())
  1917. }, vm.SubmitAnswer = function() {
  1918. vm.Selection != -1 && ($interval.cancel(vm.TimerInterval), vm.ShowQuestion = !0, vm.sendAnswer(vm.Question.ID, vm.Question.Answers[vm.Selection].ID, !1), dataLayer.push({
  1919. event: "quiz",
  1920. quizAction: "submit",
  1921. quizLabel: "week " + vm.currentWeek + " end of week bonus question",
  1922. quizType: "bonus quiz"
  1923. }))
  1924. }, vm.sendAnswer = function(qID, qanswer, skip) {
  1925. EndOfWeekService.eowQuestionsAnswer(qID, qanswer, skip, vm.Time, function(response) {
  1926. log(response.Messages[0]), "Question Skipped" == response.Messages[0] ? utils.navigateRoute($scope, "/end-of-week/summary", "next") : response.AnsweredCorrectly ? (EndOfWeekService.setQuestionData({
  1927. Time: vm.Time,
  1928. CashReward: response.Reward,
  1929. TimeBonus: response.Bonus
  1930. }), utils.navigateRoute($scope, "/end-of-week/feedback-correct", "next")) : (EndOfWeekService.setQuestionData({
  1931. Time: vm.Time,
  1932. CashReward: 0,
  1933. TimeBonus: 0
  1934. }), utils.navigateRoute($scope, "/end-of-week/feedback-incorrect", "next"))
  1935. }, function(response) {
  1936. log("fail", response), "Question has already been answered." == response && MessageService.showConfirm({
  1937. content: response,
  1938. acceptFn: vm.Continue,
  1939. declineFn: !1,
  1940. acceptBtnLabel: "GO TO SUMMARY",
  1941. declineBtnLabel: ""
  1942. })
  1943. })
  1944. }, vm.SkipAnswer = function() {
  1945. dataLayer.push({
  1946. event: "quiz",
  1947. quizAction: "skip",
  1948. quizLabel: "week " + vm.currentWeek + " end of week bonus question",
  1949. quizType: "bonus quiz"
  1950. }), vm.sendAnswer(vm.Question.ID, null, !0)
  1951. }, vm.Continue = function() {
  1952. utils.navigateRoute($scope, "/end-of-week/summary", "next")
  1953. }, vm.Init()
  1954. }
  1955.  
  1956. function EndOfWeekFeedbackController($scope, GameInstancesService, utils, EndOfWeekService) {
  1957. var vm = this;
  1958. 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() {
  1959. utils.navigateRoute($scope, "/end-of-week/summary", "next")
  1960. }
  1961. }
  1962.  
  1963. function EndOfWeekSummaryController($scope, EndOfWeekService, utils, GameInstancesService, GameMediaService) {
  1964. var vm = this;
  1965. vm.currentWeek = GameInstancesService.getCurrentWeek(), vm.Summary, vm.howl = GameMediaService.get("mentor", "happy"), vm.TextColor, vm.Init = function() {
  1966. EndOfWeekService.getCurrentSummary(function(response) {
  1967. log(response), vm.Summary = response, GameInstancesService.endWeek(function(response) {
  1968. log("success ", response), response.Week > response.TotalGameWeeks ? (GameInstancesService.checkEndGameSurvey(function(response) {
  1969. if (response.HasEndSurvey) return void(vm.ContinueBtnText = "START QUIZ")
  1970. }, function(repsonse) {
  1971. log("fail", repsonse)
  1972. }), vm.ContinueBtnText = "FINISH THE GAME") : vm.ContinueBtnText = "START NEXT WEEK"
  1973. }, function(response) {
  1974. log("fail ", response)
  1975. })
  1976. }, function(response) {
  1977. log("fail", response)
  1978. })
  1979. }, vm.ChangeIndicator = function(diff) {
  1980. 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")
  1981. }, vm.StartWeek = function() {
  1982. utils.navigateRoute($scope, "/end-of-week/start", "next")
  1983. }, vm.Logout = function() {
  1984. utils.navigateRoute($scope, "/auth/game")
  1985. }, vm.Init()
  1986. }
  1987.  
  1988. function EndOfWeekStartController($scope, $localStorage, GameInstancesService, utils, $timeout) {
  1989. var vm = this;
  1990. vm.CallBackSuccess = !1;
  1991. var currentWeek = parseInt(GameInstancesService.getCurrentWeek()),
  1992. totalWeeks = parseInt(GameInstancesService.getTotalWeeks());
  1993. vm.currentWeek = 1 + currentWeek, vm.currentWeek > totalWeeks ? (dataLayer.push({
  1994. event: "game completed",
  1995. gameNumber: "game " + $localStorage.GameNumber
  1996. }), GameInstancesService.checkEndGameSurvey(function(response) {
  1997. response.HasEndSurvey && dataLayer.push({
  1998. event: "end of game quiz",
  1999. endGameQuizAction: "start quiz",
  2000. gameNumber: "game " + $localStorage.GameNumber
  2001. })
  2002. }, function(repsonse) {
  2003. log("fail", repsonse)
  2004. })) : dataLayer.push({
  2005. event: "week",
  2006. weekState: "start week",
  2007. weekCompleted: "week " + vm.currentWeek
  2008. }), GameInstancesService.startWeek(function() {
  2009. vm.CallBackSuccess = !0, $timeout(function() {
  2010. utils.navigateRoute($scope, "/app/dashboard/view", "next")
  2011. }, 2800)
  2012. }, function() {})
  2013. }
  2014.  
  2015. function FinanceWeeklyHomeController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
  2016. var vm = this;
  2017. vm.QuizComplete = !1, vm.Article, vm.Initialize = function() {
  2018. FinanceWeeklyService.getArticle(function(data) {
  2019. 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())
  2020. }, function(data) {
  2021. log(data)
  2022. })
  2023. }, vm.ArticleClicked = function() {
  2024. FinanceWeeklyService.storeCurrentArticle(vm.Article), dataLayer.push({
  2025. event: "app",
  2026. appSelected: "finance weekly",
  2027. appAction: "read article"
  2028. }), utils.navigateRoute($scope, "/app/dashboard/financeweekly/article", "next")
  2029. }, vm.ArchiveClicked = function() {
  2030. utils.navigateRoute($scope, "/app/dashboard/financeweekly/archive", "next")
  2031. }, vm.QuizClicked = function() {
  2032. FinanceWeeklyService.createQuiz(vm.Article.ID, function(data) {
  2033. dataLayer.push({
  2034. event: "app",
  2035. appSelected: "finance weekly",
  2036. appAction: "take quiz"
  2037. }), utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz", "next")
  2038. }, function(data) {
  2039. log(data)
  2040. })
  2041. }, vm.Initialize()
  2042. }
  2043.  
  2044. function FinanceWeeklyArticleController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService, $location) {
  2045. var vm = this;
  2046. vm.QuizComplete = !1, vm.Article = FinanceWeeklyService.getCurrentArticle(), vm.Initialize = function() {}, vm.BackClicked = function() {
  2047. $location.path().indexOf("archive") > 0 ? utils.navigateRoute($scope, "/app/dashboard/financeweekly/archive", "back") : utils.navigateRoute($scope, "/app/dashboard/financeweekly", "back")
  2048. }, vm.Initialize()
  2049. }
  2050.  
  2051. function FinanceWeeklyArchiveController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService, $location) {
  2052. var vm = this;
  2053. vm.Initialize = function() {
  2054. FinanceWeeklyService.getArticles(function(data) {
  2055. vm.Articles = data.Results
  2056. }, function(data) {
  2057. log(data)
  2058. })
  2059. }, vm.ArticleClicked = function(article) {
  2060. dataLayer.push({
  2061. event: "app",
  2062. appSelected: "finance weekly",
  2063. appAction: "read archived article"
  2064. }), 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")
  2065. }, vm.BackClicked = function() {
  2066. utils.navigateRoute($scope, "/app/dashboard/financeweekly", "back")
  2067. }, vm.Initialize()
  2068. }
  2069.  
  2070. function FinanceWeeklyQuizController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService, $stateParams, $location) {
  2071. function startQuiz() {
  2072. FinanceWeeklyService.startQuiz(vm.Quiz.ID, function(data) {
  2073. log(data)
  2074. }, function(data) {
  2075. log(data)
  2076. })
  2077. }
  2078.  
  2079. function setupQuestion() {
  2080. 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")
  2081. }
  2082.  
  2083. function submitQuestion(event, answers) {
  2084. FinanceWeeklyService.submitAnswer(answers, function(data) {
  2085. log(data), $scope.$broadcast("QuizAnswerFeedback", data.Messages)
  2086. }, function(data) {
  2087. log(data), MessageService.showMessage({
  2088. content: data[0]
  2089. })
  2090. })
  2091. }
  2092.  
  2093. function quizQuestionFinished(event) {
  2094. FinanceWeeklyService.completeQuestion(vm.Quiz.CurrentQuestion.ID, function(data) {
  2095. log(data), vm.Quiz.AtLastQuestion ? (vm.showQuizEndBtn = !1, utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz/summary", "next"), FinanceWeeklyService.getQuiz(function(data) {
  2096. vm.Quiz = data, vm.Quiz.TotalQuestions = vm.Quiz.Questions.length, dataLayer.push({
  2097. event: "quiz",
  2098. quizAction: "submit",
  2099. quizLabel: "week " + vm.Week + " " + vm.Quiz.Title,
  2100. quizType: "weekly quiz"
  2101. })
  2102. }, function(data) {
  2103. log(data)
  2104. })) : vm.Initialize()
  2105. }, function(data) {
  2106. log(data)
  2107. })
  2108. }
  2109.  
  2110. function showSummary(raiseGA) {
  2111. vm.showQuizEndBtn = !1, FinanceWeeklyService.endQuiz(vm.Quiz.ID, function(data) {
  2112. log(data), FinanceWeeklyService.getQuiz(function(data) {
  2113. vm.Quiz = data, vm.Quiz.TotalQuestions = vm.Quiz.Questions.length, raiseGA && dataLayer.push({
  2114. event: "quiz",
  2115. quizAction: "end quiz",
  2116. quizLabel: "week " + vm.Week + " " + vm.Quiz.Title,
  2117. quizType: "weekly quiz"
  2118. })
  2119. }, function(data) {
  2120. log(data)
  2121. })
  2122. }, function(data) {
  2123. log(data)
  2124. })
  2125. }
  2126.  
  2127. function yesEndQuiz() {
  2128. showSummary(!0), vm.showQuizEndBtn = !1, utils.navigateRoute($scope, "/app/dashboard/financeweekly/quiz/summary", "next")
  2129. }
  2130.  
  2131. function noEndQuiz() {}
  2132. var vm = this;
  2133. 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() {
  2134. FinanceWeeklyService.getQuiz(function(data) {
  2135. vm.Quiz = data, vm.Quiz.TotalQuestions = vm.Quiz.Questions.length, log(vm.Quiz), startQuiz(), $location.path().indexOf("summary") == -1 ? setupQuestion() : showSummary(!1)
  2136. }, function(data) {
  2137. log(data)
  2138. })
  2139. }, vm.EndQuiz = function() {
  2140. vm.showQuizEndBtn ? MessageService.showConfirm({
  2141. 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?",
  2142. acceptFn: yesEndQuiz,
  2143. declineFn: noEndQuiz,
  2144. acceptBtnLabel: "End Quiz",
  2145. declineBtnLabel: "Keep going"
  2146. }) : utils.navigateRoute($scope, "/app/dashboard/view", "toDash")
  2147. }, $scope.$on("QuizSubmitAnswers", submitQuestion), $scope.$on("QuizQuestionFinished", quizQuestionFinished), $scope.$on("QuitingQuiz", vm.EndQuiz), vm.Initialize()
  2148. }
  2149.  
  2150. function FinanceWeeklyMultipleChoiceController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
  2151. function setSelected(selected) {
  2152. for (var i = 0; i < $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.length; i++) $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[i].Selected = !1
  2153. }
  2154.  
  2155. function showFeedback(event, feedback) {
  2156. for (var overall = !0, i = 0; i < feedback.length; i++) {
  2157. 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);
  2158. "True" == answer[1] ? $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Classes += " correct" : (overall = !1, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Classes += " incorrect")
  2159. }
  2160. overall ? vm.OverAllResult = 'Result - <span class="correct-text">Correct</span>' : vm.OverAllResult = 'Result - <span class="incorrect-text">Incorrect</span>'
  2161. }
  2162. var vm = this;
  2163. vm.SubmitDisabled = !0, vm.ButtonText = "Submit", vm.SelectedAnswers = [], vm.HasSubmitted = !1, vm.OverAllResult = "", $scope.$watch("$parent.vm.Quiz", function(newValue, oldValue, scope) {
  2164. null != $scope.$parent.vm.Quiz && setSelected(null)
  2165. }), vm.AnswerClicked = function(index, qId, qIndex) {
  2166. if (!vm.HasSubmitted) {
  2167. 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 = "";
  2168. vm.SelectedAnswers = [], $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Selected = !0, $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions[index].Classes = "selected", vm.SelectedAnswers.push({
  2169. ID: qId,
  2170. Index: qIndex
  2171. }), vm.SelectedAnswers.length > 0 ? vm.SubmitDisabled = !1 : vm.SubmitDisabled = !0
  2172. }
  2173. }, vm.SubmitClicked = function() {
  2174. 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")
  2175. }, $scope.$on("QuizAnswerFeedback", showFeedback)
  2176. }
  2177.  
  2178. function FinanceWeeklyFillGapController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
  2179. function checkComplete() {
  2180. 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++;
  2181. complete == $scope.$parent.vm.Quiz.CurrentQuestion.RequiredAnswerCount ? vm.SubmitDisabled = !1 : vm.SubmitDisabled = !0
  2182. }
  2183.  
  2184. function showFeedback(event, feedback) {
  2185. for (var i = 0; i < feedback.length; i++) {
  2186. var answer = feedback[i].split(":");
  2187. $scope.$broadcast("QuizShowFeedback", answer)
  2188. }
  2189. }
  2190.  
  2191. function showWordPopup(event, wordId, offset) {
  2192. if (!vm.HasSubmitted) {
  2193. vm.CurrentWordIndex = wordId, $(window).outerWidth() < 992 && (offset += 60), vm.WordPopupOffset = {
  2194. top: Math.round(offset) - 50 + "px"
  2195. }, vm.WordPopup = !0;
  2196. var count = 0,
  2197. setHeight = function() {
  2198. var el = angular.element(".word-popup-content")[0];
  2199. if (el.clientHeight > 0) {
  2200. var boxOffset = el.offsetTop,
  2201. bottomOffset = boxOffset + el.clientHeight,
  2202. gapHeight = $(".finance-weekly-fill-gap").height();
  2203. bottomOffset > gapHeight && (vm.PageOffset = {
  2204. height: bottomOffset + "px"
  2205. });
  2206. var popupHeight = el.clientHeight;
  2207. return $(".app-screen__app").animate({
  2208. scrollTop: offset + popupHeight - 130
  2209. }, 500), void $scope.$apply()
  2210. }
  2211. count++, count < 10 && setTimeout(setHeight, 10)
  2212. };
  2213. setHeight()
  2214. }
  2215. }
  2216. var vm = this;
  2217. 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) {
  2218. if (null != $scope.$parent.vm.Quiz) {
  2219. var text = $scope.$parent.vm.Quiz.CurrentQuestion.Text;
  2220. text = text.replace(/{(.*?)}/g, '<blank-word id="$1">$1</blank-word>'), vm.QuestionTxt = text;
  2221. 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
  2222. }
  2223. }), vm.AnswerClicked = function(data) {
  2224. 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);
  2225. if (!alreadyUsed) {
  2226. 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);
  2227. $scope.$broadcast("UpdateWordAnswer", vm.CurrentWordIndex, data), checkComplete()
  2228. }
  2229. }, vm.AnswerCleared = function(data) {
  2230. 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);
  2231. $scope.$broadcast("ClearAnswer", wordIndex, {
  2232. Text: "&nbsp;"
  2233. }, vm.CurrentWordIndex), checkComplete()
  2234. }, vm.SubmitClicked = function() {
  2235. vm.HasSubmitted && $scope.$emit("QuizQuestionFinished"), vm.SubmitDisabled || vm.HasSubmitted || (vm.SelectedAnswers = $scope.$parent.vm.Quiz.CurrentQuestion.AnswerOptions.filter(function(answer) {
  2236. if (answer.Index > -1) return {
  2237. ID: answer.ID,
  2238. Index: answer.Index
  2239. }
  2240. }), $scope.$emit("QuizSubmitAnswers", vm.SelectedAnswers), vm.HasSubmitted = !0, vm.ButtonText = "Next", dataLayer.push({
  2241. event: "quiz",
  2242. quizAction: "submit",
  2243. quizLabel: "week " + vm.Week + " " + $scope.$parent.vm.Quiz.Title,
  2244. quizType: "weekly quiz"
  2245. }))
  2246. }, vm.CloseClicked = function() {
  2247. vm.WordPopup = !1, vm.PageOffset = {}, $scope.$broadcast("QuizPopupClosed")
  2248. }, $scope.$on("QuizAnswerFeedback", showFeedback), $scope.$on("QuizWordPopup", showWordPopup), $scope.$on("QuizClearWord", function(event, data) {
  2249. vm.AnswerCleared(data)
  2250. })
  2251. }
  2252.  
  2253. function FinanceWeeklySummaryController($scope, FinanceWeeklyService, utils, GameMediaService, MessageService, GameInstancesService) {
  2254. var vm = this;
  2255. $scope.$watch("$parent.vm.Quiz.ScoreActual", function(newValue, oldValue) {
  2256. 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)
  2257. }), vm.FinishClicked = function() {
  2258. utils.navigateRoute($scope, "/app/dashboard/financeweekly", "next")
  2259. }
  2260. }
  2261.  
  2262. function WeeklyPlannerHomeController($scope, utils, GameMediaService, ItemsService, $stateParams, MessageService, $location) {
  2263. var vm = this;
  2264. vm.ShowMyBudget = !0, vm.Initialize = function() {
  2265. $location.path().indexOf("mybudget") > 0 ? vm.ShowMyBudget = !0 : $location.path().indexOf("diary") > 0 ? vm.ShowMyBudget = !1 : utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/mybudget", "appOpen")
  2266. }, vm.ShowMyBudgetClick = function() {
  2267. vm.ShowMyBudget = !0, utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/mybudget", "none")
  2268. }, vm.ShowDiaryClick = function() {
  2269. vm.ShowMyBudget = !1, utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/diary", "none")
  2270. }, $scope.$on("UpdateTab", function(event, data) {
  2271. vm.ShowMyBudget = data
  2272. }), vm.Initialize()
  2273. }
  2274.  
  2275. function DiaryController($scope, WeeklyPlannerService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
  2276. function savingComplete() {
  2277. vm.QuestionAnswered = !0, $scope.$broadcast("ResetTransferButton")
  2278. }
  2279. var vm = this;
  2280. vm.QuestionAnswered = !1, vm.Initialize = function() {
  2281. $scope.$emit("UpdateTab", !1), WeeklyPlannerService.getCurrentQuestion(function(data) {
  2282. log(data), vm.Question = data, vm.Question.Answer.length > 0 && (vm.QuestionAnswered = !0)
  2283. }, function(data) {
  2284. log(data)
  2285. })
  2286. }, vm.AnswerQuestion = function() {
  2287. vm.Question.Answer.length > 0 && ($scope.$broadcast("ShowTransferLoading"), WeeklyPlannerService.answerQuestion(vm.Question.Week, vm.Question.Answer, function(data) {
  2288. log(data), dataLayer.push({
  2289. event: "app",
  2290. appSelected: "weekly planner",
  2291. appAction: "save response"
  2292. }), $scope.$broadcast("ShowTransferSuccess")
  2293. }, function(data) {
  2294. $scope.$broadcast("ResetTransferButton"), log(data)
  2295. }))
  2296. }, vm.EditAnswer = function() {
  2297. vm.QuestionAnswered = !1, dataLayer.push({
  2298. event: "app",
  2299. appSelected: "weekly planner",
  2300. appAction: "edit response"
  2301. })
  2302. }, vm.ViewArchive = function() {
  2303. utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/archive", "next")
  2304. }, $scope.$on("TransactionComplete", savingComplete), vm.Initialize()
  2305. }
  2306.  
  2307. function MyBudgetController($scope, WeeklyPlannerService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
  2308. function updateRemainingClass() {
  2309. 0 == vm.SliderRemaining ? vm.RemainingClass = "zero" : vm.SliderRemaining < 0 ? vm.RemainingClass = "negative" : vm.RemainingClass = ""
  2310. }
  2311.  
  2312. function disableSliders(bool) {
  2313. for (var i = 0; i < vm.Sliders.length; i++) vm.Sliders[i].options.disabled = bool
  2314. }
  2315.  
  2316. function updateSliderSpend(event) {
  2317. 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;
  2318. vm.SliderRemaining = remaining - totalSliderSpend, updateRemainingClass()
  2319. }
  2320. var vm = this;
  2321. vm.Income = 0, vm.Expenses = {
  2322. Total: 0,
  2323. Rent: {
  2324. width: "0",
  2325. Title: "Rent",
  2326. Expense: 0
  2327. },
  2328. Food: {
  2329. width: "0",
  2330. Title: "Food",
  2331. Expense: 0
  2332. },
  2333. Travel: {
  2334. width: "0",
  2335. Title: "Travel",
  2336. Expense: 0
  2337. },
  2338. Entertainment: {
  2339. width: "0",
  2340. Title: "Entertainment",
  2341. Expense: 0
  2342. }
  2343. }, vm.Remaining = 0, vm.SliderRemaining = 0, vm.SliderOptions = {
  2344. id: 0,
  2345. floor: 0,
  2346. ceil: 100,
  2347. hidePointerLabels: !0,
  2348. hideLimitLabels: !0,
  2349. step: 1,
  2350. showSelectionBarFromValue: 1,
  2351. showSelectionBar: !0,
  2352. showSelectionBarEnd: !0,
  2353. onStart: function(sliderId, modelValue, highValue, pointerType) {
  2354. vm.SliderStart(sliderId, modelValue, highValue, pointerType)
  2355. },
  2356. onChange: function(sliderId, modelValue, highValue, pointerType) {
  2357. vm.SliderChange(sliderId, modelValue, highValue, pointerType)
  2358. },
  2359. onEnd: function(sliderId, modelValue, highValue, pointerType) {
  2360. vm.SliderEnd(sliderId, modelValue, highValue, pointerType)
  2361. }
  2362. }, vm.Initialize = function() {
  2363. $scope.$emit("UpdateTab", !0), vm.Sliders = [{
  2364. Value: 0,
  2365. Spend: null,
  2366. Title: "Bills"
  2367. }, {
  2368. Value: 0,
  2369. Spend: null,
  2370. Title: "Goods"
  2371. }, {
  2372. Value: 0,
  2373. Spend: null,
  2374. Title: "Savings Account"
  2375. }, {
  2376. Value: 0,
  2377. Spend: null,
  2378. Title: "Shares"
  2379. }, {
  2380. Value: 0,
  2381. Spend: null,
  2382. Title: "Fixed Term Investment"
  2383. }];
  2384. for (var i = 0; i < vm.Sliders.length; i++) vm.Sliders[i].options = angular.copy(vm.SliderOptions), vm.Sliders[i].options.id = i;
  2385. WeeklyPlannerService.getPlannerSummary(function(data) {
  2386. log("--> ", data), vm.Income = data.Income;
  2387. for (var c = 0; c < data.Expenses.length; c++) vm.Expenses.Total += data.Expenses[c].Value;
  2388. vm.Remaining = vm.SliderRemaining = vm.Income - vm.Expenses.Total, vm.Remaining <= 0 ? (vm.Expenses.Style = {
  2389. width: "100%"
  2390. }, disableSliders(!0)) : vm.Expenses.Style = {
  2391. width: Math.round(vm.Expenses.Total / vm.Income * 100) + "%"
  2392. }, updateRemainingClass();
  2393. for (var i = 0; i < data.Expenses.length; i++) switch (data.Expenses[i].Key) {
  2394. case "Rent expense":
  2395. vm.Expenses.Rent = {
  2396. width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
  2397. Title: "Rent",
  2398. Expense: data.Expenses[i].Value
  2399. };
  2400. break;
  2401. case "Entertainment expense":
  2402. vm.Expenses.Entertainment = {
  2403. width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
  2404. Title: "Entertainment",
  2405. Expense: data.Expenses[i].Value
  2406. };
  2407. break;
  2408. case "Food expense":
  2409. vm.Expenses.Food = {
  2410. width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
  2411. Title: "Food",
  2412. Expense: data.Expenses[i].Value
  2413. };
  2414. break;
  2415. case "Travel expense":
  2416. vm.Expenses.Travel = {
  2417. width: Math.round(data.Expenses[i].Value / vm.Expenses.Total * 100) + "%",
  2418. Title: "Travel",
  2419. Expense: data.Expenses[i].Value
  2420. }
  2421. }
  2422. }, function(data) {
  2423. log(data)
  2424. })
  2425. }, vm.SliderStart = function(sliderId, modelValue, highValue, pointerType) {}, vm.SliderChange = function(sliderId, modelValue, highValue, pointerType) {
  2426. vm.Sliders[sliderId].Spend = Math.round(vm.Remaining * (modelValue / 100));
  2427. 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;
  2428. vm.SliderRemaining = remaining - totalSliderSpend, updateRemainingClass()
  2429. }, vm.SliderEnd = function(sliderId, modelValue, highValue, pointerType) {}, $scope.$on("SliderSpendManuallyUpdated", updateSliderSpend), vm.Initialize()
  2430. }
  2431.  
  2432. function WeeklyPlannerDiaryArchiveController($scope, utils, WeeklyPlannerService, GameMediaService, ItemsService, $stateParams, MessageService, $location) {
  2433. var vm = this;
  2434. vm.Data = {}, vm.Initialize = function() {
  2435. WeeklyPlannerService.getQuestionInstances(function(data) {
  2436. log(data), vm.Data = data
  2437. }, function(data) {
  2438. log(data)
  2439. })
  2440. }, vm.QuestionClicked = function(question) {
  2441. WeeklyPlannerService.storeArchiveQuestion(question), utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/archive/view", "next")
  2442. }, vm.BackClicked = function() {
  2443. utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/diary", "back")
  2444. }, vm.Initialize()
  2445. }
  2446.  
  2447. function ViewDiaryController($scope, WeeklyPlannerService, utils, GameMediaService, ItemsService, $stateParams, MessageService, $timeout) {
  2448. function savingComplete() {
  2449. vm.QuestionAnswered = !0, $scope.$broadcast("ResetTransferButton")
  2450. }
  2451. var vm = this;
  2452. vm.Question = {}, vm.Initialize = function() {
  2453. 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");
  2454. }, vm.AnswerQuestion = function() {
  2455. vm.Question.Answer.length > 0 && ($scope.$broadcast("ShowTransferLoading"), WeeklyPlannerService.answerQuestion(vm.Question.Week, vm.Question.Answer, function(data) {
  2456. log(data), dataLayer.push({
  2457. event: "app",
  2458. appSelected: "weekly planner",
  2459. appAction: "save past response"
  2460. }), $scope.$broadcast("ShowTransferSuccess")
  2461. }, function(data) {
  2462. $scope.$broadcast("ResetTransferButton"), log(data)
  2463. }))
  2464. }, vm.EditAnswer = function() {
  2465. vm.QuestionAnswered = !1, dataLayer.push({
  2466. event: "app",
  2467. appSelected: "weekly planner",
  2468. appAction: "edit past response"
  2469. })
  2470. }, vm.BackClicked = function() {
  2471. utils.navigateRoute($scope, "/app/dashboard/weeklyplanner/archive", "back")
  2472. }, $scope.$on("TransactionComplete", savingComplete), vm.Initialize()
  2473. }
  2474.  
  2475. function EndFireworksController($scope, utils, $location, GameInstancesService, $localStorage, $window) {
  2476. var vm = this;
  2477. 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) {
  2478. response.HasEndSurvey && (vm.GameHasSurvey = !0, vm.GameName = " The Suncorp Essi Money Challenge")
  2479. }, function(response) {
  2480. log(response)
  2481. }), vm.ViewBalanceSheet = function() {
  2482. dataLayer.push({
  2483. event: "view final balance",
  2484. gameNumber: "game " + $localStorage.GameNumber
  2485. }), utils.navigateRoute($scope, "/end-of-game/balancesheet", "next")
  2486. }, vm.GetCertificate = function() {
  2487. dataLayer.push({
  2488. event: "download certificate",
  2489. gameNumber: "game " + $localStorage.GameNumber
  2490. }), $window.open(vm.CertificateUrl)
  2491. }
  2492. }
  2493.  
  2494. function SurveyController($scope, utils, $location, GameInstancesService, SurveyService) {
  2495. var vm = this;
  2496. vm.Name = "Loading survey", SurveyService.getSurvey(function(data) {
  2497. vm.Name = data.Name, vm.Options = data.Options
  2498. }, function(data) {
  2499. Log(data)
  2500. }), vm.checkEndGameSurvey = function() {
  2501. SurveyService.checkEndGameSurvey(function(data) {
  2502. alert("checked if end game survey exists")
  2503. }, function(data) {
  2504. Log(data)
  2505. })
  2506. }, vm.StartSurvey = function() {
  2507. utils.navigateRoute($scope, "/surveys/question", "next")
  2508. }, vm.FinishSurvey = function() {
  2509. utils.navigateRoute($scope, "/end-of-game/balancesheet", "next")
  2510. }
  2511. }
  2512.  
  2513. function SurveyQuestionController($scope, utils, SurveyService, $localStorage) {
  2514. function resetSelection() {
  2515. for (var i = 0; i < vm.Answers.length; i++) vm.Answers[i].Selected = "";
  2516. vm.Selection >= 0 && (vm.Answers[vm.Selection].Selected = "selected")
  2517. }
  2518. var vm = this;
  2519. 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() {
  2520. vm.GetNextQuestion()
  2521. }, vm.AnswerClicked = function(index) {
  2522. vm.DisableAnswers || (vm.Selection = index, resetSelection())
  2523. }, vm.SubmitAnswer = function() {
  2524. vm.Selection != -1 && SurveyService.submitSurvey(vm.Answers[vm.Selection].ID, function(response) {
  2525. dataLayer.push({
  2526. event: "end of game quiz",
  2527. endGameQuizAction: "submit question",
  2528. gameNumber: "game " + $localStorage.GameNumber,
  2529. endGameQuizQuestion: "question " + vm.CurrentQuestion
  2530. }), 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())
  2531. }, function(response) {})
  2532. }, vm.GetNextQuestion = function() {
  2533. SurveyService.getSurvey(function(response) {
  2534. return response.HasSurvey ? (vm.Question = response.Name, vm.Answers = response.Options, vm.Bonus = response.Bonus, vm.CurrentQuestion = response.CurrentQuestionIndex, SurveyService.setQuestionData({
  2535. CurrentQuestion: vm.CurrentQuestion,
  2536. TotalQuestions: response.TotalQuestionCount,
  2537. CashReward: vm.Bonus
  2538. }), SurveyService.getQuestionData().TotalQuestions === response.CurrentQuestionIndex && (vm.IsLastQuestion = !0), void 0) : (dataLayer.push({
  2539. event: "end of game quiz",
  2540. endGameQuizAction: "finish quiz",
  2541. gameNumber: "game " + $localStorage.GameNumber
  2542. }), void utils.navigateRoute($scope, "/end-of-game", "next"))
  2543. }, function(response) {})
  2544. }
  2545. }
  2546.  
  2547. function SurveyQuestionFeedbackController($scope, GameInstancesService, utils, SurveyService, $localStorage) {
  2548. var vm = this;
  2549. vm.progressData, vm.currentQuestion, vm.cashReward, vm.Init = function() {
  2550. vm.progressData = SurveyService.getQuestionData(), vm.currentQuestion = vm.progressData.CurrentQuestion, vm.cashReward = vm.progressData.CashReward
  2551. }, vm.Continue = function() {
  2552. dataLayer.push({
  2553. event: "end of game quiz",
  2554. endGameQuizAction: "continue",
  2555. gameNumber: "game " + $localStorage.GameNumber,
  2556. endGameQuizQuestion: "question " + vm.currentQuestion
  2557. }), utils.navigateRoute($scope, "/surveys/question", "next")
  2558. }
  2559. }
  2560.  
  2561. function SurveyProgressController($scope, utils, $location, GameInstancesService, SurveyService) {
  2562. var vm = this;
  2563. vm.ProgressData, vm.BarWidth;
  2564. var progressChanged = function() {
  2565. vm.ProgressData = SurveyService.getQuestionData();
  2566. var width = Math.round(vm.ProgressData.CurrentQuestion / vm.ProgressData.TotalQuestions * 100);
  2567. vm.BarWidth = {
  2568. width: width + "%"
  2569. }
  2570. };
  2571. SurveyService.registerObserverCallback(progressChanged), vm.Init = function() {
  2572. vm.ProgressData = SurveyService.getQuestionData();
  2573. var width = Math.round(vm.ProgressData.CurrentQuestion / vm.ProgressData.TotalQuestions * 100);
  2574. vm.BarWidth = {
  2575. width: width + "%",
  2576. transition: "none"
  2577. }
  2578. }
  2579. }
  2580. var appConfig = {
  2581. gameLength: 26,
  2582. baseUrl: "https://essimoney.com.au/api",
  2583. gameApps: [{
  2584. displayName: "My Bank",
  2585. application: "Banking",
  2586. state: "idle",
  2587. url: "/app/dashboard/banking",
  2588. priority: 2,
  2589. mobilePriority: 2
  2590. }, {
  2591. displayName: "My Cash",
  2592. application: "Cashbox",
  2593. state: "idle",
  2594. url: "/app/dashboard/cashbox",
  2595. priority: 5,
  2596. mobilePriority: 5
  2597. }, {
  2598. displayName: "My Credit",
  2599. application: "Credit Cards",
  2600. state: "idle",
  2601. url: "/app/dashboard/creditcard",
  2602. priority: 6,
  2603. mobilePriority: 6
  2604. }, {
  2605. displayName: "Email",
  2606. application: "Emails",
  2607. state: "idle",
  2608. url: "/app/dashboard/emails",
  2609. priority: 1,
  2610. mobilePriority: 1
  2611. }, {
  2612. displayName: "Messages",
  2613. application: "Text Messages",
  2614. state: "idle",
  2615. url: "/app/dashboard/text-message",
  2616. priority: 3,
  2617. mobilePriority: 3
  2618. }, {
  2619. displayName: "Job Finder",
  2620. application: "JobFinder",
  2621. state: "idle",
  2622. url: "/app/dashboard/job-finder",
  2623. priority: 8,
  2624. mobilePriority: 8
  2625. }, {
  2626. displayName: "MyStuff",
  2627. application: "Items",
  2628. state: "idle",
  2629. url: "/app/dashboard/my-stuff",
  2630. priority: 7,
  2631. mobilePriority: 7
  2632. }, {
  2633. displayName: "iBuy",
  2634. application: "iBuy",
  2635. state: "idle",
  2636. url: "/app/dashboard/ibuy",
  2637. priority: 10,
  2638. mobilePriority: 10
  2639. }, {
  2640. displayName: "uShop",
  2641. application: "uShop",
  2642. state: "idle",
  2643. url: "/app/dashboard/ushop",
  2644. priority: 9,
  2645. mobilePriority: 9
  2646. }, {
  2647. displayName: "Shares",
  2648. application: "Shares",
  2649. state: "idle",
  2650. url: "/app/dashboard/shares",
  2651. priority: 11,
  2652. mobilePriority: 11
  2653. }, {
  2654. displayName: "Finance Weekly",
  2655. application: "News",
  2656. state: "idle",
  2657. url: "/app/dashboard/financeweekly",
  2658. priority: 12,
  2659. mobilePriority: 12
  2660. }, {
  2661. displayName: "Weekly Planner",
  2662. application: "Planner",
  2663. state: "idle",
  2664. url: "/app/dashboard/weeklyplanner/mybudget",
  2665. priority: 4,
  2666. mobilePriority: 4
  2667. }],
  2668. enableLogging: !0,
  2669. glossary: [{
  2670. Term: "Gross Pay",
  2671. Definition: "The total amount of money you earned for the week, before any deductions were taken from your pay."
  2672. }, {
  2673. Term: "Net Pay",
  2674. Definition: "The amount of money you actually receive in your pay after income tax and superannuation have been deducted."
  2675. }, {
  2676. Term: "Income Tax",
  2677. Definition: "A government tax or charge based on what a person earns each week."
  2678. }, {
  2679. Term: "Superannuation",
  2680. Definition: "An amount of money put aside from each weekโ€™s pay and paid into a fund for when you retire."
  2681. }, {
  2682. Term: "Group Certificate",
  2683. Definition: "A statement provided to all employees by an employer detailing gross income, net income, tax paid and superannuation paid within the financial year."
  2684. }, {
  2685. Term: "Credit Card",
  2686. Definition: "A card which enables you to purchase goods and services with money lent to you by a bank or other financial institution."
  2687. }, {
  2688. Term: "Interest",
  2689. Definition: "The amount of money you have to pay to the financial institution for using its money to buy your goods and services."
  2690. }, {
  2691. Term: "Interest Rate",
  2692. Definition: "The percentage rate of interest you pay on the amount of credit you have used on your credit card."
  2693. }, {
  2694. Term: "Credit card limit",
  2695. Definition: "The maximum amount of money that you are able to use on your credit card."
  2696. }, {
  2697. Term: "Cash",
  2698. 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."
  2699. }, {
  2700. Term: "Bank Account",
  2701. Definition: "Bank account holds deposits of money you make into your personal individual account."
  2702. }, {
  2703. Term: "ATM",
  2704. Definition: "Automated Teller Machine"
  2705. }, {
  2706. Term: "Internet Banking",
  2707. Definition: "Internet Banking involves the ability to transfer money from one account to another, and to pay bills online."
  2708. }, {
  2709. Term: "Phone Banking",
  2710. Definition: "The ability to transfer money from one account to another, and to pay bills using a telephone or mobile phone."
  2711. }, {
  2712. Term: "BPay",
  2713. Definition: "Bpay enables you to have bills paid directly from your account to a business."
  2714. }, {
  2715. Term: "EFTPOS ",
  2716. Definition: "Electronic Funds Transfer Point of Sale."
  2717. }, {
  2718. Term: "Financial planner",
  2719. 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."
  2720. }, {
  2721. Term: "Budget",
  2722. Definition: "A statement of your income and expenditure over a period of time."
  2723. }, {
  2724. Term: "Income",
  2725. Definition: "Money earned by you from work and other sources"
  2726. }, {
  2727. Term: "Expenses",
  2728. Definition: "The money you spend on your needs and wants."
  2729. }, {
  2730. Term: "Debt",
  2731. Definition: "Debt is the amount of money owed by a person to another person, business and/or financial institution."
  2732. }, {
  2733. Term: "Assets",
  2734. Definition: "Assets are items of value that an individual owns such as a house, car, jewellery or cash in the bank."
  2735. }, {
  2736. Term: "Lender",
  2737. Definition: "Lender - A person, business or financial institution from whom you have borrowed money and are in debt to."
  2738. }, {
  2739. Term: "Debt consolidation",
  2740. Definition: "Debt consolidation is putting all your debts into one debt"
  2741. }, {
  2742. Term: "Debt collector",
  2743. Definition: "Debt collector is a person or company used by a lender to pursue you for the lenderโ€™s money"
  2744. }, {
  2745. Term: "Bankruptcy",
  2746. Definition: "Bankruptcy occurs when a person is unable to pay their debts and a court order is issued declaring a person bankrupt."
  2747. }, {
  2748. Term: "Unemployment",
  2749. Definition: "Unemployment is when a person does not have a job, but is currently seeking a job in the workforce."
  2750. }, {
  2751. Term: "Centrelink",
  2752. Definition: "Centrelink is the Australian Government organisation which looks after unemployment and social security (pensions) payments."
  2753. }, {
  2754. Term: "Personal loan",
  2755. Definition: "Personal loan โ€“ an amount of money used for a specific consumer purpose such as the purchase of a car."
  2756. }, {
  2757. Term: "Guarantor",
  2758. 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."
  2759. }, {
  2760. Term: "Principal",
  2761. Definition: "The Principal is the amount that is borrowed in a loan."
  2762. }, {
  2763. Term: "Interest Rate 2",
  2764. Definition: "The interest rate is the cost of the loan and determines how much extra money must be repaid on the loan."
  2765. }, {
  2766. Term: "Warranty",
  2767. Definition: "Is a guarantee or assurance that a product or item will perform or function without fault for a period of time."
  2768. }, {
  2769. Term: "Investing",
  2770. Definition: "Investing is the purchase of an asset with the intention of receiving an income or a capital gain or both for the owner."
  2771. }, {
  2772. Term: "Rate of return",
  2773. Definition: "Rate of return is how fast your money grows."
  2774. }, {
  2775. Term: "Risk",
  2776. Definition: "Risk is the level of uncertainty associated with a particular investment."
  2777. }, {
  2778. Term: "Bonds",
  2779. 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."
  2780. }, {
  2781. Term: "Property",
  2782. Definition: "Property includes land, houses, units, farms, shopping centres and commercial buildings."
  2783. }, {
  2784. Term: "Collectibles",
  2785. Definition: "Collectibles include paintings, sculptures, rare stamps etc."
  2786. }, {
  2787. Term: "Managed Funds",
  2788. Definition: "Managed Funds pool money from several investors and use the money to buy investments such as property and shares."
  2789. }, {
  2790. Term: "Shares",
  2791. Definition: "Shares are an investment that represents ownership in a company."
  2792. }, {
  2793. Term: "Stockbroker",
  2794. Definition: "A stockbroker is a person who buys and sells shares on your behalf."
  2795. }, {
  2796. Term: "Dividend",
  2797. Definition: "A dividend is a share of the companyโ€™s profits given to shareholders on the basis of how many shares they own."
  2798. }, {
  2799. Term: "Capital gain",
  2800. Definition: "Capital gain occurs when the sale price for an asset is greater than the original cost."
  2801. }, {
  2802. Term: "Insurance",
  2803. 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."
  2804. }, {
  2805. Term: "Insurance policy",
  2806. Definition: "An insurance policy is a written statement of what is covered when you take out insurance."
  2807. }, {
  2808. Term: "Insurance premium",
  2809. 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."
  2810. }, {
  2811. Term: "Insurance claim",
  2812. 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."
  2813. }, {
  2814. Term: "Excess",
  2815. 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."
  2816. }, {
  2817. Term: "Car Insurance",
  2818. Definition: "Car Insurance covers damage to your car, other cars and property in the event of an accident or theft."
  2819. }, {
  2820. Term: "Health Insurance",
  2821. Definition: "Health Insurance covers you against medical and hospital expenses not covered by Medicare."
  2822. }, {
  2823. Term: "Home insurance",
  2824. Definition: "Home insurance covers damage to your house in the vent of fire, flood, earthquake etc."
  2825. }, {
  2826. Term: "Contents insurance",
  2827. Definition: "Contents insurance covers damage to or theft of the contents of your house such as carpets, electrical appliances, clothing etc."
  2828. }, {
  2829. Term: "Life assurance",
  2830. Definition: "Life assurance provides a payout to a nominated person in the event of your death."
  2831. }, {
  2832. Term: "Travel insurance",
  2833. Definition: "Travel insurance covers you in the event of loss of luggage or medical expenses due to illness whilst travelling."
  2834. }, {
  2835. Term: "Income protection",
  2836. Definition: "Income protection insurance covers the loss of income through personal; accident, illness or disability."
  2837. }, {
  2838. Term: "Entrepreneur",
  2839. Definition: "An entrepreneur is someone who organises and manages a business, develops new ways of thinking and puts this into action."
  2840. }, {
  2841. Term: "Life expectancy",
  2842. Definition: "Life expectancy is the age to which you can expect to live."
  2843. }]
  2844. };
  2845. 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) {
  2846. $urlRouterProvider.otherwise("/timeout"), $locationProvider.hashPrefix(""), $stateProvider.state("app", {
  2847. url: "/app",
  2848. templateUrl: "app/operating-system/game-template.view.tpl"
  2849. }).state("timeout", {
  2850. url: "/timeout",
  2851. templateUrl: "app/partials/404.view.tpl"
  2852. }).state("app.dashboard", {
  2853. url: "/dashboard",
  2854. views: {
  2855. appView: {
  2856. template: '<div ui-view class="app-view height-100" ng-class="main.ViewTransition" ></div>'
  2857. },
  2858. leftView: {
  2859. templateUrl: "app/dashboard/dashboard-desktop.view.tpl",
  2860. controller: "DashboardController",
  2861. controllerAs: "vm"
  2862. },
  2863. rightView: {
  2864. templateUrl: "app/where-im-at/where-im-at-desktop.view.tpl",
  2865. controller: "WhereImAtController",
  2866. controllerAs: "vm"
  2867. }
  2868. }
  2869. }), $httpProvider.interceptors.push(["$q", "$location", "$localStorage", function($q, $location, $localStorage) {
  2870. return {
  2871. request: function(config) {
  2872. config.headers = config.headers || {};
  2873. var base = $location.path().split("/");
  2874. 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
  2875. },
  2876. responseError: function(response) {
  2877. return 401 !== response.status && 403 !== response.status || $location.path("/timeout"), $q.reject(response)
  2878. }
  2879. }
  2880. }])
  2881. }]), angular.module("essimoney").filter("isEmpty", function() {
  2882. var bar;
  2883. return function(obj) {
  2884. for (bar in obj)
  2885. if (obj.hasOwnProperty(bar)) return !1;
  2886. return !0
  2887. }
  2888. }), angular.module("essimoney").filter("orderObjectBy", function() {
  2889. return function(items, field, reverse) {
  2890. var filtered = [];
  2891. return angular.forEach(items, function(item) {
  2892. filtered.push(item)
  2893. }), filtered.sort(function(a, b) {
  2894. return a[field] > b[field] ? 1 : -1
  2895. }), reverse && filtered.reverse(), filtered
  2896. }
  2897. }), angular.module("essimoney").factory("utils", ["$localStorage", "$http", "ngDialog", "$location", "$window", "$timeout", function($localStorage, $http, ngDialog, $location, $window, $timeout) {
  2898. return {
  2899. "if": function(exp) {
  2900. var expEval = function(exp) {
  2901. this.params = [], this.exp = "function" == typeof exp ? exp(this) : exp
  2902. };
  2903. return expEval.prototype["true"] = function(success) {
  2904. return this.exp && success.apply(null, this.params), this
  2905. }, expEval.prototype["false"] = function(fail) {
  2906. return this.exp || fail.apply(null, this.params), this
  2907. }, expEval.prototype.addParams = function(params) {
  2908. 1 === arguments.length ? (angular.isArray(params) || (params = [params]), this.params = this.params.concat(params)) : this.params = arguments
  2909. }, new expEval(exp)
  2910. },
  2911. req: function(config) {
  2912. var request = $http(config);
  2913. return {
  2914. success: function(callback) {
  2915. return request.then(callback), this
  2916. },
  2917. fail: function(callback) {
  2918. return request.then(null, callback), this
  2919. }
  2920. }
  2921. },
  2922. getInstanceAppID: function(App) {
  2923. var gApps = $localStorage.GameAppInstances;
  2924. return gApps.filter(function(e) {
  2925. return e.Name === App
  2926. })[0].ID
  2927. },
  2928. getGameAppID: function(App) {
  2929. var gApps = $localStorage.GameAppInstances;
  2930. return gApps.filter(function(e) {
  2931. return e.Name === App
  2932. })[0].GameAppID
  2933. },
  2934. isGameDisabled: function(App) {
  2935. var gApps = $localStorage.GameAppInstances;
  2936. return gApps.filter(function(e) {
  2937. return e.Name === App
  2938. })[0].IsDisabled
  2939. },
  2940. navigateRoute: function(scope, path, direction) {
  2941. switch (scope.$emit("StartNavigateRoute"), direction) {
  2942. case "next":
  2943. scope.$emit("updateViewTransition", {
  2944. transition: "transition-app-screen-in",
  2945. path: path
  2946. }), $timeout(function() {
  2947. $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
  2948. }, 100);
  2949. break;
  2950. case "back":
  2951. scope.$emit("updateViewTransition", {
  2952. transition: "transition-app-screen-out",
  2953. path: path
  2954. }), $timeout(function() {
  2955. "" === path ? ($window.history.back(), $(".app-screen__app, html, body").scrollTop(0)) : (scope.$emit("updateViewTransition", {
  2956. transition: "transition-app-screen-out",
  2957. path: path
  2958. }), $timeout(function() {
  2959. $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
  2960. }, 100))
  2961. }, 100);
  2962. break;
  2963. case "appOpen":
  2964. scope.$emit("updateViewTransition", {
  2965. transition: "transition-dash-to-app",
  2966. path: path
  2967. }), $timeout(function() {
  2968. $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
  2969. }, 100);
  2970. break;
  2971. case "toDash":
  2972. scope.$emit("updateViewTransition", {
  2973. transition: "transition-app-to-dash",
  2974. path: path
  2975. }), $timeout(function() {
  2976. $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
  2977. }, 100);
  2978. break;
  2979. case "none":
  2980. scope.$emit("updateViewTransition", {
  2981. transition: "",
  2982. path: path
  2983. }), $timeout(function() {
  2984. $location.path(path), $(".app-screen__app, html, body").scrollTop(0)
  2985. }, 100)
  2986. }
  2987. },
  2988. currencyToNumber: function(currency) {
  2989. return "$" === String(currency).substring(0, 1) ? currency.substring(1, currency.length) : currency
  2990. },
  2991. addHTMLBreaks: function(content) {
  2992. return content.replace(/(?:\r\n|\\r|\\n)/g, "<br/>")
  2993. },
  2994. orderTransactionsArr: function(transactions) {
  2995. 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]);
  2996. var weeksSorted = [];
  2997. for (var key in weeks) weeks[key].reverse(), weeksSorted.push(weeks[key]);
  2998. return weeksSorted.reverse(), weeksSorted
  2999. },
  3000. isNumeric: function(n) {
  3001. return !isNaN(parseFloat(n)) && isFinite(n)
  3002. },
  3003. replaceBetween: function(str, start, end, replace) {
  3004. return str.substring(0, start) + replace + str.substring(end)
  3005. },
  3006. fillContentTokens: function(terms, content, template) {
  3007. for (var sortedTerms = terms.sort(function(a, b) {
  3008. return b.length - a.length
  3009. }), tokens = [], i = 0; i < sortedTerms.length; ++i)
  3010. for (var match, term = sortedTerms[i], re = new RegExp("\\b(" + term + ")\\b", "ig"); null != (match = re.exec(content));) {
  3011. for (var found = !1, j = 0; j < tokens.length; ++j) {
  3012. var token = tokens[j];
  3013. if (match.index >= token.start && match.index <= token.end) {
  3014. found = !0;
  3015. break
  3016. }
  3017. }
  3018. found || tokens.push({
  3019. term: term,
  3020. index: i,
  3021. start: match.index,
  3022. end: match.index + term.length
  3023. })
  3024. }
  3025. for (var sortedTokens = tokens.sort(function(a, b) {
  3026. return b.start - a.start
  3027. }), i = 0; i < sortedTokens.length; ++i) {
  3028. var token = sortedTokens[i];
  3029. content = this.replaceBetween(content, token.start, token.end, template.replace(/\|token\|/g, token.term))
  3030. }
  3031. return content
  3032. },
  3033. addGlossaryItems: function(content) {
  3034. for (var terms = [], i = 0; i < appConfig.glossary.length; ++i) terms.push(appConfig.glossary[i].Term);
  3035. return this.fillContentTokens(terms, content, '<glossary-item match="|token|" term="|token|"></glossary-item>')
  3036. },
  3037. getGlossaryDefinition: function(term) {
  3038. for (var i = 0; i < appConfig.glossary.length; i++)
  3039. if (term === appConfig.glossary[i].Term) return appConfig.glossary[i].Definition;
  3040. return !1
  3041. }
  3042. }
  3043. }]), angular.module("essimoney").directive("onFinishRender", function($timeout) {
  3044. return {
  3045. restrict: "A",
  3046. link: function(scope, element, attr) {
  3047. scope.$last === !0 && $timeout(function() {
  3048. scope.$emit(attr.onFinishRender)
  3049. })
  3050. }
  3051. }
  3052. }).directive("complexPassword", function() {
  3053. return {
  3054. require: "ngModel",
  3055. link: function(scope, elm, attrs, ctrl) {
  3056. ctrl.$parsers.unshift(function(password) {
  3057. var minimumCharacterCount = 8,
  3058. startGroupCount = 3,
  3059. hasUpperCase = /[A-Z]/.test(password),
  3060. hasLowerCase = /[a-z]/.test(password),
  3061. hasNumbers = /\d/.test(password),
  3062. characterGroupCount = hasUpperCase + hasLowerCase + hasNumbers;
  3063. return password.length >= minimumCharacterCount && characterGroupCount >= startGroupCount ? (ctrl.$setValidity("complexity", !0), password) : void ctrl.$setValidity("complexity", !1)
  3064. })
  3065. }
  3066. }
  3067. }).directive("passwordCheck", function() {
  3068. return {
  3069. require: "ngModel",
  3070. link: function(scope, elem, attrs, ctrl) {
  3071. var firstPassword = "#" + attrs.passwordCheck;
  3072. elem.add(firstPassword).on("keyup", function() {
  3073. scope.$apply(function() {
  3074. ctrl.$setValidity("passwordMatch", elem.val() === $(firstPassword).val())
  3075. })
  3076. })
  3077. }
  3078. }
  3079. }).directive("bindHtmlCompile", ["$compile", function($compile) {
  3080. return {
  3081. restrict: "A",
  3082. link: function(scope, element, attrs) {
  3083. scope.$watch(function() {
  3084. return scope.$eval(attrs.bindHtmlCompile)
  3085. }, function(value) {
  3086. element.html(value && value.toString());
  3087. var compileScope = scope;
  3088. attrs.bindHtmlScope && (compileScope = scope.$eval(attrs.bindHtmlScope)), $compile(element.contents())(compileScope)
  3089. })
  3090. }
  3091. }
  3092. }]).directive("transitionEnd", ["$parse", function($parse) {
  3093. var transitions = {
  3094. transition: "transitionend",
  3095. OTransition: "oTransitionEnd",
  3096. MozTransition: "transitionend",
  3097. WebkitTransition: "webkitTransitionEnd"
  3098. },
  3099. whichTransitionEvent = function() {
  3100. var t, el = document.createElement("fakeelement");
  3101. for (t in transitions)
  3102. if (void 0 !== el.style[t]) return transitions[t]
  3103. },
  3104. transitionEvent = whichTransitionEvent();
  3105. return {
  3106. restrict: "A",
  3107. link: function(scope, element, attrs) {
  3108. function addEvent() {
  3109. element.on(transitionEvent, transitionEventEnded)
  3110. }
  3111.  
  3112. function removeEvent() {
  3113. element.off(transitionEvent, transitionEventEnded)
  3114. }
  3115.  
  3116. function transitionEventEnded(evt) {}
  3117. var expr = attrs.transitionEnd;
  3118. $parse(expr);
  3119. scope.$on("updateViewTransition", function(event, data) {
  3120. removeEvent(), addEvent()
  3121. })
  3122. }
  3123. }
  3124. }]);
  3125. var guid = function() {
  3126. function s4() {
  3127. return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1)
  3128. }
  3129. return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4()
  3130. },
  3131. log = function() {
  3132. appConfig.enableLogging
  3133. },
  3134. logError = function() {
  3135. appConfig.enableLogging
  3136. };
  3137. angular.module("essimoney").service("AppsService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
  3138. return {
  3139. get: function(successCallback, failCallback) {
  3140. return null != $localStorage.Apps ? void successCallback($localStorage.Apps) : void utils.req({
  3141. method: "GET",
  3142. url: appConfig.baseUrl + "/api/a/apps"
  3143. }).success(function(response) {
  3144. return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.Messages)
  3145. }).fail(function(response) {
  3146. failCallback(response.data)
  3147. })
  3148. }
  3149. }
  3150. }]).service("GamesService", ["$http", "$q", "utils", "$localStorage", function($http, $q, utils, $localStorage) {
  3151. return {
  3152. create: function(name, successCallback, failCallback) {
  3153. utils.req({
  3154. method: "POST",
  3155. url: appConfig.baseUrl + "/api/g/games",
  3156. data: {
  3157. Name: name
  3158. }
  3159. }).success(function(response) {
  3160. return response.data.Status ? ($localStorage.GameID = response.data.ID, void successCallback(response.data.ID)) : void failCallback(response.data.Messages)
  3161. }).fail(function(response) {
  3162. failCallback(response.data)
  3163. })
  3164. },
  3165. apps: function(successCallback, failCallback) {
  3166. return null == $localStorage.GameID ? void failCallback(["Game not found."]) : null != $localStorage.GameApps ? void successCallback($localStorage.GameApps) : void utils.req({
  3167. method: "GET",
  3168. url: appConfig.baseUrl + "/api/g/games/apps",
  3169. params: {
  3170. GameID: $localStorage.GameID
  3171. }
  3172. }).success(function(response) {
  3173. return response.data.Success ? ($localStorage.GameApps = response.data.Results, void successCallback(response.data.Results)) : void failCallback(response.Messages)
  3174. }).fail(function(response) {
  3175. failCallback(response.data)
  3176. })
  3177. }
  3178. }
  3179. }]).service("GameInstancesService", ["$http", "utils", "$localStorage", "$rootScope", "FinancialInstanceService", "FinanceWeeklyService", function($http, utils, $localStorage, $rootScope, FinancialInstanceService, FinanceWeeklyService) {
  3180. var _currentWeek = 0,
  3181. _totalWeeks = 0,
  3182. _netWorth = 0,
  3183. giObj = {
  3184. create: function(successCallback, failCallback) {
  3185. utils.req({
  3186. method: "POST",
  3187. url: appConfig.baseUrl + "/api/i/games",
  3188. data: {
  3189. GameID: $localStorage.GameID
  3190. }
  3191. }).success(function(response) {
  3192. return response.data.Success ? ($localStorage.GameInstanceID = response.data.ID, void successCallback(response.data.ID)) : void failCallback(response.data.Messages)
  3193. }).fail(function(response) {
  3194. failCallback(response.data)
  3195. })
  3196. },
  3197. createGame: function(successCallback, failCallback) {
  3198. utils.req({
  3199. method: "PUT",
  3200. url: appConfig.baseUrl + "/api/i/games",
  3201. headers: {
  3202. "Content-Type": "application/json",
  3203. Authorization: "bearer " + encodeURIComponent($localStorage.Token)
  3204. },
  3205. data: {
  3206. GameLinkID: $localStorage.GameLinkID
  3207. }
  3208. }).success(function(response) {
  3209. return response.data.Success ? ($localStorage.GameInstanceID = response.data.ID, void successCallback(response.data.ID)) : void failCallback(response.data.Messages)
  3210. }).fail(function(response) {
  3211. failCallback(response.data)
  3212. })
  3213. },
  3214. apps: function(successCallback, failCallback) {
  3215. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : null != $localStorage.GameInstanceApps ? void successCallback($localStorage.GameInstanceApps) : void utils.req({
  3216. method: "GET",
  3217. url: appConfig.baseUrl + "/api/i/games/apps",
  3218. headers: {
  3219. "Content-Type": "application/json",
  3220. Authorization: "bearer " + encodeURIComponent($localStorage.Token)
  3221. },
  3222. params: {
  3223. GameInstanceID: $localStorage.GameInstanceID
  3224. }
  3225. }).success(function(response) {
  3226. return response.data.Success ? ($localStorage.GameAppInstances = response.data.Results, _totalWeeks = parseInt(response.data.TotalWeeks), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
  3227. }).fail(function(response) {
  3228. failCallback(response.data)
  3229. })
  3230. },
  3231. setAppAsViewed: function(appInstanceID, successCallback, failCallback) {
  3232. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
  3233. method: "POST",
  3234. url: appConfig.baseUrl + "/api/i/gameappinstances",
  3235. data: {
  3236. GameInstanceID: $localStorage.GameInstanceID,
  3237. AppInstanceID: appInstanceID
  3238. }
  3239. }).success(function(response) {
  3240. return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
  3241. }).fail(function(response) {
  3242. failCallback(response.data)
  3243. })
  3244. },
  3245. startWeek: function(successCallback, failCallback) {
  3246. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
  3247. method: "POST",
  3248. url: appConfig.baseUrl + "/api/i/games/startweek",
  3249. headers: {
  3250. "Content-Type": "application/json",
  3251. Authorization: "bearer " + encodeURIComponent($localStorage.Token)
  3252. },
  3253. data: {
  3254. GameInstanceID: $localStorage.GameInstanceID
  3255. }
  3256. }).success(function(response) {
  3257. 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) {
  3258. m.Message = m.Message.replace(/(?:\r\n|\\r|\\n)/g, "<br />"), m.Message = m.Message.replace(/%USERNAME%/g, $localStorage.PlayerName)
  3259. }), 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)
  3260. }).fail(function(response) {
  3261. failCallback(response.data.Messages)
  3262. })
  3263. },
  3264. endWeek: function(successCallback, failCallback) {
  3265. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
  3266. method: "POST",
  3267. url: appConfig.baseUrl + "/api/i/games/endweek",
  3268. headers: {
  3269. "Content-Type": "application/json",
  3270. Authorization: "bearer " + encodeURIComponent($localStorage.Token)
  3271. },
  3272. data: {
  3273. GameInstanceID: $localStorage.GameInstanceID
  3274. }
  3275. }).success(function(response) {
  3276. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  3277. }).fail(function(response) {
  3278. failCallback(response.data)
  3279. })
  3280. },
  3281. endWeekProcess: function() {
  3282. log("endWeekProcess in service", giObj.getCurrentWeek()), FinanceWeeklyService.isQuizRequiredAndCompleted(function(data) {
  3283. return data.IsQuizRequired && !data.IsQuizCompleted ? void $rootScope.$broadcast("AppIconStateUpdate", {
  3284. application: "News",
  3285. state: "block"
  3286. }) : void(1 === giObj.getCurrentWeek() ? FinancialInstanceService.getAccountSources("Banking", function(accounts) {
  3287. accounts.length > 0 ? (dataLayer.push({
  3288. event: "week",
  3289. weekState: "finish week",
  3290. weekCompleted: "week " + giObj.getCurrentWeek()
  3291. }), utils.navigateRoute($rootScope, "/end-of-week/end", "next")) : $rootScope.$broadcast("AppIconStateUpdate", {
  3292. application: "Banking",
  3293. state: "block"
  3294. })
  3295. }, function(messages) {
  3296. log(messages[0])
  3297. }) : (dataLayer.push({
  3298. event: "week",
  3299. weekState: "finish week",
  3300. weekCompleted: "week " + giObj.getCurrentWeek()
  3301. }), utils.navigateRoute($rootScope, "/end-of-week/end", "next")))
  3302. }, function(messages) {
  3303. alert("error")
  3304. })
  3305. },
  3306. getUser: function() {
  3307. if (null == $localStorage.GameInstanceID) return void failCallback(["Game Instance doesn't exist."]);
  3308. var userName = "Player";
  3309. return null != $localStorage.PlayerName && (userName = $localStorage.PlayerName), {
  3310. username: userName
  3311. }
  3312. },
  3313. setCurrentWeek: function(week) {
  3314. _currentWeek = week, $rootScope.$broadcast("CurrentWeekUpdated", _currentWeek)
  3315. },
  3316. getCurrentWeek: function() {
  3317. return _currentWeek
  3318. },
  3319. setConfigAppState: function(app, state) {
  3320. for (var i = 0; i < appConfig.gameApps.length; i++) appConfig.gameApps[i].application === app && (appConfig.gameApps[i].state = state)
  3321. },
  3322. setTotalWeeks: function(weeks) {
  3323. _totalWeeks = weeks
  3324. },
  3325. getTotalWeeks: function() {
  3326. return _totalWeeks
  3327. },
  3328. getProgressBarPercent: function() {
  3329. var width = Math.round(_currentWeek / _totalWeeks * 100);
  3330. return width + "%"
  3331. },
  3332. setNetWorth: function(netWorth) {
  3333. _netWorth = netWorth, $rootScope.$broadcast("NetWorthUpdated", _netWorth)
  3334. },
  3335. getNetWorth: function() {
  3336. return _netWorth
  3337. },
  3338. checkEndGameSurvey: function(successCallback, failCallback) {
  3339. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  3340. method: "GET",
  3341. url: appConfig.baseUrl + "/api/i/games/hasendsurvey",
  3342. params: {
  3343. GameInstanceID: $localStorage.GameInstanceID
  3344. }
  3345. }).success(function(response) {
  3346. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  3347. }).fail(function(response) {
  3348. failCallback(response.data)
  3349. })
  3350. }
  3351. };
  3352. return giObj
  3353. }]).service("GameMediaService", ["$http", "utils", "$localStorage", "GameInstancesService", function($http, utils, $localStorage, GameInstancesService) {
  3354. var MediaData = {};
  3355. return utils.req({
  3356. method: "GET",
  3357. url: "assets/images/media.json"
  3358. }).success(function(response) {
  3359. MediaData = response.data
  3360. }).fail(function(response) {
  3361. log(response);
  3362. }), {
  3363. get: function(mediaGroup, mediaID) {
  3364. 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"])
  3365. },
  3366. replaceContentPlaceholders: function(msg) {
  3367. for (var content = msg, username = GameInstancesService.getUser().username, emoticons = [
  3368. [":D", "emoticonbigsmile"],
  3369. [":(", "emoticonsad"],
  3370. [":)", "emoticonsmile"],
  3371. [";)", "emoticonwink"]
  3372. ], i = 0; i < emoticons.length; i++) content = content.replace(emoticons[i][0], '<img class="emoticon" src="' + this.get("textmessages", emoticons[i][1]) + '">');
  3373. return content = content.replace(/%USERNAME%/g, username)
  3374. }
  3375. }
  3376. }]), 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) {
  3377. return {
  3378. restrict: "E",
  3379. replace: !0,
  3380. link: function(scope, elem, attrs) {
  3381. scope.newGameInstance = "", scope.startWeek = function() {
  3382. GameInstancesService.startWeek(function(data) {
  3383. log(data)
  3384. }, function(message) {
  3385. log(message)
  3386. })
  3387. }, scope.endWeek = function() {
  3388. log(GameInstancesService.getCurrentWeek()), 1 === GameInstancesService.getCurrentWeek() ? FinancialInstanceService.getAccountSources("Banking", function(accounts) {
  3389. accounts.length > 0 ? GameInstancesService.endWeek(function(data) {
  3390. log(data)
  3391. }, function(message) {
  3392. log(message)
  3393. }) : scope.$broadcast("AppIconStateUpdate", {
  3394. application: "Banking",
  3395. state: "block"
  3396. })
  3397. }, function(messages) {
  3398. log(messages[0])
  3399. }) : GameInstancesService.endWeek(function(data) {
  3400. log(data)
  3401. }, function(message) {
  3402. log(message)
  3403. })
  3404. }, scope.createNewGameInstance = function() {
  3405. GameInstancesService.create(function(data) {
  3406. log(data), scope.newGameInstance = data, scope.$broadcast("CreateNewGame", data)
  3407. }, function(message) {
  3408. log(message)
  3409. })
  3410. }
  3411. },
  3412. templateUrl: "app/operating-system/debug/debug.tpl"
  3413. }
  3414. }]), angular.module("essimoney").directive("appHeader", ["$window", "$location", "utils", "$rootScope", function($window, $location, utils, $rootScope) {
  3415. return {
  3416. restrict: "E",
  3417. scope: {
  3418. title: "=",
  3419. showCalculator: "=",
  3420. backTo: "="
  3421. },
  3422. replace: !0,
  3423. link: function(scope, elem, attrs) {
  3424. scope.homeClicked = function() {
  3425. "quiz" == scope.backTo ? $rootScope.$broadcast("QuitingQuiz") : ($rootScope.$emit("ResetActiveApp"), utils.navigateRoute(scope, "app/dashboard/view", "toDash"))
  3426. }
  3427. },
  3428. templateUrl: "app/operating-system/app-header/app-header.tpl"
  3429. }
  3430. }]), angular.module("essimoney").directive("goBack", ["$window", "utils", "$rootScope", function($window, utils, $rootScope) {
  3431. return {
  3432. restrict: "AE",
  3433. scope: !1,
  3434. replace: !0,
  3435. link: function(scope, elem, attrs) {
  3436. function goBack(e) {
  3437. 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")
  3438. }
  3439. var vm = scope;
  3440. vm.goBack = goBack, vm.to = attrs.to
  3441. },
  3442. template: '<button ng-click="goBack()" class="btn btn-icon back"><span class="icon-back"></span></button>'
  3443. }
  3444. }]), 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) {
  3445. return {
  3446. showMessage: function(data) {
  3447. return ngDialog.open({
  3448. template: "app/operating-system/dialog-popup/dialog-popup.tpl",
  3449. controller: "DialogPopupController",
  3450. controllerAs: "vm",
  3451. data: {
  3452. type: "msg",
  3453. content: data.content
  3454. },
  3455. showClose: !1,
  3456. className: "dialog-popup"
  3457. })
  3458. },
  3459. showConfirm: function(data) {
  3460. var acceptBtnLabel = "Accept",
  3461. declineBtnLabel = "Decline";
  3462. return null != data.acceptBtnLabel && (acceptBtnLabel = data.acceptBtnLabel), null != data.declineBtnLabel && (declineBtnLabel = data.declineBtnLabel), ngDialog.open({
  3463. template: "app/operating-system/dialog-popup/dialog-popup.tpl",
  3464. controller: "DialogPopupController",
  3465. controllerAs: "vm",
  3466. data: {
  3467. type: "confirm",
  3468. content: data.content,
  3469. acceptFn: data.acceptFn,
  3470. declineFn: data.declineFn,
  3471. acceptBtnLabel: acceptBtnLabel,
  3472. declineBtnLabel: declineBtnLabel
  3473. },
  3474. showClose: !1,
  3475. className: "dialog-popup"
  3476. })
  3477. }
  3478. }
  3479. }]), angular.module("essimoney").directive("deviceHeight", ["$window", "$document", "utils", "$timeout", function($window, $document, utils, $timeout) {
  3480. return {
  3481. restrict: "AE",
  3482. scope: !1,
  3483. replace: !1,
  3484. link: function(scope, elem, attrs) {
  3485. function setDeviceHeight() {
  3486. var deviceHeight = angular.element($window).height(),
  3487. deviceWidth = angular.element($window).width();
  3488. deviceWidth < 991 ? elem.css({
  3489. height: deviceHeight
  3490. }) : elem.css({
  3491. height: ""
  3492. })
  3493. }
  3494. $timeout(function() {
  3495. setDeviceHeight()
  3496. }, 200), scope.$on("RefreshWebKitScrolling", function() {
  3497. elem.css({
  3498. "-webkit-overflow-scrolling": "auto"
  3499. }), setTimeout(function() {
  3500. elem.css({
  3501. "-webkit-overflow-scrolling": "touch"
  3502. })
  3503. }, 400)
  3504. }), angular.element($window).on("resize", setDeviceHeight), scope.$on("$destroy", function() {
  3505. angular.element($window).off("resize", setDeviceHeight)
  3506. })
  3507. }
  3508. }
  3509. }]), angular.module("essimoney").directive("dropdown", function($rootScope, $timeout, $document, utils) {
  3510. return {
  3511. restrict: "E",
  3512. templateUrl: "app/components/dropdown/dropdown.tpl",
  3513. scope: {
  3514. placeholder: "@",
  3515. list: "=",
  3516. selecteditem: "=",
  3517. property: "@",
  3518. id: "@"
  3519. },
  3520. link: function(scope, element) {
  3521. function cleanUp() {
  3522. scope.appWindow = angular.element($document[0].getElementsByClassName("app-window")), scope.appWindow.css("height", "")
  3523. }
  3524. log(scope), scope.listVisible = !1, scope.isPlaceholder = !0, scope.selectDisabled = !1, scope.scopeAppWindowh = !1, scope.ddPos = -1, scope.appWindow = 0, scope.$watch("list", function() {
  3525. null != scope.list && scope.list.length > 1 ? scope.selectDisabled = !1 : scope.selectDisabled = !0
  3526. }), scope.select = function(item) {
  3527. scope.selecteditem = item, scope.listVisible = !1, cleanUp()
  3528. }, scope.closeDropdown = function() {
  3529. scope.listVisible = !1, cleanUp()
  3530. }, scope.isselecteditem = function(item) {
  3531. if (null != scope.selecteditem) return item[scope.property] === scope.selecteditem[scope.property]
  3532. }, $rootScope.$on("closeAllDropDowns", function(event, id) {
  3533. id !== scope.id && (scope.listVisible = !1, cleanUp())
  3534. }), scope.show = function() {
  3535. if ($rootScope.$broadcast("closeAllDropDowns", scope.id), !scope.selectDisabled && scope.list.length > 1)
  3536. if (scope.listVisible) scope.listVisible = !1, cleanUp();
  3537. else {
  3538. scope.listVisible = !0;
  3539. var ddHeight = 0,
  3540. ddListTop = 0,
  3541. AppScreen = 0,
  3542. diff = 0;
  3543. $timeout(function() {
  3544. var ddList = angular.element(element[0].getElementsByClassName("list-item"));
  3545. ddList.each(function(index) {
  3546. ddHeight += angular.element(this).height()
  3547. }), 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({
  3548. scrollTop: $(element[0].getElementsByClassName("dropdown-list")).offset().top
  3549. }, 200)
  3550. }, 200)
  3551. }
  3552. }
  3553. }
  3554. }
  3555. }), angular.module("essimoney").directive("format", ["$filter", function($filter) {
  3556. return {
  3557. require: "?ngModel",
  3558. link: function(scope, elem, attrs, ctrl) {
  3559. ctrl && (ctrl.$formatters.unshift(function(a) {
  3560. return $filter(attrs.format)(ctrl.$modelValue)
  3561. }), elem.bind("blur", function(event) {
  3562. var plainNumber = elem.val().replace(/[^\d|\-+|\.+]/g, "");
  3563. elem.val($filter(attrs.format)(plainNumber))
  3564. }))
  3565. }
  3566. }
  3567. }]), angular.module("essimoney").directive("transferButton", ["$window", "$timeout", function($window, $timeout) {
  3568. return {
  3569. restrict: "E",
  3570. replace: !0,
  3571. scope: {
  3572. label: "@label"
  3573. },
  3574. link: function(scope, elem, attrs) {
  3575. function resetBtn() {
  3576. scope.showLabel = !0, scope.showLoading = !1, scope.showSuccess = !1, scope.disableBtn = !1
  3577. }
  3578. resetBtn(), scope.$on("ResetTransferButton", resetBtn), scope.$on("ShowTransferLoading", function(event, args) {
  3579. scope.showLabel = !1, scope.showLoading = !0, scope.showSuccess = !1, scope.disableBtn = !0
  3580. }), scope.$on("ShowTransferSuccess", function(event, args) {
  3581. $timeout(function() {
  3582. scope.showLabel = !1, scope.showLoading = !1, scope.showSuccess = !0, $timeout(function() {
  3583. scope.$emit("TransactionComplete")
  3584. }, 1e3)
  3585. }, 1e3)
  3586. })
  3587. },
  3588. 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>'
  3589. }
  3590. }]), angular.module("essimoney").directive("creditCardImage", ["$window", "$timeout", "GameInstancesService", "GameMediaService", function($window, $timeout, GameInstancesService, GameMediaService) {
  3591. return {
  3592. restrict: "E",
  3593. replace: !0,
  3594. scope: {
  3595. cardName: "="
  3596. },
  3597. link: function(scope, elem, attrs) {
  3598. scope.name = GameInstancesService.getUser().username, scope.$watch("cardName", function() {
  3599. void 0 !== scope.cardName && (scope.image = GameMediaService.get("creditcard", scope.cardName))
  3600. })
  3601. },
  3602. template: '<div><div class="image"><img ng-src="{{image}}"></div><div class="card-name">{{name}}</div></div>'
  3603. }
  3604. }]), angular.module("essimoney").directive("itemImage", ["$window", "$timeout", "GameMediaService", function($window, $timeout, GameMediaService) {
  3605. return {
  3606. restrict: "E",
  3607. replace: !0,
  3608. scope: {
  3609. itemId: "="
  3610. },
  3611. link: function(scope, elem, attrs) {
  3612. scope.$watch("itemId", function() {
  3613. void 0 !== scope.itemId && (scope.image = GameMediaService.get("items", scope.itemId))
  3614. })
  3615. },
  3616. template: '<div><img ng-src="{{image}}"></div>'
  3617. }
  3618. }]), angular.module("essimoney").directive("accountIcon", ["GameMediaService", function(GameMediaService) {
  3619. return {
  3620. restrict: "E",
  3621. scope: {
  3622. accountType: "="
  3623. },
  3624. replace: !0,
  3625. link: function(scope, elem, attrs) {
  3626. scope.$watch("accountType", function() {
  3627. scope.icon = GameMediaService.get("banking", scope.accountType)
  3628. })
  3629. },
  3630. template: '<span ng-class="icon"></span>'
  3631. }
  3632. }]), angular.module("essimoney").directive("fullHeight", ["utils", "$document", "$window", function(utils, $document, $window) {
  3633. return {
  3634. restrict: "A",
  3635. link: function(scope, elem, attrs) {
  3636. scope.$watch("fullHeight", function() {
  3637. log("watch"), scope.onResize()
  3638. }), scope.onResize = function() {
  3639. var appScreen = angular.element($document[0].getElementsByClassName(attrs.fullHeight));
  3640. log(elem.height() + " < " + (appScreen.height() - 39))
  3641. }, angular.element($window).bind("resize", function() {
  3642. scope.onResize()
  3643. })
  3644. }
  3645. }
  3646. }]), angular.module("essimoney").directive("moneyAmountInput", ["$window", "$timeout", function($window, $timeout) {
  3647. return {
  3648. restrict: "E",
  3649. replace: !0,
  3650. scope: !1,
  3651. link: function(scope, elem, attrs, modelCtrl) {
  3652. log(scope.vm), scope.inputPattern = /^\d+$/, scope.onlyNumbers = function(event) {
  3653. var keys = {
  3654. up: 38,
  3655. right: 39,
  3656. down: 40,
  3657. left: 37,
  3658. escape: 27,
  3659. backspace: 8,
  3660. tab: 9,
  3661. enter: 13,
  3662. del: 46,
  3663. 0: 48,
  3664. 1: 49,
  3665. 2: 50,
  3666. 3: 51,
  3667. 4: 52,
  3668. 5: 53,
  3669. 6: 54,
  3670. 7: 55,
  3671. 8: 56,
  3672. 9: 57
  3673. };
  3674. for (var index in keys)
  3675. if (keys.hasOwnProperty(index) && (event.charCode == keys[index] || event.keyCode == keys[index])) return;
  3676. event.preventDefault()
  3677. }
  3678. },
  3679. 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>'
  3680. }
  3681. }]), angular.module("essimoney").directive("lockedAccount", function($rootScope, $timeout, $document, utils) {
  3682. return {
  3683. restrict: "E",
  3684. scope: !1,
  3685. link: function(scope, element, attr) {
  3686. function setHight() {
  3687. var bgElement = angular.element(element[0].getElementsByClassName("inner"));
  3688. bgElement.height(element.parent().height() - 50)
  3689. }
  3690. $timeout(setHight)
  3691. }
  3692. }
  3693. }), angular.module("essimoney").directive("appHeight", function($rootScope, $timeout, $document, utils) {
  3694. return {
  3695. restrict: "E",
  3696. scope: !1,
  3697. link: function(scope, element, attr) {
  3698. function updateHeight(data) {
  3699. for (var elements = angular.element(element[0].getElementsByClassName(data.selector)), allHeights = 0, i = 0; i < elements.length; i++) allHeights += angular.element(elements[i]).outerHeight();
  3700. allHeights += parseInt(data.offset), element.height(allHeights)
  3701. }
  3702. scope.$on("UpdateAppHeight", function(event, data) {
  3703. updateHeight(data)
  3704. })
  3705. }
  3706. }
  3707. }), angular.module("essimoney").directive("glossaryItem", ["MessageService", "utils", function(MessageService, utils) {
  3708. return {
  3709. restrict: "E",
  3710. scope: !0,
  3711. replace: !0,
  3712. link: function(scope, elem, attrs) {
  3713. scope.Match = attrs.match, scope.Term = attrs.term, scope.glossaryClicked = function() {
  3714. dataLayer.push({
  3715. event: "app",
  3716. appSelected: "finance weekly",
  3717. appAction: "term definition"
  3718. }), MessageService.showMessage({
  3719. content: "<h1>" + scope.Term + "</h1><p>" + utils.getGlossaryDefinition(scope.Term) + "</p>"
  3720. })
  3721. }
  3722. },
  3723. template: ' <a href="" ng-click="glossaryClicked()">{{Match}}</a> '
  3724. }
  3725. }]), angular.module("essimoney.authentication", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.authentication").service("AuthenticationService", ["$http", "utils", "$localStorage", function($http, utils, $localStorage) {
  3726. return {
  3727. requestToken: function(username, password, successCallback, failCallback) {
  3728. utils.req({
  3729. method: "POST",
  3730. url: appConfig.baseUrl + "/Token",
  3731. data: "grant_type=password&username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password)
  3732. }).success(function(response) {
  3733. 200 === response.status ? ($localStorage.Token = response.data.access_token, $localStorage.PlayerName = response.data.name, $localStorage.UserID = response.data.userId, successCallback(response.data), dataLayer.push({
  3734. event: "user action",
  3735. userAction: "log in"
  3736. })) : failCallback(response.data)
  3737. }).fail(function(response) {
  3738. failCallback(response)
  3739. })
  3740. },
  3741. register: function(email, yob, password, gender, confirmPassword, name, callbackUrl, successCallback, failCallback) {
  3742. utils.req({
  3743. method: "POST",
  3744. url: appConfig.baseUrl + "/api/Account/Register",
  3745. data: {
  3746. Email: email,
  3747. YOB: yob,
  3748. Password: password,
  3749. ConfirmPassword: confirmPassword,
  3750. Name: name,
  3751. Gender: gender,
  3752. CallbackUrl: callbackUrl
  3753. }
  3754. }).success(function(response) {
  3755. successCallback(response)
  3756. }).fail(function(response) {
  3757. failCallback(response)
  3758. })
  3759. },
  3760. yobRange: function(successCallback, failCallback) {
  3761. utils.req({
  3762. method: "GET",
  3763. url: appConfig.baseUrl + "/api/Account/yobrange"
  3764. }).success(function(response) {
  3765. successCallback(response)
  3766. }).fail(function(response) {
  3767. failCallback(response)
  3768. })
  3769. },
  3770. sendResetPassword: function(username, callbackUrl, successCallback, failCallback) {
  3771. utils.req({
  3772. method: "POST",
  3773. url: appConfig.baseUrl + "/api/Account/sendresetpassword?UserName=" + encodeURIComponent(username),
  3774. data: {
  3775. UserName: username,
  3776. CallbackUrl: callbackUrl
  3777. }
  3778. }).success(function(response) {
  3779. successCallback(response)
  3780. }).fail(function(response) {
  3781. failCallback(response)
  3782. })
  3783. },
  3784. resetPassword: function(userID, token, newPassword, confirmPassword, successCallback, failCallback) {
  3785. utils.req({
  3786. method: "POST",
  3787. url: appConfig.baseUrl + "/api/Account/ResetPassword",
  3788. data: {
  3789. UserID: userID,
  3790. Code: token,
  3791. NewPassword: newPassword,
  3792. ConfirmPassword: confirmPassword
  3793. }
  3794. }).success(function(response) {
  3795. successCallback(response)
  3796. }).fail(function(response) {
  3797. failCallback(response)
  3798. })
  3799. },
  3800. logout: function(successCallback, failCallback) {
  3801. utils.req({
  3802. method: "POST",
  3803. url: appConfig.baseUrl + "/api/account/logout",
  3804. headers: {
  3805. "Content-Type": "application/json",
  3806. Authorization: "bearer " + encodeURIComponent($localStorage.Token)
  3807. },
  3808. data: {}
  3809. }).success(function(response) {
  3810. successCallback(response), dataLayer.push({
  3811. event: "user action",
  3812. userAction: "log out"
  3813. })
  3814. }).fail(function(response) {
  3815. failCallback(response)
  3816. })
  3817. }
  3818. }
  3819. }]), angular.module("essimoney.authentication").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  3820. $stateProvider.state("auth", {
  3821. url: "/auth",
  3822. templateUrl: "app/authentication/auth.view.tpl"
  3823. }).state("auth.login", {
  3824. url: "/login/:gamelinkid",
  3825. templateUrl: "app/authentication/login/login.tpl",
  3826. controller: "AuthLoginController",
  3827. controllerAs: "vm"
  3828. }).state("auth.create", {
  3829. url: "/create-user",
  3830. templateUrl: "app/authentication/create-user/create-user.tpl",
  3831. controller: "AuthCreateUserController",
  3832. controllerAs: "vm"
  3833. }).state("auth.password-reset", {
  3834. url: "/password-reset?user&token",
  3835. templateUrl: "app/authentication/password-reset/password-reset.tpl",
  3836. controller: "PasswordResetController",
  3837. controllerAs: "vm"
  3838. }).state("auth.account-recovery", {
  3839. url: "/account-recovery/:gamelinkid",
  3840. templateUrl: "app/authentication/recovery/recovery.tpl",
  3841. controller: "AuthRecoveryController",
  3842. controllerAs: "vm"
  3843. }).state("auth.game", {
  3844. url: "/game",
  3845. templateUrl: "app/authentication/select-game/select-game.tpl",
  3846. controller: "AuthSelectGameController",
  3847. controllerAs: "vm",
  3848. resolve: {
  3849. GameInstances: function() {}
  3850. }
  3851. })
  3852. }]), 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() {
  3853. 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;
  3854. return {
  3855. require: "ngModel",
  3856. restrict: "",
  3857. link: function(scope, elm, attrs, ctrl) {
  3858. ctrl && ctrl.$validators.email && (ctrl.$validators.email = function(modelValue) {
  3859. return ctrl.$isEmpty(modelValue) || EMAIL_REGEXP.test(modelValue)
  3860. })
  3861. }
  3862. }
  3863. }), angular.module("essimoney.authentication").directive("validateYob", ["AuthenticationService", function(AuthenticationService) {
  3864. var YEAR_REGEX = /[0-9]{4}/;
  3865. return {
  3866. require: "ngModel",
  3867. restrict: "",
  3868. link: function(scope, elm, attrs, ctrl) {
  3869. if (ctrl) {
  3870. var startYear = 0,
  3871. endYear = 9999;
  3872. AuthenticationService.yobRange(function(response) {
  3873. startYear = +response.data.StartYear, endYear = +response.data.EndYear
  3874. }, function(response) {
  3875. log(response)
  3876. }), ctrl.$validators.yobrange = function(modelValue) {
  3877. if (YEAR_REGEX.test(modelValue)) {
  3878. var yob = +modelValue;
  3879. return yob >= startYear && yob <= endYear
  3880. }
  3881. return !0
  3882. }
  3883. }
  3884. }
  3885. }
  3886. }]), angular.module("essimoney.dashboard", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.dashboard").service("DashboardService", ["$http", "$q", function() {
  3887. var _GameApplications = {};
  3888. return {
  3889. setGameApps: function(gameApps) {
  3890. _GameApplications = gameApps
  3891. },
  3892. getGameApps: function(gameApps) {
  3893. return _GameApplications
  3894. }
  3895. }
  3896. }]), 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) {
  3897. $stateProvider.state("app.dashboard.view", {
  3898. url: "/view",
  3899. templateUrl: "app/dashboard/dashboard.view.tpl",
  3900. controller: "DashboardController",
  3901. controllerAs: "vm"
  3902. })
  3903. }]), angular.module("essimoney").directive("dashboardAppBtn", ["$rootScope", "$location", "utils", "GameMediaService", "MentorService", "GameInstancesService", function($rootScope, $location, utils, GameMediaService, MentorService, GameInstancesService) {
  3904. return {
  3905. restrict: "E",
  3906. scope: {
  3907. appData: "="
  3908. },
  3909. replace: !0,
  3910. link: function(scope, elem, attrs) {
  3911. function updateIcon() {
  3912. "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"))
  3913. }
  3914.  
  3915. function openApp() {
  3916. scope.$emit("ResetActiveApp"), scope.appData.active = !0, scope.appData.HasBeenAccessed || MentorService.getAppHelpMessage(scope.appData.GameAppID, function(data) {
  3917. for (var mentorMessages = [], i = 0; i < data.Results.length; i++) mentorMessages.push({
  3918. ID: 0,
  3919. Message: data.Results[i].Body,
  3920. Title: data.Results[i].Title
  3921. });
  3922. mentorMessages.length > 0 && scope.$emit("ShowMentorPopup", mentorMessages), GameInstancesService.setAppAsViewed(scope.appData.ID, function() {
  3923. scope.$emit("UpdateNotifications")
  3924. }, function() {})
  3925. }, function(data) {
  3926. log("fail help message", data)
  3927. }), utils.navigateRoute(scope, scope.appData.url, "appOpen")
  3928. }
  3929. scope.$watchCollection("[appData.state, appData.HasUpdate ]", function() {
  3930. updateIcon()
  3931. }), scope.appClicked = function() {
  3932. $location.path().indexOf("financeweekly/quiz") > -1 && $location.path().indexOf("summary") == -1 ? $rootScope.$broadcast("QuitingQuiz") : openApp()
  3933. }
  3934. },
  3935. 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>'
  3936. }
  3937. }]), 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) {
  3938. return {
  3939. getProgress: function(successCallback, failCallback) {
  3940. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  3941. method: "GET",
  3942. url: appConfig.baseUrl + "/api/i/progress",
  3943. params: {
  3944. GameInstanceID: $localStorage.GameInstanceID
  3945. }
  3946. }).success(function(response) {
  3947. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  3948. }).fail(function(response) {
  3949. failCallback(response.data)
  3950. })
  3951. }
  3952. }
  3953. }]), angular.module("essimoney.whereimat").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  3954. $stateProvider.state("app.dashboard.whereimat", {
  3955. url: "/where-im-at",
  3956. templateUrl: "app/where-im-at/where-im-at-mobile.view.tpl",
  3957. controller: "WhereImAtController",
  3958. controllerAs: "vm"
  3959. })
  3960. }]), angular.module("essimoney.banking", ["ui.router", "ngStorage"]), angular.module("essimoney.banking").service("GameBankingService", ["$http", "utils", "$localStorage", function($http, utils, $localStorage) {
  3961. return {
  3962. get: function(successCallback, failCallback) {
  3963. 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({
  3964. method: "GET",
  3965. url: appConfig.baseUrl + "/api/g/banking",
  3966. params: {
  3967. GameID: $localStorage.GameID
  3968. }
  3969. }).success(function(response) {
  3970. return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
  3971. }).fail(function(response) {
  3972. failCallback(response.data)
  3973. })
  3974. },
  3975. getInvestmentAccounts: function(successCallback, failCallback) {
  3976. 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({
  3977. method: "GET",
  3978. url: appConfig.baseUrl + "/api/g/banking/investments",
  3979. params: {
  3980. GameID: $localStorage.GameID
  3981. }
  3982. }).success(function(response) {
  3983. return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
  3984. }).fail(function(response) {
  3985. failCallback(response.data)
  3986. })
  3987. }
  3988. }
  3989. }]).service("BankingInstanceService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
  3990. return {
  3991. get: function(successCallback, failCallback) {
  3992. 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({
  3993. method: "GET",
  3994. url: appConfig.baseUrl + "/api/i/banking",
  3995. params: {
  3996. GameInstanceID: $localStorage.GameInstanceID
  3997. }
  3998. }).success(function(response) {
  3999. return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
  4000. }).fail(function(response) {
  4001. failCallback(response.data.Messages)
  4002. })
  4003. },
  4004. create: function(gameAccountID, transferFromGameAppInstanceID, transferFromAccountInstanceID, amount, successCallback, failCallback) {
  4005. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : (log(amount), void utils.req({
  4006. method: "POST",
  4007. url: appConfig.baseUrl + "/api/i/banking",
  4008. data: {
  4009. GameInstanceID: $localStorage.GameInstanceID,
  4010. GameAccountID: gameAccountID,
  4011. TransferFromGameAppInstanceID: transferFromGameAppInstanceID,
  4012. TransferFromAccountInstanceID: transferFromAccountInstanceID,
  4013. Amount: amount
  4014. }
  4015. }).success(function(response) {
  4016. return response.data.Success ? ($rootScope.$broadcast("AppIconStateUpdate", {
  4017. application: "Banking",
  4018. state: "idle"
  4019. }), $rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
  4020. }).fail(function(response) {
  4021. failCallback([response.data.Message])
  4022. }))
  4023. },
  4024. close: function(accountInstanceID, transferToAccountInstanceID, successCallback, failCallback) {
  4025. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : (log($localStorage.GameInstanceID, accountInstanceID, transferToAccountInstanceID), void utils.req({
  4026. method: "POST",
  4027. url: appConfig.baseUrl + "/api/i/banking/close",
  4028. data: {
  4029. GameInstanceID: $localStorage.GameInstanceID,
  4030. AccountInstanceID: accountInstanceID,
  4031. TransferToAccountInstanceID: transferToAccountInstanceID
  4032. }
  4033. }).success(function(response) {
  4034. return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
  4035. }).fail(function(response) {
  4036. failCallback([response.data.Message])
  4037. }))
  4038. },
  4039. getInvestmentAccounts: function(successCallback, failCallback) {
  4040. 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({
  4041. method: "GET",
  4042. url: appConfig.baseUrl + "/api/i/banking/investments",
  4043. params: {
  4044. GameInstanceID: $localStorage.GameInstanceID
  4045. }
  4046. }).success(function(response) {
  4047. return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
  4048. }).fail(function(response) {
  4049. failCallback(response.data)
  4050. })
  4051. },
  4052. createInvestmentAccount: function(data, successCallback, failCallback) {
  4053. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : (data.GameInstanceID = $localStorage.GameInstanceID, utils.req({
  4054. method: "POST",
  4055. url: appConfig.baseUrl + "/api/i/banking/investments",
  4056. data: data
  4057. }).success(function(response) {
  4058. return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data.Results)) : void failCallback(response.data.Messages)
  4059. }).fail(function(response) {
  4060. failCallback(response.data.Messages)
  4061. }))
  4062. }
  4063. }
  4064. }]), angular.module("essimoney.banking").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  4065. $stateProvider.state("app.dashboard.banking", {
  4066. url: "/banking",
  4067. templateUrl: "app/banking/index/banking-index.tpl",
  4068. controller: "BankIndexController",
  4069. controllerAs: "vm"
  4070. }).state("app.dashboard.banking-chooseAccount", {
  4071. url: "/banking/choose-account",
  4072. templateUrl: "app/banking/choose-account/choose-account.tpl",
  4073. controller: "ChooseBankAccountController",
  4074. controllerAs: "vm"
  4075. }).state("app.dashboard.banking-openAccount-id", {
  4076. url: "/banking/open-account/:id",
  4077. templateUrl: "app/banking/open-account/open-account.tpl",
  4078. controller: "BankOpenAccountController",
  4079. controllerAs: "vm"
  4080. }).state("app.dashboard.banking-account-statement-id", {
  4081. url: "/banking/account-statement/:id",
  4082. templateUrl: "app/banking/account-statement/account-statement.tpl",
  4083. controller: "AccountStatementController",
  4084. controllerAs: "vm"
  4085. }).state("app.dashboard.banking-investmentStatement/id", {
  4086. url: "/banking/investment-statement/:id",
  4087. templateUrl: "app/banking/account-statement/account-statement.tpl",
  4088. controller: "AccountStatementController",
  4089. controllerAs: "vm"
  4090. }).state("app.dashboard.banking-choosingInvestment", {
  4091. url: "/banking/choose-investment",
  4092. templateUrl: "app/banking/choose-investment/choose-investment.tpl",
  4093. controller: "ChooseInvestmentsController",
  4094. controllerAs: "vm"
  4095. }).state("app.dashboard.banking-openInvestmentAccount-id", {
  4096. url: "/banking/open-investment-account/:id",
  4097. templateUrl: "app/banking/open-investment-account/open-investment-account.tpl",
  4098. controller: "OpenInvestmentAccountController",
  4099. controllerAs: "vm"
  4100. })
  4101. }]), 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) {
  4102. return {
  4103. payBill: function(fromGameAppInstanceID, fromAccountInstanceID, billInstanceID, setAutomatic, successCallback, failCallback) {
  4104. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4105. method: "POST",
  4106. url: appConfig.baseUrl + "/api/i/bills/pay",
  4107. data: {
  4108. GameInstanceID: $localStorage.GameInstanceID,
  4109. FromGameAppInstanceID: fromGameAppInstanceID,
  4110. FromAccountInstanceID: fromAccountInstanceID,
  4111. BillInstanceID: billInstanceID,
  4112. SetAutomatic: setAutomatic
  4113. }
  4114. }).success(function(response) {
  4115. return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  4116. }).fail(function(response) {
  4117. failCallback(response.data)
  4118. })
  4119. }
  4120. }
  4121. }]), angular.module("essimoney.cashbox", ["ui.router", "ngStorage"]), angular.module("essimoney.cashbox").service("a_cashbox", ["$http", "$q", "$localStorage", "utils", function($http, $q) {
  4122. return {
  4123. createCshboxAccount: function() {},
  4124. getCshboxAccounts: function() {}
  4125. }
  4126. }]).service("g_cashbox", ["$http", "$q", "$localStorage", "utils", function($http, $q) {
  4127. return {
  4128. createGameApp: function() {},
  4129. createGameAccnt: function() {}
  4130. }
  4131. }]).service("i_cashbox", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
  4132. return {
  4133. getGameInstanceCashbox: function() {
  4134. var req = utils.req({
  4135. method: "GET",
  4136. url: appConfig.baseUrl + "/api/i/cashbox",
  4137. params: {
  4138. GameInstanceID: $localStorage.GameInstanceID
  4139. }
  4140. });
  4141. return req
  4142. }
  4143. }
  4144. }]).service("CashboxInstanceService", ["$localStorage", "utils", function($localStorage, utils) {
  4145. return {
  4146. get: function(successCallback, failCallback) {
  4147. 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({
  4148. method: "GET",
  4149. url: appConfig.baseUrl + "/api/i/cashbox",
  4150. params: {
  4151. GameInstanceID: $localStorage.GameInstanceID
  4152. }
  4153. }).success(function(response) {
  4154. return response.data ? void successCallback(response.data) : void failCallback(response)
  4155. }).fail(function(response) {
  4156. failCallback(response.data)
  4157. })
  4158. }
  4159. }
  4160. }]), angular.module("essimoney.cashbox").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  4161. $stateProvider.state("app.dashboard.cashbox", {
  4162. url: "/cashbox",
  4163. templateUrl: "app/cashbox/cashbox.tpl",
  4164. controller: "CashboxController",
  4165. controllerAs: "vm"
  4166. })
  4167. }]), 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) {
  4168. return {
  4169. transfer: function(fromGameAppInstanceID, fromAccountInstanceID, toGameAppInstanceID, toAccountInstanceID, amount, successCallback, failCallback) {
  4170. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4171. method: "POST",
  4172. url: appConfig.baseUrl + "/api/i/transfer",
  4173. data: {
  4174. GameInstanceID: $localStorage.GameInstanceID,
  4175. FromGameAppInstanceID: fromGameAppInstanceID,
  4176. FromAccountInstanceID: fromAccountInstanceID,
  4177. toGameAppInstanceID: toGameAppInstanceID,
  4178. toAccountInstanceID: toAccountInstanceID,
  4179. Amount: amount
  4180. }
  4181. }).success(function(response) {
  4182. return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback()) : void failCallback(response.data.Messages)
  4183. }).fail(function(response) {
  4184. failCallback(response.data)
  4185. })
  4186. },
  4187. transactions: function(gameAppInstanceID, gameAppAccountInstanceID, successCallback, failCallback) {
  4188. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4189. method: "GET",
  4190. url: appConfig.baseUrl + "/api/i/transactions",
  4191. params: {
  4192. GameInstanceID: $localStorage.GameInstanceID,
  4193. GameAppInstanceID: gameAppInstanceID,
  4194. GameAppAccountInstanceID: gameAppAccountInstanceID
  4195. }
  4196. }).success(function(response) {
  4197. return response.data.Success ? void successCallback(response.data.Results) : void failCallback(response.data.Messages)
  4198. }).fail(function(response) {
  4199. failCallback(response.data)
  4200. })
  4201. },
  4202. getAccountSources: function(apps, successCallback, failCallback) {
  4203. apps = Array.isArray(apps) ? apps : [apps];
  4204. var defers = [],
  4205. sourceQueries = {
  4206. Cashbox: CashboxInstanceService.get,
  4207. Banking: BankingInstanceService.get,
  4208. "Credit Cards": null
  4209. },
  4210. shouldContinue = !0,
  4211. errorArgList = null;
  4212. ! function() {
  4213. for (var i = 0; i < apps.length; i++) {
  4214. var currentArg = apps[i],
  4215. hasQuery = !!sourceQueries[currentArg];
  4216. shouldContinue = shouldContinue && hasQuery, hasQuery || (errorArgList || (errorArgList = []), errorArgList.push(currentArg))
  4217. }
  4218. }(), shouldContinue ? (! function() {
  4219. for (var i = 0; i < apps.length; i++) {
  4220. var currentArg = apps[i];
  4221. ! function() {
  4222. var defer = $q.defer();
  4223. defers.push(function() {
  4224. return sourceQueries[currentArg](function(response) {
  4225. Array.isArray(response) || (response = [response]), defer.resolve(response)
  4226. }, failCallback), defer.promise
  4227. }())
  4228. }()
  4229. }
  4230. }(), $q.all(defers).then(function(values) {
  4231. var options = [],
  4232. forEachFn = function(source) {
  4233. source.hasOwnProperty("AppInstanceID") ? options.push(source) : options.push(angular.extend({}, source, {
  4234. AppInstanceID: utils.getInstanceAppID(source.Title)
  4235. }))
  4236. };
  4237. for (var prop in values) {
  4238. var currentSource = values[prop];
  4239. currentSource.forEach(forEachFn)
  4240. }
  4241. successCallback(options)
  4242. })) : failCallback({
  4243. Success: !1,
  4244. Messages: function() {
  4245. return [].map.call(errorArgList, function(e) {
  4246. return e + " is not found"
  4247. })
  4248. }()
  4249. })
  4250. },
  4251. getPaymentSources: function(successCallback, failCallback) {
  4252. function checkBankAccounts() {
  4253. BankingInstanceService.get(function(options) {
  4254. options = options.filter(function(e) {
  4255. return "TransactionsBankAccountInstance" === e.AccountType
  4256. }), accounts = accounts.concat(options), AllDone()
  4257. }, function(messages) {
  4258. MessageService.showMessage({
  4259. content: messages[0]
  4260. }), AllDone()
  4261. })
  4262. }
  4263.  
  4264. function AllDone() {
  4265. accounts.length > 0 ? successCallback(accounts) : failCallback(["No accounts found"])
  4266. }
  4267. var accounts = [];
  4268. i_creditCard.getGameInstanceCreditCard(function(response) {
  4269. response.Balance = response.CreditAvailable, response.AppInstanceID = utils.getInstanceAppID("Credit Cards"), response.AccountType = "creditcardinstance", accounts.push(response), checkBankAccounts()
  4270. }, function(message) {
  4271. "No credit card purchased." !== message[0] && failCallback(message), checkBankAccounts()
  4272. })
  4273. },
  4274. getPayoutSources: function(successCallback, failCallback) {
  4275. function checkBankAccounts() {
  4276. BankingInstanceService.get(function(options) {
  4277. options = options.filter(function(e) {
  4278. return "TransactionsBankAccountInstance" === e.AccountType
  4279. }), accounts = accounts.concat(options), AllDone()
  4280. }, function(messages) {
  4281. MessageService.showMessage({
  4282. content: messages[0]
  4283. }), AllDone()
  4284. })
  4285. }
  4286.  
  4287. function AllDone() {
  4288. accounts.length > 0 ? successCallback(accounts) : failCallback(["No accounts found"])
  4289. }
  4290. var accounts = [];
  4291. checkBankAccounts()
  4292. }
  4293. }
  4294. }]), angular.module("essimoney.financial").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  4295. $stateProvider.state("app.dashboard.transfer", {
  4296. url: "/transfer",
  4297. templateUrl: "app/financial/transfers/transfer-money.tpl",
  4298. controller: "TransferMoneyController",
  4299. controllerAs: "vm"
  4300. }).state("app.dashboard.transfer-accountID", {
  4301. url: "/transfer/:fromAccountID",
  4302. templateUrl: "app/financial/transfers/transfer-money.tpl",
  4303. controller: "TransferMoneyController",
  4304. controllerAs: "vm"
  4305. }).state("app.dashboard.transfer-app-accountID", {
  4306. url: "/transfer/:app/:fromAccountID",
  4307. templateUrl: "app/financial/transfers/transfer-money.tpl",
  4308. controller: "TransferMoneyController",
  4309. controllerAs: "vm"
  4310. }).state("app.dashboard.pay-creditcard", {
  4311. url: "/pay-credit",
  4312. templateUrl: "app/financial/pay-credit/pay-credit.tpl",
  4313. controller: "PayCreditCtrl",
  4314. controllerAs: "vm"
  4315. })
  4316. }]), 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) {
  4317. return {
  4318. getGameCreditCards: function() {
  4319. var addToStorage = function(response) {
  4320. $localStorage.CreditCardOptions = response.data
  4321. };
  4322. return utils.req({
  4323. method: "GET",
  4324. url: appConfig.baseUrl + "/api/g/creditcards",
  4325. params: {
  4326. GameID: $localStorage.GameID
  4327. },
  4328. cache: !0
  4329. }).success(addToStorage)
  4330. }
  4331. }
  4332. }]).service("i_creditCard", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
  4333. return {
  4334. getGameInstanceCreditCard: function(successCallback, failCallback) {
  4335. return utils.req({
  4336. method: "GET",
  4337. url: appConfig.baseUrl + "/api/i/creditcards",
  4338. params: {
  4339. GameInstanceID: $localStorage.GameInstanceID
  4340. }
  4341. }).success(function(response) {
  4342. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4343. }).fail(function(response) {
  4344. failCallback([response.data.Message])
  4345. })
  4346. },
  4347. createCreditCardInstance: function(data, successCallback, failCallback) {
  4348. var _data = angular.extend({
  4349. GameInstanceID: $localStorage.GameInstanceID
  4350. }, data);
  4351. return log(_data), utils.req({
  4352. method: "POST",
  4353. url: appConfig.baseUrl + "/api/i/creditcards",
  4354. data: _data
  4355. }).success(function(response) {
  4356. 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)
  4357. }).fail(function(response) {
  4358. log(response.data), failCallback([response.data.Message])
  4359. })
  4360. }
  4361. }
  4362. }]), angular.module("essimoney.creditcards").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  4363. $stateProvider.state("app.dashboard.creditcards", {
  4364. url: "/creditcards",
  4365. templateUrl: "app/creditcards/select-card/select-card.tpl",
  4366. controller: "SelectCardController",
  4367. controllerAs: "vm"
  4368. }).state("app.dashboard.creditcard", {
  4369. url: "/creditcard",
  4370. templateUrl: "app/creditcards/card-statement/card-statement.tpl",
  4371. controller: "CardStatementController",
  4372. controllerAs: "vm"
  4373. })
  4374. }]), 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) {
  4375. $stateProvider.state("app.dashboard.emails", {
  4376. url: "/emails",
  4377. templateUrl: "app/emails/inbox/inbox.view.tpl",
  4378. controller: "EmailInboxController",
  4379. controllerAs: "vm"
  4380. }).state("app.dashboard.emails-category", {
  4381. url: "/emails/:categoryID",
  4382. templateUrl: "app/emails/inbox/inbox.view.tpl",
  4383. controller: "EmailInboxController",
  4384. controllerAs: "vm"
  4385. }).state("app.dashboard.email-mail", {
  4386. url: "/emails/mail/:id/:categoryID",
  4387. templateUrl: "app/emails/mail/mail.view.tpl",
  4388. controller: "MailController",
  4389. controllerAs: "vm"
  4390. }).state("app.dashboard.email-payBills", {
  4391. url: "/emails/pay-bills/:id",
  4392. templateUrl: "app/emails/pay-bill/pay-bill.view.tpl",
  4393. controller: "PayBillController",
  4394. controllerAs: "vm"
  4395. })
  4396. }]), angular.module("essimoney.email").service("EmailInstanceService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
  4397. return {
  4398. getInstanceBillEmail: function(emailInstanceID, successCallback, failCallback) {
  4399. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4400. method: "GET",
  4401. url: appConfig.baseUrl + "/api/i/emails/bill",
  4402. params: {
  4403. GameInstanceID: $localStorage.GameInstanceID,
  4404. EmailInstanceID: emailInstanceID
  4405. }
  4406. }).success(function(response) {
  4407. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4408. }).fail(function(response) {
  4409. failCallback(response.data)
  4410. })
  4411. },
  4412. getCreditCardStatementEmailInstance: function(emailInstanceID, successCallback, failCallback) {
  4413. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4414. method: "GET",
  4415. url: appConfig.baseUrl + "/api/i/emails/creditcardstatement",
  4416. params: {
  4417. GameInstanceID: $localStorage.GameInstanceID,
  4418. EmailInstanceID: emailInstanceID
  4419. }
  4420. }).success(function(response) {
  4421. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4422. }).fail(function(response) {
  4423. failCallback(response.data)
  4424. })
  4425. },
  4426. getDebtCollectorEmailInstance: function(emailInstanceID, successCallback, failCallback) {
  4427. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4428. method: "GET",
  4429. url: appConfig.baseUrl + "/api/i/emails/debtcollector",
  4430. params: {
  4431. GameInstanceID: $localStorage.GameInstanceID,
  4432. EmailInstanceID: emailInstanceID
  4433. }
  4434. }).success(function(response) {
  4435. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4436. }).fail(function(response) {
  4437. failCallback(response.data)
  4438. })
  4439. },
  4440. getPaySlipEmailInstance: function(emailInstanceID, successCallback, failCallback) {
  4441. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4442. method: "GET",
  4443. url: appConfig.baseUrl + "/api/i/emails/payslip",
  4444. params: {
  4445. GameInstanceID: $localStorage.GameInstanceID,
  4446. EmailInstanceID: emailInstanceID
  4447. }
  4448. }).success(function(response) {
  4449. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4450. }).fail(function(response) {
  4451. failCallback(response.data)
  4452. })
  4453. },
  4454. orderEmailsByWeek: function(emailList) {
  4455. 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]);
  4456. var weeksSorted = [];
  4457. for (var key in weeks) weeksSorted = weeksSorted.concat(weeks[key]);
  4458. return weeksSorted
  4459. }
  4460. }
  4461. }]), 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) {
  4462. return {
  4463. restrict: "AE",
  4464. scope: !1,
  4465. replace: !1,
  4466. link: function(scope, elem, attrs) {
  4467. function setListPosition() {
  4468. $timeout(function() {
  4469. var emailListHeight = angular.element(elem).height(),
  4470. appScreenApp = document.getElementsByClassName("app-screen__app"),
  4471. deviceHeight = angular.element(appScreenApp).height();
  4472. emailListHeight > deviceHeight && elem.css({
  4473. position: ""
  4474. })
  4475. }, 10)
  4476. }
  4477. scope.$on("UpdateEmailListPosition", setListPosition)
  4478. }
  4479. }
  4480. }]), angular.module("essimoney").directive("emailVirus", ["$window", "$document", "utils", "$timeout", function($window, $document, utils, $timeout) {
  4481. return {
  4482. restrict: "E",
  4483. scope: !1,
  4484. replace: !1,
  4485. link: function(scope, elem, attrs) {
  4486. function createVirus() {
  4487. function randomRange(min, max) {
  4488. return Math.floor(Math.random() * (max - min + 1)) + min
  4489. }
  4490. var glitcher = new Glitcher({
  4491. color: {
  4492. red: 1,
  4493. green: 1,
  4494. blue: 1
  4495. },
  4496. stereoscopic: {
  4497. red: 1,
  4498. green: 10,
  4499. blue: 2
  4500. },
  4501. lineOffset: {
  4502. value: 4
  4503. }
  4504. });
  4505. glitcher.glitch("assets/images/email/email-virus.png", function() {
  4506. elem[0].appendChild(glitcher.canvas)
  4507. }), interval = setInterval(function() {
  4508. glitcher.options = {
  4509. color: {
  4510. red: 1,
  4511. green: .8,
  4512. blue: .58
  4513. },
  4514. stereoscopic: {
  4515. red: 1 * randomRange(1, 1),
  4516. green: 2 * randomRange(1, 2, 25),
  4517. blue: 1 * randomRange(1, 2)
  4518. },
  4519. lineOffset: {
  4520. value: 1 * randomRange(1, 2),
  4521. lineHeight: 3 * randomRange(1, 2)
  4522. }
  4523. }, glitcher.process()
  4524. }, 100)
  4525. }
  4526. var interval;
  4527. createVirus(), scope.$on("$destroy", function() {
  4528. clearInterval(interval)
  4529. })
  4530. }
  4531. }
  4532. }]);
  4533. var Glitcher = function() {
  4534. function Glitcher(options) {
  4535. 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
  4536. }
  4537. return Glitcher.prototype.glitch = function(url, callback) {
  4538. var _this = this;
  4539. this.loadImage(url, function(img) {
  4540. _this.renderImage(img), _this.process(), callback()
  4541. })
  4542. }, Glitcher.prototype.process = function() {
  4543. var brightness, offset, i, x, y, imageData = this.origContext.getImageData(0, 0, this.width, this.height),
  4544. pixels = imageData.data,
  4545. length = pixels.length,
  4546. options = this.options;
  4547. 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]);
  4548. if (options.lineOffset)
  4549. for (i = 0, y = 0; y < this.height; y++)
  4550. 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];
  4551. options.glitch, this.context.putImageData(imageData, 0, 0)
  4552. }, Glitcher.prototype.loadImage = function(url, callback) {
  4553. var img = document.createElement("img");
  4554. img.crossOrigin = "anonymous", img.onload = function() {
  4555. callback(img)
  4556. }, img.src = url
  4557. }, Glitcher.prototype.renderImage = function(img) {
  4558. 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)
  4559. }, Glitcher
  4560. }();
  4561. 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) {
  4562. var _currentCommunicationObj = {};
  4563. return {
  4564. getInstances: function(gameAppInstanceID, successCallback, failCallback) {
  4565. 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({
  4566. method: "GET",
  4567. url: appConfig.baseUrl + "/api/i/communications",
  4568. params: {
  4569. GameInstanceID: $localStorage.GameInstanceID,
  4570. GameAppInstanceID: gameAppInstanceID
  4571. }
  4572. }).success(function(response) {
  4573. return response.data ? void successCallback(response.data) : void failCallback(response)
  4574. }).fail(function(response) {
  4575. failCallback(response.data)
  4576. })
  4577. },
  4578. getInstance: function(gameAppInstanceID, communicationInstanceID, successCallback, failCallback) {
  4579. 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({
  4580. method: "GET",
  4581. url: appConfig.baseUrl + "/api/i/communication",
  4582. params: {
  4583. GameInstanceID: $localStorage.GameInstanceID,
  4584. GameAppInstanceID: gameAppInstanceID,
  4585. CommunicationInstanceID: communicationInstanceID
  4586. }
  4587. }).success(function(response) {
  4588. return response.data ? void successCallback(response.data) : void failCallback(response)
  4589. }).fail(function(response) {
  4590. failCallback(response.data)
  4591. })
  4592. },
  4593. readInstance: function(gameAppInstanceID, communicationInstanceID, successCallback, failCallback, isMentor) {
  4594. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance doesn't exist."]) : void utils.req({
  4595. method: "POST",
  4596. url: appConfig.baseUrl + "/api/i/communication/read",
  4597. data: {
  4598. GameInstanceID: $localStorage.GameInstanceID,
  4599. GameAppInstanceID: gameAppInstanceID,
  4600. CommunicationInstanceID: communicationInstanceID
  4601. }
  4602. }).success(function(response) {
  4603. return response.data.Success ? (isMentor || $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response)
  4604. }).fail(function(response) {
  4605. failCallback(response.data)
  4606. })
  4607. },
  4608. getCurrentCommunication: function() {
  4609. return _currentCommunicationObj
  4610. },
  4611. storeCurrentCommunication: function(commObj) {
  4612. _currentCommunicationObj = commObj
  4613. },
  4614. deleteInstance: function(gameAppInstanceID, communicationInstanceID, successCallback, failCallback) {
  4615. 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({
  4616. method: "POST",
  4617. url: appConfig.baseUrl + "/api/i/communication/delete",
  4618. data: {
  4619. GameInstanceID: $localStorage.GameInstanceID,
  4620. GameAppInstanceID: gameAppInstanceID,
  4621. CommunicationInstanceID: communicationInstanceID
  4622. }
  4623. }).success(function(response) {
  4624. return response.data ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response)
  4625. }).fail(function(response) {
  4626. failCallback(response.data)
  4627. })
  4628. },
  4629. actionInstance: function(communicationsAppInstanceID, gameAppInstanceID, actionableInstanceID, choice, successCallback, failCallback) {
  4630. 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({
  4631. method: "POST",
  4632. url: appConfig.baseUrl + "/api/i/communication/action",
  4633. data: {
  4634. GameInstanceID: $localStorage.GameInstanceID,
  4635. CommunicationsAppInstanceID: communicationsAppInstanceID,
  4636. GameAppInstanceID: gameAppInstanceID,
  4637. ActionableInstanceID: actionableInstanceID,
  4638. Choice: choice
  4639. }
  4640. }).success(function(response) {
  4641. 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])
  4642. }).fail(function(response) {
  4643. failCallback(response.data.Messages[0])
  4644. })
  4645. }
  4646. }
  4647. }]), angular.module("essimoney.textmessage", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.textmessage").service("TextMessageService", ["$http", "GameInstancesService", "GameMediaService", function($http, GameInstancesService, GameMediaService) {
  4648. return {
  4649. groupTextMessages: function(msgs) {
  4650. 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]);
  4651. var messagesSorted = [];
  4652. for (var key in messages) messagesSorted.push(messages[key]);
  4653. return messagesSorted
  4654. },
  4655. groupTextMessagesThreadByWeek: function(msgs) {
  4656. 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]);
  4657. var messagesSorted = [];
  4658. for (var key in messages) messages[key].reverse(), messagesSorted.push(messages[key]);
  4659. return messagesSorted.reverse()
  4660. },
  4661. replaceContentPlaceholders: function(msg) {
  4662. for (var content = msg, username = GameInstancesService.getUser().username, emoticons = [
  4663. [":D", "emoticonbigsmile"],
  4664. [":(", "emoticonsad"],
  4665. [":)", "emoticonsmile"],
  4666. [";)", "emoticonwink"]
  4667. ], i = 0; i < emoticons.length; i++) content = content.replace(emoticons[i][0], '<img class="emoticon" src="' + GameMediaService.get("textmessages", emoticons[i][1]) + '">');
  4668. return content = content.replace(/%USERNAME%/g, username)
  4669. }
  4670. }
  4671. }]), angular.module("essimoney.textmessage").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  4672. $stateProvider.state("app.dashboard.text-message", {
  4673. url: "/text-message",
  4674. templateUrl: "app/text-message/list-messages/list-messages.tpl",
  4675. controller: "TextMessageListController",
  4676. controllerAs: "vm"
  4677. }).state("app.dashboard.text-message-message", {
  4678. url: "/text-message/message",
  4679. templateUrl: "app/text-message/message/message.tpl",
  4680. controller: "TextMessageController",
  4681. controllerAs: "vm"
  4682. })
  4683. }]), 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) {
  4684. $stateProvider.state("app.dashboard.jobFinder", {
  4685. url: "/job-finder",
  4686. templateUrl: "app/job-finder/list-jobs/list-jobs.tpl",
  4687. controller: "JobFinderListController",
  4688. controllerAs: "vm"
  4689. }).state("app.dashboard.jobFinder-job-id", {
  4690. url: "/job-finder/job/:id",
  4691. templateUrl: "app/job-finder/job/job.tpl",
  4692. controller: "JobController",
  4693. controllerAs: "vm"
  4694. })
  4695. }]), angular.module("essimoney.jobfinder").service("JobFinderService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
  4696. return {
  4697. getInstancePostings: function(successCallback, failCallback) {
  4698. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4699. method: "GET",
  4700. url: appConfig.baseUrl + "/api/i/jobfinder",
  4701. params: {
  4702. GameInstanceID: $localStorage.GameInstanceID
  4703. }
  4704. }).success(function(response) {
  4705. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4706. }).fail(function(response) {
  4707. failCallback(response.data)
  4708. })
  4709. },
  4710. getInstancePosting: function(jobPostingID, successCallback, failCallback) {
  4711. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4712. method: "GET",
  4713. url: appConfig.baseUrl + "/api/i/jobfinder/jobposting",
  4714. params: {
  4715. GameInstanceID: $localStorage.GameInstanceID,
  4716. JobPostingID: jobPostingID
  4717. }
  4718. }).success(function(response) {
  4719. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4720. }).fail(function(response) {
  4721. failCallback(response.data)
  4722. })
  4723. },
  4724. getInstanceCurrentJobs: function(successCallback, failCallback) {
  4725. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4726. method: "GET",
  4727. url: appConfig.baseUrl + "/api/i/jobs",
  4728. params: {
  4729. GameInstanceID: $localStorage.GameInstanceID
  4730. }
  4731. }).success(function(response) {
  4732. return response.data.Success ? (log(response.data), void successCallback(response.data)) : void failCallback(response.data.Messages)
  4733. }).fail(function(response) {
  4734. failCallback(response.data)
  4735. })
  4736. },
  4737. applyForJob: function(gameJobID, gameAppID, successCallback, failCallback) {
  4738. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4739. method: "POST",
  4740. url: appConfig.baseUrl + "/api/g/jobs/apply",
  4741. data: {
  4742. GameInstanceID: $localStorage.GameInstanceID,
  4743. GameJobID: gameJobID,
  4744. GameAppID: gameAppID
  4745. }
  4746. }).success(function(response) {
  4747. return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), successCallback(response.data), void dataLayer.push({
  4748. event: "app",
  4749. appSelected: "job finder",
  4750. appAction: "apply for this job"
  4751. })) : void failCallback(response.data.Messages)
  4752. }).fail(function(response) {
  4753. failCallback(response.data.Message)
  4754. })
  4755. },
  4756. calculatePaymentSalary: function(jobs) {
  4757. for (var i = 0; i < jobs.length; i++) switch (jobs[i].Salary = jobs[i].Salary, jobs[i].PaymentFrequency) {
  4758. case 1:
  4759. jobs[i].PaymentFrequencyString = "p/w", jobs[i].PaymentFrequencyStringFull = "per week";
  4760. break;
  4761. case 2:
  4762. jobs[i].PaymentFrequencyString = "p/fn", jobs[i].PaymentFrequencyStringFull = "per fortnight";
  4763. break;
  4764. case 4:
  4765. jobs[i].PaymentFrequencyString = "p/m", jobs[i].PaymentFrequencyStringFull = "per month"
  4766. }
  4767. return jobs
  4768. }
  4769. }
  4770. }]), 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() {
  4771. return {
  4772. restrict: "E",
  4773. scope: {
  4774. workDays: "="
  4775. },
  4776. replace: !0,
  4777. link: function(scope, elem, attrs) {
  4778. scope.days = [
  4779. ["M", !1],
  4780. ["T", !1],
  4781. ["W", !1],
  4782. ["T", !1],
  4783. ["F", !1],
  4784. ["S", !1],
  4785. ["S", !1]
  4786. ], scope.$watch("workDays", function() {
  4787. if (void 0 != scope.workDays)
  4788. for (var i = 0; i < scope.workDays.length; i++) scope.days[scope.workDays[i].Day][1] = !0
  4789. })
  4790. },
  4791. template: '<ul class="work-days"><li ng-class="{\'work-days-working\': day[1] }" ng-repeat="day in days">{{day[0]}}</li></ul>'
  4792. }
  4793. }]), angular.module("essimoney.mystuff", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.mystuff").service("MyStuffService", ["$http", function($http) {
  4794. var _currentStuff = {};
  4795. return {
  4796. setCurrentStuff: function(data) {
  4797. _currentStuff = data
  4798. },
  4799. getCurrentStuff: function(data) {
  4800. return _currentStuff
  4801. }
  4802. }
  4803. }]), angular.module("essimoney.mystuff").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  4804. $stateProvider.state("app.dashboard.my-stuff", {
  4805. url: "/my-stuff",
  4806. templateUrl: "app/my-stuff/list-stuff/list-stuff.tpl",
  4807. controller: "MyStuffListController",
  4808. controllerAs: "vm"
  4809. }).state("app.dashboard.my-stuff-sell", {
  4810. url: "/my-stuff/sell",
  4811. templateUrl: "app/my-stuff/sell-stuff/sell-stuff.tpl",
  4812. controller: "MyStuffSellController",
  4813. controllerAs: "vm"
  4814. })
  4815. }]), 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) {
  4816. return {
  4817. getInventory: function(successCallback, failCallback) {
  4818. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4819. method: "GET",
  4820. url: appConfig.baseUrl + "/api/i/items/inventory",
  4821. params: {
  4822. GameInstanceID: $localStorage.GameInstanceID
  4823. }
  4824. }).success(function(response) {
  4825. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4826. }).fail(function(response) {
  4827. failCallback(response.data)
  4828. })
  4829. },
  4830. purchaseItem: function(gameAppID, gameAppItemID, financialGameAppInstanceID, financialGameAppAccountInstanceID, successCallback, failCallback) {
  4831. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4832. method: "POST",
  4833. url: appConfig.baseUrl + "/api/i/items/purchase",
  4834. data: {
  4835. GameInstanceID: $localStorage.GameInstanceID,
  4836. GameAppID: gameAppID,
  4837. GameAppItemID: gameAppItemID,
  4838. FinancialGameAppInstanceID: financialGameAppInstanceID,
  4839. FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID
  4840. }
  4841. }).success(function(response) {
  4842. return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  4843. }).fail(function(response) {
  4844. failCallback(response.data)
  4845. })
  4846. }
  4847. }
  4848. }]), angular.module("essimoney.ibuy", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.ibuy").service("IBuyService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
  4849. var _currentItem = {};
  4850. return {
  4851. sell: function(itemInstanceID, sellPrice, successCallback, failCallback) {
  4852. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4853. method: "POST",
  4854. url: appConfig.baseUrl + "/api/i/iBuy/items",
  4855. data: {
  4856. GameInstanceID: $localStorage.GameInstanceID,
  4857. ItemInstanceID: itemInstanceID,
  4858. SellPrice: sellPrice
  4859. }
  4860. }).success(function(response) {
  4861. return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  4862. }).fail(function(response) {
  4863. failCallback(response.data)
  4864. })
  4865. },
  4866. cancelSell: function(iBuyItemForSaleID, successCallback, failCallback) {
  4867. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4868. method: "POST",
  4869. url: appConfig.baseUrl + "/api/i/iBuy/items/cancel",
  4870. data: {
  4871. GameInstanceID: $localStorage.GameInstanceID,
  4872. iBuyItemForSaleID: iBuyItemForSaleID
  4873. }
  4874. }).success(function(response) {
  4875. return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  4876. }).fail(function(response) {
  4877. failCallback(response.data)
  4878. })
  4879. },
  4880. getItemsForSale: function(successCallback, failCallback) {
  4881. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4882. method: "GET",
  4883. url: appConfig.baseUrl + "/api/i/iBuy/items",
  4884. params: {
  4885. GameInstanceID: $localStorage.GameInstanceID
  4886. }
  4887. }).success(function(response) {
  4888. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4889. }).fail(function(response) {
  4890. failCallback(response.data)
  4891. })
  4892. },
  4893. getItems: function(successCallback, failCallback) {
  4894. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4895. method: "GET",
  4896. url: appConfig.baseUrl + "/api/i/iBuy",
  4897. params: {
  4898. GameInstanceID: $localStorage.GameInstanceID
  4899. }
  4900. }).success(function(response) {
  4901. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4902. }).fail(function(response) {
  4903. failCallback(response.data)
  4904. })
  4905. },
  4906. bid: function(gameAppItemID, financialGameAppInstanceID, financialGameAppAccountInstanceID, bidAmount, successCallback, failCallback) {
  4907. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4908. method: "POST",
  4909. url: appConfig.baseUrl + "/api/i/iBuy/bids",
  4910. data: {
  4911. GameInstanceID: $localStorage.GameInstanceID,
  4912. GameAppItemID: gameAppItemID,
  4913. FinancialGameAppInstanceID: financialGameAppInstanceID,
  4914. FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID,
  4915. BidAmount: bidAmount
  4916. }
  4917. }).success(function(response) {
  4918. return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  4919. }).fail(function(response) {
  4920. failCallback(response.data)
  4921. })
  4922. },
  4923. getBids: function(successCallback, failCallback) {
  4924. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4925. method: "GET",
  4926. url: appConfig.baseUrl + "/api/i/iBuy/bids",
  4927. params: {
  4928. GameInstanceID: $localStorage.GameInstanceID
  4929. }
  4930. }).success(function(response) {
  4931. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  4932. }).fail(function(response) {
  4933. failCallback(response.data)
  4934. })
  4935. },
  4936. cancelBids: function(iBuyGameItemBidID, successCallback, failCallback) {
  4937. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4938. method: "POST",
  4939. url: appConfig.baseUrl + "/api/i/iBuy/bids/cancel",
  4940. data: {
  4941. GameInstanceID: $localStorage.GameInstanceID,
  4942. iBuyGameItemBidID: iBuyGameItemBidID
  4943. }
  4944. }).success(function(response) {
  4945. return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  4946. }).fail(function(response) {
  4947. failCallback(response.data)
  4948. })
  4949. },
  4950. storeCurrentItem: function(data) {
  4951. _currentItem = data
  4952. },
  4953. getCurrentItem: function() {
  4954. return _currentItem
  4955. }
  4956. }
  4957. }]), angular.module("essimoney.ibuy").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  4958. $stateProvider.state("app.dashboard.ibuy", {
  4959. url: "/ibuy",
  4960. templateUrl: "app/ibuy/ibuy-list/ibuy-list.tpl",
  4961. controller: "IBuyListController",
  4962. controllerAs: "vm"
  4963. }).state("app.dashboard.ibuy-item", {
  4964. url: "/ibuy/item",
  4965. templateUrl: "app/ibuy/item/ibuy-item.tpl",
  4966. controller: "IBuyItemController",
  4967. controllerAs: "vm"
  4968. }).state("app.dashboard.ibuy-item-bid", {
  4969. url: "/ibuy/item/bid",
  4970. templateUrl: "app/ibuy/purchase/ibuy-purchase.tpl",
  4971. controller: "IBuyPurchaseController",
  4972. controllerAs: "vm"
  4973. }).state("app.dashboard.ibuy-item-buy", {
  4974. url: "/ibuy/item/buy",
  4975. templateUrl: "app/ibuy/purchase/ibuy-purchase.tpl",
  4976. controller: "IBuyPurchaseController",
  4977. controllerAs: "vm"
  4978. }).state("app.dashboard.ibuy-item-complete-bid", {
  4979. url: "/ibuy/item/complete/bid",
  4980. templateUrl: "app/ibuy/purchase-complete/ibuy-purchase-complete.tpl",
  4981. controller: "IBuyPurchaseCompleteController",
  4982. controllerAs: "vm"
  4983. }).state("app.dashboard.ibuy-item-complete-buy", {
  4984. url: "/ibuy/item/complete/buy",
  4985. templateUrl: "app/ibuy/purchase-complete/ibuy-purchase-complete.tpl",
  4986. controller: "IBuyPurchaseCompleteController",
  4987. controllerAs: "vm"
  4988. }).state("app.dashboard.ibuy-page", {
  4989. url: "/ibuy/:page",
  4990. templateUrl: "app/ibuy/ibuy-list/ibuy-list.tpl",
  4991. controller: "IBuyListController",
  4992. controllerAs: "vm"
  4993. })
  4994. }]), 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) {
  4995. var _currentItem = {};
  4996. return {
  4997. getItems: function(successCallback, failCallback) {
  4998. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  4999. method: "GET",
  5000. url: appConfig.baseUrl + "/api/i/uShop",
  5001. params: {
  5002. GameInstanceID: $localStorage.GameInstanceID
  5003. }
  5004. }).success(function(response) {
  5005. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5006. }).fail(function(response) {
  5007. failCallback(response.data)
  5008. })
  5009. },
  5010. storeCurrentItem: function(data) {
  5011. _currentItem = data
  5012. },
  5013. getCurrentItem: function() {
  5014. return _currentItem
  5015. }
  5016. }
  5017. }]), angular.module("essimoney.ushop").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  5018. $stateProvider.state("app.dashboard.ushop", {
  5019. url: "/ushop",
  5020. templateUrl: "app/ushop/ushop-list/ushop-list.tpl",
  5021. controller: "UShopListController",
  5022. controllerAs: "vm"
  5023. }).state("app.dashboard.ushop-item", {
  5024. url: "/ushop/item",
  5025. templateUrl: "app/ushop/item/ushop-item.tpl",
  5026. controller: "UShopItemController",
  5027. controllerAs: "vm"
  5028. }).state("app.dashboard.ushop-item-buy", {
  5029. url: "/ushop/item/buy",
  5030. templateUrl: "app/ushop/purchase/ushop-purchase.tpl",
  5031. controller: "UShopPurchaseController",
  5032. controllerAs: "vm"
  5033. })
  5034. }]), 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) {
  5035. var _currentShare = {};
  5036. return {
  5037. getShares: function(successCallback, failCallback) {
  5038. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5039. method: "GET",
  5040. url: appConfig.baseUrl + "/api/i/shares",
  5041. params: {
  5042. GameInstanceID: $localStorage.GameInstanceID
  5043. }
  5044. }).success(function(response) {
  5045. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5046. }).fail(function(response) {
  5047. failCallback(response.data)
  5048. })
  5049. },
  5050. buyShares: function(shareInstanceID, financialGameAppInstanceID, financialGameAppAccountInstanceID, total, successCallback, failCallback) {
  5051. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5052. method: "POST",
  5053. url: appConfig.baseUrl + "/api/i/shares/buy",
  5054. data: {
  5055. GameInstanceID: $localStorage.GameInstanceID,
  5056. ShareInstanceID: shareInstanceID,
  5057. FinancialGameAppInstanceID: financialGameAppInstanceID,
  5058. FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID,
  5059. Total: total
  5060. }
  5061. }).success(function(response) {
  5062. return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  5063. }).fail(function(response) {
  5064. failCallback(response.data)
  5065. })
  5066. },
  5067. sellShares: function(shareInstanceID, financialGameAppInstanceID, financialGameAppAccountInstanceID, total, successCallback, failCallback) {
  5068. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5069. method: "POST",
  5070. url: appConfig.baseUrl + "/api/i/shares/sell",
  5071. data: {
  5072. GameInstanceID: $localStorage.GameInstanceID,
  5073. ShareInstanceID: shareInstanceID,
  5074. FinancialGameAppInstanceID: financialGameAppInstanceID,
  5075. FinancialGameAppAccountInstanceID: financialGameAppAccountInstanceID,
  5076. Total: total
  5077. }
  5078. }).success(function(response) {
  5079. return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), $rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  5080. }).fail(function(response) {
  5081. failCallback(response.data)
  5082. })
  5083. },
  5084. storeCurrentShare: function(share) {
  5085. _currentShare = share
  5086. },
  5087. getCurrentShare: function() {
  5088. return _currentShare
  5089. }
  5090. }
  5091. }]), angular.module("essimoney.shares").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  5092. $stateProvider.state("app.dashboard.shares", {
  5093. url: "/shares",
  5094. templateUrl: "app/shares/shares-list/shares-list.tpl",
  5095. controller: "SharesListController",
  5096. controllerAs: "vm"
  5097. }).state("app.dashboard.shares-buy", {
  5098. url: "/shares/buy",
  5099. templateUrl: "app/shares/shares-buy/shares-buy.tpl",
  5100. controller: "SharesBuyController",
  5101. controllerAs: "vm"
  5102. }).state("app.dashboard.shares-sell", {
  5103. url: "/shares/sell",
  5104. templateUrl: "app/shares/shares-sell/shares-sell.tpl",
  5105. controller: "SharesSellController",
  5106. controllerAs: "vm"
  5107. })
  5108. }]), 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) {
  5109. var _currentQuestion = {};
  5110. return {
  5111. getCurrentSummary: function(successCallback, failCallback) {
  5112. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5113. method: "GET",
  5114. url: appConfig.baseUrl + "/api/i/progress/summary",
  5115. params: {
  5116. GameInstanceID: $localStorage.GameInstanceID
  5117. }
  5118. }).success(function(response) {
  5119. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5120. }).fail(function(response) {
  5121. failCallback(response.data)
  5122. })
  5123. },
  5124. eowQuestionsGenerate: function(successCallback, failCallback) {
  5125. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5126. method: "POST",
  5127. url: appConfig.baseUrl + "/api/i/eowquestions/generate",
  5128. data: {
  5129. GameInstanceID: $localStorage.GameInstanceID
  5130. }
  5131. }).success(function(response) {
  5132. return response.data.Success ? void successCallback(response.data.Success) : void failCallback(response.data.Messages)
  5133. }).fail(function(response) {
  5134. failCallback(response.data)
  5135. })
  5136. },
  5137. eowQuestions: function(successCallback, failCallback) {
  5138. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5139. method: "GET",
  5140. url: appConfig.baseUrl + "/api/i/eowquestions",
  5141. params: {
  5142. GameInstanceID: $localStorage.GameInstanceID
  5143. }
  5144. }).success(function(response) {
  5145. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5146. }).fail(function(response) {
  5147. failCallback(response.data)
  5148. })
  5149. },
  5150. eowQuestionsAnswer: function(questionID, answerID, skip, totalSeconds, successCallback, failCallback) {
  5151. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5152. method: "POST",
  5153. url: appConfig.baseUrl + "/api/i/eowquestions",
  5154. data: {
  5155. GameInstanceID: $localStorage.GameInstanceID,
  5156. QuestionID: questionID,
  5157. AnswerID: answerID,
  5158. Skip: skip,
  5159. TimeRemaining: totalSeconds
  5160. }
  5161. }).success(function(response) {
  5162. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5163. }).fail(function(response) {
  5164. failCallback(response.data)
  5165. })
  5166. },
  5167. setQuestionData: function(data) {
  5168. _currentQuestion = data
  5169. },
  5170. getQuestionData: function() {
  5171. return _currentQuestion
  5172. }
  5173. }
  5174. }]), angular.module("essimoney.endofweek").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  5175. $stateProvider.state("endofweek", {
  5176. url: "/end-of-week",
  5177. templateUrl: "app/end-of-week/end-of-week.view.tpl",
  5178. controllerAs: "vm"
  5179. }).state("endofweek.end", {
  5180. url: "/end",
  5181. templateUrl: "app/end-of-week/end/end-of-week-end.view.tpl",
  5182. controller: "EndOfWeekEndController",
  5183. controllerAs: "vm"
  5184. }).state("endofweek.question", {
  5185. url: "/question",
  5186. templateUrl: "app/end-of-week/question/end-of-week-question.view.tpl",
  5187. controller: "EndOfWeekQuestionController",
  5188. controllerAs: "vm"
  5189. }).state("endofweek.question-feedback-correct", {
  5190. url: "/feedback-correct",
  5191. templateUrl: "app/end-of-week/question/feedback-correct.view.tpl",
  5192. controller: "EndOfWeekFeedbackController",
  5193. controllerAs: "vm"
  5194. }).state("endofweek.question-feedback-incorrect", {
  5195. url: "/feedback-incorrect",
  5196. templateUrl: "app/end-of-week/question/feedback-incorrect.view.tpl",
  5197. controller: "EndOfWeekFeedbackController",
  5198. controllerAs: "vm"
  5199. }).state("endofweek.summary", {
  5200. url: "/summary",
  5201. templateUrl: "app/end-of-week/summary/end-of-week-summary.view.tpl",
  5202. controller: "EndOfWeekSummaryController",
  5203. controllerAs: "vm"
  5204. }).state("endofweek.start", {
  5205. url: "/start",
  5206. templateUrl: "app/end-of-week/start/end-of-week-start.view.tpl",
  5207. controller: "EndOfWeekStartController",
  5208. controllerAs: "vm"
  5209. })
  5210. }]), 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) {
  5211. return {
  5212. restrict: "E",
  5213. scope: !1,
  5214. link: function(scope, elem, attrs) {
  5215. function showMentorPopup(data) {
  5216. 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))
  5217. }
  5218.  
  5219. function animationFinished(data) {
  5220. $window.removeEventListener("animationend", animationFinished), elem.html(""), scope.currentMsg++, scope.currentMsg < scope.data.length ? showMentorPopup(scope.data[scope.currentMsg]) : scope.currentMsg = 0
  5221. }
  5222. 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) {
  5223. data.length > 0 && (scope.data = data, showMentorPopup(data[scope.currentMsg]))
  5224. }), scope.$on("ShowMentorHelpPopup", function() {
  5225. scope.showCloseButton = !1;
  5226. 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({
  5227. GameAppID: apps[i].GameAppID,
  5228. Name: apps[i].displayName
  5229. });
  5230. scope.data = [{
  5231. ShowHelp: !0,
  5232. ID: 0,
  5233. Title: "What can I help <br/>you with?",
  5234. Message: content
  5235. }], log(scope.data), showMentorPopup(scope.data[0])
  5236. }), scope.$on("ShowMentorFaqPopup", function() {
  5237. scope.showCloseButton = !1, MentorService.getAppFAQMessages(function(response) {
  5238. 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({
  5239. ID: faqs[i].ID,
  5240. Name: faqs[i].Name,
  5241. Content: faqs[i].Content
  5242. });
  5243. scope.data = [{
  5244. ShowHelp: !1,
  5245. ShowFaqs: !0,
  5246. ID: 0,
  5247. Title: "Frequently asked questions",
  5248. Message: content
  5249. }], showMentorPopup(scope.data[0])
  5250. }, function(error) {})
  5251. }), scope.CloseMentorPopup = function(closeMsg) {
  5252. 0 != scope.data[scope.currentMsg].ID && CommunicationsService.readInstance(scope.gameAppInstanceID, scope.data[scope.currentMsg].ID, function() {}, function() {}, !0), closeMsg || (closeMsg = "close"), dataLayer.push({
  5253. event: "howl spotlight",
  5254. howlInteraction: closeMsg
  5255. }), $window.addEventListener("animationend", animationFinished, !1), elem.children().eq(0).addClass("close")
  5256. }, scope.$on("ResetMentorPopup", function() {
  5257. scope.showCloseButton = !1
  5258. }), scope.$on("LastPageShown", function() {
  5259. scope.showCloseButton = !0
  5260. }), scope.$on("CloseMentorPopup", function() {
  5261. scope.CloseMentorPopup("got it")
  5262. })
  5263. }
  5264. }
  5265. }]), angular.module("essimoney").directive("mentorMsg", ["$window", "$compile", "MentorService", "GameMediaService", function($window, $compile, MentorService, GameMediaService) {
  5266. return {
  5267. restrict: "E",
  5268. scope: {
  5269. mentorData: "="
  5270. },
  5271. link: function(scope, elem, attrs) {
  5272. function showHelpContent() {
  5273. scope.HelpContent = scope.mentorData, scope.ShowHelp = !0, scope.ShowHelpBackBtn = !0, scope.Pages = scope.mentorData.Message, setupNav()
  5274. }
  5275.  
  5276. function showFaqContent() {
  5277. scope.HelpContent = scope.mentorData, scope.ShowFaqs = !0, scope.ShowHelpBackBtn = !1, scope.Pages = scope.mentorData.Message, setupNav()
  5278. }
  5279.  
  5280. function showMessageContent() {
  5281. scope.ShowHelp = !1, scope.ShowFaqs = !1, scope.Pages = chunkString(scope.mentorData.Message, 350), setupNav()
  5282. }
  5283.  
  5284. function setupNav() {
  5285. 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)
  5286. }
  5287.  
  5288. function chunkString(str, len) {
  5289. for (var _offsetStart, _offsetEnd, _size = Math.ceil(str.length / len), _ret = [], _offsetArr = [0], _i = 0; _i < _size; _i++) {
  5290. for (_offsetStart = _offsetArr[_i], _offsetEnd = _offsetStart + len;
  5291. " " !== str.charAt(_offsetEnd) && _offsetEnd < str.length;) _offsetEnd++;
  5292. _offsetEnd > str.length && (_offsetEnd = str.length), _ret.push(str.substring(_offsetStart, _offsetEnd)), _offsetArr.push(_offsetEnd)
  5293. }
  5294. for (var _i = 0; _i < _ret.length; ++_i) {
  5295. var rp = GameMediaService.replaceContentPlaceholders(_ret[_i]).replace(/(?:\r\n|\\r|\\n)/g, "<br />");
  5296. _ret[_i] = rp
  5297. }
  5298. return _ret
  5299. }
  5300. 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) {
  5301. MentorService.getAppHelpMessage(gameAppID, function(data) {
  5302. if (data.Results.length > 0) {
  5303. for (var mentorMessages = [], i = 0; i < data.Results.length; i++) mentorMessages.push({
  5304. ID: data.Results[i].ID,
  5305. Message: data.Results[i].Body,
  5306. Title: data.Results[i].Title
  5307. });
  5308. scope.mentorData = mentorMessages[0], dataLayer.push({
  5309. event: "help",
  5310. helpAction: mentorMessages[0].Title
  5311. }), showMessageContent(), scope.$emit("ResetMentorPopup")
  5312. }
  5313. }, function(data) {})
  5314. }, scope.FaqsClicked = function(id, title, content) {
  5315. var mentorMessages = [];
  5316. mentorMessages.push({
  5317. ID: id,
  5318. Message: content,
  5319. Title: title
  5320. }), scope.mentorData = mentorMessages[0], showMessageContent(), scope.$emit("ResetMentorPopup")
  5321. }, scope.Close = function() {
  5322. scope.$emit("CloseMentorPopup")
  5323. }, scope.NextPage = function() {
  5324. 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({
  5325. event: "howl spotlight",
  5326. howlInteraction: "next"
  5327. })
  5328. }, scope.PrevPage = function() {
  5329. scope.CurrentPage--, scope.ShowBtn = !1, scope.CurrentPage > 0 || (scope.CurrentPage = 0, scope.PrevDisabled = !0, scope.NextDisabled = !1), dataLayer.push({
  5330. event: "howl spotlight",
  5331. howlInteraction: "prev"
  5332. })
  5333. }, scope.getHowl = function(tag) {
  5334. return void 0 == tag ? GameMediaService.get("mentor", "default") : GameMediaService.get("mentor", tag)
  5335. }
  5336. },
  5337. templateUrl: "app/mentor-popup/mentor-msg.view.tpl"
  5338. }
  5339. }]), angular.module("essimoney.mentorpopup").service("MentorService", ["$http", "$localStorage", "utils", function($http, $localStorage, utils) {
  5340. return {
  5341. getAppHelpMessage: function(gameAppId, successCallback, failCallback) {
  5342. return null == $localStorage.GameID ? void failCallback(["Game not found."]) : null != $localStorage.GameApps ? void successCallback($localStorage.GameApps) : void utils.req({
  5343. method: "GET",
  5344. url: appConfig.baseUrl + "/api/g/mentor/help-messages",
  5345. params: {
  5346. GameID: $localStorage.GameID,
  5347. TargetGameAppID: gameAppId
  5348. }
  5349. }).success(function(response) {
  5350. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5351. }).fail(function(response) {
  5352. failCallback(response.data)
  5353. })
  5354. },
  5355. getAppFAQMessages: function(successCallback, failCallback) {
  5356. $http.get("assets/json/faqs/faqs.json").then(successCallback, failCallback)
  5357. }
  5358. }
  5359. }]), angular.module("essimoney.financeweekly", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.financeweekly").service("FinanceWeeklyService", ["$rootScope", "$http", "$localStorage", "utils", function($rootScope, $http, $localStorage, utils) {
  5360. var _currentArticle = {};
  5361. return {
  5362. getArticle: function(successCallback, failCallback) {
  5363. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5364. method: "GET",
  5365. url: appConfig.baseUrl + "/api/i/news/article",
  5366. params: {
  5367. GameInstanceID: $localStorage.GameInstanceID
  5368. }
  5369. }).success(function(response) {
  5370. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5371. }).fail(function(response) {
  5372. failCallback(response.data)
  5373. })
  5374. },
  5375. storeCurrentArticle: function(data) {
  5376. _currentArticle = data
  5377. },
  5378. getCurrentArticle: function() {
  5379. return _currentArticle
  5380. },
  5381. getArticles: function(successCallback, failCallback) {
  5382. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5383. method: "GET",
  5384. url: appConfig.baseUrl + "/api/i/news/archive/articles",
  5385. params: {
  5386. GameInstanceID: $localStorage.GameInstanceID
  5387. }
  5388. }).success(function(response) {
  5389. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5390. }).fail(function(response) {
  5391. failCallback(response.data)
  5392. })
  5393. },
  5394. createQuizWithQuestions: function(articleID, gameQuestionIDs, successCallback, failCallback) {
  5395. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5396. method: "POST",
  5397. url: appConfig.baseUrl + "/api/i/news/quiz/create",
  5398. data: {
  5399. GameInstanceID: $localStorage.GameInstanceID,
  5400. ArticleID: articleID,
  5401. GameQuestionIDs: gameQuestionIDs
  5402. }
  5403. }).success(function(response) {
  5404. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5405. }).fail(function(response) {
  5406. failCallback(response.data)
  5407. })
  5408. },
  5409. createQuiz: function(articleID, successCallback, failCallback) {
  5410. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5411. method: "POST",
  5412. url: appConfig.baseUrl + "/api/i/news/quiz/create",
  5413. data: {
  5414. GameInstanceID: $localStorage.GameInstanceID,
  5415. ArticleID: articleID
  5416. }
  5417. }).success(function(response) {
  5418. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5419. }).fail(function(response) {
  5420. failCallback(response.data)
  5421. })
  5422. },
  5423. startQuiz: function(quizID, successCallback, failCallback) {
  5424. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5425. method: "POST",
  5426. url: appConfig.baseUrl + "/api/i/news/quiz/start",
  5427. data: {
  5428. GameInstanceID: $localStorage.GameInstanceID,
  5429. QuizID: quizID
  5430. }
  5431. }).success(function(response) {
  5432. return response.data.Success ? ($rootScope.$broadcast("AppIconStateUpdate", {
  5433. application: "News",
  5434. state: "idle"
  5435. }), void successCallback(response.data)) : void failCallback(response.data.Messages)
  5436. }).fail(function(response) {
  5437. failCallback(response.data)
  5438. })
  5439. },
  5440. isQuizRequiredAndCompleted: function(successCallback, failCallback) {
  5441. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5442. method: "GET",
  5443. url: appConfig.baseUrl + "/api/i/news/quiz/isrequired",
  5444. params: {
  5445. GameInstanceID: $localStorage.GameInstanceID
  5446. }
  5447. }).success(function(response) {
  5448. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5449. }).fail(function(response) {
  5450. failCallback(response.data)
  5451. })
  5452. },
  5453. endQuiz: function(quizID, successCallback, failCallback) {
  5454. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5455. method: "POST",
  5456. url: appConfig.baseUrl + "/api/i/news/quiz/end",
  5457. data: {
  5458. GameInstanceID: $localStorage.GameInstanceID,
  5459. QuizID: quizID
  5460. }
  5461. }).success(function(response) {
  5462. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5463. }).fail(function(response) {
  5464. failCallback(response.data)
  5465. })
  5466. },
  5467. completeQuestion: function(questionID, successCallback, failCallback) {
  5468. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5469. method: "POST",
  5470. url: appConfig.baseUrl + "/api/i/news/question/complete",
  5471. data: {
  5472. GameInstanceID: $localStorage.GameInstanceID,
  5473. QuestionID: questionID
  5474. }
  5475. }).success(function(response) {
  5476. return response.data.Success ? ($rootScope.$broadcast("UpdateWhereImAt"), void successCallback(response.data)) : void failCallback(response.data.Messages)
  5477. }).fail(function(response) {
  5478. failCallback(response.data)
  5479. })
  5480. },
  5481. submitAnswer: function(answers, successCallback, failCallback) {
  5482. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5483. method: "POST",
  5484. url: appConfig.baseUrl + "/api/i/news/answer/submit",
  5485. data: {
  5486. GameInstanceID: $localStorage.GameInstanceID,
  5487. Answers: answers
  5488. }
  5489. }).success(function(response) {
  5490. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5491. }).fail(function(response) {
  5492. failCallback(response.data)
  5493. })
  5494. },
  5495. getQuiz: function(successCallback, failCallback) {
  5496. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5497. method: "GET",
  5498. url: appConfig.baseUrl + "/api/i/news/quiz",
  5499. params: {
  5500. GameInstanceID: $localStorage.GameInstanceID
  5501. }
  5502. }).success(function(response) {
  5503. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5504. }).fail(function(response) {
  5505. failCallback(response.data)
  5506. })
  5507. }
  5508. }
  5509. }]), angular.module("essimoney.financeweekly").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  5510. $stateProvider.state("app.dashboard.financeweekly", {
  5511. url: "/financeweekly",
  5512. templateUrl: "app/finance-weekly/finance-weekly-home/finance-weekly-home.tpl",
  5513. controller: "FinanceWeeklyHomeController",
  5514. controllerAs: "vm"
  5515. }).state("app.dashboard.financeweekly-article", {
  5516. url: "/financeweekly/article",
  5517. templateUrl: "app/finance-weekly/finance-weekly-article/finance-weekly-article.tpl",
  5518. controller: "FinanceWeeklyArticleController",
  5519. controllerAs: "vm"
  5520. }).state("app.dashboard.financeweekly-archive", {
  5521. url: "/financeweekly/archive",
  5522. templateUrl: "app/finance-weekly/finance-weekly-archive/finance-weekly-archive.tpl",
  5523. controller: "FinanceWeeklyArchiveController",
  5524. controllerAs: "vm"
  5525. }).state("app.dashboard.financeweekly-archive-article", {
  5526. url: "/financeweekly/archive/article",
  5527. templateUrl: "app/finance-weekly/finance-weekly-article/finance-weekly-article.tpl",
  5528. controller: "FinanceWeeklyArticleController",
  5529. controllerAs: "vm"
  5530. }).state("app.dashboard.financeweekly-quiz", {
  5531. url: "/financeweekly/quiz",
  5532. templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz.tpl",
  5533. controller: "FinanceWeeklyQuizController",
  5534. controllerAs: "vm"
  5535. }).state("app.dashboard.financeweekly-quiz.fill-gap", {
  5536. url: "/fill-gap",
  5537. templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-fill-gap.tpl",
  5538. controller: "FinanceWeeklyFillGapController",
  5539. controllerAs: "vm"
  5540. }).state("app.dashboard.financeweekly-quiz.summary", {
  5541. url: "/summary",
  5542. templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-summary.tpl",
  5543. controller: "FinanceWeeklySummaryController",
  5544. controllerAs: "vm"
  5545. }).state("app.dashboard.financeweekly-quiz.question", {
  5546. url: "/:question",
  5547. templateUrl: "app/finance-weekly/finance-weekly-quiz/finance-weekly-quiz-multiple-choice.tpl",
  5548. controller: "FinanceWeeklyMultipleChoiceController",
  5549. controllerAs: "vm"
  5550. })
  5551. }]), 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),
  5552. 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) {
  5553. return {
  5554. restrict: "E",
  5555. scope: {
  5556. id: "="
  5557. },
  5558. replace: !0,
  5559. link: function(scope, elem, attrs) {
  5560. function updateWordAnswer(event, index, data) {
  5561. index == scope.id && (data.Index > -1 ? (scope.Answer = data, scope.Classes = "current-selection has-word") : (scope.Answer = data, scope.Classes = ""))
  5562. }
  5563.  
  5564. function clearAnswer(event, index, data, currentSelectedID) {
  5565. index == scope.id && (scope.Answer = data, scope.id == currentSelectedID ? scope.Classes = "current-selection" : scope.Classes = "")
  5566. }
  5567.  
  5568. function showFeedback(event, feedback) {
  5569. feedback[0] == scope.Answer.ID && ("True" == feedback[1] ? scope.Classes = "correct" : scope.Classes = "incorrect")
  5570. }
  5571.  
  5572. function removeZIndex() {
  5573. scope.Classes = scope.Classes.replace("current-selection", "")
  5574. }
  5575. scope.Answer = {
  5576. Text: "&nbsp;"
  5577. }, scope.Classes = "";
  5578. var scrollElement = angular.element(document.getElementsByClassName("app-screen__app"));
  5579. scope.WordClicked = function() {
  5580. "correct" == scope.Classes || "incorrect" == scope.Classes || (scope.Answer.Index > -1 ? (scope.Classes = "current-selection", scope.$emit("QuizClearWord", {
  5581. Index: scope.Answer.Index
  5582. }), scope.Answer = {
  5583. Text: "&nbsp;"
  5584. }) : scope.Classes = "current-selection", scope.$emit("QuizWordPopup", scope.id, angular.element(elem).offset().top + scrollElement.scrollTop(), angular.element(elem).height()))
  5585. }, scope.$on("UpdateWordAnswer", updateWordAnswer), scope.$on("ClearAnswer", clearAnswer), scope.$on("QuizShowFeedback", showFeedback), scope.$on("QuizPopupClosed", removeZIndex)
  5586. },
  5587. 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>'
  5588. }
  5589. }]), angular.module("essimoney.weeklyplanner", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.weeklyplanner").service("WeeklyPlannerService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
  5590. var _currentQuestion = {};
  5591. return {
  5592. answerQuestion: function(week, answer, successCallback, failCallback) {
  5593. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5594. method: "POST",
  5595. url: appConfig.baseUrl + "/api/i/planner",
  5596. data: {
  5597. GameInstanceID: $localStorage.GameInstanceID,
  5598. Week: week,
  5599. Answer: answer
  5600. }
  5601. }).success(function(response) {
  5602. return response.data.Success ? ($rootScope.$broadcast("ShowMentorPopup", response.data.MentorMessages), void successCallback(response.data)) : void failCallback(response.data.Messages)
  5603. }).fail(function(response) {
  5604. failCallback(response.data)
  5605. })
  5606. },
  5607. getPlannerSummary: function(successCallback, failCallback) {
  5608. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5609. method: "GET",
  5610. url: appConfig.baseUrl + "/api/i/planner",
  5611. params: {
  5612. GameInstanceID: $localStorage.GameInstanceID
  5613. }
  5614. }).success(function(response) {
  5615. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5616. }).fail(function(response) {
  5617. failCallback(response.data)
  5618. })
  5619. },
  5620. getCurrentQuestion: function(successCallback, failCallback) {
  5621. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5622. method: "GET",
  5623. url: appConfig.baseUrl + "/api/i/planner/question",
  5624. params: {
  5625. GameInstanceID: $localStorage.GameInstanceID
  5626. }
  5627. }).success(function(response) {
  5628. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5629. }).fail(function(response) {
  5630. failCallback(response.data)
  5631. })
  5632. },
  5633. getQuestionInstances: function(successCallback, failCallback) {
  5634. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5635. method: "GET",
  5636. url: appConfig.baseUrl + "/api/i/planner/questions",
  5637. params: {
  5638. GameInstanceID: $localStorage.GameInstanceID
  5639. }
  5640. }).success(function(response) {
  5641. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5642. }).fail(function(response) {
  5643. failCallback(response.data)
  5644. })
  5645. },
  5646. storeArchiveQuestion: function(data) {
  5647. _currentQuestion = data
  5648. },
  5649. getArchiveQuestion: function() {
  5650. return _currentQuestion
  5651. }
  5652. }
  5653. }]), angular.module("essimoney.weeklyplanner").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  5654. $stateProvider.state("app.dashboard.weeklyplanner", {
  5655. url: "/weeklyplanner",
  5656. templateUrl: "app/weekly-planner/weekly-planner-home/weekly-planner-home.tpl",
  5657. controller: "WeeklyPlannerHomeController",
  5658. controllerAs: "vm"
  5659. }).state("app.dashboard.weeklyplanner.mybudget", {
  5660. url: "/mybudget",
  5661. templateUrl: "app/weekly-planner/weekly-planner-home/my-budget/my-budget.tpl",
  5662. controller: "MyBudgetController",
  5663. controllerAs: "vm"
  5664. }).state("app.dashboard.weeklyplanner.diary", {
  5665. url: "/diary",
  5666. templateUrl: "app/weekly-planner/weekly-planner-home/diary/diary.tpl",
  5667. controller: "DiaryController",
  5668. controllerAs: "vm"
  5669. }).state("app.dashboard.weeklyplanner-diaryView", {
  5670. url: "/weeklyplanner/archive/view",
  5671. templateUrl: "app/weekly-planner/weekly-planner-archive/view-diary.tpl",
  5672. controller: "ViewDiaryController",
  5673. controllerAs: "vm"
  5674. }).state("app.dashboard.weeklyplanner-archive", {
  5675. url: "/weeklyplanner/archive",
  5676. templateUrl: "app/weekly-planner/weekly-planner-archive/diary-archive.tpl",
  5677. controller: "WeeklyPlannerDiaryArchiveController",
  5678. controllerAs: "vm"
  5679. })
  5680. }]), 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) {
  5681. return {
  5682. restrict: "E",
  5683. replace: !0,
  5684. scope: {
  5685. data: "=",
  5686. maxData: "="
  5687. },
  5688. link: function(scope, elem, attrs) {
  5689. log(scope.vm), scope.inputPattern = /^\d+$/, scope.ID = attrs.id, scope.onlyNumbers = function(event) {
  5690. var keys = {
  5691. up: 38,
  5692. right: 39,
  5693. down: 40,
  5694. left: 37,
  5695. escape: 27,
  5696. backspace: 8,
  5697. tab: 9,
  5698. enter: 13,
  5699. del: 46,
  5700. 0: 48,
  5701. 1: 49,
  5702. 2: 50,
  5703. 3: 51,
  5704. 4: 52,
  5705. 5: 53,
  5706. 6: 54,
  5707. 7: 55,
  5708. 8: 56,
  5709. 9: 57
  5710. };
  5711. for (var index in keys)
  5712. if (keys.hasOwnProperty(index) && (event.charCode == keys[index] || event.keyCode == keys[index])) return;
  5713. event.preventDefault()
  5714. }, scope.onBlur = function() {
  5715. void 0 == scope.data.Spend ? scope.data.Spend = 0 : scope.data.Spend = parseFloat(scope.data.Spend.toFixed())
  5716. }, scope.keyUpCheck = function() {
  5717. scope.data.Spend > scope.maxData && (scope.data.Spend = parseFloat(scope.maxData.toFixed())), scope.$emit("SliderSpendManuallyUpdated")
  5718. }
  5719. },
  5720. 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>'
  5721. }
  5722. }]), 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) {
  5723. $stateProvider.state("endofgame", {
  5724. url: "/end-of-game",
  5725. templateUrl: "app/end-of-game/fireworks/end-fireworks.view.tpl",
  5726. controller: "EndFireworksController",
  5727. controllerAs: "vm"
  5728. }).state("endofgame-balance", {
  5729. url: "/end-of-game/balancesheet",
  5730. templateUrl: "app/end-of-game/end-balance-sheet/end-balance-sheet.view.tpl",
  5731. controller: "WhereImAtController",
  5732. controllerAs: "vm"
  5733. })
  5734. }]), angular.module("essimoney.endofgame").controller("EndFireworksController", EndFireworksController), EndFireworksController.$inject = ["$scope", "utils", "$location", "GameInstancesService", "$localStorage", "$window"], angular.module("essimoney.endofgame").directive("fireworksCanvas", ["$window", function($window) {
  5735. return {
  5736. restrict: "E",
  5737. replace: !0,
  5738. link: function(scope, elem, attrs) {
  5739. function random(min, max) {
  5740. return Math.random() * (max - min) + min
  5741. }
  5742.  
  5743. function calculateDistance(p1x, p1y, p2x, p2y) {
  5744. var xDistance = p1x - p2x,
  5745. yDistance = p1y - p2y;
  5746. return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2))
  5747. }
  5748.  
  5749. function Firework(sx, sy, tx, ty) {
  5750. 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]);
  5751. this.angle = Math.atan2(ty - sy, tx - sx), this.speed = 2, this.acceleration = 1.05, this.brightness = random(50, 70), this.targetRadius = 0
  5752. }
  5753.  
  5754. function Particle(x, y) {
  5755. for (this.x = x, this.y = y, this.coordinates = [], this.coordinateCount = 5; this.coordinateCount--;) this.coordinates.push([this.x, this.y]);
  5756. 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)
  5757. }
  5758.  
  5759. function createParticles(x, y) {
  5760. for (var particleCount = 50; particleCount--;) particles.push(new Particle(x, y))
  5761. }
  5762.  
  5763. function loop() {
  5764. 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";
  5765. for (var i = fireworks.length; i--;) fireworks[i].draw(), fireworks[i].update(i);
  5766. for (var i = particles.length; i--;) particles[i].draw(), particles[i].update(i);
  5767. timerTick >= timerTotal ? mousedown || (fireworks.push(new Firework(cw / 2, ch, random(0, cw), random(0, ch / 2))), timerTick = 0) : timerTick++
  5768. }
  5769. scope.ShowFireworks = !0, scope.Style = {}, scope.width = 0, scope.height = 0, elem.on("$destroy", function() {
  5770. scope.ShowFireworks = !1
  5771. }), window.requestAnimFrame = function() {
  5772. return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
  5773. window.setTimeout(callback, 1e3 / 60)
  5774. }
  5775. }();
  5776. var canvas = document.getElementById("canvas"),
  5777. ctx = canvas.getContext("2d"),
  5778. cw = window.innerWidth,
  5779. ch = window.innerHeight,
  5780. fireworks = [],
  5781. particles = [],
  5782. hue = 120,
  5783. timerTotal = 30,
  5784. timerTick = 0,
  5785. mousedown = !1;
  5786. canvas.width = cw, canvas.height = ch, Firework.prototype.update = function(index) {
  5787. this.coordinates.pop(), this.coordinates.unshift([this.x, this.y]), this.targetRadius = .1, this.speed *= this.acceleration;
  5788. var vx = Math.cos(this.angle) * this.speed,
  5789. vy = Math.sin(this.angle) * this.speed;
  5790. this.distanceTraveled = calculateDistance(this.sx, this.sy, this.x + vx, this.y + vy), createParticles(this.tx, this.ty), fireworks.splice(index, 1)
  5791. }, Firework.prototype.draw = function() {
  5792. 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()
  5793. }, Particle.prototype.update = function(index) {
  5794. 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)
  5795. }, Particle.prototype.draw = function() {
  5796. 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()
  5797. }, loop(), angular.element($window).bind("resize", function() {
  5798. scope.$apply()
  5799. })
  5800. },
  5801. template: '<canvas id="canvas" width="{{width}}" height="{{height}}"></canvas>'
  5802. }
  5803. }]), angular.module("essimoney.survey", ["ui.router", "ngCookies", "ngResource", "ngStorage"]), angular.module("essimoney.survey").service("SurveyService", ["$http", "$localStorage", "utils", "$rootScope", function($http, $localStorage, utils, $rootScope) {
  5804. var _questionData = {},
  5805. _observerCallbacks = [],
  5806. notifyObservers = function() {
  5807. angular.forEach(_observerCallbacks, function(callback) {
  5808. callback()
  5809. })
  5810. };
  5811. return {
  5812. getSurvey: function(successCallback, failCallback) {
  5813. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5814. method: "GET",
  5815. url: appConfig.baseUrl + "/api/i/survey",
  5816. params: {
  5817. GameInstanceID: $localStorage.GameInstanceID
  5818. }
  5819. }).success(function(response) {
  5820. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5821. }).fail(function(response) {
  5822. failCallback(response.data)
  5823. })
  5824. },
  5825. submitSurvey: function(surveyQuestionOptionID, successCallback, failCallback) {
  5826. return null == $localStorage.GameInstanceID ? void failCallback(["Game Instance not found."]) : void utils.req({
  5827. method: "POST",
  5828. url: appConfig.baseUrl + "/api/i/survey/submit",
  5829. data: {
  5830. GameInstanceID: $localStorage.GameInstanceID,
  5831. SurveyQuestionOptionID: surveyQuestionOptionID
  5832. }
  5833. }).success(function(response) {
  5834. return response.data.Success ? void successCallback(response.data) : void failCallback(response.data.Messages)
  5835. }).fail(function(response) {
  5836. failCallback(response.data)
  5837. })
  5838. },
  5839. setQuestionData: function(data) {
  5840. _questionData = data, notifyObservers()
  5841. },
  5842. getQuestionData: function() {
  5843. return _questionData
  5844. },
  5845. registerObserverCallback: function(callback) {
  5846. _observerCallbacks.push(callback)
  5847. }
  5848. }
  5849. }]), angular.module("essimoney.survey").config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) {
  5850. $stateProvider.state("surveys", {
  5851. url: "/surveys",
  5852. templateUrl: "app/survey/survey.view.tpl",
  5853. controllerAs: "vm"
  5854. }).state("surveys.question", {
  5855. url: "/question",
  5856. views: {
  5857. "": {
  5858. templateUrl: "app/survey/survey-question/question.view.tpl",
  5859. controller: "SurveyQuestionController",
  5860. controllerAs: "vm"
  5861. },
  5862. progress: {
  5863. templateUrl: "app/survey/survey-progress/progress.view.tpl",
  5864. controller: "SurveyProgressController",
  5865. controllerAs: "vm"
  5866. }
  5867. }
  5868. }).state("surveys.feedback-correct", {
  5869. url: "/feedback-correct",
  5870. views: {
  5871. "": {
  5872. templateUrl: "app/survey/survey-question/feedback-correct.view.tpl",
  5873. controller: "SurveyQuestionFeedbackController",
  5874. controllerAs: "vm"
  5875. },
  5876. progress: {
  5877. templateUrl: "app/survey/survey-progress/progress.view.tpl",
  5878. controller: "SurveyProgressController",
  5879. controllerAs: "vm"
  5880. }
  5881. }
  5882. }).state("surveys.feedback-incorrect", {
  5883. url: "/feedback-incorrect",
  5884. views: {
  5885. "": {
  5886. templateUrl: "app/survey/survey-question/feedback-incorrect.view.tpl",
  5887. controller: "SurveyQuestionFeedbackController",
  5888. controllerAs: "vm"
  5889. },
  5890. progress: {
  5891. templateUrl: "app/survey/survey-progress/progress.view.tpl",
  5892. controller: "SurveyProgressController",
  5893. controllerAs: "vm"
  5894. }
  5895. }
  5896. })
  5897. }]), angular.module("essimoney").directive("survey", [function() {
  5898. return {
  5899. restrict: "E",
  5900. scope: !1,
  5901. link: function(scope, elem, attrs) {},
  5902. templateUrl: "app/survey/survey-start.view.tpl"
  5903. }
  5904. }]), 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) {
  5905. return {
  5906. register: function(gamelinkid, successCallback, failCallback) {
  5907. utils.req({
  5908. method: "post",
  5909. url: appConfig.baseUrl + "/api/m/gamelinks",
  5910. headers: {
  5911. "Content-Type": "application/json",
  5912. Authorization: "bearer " + encodeURIComponent($localStorage.Token)
  5913. },
  5914. data: {
  5915. GameLinkID: gamelinkid
  5916. }
  5917. }).success(successCallback).fail(function(response) {
  5918. failCallback(response)
  5919. })
  5920. },
  5921. get: function(gamelinkid, successCallback, failCallback) {
  5922. utils.req({
  5923. method: "get",
  5924. url: appConfig.baseUrl + "/api/m/gamelinks?GameLinkID=" + encodeURIComponent(gamelinkid),
  5925. headers: {
  5926. "Content-Type": "application/json",
  5927. Authorization: "bearer " + encodeURIComponent($localStorage.Token)
  5928. }
  5929. }).success(function(response) {
  5930. $localStorage.GameLink = response.data, $localStorage.GameID = response.data.GameID, dataLayer.push({
  5931. userId: $localStorage.GameLink.UserID
  5932. }), successCallback(response.data)
  5933. }).fail(function(response) {
  5934. alert("failed"), failCallback(response)
  5935. })
  5936. },
  5937. getInfo: function(gamelinkid, successCallback, failCallback) {
  5938. utils.req({
  5939. method: "get",
  5940. url: appConfig.baseUrl + "/api/m/gamelink?GameLinkID=" + encodeURIComponent(gamelinkid),
  5941. headers: {
  5942. "Content-Type": "application/json"
  5943. }
  5944. }).success(function(response) {
  5945. log(gamelinkid), $localStorage.GameLinkID = gamelinkid, successCallback(response.data)
  5946. }).fail(function(response) {
  5947. failCallback(response)
  5948. })
  5949. }
  5950. }
  5951. }]), angular.module("essimoney").run(["$templateCache", function($templateCache) {
  5952. $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> '),
  5953. $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>'),
  5954. $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> '),
  5955. $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> ')
  5956. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement