angular.module("eventsPlayed.module",["lta.services"]).controller("eventsPlayedCtrl",["$scope","$rootScope","helper","data","$window",function(n,t,i,r,u){"use strict";n.seniorsRankingsOnly=$(".playerProfileRankings:first-child table").length===0,n.eventsPlayed=eventsPlayedJson,n.filtered={Seasons:null,AgeGroups:null,Qualifying:null},n.removeDuplicates=function(){for(var u={},i=n.eventsPlayed.CompetitionEventsPlayed,r,t=i.length-1;t>=0;t--)delete n.eventsPlayed.CompetitionEventsPlayed[t].$$hashKey,r=JSON.stringify(i[t]),u[r]?i.splice(t,1):u[r]=!0;return i},n.isCombinedRankings=function(t){if(n.eventsPlayed.AgeGroups.length>0){var i,r,u;return t?(i=parseInt(t.AgeGroup)>=12,r=parseInt(t.AgeGroup)<=18,u=t.AgeGroup=="Open"):(i=parseInt(n.eventsPlayed.AgeGroups[n.eventsPlayed.AgeGroups.length-1].Value)>=12,r=parseInt(n.eventsPlayed.AgeGroups[n.eventsPlayed.AgeGroups.length-1].Value)<=18,u=n.eventsPlayed.AgeGroups[n.eventsPlayed.AgeGroups.length-1].Value=="Open"),n.showQualifyingEvents=$(".iconUsedInRankingsRun").length>0,i&&r||u}},n.hideFilterText=function(){if(n.eventsPlayed.AgeGroups.length>0){var t=n.eventsPlayed.Seasons.length<=1,i=n.eventsPlayed.AgeGroups.length<=1,r=!n.showQualifyingEvents;return t&&i&&r}},n.myFilter=function(t){var i=!1,r=function(){return!n.filtered.AgeGroups&&!n.filtered.Seasons&&!n.filtered.Qualifying},u=function(){return t.AgeGroup===n.filtered.AgeGroups||!n.filtered.AgeGroups},f=function(){return t.Season===n.filtered.Seasons||!n.filtered.Seasons},e=function(){return t.UsedInRankingsRun===n.filtered.Qualifying&&n.isCombinedRankings(t)||!n.filtered.Qualifying};return r()?i=!0:u()&&f()&&e()&&(i=!0),i},n.sortDate=function(n){return new Date(n.EndDate)},n.formatDateString=function(n){if(n.indexOf("-")==-1){var t=n.split("/");return t[1]+"/"+t[0]+"/"+t[2]}return n},n.table1ColumnToggleClicked=!1,n.table1ResponsiveTableCheck=function(){n.windowWidth=angular.element(u).width(),parseInt(n.windowWidth)>1200?(n.table1ColumnPriority1=!0,n.table1ColumnPriority2=!0,n.table1ColumnPriority3=!0,n.table1ColumnPriority4=!0,n.table1ColumnPriority5=!0,n.table1ColumnPriority6=!0):(n.table1ColumnPriority1=parseInt(n.windowWidth)<320?!1:!0,n.table1ColumnPriority2=parseInt(n.windowWidth)<480?!1:!0,n.table1ColumnPriority3=parseInt(n.windowWidth)<640?!1:!0,n.table1ColumnPriority4=parseInt(n.windowWidth)<800?!1:!0,n.table1ColumnPriority5=parseInt(n.windowWidth)<980?!1:!0,n.table1ColumnPriority6=parseInt(n.windowWidth)<1200?!1:!0)},n.table1ResponsiveTableCheck(),n.table2ColumnToggleClicked=!1,n.table2ResponsiveTableCheck=function(){n.windowWidth=angular.element(u).width(),parseInt(n.windowWidth)>1200?(n.table2ColumnPriority1=!0,n.table2ColumnPriority2=!0,n.table2ColumnPriority3=!0,n.table2ColumnPriority4=!0,n.table2ColumnPriority5=!0,n.table2ColumnPriority6=!0):(n.table2ColumnPriority1=parseInt(n.windowWidth)<320?!1:!0,n.table2ColumnPriority2=parseInt(n.windowWidth)<480?!1:!0,n.table2ColumnPriority3=parseInt(n.windowWidth)<640?!1:!0,n.table2ColumnPriority4=parseInt(n.windowWidth)<800?!1:!0,n.table2ColumnPriority5=parseInt(n.windowWidth)<980?!1:!0,n.table2ColumnPriority6=parseInt(n.windowWidth)<1200?!1:!0)},n.table2ResponsiveTableCheck();var f=angular.element(u);f.bind("resize",function(){n.table1ResponsiveTableCheck(),n.table2ResponsiveTableCheck(),n.$apply()})}])