;(function(FastPlayGames,FastplayJackpot,Draws, _, session){ /** * @class Games * @extends Backbone.View * @requires portalGGA.models.Draws * @view */ portalGGA.views.FastProgressiveBanners= Backbone.View.extend( /** @lends portalGGA.views.DrawResults.prototype */{ /** * Rename object, and render on init. * @author mulleti.satyanarayana@gtech.com * @param {Object} options * @param {portalGGA.models.Draws} [options.draws] Draws collection, if not given new one will be created. * @param {Object} options.betslipLinks Map of betslip links, one per each ESA game name. */ constructor: function FastProgressiveBanners( options ){ Backbone.View.apply(this, arguments); this.gameConfig = $.parseJSON(options.gameConfig); this.fastplaygames = new FastPlayGames(); this.fastplaygamejackpot = new FastplayJackpot(); this.portalGameCode = options.portalGameName; this.renderView = options.renderView; var gameConfig = portalGGA.utils.getGameConfigByPortalGameName(this.portalGameCode,this.gameConfig); _.bindAll(this, "displayWinningInfo"); this.renderBanner(); }, renderBanner: function renderBanner(gameConfig){ var self =this; this.fastplaygamejackpot.fetch({cache:false}). done(self.displayWinningInfo).fail(self.displayFailure); }, displayFailure: function displayFailure(){ var game = {}; game['jackpotAmount'] = ""; game['time'] = ""; self.$('#headerGameBannerInfo').append(headerGameInfoTemplate({jackpotGame:game})); $( "#amountInfo" ).before( $("#html_tag").html() ); $( "#amountInfo" ).before( $("#style_tag").html() ); // $('.fast-play-banner__logo').attr("style","width:auto"); }, drawStaticTemplate: function drawStaticTemplate(){ var self=this; if(self.renderView == "topview") { self.$('#headerGameBannerInfo').html(headerStaticTemplate({})); $("#html_tag").attr("style","display:block"); $('#row_col').append($("#style_tag")); $('#row_col').append($("#html_tag")); } }, displayWinningInfo: function displayWinningInfo(){ var self = this, gameConfig; var game = {}; var fastplayGame= self.fastplaygamejackpot.toJSON(); if(fastplayGame[0].jackpotAmount!= null){ var date=new Date(fastplayGame[0].time); var monthVal=date.getMonth()+1; var minutes =date.getMinutes(); var hoursVal=date.getHours(); var amPm="am"; if (minutes < 10) minutes = "0" + minutes; if(hoursVal>=12){ amPm="pm"; hoursVal=hoursVal-12; } var timeconverted=monthVal+"/"+date.getDate()+"/"+date.getFullYear()+" "+hoursVal+":"+minutes+" "+amPm; game['jackpotAmount'] = fastplayGame[0].jackpotAmount; game['time'] = fastplayGame[0].time; game['isJackpot'] = "YES"; } else{ game['jackpotAmount'] = ""; game['time'] = ""; } if(self.renderView == "topview") { self.$('#headerGameBannerInfo').append(headerGameInfoTemplate({jackpotGame:game})); $( "#amountInfo" ).before( $("#html_tag").html() ); $( "#amountInfo" ).before( $("#style_tag").html() ); // $('.fast-play-banner__logo').attr("style","width:auto"); } return this.$el; } }); }(portalGGA.models.FastPlayGames,portalGGA.models.FastplayJackpots,portalGGA.models.Draws, _, portalGGA.utils.session))