extend player

block playercontent
  .row
    .col-md-6
      h2 Record: #{player.win}-#{player.lose}
    .col-md-6
      h2 Win Rate: #{(player.win/player.games*100).toFixed(2) || 0.00}%   
  .row
    .col-md-12
      h3 Activity
      p
        button.btn.btn-default#prev <
        button.btn.btn-default#next >
      div#cal-heatmap
  .row
    .col-md-7
      h3 Recent Matches
      table.table#recent
        thead
          tr
           th Match ID
           th Hero
           th Result
           th Game Mode
           th Duration
           th Played
           th K
           th D
           th A
           th: abbr(title=constants.tooltips.status) Status
        each match in player.matches.slice(0,10)
          tr(class= match.player_win ? "success" : "danger")
            td: a(href='/matches/#{match.match_id}')= match.match_id
            - var hero = constants.heroes[match.players[0].hero_id]
            td.hero 
              if hero
                img(src=hero.img, title=hero.localized_name)
              else
                =match.players[0].hero_id
            td= match.player_win ? "Won" : "Lost"
            td= constants.modes[match.game_mode] ? constants.modes[match.game_mode].name : match.game_mode
            td= moment().startOf('day').seconds(match.duration).format("H:mm:ss")
            td= moment.unix(match.start_time + match.duration).fromNow()
            td=match.players[0].kills
            td=match.players[0].deaths
            td=match.players[0].assists
            td=constants.parse_status[match.parse_status]
    .col-md-5(style="margin-top:3em")
      include ads/skyscraper
  .row
    .col-md-12
      h3 Heroes
      table.table#heroes
        thead
          tr
            th Hero
            th Hero Name
            th Games
            th Wins
            th Winrate
        each hero in constants.heroes
          tr
            td.hero
              img(src=hero.img, title=hero.localized_name)
            td 
              =hero.localized_name
            - var entry = player.heroes[hero.id]
            td #{entry ? entry.games : 0}
            td #{entry ? entry.win : 0}
            td #{entry ? (100*entry.win/entry.games).toFixed(2) : 0.00}%      
  .row
    include ads/leaderboard_2
  link(rel="stylesheet", href='//cdn.rawgit.com/kamisama/cal-heatmap/master/cal-heatmap.css')
  script.
    var calData = !{JSON.stringify(player.calheatmap)}
    generateCalHeatmap(calData);